argos-harness 0.1.0 → 0.2.0
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 +38 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +222 -59
- 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/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/adopt.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { basename, join } from \"node:path\";\nimport pc from \"picocolors\";\nimport { writeFileAtomic } from \"../lib/atomic-write.js\";\nimport {\n CONFIG_FILENAME,\n type ArgosConfig,\n type ArgosConfigInput,\n hasConfig,\n readConfig,\n writeConfig,\n} from \"../lib/config.js\";\nimport {\n buildQualityGateFast,\n detectFramework,\n detectLibs,\n detectMappedSkills,\n detectPackageManager,\n MOTOR_SKILLS,\n readPackageJson,\n} from \"../lib/detect.js\";\nimport { createBackup } from \"../lib/backup.js\";\nimport { buildFichaContent, FICHA_BLOCK_ID } from \"../lib/ficha.js\";\nimport { checkGitRepo, getRemoteOriginUrl, parseIdentityFromRemote } from \"../lib/git.js\";\nimport { injectBlock, listBlocks } from \"../lib/markers.js\";\nimport type { FileStatus } from \"../lib/managed-files.js\";\nimport { readNaviorConfig } from \"../lib/navori-import.js\";\nimport { readCliVersion } from \"../lib/version.js\";\nimport { linkRepo, loadRegistry, resolveWorkspaceForRepo } from \"../lib/workspaces.js\";\n\n/** Written when no lint/typecheck/test script exists to build a real gate from. */\nexport const NO_GATE_PLACEHOLDER =\n \"echo 'argos: no lint/typecheck/test scripts detected — set qualityGate.fast manually'\";\n\nexport interface AdoptRow {\n field: string;\n value: string;\n source: \"imported\" | \"preserved\" | \"detected\" | \"default\" | \"info\" | \"warning\" | \"error\";\n}\n\nexport interface AdoptOptions {\n cwd: string;\n refresh?: boolean;\n}\n\nexport interface AdoptReport {\n rows: AdoptRow[];\n configPath?: string;\n fichaStatus?: FileStatus;\n backupPath?: string;\n exitCode: 0 | 1;\n error?: string;\n}\n\nfunction errorMessage(err: unknown): string {\n return err instanceof Error ? err.message : String(err);\n}\n\n/**\n * Core, testable implementation of `argos adopt [--refresh]`: writes\n * `argos.config.json` (detecting stack/quality-gate/identity, importing\n * `navori.config.json` when present) and injects the `ficha` managed block\n * into `./CLAUDE.md`. Pure function of the filesystem — no process.exit.\n */\nexport function runAdopt(options: AdoptOptions): AdoptReport {\n const { cwd, refresh = false } = options;\n\n const gitCheck = checkGitRepo(cwd);\n if (!gitCheck.isRepo) {\n return {\n rows: [],\n exitCode: 1,\n error: gitCheck.gitMissing\n ? \"No se encontró el binario git — instalá git y volvé a intentar.\"\n : \"argos adopt debe ejecutarse dentro de un repositorio git.\",\n };\n }\n\n const configExists = hasConfig(cwd);\n if (configExists && !refresh) {\n return {\n rows: [],\n exitCode: 1,\n error: \"argos.config.json ya existe. Corre `argos adopt --refresh` para regenerarlo.\",\n };\n }\n\n const rows: AdoptRow[] = [];\n\n let existing: ArgosConfig | undefined;\n if (configExists) {\n try {\n existing = readConfig(cwd);\n } catch {\n rows.push({\n field: \"argos.config.json\",\n value: \"config existente inválido, se regenera desde cero\",\n source: \"warning\",\n });\n }\n }\n\n const naviorResult = readNaviorConfig(cwd);\n const navori = naviorResult.kind === \"imported\" ? naviorResult.data : undefined;\n if (naviorResult.kind === \"imported\") {\n rows.push({ field: \"import\", value: \"importado de navori.config.json\", source: \"imported\" });\n } else if (naviorResult.kind === \"unreadable\") {\n rows.push({\n field: \"navori.config.json\",\n value: \"navori.config.json presente pero ilegible — ignorado\",\n source: \"warning\",\n });\n }\n\n const pkg = readPackageJson(cwd);\n\n // name: existing > navori import > package.json > repo dirname\n let name: string;\n let nameSource: AdoptRow[\"source\"];\n if (existing?.name) {\n name = existing.name;\n nameSource = \"preserved\";\n } else if (navori?.name) {\n name = navori.name;\n nameSource = \"imported\";\n } else if (pkg?.name) {\n name = pkg.name;\n nameSource = \"detected\";\n } else {\n name = basename(cwd);\n nameSource = \"default\";\n }\n rows.push({ field: \"name\", value: name, source: nameSource });\n\n // workspace / branchBase / prTarget: existing > navori import > default (no detection exists for these)\n const workspace = existing?.workspace ?? navori?.workspace;\n rows.push({\n field: \"workspace\",\n value: workspace ?? \"(sin asignar)\",\n source: existing?.workspace ? \"preserved\" : navori?.workspace ? \"imported\" : \"default\",\n });\n\n const branchBase = existing?.branchBase ?? navori?.branchBase ?? \"main\";\n rows.push({\n field: \"branchBase\",\n value: branchBase,\n source: existing?.branchBase ? \"preserved\" : navori?.branchBase ? \"imported\" : \"default\",\n });\n\n const prTarget = existing?.prTarget ?? navori?.prTarget;\n if (prTarget) {\n rows.push({\n field: \"prTarget\",\n value: prTarget,\n source: existing?.prTarget ? \"preserved\" : \"imported\",\n });\n }\n\n // project: existing > navori import > empty defaults\n const project = existing?.project ?? {\n criticalAreas: navori?.project?.criticalAreas ?? [],\n legacyPaths: navori?.project?.legacyPaths ?? [],\n };\n rows.push({\n field: \"project\",\n value: `criticalAreas=[${project.criticalAreas.join(\", \")}] legacyPaths=[${project.legacyPaths.join(\", \")}]`,\n source: existing?.project ? \"preserved\" : navori?.project ? \"imported\" : \"default\",\n });\n\n // stack (packageManager/framework/libs): always freshly detected.\n const packageManager = detectPackageManager(cwd);\n const framework = pkg ? detectFramework(pkg) : undefined;\n const libs = pkg ? detectLibs(pkg) : [];\n rows.push({ field: \"stack.packageManager\", value: packageManager ?? \"(no detectado)\", source: \"detected\" });\n rows.push({ field: \"stack.framework\", value: framework ?? \"(no detectado)\", source: \"detected\" });\n rows.push({ field: \"stack.libs\", value: libs.join(\", \") || \"(ninguna)\", source: \"detected\" });\n\n // qualityGate: existing > navori import > detected from package.json scripts\n const importedFull = existing?.qualityGate?.full ?? navori?.qualityGate?.full;\n const importedFast = existing?.qualityGate?.fast || navori?.qualityGate?.fast;\n let qualityGate: { fast: string; full?: string };\n if (importedFast) {\n qualityGate = { fast: importedFast, full: importedFull };\n rows.push({\n field: \"qualityGate.fast\",\n value: importedFast,\n source: existing?.qualityGate ? \"preserved\" : \"imported\",\n });\n } else {\n const fast = pkg && packageManager ? buildQualityGateFast(pkg, packageManager) : \"\";\n if (fast) {\n qualityGate = { fast, full: importedFull };\n rows.push({ field: \"qualityGate.fast\", value: fast, source: \"detected\" });\n } else {\n qualityGate = { fast: NO_GATE_PLACEHOLDER, full: importedFull };\n rows.push({\n field: \"qualityGate.fast\",\n value: \"no se detectaron scripts lint/typecheck/test\",\n source: \"warning\",\n });\n }\n }\n\n // identity: always freshly detected from the git remote.\n const remoteUrl = getRemoteOriginUrl(cwd);\n const identity = remoteUrl ? (parseIdentityFromRemote(remoteUrl) ?? undefined) : undefined;\n rows.push({ field: \"identity\", value: identity ?? \"(no detectada)\", source: \"detected\" });\n\n // skills: the 4 hardcoded motor skills plus whatever DEP_SKILL_MAP maps\n // from the repo's detected deps, deduped and in stable (MOTOR_SKILLS\n // first, then DEP_SKILL_MAP declaration order) order.\n const mappedSkills = pkg ? detectMappedSkills(pkg) : [];\n const skills = [...MOTOR_SKILLS, ...mappedSkills.filter((id) => !MOTOR_SKILLS.includes(id))];\n rows.push({ field: \"skills\", value: skills.join(\", \"), source: \"detected\" });\n\n const configInput: ArgosConfigInput = {\n name,\n language: existing?.language ?? \"es\",\n workspace,\n branchBase,\n prTarget,\n qualityGate,\n project,\n identity,\n stack: { framework, packageManager, libs },\n skills,\n };\n\n let configPath: string | undefined;\n let finalConfig: ArgosConfig | undefined;\n try {\n writeConfig(cwd, configInput);\n configPath = join(cwd, CONFIG_FILENAME);\n finalConfig = readConfig(cwd);\n } catch (err) {\n rows.push({ field: \"argos.config.json\", value: errorMessage(err), source: \"error\" });\n return { rows, configPath, exitCode: 1 };\n }\n\n // Workspace auto-link: resolve the same explicit>config>match-rules chain\n // `workspace link` uses and register the repo when it resolves cleanly.\n // Never blocks adopt — an unresolved or ambiguous result is reported as a\n // pending step (info/warning row), not an error.\n try {\n const registry = loadRegistry();\n const resolution = resolveWorkspaceForRepo(registry, {\n configWorkspace: finalConfig.workspace,\n remoteUrl,\n repoPath: cwd,\n });\n if (resolution.kind === \"resolved\") {\n const linkResult = linkRepo(resolution.name, { name: finalConfig.name, path: cwd });\n rows.push({\n field: \"workspace.link\",\n value: `${linkResult.action} en workspace '${resolution.name}'`,\n source: \"detected\",\n });\n } else if (resolution.kind === \"ambiguous\") {\n rows.push({\n field: \"workspace.link\",\n value: `ambiguo entre workspaces (${resolution.candidates.join(\", \")}) — corre argos workspace link <nombre>`,\n source: \"warning\",\n });\n } else {\n rows.push({\n field: \"workspace.link\",\n value: \"workspace sin resolver — corre argos workspace link <nombre>\",\n source: \"info\",\n });\n }\n } catch (err) {\n rows.push({ field: \"workspace.link\", value: errorMessage(err), source: \"warning\" });\n }\n\n // Ficha: inject/replace the `ficha` managed block in ./CLAUDE.md via the\n // same markers lib used for the global engine — foreign content untouched.\n let fichaStatus: FileStatus | undefined;\n let backupPath: string | undefined;\n try {\n // Back up the repo's own CLAUDE.md before mutating it in place — same\n // backups location the global engine uses, keyed by an arbitrary source dir.\n backupPath = createBackup(cwd, [\"CLAUDE.md\"]);\n\n const fichaContent = buildFichaContent(finalConfig);\n const claudeMdPath = join(cwd, \"CLAUDE.md\");\n const claudeMdBefore = existsSync(claudeMdPath) ? readFileSync(claudeMdPath, \"utf-8\") : \"\";\n const hadFicha = listBlocks(claudeMdBefore).some((b) => b.id === FICHA_BLOCK_ID);\n const claudeMdAfter = injectBlock(claudeMdBefore, FICHA_BLOCK_ID, readCliVersion(), fichaContent);\n fichaStatus = claudeMdAfter === claudeMdBefore ? \"unchanged\" : hadFicha ? \"updated\" : \"created\";\n writeFileAtomic(claudeMdPath, claudeMdAfter);\n rows.push({ field: \"ficha (./CLAUDE.md)\", value: fichaStatus, source: \"detected\" });\n } catch (err) {\n rows.push({ field: \"ficha (./CLAUDE.md)\", value: errorMessage(err), source: \"error\" });\n }\n\n const exitCode: 0 | 1 = rows.some((r) => r.source === \"error\") ? 1 : 0;\n return { rows, configPath, fichaStatus, backupPath, exitCode };\n}\n\nexport const adoptCommand = defineCommand({\n meta: {\n name: \"adopt\",\n description: \"Detect a repo's stack and write its argos.config.json.\",\n },\n args: {\n refresh: {\n type: \"boolean\",\n default: false,\n description: \"Regenera argos.config.json y la ficha aunque ya existan.\",\n },\n },\n run({ args }) {\n const report = runAdopt({ cwd: process.cwd(), refresh: Boolean(args.refresh) });\n\n if (report.error) {\n console.error(pc.red(report.error));\n process.exit(report.exitCode);\n }\n\n for (const row of report.rows) {\n const paddedSource = row.source.padEnd(10);\n const label =\n row.source === \"error\" ? pc.red(paddedSource) : row.source === \"warning\" ? pc.yellow(paddedSource) : pc.dim(paddedSource);\n console.log(`${label} ${row.field.padEnd(28)} ${row.value}`);\n }\n console.log(\"\");\n console.log(`argos.config.json escrito en ${report.configPath}`);\n if (report.backupPath) console.log(`backup en ${report.backupPath}`);\n\n process.exit(report.exitCode);\n },\n});\n"],"names":["defineCommand","existsSync","readFileSync","basename","join","pc","writeFileAtomic","CONFIG_FILENAME","hasConfig","readConfig","writeConfig","buildQualityGateFast","detectFramework","detectLibs","detectMappedSkills","detectPackageManager","MOTOR_SKILLS","readPackageJson","createBackup","buildFichaContent","FICHA_BLOCK_ID","checkGitRepo","getRemoteOriginUrl","parseIdentityFromRemote","injectBlock","listBlocks","readNaviorConfig","readCliVersion","linkRepo","loadRegistry","resolveWorkspaceForRepo","NO_GATE_PLACEHOLDER","errorMessage","err","Error","message","String","runAdopt","options","cwd","refresh","gitCheck","isRepo","rows","exitCode","error","gitMissing","configExists","existing","push","field","value","source","naviorResult","navori","kind","data","undefined","pkg","name","nameSource","workspace","branchBase","prTarget","project","criticalAreas","legacyPaths","packageManager","framework","libs","importedFull","qualityGate","full","importedFast","fast","remoteUrl","identity","mappedSkills","skills","filter","id","includes","configInput","language","stack","configPath","finalConfig","registry","resolution","configWorkspace","repoPath","linkResult","path","action","candidates","fichaStatus","backupPath","fichaContent","claudeMdPath","claudeMdBefore","hadFicha","some","b","claudeMdAfter","r","adoptCommand","meta","description","args","type","default","run","report","process","Boolean","console","red","exit","row","paddedSource","padEnd","label","yellow","dim","log"],"mappings":"AAAA,SAASA,aAAa,QAAQ,QAAQ;AACtC,SAASC,UAAU,EAAEC,YAAY,QAAQ,UAAU;AACnD,SAASC,QAAQ,EAAEC,IAAI,QAAQ,YAAY;AAC3C,OAAOC,QAAQ,aAAa;AAC5B,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SACEC,eAAe,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AAEH,IAAIpE,KAAK,CAACsE,MAAM,CAAC,IAAI,CAAC,EAAEF,IAAInE,KAAK,EAAE;QAC7D;QACAgE,QAAQS,GAAG,CAAC;QACZT,QAAQS,GAAG,CAAC,CAAC,6BAA6B,EAAEZ,OAAO3B,UAAU,EAAE;QAC/D,IAAI2B,OAAOhB,UAAU,EAAEmB,QAAQS,GAAG,CAAC,CAAC,UAAU,EAAEZ,OAAOhB,UAAU,EAAE;QAEnEiB,QAAQI,IAAI,CAACL,OAAOpE,QAAQ;IAC9B;AACF,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../../src/commands/adopt.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { basename, join } from \"node:path\";\nimport pc from \"picocolors\";\nimport { writeFileAtomic } from \"../lib/atomic-write.js\";\nimport {\n CONFIG_FILENAME,\n type ArgosConfig,\n type ArgosConfigInput,\n hasConfig,\n readConfig,\n writeConfig,\n} from \"../lib/config.js\";\nimport {\n buildQualityGateFast,\n detectFramework,\n detectLibs,\n detectMappedSkills,\n detectPackageManager,\n MOTOR_SKILLS,\n readPackageJson,\n} from \"../lib/detect.js\";\nimport { createBackup } from \"../lib/backup.js\";\nimport { buildFichaContent, FICHA_BLOCK_ID } from \"../lib/ficha.js\";\nimport { checkGitRepo, getRemoteOriginUrl, parseIdentityFromRemote } from \"../lib/git.js\";\nimport { injectBlock, listBlocks } from \"../lib/markers.js\";\nimport type { FileStatus } from \"../lib/managed-files.js\";\nimport { readNaviorConfig } from \"../lib/navori-import.js\";\nimport { isInteractive, clackPrompter, type Prompter } from \"../lib/prompter.js\";\nimport { readCliVersion } from \"../lib/version.js\";\nimport { linkRepo, loadRegistry, resolveWorkspaceForRepo } from \"../lib/workspaces.js\";\n\n/** Written when no lint/typecheck/test script exists to build a real gate from. */\nexport const NO_GATE_PLACEHOLDER =\n \"echo 'argos: no lint/typecheck/test scripts detected — set qualityGate.fast manually'\";\n\nexport interface AdoptRow {\n field: string;\n value: string;\n source: \"imported\" | \"preserved\" | \"detected\" | \"default\" | \"edited\" | \"info\" | \"warning\" | \"error\";\n}\n\nexport interface AdoptOverrides {\n name?: string;\n branchBase?: string;\n qualityGateFast?: string;\n workspace?: string;\n identity?: string;\n}\n\nexport interface AdoptOptions {\n cwd: string;\n refresh?: boolean;\n /**\n * Values the interactive layer collected by presenting the\n * detected/imported defaults as editable (spec 0004 \"argos adopt\";\n * Enter = accept the detected value). Additive — every field optional,\n * and omitting `overrides` entirely reproduces today's non-interactive\n * behavior byte-for-byte. Applied in place of the corresponding detected\n * value, reported with row `source: \"edited\"`.\n */\n overrides?: AdoptOverrides;\n}\n\n/**\n * Pure value selection: the interactive-layer override wins over the\n * detected/imported value, when one was collected and it actually differs\n * (Enter-accepted defaults come back as `undefined` from the wizard — see\n * `runAdoptInteractive` — so they're a no-op here too). No side effects —\n * safe to embed in an expression (e.g. an object spread) without hiding a\n * mutation inside it.\n */\nfunction resolveOverride<T extends string | undefined>(computed: T, override: T | undefined): T {\n return override === undefined || override === computed ? computed : override;\n}\n\n/**\n * The mutation half of applying an override: when `override` differs from\n * `computed` (the value already pushed as `field`'s row), rewrites that\n * row's `value`/`source` in place to reflect the edit (`source: \"edited\"`).\n * Deliberately separate from `resolveOverride` and NEVER called embedded\n * inside another expression (e.g. a spread) — always its own statement, so\n * the side effect is visible at the call site, not hidden.\n */\nfunction markRowEditedIfOverridden<T extends string | undefined>(\n rows: AdoptRow[],\n field: string,\n computed: T,\n override: T | undefined,\n): void {\n if (override === undefined || override === computed) return;\n const row = rows.find((r) => r.field === field);\n if (row) {\n row.value = override;\n row.source = \"edited\";\n }\n}\n\nexport interface AdoptReport {\n rows: AdoptRow[];\n configPath?: string;\n fichaStatus?: FileStatus;\n backupPath?: string;\n exitCode: 0 | 1;\n error?: string;\n}\n\nfunction errorMessage(err: unknown): string {\n return err instanceof Error ? err.message : String(err);\n}\n\n/**\n * Core, testable implementation of `argos adopt [--refresh]`: writes\n * `argos.config.json` (detecting stack/quality-gate/identity, importing\n * `navori.config.json` when present) and injects the `ficha` managed block\n * into `./CLAUDE.md`. Pure function of the filesystem — no process.exit.\n */\nexport function runAdopt(options: AdoptOptions): AdoptReport {\n const { cwd, refresh = false } = options;\n\n const gitCheck = checkGitRepo(cwd);\n if (!gitCheck.isRepo) {\n return {\n rows: [],\n exitCode: 1,\n error: gitCheck.gitMissing\n ? \"No se encontró el binario git — instalá git y volvé a intentar.\"\n : \"argos adopt debe ejecutarse dentro de un repositorio git.\",\n };\n }\n\n const configExists = hasConfig(cwd);\n if (configExists && !refresh) {\n return {\n rows: [],\n exitCode: 1,\n error: \"argos.config.json ya existe. Corre `argos adopt --refresh` para regenerarlo.\",\n };\n }\n\n const rows: AdoptRow[] = [];\n\n let existing: ArgosConfig | undefined;\n if (configExists) {\n try {\n existing = readConfig(cwd);\n } catch {\n rows.push({\n field: \"argos.config.json\",\n value: \"config existente inválido, se regenera desde cero\",\n source: \"warning\",\n });\n }\n }\n\n const naviorResult = readNaviorConfig(cwd);\n const navori = naviorResult.kind === \"imported\" ? naviorResult.data : undefined;\n if (naviorResult.kind === \"imported\") {\n rows.push({ field: \"import\", value: \"importado de navori.config.json\", source: \"imported\" });\n } else if (naviorResult.kind === \"unreadable\") {\n rows.push({\n field: \"navori.config.json\",\n value: \"navori.config.json presente pero ilegible — ignorado\",\n source: \"warning\",\n });\n }\n\n const pkg = readPackageJson(cwd);\n\n // name: existing > navori import > package.json > repo dirname\n let name: string;\n let nameSource: AdoptRow[\"source\"];\n if (existing?.name) {\n name = existing.name;\n nameSource = \"preserved\";\n } else if (navori?.name) {\n name = navori.name;\n nameSource = \"imported\";\n } else if (pkg?.name) {\n name = pkg.name;\n nameSource = \"detected\";\n } else {\n name = basename(cwd);\n nameSource = \"default\";\n }\n rows.push({ field: \"name\", value: name, source: nameSource });\n markRowEditedIfOverridden(rows, \"name\", name, options.overrides?.name);\n name = resolveOverride(name, options.overrides?.name);\n\n // workspace / branchBase / prTarget: existing > navori import > default (no detection exists for these)\n let workspace: string | undefined = existing?.workspace ?? navori?.workspace;\n rows.push({\n field: \"workspace\",\n value: workspace ?? \"(sin asignar)\",\n source: existing?.workspace ? \"preserved\" : navori?.workspace ? \"imported\" : \"default\",\n });\n markRowEditedIfOverridden(rows, \"workspace\", workspace, options.overrides?.workspace);\n workspace = resolveOverride(workspace, options.overrides?.workspace);\n\n let branchBase = existing?.branchBase ?? navori?.branchBase ?? \"main\";\n rows.push({\n field: \"branchBase\",\n value: branchBase,\n source: existing?.branchBase ? \"preserved\" : navori?.branchBase ? \"imported\" : \"default\",\n });\n markRowEditedIfOverridden(rows, \"branchBase\", branchBase, options.overrides?.branchBase);\n branchBase = resolveOverride(branchBase, options.overrides?.branchBase);\n\n const prTarget = existing?.prTarget ?? navori?.prTarget;\n if (prTarget) {\n rows.push({\n field: \"prTarget\",\n value: prTarget,\n source: existing?.prTarget ? \"preserved\" : \"imported\",\n });\n }\n\n // project: existing > navori import > empty defaults\n const project = existing?.project ?? {\n criticalAreas: navori?.project?.criticalAreas ?? [],\n legacyPaths: navori?.project?.legacyPaths ?? [],\n };\n rows.push({\n field: \"project\",\n value: `criticalAreas=[${project.criticalAreas.join(\", \")}] legacyPaths=[${project.legacyPaths.join(\", \")}]`,\n source: existing?.project ? \"preserved\" : navori?.project ? \"imported\" : \"default\",\n });\n\n // stack (packageManager/framework/libs): always freshly detected.\n const packageManager = detectPackageManager(cwd);\n const framework = pkg ? detectFramework(pkg) : undefined;\n const libs = pkg ? detectLibs(pkg) : [];\n rows.push({ field: \"stack.packageManager\", value: packageManager ?? \"(no detectado)\", source: \"detected\" });\n rows.push({ field: \"stack.framework\", value: framework ?? \"(no detectado)\", source: \"detected\" });\n rows.push({ field: \"stack.libs\", value: libs.join(\", \") || \"(ninguna)\", source: \"detected\" });\n\n // qualityGate: existing > navori import > detected from package.json scripts\n const importedFull = existing?.qualityGate?.full ?? navori?.qualityGate?.full;\n const importedFast = existing?.qualityGate?.fast || navori?.qualityGate?.fast;\n let qualityGate: { fast: string; full?: string };\n if (importedFast) {\n qualityGate = { fast: importedFast, full: importedFull };\n rows.push({\n field: \"qualityGate.fast\",\n value: importedFast,\n source: existing?.qualityGate ? \"preserved\" : \"imported\",\n });\n } else {\n const fast = pkg && packageManager ? buildQualityGateFast(pkg, packageManager) : \"\";\n if (fast) {\n qualityGate = { fast, full: importedFull };\n rows.push({ field: \"qualityGate.fast\", value: fast, source: \"detected\" });\n } else {\n qualityGate = { fast: NO_GATE_PLACEHOLDER, full: importedFull };\n rows.push({\n field: \"qualityGate.fast\",\n value: \"no se detectaron scripts lint/typecheck/test\",\n source: \"warning\",\n });\n }\n }\n markRowEditedIfOverridden(rows, \"qualityGate.fast\", qualityGate.fast, options.overrides?.qualityGateFast);\n qualityGate = { ...qualityGate, fast: resolveOverride(qualityGate.fast, options.overrides?.qualityGateFast) };\n\n // identity: always freshly detected from the git remote.\n const remoteUrl = getRemoteOriginUrl(cwd);\n let identity = remoteUrl ? (parseIdentityFromRemote(remoteUrl) ?? undefined) : undefined;\n rows.push({ field: \"identity\", value: identity ?? \"(no detectada)\", source: \"detected\" });\n markRowEditedIfOverridden(rows, \"identity\", identity, options.overrides?.identity);\n identity = resolveOverride(identity, options.overrides?.identity);\n\n // skills: the 4 hardcoded motor skills plus whatever DEP_SKILL_MAP maps\n // from the repo's detected deps, deduped and in stable (MOTOR_SKILLS\n // first, then DEP_SKILL_MAP declaration order) order.\n const mappedSkills = pkg ? detectMappedSkills(pkg) : [];\n const skills = [...MOTOR_SKILLS, ...mappedSkills.filter((id) => !MOTOR_SKILLS.includes(id))];\n rows.push({ field: \"skills\", value: skills.join(\", \"), source: \"detected\" });\n\n const configInput: ArgosConfigInput = {\n name,\n language: existing?.language ?? \"es\",\n workspace,\n branchBase,\n prTarget,\n qualityGate,\n project,\n identity,\n stack: { framework, packageManager, libs },\n skills,\n };\n\n let configPath: string | undefined;\n let finalConfig: ArgosConfig | undefined;\n try {\n writeConfig(cwd, configInput);\n configPath = join(cwd, CONFIG_FILENAME);\n finalConfig = readConfig(cwd);\n } catch (err) {\n rows.push({ field: \"argos.config.json\", value: errorMessage(err), source: \"error\" });\n return { rows, configPath, exitCode: 1 };\n }\n\n // Workspace auto-link: resolve the same explicit>config>match-rules chain\n // `workspace link` uses and register the repo when it resolves cleanly.\n // Never blocks adopt — an unresolved or ambiguous result is reported as a\n // pending step (info/warning row), not an error.\n try {\n const registry = loadRegistry();\n const resolution = resolveWorkspaceForRepo(registry, {\n configWorkspace: finalConfig.workspace,\n remoteUrl,\n repoPath: cwd,\n });\n if (resolution.kind === \"resolved\") {\n const linkResult = linkRepo(resolution.name, { name: finalConfig.name, path: cwd });\n rows.push({\n field: \"workspace.link\",\n value: `${linkResult.action} en workspace '${resolution.name}'`,\n source: \"detected\",\n });\n } else if (resolution.kind === \"ambiguous\") {\n rows.push({\n field: \"workspace.link\",\n value: `ambiguo entre workspaces (${resolution.candidates.join(\", \")}) — corre argos workspace link <nombre>`,\n source: \"warning\",\n });\n } else {\n rows.push({\n field: \"workspace.link\",\n value: \"workspace sin resolver — corre argos workspace link <nombre>\",\n source: \"info\",\n });\n }\n } catch (err) {\n rows.push({ field: \"workspace.link\", value: errorMessage(err), source: \"warning\" });\n }\n\n // Ficha: inject/replace the `ficha` managed block in ./CLAUDE.md via the\n // same markers lib used for the global engine — foreign content untouched.\n let fichaStatus: FileStatus | undefined;\n let backupPath: string | undefined;\n try {\n // Back up the repo's own CLAUDE.md before mutating it in place — same\n // backups location the global engine uses, keyed by an arbitrary source dir.\n backupPath = createBackup(cwd, [\"CLAUDE.md\"]);\n\n const fichaContent = buildFichaContent(finalConfig);\n const claudeMdPath = join(cwd, \"CLAUDE.md\");\n const claudeMdBefore = existsSync(claudeMdPath) ? readFileSync(claudeMdPath, \"utf-8\") : \"\";\n const hadFicha = listBlocks(claudeMdBefore).some((b) => b.id === FICHA_BLOCK_ID);\n const claudeMdAfter = injectBlock(claudeMdBefore, FICHA_BLOCK_ID, readCliVersion(), fichaContent);\n fichaStatus = claudeMdAfter === claudeMdBefore ? \"unchanged\" : hadFicha ? \"updated\" : \"created\";\n writeFileAtomic(claudeMdPath, claudeMdAfter);\n rows.push({ field: \"ficha (./CLAUDE.md)\", value: fichaStatus, source: \"detected\" });\n } catch (err) {\n rows.push({ field: \"ficha (./CLAUDE.md)\", value: errorMessage(err), source: \"error\" });\n }\n\n const exitCode: 0 | 1 = rows.some((r) => r.source === \"error\") ? 1 : 0;\n return { rows, configPath, fichaStatus, backupPath, exitCode };\n}\n\ninterface AdoptDefaults {\n name: string;\n branchBase: string;\n qualityGateFast: string;\n identity?: string;\n workspaceDefault?: string;\n workspaceAmbiguousCandidates?: string[];\n /** Human-readable description of the resolution chain that found `workspaceDefault`/the ambiguity, for display only. */\n workspaceChain: string;\n}\n\n/**\n * Read-only preview of the values `runAdopt` would detect/import, used only\n * to seed the interactive wizard's editable prompts (spec 0004 \"argos\n * adopt\": \"Enter = aceptar lo detectado\"). Deliberately duplicates a slice\n * of `runAdopt`'s own detection logic instead of factoring it out from\n * there — this function never writes anything (no config, no ficha, no\n * registry), so it's safe to call before deciding what to write, but it must\n * stay obviously side-effect-free rather than becoming a shared code path\n * with the writing core.\n */\nfunction computeAdoptDefaults(cwd: string): AdoptDefaults {\n let existing: ArgosConfig | undefined;\n if (hasConfig(cwd)) {\n try {\n existing = readConfig(cwd);\n } catch {\n existing = undefined;\n }\n }\n const naviorResult = readNaviorConfig(cwd);\n const navori = naviorResult.kind === \"imported\" ? naviorResult.data : undefined;\n const pkg = readPackageJson(cwd);\n\n const name = existing?.name ?? navori?.name ?? pkg?.name ?? basename(cwd);\n const branchBase = existing?.branchBase ?? navori?.branchBase ?? \"main\";\n\n const packageManager = detectPackageManager(cwd);\n const importedFast = existing?.qualityGate?.fast || navori?.qualityGate?.fast;\n const qualityGateFast =\n importedFast || (pkg && packageManager ? buildQualityGateFast(pkg, packageManager) : \"\") || NO_GATE_PLACEHOLDER;\n\n const remoteUrl = getRemoteOriginUrl(cwd);\n const identity = remoteUrl ? (parseIdentityFromRemote(remoteUrl) ?? undefined) : undefined;\n\n const configWorkspace = existing?.workspace ?? navori?.workspace;\n let workspaceDefault: string | undefined = configWorkspace;\n let workspaceAmbiguousCandidates: string[] | undefined;\n let workspaceChain: string;\n if (configWorkspace) {\n workspaceChain = existing?.workspace ? \"argos.config.json existente\" : \"importado de navori.config.json\";\n } else {\n let registry: ReturnType<typeof loadRegistry>;\n try {\n registry = loadRegistry();\n } catch {\n registry = {};\n }\n const resolution = resolveWorkspaceForRepo(registry, { remoteUrl, repoPath: cwd });\n if (resolution.kind === \"resolved\") {\n workspaceDefault = resolution.name;\n workspaceChain = `match rule (${resolution.source})`;\n } else if (resolution.kind === \"ambiguous\") {\n workspaceAmbiguousCandidates = resolution.candidates;\n workspaceChain = `ambiguo (${resolution.source})`;\n } else {\n workspaceChain = \"sin resolver\";\n }\n }\n\n return { name, branchBase, qualityGateFast, identity, workspaceDefault, workspaceAmbiguousCandidates, workspaceChain };\n}\n\nexport interface AdoptInteractiveOptions extends AdoptOptions {\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 cancelledAdoptReport(): AdoptReport {\n return { rows: [], exitCode: 1 };\n}\n\n/**\n * Interactive layer over `runAdopt` (spec 0004 F5 \"argos adopt\"). A pure\n * additive wrapper — the core `runAdopt` never changes behavior or\n * contract. Without a real TTY, or with `--yes`, this delegates to\n * `runAdopt(options)` unchanged. With a TTY, and only when the underlying\n * call would otherwise proceed to detection (repo exists, config doesn't\n * already block without `--refresh`), it presents every detected/imported\n * value as an editable prompt (Enter = accept detected), resolves an\n * ambiguous workspace match via a `select` instead of erroring, and shows a\n * final confirm before writing anything.\n */\nexport async function runAdoptInteractive(options: AdoptInteractiveOptions): Promise<AdoptReport> {\n if (!isInteractive({ yes: options.yes })) {\n return runAdopt(options);\n }\n\n const { cwd, refresh = false } = options;\n\n // Same 2 early-exit guards `runAdopt` itself has — reproduce them here\n // unprompted so the wizard never even starts when the underlying call is\n // just going to error out anyway.\n const gitCheck = checkGitRepo(cwd);\n if (!gitCheck.isRepo) return runAdopt(options);\n if (hasConfig(cwd) && !refresh) return runAdopt(options);\n\n const prompter = options.prompter ?? clackPrompter;\n const defaults = computeAdoptDefaults(cwd);\n\n prompter.intro(\"argos adopt — revisión interactiva\");\n\n const name = await prompter.text({ message: \"Nombre del repo\", initialValue: defaults.name, defaultValue: defaults.name });\n if (prompter.isCancel(name)) {\n prompter.cancel(\"argos adopt cancelado — no se tocó nada.\");\n return cancelledAdoptReport();\n }\n\n const branchBase = await prompter.text({\n message: \"Rama base\",\n initialValue: defaults.branchBase,\n defaultValue: defaults.branchBase,\n });\n if (prompter.isCancel(branchBase)) {\n prompter.cancel(\"argos adopt cancelado — no se tocó nada.\");\n return cancelledAdoptReport();\n }\n\n const qualityGateFast = await prompter.text({\n message: \"Quality gate (fast)\",\n initialValue: defaults.qualityGateFast,\n defaultValue: defaults.qualityGateFast,\n });\n if (prompter.isCancel(qualityGateFast)) {\n prompter.cancel(\"argos adopt cancelado — no se tocó nada.\");\n return cancelledAdoptReport();\n }\n\n let workspace: string | undefined = defaults.workspaceDefault;\n if (defaults.workspaceAmbiguousCandidates) {\n const chosen = await prompter.select<string>({\n message: `Workspace ambiguo — resolución vía ${defaults.workspaceChain}. Elegí uno:`,\n options: defaults.workspaceAmbiguousCandidates.map((c) => ({ value: c })),\n });\n if (prompter.isCancel(chosen)) {\n prompter.cancel(\"argos adopt cancelado — no se tocó nada.\");\n return cancelledAdoptReport();\n }\n workspace = chosen;\n } else {\n const edited = await prompter.text({\n message: `Workspace (resuelto vía: ${defaults.workspaceChain})`,\n initialValue: workspace ?? \"\",\n defaultValue: workspace ?? \"\",\n });\n if (prompter.isCancel(edited)) {\n prompter.cancel(\"argos adopt cancelado — no se tocó nada.\");\n return cancelledAdoptReport();\n }\n workspace = edited || undefined;\n }\n\n const identity = await prompter.text({\n message: \"Identidad\",\n initialValue: defaults.identity ?? \"\",\n defaultValue: defaults.identity ?? \"\",\n });\n if (prompter.isCancel(identity)) {\n prompter.cancel(\"argos adopt cancelado — no se tocó nada.\");\n return cancelledAdoptReport();\n }\n\n prompter.note(\n [\n `nombre: ${name}`,\n `branchBase: ${branchBase}`,\n `qualityGate.fast: ${qualityGateFast}`,\n `workspace: ${workspace ?? \"(sin asignar)\"}`,\n `identity: ${identity || \"(no detectada)\"}`,\n ].join(\"\\n\"),\n \"Resumen (config + ficha)\",\n );\n\n const proceed = await prompter.confirm({ message: \"¿Escribir argos.config.json y la ficha?\", initialValue: true });\n if (prompter.isCancel(proceed) || !proceed) {\n prompter.cancel(\"argos adopt cancelado — no se tocó nada.\");\n return cancelledAdoptReport();\n }\n\n const report = runAdopt({\n cwd,\n refresh,\n overrides: {\n name: name || undefined,\n branchBase: branchBase || undefined,\n qualityGateFast: qualityGateFast || undefined,\n workspace,\n identity: identity || undefined,\n },\n });\n prompter.outro(`argos.config.json escrito en ${report.configPath}`);\n return report;\n}\n\nexport const adoptCommand = defineCommand({\n meta: {\n name: \"adopt\",\n description: \"Detect a repo's stack and write its argos.config.json.\",\n },\n args: {\n refresh: {\n type: \"boolean\",\n default: false,\n description: \"Regenera argos.config.json y la ficha aunque ya existan.\",\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 },\n async run({ args }) {\n const report = await runAdoptInteractive({\n cwd: process.cwd(),\n refresh: Boolean(args.refresh),\n yes: Boolean(args.yes),\n });\n\n if (report.error) {\n console.error(pc.red(report.error));\n process.exit(report.exitCode);\n }\n\n for (const row of report.rows) {\n const paddedSource = row.source.padEnd(10);\n const label =\n row.source === \"error\" ? pc.red(paddedSource) : row.source === \"warning\" ? pc.yellow(paddedSource) : pc.dim(paddedSource);\n console.log(`${label} ${row.field.padEnd(28)} ${row.value}`);\n }\n console.log(\"\");\n console.log(`argos.config.json escrito en ${report.configPath}`);\n if (report.backupPath) console.log(`backup en ${report.backupPath}`);\n\n process.exit(report.exitCode);\n },\n});\n"],"names":["defineCommand","existsSync","readFileSync","basename","join","pc","writeFileAtomic","CONFIG_FILENAME","hasConfig","readConfig","writeConfig","buildQualityGateFast","detectFramework","detectLibs","detectMappedSkills","detectPackageManager","MOTOR_SKILLS","readPackageJson","createBackup","buildFichaContent","FICHA_BLOCK_ID","checkGitRepo","getRemoteOriginUrl","parseIdentityFromRemote","injectBlock","listBlocks","readNaviorConfig","isInteractive","clackPrompter","readCliVersion","linkRepo","loadRegistry","resolveWorkspaceForRepo","NO_GATE_PLACEHOLDER","resolveOverride","computed","override","undefined","markRowEditedIfOverridden","rows","field","row","find","r","value","source","errorMessage","err","Error","message","String","runAdopt","options","cwd","refresh","gitCheck","isRepo","exitCode","error","gitMissing","configExists","existing","push","naviorResult","navori","kind","data","pkg","name","nameSource","overrides","workspace","branchBase","prTarget","project","criticalAreas","legacyPaths","packageManager","framework","libs","importedFull","qualityGate","full","importedFast","fast","qualityGateFast","remoteUrl","identity","mappedSkills","skills","filter","id","includes","configInput","language","stack","configPath","finalConfig","registry","resolution","configWorkspace","repoPath","linkResult","path","action","candidates","fichaStatus","backupPath","fichaContent","claudeMdPath","claudeMdBefore","hadFicha","some","b","claudeMdAfter","computeAdoptDefaults","workspaceDefault","workspaceAmbiguousCandidates","workspaceChain","cancelledAdoptReport","runAdoptInteractive","yes","prompter","defaults","intro","text","initialValue","defaultValue","isCancel","cancel","chosen","select","map","c","edited","note","proceed","confirm","report","outro","adoptCommand","meta","description","args","type","default","run","process","Boolean","console","red","exit","paddedSource","padEnd","label","yellow","dim","log"],"mappings":"AAAA,SAASA,aAAa,QAAQ,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"],"names":[],"mappings":"AAyBA,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAEvD,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,WAAW,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;CACjB;
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAyBA,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAEvD,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,WAAW,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;CACjB;AAodD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,YAAY,CAU9D;AAED,eAAO,MAAM,aAAa,qDAqBxB,CAAC"}
|
package/dist/commands/doctor.js
CHANGED
|
@@ -80,7 +80,7 @@ function isPlainObject(v) {
|
|
|
80
80
|
if (!hasArgosShellFileMarker(content)) {
|
|
81
81
|
findings.push({
|
|
82
82
|
level: "info",
|
|
83
|
-
message: `hooks/${id}.sh
|
|
83
|
+
message: `archivo ajeno en hooks/${id}.sh — hay versión del motor disponible pero está bloqueada; muévelo o bórralo y corre argos init para instalarla.`
|
|
84
84
|
});
|
|
85
85
|
continue;
|
|
86
86
|
}
|
|
@@ -176,6 +176,39 @@ function isPlainObject(v) {
|
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* Voice activation (spec 0004 "Activación de la voz"): Argos's own
|
|
181
|
+
* output-style asset is installed on disk (`output-styles/argos.md`, with
|
|
182
|
+
* the argos:file marker) but `settings.json.outputStyle` isn't `"Argos"` —
|
|
183
|
+
* the voice is present but not the one Claude Code will actually load.
|
|
184
|
+
* Read-only, guarded against a missing/corrupt settings.json (never throws).
|
|
185
|
+
*/ function checkOutputStyleVoice(findings, claudeDir) {
|
|
186
|
+
const outputStylePath = join(claudeDir, "output-styles", "argos.md");
|
|
187
|
+
if (!existsSync(outputStylePath)) return; // nothing installed — checkMotor's own full-file check already covers this
|
|
188
|
+
if (!hasArgosFileMarker(readFileSafe(outputStylePath, findings, "output-styles/argos.md"))) return; // foreign, not ours to opine on
|
|
189
|
+
const settingsPath = join(claudeDir, "settings.json");
|
|
190
|
+
if (!existsSync(settingsPath)) {
|
|
191
|
+
findings.push({
|
|
192
|
+
level: "warning",
|
|
193
|
+
message: "La voz de Argos está instalada pero no activa. Corre argos init."
|
|
194
|
+
});
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
let settings;
|
|
198
|
+
try {
|
|
199
|
+
const raw = readFileSync(settingsPath, "utf-8");
|
|
200
|
+
settings = raw.trim().length === 0 ? {} : JSON.parse(raw);
|
|
201
|
+
} catch {
|
|
202
|
+
return; // settings.json's own JSON validity is already reported by checkHookSettings
|
|
203
|
+
}
|
|
204
|
+
const outputStyle = isPlainObject(settings) ? settings.outputStyle : undefined;
|
|
205
|
+
if (outputStyle !== "Argos") {
|
|
206
|
+
findings.push({
|
|
207
|
+
level: "warning",
|
|
208
|
+
message: "La voz de Argos está instalada pero no activa. Corre argos init."
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
179
212
|
/**
|
|
180
213
|
* Workspaces (F2, motor scope): `~/.argos/workspaces.json` registry entries
|
|
181
214
|
* whose repo path no longer exists on disk (moved/deleted repo). Guarded
|
|
@@ -286,12 +319,13 @@ function checkMotor(findings) {
|
|
|
286
319
|
if (!hasArgosFileMarker(content)) {
|
|
287
320
|
findings.push({
|
|
288
321
|
level: "info",
|
|
289
|
-
message:
|
|
322
|
+
message: `archivo ajeno en ${label} — hay versión del motor disponible pero está bloqueada; muévelo o bórralo y corre argos init para instalarla.`
|
|
290
323
|
});
|
|
291
324
|
}
|
|
292
325
|
}
|
|
293
326
|
checkHookScripts(findings, claudeDir, currentVersion);
|
|
294
327
|
checkHookSettings(findings, claudeDir);
|
|
328
|
+
checkOutputStyleVoice(findings, claudeDir);
|
|
295
329
|
checkWorkspaceRegistryHealth(findings);
|
|
296
330
|
}
|
|
297
331
|
function checkRepo(cwd, findings) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/doctor.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { existsSync, readFileSync, realpathSync, statSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport pc from \"picocolors\";\nimport { z } from \"zod\";\nimport { ArgosConfigSchema, hasConfig } from \"../lib/config.js\";\nimport {\n detectFramework,\n detectLibs,\n detectPackageManager,\n readPackageJson,\n} from \"../lib/detect.js\";\nimport { buildFichaContent, FICHA_BLOCK_ID } from \"../lib/ficha.js\";\nimport { getRemoteOriginUrl, isGitRepo, parseIdentityFromRemote } from \"../lib/git.js\";\nimport { listAgentIds, listSkillIds, MANAGED_BLOCK_IDS, resolveAssetsDir } from \"../lib/assets.js\";\nimport { listBlocks, listDanglingBlockIds } from \"../lib/markers.js\";\nimport { hasArgosFileMarker, hasArgosShellFileMarker } from \"../lib/managed-files.js\";\nimport { hasNaviorConfig } from \"../lib/navori-import.js\";\nimport { resolveClaudeDir } from \"../lib/paths.js\";\nimport { isArgosHookCommand } from \"../lib/settings-merge.js\";\nimport { readCliVersion } from \"../lib/version.js\";\nimport { loadRegistry, resolveWorkspaceForRepo } from \"../lib/workspaces.js\";\nimport { describeZodError } from \"../lib/zod-messages.js\";\nimport { NO_GATE_PLACEHOLDER } from \"./adopt.js\";\n\nexport type DoctorLevel = \"info\" | \"warning\" | \"error\";\n\nexport interface DoctorFinding {\n level: DoctorLevel;\n message: string;\n}\n\nexport interface DoctorOptions {\n cwd: string;\n}\n\nexport interface DoctorReport {\n findings: DoctorFinding[];\n exitCode: 0 | 1;\n}\n\n/**\n * Read a text file, guarding against fs failures (e.g. EACCES) that would\n * otherwise crash doctor's read-only audit. On failure, pushes an error\n * finding and falls back to `\"\"` so the rest of the audit can still run.\n */\nfunction readFileSafe(path: string, findings: DoctorFinding[], label: string): string {\n if (!existsSync(path)) return \"\";\n try {\n return readFileSync(path, \"utf-8\");\n } catch (err) {\n findings.push({\n level: \"error\",\n message: `No se pudo leer ${label} (${err instanceof Error ? err.message : String(err)}).`,\n });\n return \"\";\n }\n}\n\n/** Compare two semver-ish `x.y.z` strings. Returns <0, 0, or >0 like Array.sort comparators. */\nfunction compareVersions(a: string, b: string): number {\n const pa = a.split(\".\").map((n) => Number.parseInt(n, 10) || 0);\n const pb = b.split(\".\").map((n) => Number.parseInt(n, 10) || 0);\n for (let i = 0; i < Math.max(pa.length, pb.length); i++) {\n const diff = (pa[i] ?? 0) - (pb[i] ?? 0);\n if (diff !== 0) return diff;\n }\n return 0;\n}\n\n/**\n * Ids (basenames under `<claudeDir>/hooks/`) of the 2 global hooks `argos\n * init` installs (see spec 0003 \"Hooks globales parametrizados\"). Mirrors\n * `HOOK_IDS` in commands/init.ts — kept as a local duplicate here since\n * doctor only reads the filesystem/version drift, it never installs, and the\n * two commands are intentionally not allowed to share private constants.\n */\nconst HOOK_IDS = [\"argos-guard-destructive\", \"argos-quality-gate\"] as const;\n\n/** Extract the version stamped by a shell-comment `# argos:file v=\"<version>\"` marker (see lib/managed-files.ts). */\nfunction extractShellMarkerVersion(content: string): string | null {\n return /^# argos:file v=\"([^\"]*)\"/m.exec(content)?.[1] ?? null;\n}\n\n/** Extract the script path from an Argos hook command string (`bash \"<scriptPath>\"`, see lib/settings-merge.ts). */\nfunction extractHookScriptPath(command: string): string | null {\n return /^bash \"(.+)\"$/.exec(command)?.[1] ?? null;\n}\n\nfunction isPlainObject(v: unknown): v is Record<string, unknown> {\n return typeof v === \"object\" && v !== null && !Array.isArray(v);\n}\n\n/**\n * Hooks (F2, motor scope): presence, ownership, and version drift of the 2\n * global hook scripts under `<claudeDir>/hooks/`. Same bidirectional-version\n * convention as the CLAUDE.md managed-blocks check in `checkMotor`.\n */\nfunction checkHookScripts(findings: DoctorFinding[], claudeDir: string, currentVersion: string): void {\n for (const id of HOOK_IDS) {\n const hookPath = join(claudeDir, \"hooks\", `${id}.sh`);\n if (!existsSync(hookPath)) {\n findings.push({ level: \"warning\", message: `Falta el hook hooks/${id}.sh. Corre argos init.` });\n continue;\n }\n\n const beforeCount = findings.length;\n const content = readFileSafe(hookPath, findings, `hooks/${id}.sh`);\n if (findings.length > beforeCount) continue; // read error already reported by readFileSafe\n\n if (!hasArgosShellFileMarker(content)) {\n findings.push({ level: \"info\", message: `hooks/${id}.sh existe pero es ajeno (sin marker argos:file).` });\n continue;\n }\n\n const hookVersion = extractShellMarkerVersion(content);\n if (!hookVersion) continue;\n const cmp = compareVersions(hookVersion, currentVersion);\n if (cmp < 0) {\n findings.push({\n level: \"warning\",\n message: `hooks/${id}.sh está desactualizado (v${hookVersion} < v${currentVersion}). Corre argos init.`,\n });\n } else if (cmp > 0) {\n findings.push({\n level: \"warning\",\n message: `hooks/${id}.sh es más nuevo que el binario (v${hookVersion} > v${currentVersion}) — el binario es más viejo que el motor instalado — actualiza el paquete (npm i -g).`,\n });\n }\n }\n}\n\n/**\n * Hooks (F2, motor scope): `settings.json` PreToolUse entries — missing,\n * orphaned (the entry's script file is gone), or the file itself unreadable\n * as valid JSON. Guarded reads throughout: never throws, always degrades to\n * an error finding so the rest of doctor's audit still runs.\n */\nfunction checkHookSettings(findings: DoctorFinding[], claudeDir: string): void {\n const settingsPath = join(claudeDir, \"settings.json\");\n if (!existsSync(settingsPath)) {\n for (const id of HOOK_IDS) {\n findings.push({ level: \"warning\", message: `Falta la entrada del hook ${id} en settings.json. Corre argos init.` });\n }\n return;\n }\n\n let raw: string;\n try {\n raw = readFileSync(settingsPath, \"utf-8\");\n } catch (err) {\n findings.push({\n level: \"error\",\n message: `No se pudo leer settings.json (${err instanceof Error ? err.message : String(err)}).`,\n });\n return;\n }\n\n let settings: unknown;\n try {\n settings = raw.trim().length === 0 ? {} : JSON.parse(raw);\n } catch (err) {\n findings.push({\n level: \"error\",\n message: `settings.json tiene JSON inválido (${err instanceof Error ? err.message : String(err)}).`,\n });\n return;\n }\n\n const foundScriptPaths = new Set<string>();\n const hooksRoot = isPlainObject(settings) ? settings.hooks : undefined;\n const preToolUse = isPlainObject(hooksRoot) ? hooksRoot.PreToolUse : undefined;\n if (Array.isArray(preToolUse)) {\n for (const bucket of preToolUse) {\n if (!isPlainObject(bucket) || !Array.isArray(bucket.hooks)) continue;\n for (const hook of bucket.hooks) {\n if (!isPlainObject(hook) || !isArgosHookCommand(hook.command)) continue;\n const scriptPath = extractHookScriptPath(hook.command);\n if (!scriptPath) continue;\n foundScriptPaths.add(scriptPath);\n // `existsSync` alone is true for directories too — a settings.json\n // entry pointing at a directory (e.g. a failed write that left a\n // stray directory in the script's place) would otherwise read as\n // \"present\" here and slip past the orphan check.\n let isRealFile = false;\n try {\n isRealFile = existsSync(scriptPath) && statSync(scriptPath).isFile();\n } catch {\n isRealFile = false;\n }\n if (!isRealFile) {\n findings.push({\n level: \"warning\",\n message: `settings.json referencia el hook huérfano ${scriptPath} (el script ya no existe). Corre argos init.`,\n });\n }\n }\n }\n }\n\n for (const id of HOOK_IDS) {\n const expectedPath = join(claudeDir, \"hooks\", `${id}.sh`);\n if (!foundScriptPaths.has(expectedPath)) {\n findings.push({ level: \"warning\", message: `Falta la entrada del hook ${id} en settings.json. Corre argos init.` });\n }\n }\n}\n\n/**\n * Workspaces (F2, motor scope): `~/.argos/workspaces.json` registry entries\n * whose repo path no longer exists on disk (moved/deleted repo). Guarded\n * against a corrupt registry file — never throws.\n */\nfunction checkWorkspaceRegistryHealth(findings: DoctorFinding[]): void {\n let registry: ReturnType<typeof loadRegistry>;\n try {\n registry = loadRegistry();\n } catch (err) {\n findings.push({\n level: \"error\",\n message: `No se pudo leer workspaces.json (${err instanceof Error ? err.message : String(err)}).`,\n });\n return;\n }\n\n const stale: string[] = [];\n for (const [wsName, ws] of Object.entries(registry)) {\n for (const repo of ws.repos) {\n if (!existsSync(repo.path)) stale.push(`${wsName}/${repo.name} (${repo.path})`);\n }\n }\n if (stale.length > 0) {\n findings.push({\n level: \"warning\",\n message: `Hay repos registrados en workspaces con paths inexistentes: ${stale.join(\", \")}. Corre argos workspace link o editá el registro a mano.`,\n });\n }\n}\n\n/**\n * Flag dangling/unclosed managed-block markers (an open marker with no\n * matching close — crash residue or hand-edited corruption) as a warning.\n * Reuses `listDanglingBlockIds` (lib/markers.ts) — the same scanning logic\n * `remove`'s progress-guard relies on to avoid spinning forever on the same\n * corruption (see commands/remove.ts's processClaudeMd).\n */\nfunction checkDanglingMarkers(findings: DoctorFinding[], content: string, label: string): void {\n for (const id of listDanglingBlockIds(content)) {\n findings.push({\n level: \"warning\",\n message: `Marker argos huérfano sin cierre en ${label} (bloque \"${id}\"). Corre argos remove para limpiarlo, o editá el archivo a mano.`,\n });\n }\n}\n\nfunction checkMotor(findings: DoctorFinding[]): void {\n const claudeDir = resolveClaudeDir();\n const currentVersion = readCliVersion();\n const assetsDir = resolveAssetsDir();\n\n const claudeMdPath = join(claudeDir, \"CLAUDE.md\");\n const claudeMd = readFileSafe(claudeMdPath, findings, \"CLAUDE.md\");\n const blocks = listBlocks(claudeMd);\n\n checkDanglingMarkers(findings, claudeMd, \"CLAUDE.md\");\n\n for (const id of MANAGED_BLOCK_IDS) {\n const matching = blocks.filter((b) => b.id === id);\n if (matching.length > 1) {\n findings.push({\n level: \"warning\",\n message: `El bloque \"${id}\" está duplicado (${matching.length} veces) en CLAUDE.md. Corre argos init para sanearlo.`,\n });\n }\n\n const block = matching[0];\n if (!block) {\n findings.push({ level: \"error\", message: `Falta el bloque managed \"${id}\" en CLAUDE.md. Corre argos init.` });\n continue;\n }\n if (block.version) {\n const cmp = compareVersions(block.version, currentVersion);\n if (cmp < 0) {\n findings.push({\n level: \"warning\",\n message: `El bloque \"${id}\" está desactualizado (v${block.version} < v${currentVersion}). Corre argos init.`,\n });\n } else if (cmp > 0) {\n findings.push({\n level: \"warning\",\n message: `El bloque \"${id}\" es más nuevo que el binario (v${block.version} > v${currentVersion}) — el binario es más viejo que el motor instalado — actualiza el paquete (npm i -g).`,\n });\n }\n }\n }\n\n const fullFiles: string[][] = [\n [\"output-styles\", \"argos.md\"],\n ...listAgentIds(assetsDir).map((id) => [\"agents\", `${id}.md`]),\n ...listSkillIds(assetsDir).map((id) => [\"skills\", id, \"SKILL.md\"]),\n ];\n for (const relPath of fullFiles) {\n const dest = join(claudeDir, ...relPath);\n const label = join(...relPath);\n if (!existsSync(dest)) {\n findings.push({ level: \"error\", message: `Falta ${label} en el motor. Corre argos init.` });\n continue;\n }\n const content = readFileSync(dest, \"utf-8\");\n if (!hasArgosFileMarker(content)) {\n findings.push({ level: \"info\", message: `${label} existe pero es ajeno (sin marker argos:file).` });\n }\n }\n\n checkHookScripts(findings, claudeDir, currentVersion);\n checkHookSettings(findings, claudeDir);\n checkWorkspaceRegistryHealth(findings);\n}\n\nfunction checkRepo(cwd: string, findings: DoctorFinding[]): void {\n if (!hasConfig(cwd)) return;\n\n const configPath = join(cwd, \"argos.config.json\");\n let config: z.infer<typeof ArgosConfigSchema> | undefined;\n try {\n const raw: unknown = JSON.parse(readFileSync(configPath, \"utf-8\"));\n config = ArgosConfigSchema.parse(raw);\n } catch (error) {\n for (const message of describeZodError(error)) {\n findings.push({ level: \"error\", message: `argos.config.json inválido — ${message}` });\n }\n return;\n }\n\n if (hasNaviorConfig(cwd)) {\n findings.push({\n level: \"info\",\n message: \"navori.config.json coexiste con argos.config.json (migración en curso).\",\n });\n }\n\n if (config.qualityGate.fast === NO_GATE_PLACEHOLDER) {\n findings.push({\n level: \"warning\",\n message: \"quality gate placeholder — configura scripts y corre argos adopt --refresh.\",\n });\n }\n\n // Ficha drift: does ./CLAUDE.md's ficha block match what adopt would write today?\n const claudeMdPath = join(cwd, \"CLAUDE.md\");\n const claudeMd = readFileSafe(claudeMdPath, findings, \"./CLAUDE.md\");\n checkDanglingMarkers(findings, claudeMd, \"./CLAUDE.md\");\n const fichaBlocks = listBlocks(claudeMd).filter((b) => b.id === FICHA_BLOCK_ID);\n if (fichaBlocks.length > 1) {\n findings.push({\n level: \"warning\",\n message: `La ficha está duplicada (${fichaBlocks.length} veces) en ./CLAUDE.md. Corre argos adopt --refresh para sanearla.`,\n });\n }\n const fichaBlock = fichaBlocks[0];\n if (!fichaBlock) {\n findings.push({ level: \"warning\", message: \"Falta la ficha en ./CLAUDE.md. Corre argos adopt --refresh.\" });\n } else {\n const expectedFicha = buildFichaContent(config);\n if (!claudeMd.includes(expectedFicha)) {\n findings.push({ level: \"warning\", message: \"La ficha de ./CLAUDE.md quedó vieja. Corre argos adopt --refresh.\" });\n }\n }\n\n // Stack drift: new relevant libs in package.json not yet recorded.\n const pkg = readPackageJson(cwd);\n if (pkg) {\n const recordedLibs = new Set(config.stack?.libs ?? []);\n const freshLibs = detectLibs(pkg);\n const newLibs = freshLibs.filter((lib) => !recordedLibs.has(lib));\n if (newLibs.length > 0) {\n findings.push({\n level: \"warning\",\n message: `Nuevas libs detectadas sin registrar (${newLibs.join(\", \")}). Corre argos adopt --refresh.`,\n });\n }\n\n const freshFramework = detectFramework(pkg);\n if (freshFramework && config.stack?.framework && freshFramework !== config.stack.framework) {\n findings.push({\n level: \"warning\",\n message: `El framework detectado (${freshFramework}) difiere del registrado (${config.stack.framework}). Corre argos adopt --refresh.`,\n });\n }\n\n const freshPackageManager = detectPackageManager(cwd);\n if (\n freshPackageManager &&\n config.stack?.packageManager &&\n freshPackageManager !== config.stack.packageManager\n ) {\n findings.push({\n level: \"warning\",\n message: `El package manager detectado (${freshPackageManager}) difiere del registrado (${config.stack.packageManager}). Corre argos adopt --refresh.`,\n });\n }\n }\n\n // Identity drift: current git remote vs the identity recorded in config.\n const remoteUrl = getRemoteOriginUrl(cwd);\n const freshIdentity = remoteUrl ? (parseIdentityFromRemote(remoteUrl) ?? undefined) : undefined;\n if (freshIdentity && config.identity && freshIdentity !== config.identity) {\n findings.push({\n level: \"warning\",\n message: `La identidad detectada (${freshIdentity}) difiere de la registrada (${config.identity}). Corre argos adopt --refresh.`,\n });\n }\n\n // Workspace linkage (F2): repo not registered, registered under a stale\n // path, or config.workspace pointing at a name absent from the registry.\n let registry: ReturnType<typeof loadRegistry>;\n try {\n registry = loadRegistry();\n } catch (err) {\n findings.push({\n level: \"error\",\n message: `No se pudo leer workspaces.json (${err instanceof Error ? err.message : String(err)}).`,\n });\n return;\n }\n const resolution = resolveWorkspaceForRepo(registry, {\n configWorkspace: config.workspace,\n remoteUrl,\n repoPath: cwd,\n });\n\n if (resolution.kind === \"unresolved\") {\n findings.push({\n level: \"info\",\n message: \"El repo no está vinculado a ningún workspace. Corre argos workspace link.\",\n });\n } else if (resolution.kind === \"resolved\") {\n const workspace = registry[resolution.name];\n if (!workspace) {\n findings.push({\n level: \"warning\",\n message: `argos.config.json referencia el workspace '${resolution.name}', que no existe en el registro. Corre argos workspace link ${resolution.name}.`,\n });\n } else {\n const entry = workspace.repos.find((r) => r.name === config.name);\n if (!entry) {\n findings.push({\n level: \"info\",\n message: \"El repo no está vinculado a ningún workspace. Corre argos workspace link.\",\n });\n } else {\n let realCwd: string | undefined;\n try {\n realCwd = realpathSync(resolve(cwd));\n } catch {\n realCwd = undefined;\n }\n if (realCwd && entry.path !== realCwd) {\n findings.push({\n level: \"warning\",\n message: `El repo está registrado en el workspace '${resolution.name}' con un path distinto (${entry.path} vs ${realCwd}). Corre argos workspace link para actualizarlo.`,\n });\n }\n }\n }\n }\n}\n\n/**\n * Core, testable implementation of `argos doctor`: a read-only audit of the\n * global engine and (when cwd is a git repo) the repo's argos.config.json +\n * ficha. Never writes anything.\n */\nexport function runDoctor(options: DoctorOptions): DoctorReport {\n const findings: DoctorFinding[] = [];\n\n checkMotor(findings);\n if (isGitRepo(options.cwd)) {\n checkRepo(options.cwd, findings);\n }\n\n const exitCode = findings.some((f) => f.level !== \"info\") ? 1 : 0;\n return { findings, exitCode };\n}\n\nexport const doctorCommand = defineCommand({\n meta: {\n name: \"doctor\",\n description: \"Report drift between the engine, the repo config, and its ficha.\",\n },\n run() {\n const report = runDoctor({ cwd: process.cwd() });\n\n if (report.findings.length === 0) {\n console.log(\"Todo al día.\");\n process.exit(0);\n }\n\n for (const finding of report.findings) {\n const padded = finding.level.padEnd(10);\n const label = finding.level === \"error\" ? pc.red(padded) : finding.level === \"warning\" ? pc.yellow(padded) : pc.dim(padded);\n console.log(`${label} ${finding.message}`);\n }\n\n process.exit(report.exitCode);\n },\n});\n"],"names":["defineCommand","existsSync","readFileSync","realpathSync","statSync","join","resolve","pc","ArgosConfigSchema","hasConfig","detectFramework","detectLibs","detectPackageManager","readPackageJson","buildFichaContent","FICHA_BLOCK_ID","getRemoteOriginUrl","isGitRepo","parseIdentityFromRemote","listAgentIds","listSkillIds","MANAGED_BLOCK_IDS","resolveAssetsDir","listBlocks","listDanglingBlockIds","hasArgosFileMarker","hasArgosShellFileMarker","hasNaviorConfig","resolveClaudeDir","isArgosHookCommand","readCliVersion","loadRegistry","resolveWorkspaceForRepo","describeZodError","NO_GATE_PLACEHOLDER","readFileSafe","path","findings","label","err","push","level","message","Error","String","compareVersions","a","b","pa","split","map","n","Number","parseInt","pb","i","Math","max","length","diff","HOOK_IDS","extractShellMarkerVersion","content","exec","extractHookScriptPath","command","isPlainObject","v","Array","isArray","checkHookScripts","claudeDir","currentVersion","id","hookPath","beforeCount","hookVersion","cmp","checkHookSettings","settingsPath","raw","settings","trim","JSON","parse","foundScriptPaths","Set","hooksRoot","hooks","undefined","preToolUse","PreToolUse","bucket","hook","scriptPath","add","isRealFile","isFile","expectedPath","has","checkWorkspaceRegistryHealth","registry","stale","wsName","ws","Object","entries","repo","repos","name","checkDanglingMarkers","checkMotor","assetsDir","claudeMdPath","claudeMd","blocks","matching","filter","block","version","fullFiles","relPath","dest","checkRepo","cwd","configPath","config","error","qualityGate","fast","fichaBlocks","fichaBlock","expectedFicha","includes","pkg","recordedLibs","stack","libs","freshLibs","newLibs","lib","freshFramework","framework","freshPackageManager","packageManager","remoteUrl","freshIdentity","identity","resolution","configWorkspace","workspace","repoPath","kind","entry","find","r","realCwd","runDoctor","options","exitCode","some","f","doctorCommand","meta","description","run","report","process","console","log","exit","finding","padded","padEnd","red","yellow","dim"],"mappings":"AAAA,SAASA,aAAa,QAAQ,QAAQ;AACtC,SAASC,UAAU,EAAEC,YAAY,EAAEC,YAAY,EAAEC,QAAQ,QAAQ,UAAU;AAC3E,SAASC,IAAI,EAAEC,OAAO,QAAQ,YAAY;AAC1C,OAAOC,QAAQ,aAAa;AAE5B,SAASC,iBAAiB,EAAEC,SAAS,QAAQ,mBAAmB;AAChE,SACEC,eAAe,EACfC,UAAU,EACVC,oBAAoB,EACpBC,eAAe,QACV,mBAAmB;AAC1B,SAASC,iBAAiB,EAAEC,cAAc,QAAQ,kBAAkB;AACpE,SAASC,kBAAkB,EAAEC,SAAS,EAAEC,uBAAuB,QAAQ,gBAAgB;AACvF,SAASC,YAAY,EAAEC,YAAY,EAAEC,iBAAiB,EAAEC,gBAAgB,QAAQ,mBAAmB;AACnG,SAASC,UAAU,EAAEC,oBAAoB,QAAQ,oBAAoB;AACrE,SAASC,kBAAkB,EAAEC,uBAAuB,QAAQ,0BAA0B;AACtF,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,SAASC,gBAAgB,QAAQ,kBAAkB;AACnD,SAASC,kBAAkB,QAAQ,2BAA2B;AAC9D,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,YAAY,EAAEC,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,CAAC,yCAAyC,EAAE0G,WAAWvC,IAAI,CAAC,wBAAwB,EAAE4C,MAAMrH,IAAI,CAAC,IAAI,EAAEwH,QAAQ,gDAAgD,CAAC;oBAC3K;gBACF;YACF;QACF;IACF;AACF;AAEA;;;;CAIC,GACD,OAAO,SAASC,UAAUC,OAAsB;IAC9C,MAAMzH,WAA4B,EAAE;IAEpC0E,WAAW1E;IACX,IAAIpB,UAAU6I,QAAQlC,GAAG,GAAG;QAC1BD,UAAUmC,QAAQlC,GAAG,EAAEvF;IACzB;IAEA,MAAM0H,WAAW1H,SAAS2H,IAAI,CAAC,CAACC,IAAMA,EAAExH,KAAK,KAAK,UAAU,IAAI;IAChE,OAAO;QAAEJ;QAAU0H;IAAS;AAC9B;AAEA,OAAO,MAAMG,gBAAgBlK,cAAc;IACzCmK,MAAM;QACJtD,MAAM;QACNuD,aAAa;IACf;IACAC;QACE,MAAMC,SAAST,UAAU;YAAEjC,KAAK2C,QAAQ3C,GAAG;QAAG;QAE9C,IAAI0C,OAAOjI,QAAQ,CAACqB,MAAM,KAAK,GAAG;YAChC8G,QAAQC,GAAG,CAAC;YACZF,QAAQG,IAAI,CAAC;QACf;QAEA,KAAK,MAAMC,WAAWL,OAAOjI,QAAQ,CAAE;YACrC,MAAMuI,SAASD,QAAQlI,KAAK,CAACoI,MAAM,CAAC;YACpC,MAAMvI,QAAQqI,QAAQlI,KAAK,KAAK,UAAUlC,GAAGuK,GAAG,CAACF,UAAUD,QAAQlI,KAAK,KAAK,YAAYlC,GAAGwK,MAAM,CAACH,UAAUrK,GAAGyK,GAAG,CAACJ;YACpHJ,QAAQC,GAAG,CAAC,GAAGnI,MAAM,CAAC,EAAEqI,QAAQjI,OAAO,EAAE;QAC3C;QAEA6H,QAAQG,IAAI,CAACJ,OAAOP,QAAQ;IAC9B;AACF,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../../src/commands/doctor.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { existsSync, readFileSync, realpathSync, statSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport pc from \"picocolors\";\nimport { z } from \"zod\";\nimport { ArgosConfigSchema, hasConfig } from \"../lib/config.js\";\nimport {\n detectFramework,\n detectLibs,\n detectPackageManager,\n readPackageJson,\n} from \"../lib/detect.js\";\nimport { buildFichaContent, FICHA_BLOCK_ID } from \"../lib/ficha.js\";\nimport { getRemoteOriginUrl, isGitRepo, parseIdentityFromRemote } from \"../lib/git.js\";\nimport { listAgentIds, listSkillIds, MANAGED_BLOCK_IDS, resolveAssetsDir } from \"../lib/assets.js\";\nimport { listBlocks, listDanglingBlockIds } from \"../lib/markers.js\";\nimport { hasArgosFileMarker, hasArgosShellFileMarker } from \"../lib/managed-files.js\";\nimport { hasNaviorConfig } from \"../lib/navori-import.js\";\nimport { resolveClaudeDir } from \"../lib/paths.js\";\nimport { isArgosHookCommand } from \"../lib/settings-merge.js\";\nimport { readCliVersion } from \"../lib/version.js\";\nimport { loadRegistry, resolveWorkspaceForRepo } from \"../lib/workspaces.js\";\nimport { describeZodError } from \"../lib/zod-messages.js\";\nimport { NO_GATE_PLACEHOLDER } from \"./adopt.js\";\n\nexport type DoctorLevel = \"info\" | \"warning\" | \"error\";\n\nexport interface DoctorFinding {\n level: DoctorLevel;\n message: string;\n}\n\nexport interface DoctorOptions {\n cwd: string;\n}\n\nexport interface DoctorReport {\n findings: DoctorFinding[];\n exitCode: 0 | 1;\n}\n\n/**\n * Read a text file, guarding against fs failures (e.g. EACCES) that would\n * otherwise crash doctor's read-only audit. On failure, pushes an error\n * finding and falls back to `\"\"` so the rest of the audit can still run.\n */\nfunction readFileSafe(path: string, findings: DoctorFinding[], label: string): string {\n if (!existsSync(path)) return \"\";\n try {\n return readFileSync(path, \"utf-8\");\n } catch (err) {\n findings.push({\n level: \"error\",\n message: `No se pudo leer ${label} (${err instanceof Error ? err.message : String(err)}).`,\n });\n return \"\";\n }\n}\n\n/** Compare two semver-ish `x.y.z` strings. Returns <0, 0, or >0 like Array.sort comparators. */\nfunction compareVersions(a: string, b: string): number {\n const pa = a.split(\".\").map((n) => Number.parseInt(n, 10) || 0);\n const pb = b.split(\".\").map((n) => Number.parseInt(n, 10) || 0);\n for (let i = 0; i < Math.max(pa.length, pb.length); i++) {\n const diff = (pa[i] ?? 0) - (pb[i] ?? 0);\n if (diff !== 0) return diff;\n }\n return 0;\n}\n\n/**\n * Ids (basenames under `<claudeDir>/hooks/`) of the 2 global hooks `argos\n * init` installs (see spec 0003 \"Hooks globales parametrizados\"). Mirrors\n * `HOOK_IDS` in commands/init.ts — kept as a local duplicate here since\n * doctor only reads the filesystem/version drift, it never installs, and the\n * two commands are intentionally not allowed to share private constants.\n */\nconst HOOK_IDS = [\"argos-guard-destructive\", \"argos-quality-gate\"] as const;\n\n/** Extract the version stamped by a shell-comment `# argos:file v=\"<version>\"` marker (see lib/managed-files.ts). */\nfunction extractShellMarkerVersion(content: string): string | null {\n return /^# argos:file v=\"([^\"]*)\"/m.exec(content)?.[1] ?? null;\n}\n\n/** Extract the script path from an Argos hook command string (`bash \"<scriptPath>\"`, see lib/settings-merge.ts). */\nfunction extractHookScriptPath(command: string): string | null {\n return /^bash \"(.+)\"$/.exec(command)?.[1] ?? null;\n}\n\nfunction isPlainObject(v: unknown): v is Record<string, unknown> {\n return typeof v === \"object\" && v !== null && !Array.isArray(v);\n}\n\n/**\n * Hooks (F2, motor scope): presence, ownership, and version drift of the 2\n * global hook scripts under `<claudeDir>/hooks/`. Same bidirectional-version\n * convention as the CLAUDE.md managed-blocks check in `checkMotor`.\n */\nfunction checkHookScripts(findings: DoctorFinding[], claudeDir: string, currentVersion: string): void {\n for (const id of HOOK_IDS) {\n const hookPath = join(claudeDir, \"hooks\", `${id}.sh`);\n if (!existsSync(hookPath)) {\n findings.push({ level: \"warning\", message: `Falta el hook hooks/${id}.sh. Corre argos init.` });\n continue;\n }\n\n const beforeCount = findings.length;\n const content = readFileSafe(hookPath, findings, `hooks/${id}.sh`);\n if (findings.length > beforeCount) continue; // read error already reported by readFileSafe\n\n if (!hasArgosShellFileMarker(content)) {\n findings.push({\n level: \"info\",\n message: `archivo ajeno en hooks/${id}.sh — hay versión del motor disponible pero está bloqueada; muévelo o bórralo y corre argos init para instalarla.`,\n });\n continue;\n }\n\n const hookVersion = extractShellMarkerVersion(content);\n if (!hookVersion) continue;\n const cmp = compareVersions(hookVersion, currentVersion);\n if (cmp < 0) {\n findings.push({\n level: \"warning\",\n message: `hooks/${id}.sh está desactualizado (v${hookVersion} < v${currentVersion}). Corre argos init.`,\n });\n } else if (cmp > 0) {\n findings.push({\n level: \"warning\",\n message: `hooks/${id}.sh es más nuevo que el binario (v${hookVersion} > v${currentVersion}) — el binario es más viejo que el motor instalado — actualiza el paquete (npm i -g).`,\n });\n }\n }\n}\n\n/**\n * Hooks (F2, motor scope): `settings.json` PreToolUse entries — missing,\n * orphaned (the entry's script file is gone), or the file itself unreadable\n * as valid JSON. Guarded reads throughout: never throws, always degrades to\n * an error finding so the rest of doctor's audit still runs.\n */\nfunction checkHookSettings(findings: DoctorFinding[], claudeDir: string): void {\n const settingsPath = join(claudeDir, \"settings.json\");\n if (!existsSync(settingsPath)) {\n for (const id of HOOK_IDS) {\n findings.push({ level: \"warning\", message: `Falta la entrada del hook ${id} en settings.json. Corre argos init.` });\n }\n return;\n }\n\n let raw: string;\n try {\n raw = readFileSync(settingsPath, \"utf-8\");\n } catch (err) {\n findings.push({\n level: \"error\",\n message: `No se pudo leer settings.json (${err instanceof Error ? err.message : String(err)}).`,\n });\n return;\n }\n\n let settings: unknown;\n try {\n settings = raw.trim().length === 0 ? {} : JSON.parse(raw);\n } catch (err) {\n findings.push({\n level: \"error\",\n message: `settings.json tiene JSON inválido (${err instanceof Error ? err.message : String(err)}).`,\n });\n return;\n }\n\n const foundScriptPaths = new Set<string>();\n const hooksRoot = isPlainObject(settings) ? settings.hooks : undefined;\n const preToolUse = isPlainObject(hooksRoot) ? hooksRoot.PreToolUse : undefined;\n if (Array.isArray(preToolUse)) {\n for (const bucket of preToolUse) {\n if (!isPlainObject(bucket) || !Array.isArray(bucket.hooks)) continue;\n for (const hook of bucket.hooks) {\n if (!isPlainObject(hook) || !isArgosHookCommand(hook.command)) continue;\n const scriptPath = extractHookScriptPath(hook.command);\n if (!scriptPath) continue;\n foundScriptPaths.add(scriptPath);\n // `existsSync` alone is true for directories too — a settings.json\n // entry pointing at a directory (e.g. a failed write that left a\n // stray directory in the script's place) would otherwise read as\n // \"present\" here and slip past the orphan check.\n let isRealFile = false;\n try {\n isRealFile = existsSync(scriptPath) && statSync(scriptPath).isFile();\n } catch {\n isRealFile = false;\n }\n if (!isRealFile) {\n findings.push({\n level: \"warning\",\n message: `settings.json referencia el hook huérfano ${scriptPath} (el script ya no existe). Corre argos init.`,\n });\n }\n }\n }\n }\n\n for (const id of HOOK_IDS) {\n const expectedPath = join(claudeDir, \"hooks\", `${id}.sh`);\n if (!foundScriptPaths.has(expectedPath)) {\n findings.push({ level: \"warning\", message: `Falta la entrada del hook ${id} en settings.json. Corre argos init.` });\n }\n }\n}\n\n/**\n * Voice activation (spec 0004 \"Activación de la voz\"): Argos's own\n * output-style asset is installed on disk (`output-styles/argos.md`, with\n * the argos:file marker) but `settings.json.outputStyle` isn't `\"Argos\"` —\n * the voice is present but not the one Claude Code will actually load.\n * Read-only, guarded against a missing/corrupt settings.json (never throws).\n */\nfunction checkOutputStyleVoice(findings: DoctorFinding[], claudeDir: string): void {\n const outputStylePath = join(claudeDir, \"output-styles\", \"argos.md\");\n if (!existsSync(outputStylePath)) return; // nothing installed — checkMotor's own full-file check already covers this\n if (!hasArgosFileMarker(readFileSafe(outputStylePath, findings, \"output-styles/argos.md\"))) return; // foreign, not ours to opine on\n\n const settingsPath = join(claudeDir, \"settings.json\");\n if (!existsSync(settingsPath)) {\n findings.push({ level: \"warning\", message: \"La voz de Argos está instalada pero no activa. Corre argos init.\" });\n return;\n }\n\n let settings: unknown;\n try {\n const raw = readFileSync(settingsPath, \"utf-8\");\n settings = raw.trim().length === 0 ? {} : JSON.parse(raw);\n } catch {\n return; // settings.json's own JSON validity is already reported by checkHookSettings\n }\n\n const outputStyle = isPlainObject(settings) ? settings.outputStyle : undefined;\n if (outputStyle !== \"Argos\") {\n findings.push({ level: \"warning\", message: \"La voz de Argos está instalada pero no activa. Corre argos init.\" });\n }\n}\n\n/**\n * Workspaces (F2, motor scope): `~/.argos/workspaces.json` registry entries\n * whose repo path no longer exists on disk (moved/deleted repo). Guarded\n * against a corrupt registry file — never throws.\n */\nfunction checkWorkspaceRegistryHealth(findings: DoctorFinding[]): void {\n let registry: ReturnType<typeof loadRegistry>;\n try {\n registry = loadRegistry();\n } catch (err) {\n findings.push({\n level: \"error\",\n message: `No se pudo leer workspaces.json (${err instanceof Error ? err.message : String(err)}).`,\n });\n return;\n }\n\n const stale: string[] = [];\n for (const [wsName, ws] of Object.entries(registry)) {\n for (const repo of ws.repos) {\n if (!existsSync(repo.path)) stale.push(`${wsName}/${repo.name} (${repo.path})`);\n }\n }\n if (stale.length > 0) {\n findings.push({\n level: \"warning\",\n message: `Hay repos registrados en workspaces con paths inexistentes: ${stale.join(\", \")}. Corre argos workspace link o editá el registro a mano.`,\n });\n }\n}\n\n/**\n * Flag dangling/unclosed managed-block markers (an open marker with no\n * matching close — crash residue or hand-edited corruption) as a warning.\n * Reuses `listDanglingBlockIds` (lib/markers.ts) — the same scanning logic\n * `remove`'s progress-guard relies on to avoid spinning forever on the same\n * corruption (see commands/remove.ts's processClaudeMd).\n */\nfunction checkDanglingMarkers(findings: DoctorFinding[], content: string, label: string): void {\n for (const id of listDanglingBlockIds(content)) {\n findings.push({\n level: \"warning\",\n message: `Marker argos huérfano sin cierre en ${label} (bloque \"${id}\"). Corre argos remove para limpiarlo, o editá el archivo a mano.`,\n });\n }\n}\n\nfunction checkMotor(findings: DoctorFinding[]): void {\n const claudeDir = resolveClaudeDir();\n const currentVersion = readCliVersion();\n const assetsDir = resolveAssetsDir();\n\n const claudeMdPath = join(claudeDir, \"CLAUDE.md\");\n const claudeMd = readFileSafe(claudeMdPath, findings, \"CLAUDE.md\");\n const blocks = listBlocks(claudeMd);\n\n checkDanglingMarkers(findings, claudeMd, \"CLAUDE.md\");\n\n for (const id of MANAGED_BLOCK_IDS) {\n const matching = blocks.filter((b) => b.id === id);\n if (matching.length > 1) {\n findings.push({\n level: \"warning\",\n message: `El bloque \"${id}\" está duplicado (${matching.length} veces) en CLAUDE.md. Corre argos init para sanearlo.`,\n });\n }\n\n const block = matching[0];\n if (!block) {\n findings.push({ level: \"error\", message: `Falta el bloque managed \"${id}\" en CLAUDE.md. Corre argos init.` });\n continue;\n }\n if (block.version) {\n const cmp = compareVersions(block.version, currentVersion);\n if (cmp < 0) {\n findings.push({\n level: \"warning\",\n message: `El bloque \"${id}\" está desactualizado (v${block.version} < v${currentVersion}). Corre argos init.`,\n });\n } else if (cmp > 0) {\n findings.push({\n level: \"warning\",\n message: `El bloque \"${id}\" es más nuevo que el binario (v${block.version} > v${currentVersion}) — el binario es más viejo que el motor instalado — actualiza el paquete (npm i -g).`,\n });\n }\n }\n }\n\n const fullFiles: string[][] = [\n [\"output-styles\", \"argos.md\"],\n ...listAgentIds(assetsDir).map((id) => [\"agents\", `${id}.md`]),\n ...listSkillIds(assetsDir).map((id) => [\"skills\", id, \"SKILL.md\"]),\n ];\n for (const relPath of fullFiles) {\n const dest = join(claudeDir, ...relPath);\n const label = join(...relPath);\n if (!existsSync(dest)) {\n findings.push({ level: \"error\", message: `Falta ${label} en el motor. Corre argos init.` });\n continue;\n }\n const content = readFileSync(dest, \"utf-8\");\n if (!hasArgosFileMarker(content)) {\n findings.push({\n level: \"info\",\n message: `archivo ajeno en ${label} — hay versión del motor disponible pero está bloqueada; muévelo o bórralo y corre argos init para instalarla.`,\n });\n }\n }\n\n checkHookScripts(findings, claudeDir, currentVersion);\n checkHookSettings(findings, claudeDir);\n checkOutputStyleVoice(findings, claudeDir);\n checkWorkspaceRegistryHealth(findings);\n}\n\nfunction checkRepo(cwd: string, findings: DoctorFinding[]): void {\n if (!hasConfig(cwd)) return;\n\n const configPath = join(cwd, \"argos.config.json\");\n let config: z.infer<typeof ArgosConfigSchema> | undefined;\n try {\n const raw: unknown = JSON.parse(readFileSync(configPath, \"utf-8\"));\n config = ArgosConfigSchema.parse(raw);\n } catch (error) {\n for (const message of describeZodError(error)) {\n findings.push({ level: \"error\", message: `argos.config.json inválido — ${message}` });\n }\n return;\n }\n\n if (hasNaviorConfig(cwd)) {\n findings.push({\n level: \"info\",\n message: \"navori.config.json coexiste con argos.config.json (migración en curso).\",\n });\n }\n\n if (config.qualityGate.fast === NO_GATE_PLACEHOLDER) {\n findings.push({\n level: \"warning\",\n message: \"quality gate placeholder — configura scripts y corre argos adopt --refresh.\",\n });\n }\n\n // Ficha drift: does ./CLAUDE.md's ficha block match what adopt would write today?\n const claudeMdPath = join(cwd, \"CLAUDE.md\");\n const claudeMd = readFileSafe(claudeMdPath, findings, \"./CLAUDE.md\");\n checkDanglingMarkers(findings, claudeMd, \"./CLAUDE.md\");\n const fichaBlocks = listBlocks(claudeMd).filter((b) => b.id === FICHA_BLOCK_ID);\n if (fichaBlocks.length > 1) {\n findings.push({\n level: \"warning\",\n message: `La ficha está duplicada (${fichaBlocks.length} veces) en ./CLAUDE.md. Corre argos adopt --refresh para sanearla.`,\n });\n }\n const fichaBlock = fichaBlocks[0];\n if (!fichaBlock) {\n findings.push({ level: \"warning\", message: \"Falta la ficha en ./CLAUDE.md. Corre argos adopt --refresh.\" });\n } else {\n const expectedFicha = buildFichaContent(config);\n if (!claudeMd.includes(expectedFicha)) {\n findings.push({ level: \"warning\", message: \"La ficha de ./CLAUDE.md quedó vieja. Corre argos adopt --refresh.\" });\n }\n }\n\n // Stack drift: new relevant libs in package.json not yet recorded.\n const pkg = readPackageJson(cwd);\n if (pkg) {\n const recordedLibs = new Set(config.stack?.libs ?? []);\n const freshLibs = detectLibs(pkg);\n const newLibs = freshLibs.filter((lib) => !recordedLibs.has(lib));\n if (newLibs.length > 0) {\n findings.push({\n level: \"warning\",\n message: `Nuevas libs detectadas sin registrar (${newLibs.join(\", \")}). Corre argos adopt --refresh.`,\n });\n }\n\n const freshFramework = detectFramework(pkg);\n if (freshFramework && config.stack?.framework && freshFramework !== config.stack.framework) {\n findings.push({\n level: \"warning\",\n message: `El framework detectado (${freshFramework}) difiere del registrado (${config.stack.framework}). Corre argos adopt --refresh.`,\n });\n }\n\n const freshPackageManager = detectPackageManager(cwd);\n if (\n freshPackageManager &&\n config.stack?.packageManager &&\n freshPackageManager !== config.stack.packageManager\n ) {\n findings.push({\n level: \"warning\",\n message: `El package manager detectado (${freshPackageManager}) difiere del registrado (${config.stack.packageManager}). Corre argos adopt --refresh.`,\n });\n }\n }\n\n // Identity drift: current git remote vs the identity recorded in config.\n const remoteUrl = getRemoteOriginUrl(cwd);\n const freshIdentity = remoteUrl ? (parseIdentityFromRemote(remoteUrl) ?? undefined) : undefined;\n if (freshIdentity && config.identity && freshIdentity !== config.identity) {\n findings.push({\n level: \"warning\",\n message: `La identidad detectada (${freshIdentity}) difiere de la registrada (${config.identity}). Corre argos adopt --refresh.`,\n });\n }\n\n // Workspace linkage (F2): repo not registered, registered under a stale\n // path, or config.workspace pointing at a name absent from the registry.\n let registry: ReturnType<typeof loadRegistry>;\n try {\n registry = loadRegistry();\n } catch (err) {\n findings.push({\n level: \"error\",\n message: `No se pudo leer workspaces.json (${err instanceof Error ? err.message : String(err)}).`,\n });\n return;\n }\n const resolution = resolveWorkspaceForRepo(registry, {\n configWorkspace: config.workspace,\n remoteUrl,\n repoPath: cwd,\n });\n\n if (resolution.kind === \"unresolved\") {\n findings.push({\n level: \"info\",\n message: \"El repo no está vinculado a ningún workspace. Corre argos workspace link.\",\n });\n } else if (resolution.kind === \"resolved\") {\n const workspace = registry[resolution.name];\n if (!workspace) {\n findings.push({\n level: \"warning\",\n message: `argos.config.json referencia el workspace '${resolution.name}', que no existe en el registro. Corre argos workspace link ${resolution.name}.`,\n });\n } else {\n const entry = workspace.repos.find((r) => r.name === config.name);\n if (!entry) {\n findings.push({\n level: \"info\",\n message: \"El repo no está vinculado a ningún workspace. Corre argos workspace link.\",\n });\n } else {\n let realCwd: string | undefined;\n try {\n realCwd = realpathSync(resolve(cwd));\n } catch {\n realCwd = undefined;\n }\n if (realCwd && entry.path !== realCwd) {\n findings.push({\n level: \"warning\",\n message: `El repo está registrado en el workspace '${resolution.name}' con un path distinto (${entry.path} vs ${realCwd}). Corre argos workspace link para actualizarlo.`,\n });\n }\n }\n }\n }\n}\n\n/**\n * Core, testable implementation of `argos doctor`: a read-only audit of the\n * global engine and (when cwd is a git repo) the repo's argos.config.json +\n * ficha. Never writes anything.\n */\nexport function runDoctor(options: DoctorOptions): DoctorReport {\n const findings: DoctorFinding[] = [];\n\n checkMotor(findings);\n if (isGitRepo(options.cwd)) {\n checkRepo(options.cwd, findings);\n }\n\n const exitCode = findings.some((f) => f.level !== \"info\") ? 1 : 0;\n return { findings, exitCode };\n}\n\nexport const doctorCommand = defineCommand({\n meta: {\n name: \"doctor\",\n description: \"Report drift between the engine, the repo config, and its ficha.\",\n },\n run() {\n const report = runDoctor({ cwd: process.cwd() });\n\n if (report.findings.length === 0) {\n console.log(\"Todo al día.\");\n process.exit(0);\n }\n\n for (const finding of report.findings) {\n const padded = finding.level.padEnd(10);\n const label = finding.level === \"error\" ? pc.red(padded) : finding.level === \"warning\" ? pc.yellow(padded) : pc.dim(padded);\n console.log(`${label} ${finding.message}`);\n }\n\n process.exit(report.exitCode);\n },\n});\n"],"names":["defineCommand","existsSync","readFileSync","realpathSync","statSync","join","resolve","pc","ArgosConfigSchema","hasConfig","detectFramework","detectLibs","detectPackageManager","readPackageJson","buildFichaContent","FICHA_BLOCK_ID","getRemoteOriginUrl","isGitRepo","parseIdentityFromRemote","listAgentIds","listSkillIds","MANAGED_BLOCK_IDS","resolveAssetsDir","listBlocks","listDanglingBlockIds","hasArgosFileMarker","hasArgosShellFileMarker","hasNaviorConfig","resolveClaudeDir","isArgosHookCommand","readCliVersion","loadRegistry","resolveWorkspaceForRepo","describeZodError","NO_GATE_PLACEHOLDER","readFileSafe","path","findings","label","err","push","level","message","Error","String","compareVersions","a","b","pa","split","map","n","Number","parseInt","pb","i","Math","max","length","diff","HOOK_IDS","extractShellMarkerVersion","content","exec","extractHookScriptPath","command","isPlainObject","v","Array","isArray","checkHookScripts","claudeDir","currentVersion","id","hookPath","beforeCount","hookVersion","cmp","checkHookSettings","settingsPath","raw","settings","trim","JSON","parse","foundScriptPaths","Set","hooksRoot","hooks","undefined","preToolUse","PreToolUse","bucket","hook","scriptPath","add","isRealFile","isFile","expectedPath","has","checkOutputStyleVoice","outputStylePath","outputStyle","checkWorkspaceRegistryHealth","registry","stale","wsName","ws","Object","entries","repo","repos","name","checkDanglingMarkers","checkMotor","assetsDir","claudeMdPath","claudeMd","blocks","matching","filter","block","version","fullFiles","relPath","dest","checkRepo","cwd","configPath","config","error","qualityGate","fast","fichaBlocks","fichaBlock","expectedFicha","includes","pkg","recordedLibs","stack","libs","freshLibs","newLibs","lib","freshFramework","framework","freshPackageManager","packageManager","remoteUrl","freshIdentity","identity","resolution","configWorkspace","workspace","repoPath","kind","entry","find","r","realCwd","runDoctor","options","exitCode","some","f","doctorCommand","meta","description","run","report","process","console","log","exit","finding","padded","padEnd","red","yellow","dim"],"mappings":"AAAA,SAASA,aAAa,QAAQ,QAAQ;AACtC,SAASC,UAAU,EAAEC,YAAY,EAAEC,YAAY,EAAEC,QAAQ,QAAQ,UAAU;AAC3E,SAASC,IAAI,EAAEC,OAAO,QAAQ,YAAY;AAC1C,OAAOC,QAAQ,aAAa;AAE5B,SAASC,iBAAiB,EAAEC,SAAS,QAAQ,mBAAmB;AAChE,SACEC,eAAe,EACfC,UAAU,EACVC,oBAAoB,EACpBC,eAAe,QACV,mBAAmB;AAC1B,SAASC,iBAAiB,EAAEC,cAAc,QAAQ,kBAAkB;AACpE,SAASC,kBAAkB,EAAEC,SAAS,EAAEC,uBAAuB,QAAQ,gB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Q,gDAAgD,CAAC;oBAC3K;gBACF;YACF;QACF;IACF;AACF;AAEA;;;;CAIC,GACD,OAAO,SAASC,UAAUC,OAAsB;IAC9C,MAAM5H,WAA4B,EAAE;IAEpC6E,WAAW7E;IACX,IAAIpB,UAAUgJ,QAAQlC,GAAG,GAAG;QAC1BD,UAAUmC,QAAQlC,GAAG,EAAE1F;IACzB;IAEA,MAAM6H,WAAW7H,SAAS8H,IAAI,CAAC,CAACC,IAAMA,EAAE3H,KAAK,KAAK,UAAU,IAAI;IAChE,OAAO;QAAEJ;QAAU6H;IAAS;AAC9B;AAEA,OAAO,MAAMG,gBAAgBrK,cAAc;IACzCsK,MAAM;QACJtD,MAAM;QACNuD,aAAa;IACf;IACAC;QACE,MAAMC,SAAST,UAAU;YAAEjC,KAAK2C,QAAQ3C,GAAG;QAAG;QAE9C,IAAI0C,OAAOpI,QAAQ,CAACqB,MAAM,KAAK,GAAG;YAChCiH,QAAQC,GAAG,CAAC;YACZF,QAAQG,IAAI,CAAC;QACf;QAEA,KAAK,MAAMC,WAAWL,OAAOpI,QAAQ,CAAE;YACrC,MAAM0I,SAASD,QAAQrI,KAAK,CAACuI,MAAM,CAAC;YACpC,MAAM1I,QAAQwI,QAAQrI,KAAK,KAAK,UAAUlC,GAAG0K,GAAG,CAACF,UAAUD,QAAQrI,KAAK,KAAK,YAAYlC,GAAG2K,MAAM,CAACH,UAAUxK,GAAG4K,GAAG,CAACJ;YACpHJ,QAAQC,GAAG,CAAC,GAAGtI,MAAM,CAAC,EAAEwI,QAAQpI,OAAO,EAAE;QAC3C;QAEAgI,QAAQG,IAAI,CAACJ,OAAOP,QAAQ;IAC9B;AACF,GAAG"}
|
package/dist/commands/init.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type FileStatus } from "../lib/managed-files.js";
|
|
2
|
+
import { type Prompter } from "../lib/prompter.js";
|
|
2
3
|
export type InitRowStatus = FileStatus | "error";
|
|
3
4
|
export interface InitRow {
|
|
4
5
|
path: string;
|
|
@@ -7,6 +8,22 @@ export interface InitRow {
|
|
|
7
8
|
}
|
|
8
9
|
export interface InitOptions {
|
|
9
10
|
language?: "es" | "en";
|
|
11
|
+
/**
|
|
12
|
+
* Install the agent full-file assets under `agents/`. Default `true`.
|
|
13
|
+
* Skills are NEVER gated by an option (spec 0004: they load on-demand and
|
|
14
|
+
* trimming them breaks the arsenal), only agents and hooks are.
|
|
15
|
+
*/
|
|
16
|
+
installAgents?: boolean;
|
|
17
|
+
/** Install the 2 global hooks (scripts + settings.json entries). Default `true`. */
|
|
18
|
+
installHooks?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Whether to take over `settings.json.outputStyle` when it currently
|
|
21
|
+
* points at the predecessor harness's voice (`navori`). Default `true`
|
|
22
|
+
* (unconditional replace — the `--yes`/no-TTY behavior from spec 0004);
|
|
23
|
+
* the interactive wizard passes `false` when the user declines the
|
|
24
|
+
* takeover prompt.
|
|
25
|
+
*/
|
|
26
|
+
takeoverNavoriVoice?: boolean;
|
|
10
27
|
}
|
|
11
28
|
export interface InitReport {
|
|
12
29
|
rows: InitRow[];
|
|
@@ -21,6 +38,22 @@ export interface InitReport {
|
|
|
21
38
|
* filesystem — no process.exit, no console output.
|
|
22
39
|
*/
|
|
23
40
|
export declare function runInit(options?: InitOptions): InitReport;
|
|
41
|
+
export interface InitInteractiveOptions extends InitOptions {
|
|
42
|
+
/** `--yes`: forces non-interactive behavior even under a real TTY. */
|
|
43
|
+
yes?: boolean;
|
|
44
|
+
/** Injectable for tests; defaults to the real `@clack/prompts`-backed prompter. */
|
|
45
|
+
prompter?: Prompter;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Interactive layer over `runInit` (spec 0004 F5 "argos init"). A pure
|
|
49
|
+
* additive wrapper — the core `runInit` never changes behavior or contract.
|
|
50
|
+
* Without a real TTY, or with `--yes`, this delegates to `runInit(options)`
|
|
51
|
+
* unchanged: no prompt library call is ever reached on that path. With a
|
|
52
|
+
* TTY, it runs a 3-step wizard (language, agents/hooks toggles, summary +
|
|
53
|
+
* final confirm) before calling `runInit` with the gathered choices;
|
|
54
|
+
* cancelling at any step touches nothing and returns a no-op report.
|
|
55
|
+
*/
|
|
56
|
+
export declare function runInitInteractive(options?: InitInteractiveOptions): Promise<InitReport>;
|
|
24
57
|
export declare const initCommand: import("citty").CommandDef<{
|
|
25
58
|
readonly language: {
|
|
26
59
|
readonly type: "enum";
|
|
@@ -28,5 +61,10 @@ export declare const initCommand: import("citty").CommandDef<{
|
|
|
28
61
|
readonly default: "es";
|
|
29
62
|
readonly description: "Idioma del motor (global.json).";
|
|
30
63
|
};
|
|
64
|
+
readonly yes: {
|
|
65
|
+
readonly type: "boolean";
|
|
66
|
+
readonly default: false;
|
|
67
|
+
readonly description: "Fuerza modo no interactivo aunque haya una TTY real (defaults + flags, sin wizard).";
|
|
68
|
+
};
|
|
31
69
|
}>;
|
|
32
70
|
//# sourceMappingURL=init.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAeA,OAAO,EACL,KAAK,UAAU,EAIhB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAeA,OAAO,EACL,KAAK,UAAU,EAIhB,MAAM,yBAAyB,CAAC;AAQjC,OAAO,EAAgC,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAqBjF,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,OAAO,CAAC;AAEjD,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB;;;;OAIG;IACH,aA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