feat: implement API-first settings management and description history tracking

- Migrated settings persistence from localStorage to an API-first approach, ensuring consistency between Electron and web modes.
- Introduced `useSettingsSync` hook for automatic synchronization of settings to the server with debouncing.
- Enhanced feature update logic to track description changes with a history, allowing for better management of feature descriptions.
- Updated various components and services to utilize the new settings structure and description history functionality.
- Removed persist middleware from Zustand store, streamlining state management and improving performance.
This commit is contained in:
webdevcody
2026-01-07 10:05:54 -05:00
parent 1316ead8c8
commit 11accac5ae
22 changed files with 3177 additions and 2262 deletions

View File

@@ -4,6 +4,16 @@
import type { PlanningMode, ThinkingLevel } from './settings.js';
/**
* A single entry in the description history
*/
export interface DescriptionHistoryEntry {
description: string;
timestamp: string; // ISO date string
source: 'initial' | 'enhance' | 'edit'; // What triggered this version
enhancementMode?: 'improve' | 'technical' | 'simplify' | 'acceptance'; // Only for 'enhance' source
}
export interface FeatureImagePath {
id: string;
path: string;
@@ -54,6 +64,7 @@ export interface Feature {
error?: string;
summary?: string;
startedAt?: string;
descriptionHistory?: DescriptionHistoryEntry[]; // History of description changes
[key: string]: unknown; // Keep catch-all for extensibility
}

View File

@@ -20,7 +20,13 @@ export type {
} from './provider.js';
// Feature types
export type { Feature, FeatureImagePath, FeatureTextFilePath, FeatureStatus } from './feature.js';
export type {
Feature,
FeatureImagePath,
FeatureTextFilePath,
FeatureStatus,
DescriptionHistoryEntry,
} from './feature.js';
// Session types
export type {

View File

@@ -387,6 +387,14 @@ export interface GlobalSettings {
/** Version number for schema migration */
version: number;
// Onboarding / Setup Wizard
/** Whether the initial setup wizard has been completed */
setupComplete: boolean;
/** Whether this is the first run experience (used by UI onboarding) */
isFirstRun: boolean;
/** Whether Claude setup was skipped during onboarding */
skipClaudeSetup: boolean;
// Theme Configuration
/** Currently selected theme */
theme: ThemeMode;
@@ -452,6 +460,8 @@ export interface GlobalSettings {
projects: ProjectRef[];
/** Projects in trash/recycle bin */
trashedProjects: TrashedProjectRef[];
/** ID of the currently open project (null if none) */
currentProjectId: string | null;
/** History of recently opened project IDs */
projectHistory: string[];
/** Current position in project history for navigation */
@@ -608,7 +618,7 @@ export const DEFAULT_PHASE_MODELS: PhaseModelConfig = {
};
/** Current version of the global settings schema */
export const SETTINGS_VERSION = 3;
export const SETTINGS_VERSION = 4;
/** Current version of the credentials schema */
export const CREDENTIALS_VERSION = 1;
/** Current version of the project settings schema */
@@ -641,6 +651,9 @@ export const DEFAULT_KEYBOARD_SHORTCUTS: KeyboardShortcuts = {
/** Default global settings used when no settings file exists */
export const DEFAULT_GLOBAL_SETTINGS: GlobalSettings = {
version: SETTINGS_VERSION,
setupComplete: false,
isFirstRun: true,
skipClaudeSetup: false,
theme: 'dark',
sidebarOpen: true,
chatHistoryOpen: false,
@@ -664,6 +677,7 @@ export const DEFAULT_GLOBAL_SETTINGS: GlobalSettings = {
aiProfiles: [],
projects: [],
trashedProjects: [],
currentProjectId: null,
projectHistory: [],
projectHistoryIndex: -1,
lastProjectDir: undefined,