/** * JSON array-entry merge for hook-config wiring (SMI-5456 Wave 1 Step 5). * * The MCP-server merge (`agent-config-merge.json.ts`) sets a single named * key (`skillsmith`) and so can genuinely conflict with a foreign value at * that key. Hook config is different: harnesses model hooks as an ARRAY of * matcher entries, and we only ever add/update the one entry whose `command` * is our own hook script's absolute path — every other array entry (a * user's own hooks, or entries for other tools) is left untouched. There is * no foreign-entry conflict case for an array append. * * @module @skillsmith/core/install/agent-config-merge.json-array */ import type { MergeResult } from './agent-config-merge.types.js'; /** * Exported for reuse by the Cursor legacy-key cleanup step * (`agent-pack-installer.cursor-hooks.ts`, SMI-5893 Wave 10) — same backup * convention (timestamped `.bak` file in the run's backup dir), needed * outside the normal merge-entry path when mutating a config file for a * reason other than adding/updating our own array entry. */ export declare function writeBackup(sourcePath: string, backupDir: string): string; export interface JsonArrayMergeOptions { path: string; /** Key path to the array (created as `[]` if any segment is missing). */ keyPath: readonly string[]; /** The entry to add/update. */ entry: unknown; /** Identifies "our" entry among existing array items (e.g. by embedded script path). */ isOurEntry: (item: unknown) => boolean; backupDir: string; /** See `MergeOptions.alreadyBackedUpPaths` — claude-code merges hooks AND MCP registration into the same `settings.json` per install run. */ alreadyBackedUpPaths?: Set; /** * Top-level document keys to set when absent, applied before the array * merge and never overwriting an existing value. Used for a sibling * requirement the array merge itself can't express — e.g. Cursor's * `hooks.json` requires a top-level `"version": 1` alongside its `"hooks"` * object (agent-pack-installer.harness.ts's `installCursorHooks`). */ ensureTopLevelDefaults?: Readonly>; } /** Add or update our entry in a JSON array at `keyPath`, leaving every other array item untouched. */ export declare function mergeJsonArrayEntry(opts: JsonArrayMergeOptions): MergeResult; //# sourceMappingURL=agent-config-merge.json-array.d.ts.map