/** * Shared global bootstrap logic for CLEO. * * Contains the shared functions used by BOTH: * - `bin/postinstall.js` (npm postinstall hook) * - `cleo install-global` CLI command * * This is the single source of truth for global setup operations. * This is the SSoT — postinstall and self-update both delegate here. * * @task T5267 */ /** Result tracking arrays passed through each bootstrap step. */ export interface BootstrapContext { created: string[]; warnings: string[]; isDryRun: boolean; } /** Options for bootstrapGlobalCleo. */ export interface BootstrapOptions { /** Preview changes without applying. */ dryRun?: boolean; /** Override package root for template/skill discovery. */ packageRoot?: string; } /** * Bootstrap the global CLEO directory structure and install templates. * * Creates: * - ~/.local/share/cleo/templates/CLEO-INJECTION.md (XDG primary) * - ~/.cleo/templates/CLEO-INJECTION.md (legacy sync) * - ~/.agents/AGENTS.md with CAAMP injection block * * This is idempotent — safe to call multiple times. */ export declare function bootstrapGlobalCleo(options?: BootstrapOptions): Promise; /** * Ensure `~/.cleo` is a symlink (or junction on Windows) pointing to the * canonical OS-appropriate CLEO data directory (`getCleoHome()`). * * This is the keystone of CLEO's cross-OS layout: * * Physical canonical storage (OS-specific via env-paths): * Linux → `~/.local/share/cleo/` * macOS → `~/Library/Application Support/cleo/` * Windows → `%LOCALAPPDATA%\cleo\Data\` * * Universal reference path (identical on every OS): * `~/.cleo/` (symlink / junction) * * With this symlink in place, an injection reference like * `@~/.cleo/templates/CLEO-INJECTION.md` resolves correctly on every OS * without the caller having to know the OS-specific canonical path. All * internal code writing to `join(homedir(), '.cleo', …)` also transparently * routes to the canonical location. * * Behaviour: * - If `~/.cleo` does not exist → create the symlink. * - If it is already the correct symlink → no-op. * - If it is a symlink to a wrong target → warn; do not modify. * - If it is a real directory with files → move to `~/.cleo.bak-` * and create the symlink (user * informed via ctx.created). * - Errors are non-fatal — bootstrap continues with a warning. */ export declare function ensureCleoSymlink(ctx: BootstrapContext): Promise; /** * No-op. Kept for API compatibility. */ export declare function installMcpToProviders(_ctx: BootstrapContext): Promise; /** * Install CLEO core skills globally via CAAMP. */ export declare function installSkillsGlobally(ctx: BootstrapContext): Promise; /** * Seed the global CANT agents directory from the bundled seed-agents. * * Idempotently copies `.cant` persona files from the `@cleocode/agents` * package's `seed-agents/` directory into * `{cleoHome}/cant/agents/` (typically `~/.local/share/cleo/cant/agents/`). * * Without this step, a fresh `npm install -g @cleocode/cleo` leaves the * global CANT agents directory empty, and `cleo orchestrate spawn` has no * personas to resolve against. The post-install hook calls this step so the * ship-surface personas (per ADR-055 D032: `cleo-subagent` universal base * plus the four generic role templates under `seed-agents/`) are available * immediately. * * Seed-dir resolution is delegated to {@link resolveSeedAgentsDir} in * `init.ts` so both the project-scoped `cleo init --install-seed-agents` path * and this global path share the same multi-candidate lookup (monorepo, * node_modules, bundled CLI dist). * * Behaviour: * - Existing files in the global target are preserved (never overwritten). * - Missing seed-dir is a warning, not a failure — keeps postinstall * resilient when the agents package isn't yet linked. * - Dry-run mode records the planned action without touching the FS. * * @param ctx - Bootstrap context for recording created/warnings entries. * * @task T889 / T897 / W2-5 */ export declare function installSeedAgentsGlobally(ctx: BootstrapContext): Promise; /** * Populate the nexus.db `sigils` table with one row per canonical CANT agent. * * Runs after seed-agents installation so the `sigils` rows reference the * just-installed .cant files. Idempotent — re-running the bootstrap will * upsert in place. Failures are reported as warnings rather than aborting * the bootstrap, because a missing sigils table is recoverable: callers can * always run `cleo nexus sigil sync` later. * * Skipped during dry-run because the sync touches the live nexus.db. * * @param ctx - Bootstrap context for recording created/warnings entries. * * @task T1386 * @epic T1148 */ export declare function syncCanonicalSigilsStep(ctx: BootstrapContext): Promise; /** * Combined bootstrap health + dependency verification result. * * Produced by {@link verifyBootstrapComplete} and intended for consumers * such as `postinstall.js` and `cleo install-global` that need a single * aggregated view of system readiness after bootstrap completes. */ export interface BootstrapVerificationResult { /** `true` when both bootstrap injection-chain health and all required dependencies are healthy. */ complete: boolean; /** `true` when the injection-chain health checks (template files, AGENTS.md) all pass. */ bootstrapHealthy: boolean; /** `true` when every `required` dependency is healthy (see {@link DependencyReport.allRequiredMet}). */ dependenciesHealthy: boolean; /** Human-readable failure descriptions from both the injection-chain and dependency checks. */ failures: string[]; /** Non-fatal advisory messages (optional deps missing, template version skew, etc.). */ warnings: string[]; } /** * Run both injection-chain health verification and full dependency checks after bootstrap. * * Combines: * 1. Injection-chain health (XDG template, legacy template version sync, AGENTS.md reference, * orphaned content detection) — delegated to the internal {@link verifyBootstrapHealth}. * 2. All registered runtime dependencies — delegated to {@link checkAllDependencies} from * `./system/dependencies.js`. * * This function is intentionally non-throwing. Every error is captured and surfaced through * the returned {@link BootstrapVerificationResult} so callers (postinstall, CLI commands) can * decide how to present failures without crashing the install process. * * @returns A {@link BootstrapVerificationResult} aggregating both checks. */ export declare function verifyBootstrapComplete(): Promise; //# sourceMappingURL=bootstrap.d.ts.map