feat(KB-185): add global/project settings hierarchy with scope-aware UI
- Add GlobalSettingsStore with file-based storage in ~/.pi/kb/settings.json - Implement two-tier hierarchy: global (user prefs) and project (.kb/config.json) - Update TaskStore to merge settings with project overriding global - Add API endpoints: GET/PUT /api/settings/global and GET /api/settings/scopes - Add scope indicators (🌐 global, 📁 project) to settings modal sidebar - Implement scope-aware save: only save active scope, reject global-only fields - Add frontend API functions for global settings operations - Add tests for GlobalSettingsStore, settings routes, and SettingsModal scopes - Create changeset for the new settings hierarchy feature - Update AGENTS.md with settings hierarchy documentation
This commit is contained in:
@@ -7,6 +7,8 @@ import type {
|
||||
Column,
|
||||
MergeResult,
|
||||
Settings,
|
||||
GlobalSettings,
|
||||
ProjectSettings,
|
||||
BatchStatusResult,
|
||||
BatchStatusResponse,
|
||||
BatchStatusEntry,
|
||||
@@ -198,6 +200,24 @@ export function updateSettings(settings: Partial<Settings>): Promise<Settings> {
|
||||
});
|
||||
}
|
||||
|
||||
/** Fetch global (user-level) settings from ~/.pi/kb/settings.json */
|
||||
export function fetchGlobalSettings(): Promise<GlobalSettings> {
|
||||
return api<GlobalSettings>("/settings/global");
|
||||
}
|
||||
|
||||
/** Update global (user-level) settings. These persist across all kb projects. */
|
||||
export function updateGlobalSettings(settings: Partial<GlobalSettings>): Promise<Settings> {
|
||||
return api<Settings>("/settings/global", {
|
||||
method: "PUT",
|
||||
body: JSON.stringify(settings),
|
||||
});
|
||||
}
|
||||
|
||||
/** Fetch settings separated by scope: { global, project } */
|
||||
export function fetchSettingsByScope(): Promise<{ global: GlobalSettings; project: Partial<ProjectSettings> }> {
|
||||
return api<{ global: GlobalSettings; project: Partial<ProjectSettings> }>("/settings/scopes");
|
||||
}
|
||||
|
||||
export function testNtfyNotification(): Promise<{ success: boolean }> {
|
||||
return api<{ success: boolean }>("/settings/test-ntfy", {
|
||||
method: "POST",
|
||||
|
||||
Reference in New Issue
Block a user