argos-harness 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/hooks/argos-guard-destructive.sh +1 -1
- package/assets/managed/disciplina-skills.md +11 -0
- package/assets/managed/formato-respuesta.md +2 -2
- package/assets/managed/identidad.md +7 -7
- package/assets/managed/operaciones-seguras.md +6 -6
- package/assets/output-styles/argos.md +12 -12
- package/dist/commands/adopt.d.ts +41 -1
- package/dist/commands/adopt.d.ts.map +1 -1
- package/dist/commands/adopt.js +243 -6
- package/dist/commands/adopt.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +36 -2
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/init.d.ts +56 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +330 -64
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/remove.d.ts +24 -0
- package/dist/commands/remove.d.ts.map +1 -1
- package/dist/commands/remove.js +94 -4
- package/dist/commands/remove.js.map +1 -1
- package/dist/commands/workspace.d.ts +32 -0
- package/dist/commands/workspace.d.ts.map +1 -1
- package/dist/commands/workspace.js +97 -3
- package/dist/commands/workspace.js.map +1 -1
- package/dist/lib/assets.d.ts +5 -3
- package/dist/lib/assets.d.ts.map +1 -1
- package/dist/lib/assets.js +5 -2
- package/dist/lib/assets.js.map +1 -1
- package/dist/lib/managed-files.d.ts +19 -5
- package/dist/lib/managed-files.d.ts.map +1 -1
- package/dist/lib/managed-files.js +18 -6
- package/dist/lib/managed-files.js.map +1 -1
- package/dist/lib/prompter.d.ts +63 -0
- package/dist/lib/prompter.d.ts.map +1 -0
- package/dist/lib/prompter.js +30 -0
- package/dist/lib/prompter.js.map +1 -0
- package/dist/lib/settings-merge.d.ts +78 -0
- package/dist/lib/settings-merge.d.ts.map +1 -1
- package/dist/lib/settings-merge.js +204 -0
- package/dist/lib/settings-merge.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/init.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport pc from \"picocolors\";\nimport {\n listAgentIds,\n listSkillFiles,\n listSkillIds,\n MANAGED_BLOCK_IDS,\n readAsset,\n resolveAssetsDir,\n} from \"../lib/assets.js\";\nimport { writeFileAtomic } from \"../lib/atomic-write.js\";\nimport { createBackup } from \"../lib/backup.js\";\nimport { injectBlock, listBlocks } from \"../lib/markers.js\";\nimport {\n type FileStatus,\n hasArgosFileMarker,\n writeManagedFile,\n writeManagedShellFile,\n} from \"../lib/managed-files.js\";\nimport { resolveArgosHome, resolveClaudeDir } from \"../lib/paths.js\";\nimport { type ArgosHookSpec, mergeHooksIntoSettings } from \"../lib/settings-merge.js\";\nimport { readCliVersion } from \"../lib/version.js\";\n\n/**\n * Ids (basenames under assets/hooks/) of the 2 global hooks argos init\n * installs. See spec 0003 \"Hooks globales parametrizados\".\n */\nconst HOOK_IDS = [\"argos-guard-destructive\", \"argos-quality-gate\"] as const;\n\n/**\n * Outer Claude Code hook timeout (seconds) for argos-quality-gate.sh. Fixed\n * rather than derived from $ARGOS_GATE_TIMEOUT_MS: that env var is read\n * inside the hook at COMMIT time (whatever env the Claude Code session has),\n * not at `argos init` time, so there's nothing meaningful to read here. 600s\n * comfortably covers the hook's own default inner bound (300s) with 2x\n * headroom; a repo whose gate legitimately needs longer than ~590s needs to\n * bump this constant (and rerun `argos init`) alongside its own\n * $ARGOS_GATE_TIMEOUT_MS — not automated in v1.\n */\nconst QUALITY_GATE_OUTER_TIMEOUT_SECONDS = 600;\n\nexport type InitRowStatus = FileStatus | \"error\";\n\nexport interface InitRow {\n path: string;\n status: InitRowStatus;\n detail?: string;\n}\n\nexport interface InitOptions {\n language?: \"es\" | \"en\";\n}\n\nexport interface InitReport {\n rows: InitRow[];\n summary: string;\n exitCode: 0 | 1;\n backupPath?: string;\n}\n\nconst STATUS_COUNT_ORDER: InitRowStatus[] = [\"created\", \"updated\", \"unchanged\", \"skipped-foreign\", \"error\"];\n\nfunction summarize(rows: InitRow[]): string {\n const counts: Record<InitRowStatus, number> = {\n created: 0,\n updated: 0,\n unchanged: 0,\n \"skipped-foreign\": 0,\n error: 0,\n };\n for (const row of rows) counts[row.status]++;\n\n const parts = STATUS_COUNT_ORDER.filter((s) => counts[s] > 0).map((s) => `${counts[s]} ${s}`);\n return `argos init: ${parts.join(\", \")}.`;\n}\n\nfunction errorMessage(err: unknown): string {\n return err instanceof Error ? err.message : String(err);\n}\n\n/**\n * Write a plain (unmarked) supporting file belonging to an already\n * ownership-checked skill directory — e.g. `references/core.md`,\n * `phases/0-product.md`. Unlike `writeManagedFile`, this never carries or\n * checks the `argos:file` marker itself: ownership for the whole skill\n * directory is decided once, up front, from its `SKILL.md` (see the skills\n * loop in `runInit`), so per-file marker bookkeeping here would be\n * redundant. Reports the same created/updated/unchanged statuses.\n */\nfunction writePlainFile(destPath: string, sourceContent: string): FileStatus {\n if (!existsSync(destPath)) {\n mkdirSync(dirname(destPath), { recursive: true });\n writeFileAtomic(destPath, sourceContent);\n return \"created\";\n }\n\n const current = readFileSync(destPath, \"utf-8\");\n if (current === sourceContent) return \"unchanged\";\n\n writeFileAtomic(destPath, sourceContent);\n return \"updated\";\n}\n\n/** Inject one managed CLAUDE.md block, reporting created/updated/unchanged. */\nfunction injectAndReport(claudeMd: string, id: string, version: string, content: string) {\n const hadBlock = listBlocks(claudeMd).some((b) => b.id === id);\n const after = injectBlock(claudeMd, id, version, content);\n const status: FileStatus = after === claudeMd ? \"unchanged\" : hadBlock ? \"updated\" : \"created\";\n return { claudeMd: after, status };\n}\n\n/**\n * Core, testable implementation of `argos init`: installs the Argos engine\n * (CLAUDE.md managed blocks + agents/skills/output-style full files +\n * `~/.argos/global.json`) into `resolveClaudeDir()`. Pure function of the\n * filesystem — no process.exit, no console output.\n */\nexport function runInit(options: InitOptions = {}): InitReport {\n const language = options.language ?? \"es\";\n const version = readCliVersion();\n const claudeDir = resolveClaudeDir();\n const assetsDir = resolveAssetsDir();\n const rows: InitRow[] = [];\n\n // Backup everything Argos is about to touch, before any write happens. A\n // failed backup means we have no safety net for what's about to be\n // mutated, so it aborts the whole run right here — every subsequent\n // mutation step is skipped, nothing gets touched.\n let backupPath: string | undefined;\n try {\n backupPath = createBackup(claudeDir, [\"CLAUDE.md\", \"agents\", \"skills\", \"output-styles\", \"hooks\", \"settings.json\"]);\n } catch (err) {\n const detail = errorMessage(err);\n rows.push({ path: \"backup\", status: \"error\", detail });\n return { rows, summary: `backup falló — no se tocó nada (${detail}).`, exitCode: 1 };\n }\n\n // 1. CLAUDE.md — 5 managed blocks, in order.\n const claudeMdPath = join(claudeDir, \"CLAUDE.md\");\n let claudeMd = existsSync(claudeMdPath) ? readFileSync(claudeMdPath, \"utf-8\") : \"\";\n const blockResults: { id: string; status: FileStatus }[] = [];\n for (const id of MANAGED_BLOCK_IDS) {\n const content = readAsset(assetsDir, \"managed\", `${id}.md`).replace(/\\n$/, \"\");\n const result = injectAndReport(claudeMd, id, version, content);\n claudeMd = result.claudeMd;\n blockResults.push({ id, status: result.status });\n }\n try {\n mkdirSync(claudeDir, { recursive: true });\n writeFileAtomic(claudeMdPath, claudeMd);\n for (const b of blockResults) rows.push({ path: `CLAUDE.md#${b.id}`, status: b.status });\n } catch (err) {\n const detail = errorMessage(err);\n for (const id of MANAGED_BLOCK_IDS) rows.push({ path: `CLAUDE.md#${id}`, status: \"error\", detail });\n }\n\n // 2. Full-file assets: output-style, agents.\n const fullFiles: string[][] = [\n [\"output-styles\", \"argos.md\"],\n ...listAgentIds(assetsDir).map((id) => [\"agents\", `${id}.md`]),\n ];\n for (const relPath of fullFiles) {\n const source = readAsset(assetsDir, ...relPath);\n const dest = join(claudeDir, ...relPath);\n try {\n const status = writeManagedFile(dest, source, version);\n rows.push({ path: join(...relPath), status });\n } catch (err) {\n rows.push({ path: join(...relPath), status: \"error\", detail: errorMessage(err) });\n }\n }\n\n // 2a. Skills: each skill directory (SKILL.md plus any `references/`,\n // `phases/`, `assets/`, etc. it ships) is installed as a single unit.\n // Ownership sentinel is SKILL.md's `argos:file` marker:\n // - SKILL.md absent, or present WITH the marker → install/update every\n // file the skill ships.\n // - SKILL.md present WITHOUT the marker (foreign/user-modified) → skip\n // every file under that skill dir, untouched — same policy as a single\n // foreign full-file asset above, extended to the whole directory.\n for (const skillId of listSkillIds(assetsDir)) {\n const skillMdDest = join(claudeDir, \"skills\", skillId, \"SKILL.md\");\n const isForeignSkill = existsSync(skillMdDest) && !hasArgosFileMarker(readFileSync(skillMdDest, \"utf-8\"));\n\n for (const relFile of listSkillFiles(assetsDir, skillId)) {\n const relParts = relFile.split(\"/\");\n const relPath = join(\"skills\", skillId, ...relParts);\n\n if (isForeignSkill) {\n rows.push({ path: relPath, status: \"skipped-foreign\" });\n continue;\n }\n\n const source = readAsset(assetsDir, \"skills\", skillId, ...relParts);\n const dest = join(claudeDir, \"skills\", skillId, ...relParts);\n try {\n const status = relFile === \"SKILL.md\" ? writeManagedFile(dest, source, version) : writePlainFile(dest, source);\n rows.push({ path: relPath, status });\n } catch (err) {\n rows.push({ path: relPath, status: \"error\", detail: errorMessage(err) });\n }\n }\n }\n\n // 2b. Global hooks: full-file shell assets, own shell-comment marker,\n // chmod +x. Same skipped-foreign policy as the full-file assets above.\n // Track which hooks actually landed on disk successfully — a hook whose\n // write threw must NEVER get a settings.json entry (see 2c below): a\n // dangling PreToolUse entry pointing at a script that isn't there hard-\n // blocks every subsequent Bash call.\n const hookWriteFailed = new Map<(typeof HOOK_IDS)[number], boolean>();\n for (const id of HOOK_IDS) {\n const relPath = [\"hooks\", `${id}.sh`];\n const source = readAsset(assetsDir, ...relPath);\n const dest = join(claudeDir, ...relPath);\n try {\n const status = writeManagedShellFile(dest, source, version);\n rows.push({ path: join(...relPath), status });\n hookWriteFailed.set(id, false);\n } catch (err) {\n rows.push({ path: join(...relPath), status: \"error\", detail: errorMessage(err) });\n hookWriteFailed.set(id, true);\n }\n }\n\n // 2c. settings.json — surgical merge of the 2 PreToolUse hook entries.\n // Only writes/updates entries whose command targets one of the 2 scripts\n // above; every other key and hook in the user's settings.json is left\n // untouched (see lib/settings-merge.ts). Only hooks whose script write\n // actually succeeded get an entry built for them at all.\n const settingsPath = join(claudeDir, \"settings.json\");\n const allHookSpecs: Record<(typeof HOOK_IDS)[number], ArgosHookSpec> = {\n \"argos-guard-destructive\": {\n scriptPath: join(claudeDir, \"hooks\", \"argos-guard-destructive.sh\"),\n matcher: \"Bash\",\n timeout: 10,\n statusMessage: \"argos: guard-destructive\",\n },\n \"argos-quality-gate\": {\n scriptPath: join(claudeDir, \"hooks\", \"argos-quality-gate.sh\"),\n matcher: \"Bash\",\n timeout: QUALITY_GATE_OUTER_TIMEOUT_SECONDS,\n statusMessage: \"argos: quality-gate\",\n },\n };\n const hookSpecs: ArgosHookSpec[] = HOOK_IDS.filter((id) => !hookWriteFailed.get(id)).map((id) => allHookSpecs[id]);\n // Any hook whose write just failed also gets its (possibly pre-existing,\n // from an earlier successful run) settings.json entry stripped out — a\n // script that's gone or broken must never be left with a live entry.\n const failedScriptPaths = HOOK_IDS.filter((id) => hookWriteFailed.get(id)).map((id) => allHookSpecs[id].scriptPath);\n const mergeResult = mergeHooksIntoSettings(settingsPath, hookSpecs, { removeScriptPaths: failedScriptPaths });\n rows.push({ path: \"settings.json\", status: mergeResult.status, detail: mergeResult.detail });\n\n // 3. ~/.argos/global.json\n const argosHome = resolveArgosHome();\n const globalJsonPath = join(argosHome, \"global.json\");\n const globalJsonContent = `${JSON.stringify({ version, language }, null, 2)}\\n`;\n try {\n const globalJsonExisted = existsSync(globalJsonPath);\n const globalJsonStatus: FileStatus = !globalJsonExisted\n ? \"created\"\n : readFileSync(globalJsonPath, \"utf-8\") === globalJsonContent\n ? \"unchanged\"\n : \"updated\";\n mkdirSync(argosHome, { recursive: true });\n writeFileSync(globalJsonPath, globalJsonContent, \"utf-8\");\n rows.push({ path: \"global.json\", status: globalJsonStatus });\n } catch (err) {\n rows.push({ path: \"global.json\", status: \"error\", detail: errorMessage(err) });\n }\n\n const exitCode: 0 | 1 = rows.some((r) => r.status === \"error\") ? 1 : 0;\n return { rows, summary: summarize(rows), exitCode, backupPath };\n}\n\nexport const initCommand = defineCommand({\n meta: {\n name: \"init\",\n description: \"Install the Argos engine into the global Claude Code home.\",\n },\n args: {\n language: {\n type: \"enum\",\n options: [\"es\", \"en\"],\n default: \"es\",\n description: \"Idioma del motor (global.json).\",\n },\n },\n run({ args }) {\n const report = runInit({ language: args.language as \"es\" | \"en\" });\n\n const colorize = (status: InitRowStatus): string => {\n const padded = status.padEnd(18);\n switch (status) {\n case \"skipped-foreign\":\n return pc.yellow(padded);\n case \"created\":\n return pc.green(padded);\n case \"updated\":\n return pc.cyan(padded);\n case \"error\":\n return pc.red(padded);\n default:\n return pc.dim(padded);\n }\n };\n for (const row of report.rows) {\n const suffix = row.detail ? ` (${row.detail})` : \"\";\n console.log(`${colorize(row.status)} ${row.path}${suffix}`);\n }\n console.log(\"\");\n console.log(report.summary);\n if (report.backupPath) console.log(`backup en ${report.backupPath}`);\n\n process.exit(report.exitCode);\n },\n});\n"],"names":["defineCommand","existsSync","mkdirSync","readFileSync","writeFileSync","dirname","join","pc","listAgentIds","listSkillFiles","listSkillIds","MANAGED_BLOCK_IDS","readAsset","resolveAssetsDir","writeFileAtomic","createBackup","injectBlock","listBlocks","hasArgosFileMarker","writeManagedFile","writeManagedShellFile","resolveArgosHome","resolveClaudeDir","mergeHooksIntoSettings","readCliVersion","HOOK_IDS","QUALITY_GATE_OUTER_TIMEOUT_SECONDS","STATUS_COUNT_ORDER","summarize","rows","counts","created","updated","unchanged","error","row","status","parts","filter","s","map","errorMessage","err","Error","message","String","writePlainFile","destPath","sourceContent","recursive","current","injectAndReport","claudeMd","id","version","content","hadBlock","some","b","after","runInit","options","language","claudeDir","assetsDir","backupPath","detail","push","path","summary","exitCode","claudeMdPath","blockResults","replace","result","fullFiles","relPath","source","dest","skillId","skillMdDest","isForeignSkill","relFile","relParts","split","hookWriteFailed","Map","set","settingsPath","allHookSpecs","scriptPath","matcher","timeout","statusMessage","hookSpecs","get","failedScriptPaths","mergeResult","removeScriptPaths","argosHome","globalJsonPath","globalJsonContent","JSON","stringify","globalJsonExisted","globalJsonStatus","r","initCommand","meta","name","description","args","type","default","run","report","colorize","padded","padEnd","yellow","green","cyan","red","dim","suffix","console","log","process","exit"],"mappings":"AAAA,SAASA,aAAa,QAAQ,QAAQ;AACtC,SAASC,UAAU,EAAEC,SAAS,EAAEC,YAAY,EAAEC,aAAa,QAAQ,UAAU;AAC7E,SAASC,OAAO,EAAEC,IAAI,QAAQ,YAAY;AAC1C,OAAOC,QAAQ,aAAa;AAC5B,SACEC,YAAY,EACZC,cAAc,EACdC,YAAY,EACZC,iBAAiB,EACjBC,SAAS,EACTC,gBAAgB,QACX,mBAAmB;AAC1B,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,WAAW,EAAEC,UAAU,QAAQ,oBAAoB;AAC5D,SAEEC,kBAAkB,EAClBC,gBAAgB,EAChBC,qBAAqB,QAChB,0BAA0B;AACjC,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,kBAAkB;AACrE,SAA6BC,sBAAsB,QAAQ,2BAA2B;AACtF,SAASC,cAAc,QAAQ,oBAAoB;AAEnD;;;CAGC,GACD,MAAMC,WAAW;IAAC;IAA2B;CAAqB;AAElE;;;;;;;;;CASC,GACD,MAAMC,qCAAqC;AAqB3C,MAAMC,qBAAsC;IAAC;IAAW;IAAW;IAAa;IAAmB;CAAQ;AAE3G,SAASC,UAAUC,IAAe;IAChC,MAAMC,SAAwC;QAC5CC,SAAS;QACTC,SAAS;QACTC,WAAW;QACX,mBAAmB;QACnBC,OAAO;IACT;IACA,KAAK,MAAMC,OAAON,KAAMC,M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jD,UAAU;YACRkD,MAAM;YACNnD,SAAS;gBAAC;gBAAM;aAAK;YACrBoD,SAAS;YACTH,aAAa;QACf;IACF;IACAI,KAAI,EAAEH,IAAI,EAAE;QACV,MAAMI,SAASvD,QAAQ;YAAEE,UAAUiD,KAAKjD,QAAQ;QAAgB;QAEhE,MAAMsD,WAAW,CAAChF;YAChB,MAAMiF,SAASjF,OAAOkF,MAAM,CAAC;YAC7B,OAAQlF;gBACN,KAAK;oBACH,OAAO7B,GAAGgH,MAAM,CAACF;gBACnB,KAAK;oBACH,OAAO9G,GAAGiH,KAAK,CAACH;gBAClB,KAAK;oBACH,OAAO9G,GAAGkH,IAAI,CAACJ;gBACjB,KAAK;oBACH,OAAO9G,GAAGmH,GAAG,CAACL;gBAChB;oBACE,OAAO9G,GAAGoH,GAAG,CAACN;YAClB;QACF;QACA,KAAK,MAAMlF,OAAOgF,OAAOtF,IAAI,CAAE;YAC7B,MAAM+F,SAASzF,IAAI+B,MAAM,GAAG,CAAC,EAAE,EAAE/B,IAAI+B,MAAM,CAAC,CAAC,CAAC,GAAG;YACjD2D,QAAQC,GAAG,CAAC,GAAGV,SAASjF,IAAIC,MAAM,EAAE,CAAC,EAAED,IAAIiC,IAAI,GAAGwD,QAAQ;QAC5D;QACAC,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAACX,OAAO9C,OAAO;QAC1B,IAAI8C,OAAOlD,UAAU,EAAE4D,QAAQC,GAAG,CAAC,CAAC,UAAU,EAAEX,OAAOlD,UAAU,EAAE;QAEnE8D,QAAQC,IAAI,CAACb,OAAO7C,QAAQ;IAC9B;AACF,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../../src/commands/init.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport pc from \"picocolors\";\nimport {\n listAgentIds,\n listSkillFiles,\n listSkillIds,\n MANAGED_BLOCK_IDS,\n readAsset,\n resolveAssetsDir,\n} from \"../lib/assets.js\";\nimport { writeFileAtomic } from \"../lib/atomic-write.js\";\nimport { createBackup } from \"../lib/backup.js\";\nimport { injectBlock, listBlocks } from \"../lib/markers.js\";\nimport {\n type FileStatus,\n hasArgosFileMarker,\n hasArgosShellFileMarker,\n writeManagedFile,\n writeManagedShellFile,\n} from \"../lib/managed-files.js\";\nimport { resolveArgosHome, resolveClaudeDir } from \"../lib/paths.js\";\nimport {\n type ArgosHookSpec,\n applyOutputStylePolicy,\n isNavoriOutputStyle,\n mergeHooksIntoSettings,\n} from \"../lib/settings-merge.js\";\nimport { isInteractive, clackPrompter, type Prompter } from \"../lib/prompter.js\";\nimport { readCliVersion } from \"../lib/version.js\";\n\n/**\n * Ids (basenames under assets/hooks/) of the 2 global hooks argos init\n * installs. See spec 0003 \"Hooks globales parametrizados\".\n */\nconst HOOK_IDS = [\"argos-guard-destructive\", \"argos-quality-gate\"] as const;\n\n/**\n * Outer Claude Code hook timeout (seconds) for argos-quality-gate.sh. Fixed\n * rather than derived from $ARGOS_GATE_TIMEOUT_MS: that env var is read\n * inside the hook at COMMIT time (whatever env the Claude Code session has),\n * not at `argos init` time, so there's nothing meaningful to read here. 600s\n * comfortably covers the hook's own default inner bound (300s) with 2x\n * headroom; a repo whose gate legitimately needs longer than ~590s needs to\n * bump this constant (and rerun `argos init`) alongside its own\n * $ARGOS_GATE_TIMEOUT_MS — not automated in v1.\n */\nconst QUALITY_GATE_OUTER_TIMEOUT_SECONDS = 600;\n\nexport type InitRowStatus = FileStatus | \"error\";\n\nexport interface InitRow {\n path: string;\n status: InitRowStatus;\n detail?: string;\n}\n\nexport interface InitOptions {\n language?: \"es\" | \"en\";\n /**\n * Install the agent full-file assets under `agents/`. Default `true`.\n * Skills are NEVER gated by an option (spec 0004: they load on-demand and\n * trimming them breaks the arsenal), only agents and hooks are.\n */\n installAgents?: boolean;\n /** Install the 2 global hooks (scripts + settings.json entries). Default `true`. */\n installHooks?: boolean;\n /**\n * Whether to take over `settings.json.outputStyle` when it currently\n * points at the predecessor harness's voice (`navori`). Default `true`\n * (unconditional replace — the `--yes`/no-TTY behavior from spec 0004);\n * the interactive wizard passes `false` when the user declines the\n * takeover prompt.\n */\n takeoverNavoriVoice?: boolean;\n /**\n * `argos init --force`: full-file motor assets (skills incl. every\n * manifest subfile, agents, output-styles, hooks) that exist on disk\n * WITHOUT an `argos:file` ownership marker — normally left untouched,\n * reported `skipped-foreign` — get overwritten with the motor version\n * instead, reported `overwritten-foreign`. The marker lands with the\n * write, so a later (non-forced) `init` treats them as owned from then on.\n * Does NOT cross into CLAUDE.md prose (managed-block injection stays\n * own-blocks-only) or foreign `settings.json` entries (surgical merge is\n * unchanged) — force only ever replaces whole files at motor paths.\n * Default `false`.\n */\n force?: boolean;\n}\n\nexport interface InitReport {\n rows: InitRow[];\n summary: string;\n exitCode: 0 | 1;\n backupPath?: string;\n}\n\nconst STATUS_COUNT_ORDER: InitRowStatus[] = [\n \"created\",\n \"updated\",\n \"unchanged\",\n \"skipped-foreign\",\n \"overwritten-foreign\",\n \"error\",\n];\n\nfunction summarize(rows: InitRow[]): string {\n const counts: Record<InitRowStatus, number> = {\n created: 0,\n updated: 0,\n unchanged: 0,\n \"skipped-foreign\": 0,\n \"overwritten-foreign\": 0,\n error: 0,\n };\n for (const row of rows) counts[row.status]++;\n\n const parts = STATUS_COUNT_ORDER.filter((s) => counts[s] > 0).map((s) => `${counts[s]} ${s}`);\n return `argos init: ${parts.join(\", \")}.`;\n}\n\nfunction errorMessage(err: unknown): string {\n return err instanceof Error ? err.message : String(err);\n}\n\n/**\n * Write a plain (unmarked) supporting file belonging to an already\n * ownership-checked skill directory — e.g. `references/core.md`,\n * `phases/0-product.md`. Unlike `writeManagedFile`, this never carries or\n * checks the `argos:file` marker itself: ownership for the whole skill\n * directory is decided once, up front, from its `SKILL.md` (see the skills\n * loop in `runInit`), so per-file marker bookkeeping here would be\n * redundant. Reports the same created/updated/unchanged statuses.\n */\nfunction writePlainFile(destPath: string, sourceContent: string): FileStatus {\n if (!existsSync(destPath)) {\n mkdirSync(dirname(destPath), { recursive: true });\n writeFileAtomic(destPath, sourceContent);\n return \"created\";\n }\n\n const current = readFileSync(destPath, \"utf-8\");\n if (current === sourceContent) return \"unchanged\";\n\n writeFileAtomic(destPath, sourceContent);\n return \"updated\";\n}\n\n/**\n * `--force` counterpart to `writePlainFile`, used only for a supporting file\n * (e.g. `references/core.md`) that lives under a skill directory whose\n * `SKILL.md` was just detected as foreign (no `argos:file` marker). These\n * plain subfiles never carry a marker of their own — the whole skill\n * directory's ownership is decided once from `SKILL.md` (see the skills loop\n * below) — so this always overwrites unconditionally: `overwritten-foreign`\n * when something was already there to replace, `created` when the motor\n * ships a subfile the foreign directory never had.\n */\nfunction writeForcedPlainFile(destPath: string, sourceContent: string): FileStatus {\n const existed = existsSync(destPath);\n if (!existed) mkdirSync(dirname(destPath), { recursive: true });\n writeFileAtomic(destPath, sourceContent);\n return existed ? \"overwritten-foreign\" : \"created\";\n}\n\n/** Inject one managed CLAUDE.md block, reporting created/updated/unchanged. */\nfunction injectAndReport(claudeMd: string, id: string, version: string, content: string) {\n const hadBlock = listBlocks(claudeMd).some((b) => b.id === id);\n const after = injectBlock(claudeMd, id, version, content);\n const status: FileStatus = after === claudeMd ? \"unchanged\" : hadBlock ? \"updated\" : \"created\";\n return { claudeMd: after, status };\n}\n\n/**\n * Core, testable implementation of `argos init`: installs the Argos engine\n * (CLAUDE.md managed blocks + agents/skills/output-style full files +\n * `~/.argos/global.json`) into `resolveClaudeDir()`. Pure function of the\n * filesystem — no process.exit, no console output.\n */\nexport function runInit(options: InitOptions = {}): InitReport {\n const language = options.language ?? \"es\";\n const installAgents = options.installAgents ?? true;\n const installHooks = options.installHooks ?? true;\n const force = options.force ?? false;\n const version = readCliVersion();\n const claudeDir = resolveClaudeDir();\n const assetsDir = resolveAssetsDir();\n const rows: InitRow[] = [];\n\n // Backup everything Argos is about to touch, before any write happens. A\n // failed backup means we have no safety net for what's about to be\n // mutated, so it aborts the whole run right here — every subsequent\n // mutation step is skipped, nothing gets touched.\n let backupPath: string | undefined;\n try {\n backupPath = createBackup(claudeDir, [\"CLAUDE.md\", \"agents\", \"skills\", \"output-styles\", \"hooks\", \"settings.json\"]);\n } catch (err) {\n const detail = errorMessage(err);\n rows.push({ path: \"backup\", status: \"error\", detail });\n return { rows, summary: `backup falló — no se tocó nada (${detail}).`, exitCode: 1 };\n }\n\n // 1. CLAUDE.md — MANAGED_BLOCK_IDS.length managed blocks, in order.\n const claudeMdPath = join(claudeDir, \"CLAUDE.md\");\n let claudeMd = existsSync(claudeMdPath) ? readFileSync(claudeMdPath, \"utf-8\") : \"\";\n const blockResults: { id: string; status: FileStatus }[] = [];\n for (const id of MANAGED_BLOCK_IDS) {\n const content = readAsset(assetsDir, \"managed\", `${id}.md`).replace(/\\n$/, \"\");\n const result = injectAndReport(claudeMd, id, version, content);\n claudeMd = result.claudeMd;\n blockResults.push({ id, status: result.status });\n }\n try {\n mkdirSync(claudeDir, { recursive: true });\n writeFileAtomic(claudeMdPath, claudeMd);\n for (const b of blockResults) rows.push({ path: `CLAUDE.md#${b.id}`, status: b.status });\n } catch (err) {\n const detail = errorMessage(err);\n for (const id of MANAGED_BLOCK_IDS) rows.push({ path: `CLAUDE.md#${id}`, status: \"error\", detail });\n }\n\n // 2. Full-file assets: output-style always, agents gated by the\n // `installAgents` toggle (default true; the wizard's \"agentes sí/no\"\n // step — spec 0004). Skills below are NEVER gated: they load on-demand\n // and trimming the set breaks the arsenal.\n const fullFiles: string[][] = [\n [\"output-styles\", \"argos.md\"],\n ...(installAgents ? listAgentIds(assetsDir).map((id) => [\"agents\", `${id}.md`]) : []),\n ];\n for (const relPath of fullFiles) {\n const source = readAsset(assetsDir, ...relPath);\n const dest = join(claudeDir, ...relPath);\n try {\n const status = writeManagedFile(dest, source, version, { force });\n rows.push({ path: join(...relPath), status });\n } catch (err) {\n rows.push({ path: join(...relPath), status: \"error\", detail: errorMessage(err) });\n }\n }\n\n // 2a. Skills: each skill directory (SKILL.md plus any `references/`,\n // `phases/`, `assets/`, etc. it ships) is installed as a single unit.\n // Ownership sentinel is SKILL.md's `argos:file` marker:\n // - SKILL.md absent, or present WITH the marker → install/update every\n // file the skill ships.\n // - SKILL.md present WITHOUT the marker (foreign/user-modified) → skip\n // every file under that skill dir, untouched — same policy as a single\n // foreign full-file asset above, extended to the whole directory. Under\n // `--force`, every file in that directory is overwritten instead\n // (`overwritten-foreign`) — SKILL.md gets its marker stamped via\n // `writeManagedFile`'s own `force` path, and each plain subfile is\n // force-written via `writeForcedPlainFile` (see its own doc comment).\n for (const skillId of listSkillIds(assetsDir)) {\n const skillMdDest = join(claudeDir, \"skills\", skillId, \"SKILL.md\");\n const isForeignSkill = existsSync(skillMdDest) && !hasArgosFileMarker(readFileSync(skillMdDest, \"utf-8\"));\n\n for (const relFile of listSkillFiles(assetsDir, skillId)) {\n const relParts = relFile.split(\"/\");\n const relPath = join(\"skills\", skillId, ...relParts);\n\n if (isForeignSkill && !force) {\n rows.push({ path: relPath, status: \"skipped-foreign\" });\n continue;\n }\n\n const source = readAsset(assetsDir, \"skills\", skillId, ...relParts);\n const dest = join(claudeDir, \"skills\", skillId, ...relParts);\n try {\n const status =\n relFile === \"SKILL.md\"\n ? writeManagedFile(dest, source, version, { force })\n : isForeignSkill\n ? writeForcedPlainFile(dest, source)\n : writePlainFile(dest, source);\n rows.push({ path: relPath, status });\n } catch (err) {\n rows.push({ path: relPath, status: \"error\", detail: errorMessage(err) });\n }\n }\n }\n\n // 2b. Global hooks: full-file shell assets, own shell-comment marker,\n // chmod +x. Same skipped-foreign policy as the full-file assets above.\n // Track which hooks actually landed on disk successfully — a hook whose\n // write threw must NEVER get a settings.json entry (see 2c below): a\n // dangling PreToolUse entry pointing at a script that isn't there hard-\n // blocks every subsequent Bash call.\n //\n // Gated by the `installHooks` toggle (default true; the wizard's \"hooks\n // sí/no\" step — spec 0004): when disabled, this run neither writes nor\n // touches any pre-existing hook script/settings.json entry — a full\n // uninstall of previously-installed hooks is `argos remove`'s job, not a\n // side effect of toggling this flag off on a later `init` run.\n const hookWriteFailed = new Map<(typeof HOOK_IDS)[number], boolean>();\n if (installHooks) {\n for (const id of HOOK_IDS) {\n const relPath = [\"hooks\", `${id}.sh`];\n const source = readAsset(assetsDir, ...relPath);\n const dest = join(claudeDir, ...relPath);\n try {\n const status = writeManagedShellFile(dest, source, version, { force });\n rows.push({ path: join(...relPath), status });\n hookWriteFailed.set(id, false);\n } catch (err) {\n rows.push({ path: join(...relPath), status: \"error\", detail: errorMessage(err) });\n hookWriteFailed.set(id, true);\n }\n }\n\n // 2c. settings.json — surgical merge of the 2 PreToolUse hook entries.\n // Only writes/updates entries whose command targets one of the 2 scripts\n // above; every other key and hook in the user's settings.json is left\n // untouched (see lib/settings-merge.ts). Only hooks whose script write\n // actually succeeded get an entry built for them at all.\n const settingsPath = join(claudeDir, \"settings.json\");\n const allHookSpecs: Record<(typeof HOOK_IDS)[number], ArgosHookSpec> = {\n \"argos-guard-destructive\": {\n scriptPath: join(claudeDir, \"hooks\", \"argos-guard-destructive.sh\"),\n matcher: \"Bash\",\n timeout: 10,\n statusMessage: \"argos: guard-destructive\",\n },\n \"argos-quality-gate\": {\n scriptPath: join(claudeDir, \"hooks\", \"argos-quality-gate.sh\"),\n matcher: \"Bash\",\n timeout: QUALITY_GATE_OUTER_TIMEOUT_SECONDS,\n statusMessage: \"argos: quality-gate\",\n },\n };\n const hookSpecs: ArgosHookSpec[] = HOOK_IDS.filter((id) => !hookWriteFailed.get(id)).map((id) => allHookSpecs[id]);\n // Any hook whose write just failed also gets its (possibly pre-existing,\n // from an earlier successful run) settings.json entry stripped out — a\n // script that's gone or broken must never be left with a live entry.\n const failedScriptPaths = HOOK_IDS.filter((id) => hookWriteFailed.get(id)).map((id) => allHookSpecs[id].scriptPath);\n const mergeResult = mergeHooksIntoSettings(settingsPath, hookSpecs, { removeScriptPaths: failedScriptPaths });\n rows.push({ path: \"settings.json\", status: mergeResult.status, detail: mergeResult.detail });\n }\n\n // 2d. Voice activation (spec 0004 \"Activación de la voz\"):\n // settings.json.outputStyle. Absent → set to \"Argos\". Matching the\n // predecessor harness's voice (navori) → takeover per\n // `takeoverNavoriVoice` (default true, i.e. unconditional replace under\n // --yes/no-TTY; the interactive wizard passes `false` when the user\n // declines). Any other value → never touched. Reported separately from\n // the hooks settings.json row above so a takeover/foreign-voice detail is\n // never conflated with the hooks merge outcome.\n const outputStyleResult = applyOutputStylePolicy(join(claudeDir, \"settings.json\"), {\n takeoverNavori: options.takeoverNavoriVoice ?? true,\n });\n // \"untouched\" (a foreign non-navori voice, or a declined navori takeover)\n // maps to the same \"skipped-foreign\" row status used elsewhere for\n // \"found something not ours, left it byte-identical\".\n const outputStyleRowStatus: InitRowStatus =\n outputStyleResult.status === \"untouched\" ? \"skipped-foreign\" : outputStyleResult.status;\n rows.push({ path: \"settings.json#outputStyle\", status: outputStyleRowStatus, detail: outputStyleResult.detail });\n\n // 3. ~/.argos/global.json\n const argosHome = resolveArgosHome();\n const globalJsonPath = join(argosHome, \"global.json\");\n const globalJsonContent = `${JSON.stringify({ version, language }, null, 2)}\\n`;\n try {\n const globalJsonExisted = existsSync(globalJsonPath);\n const globalJsonStatus: FileStatus = !globalJsonExisted\n ? \"created\"\n : readFileSync(globalJsonPath, \"utf-8\") === globalJsonContent\n ? \"unchanged\"\n : \"updated\";\n mkdirSync(argosHome, { recursive: true });\n writeFileSync(globalJsonPath, globalJsonContent, \"utf-8\");\n rows.push({ path: \"global.json\", status: globalJsonStatus });\n } catch (err) {\n rows.push({ path: \"global.json\", status: \"error\", detail: errorMessage(err) });\n }\n\n const exitCode: 0 | 1 = rows.some((r) => r.status === \"error\") ? 1 : 0;\n return { rows, summary: summarize(rows), exitCode, backupPath };\n}\n\nexport interface InitInteractiveOptions extends InitOptions {\n /** `--yes`: forces non-interactive behavior even under a real TTY. */\n yes?: boolean;\n /** Injectable for tests; defaults to the real `@clack/prompts`-backed prompter. */\n prompter?: Prompter;\n}\n\n/**\n * A cancelled wizard's report: identical shape to a run that touched\n * nothing. `exitCode: 1` — a cancel is neither a successful write nor\n * silently indistinguishable from one by exit code alone (matches\n * `runWorkspaceLinkInteractive`'s convention for its own cancel paths).\n */\nfunction cancelledInitReport(): InitReport {\n return { rows: [], summary: \"argos init: cancelado — no se tocó nada.\", exitCode: 1 };\n}\n\n/**\n * Read-only peek at `settings.json.outputStyle`, used only to decide whether\n * the interactive wizard needs to ask about a navori takeover. Never throws,\n * never writes — any missing file, unreadable file, or invalid JSON just\n * reads as \"no value\" (`undefined`), which is safely a non-match for\n * `isNavoriOutputStyle`. The actual write happens inside `runInit` via\n * `applyOutputStylePolicy`, which re-does this read itself under its own\n * mtime-guarded contract.\n */\nfunction peekOutputStyleValue(settingsPath: string): unknown {\n if (!existsSync(settingsPath)) return undefined;\n try {\n const parsed: unknown = JSON.parse(readFileSync(settingsPath, \"utf-8\"));\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) return undefined;\n return (parsed as Record<string, unknown>).outputStyle;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Read-only `--force` pre-flight: counts how many on-disk paths at motor\n * paths (output-style, agents, skills incl. every manifest subfile, hooks)\n * are foreign (no `argos:file`/shell marker) and would therefore be\n * overwritten by a forced `runInit`. Used only by the interactive wizard to\n * size its confirm prompt — the actual overwrite decision and write happen\n * inside `runInit` itself, independently, so this can never drift into\n * writing anything. Mirrors the same directory-ownership rule `runInit`'s\n * own skills loop uses (SKILL.md's marker decides the whole directory), and\n * — like `doctor.ts`'s own read-only checks — intentionally duplicates that\n * iteration shape rather than sharing private state with the writer.\n */\nfunction countForceOverwrites(\n claudeDir: string,\n assetsDir: string,\n installAgents: boolean,\n installHooks: boolean,\n): number {\n let count = 0;\n\n const fullFiles: string[][] = [\n [\"output-styles\", \"argos.md\"],\n ...(installAgents ? listAgentIds(assetsDir).map((id) => [\"agents\", `${id}.md`]) : []),\n ];\n for (const relPath of fullFiles) {\n const dest = join(claudeDir, ...relPath);\n if (existsSync(dest) && !hasArgosFileMarker(readFileSync(dest, \"utf-8\"))) count++;\n }\n\n for (const skillId of listSkillIds(assetsDir)) {\n const skillMdDest = join(claudeDir, \"skills\", skillId, \"SKILL.md\");\n const isForeignSkill = existsSync(skillMdDest) && !hasArgosFileMarker(readFileSync(skillMdDest, \"utf-8\"));\n if (!isForeignSkill) continue;\n for (const relFile of listSkillFiles(assetsDir, skillId)) {\n const dest = join(claudeDir, \"skills\", skillId, ...relFile.split(\"/\"));\n if (existsSync(dest)) count++;\n }\n }\n\n if (installHooks) {\n for (const id of HOOK_IDS) {\n const dest = join(claudeDir, \"hooks\", `${id}.sh`);\n if (existsSync(dest) && !hasArgosShellFileMarker(readFileSync(dest, \"utf-8\"))) count++;\n }\n }\n\n return count;\n}\n\n/**\n * Interactive layer over `runInit` (spec 0004 F5 \"argos init\"). A pure\n * additive wrapper — the core `runInit` never changes behavior or contract.\n * Without a real TTY, or with `--yes`, this delegates to `runInit(options)`\n * unchanged: no prompt library call is ever reached on that path. With a\n * TTY, it runs a 3-step wizard (language, agents/hooks toggles, summary +\n * final confirm) before calling `runInit` with the gathered choices;\n * cancelling at any step touches nothing and returns a no-op report.\n */\nexport async function runInitInteractive(options: InitInteractiveOptions = {}): Promise<InitReport> {\n if (!isInteractive({ yes: options.yes })) {\n return runInit(options);\n }\n\n const prompter = options.prompter ?? clackPrompter;\n\n prompter.intro(\"argos init — instalación interactiva del motor\");\n\n const language = await prompter.select<\"es\" | \"en\">({\n message: \"Idioma del motor\",\n options: [\n { value: \"es\", label: \"es — español\" },\n { value: \"en\", label: \"en — English\" },\n ],\n initialValue: options.language ?? \"es\",\n });\n if (prompter.isCancel(language)) {\n prompter.cancel(\"argos init cancelado — no se tocó nada.\");\n return cancelledInitReport();\n }\n\n const installAgents = await prompter.confirm({\n message: \"¿Instalar los agentes del motor (agents/)?\",\n initialValue: options.installAgents ?? true,\n });\n if (prompter.isCancel(installAgents)) {\n prompter.cancel(\"argos init cancelado — no se tocó nada.\");\n return cancelledInitReport();\n }\n\n const installHooks = await prompter.confirm({\n message: \"¿Instalar los hooks globales (guard-destructive + quality-gate)?\",\n initialValue: options.installHooks ?? true,\n });\n if (prompter.isCancel(installHooks)) {\n prompter.cancel(\"argos init cancelado — no se tocó nada.\");\n return cancelledInitReport();\n }\n\n const claudeDir = resolveClaudeDir();\n\n // `--force` pre-flight (see `InitOptions.force`'s doc comment): flag-driven,\n // not itself a wizard question. When active, count how many on-disk paths\n // are foreign and about to be overwritten (read-only — see\n // `countForceOverwrites`) and, only if that count is > 0, require an\n // explicit confirm before proceeding. Zero foreign paths means force has\n // nothing to do this run, so no extra prompt.\n const force = options.force ?? false;\n if (force) {\n const foreignCount = countForceOverwrites(claudeDir, resolveAssetsDir(), installAgents, installHooks);\n if (foreignCount > 0) {\n const confirmForce = await prompter.confirm({\n message: `${foreignCount} archivos ajenos serán sobrescritos por versiones del motor — backup previo en ~/.argos/backups. ¿Continuar?`,\n initialValue: false,\n });\n if (prompter.isCancel(confirmForce) || !confirmForce) {\n prompter.cancel(\"argos init cancelado — no se tocó nada.\");\n return cancelledInitReport();\n }\n }\n }\n\n // Voice activation (spec 0004): if the current settings.json.outputStyle\n // matches the predecessor harness's voice, ask before taking it over —\n // this peek is read-only and never writes; the actual takeover only\n // happens inside runInit below, once the user has confirmed everything.\n let takeoverNavoriVoice = options.takeoverNavoriVoice ?? true;\n const currentOutputStyle = peekOutputStyleValue(join(claudeDir, \"settings.json\"));\n if (isNavoriOutputStyle(currentOutputStyle)) {\n const takeover = await prompter.confirm({\n message: `settings.json.outputStyle apunta a la voz del harness predecesor ('${String(currentOutputStyle)}') — ¿reemplazarla por Argos?`,\n initialValue: true,\n });\n if (prompter.isCancel(takeover)) {\n prompter.cancel(\"argos init cancelado — no se tocó nada.\");\n return cancelledInitReport();\n }\n takeoverNavoriVoice = takeover;\n }\n\n prompter.note(\n [\n `idioma: ${language}`,\n `agentes: ${installAgents ? \"sí\" : \"no\"}`,\n \"hooks: \" + (installHooks ? \"sí\" : \"no\"),\n \"skills: sí (siempre — cargan on-demand)\",\n `destino: ${claudeDir}`,\n \"se hace un backup antes de escribir nada\",\n ].join(\"\\n\"),\n \"Resumen\",\n );\n\n const proceed = await prompter.confirm({ message: \"¿Proceder a escribir estos cambios?\", initialValue: true });\n if (prompter.isCancel(proceed) || !proceed) {\n prompter.cancel(\"argos init cancelado — no se tocó nada.\");\n return cancelledInitReport();\n }\n\n const report = runInit({\n language,\n installAgents,\n installHooks,\n takeoverNavoriVoice,\n force,\n });\n prompter.outro(report.summary);\n return report;\n}\n\nexport const initCommand = defineCommand({\n meta: {\n name: \"init\",\n description: \"Install the Argos engine into the global Claude Code home.\",\n },\n args: {\n language: {\n type: \"enum\",\n options: [\"es\", \"en\"],\n default: \"es\",\n description: \"Idioma del motor (global.json).\",\n },\n yes: {\n type: \"boolean\",\n default: false,\n description: \"Fuerza modo no interactivo aunque haya una TTY real (defaults + flags, sin wizard).\",\n },\n force: {\n type: \"boolean\",\n default: false,\n description:\n \"Sobrescribe con la versión del motor los archivos ajenos (sin marker argos) en agents/skills/output-styles/hooks. No toca prosa ajena de CLAUDE.md ni entradas ajenas de settings.json.\",\n },\n },\n async run({ args }) {\n const report = await runInitInteractive({\n language: args.language as \"es\" | \"en\",\n yes: Boolean(args.yes),\n force: Boolean(args.force),\n });\n\n const colorize = (status: InitRowStatus): string => {\n const padded = status.padEnd(18);\n switch (status) {\n case \"skipped-foreign\":\n return pc.yellow(padded);\n case \"overwritten-foreign\":\n return pc.magenta(padded);\n case \"created\":\n return pc.green(padded);\n case \"updated\":\n return pc.cyan(padded);\n case \"error\":\n return pc.red(padded);\n default:\n return pc.dim(padded);\n }\n };\n for (const row of report.rows) {\n const suffix = row.detail ? ` (${row.detail})` : \"\";\n console.log(`${colorize(row.status)} ${row.path}${suffix}`);\n }\n console.log(\"\");\n console.log(report.summary);\n if (report.backupPath) console.log(`backup en ${report.backupPath}`);\n\n process.exit(report.exitCode);\n },\n});\n"],"names":["defineCommand","existsSync","mkdirSync","readFileSync","writeFileSync","dirname","join","pc","listAgentIds","listSkillFiles","listSkillIds","MANAGED_BLOCK_IDS","readAsset","resolveAssetsDir","writeFileAtomic","createBackup","injectBlock","listBlocks","hasArgosFileMarker","hasArgosShellFileMarker","writeManagedFile","writeManagedShellFile","resolveArgosHome","resolveClaudeDir","applyOutputStylePolicy","isNavoriOutputStyle","mergeHooksIntoSettings","isInteractive","clackPrompter","readCliVersion","HOOK_IDS","QUALITY_GATE_OUTER_TIMEOUT_SECONDS","STATUS_COUNT_ORDER","summarize","rows","counts","created","updated","unchanged","error","row","status","parts","filter","s","map","errorMessage","err","Error","message","String","writePlainFile","destPath","sourceContent","recursive","current","writeForcedPlainFile","existed","injectAndReport","claudeMd","id","version","content","hadBlock","some","b","after","runInit","options","language","installAgents","installHooks","force","claudeDir","assetsDir","backupPath","detail","push","path","summary","exitCode","claudeMdPath","blockResults","replace","result","fullFiles","relPath","source","dest","skillId","skillMdDest","isForeignSkill","relFile","relParts","split","hookWriteFailed","Map","set","settingsPath","allHookSpecs","scriptPath","matcher","timeout","statusMessage","hookSpecs","get","failedScriptPaths","mergeResult","removeScriptPaths","outputStyleResult","takeoverNavori","takeoverNavoriVoice","outputStyleRowStatus","argosHome","globalJsonPath","globalJsonContent","JSON","stringify","globalJsonExisted","globalJsonStatus","r","cancelledInitReport","peekOutputStyleValue","undefined","parsed","parse","Array","isArray","outputStyle","countForceOverwrites","count","runInitInteractive","yes","prompter","intro","select","value","label","initialValue","isCancel","cancel","confirm","foreignCount","confirmForce","currentOutputStyle","takeover","note","proceed","report","outro","initCommand","meta","name","description","args","type","default","run","Boolean","colorize","padded","padEnd","yellow","magenta","green","cyan","red","dim","suffix","console","log","process","exit"],"mappings":"AAAA,SAASA,aAAa,QAAQ,QAAQ;AACtC,SAASC,UAAU,EAAEC,SAAS,EAAEC,YAAY,EAAEC,aAAa,QAAQ,UAAU;AAC7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QJ,KAAKtB,GAAG;YACrB5D,OAAOsF,QAAQJ,KAAKlF,KAAK;QAC3B;QAEA,MAAMuF,WAAW,CAACtH;YAChB,MAAMuH,SAASvH,OAAOwH,MAAM,CAAC;YAC7B,OAAQxH;gBACN,KAAK;oBACH,OAAOlC,GAAG2J,MAAM,CAACF;gBACnB,KAAK;oBACH,OAAOzJ,GAAG4J,OAAO,CAACH;gBACpB,KAAK;oBACH,OAAOzJ,GAAG6J,KAAK,CAACJ;gBAClB,KAAK;oBACH,OAAOzJ,GAAG8J,IAAI,CAACL;gBACjB,KAAK;oBACH,OAAOzJ,GAAG+J,GAAG,CAACN;gBAChB;oBACE,OAAOzJ,GAAGgK,GAAG,CAACP;YAClB;QACF;QACA,KAAK,MAAMxH,OAAO4G,OAAOlH,IAAI,CAAE;YAC7B,MAAMsI,SAAShI,IAAIoC,MAAM,GAAG,CAAC,EAAE,EAAEpC,IAAIoC,MAAM,CAAC,CAAC,CAAC,GAAG;YACjD6F,QAAQC,GAAG,CAAC,GAAGX,SAASvH,IAAIC,MAAM,EAAE,CAAC,EAAED,IAAIsC,IAAI,GAAG0F,QAAQ;QAC5D;QACAC,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAACtB,OAAOrE,OAAO;QAC1B,IAAIqE,OAAOzE,UAAU,EAAE8F,QAAQC,GAAG,CAAC,CAAC,UAAU,EAAEtB,OAAOzE,UAAU,EAAE;QAEnEgG,QAAQC,IAAI,CAACxB,OAAOpE,QAAQ;IAC9B;AACF,GAAG"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Prompter } from "../lib/prompter.js";
|
|
1
2
|
/**
|
|
2
3
|
* Uninstaller for `argos init`: the mirror image of `runInit` (see
|
|
3
4
|
* commands/init.ts). Removes only what Argos itself owns — a managed
|
|
@@ -47,6 +48,24 @@ export interface RemoveReport {
|
|
|
47
48
|
* (kept by default) — backups are removed last and always warned about.
|
|
48
49
|
*/
|
|
49
50
|
export declare function runRemove(options?: RemoveOptions): RemoveReport;
|
|
51
|
+
export interface RemoveInteractiveOptions extends RemoveOptions {
|
|
52
|
+
/** `--yes`: forces non-interactive behavior even under a real TTY. */
|
|
53
|
+
yes?: boolean;
|
|
54
|
+
/** Injectable for tests; defaults to the real `@clack/prompts`-backed prompter. */
|
|
55
|
+
prompter?: Prompter;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Interactive layer over `runRemove` (spec 0004 F5 "argos remove"). A pure
|
|
59
|
+
* additive wrapper — the core `runRemove` never changes behavior or
|
|
60
|
+
* contract. Without a real TTY, with `--yes`, or for a plain preview
|
|
61
|
+
* (`apply: false`, the default) this delegates to `runRemove(options)`
|
|
62
|
+
* unchanged — no prompt library call is ever reached on those paths. With a
|
|
63
|
+
* TTY AND `apply: true`, requires the operator to type the exact target
|
|
64
|
+
* directory (`resolveClaudeDir()`) before proceeding; `purge: true` on top
|
|
65
|
+
* of that requires a SECOND, separate confirmation mentioning backups.
|
|
66
|
+
* Either confirmation failing/cancelling aborts with zero writes.
|
|
67
|
+
*/
|
|
68
|
+
export declare function runRemoveInteractive(options?: RemoveInteractiveOptions): Promise<RemoveReport>;
|
|
50
69
|
export declare const removeCommand: import("citty").CommandDef<{
|
|
51
70
|
readonly apply: {
|
|
52
71
|
readonly type: "boolean";
|
|
@@ -58,5 +77,10 @@ export declare const removeCommand: import("citty").CommandDef<{
|
|
|
58
77
|
readonly default: false;
|
|
59
78
|
readonly description: "Also remove ~/.argos data (registry, global.json, backups). Irreversible.";
|
|
60
79
|
};
|
|
80
|
+
readonly yes: {
|
|
81
|
+
readonly type: "boolean";
|
|
82
|
+
readonly default: false;
|
|
83
|
+
readonly description: "Fuerza modo no interactivo aunque haya una TTY real (salta las confirmaciones tipadas).";
|
|
84
|
+
};
|
|
61
85
|
}>;
|
|
62
86
|
//# sourceMappingURL=remove.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../src/comm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AAoB,CAAC,OAAO,GAAE,wBAA6B,GAAG,OAAO,CAAC,YAAY,CAAC,CAkCxG;AAED,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;EAuDxB,CAAC"}
|
package/dist/commands/remove.js
CHANGED
|
@@ -8,7 +8,8 @@ import { createBackup } from "../lib/backup.js";
|
|
|
8
8
|
import { listBlocks, removeBlock } from "../lib/markers.js";
|
|
9
9
|
import { hasArgosFileMarker, hasArgosShellFileMarker } from "../lib/managed-files.js";
|
|
10
10
|
import { resolveArgosHome, resolveClaudeDir } from "../lib/paths.js";
|
|
11
|
-
import {
|
|
11
|
+
import { isInteractive, clackPrompter } from "../lib/prompter.js";
|
|
12
|
+
import { removeAllArgosHooksFromSettings, removeOutputStyleIfArgos } from "../lib/settings-merge.js";
|
|
12
13
|
const STATUS_COUNT_ORDER = [
|
|
13
14
|
"removed",
|
|
14
15
|
"would-remove",
|
|
@@ -412,6 +413,28 @@ function processPurge(apply, rows, warnings) {
|
|
|
412
413
|
detail: `${settingsResult.removedCount} hook ${noun}`
|
|
413
414
|
});
|
|
414
415
|
}
|
|
416
|
+
// Voice activation (spec 0004): remove settings.json.outputStyle ONLY when
|
|
417
|
+
// it's still exactly "Argos" — the value argos init wrote. Any other
|
|
418
|
+
// voice (a foreign one init never touched, or the key simply absent) is
|
|
419
|
+
// left byte-identical; this is `argos remove`'s own value to clean up
|
|
420
|
+
// after, never the user's.
|
|
421
|
+
const outputStyleResult = removeOutputStyleIfArgos(settingsPath, {
|
|
422
|
+
dryRun: !apply
|
|
423
|
+
});
|
|
424
|
+
if (outputStyleResult.status === "error") {
|
|
425
|
+
rows.push({
|
|
426
|
+
path: "settings.json#outputStyle",
|
|
427
|
+
category: "settings-entries",
|
|
428
|
+
status: "error",
|
|
429
|
+
detail: outputStyleResult.detail
|
|
430
|
+
});
|
|
431
|
+
} else if (outputStyleResult.status === "removed") {
|
|
432
|
+
rows.push({
|
|
433
|
+
path: "settings.json#outputStyle",
|
|
434
|
+
category: "settings-entries",
|
|
435
|
+
status: apply ? "removed" : "would-remove"
|
|
436
|
+
});
|
|
437
|
+
}
|
|
415
438
|
if (purge) processPurge(apply, rows, warnings);
|
|
416
439
|
// Always-present closing note: repo-side artifacts (argos.config.json, the
|
|
417
440
|
// ficha block in a repo's own CLAUDE.md) are out of scope for `remove` —
|
|
@@ -431,6 +454,67 @@ function processPurge(apply, rows, warnings) {
|
|
|
431
454
|
warnings
|
|
432
455
|
};
|
|
433
456
|
}
|
|
457
|
+
/**
|
|
458
|
+
* A cancelled confirmation's report: identical shape to a run that touched
|
|
459
|
+
* nothing. `exitCode: 1` — a cancel is neither a successful write nor
|
|
460
|
+
* silently indistinguishable from one by exit code alone (matches
|
|
461
|
+
* `runWorkspaceLinkInteractive`'s convention for its own cancel paths).
|
|
462
|
+
*/ function cancelledRemoveReport(reason) {
|
|
463
|
+
return {
|
|
464
|
+
rows: [
|
|
465
|
+
{
|
|
466
|
+
path: "cancel",
|
|
467
|
+
category: "scope-note",
|
|
468
|
+
status: "info",
|
|
469
|
+
detail: reason
|
|
470
|
+
}
|
|
471
|
+
],
|
|
472
|
+
summary: `argos remove: cancelado — no se tocó nada (${reason}).`,
|
|
473
|
+
exitCode: 1,
|
|
474
|
+
warnings: []
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Interactive layer over `runRemove` (spec 0004 F5 "argos remove"). A pure
|
|
479
|
+
* additive wrapper — the core `runRemove` never changes behavior or
|
|
480
|
+
* contract. Without a real TTY, with `--yes`, or for a plain preview
|
|
481
|
+
* (`apply: false`, the default) this delegates to `runRemove(options)`
|
|
482
|
+
* unchanged — no prompt library call is ever reached on those paths. With a
|
|
483
|
+
* TTY AND `apply: true`, requires the operator to type the exact target
|
|
484
|
+
* directory (`resolveClaudeDir()`) before proceeding; `purge: true` on top
|
|
485
|
+
* of that requires a SECOND, separate confirmation mentioning backups.
|
|
486
|
+
* Either confirmation failing/cancelling aborts with zero writes.
|
|
487
|
+
*/ export async function runRemoveInteractive(options = {}) {
|
|
488
|
+
const apply = options.apply ?? false;
|
|
489
|
+
const purge = options.purge ?? false;
|
|
490
|
+
if (!isInteractive({
|
|
491
|
+
yes: options.yes
|
|
492
|
+
}) || !apply) {
|
|
493
|
+
return runRemove(options);
|
|
494
|
+
}
|
|
495
|
+
const prompter = options.prompter ?? clackPrompter;
|
|
496
|
+
const claudeDir = resolveClaudeDir();
|
|
497
|
+
const typed = await prompter.text({
|
|
498
|
+
message: `Esto desinstala el motor Argos de ${claudeDir}. Escribí "${claudeDir}" para confirmar:`
|
|
499
|
+
});
|
|
500
|
+
if (prompter.isCancel(typed) || typed !== claudeDir) {
|
|
501
|
+
prompter.cancel("argos remove cancelado — no se tocó nada.");
|
|
502
|
+
return cancelledRemoveReport("confirmación de directorio no coincide o fue cancelada");
|
|
503
|
+
}
|
|
504
|
+
if (purge) {
|
|
505
|
+
const confirmPurge = await prompter.confirm({
|
|
506
|
+
message: "--purge también borra ~/.argos/backups — se pierde la red de seguridad de esta y de toda operación anterior. ¿Confirmás?",
|
|
507
|
+
initialValue: false
|
|
508
|
+
});
|
|
509
|
+
if (prompter.isCancel(confirmPurge) || !confirmPurge) {
|
|
510
|
+
prompter.cancel("argos remove cancelado — no se tocó nada.");
|
|
511
|
+
return cancelledRemoveReport("--purge no confirmado");
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
const report = runRemove(options);
|
|
515
|
+
prompter.outro(report.summary);
|
|
516
|
+
return report;
|
|
517
|
+
}
|
|
434
518
|
export const removeCommand = defineCommand({
|
|
435
519
|
meta: {
|
|
436
520
|
name: "remove",
|
|
@@ -446,12 +530,18 @@ export const removeCommand = defineCommand({
|
|
|
446
530
|
type: "boolean",
|
|
447
531
|
default: false,
|
|
448
532
|
description: "Also remove ~/.argos data (registry, global.json, backups). Irreversible."
|
|
533
|
+
},
|
|
534
|
+
yes: {
|
|
535
|
+
type: "boolean",
|
|
536
|
+
default: false,
|
|
537
|
+
description: "Fuerza modo no interactivo aunque haya una TTY real (salta las confirmaciones tipadas)."
|
|
449
538
|
}
|
|
450
539
|
},
|
|
451
|
-
run ({ args }) {
|
|
452
|
-
const report =
|
|
540
|
+
async run ({ args }) {
|
|
541
|
+
const report = await runRemoveInteractive({
|
|
453
542
|
apply: args.apply,
|
|
454
|
-
purge: args.purge
|
|
543
|
+
purge: args.purge,
|
|
544
|
+
yes: Boolean(args.yes)
|
|
455
545
|
});
|
|
456
546
|
const colorize = (status)=>{
|
|
457
547
|
const padded = status.padEnd(18);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/remove.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { existsSync, readdirSync, readFileSync, rmSync, rmdirSync } from \"node:fs\";\nimport { join, relative, sep } from \"node:path\";\nimport pc from \"picocolors\";\nimport { listSkillFiles, listSkillIds, MANAGED_BLOCK_IDS, resolveAssetsDir } from \"../lib/assets.js\";\nimport { writeFileAtomic } from \"../lib/atomic-write.js\";\nimport { createBackup } from \"../lib/backup.js\";\nimport { listBlocks, removeBlock } from \"../lib/markers.js\";\nimport { hasArgosFileMarker, hasArgosShellFileMarker } from \"../lib/managed-files.js\";\nimport { resolveArgosHome, resolveClaudeDir } from \"../lib/paths.js\";\nimport { removeAllArgosHooksFromSettings } from \"../lib/settings-merge.js\";\n\n/**\n * Uninstaller for `argos init`: the mirror image of `runInit` (see\n * commands/init.ts). Removes only what Argos itself owns — a managed\n * CLAUDE.md block, a file carrying the `argos:file`/shell marker, or a\n * settings.json hook entry pointing at an Argos script — and leaves every\n * foreign file, block, and entry byte-identical.\n *\n * Scope: this command only touches `~/.claude` (via `resolveClaudeDir()`)\n * and, with `--purge`, `~/.argos` (via `resolveArgosHome()`) — the global\n * Argos engine and its registry. Repo-side artifacts are intentionally out\n * of scope and are NEVER touched here: a repo's own `argos.config.json` and\n * the \"ficha\" managed block `argos adopt` writes into that repo's own\n * `CLAUDE.md` both survive `remove` untouched, including `remove --purge`.\n * (See the final \"scope\" row every report ends with.)\n */\n\nexport type RemoveRowStatus = \"removed\" | \"would-remove\" | \"skipped-foreign\" | \"warning\" | \"info\" | \"error\";\n\nexport type RemoveRowCategory =\n | \"claude-md-block\"\n | \"agents-file\"\n | \"skills-file\"\n | \"output-styles-file\"\n | \"hooks-file\"\n | \"settings-entries\"\n | \"argos-home\"\n | \"scope-note\";\n\nexport interface RemoveRow {\n path: string;\n category: RemoveRowCategory;\n status: RemoveRowStatus;\n detail?: string;\n}\n\nexport interface RemoveOptions {\n /** Actually perform the removal. Default false = dry-run preview, touches nothing on disk. */\n apply?: boolean;\n /** Also remove ~/.argos data (registry, global.json, backups). Backups are removed LAST. */\n purge?: boolean;\n}\n\nexport interface RemoveReport {\n rows: RemoveRow[];\n summary: string;\n exitCode: 0 | 1;\n backupPath?: string;\n /** Non-fatal warnings surfaced alongside the report, e.g. the --purge/backups tradeoff. */\n warnings: string[];\n}\n\nconst STATUS_COUNT_ORDER: RemoveRowStatus[] = [\n \"removed\",\n \"would-remove\",\n \"skipped-foreign\",\n \"info\",\n \"warning\",\n \"error\",\n];\n\nfunction summarize(rows: RemoveRow[], apply: boolean): string {\n const counts: Record<RemoveRowStatus, number> = {\n removed: 0,\n \"would-remove\": 0,\n \"skipped-foreign\": 0,\n info: 0,\n warning: 0,\n error: 0,\n };\n for (const row of rows) counts[row.status]++;\n\n const parts = STATUS_COUNT_ORDER.filter((s) => counts[s] > 0).map((s) => `${counts[s]} ${s}`);\n const verb = apply ? \"argos remove\" : \"argos remove (preview — nada se tocó)\";\n return parts.length === 0 ? `${verb}: nada que hacer.` : `${verb}: ${parts.join(\", \")}.`;\n}\n\nfunction errorMessage(err: unknown): string {\n return err instanceof Error ? err.message : String(err);\n}\n\n/** Strip every present managed block from CLAUDE.md; delete the file entirely if it becomes empty. */\nfunction processClaudeMd(claudeDir: string, apply: boolean, rows: RemoveRow[]): void {\n const claudeMdPath = join(claudeDir, \"CLAUDE.md\");\n if (!existsSync(claudeMdPath)) return;\n\n let claudeMd: string;\n try {\n claudeMd = readFileSync(claudeMdPath, \"utf-8\");\n } catch (err) {\n rows.push({ path: \"CLAUDE.md\", category: \"claude-md-block\", status: \"error\", detail: errorMessage(err) });\n return;\n }\n\n let next = claudeMd;\n const removedIds: string[] = [];\n for (const id of MANAGED_BLOCK_IDS) {\n const hadBlock = listBlocks(next).some((b) => b.id === id);\n if (!hadBlock) continue;\n const beforeThisId = next;\n // removeBlock only strips the first occurrence — loop to self-heal any\n // crash-residue duplicates left by injectBlock (see lib/markers.ts).\n // Progress-guarded: a dangling open marker with no matching close (see\n // lib/markers.ts's findBlock/listDanglingBlockIds) makes removeBlock a\n // no-op — its output equals its input — which would otherwise spin this\n // loop forever since listBlocks still reports the id as present. Break\n // and surface it as a warning instead of hanging.\n while (listBlocks(next).some((b) => b.id === id)) {\n const before = next;\n next = removeBlock(next, id);\n if (next === before) {\n rows.push({\n path: \"CLAUDE.md\",\n category: \"claude-md-block\",\n status: \"warning\",\n detail: \"marker argos huérfano sin cierre en CLAUDE.md — remuévelo a mano\",\n });\n break;\n }\n }\n if (next !== beforeThisId) removedIds.push(id);\n }\n\n if (removedIds.length === 0) return;\n for (const id of removedIds) {\n rows.push({ path: `CLAUDE.md#${id}`, category: \"claude-md-block\", status: apply ? \"removed\" : \"would-remove\" });\n }\n\n if (!apply) return;\n\n try {\n if (next.trim().length === 0) {\n rmSync(claudeMdPath, { force: true });\n } else {\n writeFileAtomic(claudeMdPath, next);\n }\n } catch (err) {\n rows.push({ path: \"CLAUDE.md\", category: \"claude-md-block\", status: \"error\", detail: errorMessage(err) });\n }\n}\n\nfunction walkFiles(dir: string): string[] {\n if (!existsSync(dir)) return [];\n const out: string[] = [];\n for (const entry of readdirSync(dir, { withFileTypes: true })) {\n const full = join(dir, entry.name);\n if (entry.isDirectory()) out.push(...walkFiles(full));\n else if (entry.isFile()) out.push(full);\n }\n return out;\n}\n\n/** Remove now-empty directories bottom-up under `dir`, leaving any dir that still holds foreign content. */\nfunction removeEmptyDirsUnder(dir: string): void {\n if (!existsSync(dir)) return;\n for (const entry of readdirSync(dir, { withFileTypes: true })) {\n if (entry.isDirectory()) removeEmptyDirsUnder(join(dir, entry.name));\n }\n const remaining = existsSync(dir) ? readdirSync(dir) : [];\n if (remaining.length === 0) {\n try {\n rmdirSync(dir);\n } catch {\n // Best-effort cleanup — a leftover empty dir is cosmetic, not an error.\n }\n }\n}\n\n/**\n * Remove every Argos-owned file (carrying the ownership marker) under\n * `claudeDir/<topDir>`, recursively — skills live in subdirectories, hence\n * the recursive walk. Foreign files (no marker) are reported\n * \"skipped-foreign\" and left byte-identical.\n */\nfunction processManagedDir(\n claudeDir: string,\n topDir: \"agents\" | \"output-styles\" | \"hooks\",\n category: RemoveRowCategory,\n hasMarker: (content: string) => boolean,\n apply: boolean,\n rows: RemoveRow[],\n): void {\n const dirPath = join(claudeDir, topDir);\n const files = walkFiles(dirPath);\n for (const file of files) {\n const relPath = relative(claudeDir, file);\n let content: string;\n try {\n content = readFileSync(file, \"utf-8\");\n } catch (err) {\n rows.push({ path: relPath, category, status: \"error\", detail: errorMessage(err) });\n continue;\n }\n\n if (!hasMarker(content)) {\n rows.push({ path: relPath, category, status: \"skipped-foreign\" });\n continue;\n }\n\n if (!apply) {\n rows.push({ path: relPath, category, status: \"would-remove\" });\n continue;\n }\n\n try {\n rmSync(file, { force: true });\n rows.push({ path: relPath, category, status: \"removed\" });\n } catch (err) {\n rows.push({ path: relPath, category, status: \"error\", detail: errorMessage(err) });\n }\n }\n\n if (apply) removeEmptyDirsUnder(dirPath);\n}\n\n/**\n * Remove Argos-owned skill directories under `claudeDir/skills/`.\n *\n * Unlike `processManagedDir` (per-file marker check), ownership here is\n * decided PER SKILL DIRECTORY: the skill's `SKILL.md` `argos:file` marker is\n * the sentinel (mirrors the install policy in commands/init.ts). Supporting\n * files (`references/*.md`, `phases/*.md`, etc.) never carry a marker of\n * their own, so a per-file marker check would wrongly treat every one of\n * them as foreign.\n * - `SKILL.md` missing, or present without the marker → the whole directory\n * is foreign (or not argos-installed at all); every file under it is left\n * untouched, reported \"skipped-foreign\".\n * - `SKILL.md` present with the marker → argos-owned. Only the files the\n * CURRENTLY shipped asset manifest lists for that skill id\n * (`listSkillFiles`) are removed; anything else in the directory — a\n * user-added extra file, or every file if this CLI version no longer\n * ships the skill at all — is left in place.\n */\nfunction processSkillsDir(claudeDir: string, apply: boolean, rows: RemoveRow[]): void {\n const skillsRoot = join(claudeDir, \"skills\");\n if (!existsSync(skillsRoot)) return;\n\n const assetsDir = resolveAssetsDir();\n const shippedSkillIds = new Set(listSkillIds(assetsDir));\n\n for (const entry of readdirSync(skillsRoot, { withFileTypes: true })) {\n if (!entry.isDirectory()) continue; // skills/ only ever holds skill subdirectories\n const skillId = entry.name;\n const skillDir = join(skillsRoot, skillId);\n const skillMdPath = join(skillDir, \"SKILL.md\");\n\n let skillMdContent: string | null = null;\n if (existsSync(skillMdPath)) {\n try {\n skillMdContent = readFileSync(skillMdPath, \"utf-8\");\n } catch (err) {\n rows.push({\n path: relative(claudeDir, skillMdPath),\n category: \"skills-file\",\n status: \"error\",\n detail: errorMessage(err),\n });\n continue;\n }\n }\n\n const isArgosOwned = skillMdContent !== null && hasArgosFileMarker(skillMdContent);\n const manifest =\n isArgosOwned && shippedSkillIds.has(skillId) ? new Set(listSkillFiles(assetsDir, skillId)) : new Set<string>();\n\n for (const file of walkFiles(skillDir)) {\n const relToClaudeDir = relative(claudeDir, file);\n\n if (!isArgosOwned || !manifest.has(relative(skillDir, file).split(sep).join(\"/\"))) {\n rows.push({ path: relToClaudeDir, category: \"skills-file\", status: \"skipped-foreign\" });\n continue;\n }\n\n if (!apply) {\n rows.push({ path: relToClaudeDir, category: \"skills-file\", status: \"would-remove\" });\n continue;\n }\n\n try {\n rmSync(file, { force: true });\n rows.push({ path: relToClaudeDir, category: \"skills-file\", status: \"removed\" });\n } catch (err) {\n rows.push({ path: relToClaudeDir, category: \"skills-file\", status: \"error\", detail: errorMessage(err) });\n }\n }\n }\n\n if (apply) removeEmptyDirsUnder(skillsRoot);\n}\n\nconst PURGE_FILES = [\"global.json\", \"workspaces.json\"] as const;\n\nfunction processPurge(apply: boolean, rows: RemoveRow[], warnings: string[]): void {\n const argosHome = resolveArgosHome();\n\n for (const name of PURGE_FILES) {\n const p = join(argosHome, name);\n if (!existsSync(p)) continue;\n const label = join(\"~\", \".argos\", name);\n if (!apply) {\n rows.push({ path: label, category: \"argos-home\", status: \"would-remove\" });\n continue;\n }\n try {\n rmSync(p, { force: true });\n rows.push({ path: label, category: \"argos-home\", status: \"removed\" });\n } catch (err) {\n rows.push({ path: label, category: \"argos-home\", status: \"error\", detail: errorMessage(err) });\n }\n }\n\n // Backups LAST, and always explicitly flagged: they're the safety net for\n // every previous (and this very) destructive operation, so purging them\n // removes the one thing that could otherwise undo a mistake.\n const backupsDir = join(argosHome, \"backups\");\n const backupsLabel = join(\"~\", \".argos\", \"backups\");\n if (existsSync(backupsDir)) {\n warnings.push(\n \"--purge elimina ~/.argos/backups — se pierde la red de seguridad de esta y de toda operación anterior.\",\n );\n if (!apply) {\n rows.push({ path: backupsLabel, category: \"argos-home\", status: \"would-remove\" });\n } else {\n try {\n rmSync(backupsDir, { recursive: true, force: true });\n rows.push({ path: backupsLabel, category: \"argos-home\", status: \"removed\" });\n } catch (err) {\n rows.push({ path: backupsLabel, category: \"argos-home\", status: \"error\", detail: errorMessage(err) });\n }\n }\n }\n}\n\n/**\n * Core, testable implementation of `argos remove`: uninstalls everything\n * `runInit` (commands/init.ts) installs into `resolveClaudeDir()`. Pure\n * function of the filesystem — no process.exit, no console output.\n *\n * Preview by default (`apply: false`): computes the full report without\n * writing anything. `apply: true` performs the removal, backing up\n * everything affected first (same `createBackup` call `runInit` makes,\n * before any mutation). `purge: true` additionally removes `~/.argos` data\n * (kept by default) — backups are removed last and always warned about.\n */\nexport function runRemove(options: RemoveOptions = {}): RemoveReport {\n const apply = options.apply ?? false;\n const purge = options.purge ?? false;\n const claudeDir = resolveClaudeDir();\n const rows: RemoveRow[] = [];\n const warnings: string[] = [];\n\n let backupPath: string | undefined;\n if (apply) {\n try {\n backupPath = createBackup(claudeDir, [\n \"CLAUDE.md\",\n \"agents\",\n \"skills\",\n \"output-styles\",\n \"hooks\",\n \"settings.json\",\n ]);\n } catch (err) {\n const detail = errorMessage(err);\n rows.push({ path: \"backup\", category: \"argos-home\", status: \"error\", detail });\n return { rows, summary: `backup falló — no se tocó nada (${detail}).`, exitCode: 1, warnings };\n }\n }\n\n processClaudeMd(claudeDir, apply, rows);\n\n processManagedDir(claudeDir, \"agents\", \"agents-file\", hasArgosFileMarker, apply, rows);\n processSkillsDir(claudeDir, apply, rows);\n processManagedDir(claudeDir, \"output-styles\", \"output-styles-file\", hasArgosFileMarker, apply, rows);\n processManagedDir(claudeDir, \"hooks\", \"hooks-file\", hasArgosShellFileMarker, apply, rows);\n\n const settingsPath = join(claudeDir, \"settings.json\");\n const settingsResult = removeAllArgosHooksFromSettings(settingsPath, join(claudeDir, \"hooks\"), { dryRun: !apply });\n if (settingsResult.status === \"error\") {\n rows.push({ path: \"settings.json\", category: \"settings-entries\", status: \"error\", detail: settingsResult.detail });\n } else if (settingsResult.removedCount > 0) {\n const noun = settingsResult.removedCount === 1 ? \"entry\" : \"entries\";\n rows.push({\n path: \"settings.json\",\n category: \"settings-entries\",\n status: apply ? \"removed\" : \"would-remove\",\n detail: `${settingsResult.removedCount} hook ${noun}`,\n });\n }\n\n if (purge) processPurge(apply, rows, warnings);\n\n // Always-present closing note: repo-side artifacts (argos.config.json, the\n // ficha block in a repo's own CLAUDE.md) are out of scope for `remove` —\n // see the module doc comment above.\n rows.push({\n path: \"scope\",\n category: \"scope-note\",\n status: \"info\",\n detail: \"los repos adoptados conservan su argos.config.json y ficha — este comando solo limpia ~/.claude y ~/.argos\",\n });\n\n const exitCode: 0 | 1 = rows.some((r) => r.status === \"error\") ? 1 : 0;\n return { rows, summary: summarize(rows, apply), exitCode, backupPath, warnings };\n}\n\nexport const removeCommand = defineCommand({\n meta: {\n name: \"remove\",\n description: \"Uninstall the Argos engine from the global Claude Code home (preview by default).\",\n },\n args: {\n apply: {\n type: \"boolean\",\n default: false,\n description: \"Actually perform the removal (default: dry-run preview, touches nothing).\",\n },\n purge: {\n type: \"boolean\",\n default: false,\n description: \"Also remove ~/.argos data (registry, global.json, backups). Irreversible.\",\n },\n },\n run({ args }) {\n const report = runRemove({ apply: args.apply, purge: args.purge });\n\n const colorize = (status: RemoveRowStatus): string => {\n const padded = status.padEnd(18);\n switch (status) {\n case \"skipped-foreign\":\n return pc.yellow(padded);\n case \"removed\":\n return pc.cyan(padded);\n case \"would-remove\":\n return pc.dim(padded);\n case \"warning\":\n return pc.yellow(padded);\n case \"info\":\n return pc.dim(padded);\n case \"error\":\n return pc.red(padded);\n default:\n return padded;\n }\n };\n for (const row of report.rows) {\n const suffix = row.detail ? ` (${row.detail})` : \"\";\n console.log(`${colorize(row.status)} ${row.path}${suffix}`);\n }\n console.log(\"\");\n console.log(report.summary);\n if (report.backupPath) console.log(`backup en ${report.backupPath}`);\n for (const warning of report.warnings) console.log(pc.yellow(`aviso: ${warning}`));\n\n process.exit(report.exitCode);\n },\n});\n"],"names":["defineCommand","existsSync","readdirSync","readFileSync","rmSync","rmdirSync","join","relative","sep","pc","listSkillFiles","listSkillIds","MANAGED_BLOCK_IDS","resolveAssetsDir","writeFileAtomic","createBackup","listBlocks","removeBlock","hasArgosFileMarker","hasArgosShellFileMarker","resolveArgosHome","resolveClaudeDir","removeAllArgosHooksFromSettings","STATUS_COUNT_ORDER","summarize","rows","apply","counts","removed","info","warning","error","row","status","parts","filter","s","map","verb","length","errorMessage","err","Error","message","String","processClaudeMd","claudeDir","claudeMdPath","claudeMd","push","path","category","detail","next","removedIds","id","hadBlock","some","b","beforeThisId","before","trim","force","walkFiles","dir","out","entry","withFileTypes","full","name","isDirectory","isFile","removeEmptyDirsUnder","remaining","processManagedDir","topDir","hasMarker","dirPath","files","file","relPath","content","processSkillsDir","skillsRoot","assetsDir","shippedSkillIds","Set","skillId","skillDir","skillMdPath","skillMdContent","isArgosOwned","manifest","has","relToClaudeDir","split","PURGE_FILES","processPurge","warnings","argosHome","p","label","backupsDir","backupsLabel","recursive","runRemove","options","purge","backupPath","summary","exitCode","settingsPath","settingsResult","dryRun","removedCount","noun","r","removeCommand","meta","description","args","type","default","run","report","colorize","padded","padEnd","yellow","cyan","dim","red","suffix","console","log","process","exit"],"mappings":"AAAA,SAASA,aAAa,QAAQ,QAAQ;AACtC,SAASC,UAAU,EAAEC,WAAW,EAAEC,YAAY,EAAEC,MAAM,EAAEC,SAAS,QAAQ,UAAU;AACnF,SAASC,IAAI,EAAEC,QAAQ,EAAEC,GAAG,QAAQ,YAAY;AAChD,OAAOC,QAAQ,aAAa;AAC5B,SAASC,cAAc,EAAEC,YAAY,EAAEC,iBAAiB,EAAEC,gBAAgB,QAAQ,mBAAmB;AACrG,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,UAAU,EAAEC,WAAW,QAAQ,oBAAoB;AAC5D,SAASC,kBAAkB,EAAEC,uBAAuB,QAAQ,0BAA0B;AACtF,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,kBAAkB;AACrE,SAASC,+BAA+B,QAAQ,2BAA2B;AAqD3E,MAAMC,qBAAwC;IAC5C;IACA;IACA;IACA;IACA;IACA;CACD;AAED,SAASC,UAAUC,IAAiB,EAAEC,KAAc;IAClD,MAAMC,SAA0C;QAC9CC,SAAS;QACT,gBAAgB;QAChB,mBAAmB;QACnBC,MAAM;QACNC,SAAS;QACTC,OAAO;IACT;IACA,KAAK,MAAMC,OAAOP,KAAME,MAAM,CAACK,IAAIC,MAAM,CAAC;IAE1C,MAAMC,QAAQX,mBAAmBY,MAAM,CAAC,CAACC,IAAMT,MAAM,CAACS,EAAE,GAAG,GAAGC,GAAG,CAAC,CAACD,IAAM,GAAGT,MAAM,CAACS,EAAE,CAAC,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uH,MAAM,CAACF;gBACnB,KAAK;oBACH,OAAOrH,GAAGwH,IAAI,CAACH;gBACjB,KAAK;oBACH,OAAOrH,GAAGyH,GAAG,CAACJ;gBAChB,KAAK;oBACH,OAAOrH,GAAGuH,MAAM,CAACF;gBACnB,KAAK;oBACH,OAAOrH,GAAGyH,GAAG,CAACJ;gBAChB,KAAK;oBACH,OAAOrH,GAAG0H,GAAG,CAACL;gBAChB;oBACE,OAAOA;YACX;QACF;QACA,KAAK,MAAM9F,OAAO4F,OAAOnG,IAAI,CAAE;YAC7B,MAAM2G,SAASpG,IAAIoB,MAAM,GAAG,CAAC,EAAE,EAAEpB,IAAIoB,MAAM,CAAC,CAAC,CAAC,GAAG;YACjDiF,QAAQC,GAAG,CAAC,GAAGT,SAAS7F,IAAIC,MAAM,EAAE,CAAC,EAAED,IAAIkB,IAAI,GAAGkF,QAAQ;QAC5D;QACAC,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAACV,OAAOf,OAAO;QAC1B,IAAIe,OAAOhB,UAAU,EAAEyB,QAAQC,GAAG,CAAC,CAAC,UAAU,EAAEV,OAAOhB,UAAU,EAAE;QACnE,KAAK,MAAM9E,WAAW8F,OAAO1B,QAAQ,CAAEmC,QAAQC,GAAG,CAAC7H,GAAGuH,MAAM,CAAC,CAAC,OAAO,EAAElG,SAAS;QAEhFyG,QAAQC,IAAI,CAACZ,OAAOd,QAAQ;IAC9B;AACF,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../../src/commands/remove.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { existsSync, readdirSync, readFileSync, rmSync, rmdirSync } from \"node:fs\";\nimport { join, relative, sep } from \"node:path\";\nimport pc from \"picocolors\";\nimport { listSkillFiles, listSkillIds, MANAGED_BLOCK_IDS, resolveAssetsDir } from \"../lib/assets.js\";\nimport { writeFileAtomic } from \"../lib/atomic-write.js\";\nimport { createBackup } from \"../lib/backup.js\";\nimport { listBlocks, removeBlock } from \"../lib/markers.js\";\nimport { hasArgosFileMarker, hasArgosShellFileMarker } from \"../lib/managed-files.js\";\nimport { resolveArgosHome, resolveClaudeDir } from \"../lib/paths.js\";\nimport { isInteractive, clackPrompter, type Prompter } from \"../lib/prompter.js\";\nimport { removeAllArgosHooksFromSettings, removeOutputStyleIfArgos } from \"../lib/settings-merge.js\";\n\n/**\n * Uninstaller for `argos init`: the mirror image of `runInit` (see\n * commands/init.ts). Removes only what Argos itself owns — a managed\n * CLAUDE.md block, a file carrying the `argos:file`/shell marker, or a\n * settings.json hook entry pointing at an Argos script — and leaves every\n * foreign file, block, and entry byte-identical.\n *\n * Scope: this command only touches `~/.claude` (via `resolveClaudeDir()`)\n * and, with `--purge`, `~/.argos` (via `resolveArgosHome()`) — the global\n * Argos engine and its registry. Repo-side artifacts are intentionally out\n * of scope and are NEVER touched here: a repo's own `argos.config.json` and\n * the \"ficha\" managed block `argos adopt` writes into that repo's own\n * `CLAUDE.md` both survive `remove` untouched, including `remove --purge`.\n * (See the final \"scope\" row every report ends with.)\n */\n\nexport type RemoveRowStatus = \"removed\" | \"would-remove\" | \"skipped-foreign\" | \"warning\" | \"info\" | \"error\";\n\nexport type RemoveRowCategory =\n | \"claude-md-block\"\n | \"agents-file\"\n | \"skills-file\"\n | \"output-styles-file\"\n | \"hooks-file\"\n | \"settings-entries\"\n | \"argos-home\"\n | \"scope-note\";\n\nexport interface RemoveRow {\n path: string;\n category: RemoveRowCategory;\n status: RemoveRowStatus;\n detail?: string;\n}\n\nexport interface RemoveOptions {\n /** Actually perform the removal. Default false = dry-run preview, touches nothing on disk. */\n apply?: boolean;\n /** Also remove ~/.argos data (registry, global.json, backups). Backups are removed LAST. */\n purge?: boolean;\n}\n\nexport interface RemoveReport {\n rows: RemoveRow[];\n summary: string;\n exitCode: 0 | 1;\n backupPath?: string;\n /** Non-fatal warnings surfaced alongside the report, e.g. the --purge/backups tradeoff. */\n warnings: string[];\n}\n\nconst STATUS_COUNT_ORDER: RemoveRowStatus[] = [\n \"removed\",\n \"would-remove\",\n \"skipped-foreign\",\n \"info\",\n \"warning\",\n \"error\",\n];\n\nfunction summarize(rows: RemoveRow[], apply: boolean): string {\n const counts: Record<RemoveRowStatus, number> = {\n removed: 0,\n \"would-remove\": 0,\n \"skipped-foreign\": 0,\n info: 0,\n warning: 0,\n error: 0,\n };\n for (const row of rows) counts[row.status]++;\n\n const parts = STATUS_COUNT_ORDER.filter((s) => counts[s] > 0).map((s) => `${counts[s]} ${s}`);\n const verb = apply ? \"argos remove\" : \"argos remove (preview — nada se tocó)\";\n return parts.length === 0 ? `${verb}: nada que hacer.` : `${verb}: ${parts.join(\", \")}.`;\n}\n\nfunction errorMessage(err: unknown): string {\n return err instanceof Error ? err.message : String(err);\n}\n\n/** Strip every present managed block from CLAUDE.md; delete the file entirely if it becomes empty. */\nfunction processClaudeMd(claudeDir: string, apply: boolean, rows: RemoveRow[]): void {\n const claudeMdPath = join(claudeDir, \"CLAUDE.md\");\n if (!existsSync(claudeMdPath)) return;\n\n let claudeMd: string;\n try {\n claudeMd = readFileSync(claudeMdPath, \"utf-8\");\n } catch (err) {\n rows.push({ path: \"CLAUDE.md\", category: \"claude-md-block\", status: \"error\", detail: errorMessage(err) });\n return;\n }\n\n let next = claudeMd;\n const removedIds: string[] = [];\n for (const id of MANAGED_BLOCK_IDS) {\n const hadBlock = listBlocks(next).some((b) => b.id === id);\n if (!hadBlock) continue;\n const beforeThisId = next;\n // removeBlock only strips the first occurrence — loop to self-heal any\n // crash-residue duplicates left by injectBlock (see lib/markers.ts).\n // Progress-guarded: a dangling open marker with no matching close (see\n // lib/markers.ts's findBlock/listDanglingBlockIds) makes removeBlock a\n // no-op — its output equals its input — which would otherwise spin this\n // loop forever since listBlocks still reports the id as present. Break\n // and surface it as a warning instead of hanging.\n while (listBlocks(next).some((b) => b.id === id)) {\n const before = next;\n next = removeBlock(next, id);\n if (next === before) {\n rows.push({\n path: \"CLAUDE.md\",\n category: \"claude-md-block\",\n status: \"warning\",\n detail: \"marker argos huérfano sin cierre en CLAUDE.md — remuévelo a mano\",\n });\n break;\n }\n }\n if (next !== beforeThisId) removedIds.push(id);\n }\n\n if (removedIds.length === 0) return;\n for (const id of removedIds) {\n rows.push({ path: `CLAUDE.md#${id}`, category: \"claude-md-block\", status: apply ? \"removed\" : \"would-remove\" });\n }\n\n if (!apply) return;\n\n try {\n if (next.trim().length === 0) {\n rmSync(claudeMdPath, { force: true });\n } else {\n writeFileAtomic(claudeMdPath, next);\n }\n } catch (err) {\n rows.push({ path: \"CLAUDE.md\", category: \"claude-md-block\", status: \"error\", detail: errorMessage(err) });\n }\n}\n\nfunction walkFiles(dir: string): string[] {\n if (!existsSync(dir)) return [];\n const out: string[] = [];\n for (const entry of readdirSync(dir, { withFileTypes: true })) {\n const full = join(dir, entry.name);\n if (entry.isDirectory()) out.push(...walkFiles(full));\n else if (entry.isFile()) out.push(full);\n }\n return out;\n}\n\n/** Remove now-empty directories bottom-up under `dir`, leaving any dir that still holds foreign content. */\nfunction removeEmptyDirsUnder(dir: string): void {\n if (!existsSync(dir)) return;\n for (const entry of readdirSync(dir, { withFileTypes: true })) {\n if (entry.isDirectory()) removeEmptyDirsUnder(join(dir, entry.name));\n }\n const remaining = existsSync(dir) ? readdirSync(dir) : [];\n if (remaining.length === 0) {\n try {\n rmdirSync(dir);\n } catch {\n // Best-effort cleanup — a leftover empty dir is cosmetic, not an error.\n }\n }\n}\n\n/**\n * Remove every Argos-owned file (carrying the ownership marker) under\n * `claudeDir/<topDir>`, recursively — skills live in subdirectories, hence\n * the recursive walk. Foreign files (no marker) are reported\n * \"skipped-foreign\" and left byte-identical.\n */\nfunction processManagedDir(\n claudeDir: string,\n topDir: \"agents\" | \"output-styles\" | \"hooks\",\n category: RemoveRowCategory,\n hasMarker: (content: string) => boolean,\n apply: boolean,\n rows: RemoveRow[],\n): void {\n const dirPath = join(claudeDir, topDir);\n const files = walkFiles(dirPath);\n for (const file of files) {\n const relPath = relative(claudeDir, file);\n let content: string;\n try {\n content = readFileSync(file, \"utf-8\");\n } catch (err) {\n rows.push({ path: relPath, category, status: \"error\", detail: errorMessage(err) });\n continue;\n }\n\n if (!hasMarker(content)) {\n rows.push({ path: relPath, category, status: \"skipped-foreign\" });\n continue;\n }\n\n if (!apply) {\n rows.push({ path: relPath, category, status: \"would-remove\" });\n continue;\n }\n\n try {\n rmSync(file, { force: true });\n rows.push({ path: relPath, category, status: \"removed\" });\n } catch (err) {\n rows.push({ path: relPath, category, status: \"error\", detail: errorMessage(err) });\n }\n }\n\n if (apply) removeEmptyDirsUnder(dirPath);\n}\n\n/**\n * Remove Argos-owned skill directories under `claudeDir/skills/`.\n *\n * Unlike `processManagedDir` (per-file marker check), ownership here is\n * decided PER SKILL DIRECTORY: the skill's `SKILL.md` `argos:file` marker is\n * the sentinel (mirrors the install policy in commands/init.ts). Supporting\n * files (`references/*.md`, `phases/*.md`, etc.) never carry a marker of\n * their own, so a per-file marker check would wrongly treat every one of\n * them as foreign.\n * - `SKILL.md` missing, or present without the marker → the whole directory\n * is foreign (or not argos-installed at all); every file under it is left\n * untouched, reported \"skipped-foreign\".\n * - `SKILL.md` present with the marker → argos-owned. Only the files the\n * CURRENTLY shipped asset manifest lists for that skill id\n * (`listSkillFiles`) are removed; anything else in the directory — a\n * user-added extra file, or every file if this CLI version no longer\n * ships the skill at all — is left in place.\n */\nfunction processSkillsDir(claudeDir: string, apply: boolean, rows: RemoveRow[]): void {\n const skillsRoot = join(claudeDir, \"skills\");\n if (!existsSync(skillsRoot)) return;\n\n const assetsDir = resolveAssetsDir();\n const shippedSkillIds = new Set(listSkillIds(assetsDir));\n\n for (const entry of readdirSync(skillsRoot, { withFileTypes: true })) {\n if (!entry.isDirectory()) continue; // skills/ only ever holds skill subdirectories\n const skillId = entry.name;\n const skillDir = join(skillsRoot, skillId);\n const skillMdPath = join(skillDir, \"SKILL.md\");\n\n let skillMdContent: string | null = null;\n if (existsSync(skillMdPath)) {\n try {\n skillMdContent = readFileSync(skillMdPath, \"utf-8\");\n } catch (err) {\n rows.push({\n path: relative(claudeDir, skillMdPath),\n category: \"skills-file\",\n status: \"error\",\n detail: errorMessage(err),\n });\n continue;\n }\n }\n\n const isArgosOwned = skillMdContent !== null && hasArgosFileMarker(skillMdContent);\n const manifest =\n isArgosOwned && shippedSkillIds.has(skillId) ? new Set(listSkillFiles(assetsDir, skillId)) : new Set<string>();\n\n for (const file of walkFiles(skillDir)) {\n const relToClaudeDir = relative(claudeDir, file);\n\n if (!isArgosOwned || !manifest.has(relative(skillDir, file).split(sep).join(\"/\"))) {\n rows.push({ path: relToClaudeDir, category: \"skills-file\", status: \"skipped-foreign\" });\n continue;\n }\n\n if (!apply) {\n rows.push({ path: relToClaudeDir, category: \"skills-file\", status: \"would-remove\" });\n continue;\n }\n\n try {\n rmSync(file, { force: true });\n rows.push({ path: relToClaudeDir, category: \"skills-file\", status: \"removed\" });\n } catch (err) {\n rows.push({ path: relToClaudeDir, category: \"skills-file\", status: \"error\", detail: errorMessage(err) });\n }\n }\n }\n\n if (apply) removeEmptyDirsUnder(skillsRoot);\n}\n\nconst PURGE_FILES = [\"global.json\", \"workspaces.json\"] as const;\n\nfunction processPurge(apply: boolean, rows: RemoveRow[], warnings: string[]): void {\n const argosHome = resolveArgosHome();\n\n for (const name of PURGE_FILES) {\n const p = join(argosHome, name);\n if (!existsSync(p)) continue;\n const label = join(\"~\", \".argos\", name);\n if (!apply) {\n rows.push({ path: label, category: \"argos-home\", status: \"would-remove\" });\n continue;\n }\n try {\n rmSync(p, { force: true });\n rows.push({ path: label, category: \"argos-home\", status: \"removed\" });\n } catch (err) {\n rows.push({ path: label, category: \"argos-home\", status: \"error\", detail: errorMessage(err) });\n }\n }\n\n // Backups LAST, and always explicitly flagged: they're the safety net for\n // every previous (and this very) destructive operation, so purging them\n // removes the one thing that could otherwise undo a mistake.\n const backupsDir = join(argosHome, \"backups\");\n const backupsLabel = join(\"~\", \".argos\", \"backups\");\n if (existsSync(backupsDir)) {\n warnings.push(\n \"--purge elimina ~/.argos/backups — se pierde la red de seguridad de esta y de toda operación anterior.\",\n );\n if (!apply) {\n rows.push({ path: backupsLabel, category: \"argos-home\", status: \"would-remove\" });\n } else {\n try {\n rmSync(backupsDir, { recursive: true, force: true });\n rows.push({ path: backupsLabel, category: \"argos-home\", status: \"removed\" });\n } catch (err) {\n rows.push({ path: backupsLabel, category: \"argos-home\", status: \"error\", detail: errorMessage(err) });\n }\n }\n }\n}\n\n/**\n * Core, testable implementation of `argos remove`: uninstalls everything\n * `runInit` (commands/init.ts) installs into `resolveClaudeDir()`. Pure\n * function of the filesystem — no process.exit, no console output.\n *\n * Preview by default (`apply: false`): computes the full report without\n * writing anything. `apply: true` performs the removal, backing up\n * everything affected first (same `createBackup` call `runInit` makes,\n * before any mutation). `purge: true` additionally removes `~/.argos` data\n * (kept by default) — backups are removed last and always warned about.\n */\nexport function runRemove(options: RemoveOptions = {}): RemoveReport {\n const apply = options.apply ?? false;\n const purge = options.purge ?? false;\n const claudeDir = resolveClaudeDir();\n const rows: RemoveRow[] = [];\n const warnings: string[] = [];\n\n let backupPath: string | undefined;\n if (apply) {\n try {\n backupPath = createBackup(claudeDir, [\n \"CLAUDE.md\",\n \"agents\",\n \"skills\",\n \"output-styles\",\n \"hooks\",\n \"settings.json\",\n ]);\n } catch (err) {\n const detail = errorMessage(err);\n rows.push({ path: \"backup\", category: \"argos-home\", status: \"error\", detail });\n return { rows, summary: `backup falló — no se tocó nada (${detail}).`, exitCode: 1, warnings };\n }\n }\n\n processClaudeMd(claudeDir, apply, rows);\n\n processManagedDir(claudeDir, \"agents\", \"agents-file\", hasArgosFileMarker, apply, rows);\n processSkillsDir(claudeDir, apply, rows);\n processManagedDir(claudeDir, \"output-styles\", \"output-styles-file\", hasArgosFileMarker, apply, rows);\n processManagedDir(claudeDir, \"hooks\", \"hooks-file\", hasArgosShellFileMarker, apply, rows);\n\n const settingsPath = join(claudeDir, \"settings.json\");\n const settingsResult = removeAllArgosHooksFromSettings(settingsPath, join(claudeDir, \"hooks\"), { dryRun: !apply });\n if (settingsResult.status === \"error\") {\n rows.push({ path: \"settings.json\", category: \"settings-entries\", status: \"error\", detail: settingsResult.detail });\n } else if (settingsResult.removedCount > 0) {\n const noun = settingsResult.removedCount === 1 ? \"entry\" : \"entries\";\n rows.push({\n path: \"settings.json\",\n category: \"settings-entries\",\n status: apply ? \"removed\" : \"would-remove\",\n detail: `${settingsResult.removedCount} hook ${noun}`,\n });\n }\n\n // Voice activation (spec 0004): remove settings.json.outputStyle ONLY when\n // it's still exactly \"Argos\" — the value argos init wrote. Any other\n // voice (a foreign one init never touched, or the key simply absent) is\n // left byte-identical; this is `argos remove`'s own value to clean up\n // after, never the user's.\n const outputStyleResult = removeOutputStyleIfArgos(settingsPath, { dryRun: !apply });\n if (outputStyleResult.status === \"error\") {\n rows.push({\n path: \"settings.json#outputStyle\",\n category: \"settings-entries\",\n status: \"error\",\n detail: outputStyleResult.detail,\n });\n } else if (outputStyleResult.status === \"removed\") {\n rows.push({\n path: \"settings.json#outputStyle\",\n category: \"settings-entries\",\n status: apply ? \"removed\" : \"would-remove\",\n });\n }\n\n if (purge) processPurge(apply, rows, warnings);\n\n // Always-present closing note: repo-side artifacts (argos.config.json, the\n // ficha block in a repo's own CLAUDE.md) are out of scope for `remove` —\n // see the module doc comment above.\n rows.push({\n path: \"scope\",\n category: \"scope-note\",\n status: \"info\",\n detail: \"los repos adoptados conservan su argos.config.json y ficha — este comando solo limpia ~/.claude y ~/.argos\",\n });\n\n const exitCode: 0 | 1 = rows.some((r) => r.status === \"error\") ? 1 : 0;\n return { rows, summary: summarize(rows, apply), exitCode, backupPath, warnings };\n}\n\nexport interface RemoveInteractiveOptions extends RemoveOptions {\n /** `--yes`: forces non-interactive behavior even under a real TTY. */\n yes?: boolean;\n /** Injectable for tests; defaults to the real `@clack/prompts`-backed prompter. */\n prompter?: Prompter;\n}\n\n/**\n * A cancelled confirmation's report: identical shape to a run that touched\n * nothing. `exitCode: 1` — a cancel is neither a successful write nor\n * silently indistinguishable from one by exit code alone (matches\n * `runWorkspaceLinkInteractive`'s convention for its own cancel paths).\n */\nfunction cancelledRemoveReport(reason: string): RemoveReport {\n return {\n rows: [{ path: \"cancel\", category: \"scope-note\", status: \"info\", detail: reason }],\n summary: `argos remove: cancelado — no se tocó nada (${reason}).`,\n exitCode: 1,\n warnings: [],\n };\n}\n\n/**\n * Interactive layer over `runRemove` (spec 0004 F5 \"argos remove\"). A pure\n * additive wrapper — the core `runRemove` never changes behavior or\n * contract. Without a real TTY, with `--yes`, or for a plain preview\n * (`apply: false`, the default) this delegates to `runRemove(options)`\n * unchanged — no prompt library call is ever reached on those paths. With a\n * TTY AND `apply: true`, requires the operator to type the exact target\n * directory (`resolveClaudeDir()`) before proceeding; `purge: true` on top\n * of that requires a SECOND, separate confirmation mentioning backups.\n * Either confirmation failing/cancelling aborts with zero writes.\n */\nexport async function runRemoveInteractive(options: RemoveInteractiveOptions = {}): Promise<RemoveReport> {\n const apply = options.apply ?? false;\n const purge = options.purge ?? false;\n\n if (!isInteractive({ yes: options.yes }) || !apply) {\n return runRemove(options);\n }\n\n const prompter = options.prompter ?? clackPrompter;\n const claudeDir = resolveClaudeDir();\n\n const typed = await prompter.text({\n message: `Esto desinstala el motor Argos de ${claudeDir}. Escribí \"${claudeDir}\" para confirmar:`,\n });\n if (prompter.isCancel(typed) || typed !== claudeDir) {\n prompter.cancel(\"argos remove cancelado — no se tocó nada.\");\n return cancelledRemoveReport(\"confirmación de directorio no coincide o fue cancelada\");\n }\n\n if (purge) {\n const confirmPurge = await prompter.confirm({\n message:\n \"--purge también borra ~/.argos/backups — se pierde la red de seguridad de esta y de toda operación anterior. ¿Confirmás?\",\n initialValue: false,\n });\n if (prompter.isCancel(confirmPurge) || !confirmPurge) {\n prompter.cancel(\"argos remove cancelado — no se tocó nada.\");\n return cancelledRemoveReport(\"--purge no confirmado\");\n }\n }\n\n const report = runRemove(options);\n prompter.outro(report.summary);\n return report;\n}\n\nexport const removeCommand = defineCommand({\n meta: {\n name: \"remove\",\n description: \"Uninstall the Argos engine from the global Claude Code home (preview by default).\",\n },\n args: {\n apply: {\n type: \"boolean\",\n default: false,\n description: \"Actually perform the removal (default: dry-run preview, touches nothing).\",\n },\n purge: {\n type: \"boolean\",\n default: false,\n description: \"Also remove ~/.argos data (registry, global.json, backups). Irreversible.\",\n },\n yes: {\n type: \"boolean\",\n default: false,\n description: \"Fuerza modo no interactivo aunque haya una TTY real (salta las confirmaciones tipadas).\",\n },\n },\n async run({ args }) {\n const report = await runRemoveInteractive({ apply: args.apply, purge: args.purge, yes: Boolean(args.yes) });\n\n const colorize = (status: RemoveRowStatus): string => {\n const padded = status.padEnd(18);\n switch (status) {\n case \"skipped-foreign\":\n return pc.yellow(padded);\n case \"removed\":\n return pc.cyan(padded);\n case \"would-remove\":\n return pc.dim(padded);\n case \"warning\":\n return pc.yellow(padded);\n case \"info\":\n return pc.dim(padded);\n case \"error\":\n return pc.red(padded);\n default:\n return padded;\n }\n };\n for (const row of report.rows) {\n const suffix = row.detail ? ` (${row.detail})` : \"\";\n console.log(`${colorize(row.status)} ${row.path}${suffix}`);\n }\n console.log(\"\");\n console.log(report.summary);\n if (report.backupPath) console.log(`backup en ${report.backupPath}`);\n for (const warning of report.warnings) console.log(pc.yellow(`aviso: ${warning}`));\n\n process.exit(report.exitCode);\n },\n});\n"],"names":["defineCommand","existsSync","readdirSync","readFileSync","rmSync","rmdirSync","join","relative","sep","pc","listSkillFiles","listSkillIds","MANAGED_BLOCK_IDS","resolveAssetsDir","writeFileAtomic","createBackup","listBlocks","removeBlock","hasArgosFileMarker","hasArgosShellFileMarker","resolveArgosHome","resolveClaudeDir","isInteractive","clackPrompter","removeAllArgosHooksFromSettings","removeOutputStyleIfArgos","STATUS_COUNT_ORDER","summarize","rows","apply","counts","removed","info","warning","error","row","status","parts","filter","s","map","verb","length","errorMessage","err","Error","message","String","processClaudeMd","claudeDir","claudeMdPath","claudeMd","push","path","category","detail","next","removedIds","id","hadBlock","some","b","beforeThisId","before","trim","force","walkFiles","dir","out","entry","withFileTypes","full","name","isDirectory","isFile","removeEmptyDirsUnder","remaining","processManagedDir","topDir","hasMarker","dirPath","files","file","relPath","content","processSkillsDir","skillsRoot","assetsDir","shippedSkillIds","Set","skillId","skillDir","skillMdPath","skillMdContent","isArgosOwned","manifest","has","relToClaudeDir","split","PURGE_FILES","processPurge","warnings","argosHome","p","label","backupsDir","backupsLabel","recursive","runRemove","options","purge","backupPath","summary","exitCode","settingsPath","settingsResult","dryRun","removedCount","noun","outputStyleResult","r","cancelledRemoveReport","reason","runRemoveInteractive","yes","prompter","typed","text","isCancel","cancel","confirmPurge","confirm","initialValue","report","outro","removeCommand","meta","description","args","type","default","run","Boolean","colorize","padded","padEnd","yellow","cyan","dim","red","suffix","console","log","process","exit"],"mappings":"AAAA,SAASA,aAAa,QAAQ,QAAQ;AACtC,SAASC,UAAU,EAAEC,WAAW,EAAEC,YAAY,EAAEC,MAAM,EAAEC,SAAS,QAAQ,UAAU;AACnF,SAASC,IAAI,EAAEC,QAAQ,EAAEC,GAAG,QAAQ,YAAY;AAChD,OAAOC,QAAQ,aAAa;AAC5B,SAASC,cAAc,EAAEC,YAAY,EAAEC,iBAAiB,EAAEC,gBAAgB,QAAQ,mBAAmB;AACrG,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,UAAU,EAAEC,WAAW,QAAQ,oBAAoB;AAC5D,SAASC,kBAAkB,EAAEC,uBAAuB,QAAQ,0BAA0B;AACtF,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,kBAAkB;AACrE,SAASC,aAAa,EAAEC,aAAa,QAAuB,qBAAqB;AACjF,SAASC,+BAA+B,EAAEC,wBAAwB,QAAQ,2BAA2B;AAqDrG,MAAMC,qBAAwC;IAC5C;IACA;IACA;IACA;IACA;IACA;CACD;AAED,SAASC,UAAUC,IAAiB,EAAEC,KAAc;IAClD,MAAMC,SAA0C;QAC9CC,SA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AAQ;QAC5D;QACAC,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAACnB,OAAOrB,OAAO;QAC1B,IAAIqB,OAAOtB,UAAU,EAAEwC,QAAQC,GAAG,CAAC,CAAC,UAAU,EAAEnB,OAAOtB,UAAU,EAAE;QACnE,KAAK,MAAM9E,WAAWoG,OAAOhC,QAAQ,CAAEkD,QAAQC,GAAG,CAAC/I,GAAGyI,MAAM,CAAC,CAAC,OAAO,EAAEjH,SAAS;QAEhFwH,QAAQC,IAAI,CAACrB,OAAOpB,QAAQ;IAC9B;AACF,GAAG"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type OpenclawRunner, type WorkspaceAgentRow } from "../lib/openclaw-agents.js";
|
|
2
|
+
import { type Prompter } from "../lib/prompter.js";
|
|
2
3
|
import { type LinkAction } from "../lib/workspaces.js";
|
|
3
4
|
export interface WorkspaceLinkOptions {
|
|
4
5
|
cwd: string;
|
|
@@ -7,6 +8,12 @@ export interface WorkspaceLinkOptions {
|
|
|
7
8
|
/** Overwrite a name collision (same config.name, different physical repo) instead of refusing. */
|
|
8
9
|
force?: boolean;
|
|
9
10
|
}
|
|
11
|
+
export interface WorkspaceLinkCollision {
|
|
12
|
+
workspaceName: string;
|
|
13
|
+
repoName: string;
|
|
14
|
+
oldPath: string;
|
|
15
|
+
newPath: string;
|
|
16
|
+
}
|
|
10
17
|
export interface WorkspaceLinkReport {
|
|
11
18
|
exitCode: 0 | 1;
|
|
12
19
|
error?: string;
|
|
@@ -16,6 +23,15 @@ export interface WorkspaceLinkReport {
|
|
|
16
23
|
createdWorkspace?: boolean;
|
|
17
24
|
/** Remote identity persisted as a new match rule, if the offer fired. */
|
|
18
25
|
matchRuleAdded?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Populated instead of a bare `error` string when `linkRepo` refused with
|
|
28
|
+
* `WorkspaceNameCollisionError` (see lib/workspaces.ts) — lets the
|
|
29
|
+
* interactive layer offer overwrite/cancel (the equivalent of `--force`)
|
|
30
|
+
* without having to string-parse `error`. Additive: `error` is still set
|
|
31
|
+
* alongside it, so any caller only reading `error` behaves exactly as
|
|
32
|
+
* before.
|
|
33
|
+
*/
|
|
34
|
+
collision?: WorkspaceLinkCollision;
|
|
19
35
|
}
|
|
20
36
|
/**
|
|
21
37
|
* Core, testable implementation of `argos workspace link [nombre]`: resolves
|
|
@@ -25,6 +41,22 @@ export interface WorkspaceLinkReport {
|
|
|
25
41
|
* remote as a match rule so future repos under the same identity auto-link.
|
|
26
42
|
*/
|
|
27
43
|
export declare function runWorkspaceLink(options: WorkspaceLinkOptions): WorkspaceLinkReport;
|
|
44
|
+
export interface WorkspaceLinkInteractiveOptions extends WorkspaceLinkOptions {
|
|
45
|
+
/** Injectable for tests; defaults to the real `@clack/prompts`-backed prompter. */
|
|
46
|
+
prompter?: Prompter;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Interactive layer over `runWorkspaceLink` (spec 0004 F5 "argos workspace
|
|
50
|
+
* link"). A pure additive wrapper — the core `runWorkspaceLink` never
|
|
51
|
+
* changes behavior or contract. Without a real TTY this delegates to
|
|
52
|
+
* `runWorkspaceLink(options)` unchanged (there's no `--yes` on this command:
|
|
53
|
+
* absence of a real TTY is itself sufficient gate, per spec 0004). With a
|
|
54
|
+
* TTY: an ambiguous match-rule resolution is resolved via `select` instead
|
|
55
|
+
* of erroring, and a name collision (`WorkspaceNameCollisionError`) is
|
|
56
|
+
* offered as an overwrite/cancel prompt — the interactive equivalent of
|
|
57
|
+
* `--force`, which stays the non-interactive escape hatch unchanged.
|
|
58
|
+
*/
|
|
59
|
+
export declare function runWorkspaceLinkInteractive(options: WorkspaceLinkInteractiveOptions): Promise<WorkspaceLinkReport>;
|
|
28
60
|
export interface WorkspaceShowRepoRow {
|
|
29
61
|
workspace: string;
|
|
30
62
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/commands/workspace.ts"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