/** * iter-8: repo-root `.mcp.json` writer for the squad_state MCP entry. * * Background: iter-7 wrote `squad_state_` into the user's HOME * `~/.copilot/mcp-config.json`. That polluted HOME with one entry per * Squad project and required a stale-entry GC that we never built. It * also touched a file outside the project, which is surprising for * `squad init` / `squad upgrade`. * * iter-8 flips it back inside the project: we write `squad_state` to a * repo-root `.mcp.json` under the plain (un-namespaced) `squad_state` * key. Copilot CLI ≥1.0.59 auto-loads `.mcp.json` walking up from cwd to * the git root, so the entry is picked up by bare * `copilot --yolo --autopilot --agent squad ...` invocations with no * wrapper script and no HOME modifications. * * `tombstoneStaleSquadStateInProjectMcp` keeps removing any pre-existing * `squad_state` entry from `.copilot/mcp-config.json` (left over by the * SDK init writer in older Squad versions), so we have exactly one * authoritative `squad_state` definition per project. * * Safety: we refuse to overwrite a malformed `.mcp.json` rather than * silently clobber a user-edited file; other `mcpServers.*` entries are * preserved semantically through the JSON round-trip, and user-supplied * `env` values on the `squad_state` entry survive re-runs. * * @module cli/core/mcp-root */ import type { SquadStateMcpSpec } from './mcp-spec.js'; /** Resolve the repo-root `.mcp.json` path for a Squad project dest. */ export declare function getProjectMcpJsonPath(dest: string): string; export interface EnsureRootResult { written: boolean; key: string; path: string; } /** * Insert/update the `squad_state` entry in the project's repo-root * `.mcp.json`. Preserves all other entries unchanged. * * @param dest Squad project root (absolute or relative). * @param _cliVersion Reserved for forensic metadata (unused — Copilot * CLI does not currently surface extra fields). * @param spec Pinned/insider command + args from * `resolveSquadStateMcpSpec`. */ export declare function ensureSquadStateMcpInRoot(dest: string, _cliVersion: string, spec: SquadStateMcpSpec): EnsureRootResult; export interface TombstoneResult { removed: boolean; path: string; } /** * Remove a stale top-level `squad_state` entry from the project * `.copilot/mcp-config.json` left there by older Squad versions or the * SDK init writer. Preserves all sibling entries. * * Best-effort: silently no-ops on a missing or unparseable file rather * than risking a partial overwrite of user-managed MCP config. */ export declare function tombstoneStaleSquadStateInProjectMcp(dest: string): TombstoneResult; /** * Pin `squad_state` to user-level `~/.copilot/mcp-config.json` so that * external `copilot -p` invocations (which skip workspace `.mcp.json` due * to the folder-trust security gate) still have access to squad_state tools. * * Unlike the repo-root writer, this writes a SINGLE entry keyed by the * project's absolute path hash to avoid collisions when multiple Squad * projects coexist. The key format is `squad_state_`. * * Best-effort: silently no-ops on parse failure to avoid corrupting the * user's hand-edited config. */ export declare function ensureSquadStateMcpInUserConfig(dest: string, spec: SquadStateMcpSpec): EnsureRootResult; //# sourceMappingURL=mcp-root.d.ts.map