/** * Start Vibing Stacks — Migrate (v2 — smart, idempotent, settings-aware) * * Compares installed vs bundled versions for skills, agents, hooks, commands AND memories. * Skills: copies the full skill folder (SKILL.md + reference/, TEMPLATE.md, …), * not only SKILL.md — missing companions mark the skill outdated. * Also reconciles runtime artefacts that earlier migrate versions ignored: * * - hooks: parsed via `// @sv-version: x.y.z` header. Legacy installs (no tag) * are skipped with a "needs-update-legacy" warning unless `--force-hooks` is * passed (which makes a `.bak` copy before overwriting). * - commands: same `version:` frontmatter contract as skills/agents. * - memories: `.md` files in `stacks/_shared/memories/` with `version:` frontmatter; * they are copied into `.claude/memories/` and auto-added to `settings.json#context.memory_files`. * - .claude/settings.json — patched idempotently to ensure the bundled hook * chain (SessionStart / UserPromptSubmit / PreToolUse / PostToolUse / Stop / * SessionEnd) is wired, plus high-reasoning defaults `effortLevel: "xhigh"` * and `permissions.defaultMode: "plan"` (only when MISSING — user choices are * never clobbered). Existing entries are preserved; only missing entries * are appended. Atomic write (.tmp + rename). * - .claude/state/ — runtime layout for multi-instance coordination is * auto-created and the `_state.README.md` is staged as `.claude/state/README.md`. * - .gitignore — `.claude/state/` is appended if not already covered. */ type Status = 'missing' | 'outdated' | 'current' | 'ahead' | 'modified-no-version' | 'needs-update-legacy'; export interface MigrateItem { kind: 'skill' | 'agent' | 'hook' | 'command' | 'memory'; name: string; source: string; target: string; bundledVersion: string; installedVersion: string | null; status: Status; } export interface MigrateOptions { apply: boolean; scope?: 'skills' | 'agents' | 'hooks' | 'commands' | 'memories' | 'all'; forceHooks?: boolean; /** Multi-target: claude | kimi | grok | cursor | all (default all) */ target?: 'claude' | 'kimi' | 'grok' | 'cursor' | 'all'; /** Copy/refresh `.claude/memory-optimization/` (MOP) */ withMemoryOptimization?: boolean; } export declare function planMigration(projectDir: string, opts: MigrateOptions): MigrateItem[]; interface SettingsPatchReport { added: string[]; alreadyPresent: string[]; fileExisted: boolean; error?: string; } export declare function patchSettings(projectDir: string, dryRun: boolean): SettingsPatchReport; interface RuntimeReport { created: string[]; copied: string[]; gitignoreUpdated: boolean; } export declare function ensureRuntimeArtefacts(projectDir: string, dryRun: boolean): RuntimeReport; export declare function runMigrate(projectDir: string, opts: MigrateOptions): Promise; export {};