Files
Michael Ramos f4dcdbffd6 Bump version to 0.4.10
- Update CLAUDE.md with new APIs and file structure
- Remove unused helper functions (isAgentSwitchEnabled, isPlanSaveEnabled)
- Sync all package versions to 0.4.10

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 14:24:59 -08:00

50 lines
1.3 KiB
TypeScript

/**
* Plan Save Settings Utility
*
* Manages settings for automatic plan saving after approval/denial.
* Users can configure custom save path or disable saving entirely.
*
* Uses cookies (not localStorage) because each hook invocation runs on a
* random port, and localStorage is scoped by origin including port.
*/
import { storage } from './storage';
const STORAGE_KEY_ENABLED = 'plannotator-save-enabled';
const STORAGE_KEY_PATH = 'plannotator-save-path';
export interface PlanSaveSettings {
enabled: boolean;
customPath: string | null;
}
const DEFAULT_SETTINGS: PlanSaveSettings = {
enabled: true,
customPath: null, // null means use default ~/.plannotator/plans/
};
/**
* Get current plan save settings from storage
*/
export function getPlanSaveSettings(): PlanSaveSettings {
const enabled = storage.getItem(STORAGE_KEY_ENABLED);
const customPath = storage.getItem(STORAGE_KEY_PATH);
return {
enabled: enabled !== 'false', // default to true
customPath: customPath || null,
};
}
/**
* Save plan save settings to storage
*/
export function savePlanSaveSettings(settings: PlanSaveSettings): void {
storage.setItem(STORAGE_KEY_ENABLED, String(settings.enabled));
if (settings.customPath) {
storage.setItem(STORAGE_KEY_PATH, settings.customPath);
} else {
storage.removeItem(STORAGE_KEY_PATH);
}
}