- Add a project storage utility with scoped key helpers and key inventories for global vs project state - Scope dashboard/task view, list preferences, quick-entry drafts, agent/tree state, terminal tabs, usage view, and modal draft persistence to projectId - Reload persisted UI state when project context changes so per-project settings and drafts do not leak across projects - Update and expand dashboard tests, including new projectStorage coverage and scoped persistence regression fixes
49 lines
1.6 KiB
TypeScript
49 lines
1.6 KiB
TypeScript
import { getScopedItem, removeScopedItem, setScopedItem } from "../utils/projectStorage";
|
|
|
|
// Storage keys — each modal type has independent storage
|
|
export const STORED_PLANNING_KEY = "kb-planning-last-description";
|
|
export const STORED_SUBTASK_KEY = "kb-subtask-last-description";
|
|
export const STORED_MISSION_KEY = "kb-mission-last-goal";
|
|
|
|
// Planning persistence
|
|
|
|
export function savePlanningDescription(description: string, projectId?: string): void {
|
|
setScopedItem(STORED_PLANNING_KEY, description, projectId);
|
|
}
|
|
|
|
export function getPlanningDescription(projectId?: string): string {
|
|
return getScopedItem(STORED_PLANNING_KEY, projectId) || "";
|
|
}
|
|
|
|
export function clearPlanningDescription(projectId?: string): void {
|
|
removeScopedItem(STORED_PLANNING_KEY, projectId);
|
|
}
|
|
|
|
// Subtask persistence
|
|
|
|
export function saveSubtaskDescription(description: string, projectId?: string): void {
|
|
setScopedItem(STORED_SUBTASK_KEY, description, projectId);
|
|
}
|
|
|
|
export function getSubtaskDescription(projectId?: string): string {
|
|
return getScopedItem(STORED_SUBTASK_KEY, projectId) || "";
|
|
}
|
|
|
|
export function clearSubtaskDescription(projectId?: string): void {
|
|
removeScopedItem(STORED_SUBTASK_KEY, projectId);
|
|
}
|
|
|
|
// Mission persistence
|
|
|
|
export function saveMissionGoal(goal: string, projectId?: string): void {
|
|
setScopedItem(STORED_MISSION_KEY, goal, projectId);
|
|
}
|
|
|
|
export function getMissionGoal(projectId?: string): string {
|
|
return getScopedItem(STORED_MISSION_KEY, projectId) || "";
|
|
}
|
|
|
|
export function clearMissionGoal(projectId?: string): void {
|
|
removeScopedItem(STORED_MISSION_KEY, projectId);
|
|
}
|