/** * Squad upgrade command — overwrites squad-owned files, runs migrations * Zero-dep implementation using Node.js stdlib only * @module cli/core/upgrade */ import { type SquadStateMcpSpec } from './mcp-spec.js'; export { resolveSquadStateMcpSpec } from './mcp-spec.js'; /** * Returns true if the version looks like a local dev build or unpublished * pre-release that cannot be resolved from the public npm registry. * Guards against writing unresolvable version strings into MCP config * (see #1204). */ export declare function isLocalOrUnpublishedVersion(version: string): boolean; export interface UpgradeOptions { migrateDirectory?: boolean; self?: boolean; force?: boolean; /** When --self, install the insider (prerelease) tag instead of latest. */ insider?: boolean; /** Preview what upgrade would change without writing. */ dryRun?: boolean; } export interface UpdateInfo { fromVersion: string; toVersion: string; filesUpdated: string[]; migrationsRun: string[]; } /** * Ensure .gitattributes has required merge=union rules (idempotent) */ export declare function ensureGitattributes(dest: string): string[]; /** * Ensure .gitignore has required entries (idempotent). * Skips entries already covered by a parent path (e.g. `.squad/` covers `.squad/log/`). */ export declare function ensureGitignore(dest: string): string[]; /** * Create missing infrastructure directories */ export declare function ensureDirectories(dest: string): string[]; /** * Scaffold default casting files (registry.json, policy.json, history.json) * if they don't already exist. Sources content from shipped templates when * available, falling back to inline JSON defaults. */ export declare function ensureCastingDefaults(dest: string, templatesDir?: string): string[]; /** * Re-run the ESM import patcher against the project's own node_modules (#1190). * * npm runs postinstall with cwd inside the installed package dir, so a global * `npm install -g` only ever patches the global copy — the consumer repo's * node_modules stays unpatched and `squad doctor` keeps failing its * vscode-jsonrpc / copilot-sdk checks there. Loading the patch script and * pointing it at `/node_modules` closes that gap on every upgrade. * * Returns true when at least one file was patched. */ export declare function ensureEsmImportsPatched(dest: string): Promise; /** Human-readable single-line description of an McpSpec for success() messages. */ export declare function describeMcpSpec(spec: SquadStateMcpSpec): string; export declare function ensureMemoryGovernanceUpgradeDefaults(dest: string): string[]; /** * Scaffold always-on built-in agent charters (Rai, Fact Checker) that ship * as templates but may be missing from older squads. Idempotent — only writes * when the agent directory is absent. Never overwrites existing charters or * history. Sources charter content from the shipped `templates/{name}-charter.md` * files when available, falling back to a minimal placeholder otherwise. * * Scribe and Ralph are intentionally NOT scaffolded here — they should already * exist in any squad that ran a prior init, and their charters are inlined in * cast.ts (no shipped template file). Adding them here would risk overwriting * customized versions on legacy squads. * * @param dest Root directory containing .squad/ * @param templatesDir Directory containing shipped charter templates * @returns Paths (relative to dest) of created agent files */ export declare function ensureBuiltinAgents(dest: string, templatesDir: string): string[]; /** * Install user-owned template files that are missing on disk. * * Iterates TEMPLATE_MANIFEST entries with `overwriteOnUpgrade: false` and * copies each source template to its destination only if the destination * does not yet exist. Existing user-customized files are never touched. * * Called during both `squad init` (post-SDK scaffolding) and `squad upgrade` * (via runEnsureChecks) so that newly-added user-owned templates are installed * for existing squads on upgrade without overwriting any prior customization. */ export declare function ensureUserOwnedTemplates(dest: string, templatesDir: string): string[]; /** * Run the upgrade command */ export declare function runUpgrade(dest: string, options?: UpgradeOptions): Promise; export interface SelfUpgradeOptions { insider?: boolean; force?: boolean; } /** * Self-upgrade the Squad CLI package via the detected package manager. * * Detects whether the CLI was installed via npm, pnpm, or yarn and runs the * appropriate global install command. On EACCES errors, suggests `sudo` with * the detected installer name. */ export declare function selfUpgradeCli(options?: SelfUpgradeOptions): Promise; //# sourceMappingURL=upgrade.d.ts.map