harnessed 4.46.0 → 4.48.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/README-en.md +65 -65
- package/README.md +65 -65
- package/dist/cli.mjs +1511 -1261
- package/dist/cli.mjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -6,11 +6,11 @@ import { Type } from '@sinclair/typebox';
|
|
|
6
6
|
import { readFile, readdir, stat, rm, unlink, writeFile, cp, mkdir, access, rename, appendFile, copyFile, chmod, mkdtemp } from 'fs/promises';
|
|
7
7
|
import { Value } from '@sinclair/typebox/value';
|
|
8
8
|
import lockfile from 'proper-lockfile';
|
|
9
|
+
import { pathToFileURL, fileURLToPath } from 'url';
|
|
9
10
|
import { LineCounter, parseDocument, parse, isSeq, isScalar, stringify } from 'yaml';
|
|
10
11
|
import { Ajv } from 'ajv';
|
|
11
12
|
import * as ajvFormatsNs from 'ajv-formats';
|
|
12
13
|
import { execFileSync, spawnSync, spawn, execFile, exec } from 'child_process';
|
|
13
|
-
import { pathToFileURL, fileURLToPath } from 'url';
|
|
14
14
|
import { createHash, verify, createPublicKey } from 'crypto';
|
|
15
15
|
import { promisify } from 'util';
|
|
16
16
|
import * as p from '@clack/prompts';
|
|
@@ -38,7 +38,7 @@ var init_package = __esm({
|
|
|
38
38
|
"package.json"() {
|
|
39
39
|
package_default = {
|
|
40
40
|
name: "harnessed",
|
|
41
|
-
version: "4.
|
|
41
|
+
version: "4.48.0",
|
|
42
42
|
description: "AI coding harness package manager + composition orchestrator",
|
|
43
43
|
type: "module",
|
|
44
44
|
license: "Apache-2.0",
|
|
@@ -1224,252 +1224,908 @@ var init_forwardStep = __esm({
|
|
|
1224
1224
|
}
|
|
1225
1225
|
});
|
|
1226
1226
|
|
|
1227
|
-
//
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1227
|
+
// messages/en.json
|
|
1228
|
+
var en_default;
|
|
1229
|
+
var init_en = __esm({
|
|
1230
|
+
"messages/en.json"() {
|
|
1231
|
+
en_default = {
|
|
1232
|
+
"setup.workflows_not_found": "error: workflows directory not found at {{path}}",
|
|
1233
|
+
"setup.nothing_to_install": "setup: no workflow directories with SKILL.md found \u2014 nothing to install",
|
|
1234
|
+
"setup.dry_run.header": "[dry-run] setup would install {{count}} workflow(s) to {{path}}:",
|
|
1235
|
+
"setup.dry_run.run_hint": " run without --dry-run to execute",
|
|
1236
|
+
"setup.copy_failed": " error: failed to copy {{name}}: {{message}}",
|
|
1237
|
+
"setup.step_a_complete": "Step A: {{count}} workflows installed to {{path}}",
|
|
1238
|
+
"setup.step_a_render.complete": " generated {{count}}/{{total}} command files",
|
|
1239
|
+
"setup.step_a_render.warnings_header": " [A.5] warnings \u2014 some capability cmds could not be fully resolved:",
|
|
1240
|
+
"setup.step_c.created": " [C] created {{path}} + enabled Agent Teams",
|
|
1241
|
+
"setup.step_c.already_enabled": " [C] Agent Teams already enabled ({{path}})",
|
|
1242
|
+
"setup.step_c.enabled_backup": " [C] enabled Agent Teams in {{path}} (backup saved \u2192 {{backupPath}})",
|
|
1243
|
+
"setup.step_c.skipped": " [C] Agent Teams enable skipped: {{message}}",
|
|
1244
|
+
"setup.step_d.created": " [D] created {{path}} + wrote env.HARNESSED_USER_LANG={{lang}}",
|
|
1245
|
+
"setup.step_d.already_set": " [D] env.HARNESSED_USER_LANG={{lang}} already set in {{path}} \u2014 respecting user override",
|
|
1246
|
+
"setup.step_d.enabled_backup": " [D] wrote env.HARNESSED_USER_LANG={{lang}} in {{path}} (backup saved \u2192 {{backupPath}})",
|
|
1247
|
+
"setup.step_d.skipped": " [D] User language write skipped: {{message}}",
|
|
1248
|
+
"setup.step_b_complete": "Upstream components: {{installed}} installed / {{already}} already-installed / {{skipped}} skipped / {{failed}} failed [{{seconds}}s]",
|
|
1249
|
+
"setup.complete": "setup complete \u2014 {{skills}} workflows + {{manifests}} base manifests configured",
|
|
1250
|
+
"setup.mcp_hint": "Run /mcp in Claude Code to verify MCP server connections.",
|
|
1251
|
+
"setup.mcp_hint_codex": "Run codex mcp list to verify MCP server connections.",
|
|
1252
|
+
"setup.search_key_hint.header": "\n\u26A0 Search MCP API keys missing \u2014 the server(s) below are installed but will fail at query time until the key is configured:",
|
|
1253
|
+
"setup.search_key_hint.line": ' {{server}}: set {{envVar}} \u2014 add it to the ~/.claude/settings.json "env" block (e.g. {"env": {"{{envVar}}": "<your-key>"}}) or export {{envVar}} in your shell',
|
|
1254
|
+
"setup.optional_offer.ecc_note": " ecc (bonus tier): installing it unlocks finer-grained scenario orchestration (per-language review/build expert routing etc.); the trade-off is ~20k+ tokens/session of static listing overhead \u2014 inherent to ECC's own scale (281 skills / 94 commands / 67 agents), not introduced by harnessed.",
|
|
1255
|
+
"setup.bundled_summary": "\nharnessed workflows bundled at <packageRoot>/workflows/ (share-only, read-only)",
|
|
1256
|
+
"setup.bundled_location": "",
|
|
1257
|
+
"setup.doctor_hint": "\nRun harnessed doctor to verify your environment.",
|
|
1258
|
+
"agent_teams.missing_header": "\n\u26A0\uFE0F Agent Teams not enabled \u2014 parallelism upgrade path unavailable",
|
|
1259
|
+
"agent_teams.missing_fix": " fix: claude config set env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS 1",
|
|
1260
|
+
"agent_teams.missing_explanation": " harnessed task parallelism uses Subagent or Agent Teams (CC 2.1.178+)",
|
|
1261
|
+
"agent_teams.missing_nonblocking": " non-blocking \u2014 auto-degrades to subagent fan-out\n",
|
|
1262
|
+
"install.manifest_not_found": "error: manifest '{{name}}' not found",
|
|
1263
|
+
"install.manifest_not_found.fix": " fix: ensure manifests/tools/{{name}}.yaml, manifests/skill-packs/{{name}}.yaml, or manifests/optional/{{name}}.yaml exists",
|
|
1264
|
+
"install.audit_hint": " fix: run 'harnessed audit' to inspect manifest issues",
|
|
1265
|
+
"install.success": "installed {{name}}",
|
|
1266
|
+
"install.success_with_version": "installed {{name}}@{{version}}",
|
|
1267
|
+
"install.already_installed": "already-installed {{name}} (idempotent check hit; nothing to do)",
|
|
1268
|
+
"install.already_installed_with_version": "already-installed {{name}}@{{version}} (idempotent check hit; nothing to do)",
|
|
1269
|
+
"install.aborted": "aborted: {{reason}}",
|
|
1270
|
+
"uninstall.dry_run.preview": "[dry-run] would uninstall '{{name}}' via method '{{method}}'",
|
|
1271
|
+
"uninstall.dry_run.run_hint": " run without --dry-run to execute",
|
|
1272
|
+
"uninstall.confirm.prompt": "Uninstall '{{name}}'? This cannot be undone.",
|
|
1273
|
+
"uninstall.cancelled": "aborted: user cancelled",
|
|
1274
|
+
"uninstall.completed": "uninstalled {{name}}",
|
|
1275
|
+
"uninstall.unified.nothing": "nothing to do \u2014 no harnessed artifacts found",
|
|
1276
|
+
"uninstall.unified.header": "harnessed uninstall will remove the following:",
|
|
1277
|
+
"uninstall.unified.commands": " Commands: {{count}} harnessed-generated slash command file(s) in ~/.claude/commands/",
|
|
1278
|
+
"uninstall.unified.agent_roles": " Agent roles: {{count}} harnessed-generated codex agent role file(s) in ~/.codex/agents/",
|
|
1279
|
+
"uninstall.unified.skills": " Skills: {{count}} workflow skill directory(ies) in ~/.claude/skills/",
|
|
1280
|
+
"uninstall.unified.settings": " Settings: harnessed env vars (CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS, HARNESSED_USER_LANG) from ~/.claude/settings.json",
|
|
1281
|
+
"uninstall.unified.hooks": " Hooks: {{count}} harnessed Stop/UserPromptSubmit hook(s) in ~/.claude/settings.json",
|
|
1282
|
+
"uninstall.unified.state_dir": " State directory: ~/.claude/harnessed/ (includes backups, audit log, state, lock)",
|
|
1283
|
+
"uninstall.unified.upstream_note": "\nUpstream components (npm packages, MCP servers, CC plugins, git-cloned repos, npx skills) are NOT affected.",
|
|
1284
|
+
"uninstall.unified.dry_run_hint": "\n(dry-run \u2014 re-run without --dry-run to actually remove)",
|
|
1285
|
+
"uninstall.unified.confirm": "Remove harnessed's own files? Upstream components (npm packages, MCP servers, CC plugins, etc.) will NOT be affected. This cannot be undone.",
|
|
1286
|
+
"uninstall.unified.removing": "removing harnessed files...",
|
|
1287
|
+
"uninstall.unified.removed_commands": " removed {{count}} command file(s)",
|
|
1288
|
+
"uninstall.unified.removed_agent_roles": " removed {{count}} codex agent role file(s)",
|
|
1289
|
+
"uninstall.unified.removed_skills": " removed {{count}} skill directory(ies)",
|
|
1290
|
+
"uninstall.unified.removed_settings": " removed harnessed env vars from ~/.claude/settings.json",
|
|
1291
|
+
"uninstall.unified.removed_hooks": " removed {{count}} harnessed hook(s) from ~/.claude/settings.json",
|
|
1292
|
+
"uninstall.unified.removed_state_dir": " removed ~/.claude/harnessed/",
|
|
1293
|
+
"uninstall.unified.partial_failure": "\n{{count}} item(s) could not be removed (permission denied or already gone):",
|
|
1294
|
+
"uninstall.unified.complete": "uninstall complete \u2014 harnessed's own files have been removed",
|
|
1295
|
+
"uninstall.unified.cli_hint_header": "\nto remove the harnessed CLI itself (the step above did not \u2014 it only cleared setup files):",
|
|
1296
|
+
"uninstall.unified.cli_hint_binary": " binary: delete {{path}}\n then remove {{dir}} from your PATH",
|
|
1297
|
+
"uninstall.unified.cli_hint_npm": " npm: npm uninstall -g harnessed",
|
|
1298
|
+
"uninstall.unified.cli_hint_other": " installed both ways? remove the other too \u2014 npm: 'npm uninstall -g harnessed' / binary: delete the exe + its bin dir from PATH",
|
|
1299
|
+
"gc.invalid_duration": "error: invalid --older-than '{{value}}'",
|
|
1300
|
+
"gc.invalid_duration.fix": " fix: use format <N>{d|h|m|w} e.g. 30d / 24h / 60m / 4w",
|
|
1301
|
+
"gc.no_backups": "no backups found ({{root}} absent) \u2014 nothing to gc",
|
|
1302
|
+
"gc.no_old_snapshots": "no snapshots older than {{cutoff}} (kept {{keptCount}} most-recent)",
|
|
1303
|
+
"gc.summary_will_delete": "would delete {{count}} snapshot(s), ~{{sizeKb}} KB total:",
|
|
1304
|
+
"gc.summary_deleting": "deleting {{count}} snapshot(s), ~{{sizeKb}} KB total:",
|
|
1305
|
+
"gc.dry_run_rerun_hint": "\n(dry-run \u2014 re-run without --dry-run to actually delete)",
|
|
1306
|
+
"doctor.summary.fail": "\nsome checks failed (see fix hints above)",
|
|
1307
|
+
"doctor.summary.warn": "\nall checks ok (with warnings \u2014 see hints above)",
|
|
1308
|
+
"doctor.summary.pass": "\nall checks passed",
|
|
1309
|
+
"doctor.host_scope": "host: {{host}} \u2014 {{applied}} of {{total}} checks apply\n",
|
|
1310
|
+
"doctor.matrix.legend": "\nn/a = the check is not declared for that host in the registry, so it was not run",
|
|
1311
|
+
"check_docs.clean": "documentation discipline: no violations",
|
|
1312
|
+
"check_docs.state_line_limit": "STATE.md is {{lines}} lines > the {{limit}}-line digest limit \u2014 archive older phase narrative to RETROSPECTIVE.md (override for one run: HARNESSED_ALLOW_LONG_STATE=1)",
|
|
1313
|
+
"check_docs.state_key_decisions": "{{count}} '\u5173\u952E\u51B3\u8BAE ship \u603B\u7ED3' section(s) > {{limit}} \u2014 keep only the current one; move the rest to RETROSPECTIVE.md",
|
|
1314
|
+
"check_docs.state_errata": "historical commentary '{{excerpt}}' belongs in RETROSPECTIVE.md, not in the STATE digest",
|
|
1315
|
+
"check_docs.roadmap_narrative": "closing narrative inlined in an overview doc ({{signals}}) \u2014 ROADMAP carries one line + a pointer per phase; narrative goes to SUMMARY / VERIFICATION",
|
|
1316
|
+
"check_docs.summary_halt": "\ndocumentation discipline: {{halt}} blocking + {{warn}} advisory violation(s)",
|
|
1317
|
+
"check_docs.summary_warn": "\ndocumentation discipline: {{warn}} advisory violation(s) (non-blocking)",
|
|
1318
|
+
"backup.no_backups": "no backups found ({{root}} absent)",
|
|
1319
|
+
"backup.no_backups_empty": "no backups found ({{root}} empty)",
|
|
1320
|
+
"backup.total_snapshots": "\n{{count}} snapshot(s) total",
|
|
1321
|
+
"rollback.metadata_unreadable": "error: cannot read {{path}}: {{message}}",
|
|
1322
|
+
"rollback.metadata_unreadable.fix": " fix: run 'harnessed backup list' to see available timestamps",
|
|
1323
|
+
"rollback.checksum_mismatch": "error: backup checksum mismatch for {{target}} (expected {{expected}}, got {{actual}})",
|
|
1324
|
+
"rollback.restored": "restored {{count}} file(s) from {{timestamp}}",
|
|
1325
|
+
"status.no_installs": "no installs recorded ({{path}} absent or empty)",
|
|
1326
|
+
"status.summary_installs": "\n{{count}} install(s) recorded",
|
|
1327
|
+
"status.lock_held": "\nlock: held (since {{since}}){{staleSuffix}}",
|
|
1328
|
+
"status.lock_held.stale_suffix": " \u2014 STALE",
|
|
1329
|
+
"status.lock_release_hint": " to release: wait for process to finish or delete {{path}}",
|
|
1330
|
+
"status.lock_free": "\nlock: free",
|
|
1331
|
+
"here.no_workflow": "no active workflow for this repo ({{path}} has no entry for cwd)",
|
|
1332
|
+
"here.no_workflow.hint": " to start: run a stage (e.g. `harnessed gates discuss`) or `harnessed run <workflow>`",
|
|
1333
|
+
"audit_log.no_records_file": "no audit records found ({{path}} does not exist)",
|
|
1334
|
+
"audit_log.no_records_empty": "no audit records found (audit.log is empty)",
|
|
1335
|
+
"audit_log.jq_missing": "\u2717 jq not found in PATH \u2014 run: harnessed doctor",
|
|
1336
|
+
"audit_log.tail_invalid": "\u2717 --tail must be a positive integer",
|
|
1337
|
+
"audit_log.head_invalid": "\u2717 --head must be a positive integer",
|
|
1338
|
+
"execute_task.require_task": "error: --task <text> is required",
|
|
1339
|
+
"execute_task.load_phases_failed": "error: failed to load workflows/{{workflow}}/phases.yaml \u2014 {{message}}",
|
|
1340
|
+
"execute_task.precommit_skipped": "\u26A0\uFE0F before-commit pre-flight skipped ({{message}}); subagent will biome-check at commit time.",
|
|
1341
|
+
"research.require_query": "error: --query <text> is required",
|
|
1342
|
+
"manifest_add.non_interactive_warn": "[ee-5-gate] WARN: --non-interactive skips 5-question prompt (D-03 dry-run-only). plan-phase hard reject still applies.",
|
|
1343
|
+
"manifest_add.dry_run_preview": "[manifest-add] dry-run preview for upstream: {{upstream}} \u2192 {{path}}",
|
|
1344
|
+
"manifest_add.empty_answer": "error: EE-5 gate requires non-empty answer",
|
|
1345
|
+
"manifest_add.gate_passed_wrote": "[manifest-add] EE-5 gate passed; wrote {{path}}",
|
|
1346
|
+
"manifest_add.gate_passed_dry_run": "[manifest-add] EE-5 gate passed (dry-run); would write {{path}}",
|
|
1347
|
+
"resume.fail": "\u2717 {{error}}",
|
|
1348
|
+
"resume.corrupt": "\u2717 {{error}}\n path: {{path}}"
|
|
1349
|
+
};
|
|
1350
|
+
}
|
|
1351
|
+
});
|
|
1352
|
+
function mapToSupported(raw) {
|
|
1353
|
+
if (!raw) return "en";
|
|
1354
|
+
if (/^zh([^a-z]|$)/i.test(raw)) return "zh-Hans";
|
|
1355
|
+
return "en";
|
|
1234
1356
|
}
|
|
1235
|
-
function
|
|
1236
|
-
const
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1357
|
+
function detectLocale() {
|
|
1358
|
+
const raw = process.env.HARNESSED_LANG || process.env.LC_ALL || process.env.LANG || process.env.LANGUAGE || safeIntlLocale();
|
|
1359
|
+
return mapToSupported(raw);
|
|
1360
|
+
}
|
|
1361
|
+
function safeIntlLocale() {
|
|
1362
|
+
try {
|
|
1363
|
+
return Intl.DateTimeFormat().resolvedOptions().locale;
|
|
1364
|
+
} catch {
|
|
1365
|
+
return void 0;
|
|
1242
1366
|
}
|
|
1243
|
-
if (!node || typeof node !== "object") return { line: null, column: null };
|
|
1244
|
-
const range = node.range;
|
|
1245
|
-
if (!range) return { line: null, column: null };
|
|
1246
|
-
const offset = range[0];
|
|
1247
|
-
const pos = lineCounter.linePos(offset);
|
|
1248
|
-
return { line: pos.line, column: pos.col };
|
|
1249
1367
|
}
|
|
1250
|
-
function
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1368
|
+
function wireMessagesDir(provider) {
|
|
1369
|
+
wiredMessagesDirProvider = provider;
|
|
1370
|
+
}
|
|
1371
|
+
function messagesDir() {
|
|
1372
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
1373
|
+
const candidates = [];
|
|
1374
|
+
if (wiredMessagesDirProvider) {
|
|
1375
|
+
try {
|
|
1376
|
+
candidates.push(wiredMessagesDirProvider());
|
|
1377
|
+
} catch {
|
|
1378
|
+
}
|
|
1257
1379
|
}
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1380
|
+
candidates.push(resolve(here, "..", "..", "messages"), resolve(here, "..", "messages"));
|
|
1381
|
+
for (const c of candidates) {
|
|
1382
|
+
try {
|
|
1383
|
+
readFileSync(join(c, "en.json"), "utf8");
|
|
1384
|
+
return c;
|
|
1385
|
+
} catch {
|
|
1386
|
+
}
|
|
1265
1387
|
}
|
|
1266
|
-
return
|
|
1267
|
-
file,
|
|
1268
|
-
path,
|
|
1269
|
-
message: err2.message ?? "unknown error",
|
|
1270
|
-
line,
|
|
1271
|
-
column,
|
|
1272
|
-
keyword: err2.keyword
|
|
1273
|
-
};
|
|
1388
|
+
return resolve(process.cwd(), "messages");
|
|
1274
1389
|
}
|
|
1275
|
-
function
|
|
1276
|
-
return
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
}
|
|
1390
|
+
function loadLocale(locale) {
|
|
1391
|
+
if (cache[locale]) return cache[locale];
|
|
1392
|
+
const path = join(messagesDir(), `${locale}.json`);
|
|
1393
|
+
try {
|
|
1394
|
+
const raw = readFileSync(path, "utf8");
|
|
1395
|
+
cache[locale] = JSON.parse(raw);
|
|
1396
|
+
} catch {
|
|
1397
|
+
cache[locale] = locale === "en" ? en_default : {};
|
|
1398
|
+
}
|
|
1399
|
+
return cache[locale];
|
|
1284
1400
|
}
|
|
1285
|
-
|
|
1286
|
-
|
|
1401
|
+
function setLocale(locale) {
|
|
1402
|
+
if (!locale) return;
|
|
1403
|
+
const mapped = mapToSupported(locale);
|
|
1404
|
+
if (SUPPORTED.has(mapped)) currentLocale = mapped;
|
|
1405
|
+
}
|
|
1406
|
+
function getLocale() {
|
|
1407
|
+
if (currentLocale === null) currentLocale = detectLocale();
|
|
1408
|
+
return currentLocale;
|
|
1409
|
+
}
|
|
1410
|
+
function t(key, params) {
|
|
1411
|
+
const locale = getLocale();
|
|
1412
|
+
const primary = loadLocale(locale);
|
|
1413
|
+
let template = primary[key];
|
|
1414
|
+
if (template === void 0 && locale !== "en") {
|
|
1415
|
+
template = loadLocale("en")[key];
|
|
1416
|
+
}
|
|
1417
|
+
if (template === void 0) template = key;
|
|
1418
|
+
if (!params) return template;
|
|
1419
|
+
return template.replace(/\{\{(\w+)\}\}/g, (_match, name) => {
|
|
1420
|
+
const v = params[name];
|
|
1421
|
+
return v === void 0 ? `{{${name}}}` : String(v);
|
|
1422
|
+
});
|
|
1423
|
+
}
|
|
1424
|
+
var SUPPORTED, currentLocale, cache, wiredMessagesDirProvider;
|
|
1425
|
+
var init_i18n = __esm({
|
|
1426
|
+
"src/i18n/index.ts"() {
|
|
1427
|
+
init_en();
|
|
1428
|
+
SUPPORTED = /* @__PURE__ */ new Set(["en", "zh-Hans"]);
|
|
1429
|
+
currentLocale = null;
|
|
1430
|
+
cache = {};
|
|
1431
|
+
wiredMessagesDirProvider = null;
|
|
1287
1432
|
}
|
|
1288
1433
|
});
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
SpdxLicense = Type.Union([
|
|
1295
|
-
Type.Literal("MIT"),
|
|
1296
|
-
Type.Literal("Apache-2.0"),
|
|
1297
|
-
Type.Literal("BSD-3-Clause"),
|
|
1298
|
-
Type.Literal("ISC"),
|
|
1299
|
-
Type.Literal("0BSD"),
|
|
1300
|
-
Type.Literal("MIT-0"),
|
|
1301
|
-
Type.Literal("anthropics-official")
|
|
1302
|
-
]);
|
|
1303
|
-
LicenseSource = Type.Union([
|
|
1304
|
-
Type.Literal("README"),
|
|
1305
|
-
Type.Literal("registry"),
|
|
1306
|
-
Type.Literal("none"),
|
|
1307
|
-
Type.Literal("anthropics-official")
|
|
1308
|
-
]);
|
|
1309
|
-
Upstream = Type.Object(
|
|
1310
|
-
{
|
|
1311
|
-
source: Type.String({ minLength: 1 }),
|
|
1312
|
-
homepage: Type.String({ format: "uri" }),
|
|
1313
|
-
repository: Type.String({ format: "uri" }),
|
|
1314
|
-
license: SpdxLicense,
|
|
1315
|
-
license_source: Type.Optional(LicenseSource),
|
|
1316
|
-
notice: Type.String({ minLength: 1, maxLength: 500 })
|
|
1317
|
-
},
|
|
1318
|
-
{ additionalProperties: false }
|
|
1319
|
-
);
|
|
1320
|
-
MetadataSchema = Type.Object(
|
|
1321
|
-
{
|
|
1322
|
-
name: Type.String({ pattern: "^[a-z0-9][a-z0-9-]*$", minLength: 1 }),
|
|
1323
|
-
display_name: Type.Optional(Type.String()),
|
|
1324
|
-
description: Type.String({ minLength: 1, maxLength: 120 }),
|
|
1325
|
-
upstream: Upstream
|
|
1326
|
-
},
|
|
1327
|
-
{ additionalProperties: false }
|
|
1328
|
-
);
|
|
1434
|
+
function getPackageRoot() {
|
|
1435
|
+
const thisFile = fileURLToPath(import.meta.url);
|
|
1436
|
+
const thisDir = dirname(thisFile);
|
|
1437
|
+
if (thisDir.endsWith("dist") || thisDir.replace(/\\/g, "/").endsWith("/dist")) {
|
|
1438
|
+
return resolve(thisDir, "..");
|
|
1329
1439
|
}
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
var
|
|
1333
|
-
"src/
|
|
1334
|
-
HookEvent = Type.Union([
|
|
1335
|
-
Type.Literal("SessionStart"),
|
|
1336
|
-
Type.Literal("UserPromptSubmit"),
|
|
1337
|
-
Type.Literal("PreToolUse"),
|
|
1338
|
-
Type.Literal("PostToolUse"),
|
|
1339
|
-
// 4.30.0 (issue #6) — Stop hook for mode-B tool-call corruption auto-recovery.
|
|
1340
|
-
Type.Literal("Stop")
|
|
1341
|
-
]);
|
|
1342
|
-
CcHookAdd = Type.Object(
|
|
1343
|
-
{
|
|
1344
|
-
method: Type.Literal("cc-hook-add"),
|
|
1345
|
-
cmd: Type.String({ minLength: 1 }),
|
|
1346
|
-
// audit-trail (the bash invocation registered)
|
|
1347
|
-
// cwd/env required by lib/spawn.ts discriminated-union access (sister 6 method
|
|
1348
|
-
// shape parity — even though cc-hook-add does not spawn, generic spawn helper
|
|
1349
|
-
// expects these fields on the install union).
|
|
1350
|
-
cwd: Type.Optional(Type.String()),
|
|
1351
|
-
env: Type.Optional(Type.Record(Type.String(), Type.String())),
|
|
1352
|
-
hook_event: HookEvent,
|
|
1353
|
-
hook_matcher: Type.Optional(Type.String()),
|
|
1354
|
-
hook_command: Type.String({ minLength: 1 }),
|
|
1355
|
-
idempotent_check: Type.String({ minLength: 1 })
|
|
1356
|
-
},
|
|
1357
|
-
{ additionalProperties: false }
|
|
1358
|
-
);
|
|
1440
|
+
return resolve(thisDir, "..", "..");
|
|
1441
|
+
}
|
|
1442
|
+
var init_packagePath = __esm({
|
|
1443
|
+
"src/platform/packagePath.ts"() {
|
|
1359
1444
|
}
|
|
1360
1445
|
});
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
cwd: Type.Optional(Type.String()),
|
|
1371
|
-
env: Type.Optional(Type.Record(Type.String(), Type.String())),
|
|
1372
|
-
args: Type.Optional(Type.Record(Type.String(), Type.Unknown())),
|
|
1373
|
-
git_ref: Type.String({ minLength: 1, pattern: GIT_REF_PATTERN }),
|
|
1374
|
-
idempotent_check: Type.String({ minLength: 1 }),
|
|
1375
|
-
// ADR 0005 — third-party marketplace structured metadata (optional).
|
|
1376
|
-
marketplace_source: Type.Optional(
|
|
1377
|
-
Type.Object(
|
|
1378
|
-
{
|
|
1379
|
-
source: Type.Literal("github"),
|
|
1380
|
-
repo: Type.String({ pattern: REPO_PATTERN, minLength: 3 })
|
|
1381
|
-
},
|
|
1382
|
-
{ additionalProperties: false }
|
|
1383
|
-
)
|
|
1384
|
-
)
|
|
1385
|
-
},
|
|
1386
|
-
{ additionalProperties: false }
|
|
1387
|
-
);
|
|
1388
|
-
}
|
|
1446
|
+
|
|
1447
|
+
// src/platform/assetsRoot.ts
|
|
1448
|
+
var assetsRoot_exports = {};
|
|
1449
|
+
__export(assetsRoot_exports, {
|
|
1450
|
+
compiledAssetsDir: () => compiledAssetsDir,
|
|
1451
|
+
computeAssetsRoot: () => computeAssetsRoot,
|
|
1452
|
+
getAssetsRoot: () => getAssetsRoot,
|
|
1453
|
+
isCompiledModuleUrl: () => isCompiledModuleUrl,
|
|
1454
|
+
isCompiledRuntime: () => isCompiledRuntime
|
|
1389
1455
|
});
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
cwd: Type.Optional(Type.String()),
|
|
1399
|
-
env: Type.Optional(Type.Record(Type.String(), Type.String())),
|
|
1400
|
-
args: Type.Optional(Type.Record(Type.String(), Type.Unknown())),
|
|
1401
|
-
git_ref: Type.String({ minLength: 1, pattern: GIT_REF_PATTERN2 }),
|
|
1402
|
-
idempotent_check: Type.String({ minLength: 1 }),
|
|
1403
|
-
// 4.23.0 (issue #3 req 5) — skill names this pack copies into the flat
|
|
1404
|
-
// ~/.claude/skills namespace; enables pre-install collision warnings against
|
|
1405
|
-
// shipped workflow names + post-install undeclared-name drift detection.
|
|
1406
|
-
installs_skills: Type.Optional(Type.Array(Type.String({ minLength: 1 })))
|
|
1407
|
-
},
|
|
1408
|
-
{ additionalProperties: false }
|
|
1409
|
-
);
|
|
1456
|
+
function isCompiledRuntime(url = import.meta.url) {
|
|
1457
|
+
return isCompiledModuleUrl(url);
|
|
1458
|
+
}
|
|
1459
|
+
function isCompiledModuleUrl(url) {
|
|
1460
|
+
let s = url;
|
|
1461
|
+
try {
|
|
1462
|
+
s = decodeURIComponent(url);
|
|
1463
|
+
} catch {
|
|
1410
1464
|
}
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
cmd: Type.String({ minLength: 1 }),
|
|
1419
|
-
cwd: Type.Optional(Type.String()),
|
|
1420
|
-
env: Type.Optional(Type.Record(Type.String(), Type.String())),
|
|
1421
|
-
args: Type.Optional(Type.Record(Type.String(), Type.Unknown())),
|
|
1422
|
-
npm_version: Type.String({ minLength: 1 }),
|
|
1423
|
-
idempotent_check: Type.String({ minLength: 1 })
|
|
1424
|
-
},
|
|
1425
|
-
{ additionalProperties: false }
|
|
1426
|
-
);
|
|
1465
|
+
const normalized2 = s.replace(/\\/g, "/").toLowerCase();
|
|
1466
|
+
return BUNFS_MARKERS.some((m) => normalized2.includes(m));
|
|
1467
|
+
}
|
|
1468
|
+
function computeAssetsRoot(d) {
|
|
1469
|
+
const override = d.env.HARNESSED_ASSETS_OVERRIDE;
|
|
1470
|
+
if (override && override.trim().length > 0) {
|
|
1471
|
+
return { root: override.trim(), source: "override", compiledAssetsMissing: false };
|
|
1427
1472
|
}
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1473
|
+
if (isCompiledModuleUrl(d.moduleUrl)) {
|
|
1474
|
+
const root = join(d.stateRoot(), "assets", d.version);
|
|
1475
|
+
const present = d.exists(join(root, "workflows"));
|
|
1476
|
+
return { root, source: "compiled", compiledAssetsMissing: !present };
|
|
1477
|
+
}
|
|
1478
|
+
return { root: d.packageRoot, source: "package", compiledAssetsMissing: false };
|
|
1479
|
+
}
|
|
1480
|
+
function compiledAssetsDir(version) {
|
|
1481
|
+
return join(detectPlatform().stateRoot, "assets", version);
|
|
1482
|
+
}
|
|
1483
|
+
function realDeps() {
|
|
1484
|
+
return {
|
|
1485
|
+
env: process.env,
|
|
1486
|
+
moduleUrl: import.meta.url,
|
|
1487
|
+
exists: (p8) => {
|
|
1488
|
+
try {
|
|
1489
|
+
return existsSync(p8);
|
|
1490
|
+
} catch {
|
|
1491
|
+
return false;
|
|
1492
|
+
}
|
|
1493
|
+
},
|
|
1494
|
+
stateRoot: () => detectPlatform().stateRoot,
|
|
1495
|
+
packageRoot: getPackageRoot(),
|
|
1496
|
+
version: package_default.version
|
|
1497
|
+
};
|
|
1498
|
+
}
|
|
1499
|
+
function getAssetsRoot() {
|
|
1500
|
+
const r = computeAssetsRoot(realDeps());
|
|
1501
|
+
if (r.source === "compiled" && r.compiledAssetsMissing && !warnedMissing) {
|
|
1502
|
+
warnedMissing = true;
|
|
1503
|
+
console.error(
|
|
1504
|
+
`warning: compiled harnessed binary but bundled assets are not unpacked at ${r.root} \u2014 asset-dependent commands (setup / run / prompt / install) will fail. Reinstall the binary, or use the npm distribution (npm i -g harnessed). (asset unpack pipeline lands in a later release \u2014 B1 seam)`
|
|
1443
1505
|
);
|
|
1444
1506
|
}
|
|
1507
|
+
return r.root;
|
|
1508
|
+
}
|
|
1509
|
+
var BUNFS_MARKERS, warnedMissing;
|
|
1510
|
+
var init_assetsRoot = __esm({
|
|
1511
|
+
"src/platform/assetsRoot.ts"() {
|
|
1512
|
+
init_package();
|
|
1513
|
+
init_packagePath();
|
|
1514
|
+
init_platform();
|
|
1515
|
+
BUNFS_MARKERS = ["/$bunfs/", "/~bun/"];
|
|
1516
|
+
warnedMissing = false;
|
|
1517
|
+
}
|
|
1445
1518
|
});
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
npm_version: Type.String({ minLength: 1 }),
|
|
1457
|
-
idempotent_check: Type.String({ minLength: 1 }),
|
|
1458
|
-
// 4.23.0 (issue #3 req 5) — skill names this pack copies into the flat
|
|
1459
|
-
// ~/.claude/skills namespace; enables pre-install collision warnings against
|
|
1460
|
-
// shipped workflow names + post-install undeclared-name drift detection.
|
|
1461
|
-
installs_skills: Type.Optional(Type.Array(Type.String({ minLength: 1 })))
|
|
1462
|
-
},
|
|
1463
|
-
{ additionalProperties: false }
|
|
1464
|
-
);
|
|
1519
|
+
function resolveLocaleYaml(dir, baseName, locale = getLocale()) {
|
|
1520
|
+
if (locale !== "en") {
|
|
1521
|
+
const sibling = join(dir, `${baseName}.${locale}.yaml`);
|
|
1522
|
+
if (existsSync(sibling)) return sibling;
|
|
1523
|
+
}
|
|
1524
|
+
return join(dir, `${baseName}.yaml`);
|
|
1525
|
+
}
|
|
1526
|
+
var init_localeYaml = __esm({
|
|
1527
|
+
"src/i18n/localeYaml.ts"() {
|
|
1528
|
+
init_i18n();
|
|
1465
1529
|
}
|
|
1466
1530
|
});
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1531
|
+
async function loadRolePrompts(workflowsDir, locale = getLocale()) {
|
|
1532
|
+
const path = resolveLocaleYaml(workflowsDir, "role-prompts", locale);
|
|
1533
|
+
let raw;
|
|
1534
|
+
try {
|
|
1535
|
+
raw = await readFile(path, "utf8");
|
|
1536
|
+
} catch {
|
|
1537
|
+
return {};
|
|
1538
|
+
}
|
|
1539
|
+
const doc = parse(raw);
|
|
1540
|
+
return doc?.prompts ?? {};
|
|
1541
|
+
}
|
|
1542
|
+
function mapRolePromptText(rp, render) {
|
|
1543
|
+
const s = (v) => typeof v === "string" ? render(v) : v;
|
|
1544
|
+
return {
|
|
1545
|
+
...rp,
|
|
1546
|
+
specialist: s(rp.specialist),
|
|
1547
|
+
responsibility: s(rp.responsibility),
|
|
1548
|
+
checklist: Array.isArray(rp.checklist) ? rp.checklist.map((c) => s(c)) : rp.checklist,
|
|
1549
|
+
severity: s(rp.severity)
|
|
1550
|
+
};
|
|
1551
|
+
}
|
|
1552
|
+
function mapRolePromptsText(prompts, render) {
|
|
1553
|
+
const out = {};
|
|
1554
|
+
for (const [name, rp] of Object.entries(prompts)) out[name] = mapRolePromptText(rp, render);
|
|
1555
|
+
return out;
|
|
1556
|
+
}
|
|
1557
|
+
var init_rolePrompts = __esm({
|
|
1558
|
+
"src/workflow/rolePrompts.ts"() {
|
|
1559
|
+
init_i18n();
|
|
1560
|
+
init_localeYaml();
|
|
1561
|
+
}
|
|
1562
|
+
});
|
|
1563
|
+
async function scanWorkflowsNested(workflowsDir, entries) {
|
|
1564
|
+
const workflows = [];
|
|
1565
|
+
for (const entry of entries.sort()) {
|
|
1566
|
+
if (NON_WORKFLOW_DIRS.has(entry)) continue;
|
|
1567
|
+
const src = join(workflowsDir, entry);
|
|
1568
|
+
let s;
|
|
1569
|
+
try {
|
|
1570
|
+
s = await stat(src);
|
|
1571
|
+
} catch {
|
|
1572
|
+
continue;
|
|
1573
|
+
}
|
|
1574
|
+
if (!s.isDirectory()) continue;
|
|
1575
|
+
let hasFlatSkill = false;
|
|
1576
|
+
try {
|
|
1577
|
+
await stat(join(src, "SKILL.md"));
|
|
1578
|
+
hasFlatSkill = true;
|
|
1579
|
+
} catch {
|
|
1580
|
+
hasFlatSkill = false;
|
|
1581
|
+
}
|
|
1582
|
+
if (hasFlatSkill) {
|
|
1583
|
+
if (FLAT_LEGACY_KEEP.has(entry)) {
|
|
1584
|
+
workflows.push({ name: entry, relPath: entry, isMaster: FLAT_TOP_LEVEL_MASTERS.has(entry) });
|
|
1585
|
+
continue;
|
|
1586
|
+
}
|
|
1587
|
+
workflows.push({ name: entry, relPath: entry, isMaster: false });
|
|
1588
|
+
continue;
|
|
1589
|
+
}
|
|
1590
|
+
let subEntries;
|
|
1591
|
+
try {
|
|
1592
|
+
subEntries = await readdir(src);
|
|
1593
|
+
} catch {
|
|
1594
|
+
continue;
|
|
1595
|
+
}
|
|
1596
|
+
for (const sub of subEntries.sort()) {
|
|
1597
|
+
const subDir = join(src, sub);
|
|
1598
|
+
let ss;
|
|
1599
|
+
try {
|
|
1600
|
+
ss = await stat(subDir);
|
|
1601
|
+
} catch {
|
|
1602
|
+
continue;
|
|
1603
|
+
}
|
|
1604
|
+
if (!ss.isDirectory()) continue;
|
|
1605
|
+
try {
|
|
1606
|
+
await stat(join(subDir, "SKILL.md"));
|
|
1607
|
+
} catch {
|
|
1608
|
+
continue;
|
|
1609
|
+
}
|
|
1610
|
+
const name = sub === "auto" ? entry : `${entry}-${sub}`;
|
|
1611
|
+
workflows.push({ name, relPath: `${entry}/${sub}`, isMaster: sub === "auto" });
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
return { workflows };
|
|
1615
|
+
}
|
|
1616
|
+
var FLAT_LEGACY_KEEP, FLAT_TOP_LEVEL_MASTERS, NON_WORKFLOW_DIRS;
|
|
1617
|
+
var init_scan_nested = __esm({
|
|
1618
|
+
"src/workflow/scan-nested.ts"() {
|
|
1619
|
+
FLAT_LEGACY_KEEP = /* @__PURE__ */ new Set(["research", "retro", "auto"]);
|
|
1620
|
+
FLAT_TOP_LEVEL_MASTERS = /* @__PURE__ */ new Set(["auto"]);
|
|
1621
|
+
NON_WORKFLOW_DIRS = /* @__PURE__ */ new Set(["disciplines", "judgments"]);
|
|
1622
|
+
}
|
|
1623
|
+
});
|
|
1624
|
+
function toHostId(id) {
|
|
1625
|
+
return id === "codex" ? "codex" : "claude";
|
|
1626
|
+
}
|
|
1627
|
+
async function loadHostPrimitives(opts) {
|
|
1628
|
+
const path = resolveLocaleYaml(opts.workflowsDir, YAML_BASE, opts.locale ?? getLocale());
|
|
1629
|
+
let raw;
|
|
1630
|
+
try {
|
|
1631
|
+
raw = await readFile(path, "utf8");
|
|
1632
|
+
} catch {
|
|
1633
|
+
return {};
|
|
1634
|
+
}
|
|
1635
|
+
const doc = parse(raw);
|
|
1636
|
+
return doc?.primitives ?? {};
|
|
1637
|
+
}
|
|
1638
|
+
async function loadHostMapNotes(opts) {
|
|
1639
|
+
const path = resolveLocaleYaml(opts.workflowsDir, YAML_BASE, opts.locale ?? getLocale());
|
|
1640
|
+
let raw;
|
|
1641
|
+
try {
|
|
1642
|
+
raw = await readFile(path, "utf8");
|
|
1643
|
+
} catch {
|
|
1644
|
+
return [];
|
|
1645
|
+
}
|
|
1646
|
+
const doc = parse(raw);
|
|
1647
|
+
const notes = doc?.host_map_notes?.[opts.host];
|
|
1648
|
+
return Array.isArray(notes) ? notes.filter((n) => typeof n === "string") : [];
|
|
1649
|
+
}
|
|
1650
|
+
function loadHostPrimitivesCached(opts) {
|
|
1651
|
+
const locale = opts.locale ?? getLocale();
|
|
1652
|
+
const key = `${opts.workflowsDir}|${locale}`;
|
|
1653
|
+
const hit = _tableCache.get(key);
|
|
1654
|
+
if (hit) return hit;
|
|
1655
|
+
const p8 = loadHostPrimitives({ workflowsDir: opts.workflowsDir, locale });
|
|
1656
|
+
_tableCache.set(key, p8);
|
|
1657
|
+
return p8;
|
|
1658
|
+
}
|
|
1659
|
+
function templateRe() {
|
|
1660
|
+
return new RegExp(HOST_PRIMITIVE_TEMPLATE.source, "g");
|
|
1661
|
+
}
|
|
1662
|
+
function lineOf(body, offset) {
|
|
1663
|
+
let line = 1;
|
|
1664
|
+
for (let i = 0; i < offset && i < body.length; i++) if (body[i] === "\n") line++;
|
|
1665
|
+
return line;
|
|
1666
|
+
}
|
|
1667
|
+
function renderHostPrimitives(body, opts) {
|
|
1668
|
+
const { host, table } = opts;
|
|
1669
|
+
return body.replace(
|
|
1670
|
+
templateRe(),
|
|
1671
|
+
(match, primitive, variant, offset) => {
|
|
1672
|
+
const name = variant ?? DEFAULT_VARIANT;
|
|
1673
|
+
const where = `'${match}' at line ${lineOf(body, offset)} (offset ${offset})`;
|
|
1674
|
+
const variants = table[primitive];
|
|
1675
|
+
if (!variants) {
|
|
1676
|
+
throw new Error(
|
|
1677
|
+
`unknown host primitive 'host.${primitive}' \u2014 ${where}; not defined in host-primitives.yaml`
|
|
1678
|
+
);
|
|
1679
|
+
}
|
|
1680
|
+
const entry = variants[name];
|
|
1681
|
+
if (!entry) {
|
|
1682
|
+
throw new Error(
|
|
1683
|
+
`unknown variant '${name}' for host primitive '${primitive}' \u2014 ${where}; defined variants: ${Object.keys(variants).sort().join(", ") || "(none)"}`
|
|
1684
|
+
);
|
|
1685
|
+
}
|
|
1686
|
+
const text = entry[host];
|
|
1687
|
+
if (text === void 0) {
|
|
1688
|
+
throw new Error(
|
|
1689
|
+
`host primitive '${primitive}.${name}' has no text for host '${host}' \u2014 ${where}; defined hosts: ${Object.keys(entry).sort().join(", ") || "(none)"}`
|
|
1690
|
+
);
|
|
1691
|
+
}
|
|
1692
|
+
return text;
|
|
1693
|
+
}
|
|
1694
|
+
);
|
|
1695
|
+
}
|
|
1696
|
+
function cell(text) {
|
|
1697
|
+
return text.replaceAll("|", "\\|");
|
|
1698
|
+
}
|
|
1699
|
+
function code(text) {
|
|
1700
|
+
return text.includes("`") ? text : `\`${text}\``;
|
|
1701
|
+
}
|
|
1702
|
+
function hostMapRows(table) {
|
|
1703
|
+
const rows = [];
|
|
1704
|
+
for (const primitive of Object.keys(table).sort()) {
|
|
1705
|
+
const entry = table[primitive]?.[DEFAULT_VARIANT];
|
|
1706
|
+
const claude = entry?.claude;
|
|
1707
|
+
const codex = entry?.codex;
|
|
1708
|
+
if (claude === void 0 || codex === void 0) continue;
|
|
1709
|
+
if (claude.includes("\n") || codex.includes("\n")) continue;
|
|
1710
|
+
if (claude.length > TERM_MAX_LEN || codex.length > TERM_MAX_LEN) continue;
|
|
1711
|
+
rows.push({ primitive, claude, codex });
|
|
1712
|
+
}
|
|
1713
|
+
return rows;
|
|
1714
|
+
}
|
|
1715
|
+
function buildHostMapSection(opts) {
|
|
1716
|
+
const { host, table } = opts;
|
|
1717
|
+
if (host === "claude") return "";
|
|
1718
|
+
const rows = hostMapRows(table);
|
|
1719
|
+
const notes = opts.notes ?? [];
|
|
1720
|
+
if (rows.length === 0 && notes.length === 0) return "";
|
|
1721
|
+
const skillsDir = table.skills_dir?.[DEFAULT_VARIANT]?.[host];
|
|
1722
|
+
const where = skillsDir ? ` and installed it under ${code(skillsDir)}` : "";
|
|
1723
|
+
const lines = [
|
|
1724
|
+
HOST_MAP_START,
|
|
1725
|
+
`## Host map \u2014 ${host}`,
|
|
1726
|
+
"",
|
|
1727
|
+
`harnessed rendered this artifact for the **${host}** harness${where}. The workflow prose was authored against Claude Code, so where a step names a tool it names the ${host} one. Use the table to decode any instruction that still reads as Claude-Code-shaped; do not substitute the Claude Code names back.`
|
|
1728
|
+
];
|
|
1729
|
+
if (rows.length > 0) {
|
|
1730
|
+
lines.push(
|
|
1731
|
+
"",
|
|
1732
|
+
`| primitive | Claude Code | ${host} |`,
|
|
1733
|
+
"| --- | --- | --- |",
|
|
1734
|
+
...rows.map(
|
|
1735
|
+
(r) => `| \`${r.primitive}\` | ${cell(code(r.claude))} | ${cell(code(r.codex))} |`
|
|
1736
|
+
)
|
|
1737
|
+
);
|
|
1738
|
+
}
|
|
1739
|
+
if (notes.length > 0) {
|
|
1740
|
+
lines.push("", "Caveats \u2014 these hold for the whole artifact:", "");
|
|
1741
|
+
for (const n of notes) lines.push(`- ${n}`);
|
|
1742
|
+
}
|
|
1743
|
+
lines.push(HOST_MAP_END);
|
|
1744
|
+
return lines.join("\n");
|
|
1745
|
+
}
|
|
1746
|
+
function regionRe() {
|
|
1747
|
+
const esc = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1748
|
+
return new RegExp(`${esc(HOST_MAP_START)}[\\s\\S]*?${esc(HOST_MAP_END)}\\n*`, "g");
|
|
1749
|
+
}
|
|
1750
|
+
function insertHostMapSection(body, section) {
|
|
1751
|
+
if (section === "") return body;
|
|
1752
|
+
const stripped = body.replace(regionRe(), "");
|
|
1753
|
+
const fm = FRONTMATTER_RX.exec(stripped);
|
|
1754
|
+
const offset = fm ? fm[0].length : 0;
|
|
1755
|
+
const before = stripped.slice(0, offset);
|
|
1756
|
+
const after = stripped.slice(offset).replace(/^\n+/, "");
|
|
1757
|
+
const lead = offset === 0 ? "" : "\n";
|
|
1758
|
+
return `${before}${lead}${section}
|
|
1759
|
+
|
|
1760
|
+
${after}`;
|
|
1761
|
+
}
|
|
1762
|
+
var DEFAULT_VARIANT, YAML_BASE, _tableCache, HOST_PRIMITIVE_TEMPLATE, HOST_MAP_START, HOST_MAP_END, TERM_MAX_LEN, FRONTMATTER_RX;
|
|
1763
|
+
var init_hostPrimitives = __esm({
|
|
1764
|
+
"src/cli/lib/hostPrimitives.ts"() {
|
|
1765
|
+
init_i18n();
|
|
1766
|
+
init_localeYaml();
|
|
1767
|
+
DEFAULT_VARIANT = "default";
|
|
1768
|
+
YAML_BASE = "host-primitives";
|
|
1769
|
+
_tableCache = /* @__PURE__ */ new Map();
|
|
1770
|
+
HOST_PRIMITIVE_TEMPLATE = /\{\{\s*host\.([A-Za-z0-9_-]+)(?:\.([A-Za-z0-9_-]+))?\s*\}\}/g;
|
|
1771
|
+
HOST_MAP_START = "<!-- harnessed:host-map:start -->";
|
|
1772
|
+
HOST_MAP_END = "<!-- harnessed:host-map:end -->";
|
|
1773
|
+
TERM_MAX_LEN = 64;
|
|
1774
|
+
FRONTMATTER_RX = /^---[ \t]*\r?\n[\s\S]*?\r?\n---[ \t]*(\r?\n|$)/;
|
|
1775
|
+
}
|
|
1776
|
+
});
|
|
1777
|
+
|
|
1778
|
+
// src/cli/lib/agentsMd.ts
|
|
1779
|
+
var agentsMd_exports = {};
|
|
1780
|
+
__export(agentsMd_exports, {
|
|
1781
|
+
AGENTS_MD_END: () => AGENTS_MD_END,
|
|
1782
|
+
AGENTS_MD_START: () => AGENTS_MD_START,
|
|
1783
|
+
agentsMdPath: () => agentsMdPath,
|
|
1784
|
+
buildAgentsMdSection: () => buildAgentsMdSection,
|
|
1785
|
+
insertAgentsMdSection: () => insertAgentsMdSection,
|
|
1786
|
+
resolveCommandNames: () => resolveCommandNames,
|
|
1787
|
+
runAgentsMd: () => runAgentsMd,
|
|
1788
|
+
stripAgentsMdSection: () => stripAgentsMdSection
|
|
1789
|
+
});
|
|
1790
|
+
function agentsMdPath() {
|
|
1791
|
+
return join(detectPlatform().homeDir, "AGENTS.md");
|
|
1792
|
+
}
|
|
1793
|
+
function buildAgentsMdSection(opts) {
|
|
1794
|
+
const { commands, commandsDir, table } = opts;
|
|
1795
|
+
const hostMap = buildHostMapSection({ host: "codex", table, notes: opts.notes });
|
|
1796
|
+
const lines = [
|
|
1797
|
+
AGENTS_MD_START,
|
|
1798
|
+
"",
|
|
1799
|
+
"## harnessed",
|
|
1800
|
+
"",
|
|
1801
|
+
"This block is GENERATED by `harnessed agents-md`. Edits inside the markers are",
|
|
1802
|
+
"overwritten on the next run; put anything hand-written OUTSIDE them.",
|
|
1803
|
+
"",
|
|
1804
|
+
`harnessed installs its slash commands as prompt files under \`${commandsDir}\`.`,
|
|
1805
|
+
"Invoke one by name to enter the orchestration engine:",
|
|
1806
|
+
"",
|
|
1807
|
+
...commands.length > 0 ? commands.map((c) => `- \`/${c}\``) : ["- (none installed \u2014 run `harnessed setup`)"],
|
|
1808
|
+
"",
|
|
1809
|
+
"Each command file carries its own description in frontmatter; read it there rather",
|
|
1810
|
+
"than guessing from the name.",
|
|
1811
|
+
""
|
|
1812
|
+
];
|
|
1813
|
+
if (hostMap !== "") lines.push(hostMap.trimEnd(), "");
|
|
1814
|
+
lines.push(AGENTS_MD_END, "");
|
|
1815
|
+
return lines.join("\n");
|
|
1816
|
+
}
|
|
1817
|
+
function stripAgentsMdSection(body) {
|
|
1818
|
+
const a = body.indexOf(AGENTS_MD_START);
|
|
1819
|
+
if (a === -1) return body;
|
|
1820
|
+
const b = body.indexOf(AGENTS_MD_END, a);
|
|
1821
|
+
if (b === -1) return body;
|
|
1822
|
+
const head = body.slice(0, a);
|
|
1823
|
+
const tail = body.slice(b + AGENTS_MD_END.length);
|
|
1824
|
+
return `${head.replace(/\n+$/, "\n")}${tail.replace(/^\n+/, "")}`;
|
|
1825
|
+
}
|
|
1826
|
+
function insertAgentsMdSection(body, section) {
|
|
1827
|
+
const base = stripAgentsMdSection(body);
|
|
1828
|
+
if (section === "") return base;
|
|
1829
|
+
const sep3 = base === "" || base.endsWith("\n\n") ? "" : base.endsWith("\n") ? "\n" : "\n\n";
|
|
1830
|
+
return `${base}${sep3}${section}`;
|
|
1831
|
+
}
|
|
1832
|
+
async function resolveCommandNames(workflowsDir) {
|
|
1833
|
+
const { readdir: readdir19 } = await import('fs/promises');
|
|
1834
|
+
const entries = await readdir19(workflowsDir);
|
|
1835
|
+
const { workflows } = await scanWorkflowsNested(workflowsDir, entries);
|
|
1836
|
+
const prompts = await loadRolePrompts(workflowsDir);
|
|
1837
|
+
return workflows.map((w) => w.name).filter((n) => prompts[n] !== void 0).sort();
|
|
1838
|
+
}
|
|
1839
|
+
async function runAgentsMd(opts) {
|
|
1840
|
+
const path = agentsMdPath();
|
|
1841
|
+
const read2 = opts.deps?.readFile ?? ((p8) => readFile(p8, "utf8"));
|
|
1842
|
+
const write = opts.deps?.writeFile ?? ((p8, c) => writeFile(p8, c, "utf8"));
|
|
1843
|
+
let current = "";
|
|
1844
|
+
let existed = true;
|
|
1845
|
+
try {
|
|
1846
|
+
current = await read2(path);
|
|
1847
|
+
} catch {
|
|
1848
|
+
existed = false;
|
|
1849
|
+
}
|
|
1850
|
+
if (opts.remove === true) {
|
|
1851
|
+
if (!existed) return { status: "absent", path };
|
|
1852
|
+
const next2 = stripAgentsMdSection(current);
|
|
1853
|
+
if (next2 === current) return { status: "unchanged", path };
|
|
1854
|
+
if (opts.dryRun !== true) await write(path, next2);
|
|
1855
|
+
return { status: "removed", path };
|
|
1856
|
+
}
|
|
1857
|
+
const locale = opts.locale ?? "en";
|
|
1858
|
+
const section = buildAgentsMdSection({
|
|
1859
|
+
commands: await resolveCommandNames(opts.workflowsDir),
|
|
1860
|
+
commandsDir: detectPlatform().commandsDir,
|
|
1861
|
+
table: await loadHostPrimitives({ workflowsDir: opts.workflowsDir, locale }),
|
|
1862
|
+
notes: await loadHostMapNotes({ workflowsDir: opts.workflowsDir, locale, host: "codex" })
|
|
1863
|
+
});
|
|
1864
|
+
const next = insertAgentsMdSection(current, section);
|
|
1865
|
+
if (existed && next === current) return { status: "unchanged", path };
|
|
1866
|
+
const action = !existed ? "create" : current.includes(AGENTS_MD_START) ? "replace" : "append";
|
|
1867
|
+
if (opts.dryRun === true) return { status: "preview", path, action, section };
|
|
1868
|
+
await write(path, next);
|
|
1869
|
+
return { status: "written", path, action };
|
|
1870
|
+
}
|
|
1871
|
+
var AGENTS_MD_START, AGENTS_MD_END;
|
|
1872
|
+
var init_agentsMd = __esm({
|
|
1873
|
+
"src/cli/lib/agentsMd.ts"() {
|
|
1874
|
+
init_platform();
|
|
1875
|
+
init_rolePrompts();
|
|
1876
|
+
init_scan_nested();
|
|
1877
|
+
init_hostPrimitives();
|
|
1878
|
+
AGENTS_MD_START = "<!-- harnessed:agents-md:start -->";
|
|
1879
|
+
AGENTS_MD_END = "<!-- harnessed:agents-md:end -->";
|
|
1880
|
+
}
|
|
1881
|
+
});
|
|
1882
|
+
|
|
1883
|
+
// src/manifest/errors.ts
|
|
1884
|
+
function instancePathToKeyPath(instancePath) {
|
|
1885
|
+
if (!instancePath || instancePath === "/") return [];
|
|
1886
|
+
return instancePath.split("/").filter(Boolean).map((seg) => {
|
|
1887
|
+
const n = Number(seg);
|
|
1888
|
+
return Number.isInteger(n) && String(n) === seg ? n : seg;
|
|
1889
|
+
});
|
|
1890
|
+
}
|
|
1891
|
+
function locateLineFromDoc(doc, lineCounter, instancePath) {
|
|
1892
|
+
const path = instancePathToKeyPath(instancePath);
|
|
1893
|
+
let node;
|
|
1894
|
+
if (path.length === 0) {
|
|
1895
|
+
node = doc.contents;
|
|
1896
|
+
} else {
|
|
1897
|
+
node = doc.getIn(path, true);
|
|
1898
|
+
}
|
|
1899
|
+
if (!node || typeof node !== "object") return { line: null, column: null };
|
|
1900
|
+
const range = node.range;
|
|
1901
|
+
if (!range) return { line: null, column: null };
|
|
1902
|
+
const offset = range[0];
|
|
1903
|
+
const pos = lineCounter.linePos(offset);
|
|
1904
|
+
return { line: pos.line, column: pos.col };
|
|
1905
|
+
}
|
|
1906
|
+
function ajvErrorToFriendly(err2, file, doc, lineCounter) {
|
|
1907
|
+
let path = err2.instancePath || "/";
|
|
1908
|
+
const params = err2.params;
|
|
1909
|
+
if (err2.keyword === "additionalProperties" && params && typeof params.additionalProperty === "string") {
|
|
1910
|
+
path = `${path}/${params.additionalProperty}`;
|
|
1911
|
+
} else if (err2.keyword === "required" && params && typeof params.missingProperty === "string") {
|
|
1912
|
+
path = `${path}/${params.missingProperty}`;
|
|
1913
|
+
}
|
|
1914
|
+
let line = null;
|
|
1915
|
+
let column = null;
|
|
1916
|
+
if (doc && lineCounter) {
|
|
1917
|
+
const lookupPath = err2.keyword === "required" ? err2.instancePath || "/" : path;
|
|
1918
|
+
const loc = locateLineFromDoc(doc, lineCounter, lookupPath);
|
|
1919
|
+
line = loc.line;
|
|
1920
|
+
column = loc.column;
|
|
1921
|
+
}
|
|
1922
|
+
return {
|
|
1923
|
+
file,
|
|
1924
|
+
path,
|
|
1925
|
+
message: err2.message ?? "unknown error",
|
|
1926
|
+
line,
|
|
1927
|
+
column,
|
|
1928
|
+
keyword: err2.keyword
|
|
1929
|
+
};
|
|
1930
|
+
}
|
|
1931
|
+
function yamlParseErrorToFriendly(err2, file) {
|
|
1932
|
+
return {
|
|
1933
|
+
file,
|
|
1934
|
+
path: "/",
|
|
1935
|
+
message: err2.message,
|
|
1936
|
+
line: err2.linePos?.[0]?.line ?? null,
|
|
1937
|
+
column: err2.linePos?.[0]?.col ?? null,
|
|
1938
|
+
keyword: "yaml-parse"
|
|
1939
|
+
};
|
|
1940
|
+
}
|
|
1941
|
+
var init_errors = __esm({
|
|
1942
|
+
"src/manifest/errors.ts"() {
|
|
1943
|
+
}
|
|
1944
|
+
});
|
|
1945
|
+
var ApiVersion, Kind, SpdxLicense, LicenseSource, Upstream, MetadataSchema;
|
|
1946
|
+
var init_metadata = __esm({
|
|
1947
|
+
"src/manifest/schema/metadata.ts"() {
|
|
1948
|
+
ApiVersion = Type.Literal("harnessed/v1");
|
|
1949
|
+
Kind = Type.Literal("Manifest");
|
|
1950
|
+
SpdxLicense = Type.Union([
|
|
1951
|
+
Type.Literal("MIT"),
|
|
1952
|
+
Type.Literal("Apache-2.0"),
|
|
1953
|
+
Type.Literal("BSD-3-Clause"),
|
|
1954
|
+
Type.Literal("ISC"),
|
|
1955
|
+
Type.Literal("0BSD"),
|
|
1956
|
+
Type.Literal("MIT-0"),
|
|
1957
|
+
Type.Literal("anthropics-official")
|
|
1958
|
+
]);
|
|
1959
|
+
LicenseSource = Type.Union([
|
|
1960
|
+
Type.Literal("README"),
|
|
1961
|
+
Type.Literal("registry"),
|
|
1962
|
+
Type.Literal("none"),
|
|
1963
|
+
Type.Literal("anthropics-official")
|
|
1964
|
+
]);
|
|
1965
|
+
Upstream = Type.Object(
|
|
1966
|
+
{
|
|
1967
|
+
source: Type.String({ minLength: 1 }),
|
|
1968
|
+
homepage: Type.String({ format: "uri" }),
|
|
1969
|
+
repository: Type.String({ format: "uri" }),
|
|
1970
|
+
license: SpdxLicense,
|
|
1971
|
+
license_source: Type.Optional(LicenseSource),
|
|
1972
|
+
notice: Type.String({ minLength: 1, maxLength: 500 })
|
|
1973
|
+
},
|
|
1974
|
+
{ additionalProperties: false }
|
|
1975
|
+
);
|
|
1976
|
+
MetadataSchema = Type.Object(
|
|
1977
|
+
{
|
|
1978
|
+
name: Type.String({ pattern: "^[a-z0-9][a-z0-9-]*$", minLength: 1 }),
|
|
1979
|
+
display_name: Type.Optional(Type.String()),
|
|
1980
|
+
description: Type.String({ minLength: 1, maxLength: 120 }),
|
|
1981
|
+
upstream: Upstream
|
|
1982
|
+
},
|
|
1983
|
+
{ additionalProperties: false }
|
|
1984
|
+
);
|
|
1985
|
+
}
|
|
1986
|
+
});
|
|
1987
|
+
var HookEvent, CcHookAdd;
|
|
1988
|
+
var init_ccHookAdd = __esm({
|
|
1989
|
+
"src/manifest/schema/installMethods/ccHookAdd.ts"() {
|
|
1990
|
+
HookEvent = Type.Union([
|
|
1991
|
+
Type.Literal("SessionStart"),
|
|
1992
|
+
Type.Literal("UserPromptSubmit"),
|
|
1993
|
+
Type.Literal("PreToolUse"),
|
|
1994
|
+
Type.Literal("PostToolUse"),
|
|
1995
|
+
// 4.30.0 (issue #6) — Stop hook for mode-B tool-call corruption auto-recovery.
|
|
1996
|
+
Type.Literal("Stop")
|
|
1997
|
+
]);
|
|
1998
|
+
CcHookAdd = Type.Object(
|
|
1999
|
+
{
|
|
2000
|
+
method: Type.Literal("cc-hook-add"),
|
|
2001
|
+
cmd: Type.String({ minLength: 1 }),
|
|
2002
|
+
// audit-trail (the bash invocation registered)
|
|
2003
|
+
// cwd/env required by lib/spawn.ts discriminated-union access (sister 6 method
|
|
2004
|
+
// shape parity — even though cc-hook-add does not spawn, generic spawn helper
|
|
2005
|
+
// expects these fields on the install union).
|
|
2006
|
+
cwd: Type.Optional(Type.String()),
|
|
2007
|
+
env: Type.Optional(Type.Record(Type.String(), Type.String())),
|
|
2008
|
+
hook_event: HookEvent,
|
|
2009
|
+
hook_matcher: Type.Optional(Type.String()),
|
|
2010
|
+
hook_command: Type.String({ minLength: 1 }),
|
|
2011
|
+
idempotent_check: Type.String({ minLength: 1 })
|
|
2012
|
+
},
|
|
2013
|
+
{ additionalProperties: false }
|
|
2014
|
+
);
|
|
2015
|
+
}
|
|
2016
|
+
});
|
|
2017
|
+
var GIT_REF_PATTERN, REPO_PATTERN, CcPluginMarketplace;
|
|
2018
|
+
var init_ccPluginMarketplace = __esm({
|
|
2019
|
+
"src/manifest/schema/installMethods/ccPluginMarketplace.ts"() {
|
|
2020
|
+
GIT_REF_PATTERN = "^([a-f0-9]{7,40}|v?\\d+\\.\\d+\\.\\d+([.-][\\w.-]+)?)$";
|
|
2021
|
+
REPO_PATTERN = "^[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+$";
|
|
2022
|
+
CcPluginMarketplace = Type.Object(
|
|
2023
|
+
{
|
|
2024
|
+
method: Type.Literal("cc-plugin-marketplace"),
|
|
2025
|
+
cmd: Type.String({ minLength: 1 }),
|
|
2026
|
+
cwd: Type.Optional(Type.String()),
|
|
2027
|
+
env: Type.Optional(Type.Record(Type.String(), Type.String())),
|
|
2028
|
+
args: Type.Optional(Type.Record(Type.String(), Type.Unknown())),
|
|
2029
|
+
git_ref: Type.String({ minLength: 1, pattern: GIT_REF_PATTERN }),
|
|
2030
|
+
idempotent_check: Type.String({ minLength: 1 }),
|
|
2031
|
+
// ADR 0005 — third-party marketplace structured metadata (optional).
|
|
2032
|
+
marketplace_source: Type.Optional(
|
|
2033
|
+
Type.Object(
|
|
2034
|
+
{
|
|
2035
|
+
source: Type.Literal("github"),
|
|
2036
|
+
repo: Type.String({ pattern: REPO_PATTERN, minLength: 3 })
|
|
2037
|
+
},
|
|
2038
|
+
{ additionalProperties: false }
|
|
2039
|
+
)
|
|
2040
|
+
)
|
|
2041
|
+
},
|
|
2042
|
+
{ additionalProperties: false }
|
|
2043
|
+
);
|
|
2044
|
+
}
|
|
2045
|
+
});
|
|
2046
|
+
var GIT_REF_PATTERN2, GitCloneWithSetup;
|
|
2047
|
+
var init_gitCloneWithSetup = __esm({
|
|
2048
|
+
"src/manifest/schema/installMethods/gitCloneWithSetup.ts"() {
|
|
2049
|
+
GIT_REF_PATTERN2 = "^([a-f0-9]{7,40}|v?\\d+\\.\\d+\\.\\d+([.-][\\w.-]+)?)$";
|
|
2050
|
+
GitCloneWithSetup = Type.Object(
|
|
2051
|
+
{
|
|
2052
|
+
method: Type.Literal("git-clone-with-setup"),
|
|
2053
|
+
cmd: Type.String({ minLength: 1 }),
|
|
2054
|
+
cwd: Type.Optional(Type.String()),
|
|
2055
|
+
env: Type.Optional(Type.Record(Type.String(), Type.String())),
|
|
2056
|
+
args: Type.Optional(Type.Record(Type.String(), Type.Unknown())),
|
|
2057
|
+
git_ref: Type.String({ minLength: 1, pattern: GIT_REF_PATTERN2 }),
|
|
2058
|
+
idempotent_check: Type.String({ minLength: 1 }),
|
|
2059
|
+
// 4.23.0 (issue #3 req 5) — skill names this pack copies into the flat
|
|
2060
|
+
// ~/.claude/skills namespace; enables pre-install collision warnings against
|
|
2061
|
+
// shipped workflow names + post-install undeclared-name drift detection.
|
|
2062
|
+
installs_skills: Type.Optional(Type.Array(Type.String({ minLength: 1 })))
|
|
2063
|
+
},
|
|
2064
|
+
{ additionalProperties: false }
|
|
2065
|
+
);
|
|
2066
|
+
}
|
|
2067
|
+
});
|
|
2068
|
+
var McpHttpAdd;
|
|
2069
|
+
var init_mcpHttpAdd = __esm({
|
|
2070
|
+
"src/manifest/schema/installMethods/mcpHttpAdd.ts"() {
|
|
2071
|
+
McpHttpAdd = Type.Object(
|
|
2072
|
+
{
|
|
2073
|
+
method: Type.Literal("mcp-http-add"),
|
|
2074
|
+
cmd: Type.String({ minLength: 1 }),
|
|
2075
|
+
cwd: Type.Optional(Type.String()),
|
|
2076
|
+
env: Type.Optional(Type.Record(Type.String(), Type.String())),
|
|
2077
|
+
args: Type.Optional(Type.Record(Type.String(), Type.Unknown())),
|
|
2078
|
+
npm_version: Type.String({ minLength: 1 }),
|
|
2079
|
+
idempotent_check: Type.String({ minLength: 1 })
|
|
2080
|
+
},
|
|
2081
|
+
{ additionalProperties: false }
|
|
2082
|
+
);
|
|
2083
|
+
}
|
|
2084
|
+
});
|
|
2085
|
+
var McpStdioAdd;
|
|
2086
|
+
var init_mcpStdioAdd = __esm({
|
|
2087
|
+
"src/manifest/schema/installMethods/mcpStdioAdd.ts"() {
|
|
2088
|
+
McpStdioAdd = Type.Object(
|
|
2089
|
+
{
|
|
2090
|
+
method: Type.Literal("mcp-stdio-add"),
|
|
2091
|
+
cmd: Type.String({ minLength: 1 }),
|
|
2092
|
+
cwd: Type.Optional(Type.String()),
|
|
2093
|
+
env: Type.Optional(Type.Record(Type.String(), Type.String())),
|
|
2094
|
+
args: Type.Optional(Type.Record(Type.String(), Type.Unknown())),
|
|
2095
|
+
npm_version: Type.String({ minLength: 1 }),
|
|
2096
|
+
idempotent_check: Type.String({ minLength: 1 })
|
|
2097
|
+
},
|
|
2098
|
+
{ additionalProperties: false }
|
|
2099
|
+
);
|
|
2100
|
+
}
|
|
2101
|
+
});
|
|
2102
|
+
var NpmCli;
|
|
2103
|
+
var init_npmCli = __esm({
|
|
2104
|
+
"src/manifest/schema/installMethods/npmCli.ts"() {
|
|
2105
|
+
NpmCli = Type.Object(
|
|
2106
|
+
{
|
|
2107
|
+
method: Type.Literal("npm-cli"),
|
|
2108
|
+
cmd: Type.String({ minLength: 1 }),
|
|
2109
|
+
cwd: Type.Optional(Type.String()),
|
|
2110
|
+
env: Type.Optional(Type.Record(Type.String(), Type.String())),
|
|
2111
|
+
args: Type.Optional(Type.Record(Type.String(), Type.Unknown())),
|
|
2112
|
+
npm_version: Type.String({ minLength: 1 }),
|
|
2113
|
+
idempotent_check: Type.String({ minLength: 1 }),
|
|
2114
|
+
// 4.23.0 (issue #3 req 5) — skill names this pack copies into the flat
|
|
2115
|
+
// ~/.claude/skills namespace; enables pre-install collision warnings against
|
|
2116
|
+
// shipped workflow names + post-install undeclared-name drift detection.
|
|
2117
|
+
installs_skills: Type.Optional(Type.Array(Type.String({ minLength: 1 })))
|
|
2118
|
+
},
|
|
2119
|
+
{ additionalProperties: false }
|
|
2120
|
+
);
|
|
2121
|
+
}
|
|
2122
|
+
});
|
|
2123
|
+
var NpxSkillInstaller;
|
|
2124
|
+
var init_npxSkillInstaller = __esm({
|
|
2125
|
+
"src/manifest/schema/installMethods/npxSkillInstaller.ts"() {
|
|
2126
|
+
NpxSkillInstaller = Type.Object(
|
|
2127
|
+
{
|
|
2128
|
+
method: Type.Literal("npx-skill-installer"),
|
|
1473
2129
|
cmd: Type.String({ minLength: 1 }),
|
|
1474
2130
|
cwd: Type.Optional(Type.String()),
|
|
1475
2131
|
env: Type.Optional(Type.Record(Type.String(), Type.String())),
|
|
@@ -1748,7 +2404,7 @@ var init_schema2 = __esm({
|
|
|
1748
2404
|
};
|
|
1749
2405
|
}
|
|
1750
2406
|
});
|
|
1751
|
-
function
|
|
2407
|
+
function lineOf2(node, lineCounter) {
|
|
1752
2408
|
if (!node?.range) return null;
|
|
1753
2409
|
const offset = node.range[0];
|
|
1754
2410
|
return lineCounter.linePos(offset).line;
|
|
@@ -1770,7 +2426,7 @@ function checkScalarCmd(doc, lineCounter, path, filename) {
|
|
|
1770
2426
|
file: filename,
|
|
1771
2427
|
path: `/${path.join("/")}`,
|
|
1772
2428
|
message: `shell escape detected: '${pat.label}' (${pat.hint}) at ${path.join(".")} \u2014 v0.1 forbids dynamic shell evaluation; v0.2 will use \`requires_secret\` + \`\${secret:KEY}\` for env placeholders`,
|
|
1773
|
-
line:
|
|
2429
|
+
line: lineOf2(node, lineCounter),
|
|
1774
2430
|
column: null,
|
|
1775
2431
|
keyword: "security"
|
|
1776
2432
|
};
|
|
@@ -1810,7 +2466,7 @@ function checkSecurityViolations(doc, filename, lineCounter) {
|
|
|
1810
2466
|
file: filename,
|
|
1811
2467
|
path: `/spec/uninstall/cleanup_paths/${idx}`,
|
|
1812
2468
|
message: `shell escape detected: '${pat.label}' (${pat.hint}) at spec.uninstall.cleanup_paths[${idx}] \u2014 v0.1 forbids dynamic shell evaluation`,
|
|
1813
|
-
line:
|
|
2469
|
+
line: lineOf2(item, lineCounter),
|
|
1814
2470
|
column: null,
|
|
1815
2471
|
keyword: "security"
|
|
1816
2472
|
});
|
|
@@ -1906,283 +2562,75 @@ var init_validate = __esm({
|
|
|
1906
2562
|
init_security();
|
|
1907
2563
|
addFormats = ajvFormatsNs.default;
|
|
1908
2564
|
ajv = addFormats(
|
|
1909
|
-
new Ajv({
|
|
1910
|
-
strict: true,
|
|
1911
|
-
strictSchema: true,
|
|
1912
|
-
strictTypes: true,
|
|
1913
|
-
strictRequired: true,
|
|
1914
|
-
allErrors: true,
|
|
1915
|
-
discriminator: true,
|
|
1916
|
-
allowUnionTypes: false
|
|
1917
|
-
})
|
|
1918
|
-
);
|
|
1919
|
-
_compiled = null;
|
|
1920
|
-
INSTALL_TYPE_METHODS = {
|
|
1921
|
-
npm: ["npm-cli"],
|
|
1922
|
-
mcp: ["mcp-stdio-add", "mcp-http-add"],
|
|
1923
|
-
git: ["git-clone-with-setup"],
|
|
1924
|
-
skill: ["cc-plugin-marketplace", "npx-skill-installer"],
|
|
1925
|
-
// 5th install_type (Phase 2.4). Missing here meant `install_type: hook` accepted
|
|
1926
|
-
// ANY method: an unconstrained bucket, not a closed one (external review L10).
|
|
1927
|
-
hook: ["cc-hook-add"]
|
|
1928
|
-
};
|
|
1929
|
-
}
|
|
1930
|
-
});
|
|
1931
|
-
|
|
1932
|
-
// src/cli/lib/origin-check.ts
|
|
1933
|
-
var origin_check_exports = {};
|
|
1934
|
-
__export(origin_check_exports, {
|
|
1935
|
-
checkOrigin: () => checkOrigin
|
|
1936
|
-
});
|
|
1937
|
-
function normalizeUrl(s) {
|
|
1938
|
-
return s.trim().replace(/^(https?:\/\/|git@github\.com:|ssh:\/\/git@github\.com\/)/, "").replace(/\.git$/, "").replace(":", "/").replace(/\/$/, "").toLowerCase();
|
|
1939
|
-
}
|
|
1940
|
-
function checkOrigin(cwd = process.cwd(), opts = {}) {
|
|
1941
|
-
const allowFork = opts.allowFork ?? true;
|
|
1942
|
-
let expected = null;
|
|
1943
|
-
try {
|
|
1944
|
-
const pkg = JSON.parse(readFileSync(join(cwd, "package.json"), "utf8"));
|
|
1945
|
-
expected = typeof pkg.repository === "string" ? pkg.repository : pkg.repository?.url ?? null;
|
|
1946
|
-
} catch {
|
|
1947
|
-
}
|
|
1948
|
-
if (!expected) {
|
|
1949
|
-
return {
|
|
1950
|
-
status: "warn",
|
|
1951
|
-
detail: "package.json has no repository.url field",
|
|
1952
|
-
fix: "add `repository` field to package.json"
|
|
1953
|
-
};
|
|
1954
|
-
}
|
|
1955
|
-
const r = spawnSync("git", ["config", "--get", "remote.origin.url"], {
|
|
1956
|
-
cwd,
|
|
1957
|
-
encoding: "utf8"
|
|
1958
|
-
});
|
|
1959
|
-
if (r.status !== 0) {
|
|
1960
|
-
return {
|
|
1961
|
-
status: "warn",
|
|
1962
|
-
detail: "no git remote origin (detached / non-clone)",
|
|
1963
|
-
fix: "git remote add origin <expected-url>"
|
|
1964
|
-
};
|
|
1965
|
-
}
|
|
1966
|
-
const actual = r.stdout.trim();
|
|
1967
|
-
if (normalizeUrl(actual) === normalizeUrl(expected)) {
|
|
1968
|
-
return { status: "pass", detail: actual };
|
|
1969
|
-
}
|
|
1970
|
-
return {
|
|
1971
|
-
status: allowFork ? "warn" : "fail",
|
|
1972
|
-
detail: `origin '${actual}' \u2260 expected '${expected}'`,
|
|
1973
|
-
fix: allowFork ? "verify intentional fork; if not, `git remote set-url origin <expected>`" : "origin URL drift \u2014 possible tamper, `git remote set-url origin <expected>` to restore"
|
|
1974
|
-
};
|
|
1975
|
-
}
|
|
1976
|
-
var init_origin_check = __esm({
|
|
1977
|
-
"src/cli/lib/origin-check.ts"() {
|
|
1978
|
-
}
|
|
1979
|
-
});
|
|
1980
|
-
|
|
1981
|
-
// messages/en.json
|
|
1982
|
-
var en_default;
|
|
1983
|
-
var init_en = __esm({
|
|
1984
|
-
"messages/en.json"() {
|
|
1985
|
-
en_default = {
|
|
1986
|
-
"setup.workflows_not_found": "error: workflows directory not found at {{path}}",
|
|
1987
|
-
"setup.nothing_to_install": "setup: no workflow directories with SKILL.md found \u2014 nothing to install",
|
|
1988
|
-
"setup.dry_run.header": "[dry-run] setup would install {{count}} workflow(s) to {{path}}:",
|
|
1989
|
-
"setup.dry_run.run_hint": " run without --dry-run to execute",
|
|
1990
|
-
"setup.copy_failed": " error: failed to copy {{name}}: {{message}}",
|
|
1991
|
-
"setup.step_a_complete": "Step A: {{count}} workflows installed to {{path}}",
|
|
1992
|
-
"setup.step_a_render.complete": " generated {{count}}/{{total}} command files",
|
|
1993
|
-
"setup.step_a_render.warnings_header": " [A.5] warnings \u2014 some capability cmds could not be fully resolved:",
|
|
1994
|
-
"setup.step_c.created": " [C] created {{path}} + enabled Agent Teams",
|
|
1995
|
-
"setup.step_c.already_enabled": " [C] Agent Teams already enabled ({{path}})",
|
|
1996
|
-
"setup.step_c.enabled_backup": " [C] enabled Agent Teams in {{path}} (backup saved \u2192 {{backupPath}})",
|
|
1997
|
-
"setup.step_c.skipped": " [C] Agent Teams enable skipped: {{message}}",
|
|
1998
|
-
"setup.step_d.created": " [D] created {{path}} + wrote env.HARNESSED_USER_LANG={{lang}}",
|
|
1999
|
-
"setup.step_d.already_set": " [D] env.HARNESSED_USER_LANG={{lang}} already set in {{path}} \u2014 respecting user override",
|
|
2000
|
-
"setup.step_d.enabled_backup": " [D] wrote env.HARNESSED_USER_LANG={{lang}} in {{path}} (backup saved \u2192 {{backupPath}})",
|
|
2001
|
-
"setup.step_d.skipped": " [D] User language write skipped: {{message}}",
|
|
2002
|
-
"setup.step_b_complete": "Upstream components: {{installed}} installed / {{already}} already-installed / {{skipped}} skipped / {{failed}} failed [{{seconds}}s]",
|
|
2003
|
-
"setup.complete": "setup complete \u2014 {{skills}} workflows + {{manifests}} base manifests configured",
|
|
2004
|
-
"setup.mcp_hint": "Run /mcp in Claude Code to verify MCP server connections.",
|
|
2005
|
-
"setup.mcp_hint_codex": "Run codex mcp list to verify MCP server connections.",
|
|
2006
|
-
"setup.search_key_hint.header": "\n\u26A0 Search MCP API keys missing \u2014 the server(s) below are installed but will fail at query time until the key is configured:",
|
|
2007
|
-
"setup.search_key_hint.line": ' {{server}}: set {{envVar}} \u2014 add it to the ~/.claude/settings.json "env" block (e.g. {"env": {"{{envVar}}": "<your-key>"}}) or export {{envVar}} in your shell',
|
|
2008
|
-
"setup.optional_offer.ecc_note": " ecc (bonus tier): installing it unlocks finer-grained scenario orchestration (per-language review/build expert routing etc.); the trade-off is ~20k+ tokens/session of static listing overhead \u2014 inherent to ECC's own scale (281 skills / 94 commands / 67 agents), not introduced by harnessed.",
|
|
2009
|
-
"setup.bundled_summary": "\nharnessed workflows bundled at <packageRoot>/workflows/ (share-only, read-only)",
|
|
2010
|
-
"setup.bundled_location": "",
|
|
2011
|
-
"setup.doctor_hint": "\nRun harnessed doctor to verify your environment.",
|
|
2012
|
-
"agent_teams.missing_header": "\n\u26A0\uFE0F Agent Teams not enabled \u2014 parallelism upgrade path unavailable",
|
|
2013
|
-
"agent_teams.missing_fix": " fix: claude config set env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS 1",
|
|
2014
|
-
"agent_teams.missing_explanation": " harnessed task parallelism uses Subagent or Agent Teams (CC 2.1.178+)",
|
|
2015
|
-
"agent_teams.missing_nonblocking": " non-blocking \u2014 auto-degrades to subagent fan-out\n",
|
|
2016
|
-
"install.manifest_not_found": "error: manifest '{{name}}' not found",
|
|
2017
|
-
"install.manifest_not_found.fix": " fix: ensure manifests/tools/{{name}}.yaml, manifests/skill-packs/{{name}}.yaml, or manifests/optional/{{name}}.yaml exists",
|
|
2018
|
-
"install.audit_hint": " fix: run 'harnessed audit' to inspect manifest issues",
|
|
2019
|
-
"install.success": "installed {{name}}",
|
|
2020
|
-
"install.success_with_version": "installed {{name}}@{{version}}",
|
|
2021
|
-
"install.already_installed": "already-installed {{name}} (idempotent check hit; nothing to do)",
|
|
2022
|
-
"install.already_installed_with_version": "already-installed {{name}}@{{version}} (idempotent check hit; nothing to do)",
|
|
2023
|
-
"install.aborted": "aborted: {{reason}}",
|
|
2024
|
-
"uninstall.dry_run.preview": "[dry-run] would uninstall '{{name}}' via method '{{method}}'",
|
|
2025
|
-
"uninstall.dry_run.run_hint": " run without --dry-run to execute",
|
|
2026
|
-
"uninstall.confirm.prompt": "Uninstall '{{name}}'? This cannot be undone.",
|
|
2027
|
-
"uninstall.cancelled": "aborted: user cancelled",
|
|
2028
|
-
"uninstall.completed": "uninstalled {{name}}",
|
|
2029
|
-
"uninstall.unified.nothing": "nothing to do \u2014 no harnessed artifacts found",
|
|
2030
|
-
"uninstall.unified.header": "harnessed uninstall will remove the following:",
|
|
2031
|
-
"uninstall.unified.commands": " Commands: {{count}} harnessed-generated slash command file(s) in ~/.claude/commands/",
|
|
2032
|
-
"uninstall.unified.agent_roles": " Agent roles: {{count}} harnessed-generated codex agent role file(s) in ~/.codex/agents/",
|
|
2033
|
-
"uninstall.unified.skills": " Skills: {{count}} workflow skill directory(ies) in ~/.claude/skills/",
|
|
2034
|
-
"uninstall.unified.settings": " Settings: harnessed env vars (CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS, HARNESSED_USER_LANG) from ~/.claude/settings.json",
|
|
2035
|
-
"uninstall.unified.hooks": " Hooks: {{count}} harnessed Stop/UserPromptSubmit hook(s) in ~/.claude/settings.json",
|
|
2036
|
-
"uninstall.unified.state_dir": " State directory: ~/.claude/harnessed/ (includes backups, audit log, state, lock)",
|
|
2037
|
-
"uninstall.unified.upstream_note": "\nUpstream components (npm packages, MCP servers, CC plugins, git-cloned repos, npx skills) are NOT affected.",
|
|
2038
|
-
"uninstall.unified.dry_run_hint": "\n(dry-run \u2014 re-run without --dry-run to actually remove)",
|
|
2039
|
-
"uninstall.unified.confirm": "Remove harnessed's own files? Upstream components (npm packages, MCP servers, CC plugins, etc.) will NOT be affected. This cannot be undone.",
|
|
2040
|
-
"uninstall.unified.removing": "removing harnessed files...",
|
|
2041
|
-
"uninstall.unified.removed_commands": " removed {{count}} command file(s)",
|
|
2042
|
-
"uninstall.unified.removed_agent_roles": " removed {{count}} codex agent role file(s)",
|
|
2043
|
-
"uninstall.unified.removed_skills": " removed {{count}} skill directory(ies)",
|
|
2044
|
-
"uninstall.unified.removed_settings": " removed harnessed env vars from ~/.claude/settings.json",
|
|
2045
|
-
"uninstall.unified.removed_hooks": " removed {{count}} harnessed hook(s) from ~/.claude/settings.json",
|
|
2046
|
-
"uninstall.unified.removed_state_dir": " removed ~/.claude/harnessed/",
|
|
2047
|
-
"uninstall.unified.partial_failure": "\n{{count}} item(s) could not be removed (permission denied or already gone):",
|
|
2048
|
-
"uninstall.unified.complete": "uninstall complete \u2014 harnessed's own files have been removed",
|
|
2049
|
-
"uninstall.unified.cli_hint_header": "\nto remove the harnessed CLI itself (the step above did not \u2014 it only cleared setup files):",
|
|
2050
|
-
"uninstall.unified.cli_hint_binary": " binary: delete {{path}}\n then remove {{dir}} from your PATH",
|
|
2051
|
-
"uninstall.unified.cli_hint_npm": " npm: npm uninstall -g harnessed",
|
|
2052
|
-
"uninstall.unified.cli_hint_other": " installed both ways? remove the other too \u2014 npm: 'npm uninstall -g harnessed' / binary: delete the exe + its bin dir from PATH",
|
|
2053
|
-
"gc.invalid_duration": "error: invalid --older-than '{{value}}'",
|
|
2054
|
-
"gc.invalid_duration.fix": " fix: use format <N>{d|h|m|w} e.g. 30d / 24h / 60m / 4w",
|
|
2055
|
-
"gc.no_backups": "no backups found ({{root}} absent) \u2014 nothing to gc",
|
|
2056
|
-
"gc.no_old_snapshots": "no snapshots older than {{cutoff}} (kept {{keptCount}} most-recent)",
|
|
2057
|
-
"gc.summary_will_delete": "would delete {{count}} snapshot(s), ~{{sizeKb}} KB total:",
|
|
2058
|
-
"gc.summary_deleting": "deleting {{count}} snapshot(s), ~{{sizeKb}} KB total:",
|
|
2059
|
-
"gc.dry_run_rerun_hint": "\n(dry-run \u2014 re-run without --dry-run to actually delete)",
|
|
2060
|
-
"doctor.summary.fail": "\nsome checks failed (see fix hints above)",
|
|
2061
|
-
"doctor.summary.warn": "\nall checks ok (with warnings \u2014 see hints above)",
|
|
2062
|
-
"doctor.summary.pass": "\nall checks passed",
|
|
2063
|
-
"doctor.host_scope": "host: {{host}} \u2014 {{applied}} of {{total}} checks apply\n",
|
|
2064
|
-
"doctor.matrix.legend": "\nn/a = the check is not declared for that host in the registry, so it was not run",
|
|
2065
|
-
"check_docs.clean": "documentation discipline: no violations",
|
|
2066
|
-
"check_docs.state_line_limit": "STATE.md is {{lines}} lines > the {{limit}}-line digest limit \u2014 archive older phase narrative to RETROSPECTIVE.md (override for one run: HARNESSED_ALLOW_LONG_STATE=1)",
|
|
2067
|
-
"check_docs.state_key_decisions": "{{count}} '\u5173\u952E\u51B3\u8BAE ship \u603B\u7ED3' section(s) > {{limit}} \u2014 keep only the current one; move the rest to RETROSPECTIVE.md",
|
|
2068
|
-
"check_docs.state_errata": "historical commentary '{{excerpt}}' belongs in RETROSPECTIVE.md, not in the STATE digest",
|
|
2069
|
-
"check_docs.roadmap_narrative": "closing narrative inlined in an overview doc ({{signals}}) \u2014 ROADMAP carries one line + a pointer per phase; narrative goes to SUMMARY / VERIFICATION",
|
|
2070
|
-
"check_docs.summary_halt": "\ndocumentation discipline: {{halt}} blocking + {{warn}} advisory violation(s)",
|
|
2071
|
-
"check_docs.summary_warn": "\ndocumentation discipline: {{warn}} advisory violation(s) (non-blocking)",
|
|
2072
|
-
"backup.no_backups": "no backups found ({{root}} absent)",
|
|
2073
|
-
"backup.no_backups_empty": "no backups found ({{root}} empty)",
|
|
2074
|
-
"backup.total_snapshots": "\n{{count}} snapshot(s) total",
|
|
2075
|
-
"rollback.metadata_unreadable": "error: cannot read {{path}}: {{message}}",
|
|
2076
|
-
"rollback.metadata_unreadable.fix": " fix: run 'harnessed backup list' to see available timestamps",
|
|
2077
|
-
"rollback.checksum_mismatch": "error: backup checksum mismatch for {{target}} (expected {{expected}}, got {{actual}})",
|
|
2078
|
-
"rollback.restored": "restored {{count}} file(s) from {{timestamp}}",
|
|
2079
|
-
"status.no_installs": "no installs recorded ({{path}} absent or empty)",
|
|
2080
|
-
"status.summary_installs": "\n{{count}} install(s) recorded",
|
|
2081
|
-
"status.lock_held": "\nlock: held (since {{since}}){{staleSuffix}}",
|
|
2082
|
-
"status.lock_held.stale_suffix": " \u2014 STALE",
|
|
2083
|
-
"status.lock_release_hint": " to release: wait for process to finish or delete {{path}}",
|
|
2084
|
-
"status.lock_free": "\nlock: free",
|
|
2085
|
-
"here.no_workflow": "no active workflow for this repo ({{path}} has no entry for cwd)",
|
|
2086
|
-
"here.no_workflow.hint": " to start: run a stage (e.g. `harnessed gates discuss`) or `harnessed run <workflow>`",
|
|
2087
|
-
"audit_log.no_records_file": "no audit records found ({{path}} does not exist)",
|
|
2088
|
-
"audit_log.no_records_empty": "no audit records found (audit.log is empty)",
|
|
2089
|
-
"audit_log.jq_missing": "\u2717 jq not found in PATH \u2014 run: harnessed doctor",
|
|
2090
|
-
"audit_log.tail_invalid": "\u2717 --tail must be a positive integer",
|
|
2091
|
-
"audit_log.head_invalid": "\u2717 --head must be a positive integer",
|
|
2092
|
-
"execute_task.require_task": "error: --task <text> is required",
|
|
2093
|
-
"execute_task.load_phases_failed": "error: failed to load workflows/{{workflow}}/phases.yaml \u2014 {{message}}",
|
|
2094
|
-
"execute_task.precommit_skipped": "\u26A0\uFE0F before-commit pre-flight skipped ({{message}}); subagent will biome-check at commit time.",
|
|
2095
|
-
"research.require_query": "error: --query <text> is required",
|
|
2096
|
-
"manifest_add.non_interactive_warn": "[ee-5-gate] WARN: --non-interactive skips 5-question prompt (D-03 dry-run-only). plan-phase hard reject still applies.",
|
|
2097
|
-
"manifest_add.dry_run_preview": "[manifest-add] dry-run preview for upstream: {{upstream}} \u2192 {{path}}",
|
|
2098
|
-
"manifest_add.empty_answer": "error: EE-5 gate requires non-empty answer",
|
|
2099
|
-
"manifest_add.gate_passed_wrote": "[manifest-add] EE-5 gate passed; wrote {{path}}",
|
|
2100
|
-
"manifest_add.gate_passed_dry_run": "[manifest-add] EE-5 gate passed (dry-run); would write {{path}}",
|
|
2101
|
-
"resume.fail": "\u2717 {{error}}",
|
|
2102
|
-
"resume.corrupt": "\u2717 {{error}}\n path: {{path}}"
|
|
2565
|
+
new Ajv({
|
|
2566
|
+
strict: true,
|
|
2567
|
+
strictSchema: true,
|
|
2568
|
+
strictTypes: true,
|
|
2569
|
+
strictRequired: true,
|
|
2570
|
+
allErrors: true,
|
|
2571
|
+
discriminator: true,
|
|
2572
|
+
allowUnionTypes: false
|
|
2573
|
+
})
|
|
2574
|
+
);
|
|
2575
|
+
_compiled = null;
|
|
2576
|
+
INSTALL_TYPE_METHODS = {
|
|
2577
|
+
npm: ["npm-cli"],
|
|
2578
|
+
mcp: ["mcp-stdio-add", "mcp-http-add"],
|
|
2579
|
+
git: ["git-clone-with-setup"],
|
|
2580
|
+
skill: ["cc-plugin-marketplace", "npx-skill-installer"],
|
|
2581
|
+
// 5th install_type (Phase 2.4). Missing here meant `install_type: hook` accepted
|
|
2582
|
+
// ANY method: an unconstrained bucket, not a closed one (external review L10).
|
|
2583
|
+
hook: ["cc-hook-add"]
|
|
2103
2584
|
};
|
|
2104
2585
|
}
|
|
2105
2586
|
});
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
return
|
|
2587
|
+
|
|
2588
|
+
// src/cli/lib/origin-check.ts
|
|
2589
|
+
var origin_check_exports = {};
|
|
2590
|
+
__export(origin_check_exports, {
|
|
2591
|
+
checkOrigin: () => checkOrigin
|
|
2592
|
+
});
|
|
2593
|
+
function normalizeUrl(s) {
|
|
2594
|
+
return s.trim().replace(/^(https?:\/\/|git@github\.com:|ssh:\/\/git@github\.com\/)/, "").replace(/\.git$/, "").replace(":", "/").replace(/\/$/, "").toLowerCase();
|
|
2114
2595
|
}
|
|
2115
|
-
function
|
|
2596
|
+
function checkOrigin(cwd = process.cwd(), opts = {}) {
|
|
2597
|
+
const allowFork = opts.allowFork ?? true;
|
|
2598
|
+
let expected = null;
|
|
2116
2599
|
try {
|
|
2117
|
-
|
|
2600
|
+
const pkg = JSON.parse(readFileSync(join(cwd, "package.json"), "utf8"));
|
|
2601
|
+
expected = typeof pkg.repository === "string" ? pkg.repository : pkg.repository?.url ?? null;
|
|
2118
2602
|
} catch {
|
|
2119
|
-
return void 0;
|
|
2120
|
-
}
|
|
2121
|
-
}
|
|
2122
|
-
function wireMessagesDir(provider) {
|
|
2123
|
-
wiredMessagesDirProvider = provider;
|
|
2124
|
-
}
|
|
2125
|
-
function messagesDir() {
|
|
2126
|
-
const here = dirname(fileURLToPath(import.meta.url));
|
|
2127
|
-
const candidates = [];
|
|
2128
|
-
if (wiredMessagesDirProvider) {
|
|
2129
|
-
try {
|
|
2130
|
-
candidates.push(wiredMessagesDirProvider());
|
|
2131
|
-
} catch {
|
|
2132
|
-
}
|
|
2133
2603
|
}
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
}
|
|
2140
|
-
}
|
|
2604
|
+
if (!expected) {
|
|
2605
|
+
return {
|
|
2606
|
+
status: "warn",
|
|
2607
|
+
detail: "package.json has no repository.url field",
|
|
2608
|
+
fix: "add `repository` field to package.json"
|
|
2609
|
+
};
|
|
2141
2610
|
}
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2611
|
+
const r = spawnSync("git", ["config", "--get", "remote.origin.url"], {
|
|
2612
|
+
cwd,
|
|
2613
|
+
encoding: "utf8"
|
|
2614
|
+
});
|
|
2615
|
+
if (r.status !== 0) {
|
|
2616
|
+
return {
|
|
2617
|
+
status: "warn",
|
|
2618
|
+
detail: "no git remote origin (detached / non-clone)",
|
|
2619
|
+
fix: "git remote add origin <expected-url>"
|
|
2620
|
+
};
|
|
2152
2621
|
}
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
if (!locale) return;
|
|
2157
|
-
const mapped = mapToSupported(locale);
|
|
2158
|
-
if (SUPPORTED.has(mapped)) currentLocale = mapped;
|
|
2159
|
-
}
|
|
2160
|
-
function getLocale() {
|
|
2161
|
-
if (currentLocale === null) currentLocale = detectLocale();
|
|
2162
|
-
return currentLocale;
|
|
2163
|
-
}
|
|
2164
|
-
function t(key, params) {
|
|
2165
|
-
const locale = getLocale();
|
|
2166
|
-
const primary = loadLocale(locale);
|
|
2167
|
-
let template = primary[key];
|
|
2168
|
-
if (template === void 0 && locale !== "en") {
|
|
2169
|
-
template = loadLocale("en")[key];
|
|
2622
|
+
const actual = r.stdout.trim();
|
|
2623
|
+
if (normalizeUrl(actual) === normalizeUrl(expected)) {
|
|
2624
|
+
return { status: "pass", detail: actual };
|
|
2170
2625
|
}
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
});
|
|
2626
|
+
return {
|
|
2627
|
+
status: allowFork ? "warn" : "fail",
|
|
2628
|
+
detail: `origin '${actual}' \u2260 expected '${expected}'`,
|
|
2629
|
+
fix: allowFork ? "verify intentional fork; if not, `git remote set-url origin <expected>`" : "origin URL drift \u2014 possible tamper, `git remote set-url origin <expected>` to restore"
|
|
2630
|
+
};
|
|
2177
2631
|
}
|
|
2178
|
-
var
|
|
2179
|
-
|
|
2180
|
-
"src/i18n/index.ts"() {
|
|
2181
|
-
init_en();
|
|
2182
|
-
SUPPORTED = /* @__PURE__ */ new Set(["en", "zh-Hans"]);
|
|
2183
|
-
currentLocale = null;
|
|
2184
|
-
cache = {};
|
|
2185
|
-
wiredMessagesDirProvider = null;
|
|
2632
|
+
var init_origin_check = __esm({
|
|
2633
|
+
"src/cli/lib/origin-check.ts"() {
|
|
2186
2634
|
}
|
|
2187
2635
|
});
|
|
2188
2636
|
function getBackupRoot() {
|
|
@@ -2558,7 +3006,7 @@ function resolveWindowsBin(bin, env = process.env, isFile = (p8) => existsSync(p
|
|
|
2558
3006
|
const candidates = extname(bin) ? [""] : exts;
|
|
2559
3007
|
for (const dir of dirs) {
|
|
2560
3008
|
for (const ext of candidates) {
|
|
2561
|
-
const p8 =
|
|
3009
|
+
const p8 = join18(dir, `${bin}${ext}`);
|
|
2562
3010
|
if (isFile(p8)) return p8;
|
|
2563
3011
|
}
|
|
2564
3012
|
}
|
|
@@ -2573,10 +3021,10 @@ function planWindowsSpawn(bin, args, resolved) {
|
|
|
2573
3021
|
const line = [escapeCommand(resolved), ...args.map((a) => escapeArgument(a))].join(" ");
|
|
2574
3022
|
return { command: "cmd.exe", args: ["/d", "/s", "/c", `"${line}"`], verbatim: true };
|
|
2575
3023
|
}
|
|
2576
|
-
var extname,
|
|
3024
|
+
var extname, join18, META;
|
|
2577
3025
|
var init_winSpawn = __esm({
|
|
2578
3026
|
"src/installers/lib/winSpawn.ts"() {
|
|
2579
|
-
({ extname, join:
|
|
3027
|
+
({ extname, join: join18 } = win32);
|
|
2580
3028
|
META = /([()\][%!^"`<>&|;, *?])/g;
|
|
2581
3029
|
}
|
|
2582
3030
|
});
|
|
@@ -2654,6 +3102,46 @@ var init_safeCwd = __esm({
|
|
|
2654
3102
|
}
|
|
2655
3103
|
});
|
|
2656
3104
|
|
|
3105
|
+
// src/installers/lib/codexMcpServers.ts
|
|
3106
|
+
function parseCodexMcpList(stdout2) {
|
|
3107
|
+
const text = stdout2.trim();
|
|
3108
|
+
if (!text.startsWith("[")) return null;
|
|
3109
|
+
try {
|
|
3110
|
+
const parsed = JSON.parse(text);
|
|
3111
|
+
if (!Array.isArray(parsed)) return null;
|
|
3112
|
+
const names = /* @__PURE__ */ new Set();
|
|
3113
|
+
for (const entry of parsed) {
|
|
3114
|
+
if (typeof entry?.name === "string" && entry.name !== "") names.add(entry.name);
|
|
3115
|
+
}
|
|
3116
|
+
return names;
|
|
3117
|
+
} catch {
|
|
3118
|
+
return null;
|
|
3119
|
+
}
|
|
3120
|
+
}
|
|
3121
|
+
function invalidateCodexMcpCache() {
|
|
3122
|
+
cache2 = null;
|
|
3123
|
+
}
|
|
3124
|
+
async function listOnce() {
|
|
3125
|
+
const r = await runHarnessArgs("codex", ["mcp", "list", "--json"], getMcpSpawnCwd(), 3e4);
|
|
3126
|
+
return r.exitCode === 0 ? parseCodexMcpList(r.stdout) : null;
|
|
3127
|
+
}
|
|
3128
|
+
function listCodexMcpServers() {
|
|
3129
|
+
cache2 = cache2 ?? listOnce();
|
|
3130
|
+
return cache2;
|
|
3131
|
+
}
|
|
3132
|
+
async function isCodexMcpServerRegistered(name) {
|
|
3133
|
+
const names = await listCodexMcpServers();
|
|
3134
|
+
return names ? names.has(name) : false;
|
|
3135
|
+
}
|
|
3136
|
+
var cache2;
|
|
3137
|
+
var init_codexMcpServers = __esm({
|
|
3138
|
+
"src/installers/lib/codexMcpServers.ts"() {
|
|
3139
|
+
init_runClaudeArgs();
|
|
3140
|
+
init_safeCwd();
|
|
3141
|
+
cache2 = null;
|
|
3142
|
+
}
|
|
3143
|
+
});
|
|
3144
|
+
|
|
2657
3145
|
// src/installers/lib/codexPlugins.ts
|
|
2658
3146
|
function parseCodexPluginList(stdout2) {
|
|
2659
3147
|
const text = stdout2.trim();
|
|
@@ -2676,9 +3164,9 @@ function parseCodexPluginList(stdout2) {
|
|
|
2676
3164
|
return ids;
|
|
2677
3165
|
}
|
|
2678
3166
|
function invalidateCodexPluginCache() {
|
|
2679
|
-
|
|
3167
|
+
cache3 = null;
|
|
2680
3168
|
}
|
|
2681
|
-
async function
|
|
3169
|
+
async function listOnce2() {
|
|
2682
3170
|
const cwd = getMcpSpawnCwd();
|
|
2683
3171
|
const json2 = await runHarnessArgs("codex", ["plugin", "list", "--json"], cwd, 3e4);
|
|
2684
3172
|
const fromJson = json2.exitCode === 0 ? parseCodexPluginList(json2.stdout) : null;
|
|
@@ -2688,8 +3176,8 @@ async function listOnce() {
|
|
|
2688
3176
|
return table.exitCode === 0 ? parseCodexPluginList(table.stdout) : null;
|
|
2689
3177
|
}
|
|
2690
3178
|
function listInstalledCodexPlugins() {
|
|
2691
|
-
|
|
2692
|
-
return
|
|
3179
|
+
cache3 = cache3 ?? listOnce2();
|
|
3180
|
+
return cache3;
|
|
2693
3181
|
}
|
|
2694
3182
|
async function isCodexPluginInstalled(name) {
|
|
2695
3183
|
const ids = await listInstalledCodexPlugins();
|
|
@@ -2703,12 +3191,12 @@ function withCodexPluginLock(fn) {
|
|
|
2703
3191
|
lock = run.catch(() => void 0);
|
|
2704
3192
|
return run;
|
|
2705
3193
|
}
|
|
2706
|
-
var
|
|
3194
|
+
var cache3, lock;
|
|
2707
3195
|
var init_codexPlugins = __esm({
|
|
2708
3196
|
"src/installers/lib/codexPlugins.ts"() {
|
|
2709
3197
|
init_runClaudeArgs();
|
|
2710
3198
|
init_safeCwd();
|
|
2711
|
-
|
|
3199
|
+
cache3 = null;
|
|
2712
3200
|
lock = Promise.resolve();
|
|
2713
3201
|
}
|
|
2714
3202
|
});
|
|
@@ -2716,6 +3204,7 @@ function getUserClaudeJsonPath() {
|
|
|
2716
3204
|
return getMcpConfigPath();
|
|
2717
3205
|
}
|
|
2718
3206
|
async function readUserClaudeJson() {
|
|
3207
|
+
if (detectPlatform().id === "codex") return {};
|
|
2719
3208
|
const path = getUserClaudeJsonPath();
|
|
2720
3209
|
let raw;
|
|
2721
3210
|
try {
|
|
@@ -2732,23 +3221,9 @@ async function readUserClaudeJson() {
|
|
|
2732
3221
|
return {};
|
|
2733
3222
|
}
|
|
2734
3223
|
}
|
|
2735
|
-
function isMcpServerInToml(raw, name) {
|
|
2736
|
-
const esc = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2737
|
-
const re = new RegExp(`^\\s*\\[mcp_servers\\.(?:${esc}|"${esc}"|'${esc}')(?:\\]|\\.)`, "m");
|
|
2738
|
-
return re.test(raw);
|
|
2739
|
-
}
|
|
2740
3224
|
async function isMcpServerRegistered(name) {
|
|
2741
3225
|
const platform = detectPlatform();
|
|
2742
|
-
if (platform.id === "codex")
|
|
2743
|
-
let raw;
|
|
2744
|
-
try {
|
|
2745
|
-
raw = await readFile(platform.mcpConfigPath, "utf8");
|
|
2746
|
-
} catch (err2) {
|
|
2747
|
-
if (err2.code === "ENOENT") return false;
|
|
2748
|
-
throw err2;
|
|
2749
|
-
}
|
|
2750
|
-
return isMcpServerInToml(raw, name);
|
|
2751
|
-
}
|
|
3226
|
+
if (platform.id === "codex") return isCodexMcpServerRegistered(name);
|
|
2752
3227
|
const config = await readUserClaudeJson();
|
|
2753
3228
|
const servers = config.mcpServers;
|
|
2754
3229
|
if (!servers || typeof servers !== "object") return false;
|
|
@@ -2788,6 +3263,7 @@ async function isPluginRegistered(pluginName) {
|
|
|
2788
3263
|
var init_readClaudeConfig = __esm({
|
|
2789
3264
|
"src/installers/lib/readClaudeConfig.ts"() {
|
|
2790
3265
|
init_platform();
|
|
3266
|
+
init_codexMcpServers();
|
|
2791
3267
|
init_codexPlugins();
|
|
2792
3268
|
}
|
|
2793
3269
|
});
|
|
@@ -3217,116 +3693,31 @@ async function resolveDeclaredArtifact(cwd, rel) {
|
|
|
3217
3693
|
if (st?.isFile() && (!best || st.mtimeMs > best.mtime)) {
|
|
3218
3694
|
best = { abs: cand, mtime: st.mtimeMs };
|
|
3219
3695
|
}
|
|
3220
|
-
}
|
|
3221
|
-
if (best) return best.abs;
|
|
3222
|
-
}
|
|
3223
|
-
return null;
|
|
3224
|
-
}
|
|
3225
|
-
async function checkPlanningSync(cwd, _workflowState) {
|
|
3226
|
-
const planningDir = resolve(cwd, ".planning");
|
|
3227
|
-
const hasPlanningDir = await stat(planningDir).then((s) => s.isDirectory()).catch(() => false);
|
|
3228
|
-
if (!hasPlanningDir) return { status: "none_declared", missing: [] };
|
|
3229
|
-
const stateFile = resolve(cwd, ".planning", "STATE.md");
|
|
3230
|
-
const hasStateFile = await stat(stateFile).then((s) => s.isFile()).catch(() => false);
|
|
3231
|
-
if (!hasStateFile) return { status: "missing", missing: [".planning/STATE.md"] };
|
|
3232
|
-
return { status: "verified", missing: [] };
|
|
3233
|
-
}
|
|
3234
|
-
async function detectDrift(evidence) {
|
|
3235
|
-
const drift = [];
|
|
3236
|
-
for (const ref of evidence) {
|
|
3237
|
-
const now = await hashFile(ref.path).catch(() => "");
|
|
3238
|
-
if (now !== ref.sha256) drift.push({ path: ref.path, was: ref.sha256, now });
|
|
3239
|
-
}
|
|
3240
|
-
return drift;
|
|
3241
|
-
}
|
|
3242
|
-
var init_evidence = __esm({
|
|
3243
|
-
"src/checkpoint/evidence.ts"() {
|
|
3244
|
-
init_resolveYaml();
|
|
3245
|
-
}
|
|
3246
|
-
});
|
|
3247
|
-
function getPackageRoot() {
|
|
3248
|
-
const thisFile = fileURLToPath(import.meta.url);
|
|
3249
|
-
const thisDir = dirname(thisFile);
|
|
3250
|
-
if (thisDir.endsWith("dist") || thisDir.replace(/\\/g, "/").endsWith("/dist")) {
|
|
3251
|
-
return resolve(thisDir, "..");
|
|
3252
|
-
}
|
|
3253
|
-
return resolve(thisDir, "..", "..");
|
|
3254
|
-
}
|
|
3255
|
-
var init_packagePath = __esm({
|
|
3256
|
-
"src/platform/packagePath.ts"() {
|
|
3257
|
-
}
|
|
3258
|
-
});
|
|
3259
|
-
|
|
3260
|
-
// src/platform/assetsRoot.ts
|
|
3261
|
-
var assetsRoot_exports = {};
|
|
3262
|
-
__export(assetsRoot_exports, {
|
|
3263
|
-
compiledAssetsDir: () => compiledAssetsDir,
|
|
3264
|
-
computeAssetsRoot: () => computeAssetsRoot,
|
|
3265
|
-
getAssetsRoot: () => getAssetsRoot,
|
|
3266
|
-
isCompiledModuleUrl: () => isCompiledModuleUrl,
|
|
3267
|
-
isCompiledRuntime: () => isCompiledRuntime
|
|
3268
|
-
});
|
|
3269
|
-
function isCompiledRuntime(url = import.meta.url) {
|
|
3270
|
-
return isCompiledModuleUrl(url);
|
|
3271
|
-
}
|
|
3272
|
-
function isCompiledModuleUrl(url) {
|
|
3273
|
-
let s = url;
|
|
3274
|
-
try {
|
|
3275
|
-
s = decodeURIComponent(url);
|
|
3276
|
-
} catch {
|
|
3277
|
-
}
|
|
3278
|
-
const normalized2 = s.replace(/\\/g, "/").toLowerCase();
|
|
3279
|
-
return BUNFS_MARKERS.some((m) => normalized2.includes(m));
|
|
3280
|
-
}
|
|
3281
|
-
function computeAssetsRoot(d) {
|
|
3282
|
-
const override = d.env.HARNESSED_ASSETS_OVERRIDE;
|
|
3283
|
-
if (override && override.trim().length > 0) {
|
|
3284
|
-
return { root: override.trim(), source: "override", compiledAssetsMissing: false };
|
|
3285
|
-
}
|
|
3286
|
-
if (isCompiledModuleUrl(d.moduleUrl)) {
|
|
3287
|
-
const root = join(d.stateRoot(), "assets", d.version);
|
|
3288
|
-
const present = d.exists(join(root, "workflows"));
|
|
3289
|
-
return { root, source: "compiled", compiledAssetsMissing: !present };
|
|
3290
|
-
}
|
|
3291
|
-
return { root: d.packageRoot, source: "package", compiledAssetsMissing: false };
|
|
3292
|
-
}
|
|
3293
|
-
function compiledAssetsDir(version) {
|
|
3294
|
-
return join(detectPlatform().stateRoot, "assets", version);
|
|
3295
|
-
}
|
|
3296
|
-
function realDeps() {
|
|
3297
|
-
return {
|
|
3298
|
-
env: process.env,
|
|
3299
|
-
moduleUrl: import.meta.url,
|
|
3300
|
-
exists: (p8) => {
|
|
3301
|
-
try {
|
|
3302
|
-
return existsSync(p8);
|
|
3303
|
-
} catch {
|
|
3304
|
-
return false;
|
|
3305
|
-
}
|
|
3306
|
-
},
|
|
3307
|
-
stateRoot: () => detectPlatform().stateRoot,
|
|
3308
|
-
packageRoot: getPackageRoot(),
|
|
3309
|
-
version: package_default.version
|
|
3310
|
-
};
|
|
3696
|
+
}
|
|
3697
|
+
if (best) return best.abs;
|
|
3698
|
+
}
|
|
3699
|
+
return null;
|
|
3311
3700
|
}
|
|
3312
|
-
function
|
|
3313
|
-
const
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3701
|
+
async function checkPlanningSync(cwd, _workflowState) {
|
|
3702
|
+
const planningDir = resolve(cwd, ".planning");
|
|
3703
|
+
const hasPlanningDir = await stat(planningDir).then((s) => s.isDirectory()).catch(() => false);
|
|
3704
|
+
if (!hasPlanningDir) return { status: "none_declared", missing: [] };
|
|
3705
|
+
const stateFile = resolve(cwd, ".planning", "STATE.md");
|
|
3706
|
+
const hasStateFile = await stat(stateFile).then((s) => s.isFile()).catch(() => false);
|
|
3707
|
+
if (!hasStateFile) return { status: "missing", missing: [".planning/STATE.md"] };
|
|
3708
|
+
return { status: "verified", missing: [] };
|
|
3709
|
+
}
|
|
3710
|
+
async function detectDrift(evidence) {
|
|
3711
|
+
const drift = [];
|
|
3712
|
+
for (const ref of evidence) {
|
|
3713
|
+
const now = await hashFile(ref.path).catch(() => "");
|
|
3714
|
+
if (now !== ref.sha256) drift.push({ path: ref.path, was: ref.sha256, now });
|
|
3319
3715
|
}
|
|
3320
|
-
return
|
|
3716
|
+
return drift;
|
|
3321
3717
|
}
|
|
3322
|
-
var
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
init_package();
|
|
3326
|
-
init_packagePath();
|
|
3327
|
-
init_platform();
|
|
3328
|
-
BUNFS_MARKERS = ["/$bunfs/", "/~bun/"];
|
|
3329
|
-
warnedMissing = false;
|
|
3718
|
+
var init_evidence = __esm({
|
|
3719
|
+
"src/checkpoint/evidence.ts"() {
|
|
3720
|
+
init_resolveYaml();
|
|
3330
3721
|
}
|
|
3331
3722
|
});
|
|
3332
3723
|
|
|
@@ -4678,9 +5069,9 @@ function defaultDeps2() {
|
|
|
4678
5069
|
};
|
|
4679
5070
|
}
|
|
4680
5071
|
function resolveBash(deps) {
|
|
4681
|
-
if (
|
|
4682
|
-
|
|
4683
|
-
return
|
|
5072
|
+
if (cache4) return cache4;
|
|
5073
|
+
cache4 = compute({ ...defaultDeps2(), ...deps });
|
|
5074
|
+
return cache4;
|
|
4684
5075
|
}
|
|
4685
5076
|
function compute(d) {
|
|
4686
5077
|
if (d.platform !== "win32") {
|
|
@@ -4700,7 +5091,7 @@ function compute(d) {
|
|
|
4700
5091
|
const gitFirst = d.where("git")[0];
|
|
4701
5092
|
if (gitFirst && /git\.exe$/i.test(gitFirst)) {
|
|
4702
5093
|
const root = dirname9(dirname9(gitFirst));
|
|
4703
|
-
for (const cand of [
|
|
5094
|
+
for (const cand of [join26(root, "bin", "bash.exe"), join26(root, "usr", "bin", "bash.exe")]) {
|
|
4704
5095
|
if (d.exists(cand) && usable(cand)) return { path: cand, source: "git-derived", wslOnPath };
|
|
4705
5096
|
}
|
|
4706
5097
|
}
|
|
@@ -4708,13 +5099,13 @@ function compute(d) {
|
|
|
4708
5099
|
d.env.ProgramFiles,
|
|
4709
5100
|
d.env.ProgramW6432,
|
|
4710
5101
|
d.env["ProgramFiles(x86)"],
|
|
4711
|
-
d.env.LOCALAPPDATA ?
|
|
5102
|
+
d.env.LOCALAPPDATA ? join26(d.env.LOCALAPPDATA, "Programs") : void 0
|
|
4712
5103
|
];
|
|
4713
5104
|
for (const base of bases) {
|
|
4714
5105
|
if (!base) continue;
|
|
4715
5106
|
for (const cand of [
|
|
4716
|
-
|
|
4717
|
-
|
|
5107
|
+
join26(base, "Git", "bin", "bash.exe"),
|
|
5108
|
+
join26(base, "Git", "usr", "bin", "bash.exe")
|
|
4718
5109
|
]) {
|
|
4719
5110
|
if (d.exists(cand) && usable(cand))
|
|
4720
5111
|
return { path: cand, source: "standard-location", wslOnPath };
|
|
@@ -4727,12 +5118,12 @@ function compute(d) {
|
|
|
4727
5118
|
}
|
|
4728
5119
|
return { path: "bash", source: "path-fallback" };
|
|
4729
5120
|
}
|
|
4730
|
-
var dirname9,
|
|
5121
|
+
var dirname9, join26, WSL_STUB_RE, cache4;
|
|
4731
5122
|
var init_resolveBash = __esm({
|
|
4732
5123
|
"src/installers/lib/resolveBash.ts"() {
|
|
4733
|
-
({ dirname: dirname9, join:
|
|
5124
|
+
({ dirname: dirname9, join: join26 } = win32);
|
|
4734
5125
|
WSL_STUB_RE = /[\\/](windows[\\/](system32|sysnative|syswow64)|microsoft[\\/]windowsapps)[\\/]bash\.exe$/i;
|
|
4735
|
-
|
|
5126
|
+
cache4 = null;
|
|
4736
5127
|
}
|
|
4737
5128
|
});
|
|
4738
5129
|
|
|
@@ -5395,7 +5786,7 @@ async function checkMcpAvailability() {
|
|
|
5395
5786
|
if (keyless.length > 0) {
|
|
5396
5787
|
const vars = keyless.map((k) => k.envVar).join(" / ");
|
|
5397
5788
|
fixes.push(
|
|
5398
|
-
`set ${vars} in the ~/.claude/settings.json "env" block (e.g. {"env": {"${keyless[0]?.envVar}": "<your-key>"}}) or export it in your shell; a mcpServers.<name>.env entry in ~/.claude.json also works`
|
|
5789
|
+
detectPlatform().id === "codex" ? `export ${vars} in your shell (on codex that is the only source this check can read \u2014 its MCP config is TOML and there is no JSON settings file)` : `set ${vars} in the ~/.claude/settings.json "env" block (e.g. {"env": {"${keyless[0]?.envVar}": "<your-key>"}}) or export it in your shell; a mcpServers.<name>.env entry in ~/.claude.json also works`
|
|
5399
5790
|
);
|
|
5400
5791
|
}
|
|
5401
5792
|
return {
|
|
@@ -5409,6 +5800,7 @@ var TARGET_SERVERS, CHECK_NAME;
|
|
|
5409
5800
|
var init_check_mcp_availability = __esm({
|
|
5410
5801
|
"src/cli/lib/check-mcp-availability.ts"() {
|
|
5411
5802
|
init_readClaudeConfig();
|
|
5803
|
+
init_platform();
|
|
5412
5804
|
init_search_mcp_keys();
|
|
5413
5805
|
TARGET_SERVERS = Object.keys(SEARCH_MCP_KEY_VARS);
|
|
5414
5806
|
CHECK_NAME = "MCP servers (tavily/exa)";
|
|
@@ -5500,67 +5892,6 @@ var init_check_bun = __esm({
|
|
|
5500
5892
|
"src/cli/lib/check-bun.ts"() {
|
|
5501
5893
|
}
|
|
5502
5894
|
});
|
|
5503
|
-
async function scanWorkflowsNested(workflowsDir, entries) {
|
|
5504
|
-
const workflows = [];
|
|
5505
|
-
for (const entry of entries.sort()) {
|
|
5506
|
-
if (NON_WORKFLOW_DIRS.has(entry)) continue;
|
|
5507
|
-
const src = join(workflowsDir, entry);
|
|
5508
|
-
let s;
|
|
5509
|
-
try {
|
|
5510
|
-
s = await stat(src);
|
|
5511
|
-
} catch {
|
|
5512
|
-
continue;
|
|
5513
|
-
}
|
|
5514
|
-
if (!s.isDirectory()) continue;
|
|
5515
|
-
let hasFlatSkill = false;
|
|
5516
|
-
try {
|
|
5517
|
-
await stat(join(src, "SKILL.md"));
|
|
5518
|
-
hasFlatSkill = true;
|
|
5519
|
-
} catch {
|
|
5520
|
-
hasFlatSkill = false;
|
|
5521
|
-
}
|
|
5522
|
-
if (hasFlatSkill) {
|
|
5523
|
-
if (FLAT_LEGACY_KEEP.has(entry)) {
|
|
5524
|
-
workflows.push({ name: entry, relPath: entry, isMaster: FLAT_TOP_LEVEL_MASTERS.has(entry) });
|
|
5525
|
-
continue;
|
|
5526
|
-
}
|
|
5527
|
-
workflows.push({ name: entry, relPath: entry, isMaster: false });
|
|
5528
|
-
continue;
|
|
5529
|
-
}
|
|
5530
|
-
let subEntries;
|
|
5531
|
-
try {
|
|
5532
|
-
subEntries = await readdir(src);
|
|
5533
|
-
} catch {
|
|
5534
|
-
continue;
|
|
5535
|
-
}
|
|
5536
|
-
for (const sub of subEntries.sort()) {
|
|
5537
|
-
const subDir = join(src, sub);
|
|
5538
|
-
let ss;
|
|
5539
|
-
try {
|
|
5540
|
-
ss = await stat(subDir);
|
|
5541
|
-
} catch {
|
|
5542
|
-
continue;
|
|
5543
|
-
}
|
|
5544
|
-
if (!ss.isDirectory()) continue;
|
|
5545
|
-
try {
|
|
5546
|
-
await stat(join(subDir, "SKILL.md"));
|
|
5547
|
-
} catch {
|
|
5548
|
-
continue;
|
|
5549
|
-
}
|
|
5550
|
-
const name = sub === "auto" ? entry : `${entry}-${sub}`;
|
|
5551
|
-
workflows.push({ name, relPath: `${entry}/${sub}`, isMaster: sub === "auto" });
|
|
5552
|
-
}
|
|
5553
|
-
}
|
|
5554
|
-
return { workflows };
|
|
5555
|
-
}
|
|
5556
|
-
var FLAT_LEGACY_KEEP, FLAT_TOP_LEVEL_MASTERS, NON_WORKFLOW_DIRS;
|
|
5557
|
-
var init_scan_nested = __esm({
|
|
5558
|
-
"src/workflow/scan-nested.ts"() {
|
|
5559
|
-
FLAT_LEGACY_KEEP = /* @__PURE__ */ new Set(["research", "retro", "auto"]);
|
|
5560
|
-
FLAT_TOP_LEVEL_MASTERS = /* @__PURE__ */ new Set(["auto"]);
|
|
5561
|
-
NON_WORKFLOW_DIRS = /* @__PURE__ */ new Set(["disciplines", "judgments"]);
|
|
5562
|
-
}
|
|
5563
|
-
});
|
|
5564
5895
|
|
|
5565
5896
|
// src/cli/lib/skillIntegrity.ts
|
|
5566
5897
|
var skillIntegrity_exports = {};
|
|
@@ -7342,557 +7673,360 @@ async function removeCodexHook(manifestName, hookEvent) {
|
|
|
7342
7673
|
invalidateCodexPluginCache();
|
|
7343
7674
|
if (r.exitCode !== 0)
|
|
7344
7675
|
return {
|
|
7345
|
-
ok: false,
|
|
7346
|
-
error: formatSpawnFail("codex plugin remove", r.exitCode, r.stdout, r.stderr)
|
|
7347
|
-
};
|
|
7348
|
-
}
|
|
7349
|
-
await removeIfEmpty(paths.cacheMarketplaceDir);
|
|
7350
|
-
await untrustCodexHooks([...keys]);
|
|
7351
|
-
const removed = [];
|
|
7352
|
-
for (const dir of [paths.pluginDir, paths.dataDir]) {
|
|
7353
|
-
if (existsSync(dir)) {
|
|
7354
|
-
await rm(dir, { recursive: true, force: true });
|
|
7355
|
-
removed.push(dir);
|
|
7356
|
-
}
|
|
7357
|
-
}
|
|
7358
|
-
const remaining = await harnessedPluginDirs(paths.pluginsDir);
|
|
7359
|
-
if (remaining.length > 0) {
|
|
7360
|
-
await writeFile(
|
|
7361
|
-
paths.marketplaceJson,
|
|
7362
|
-
`${JSON.stringify(codexMarketplaceJson(remaining), null, 2)}
|
|
7363
|
-
`
|
|
7364
|
-
);
|
|
7365
|
-
} else if (existsSync(paths.marketplaceRoot)) {
|
|
7366
|
-
const r = await runHarnessArgs(
|
|
7367
|
-
"codex",
|
|
7368
|
-
["plugin", "marketplace", "remove", CODEX_HOOK_MARKETPLACE],
|
|
7369
|
-
cwd,
|
|
7370
|
-
6e4
|
|
7371
|
-
);
|
|
7372
|
-
if (r.exitCode !== 0 && !/not configured/i.test(`${r.stdout}${r.stderr}`))
|
|
7373
|
-
return {
|
|
7374
|
-
ok: false,
|
|
7375
|
-
error: formatSpawnFail("codex plugin marketplace remove", r.exitCode, r.stdout, r.stderr)
|
|
7376
|
-
};
|
|
7377
|
-
await rm(paths.marketplaceRoot, { recursive: true, force: true });
|
|
7378
|
-
removed.push(paths.marketplaceRoot);
|
|
7379
|
-
}
|
|
7380
|
-
return { ok: true, removedPaths: removed };
|
|
7381
|
-
});
|
|
7382
|
-
}
|
|
7383
|
-
var TRUST_HINT;
|
|
7384
|
-
var init_codexHookAdd = __esm({
|
|
7385
|
-
"src/installers/codexHookAdd.ts"() {
|
|
7386
|
-
init_package();
|
|
7387
|
-
init_security();
|
|
7388
|
-
init_assetsRoot();
|
|
7389
|
-
init_platform();
|
|
7390
|
-
init_backup();
|
|
7391
|
-
init_codexHookPlugin();
|
|
7392
|
-
init_codexHookTrust();
|
|
7393
|
-
init_codexPlugins();
|
|
7394
|
-
init_confirm();
|
|
7395
|
-
init_diff();
|
|
7396
|
-
init_err();
|
|
7397
|
-
init_runClaudeArgs();
|
|
7398
|
-
init_safeCwd();
|
|
7399
|
-
init_state2();
|
|
7400
|
-
init_verifyMessage();
|
|
7401
|
-
TRUST_HINT = (name) => `codex hooks installed but NOT trusted yet \u2014 codex skips untrusted hooks. Re-run \`harnessed install ${name} --trust-codex-hooks\`, or trust them in codex's hook review.`;
|
|
7402
|
-
}
|
|
7403
|
-
});
|
|
7404
|
-
|
|
7405
|
-
// src/cli/lib/check-codex-hooks.ts
|
|
7406
|
-
var check_codex_hooks_exports = {};
|
|
7407
|
-
__export(check_codex_hooks_exports, {
|
|
7408
|
-
checkCodexHooks: () => checkCodexHooks
|
|
7409
|
-
});
|
|
7410
|
-
function defaultDeps4() {
|
|
7411
|
-
const codexHome = resolveCodexHome();
|
|
7412
|
-
return {
|
|
7413
|
-
platformId: detectPlatform().id,
|
|
7414
|
-
codexHome,
|
|
7415
|
-
join: join,
|
|
7416
|
-
pluginDirs: async () => {
|
|
7417
|
-
try {
|
|
7418
|
-
return (await readdir(join(codexHome, "harnessed", "marketplace", "plugins"))).filter(
|
|
7419
|
-
(n) => n.startsWith("harnessed-")
|
|
7420
|
-
);
|
|
7421
|
-
} catch {
|
|
7422
|
-
return [];
|
|
7423
|
-
}
|
|
7424
|
-
},
|
|
7425
|
-
installedPlugins: listInstalledCodexPlugins,
|
|
7426
|
-
listHooks: () => listCodexHooks(),
|
|
7427
|
-
readText: (p8) => {
|
|
7428
|
-
try {
|
|
7429
|
-
return readFileSync(p8, "utf8");
|
|
7430
|
-
} catch {
|
|
7431
|
-
return null;
|
|
7432
|
-
}
|
|
7433
|
-
},
|
|
7434
|
-
exists: existsSync,
|
|
7435
|
-
onPath: (bin) => binaryOnPath(bin)
|
|
7436
|
-
};
|
|
7437
|
-
}
|
|
7438
|
-
function hookIdOf(d, pluginName) {
|
|
7439
|
-
const raw = d.readText(
|
|
7440
|
-
d.join(d.codexHome, "harnessed", "marketplace", "plugins", pluginName, "hooks", "hooks.json")
|
|
7441
|
-
);
|
|
7442
|
-
let command = "";
|
|
7443
|
-
try {
|
|
7444
|
-
const hooks = JSON.parse(raw ?? "{}").hooks ?? {};
|
|
7445
|
-
const group = Object.values(hooks)[0]?.[0];
|
|
7446
|
-
command = group?.hooks?.[0]?.command ?? "";
|
|
7447
|
-
} catch {
|
|
7448
|
-
return null;
|
|
7449
|
-
}
|
|
7450
|
-
const m = command.match(/(?:hook\.cjs"|^harnessed) ([a-z][a-z-]*)/);
|
|
7451
|
-
return m?.[1] ?? null;
|
|
7452
|
-
}
|
|
7453
|
-
function chainProblem(d, pluginName, id) {
|
|
7454
|
-
const infoPath = d.join(
|
|
7455
|
-
d.codexHome,
|
|
7456
|
-
"plugins",
|
|
7457
|
-
"data",
|
|
7458
|
-
`${pluginName}-${CODEX_HOOK_MARKETPLACE}`,
|
|
7459
|
-
"install.json"
|
|
7460
|
-
);
|
|
7461
|
-
let info = null;
|
|
7462
|
-
try {
|
|
7463
|
-
info = JSON.parse(d.readText(infoPath) ?? "null");
|
|
7464
|
-
} catch {
|
|
7465
|
-
info = null;
|
|
7466
|
-
}
|
|
7467
|
-
if (!info || typeof info.assetsRoot !== "string") return "shim: install.json missing";
|
|
7468
|
-
if (info.mode === "binary")
|
|
7469
|
-
return d.onPath("harnessed") ? null : "`harnessed` not on PATH (binary-mode hook command)";
|
|
7470
|
-
const bin = id ? d.join(info.assetsRoot, "bin", `harnessed-${id}.mjs`) : null;
|
|
7471
|
-
const cli = d.join(info.assetsRoot, "dist", "cli.mjs");
|
|
7472
|
-
return bin && d.exists(bin) || d.exists(cli) ? null : `shim: no entry under ${info.assetsRoot}`;
|
|
7473
|
-
}
|
|
7474
|
-
async function checkCodexHooks(deps) {
|
|
7475
|
-
const d = { ...defaultDeps4(), ...deps };
|
|
7476
|
-
if (d.platformId !== "codex")
|
|
7477
|
-
return { name: NAME6, status: "skipped", message: `not codex (${d.platformId}) \u2014 skipped` };
|
|
7478
|
-
const plugins = await d.pluginDirs();
|
|
7479
|
-
if (plugins.length === 0)
|
|
7480
|
-
return { name: NAME6, status: "pass", message: "no harnessed codex hook plugins installed" };
|
|
7481
|
-
const [installed, listed] = await Promise.all([d.installedPlugins(), d.listHooks()]);
|
|
7482
|
-
const problems = [];
|
|
7483
|
-
const fixes = [];
|
|
7484
|
-
const ok = [];
|
|
7485
|
-
for (const pluginName of plugins.sort()) {
|
|
7486
|
-
const manifest = pluginName.replace(/^harnessed-/, "");
|
|
7487
|
-
const pluginId = `${pluginName}@${CODEX_HOOK_MARKETPLACE}`;
|
|
7488
|
-
const issues = [];
|
|
7489
|
-
if (installed && !installed.has(pluginId)) issues.push("not installed in codex");
|
|
7490
|
-
const hooks = listed.ok ? listed.value.filter((h) => h.key.startsWith(`${pluginId}:`)) : [];
|
|
7491
|
-
const trust = !listed.ok ? "unknown" : hooks.length === 0 ? "unknown" : hooks.find((h) => h.trustStatus !== "trusted")?.trustStatus ?? "trusted";
|
|
7492
|
-
if (trust !== "trusted") issues.push(`trust: ${trust}`);
|
|
7493
|
-
const chain = chainProblem(d, pluginName, hookIdOf(d, pluginName));
|
|
7494
|
-
if (chain) issues.push(chain);
|
|
7495
|
-
if (issues.length === 0) ok.push(manifest);
|
|
7496
|
-
else {
|
|
7497
|
-
problems.push(`${manifest} (${issues.join("; ")})`);
|
|
7498
|
-
fixes.push(`harnessed install ${manifest} --trust-codex-hooks`);
|
|
7676
|
+
ok: false,
|
|
7677
|
+
error: formatSpawnFail("codex plugin remove", r.exitCode, r.stdout, r.stderr)
|
|
7678
|
+
};
|
|
7499
7679
|
}
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7680
|
+
await removeIfEmpty(paths.cacheMarketplaceDir);
|
|
7681
|
+
await untrustCodexHooks([...keys]);
|
|
7682
|
+
const removed = [];
|
|
7683
|
+
for (const dir of [paths.pluginDir, paths.dataDir]) {
|
|
7684
|
+
if (existsSync(dir)) {
|
|
7685
|
+
await rm(dir, { recursive: true, force: true });
|
|
7686
|
+
removed.push(dir);
|
|
7687
|
+
}
|
|
7688
|
+
}
|
|
7689
|
+
const remaining = await harnessedPluginDirs(paths.pluginsDir);
|
|
7690
|
+
if (remaining.length > 0) {
|
|
7691
|
+
await writeFile(
|
|
7692
|
+
paths.marketplaceJson,
|
|
7693
|
+
`${JSON.stringify(codexMarketplaceJson(remaining), null, 2)}
|
|
7694
|
+
`
|
|
7695
|
+
);
|
|
7696
|
+
} else if (existsSync(paths.marketplaceRoot)) {
|
|
7697
|
+
const r = await runHarnessArgs(
|
|
7698
|
+
"codex",
|
|
7699
|
+
["plugin", "marketplace", "remove", CODEX_HOOK_MARKETPLACE],
|
|
7700
|
+
cwd,
|
|
7701
|
+
6e4
|
|
7702
|
+
);
|
|
7703
|
+
if (r.exitCode !== 0 && !/not configured/i.test(`${r.stdout}${r.stderr}`))
|
|
7704
|
+
return {
|
|
7705
|
+
ok: false,
|
|
7706
|
+
error: formatSpawnFail("codex plugin marketplace remove", r.exitCode, r.stdout, r.stderr)
|
|
7707
|
+
};
|
|
7708
|
+
await rm(paths.marketplaceRoot, { recursive: true, force: true });
|
|
7709
|
+
removed.push(paths.marketplaceRoot);
|
|
7710
|
+
}
|
|
7711
|
+
return { ok: true, removedPaths: removed };
|
|
7712
|
+
});
|
|
7509
7713
|
}
|
|
7510
|
-
var
|
|
7511
|
-
var
|
|
7512
|
-
"src/
|
|
7513
|
-
|
|
7514
|
-
|
|
7714
|
+
var TRUST_HINT;
|
|
7715
|
+
var init_codexHookAdd = __esm({
|
|
7716
|
+
"src/installers/codexHookAdd.ts"() {
|
|
7717
|
+
init_package();
|
|
7718
|
+
init_security();
|
|
7719
|
+
init_assetsRoot();
|
|
7720
|
+
init_platform();
|
|
7721
|
+
init_backup();
|
|
7515
7722
|
init_codexHookPlugin();
|
|
7516
7723
|
init_codexHookTrust();
|
|
7517
7724
|
init_codexPlugins();
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
}
|
|
7527
|
-
var ALL_HOSTS, BOTH, CHECKS;
|
|
7528
|
-
var init_doctor_registry = __esm({
|
|
7529
|
-
"src/cli/lib/doctor-registry.ts"() {
|
|
7530
|
-
init_check_builtin();
|
|
7531
|
-
ALL_HOSTS = ["claude", "codex"];
|
|
7532
|
-
BOTH = ALL_HOSTS;
|
|
7533
|
-
CHECKS = [
|
|
7534
|
-
// Node runtime version — `process.versions.node`, no harness surface at all.
|
|
7535
|
-
{ name: "node \u2265 22", hosts: BOTH, fn: async () => checkNodeVersion() },
|
|
7536
|
-
// claude-only: check-builtin.ts checkMcpScope early-returns unless
|
|
7537
|
-
// detectPlatform().id === 'claude'; it reads ~/.claude.json + project .mcp.json.
|
|
7538
|
-
{ name: "mcp scope", hosts: ["claude"], fn: checkMcpScope },
|
|
7539
|
-
// PATH probe (`where`/`which jq`) — the install hint switches on OS, not host.
|
|
7540
|
-
{ name: "jq present", hosts: BOTH, fn: async () => checkJq() },
|
|
7541
|
-
// resolveBash() PATH inspection. Its early return is an OS gate (non-Windows),
|
|
7542
|
-
// NOT a host gate — both harnesses need a usable bash on Windows.
|
|
7543
|
-
{ name: "bash flavor (win)", hosts: BOTH, fn: async () => checkWinBash() },
|
|
7544
|
-
// git remote of the cwd — no harness surface.
|
|
7545
|
-
{
|
|
7546
|
-
name: "origin URL",
|
|
7547
|
-
hosts: BOTH,
|
|
7548
|
-
fn: async () => {
|
|
7549
|
-
const { checkOrigin: checkOrigin2 } = await Promise.resolve().then(() => (init_origin_check(), origin_check_exports));
|
|
7550
|
-
const r = checkOrigin2(process.cwd(), { allowFork: true });
|
|
7551
|
-
return { name: "origin URL", status: r.status, message: r.detail, fix: r.fix };
|
|
7552
|
-
}
|
|
7553
|
-
},
|
|
7554
|
-
// PATH probe + harnessSkillsDirs() (which spans BOTH harnesses' skills dirs).
|
|
7555
|
-
{
|
|
7556
|
-
name: "gstack prefix",
|
|
7557
|
-
hosts: BOTH,
|
|
7558
|
-
fn: async () => {
|
|
7559
|
-
const { probeGstackPrefix: probeGstackPrefix2 } = await Promise.resolve().then(() => (init_probe_gstack(), probe_gstack_exports));
|
|
7560
|
-
const r = probeGstackPrefix2();
|
|
7561
|
-
return { name: "gstack prefix", status: r.status, message: r.detail, fix: r.fix };
|
|
7562
|
-
}
|
|
7563
|
-
},
|
|
7564
|
-
// Reads the packaged manifests/aliases.yaml — harness-independent.
|
|
7565
|
-
{
|
|
7566
|
-
name: "deprecated manifests",
|
|
7567
|
-
hosts: BOTH,
|
|
7568
|
-
fn: async () => (await Promise.resolve().then(() => (init_check_deprecations(), check_deprecations_exports))).checkDeprecations()
|
|
7569
|
-
},
|
|
7570
|
-
// getSkillsDir() — descriptor-resolved, so it audits whichever harness is active.
|
|
7571
|
-
{
|
|
7572
|
-
name: "token budget",
|
|
7573
|
-
hosts: BOTH,
|
|
7574
|
-
fn: async () => (await Promise.resolve().then(() => (init_check_token_budget(), check_token_budget_exports))).checkTokenBudget()
|
|
7575
|
-
},
|
|
7576
|
-
// claude-only: Agent Teams is a Claude Code env key; the check early-returns
|
|
7577
|
-
// unless detectPlatform().id === 'claude'.
|
|
7578
|
-
{
|
|
7579
|
-
name: "Agent Teams env",
|
|
7580
|
-
hosts: ["claude"],
|
|
7581
|
-
fn: async () => (await Promise.resolve().then(() => (init_check_agent_teams_doctor(), check_agent_teams_doctor_exports))).checkAgentTeamsDoctor()
|
|
7582
|
-
},
|
|
7583
|
-
// claude-only: probes the CC plugin CACHE and early-returns when
|
|
7584
|
-
// getPluginsRegistry() is null (codex has no installed_plugins.json).
|
|
7585
|
-
{
|
|
7586
|
-
name: "planning-with-files plugin",
|
|
7587
|
-
hosts: ["claude"],
|
|
7588
|
-
fn: async () => (await Promise.resolve().then(() => (init_check_planning_with_files(), check_planning_with_files_exports))).checkPlanningWithFiles()
|
|
7589
|
-
},
|
|
7590
|
-
// Both: the plugin-cache probe is registry-gated but the skill probes span
|
|
7591
|
-
// harnessSkillsDirs(), and install_commands computes `--agent` per host.
|
|
7592
|
-
{
|
|
7593
|
-
name: "mattpocock-skills",
|
|
7594
|
-
hosts: BOTH,
|
|
7595
|
-
fn: async () => (await Promise.resolve().then(() => (init_check_mattpocock_skills(), check_mattpocock_skills_exports))).checkMattpocockSkills()
|
|
7596
|
-
},
|
|
7597
|
-
// Both: isMcpServerRegistered branches on codex → `[mcp_servers.*]` in config.toml.
|
|
7598
|
-
{
|
|
7599
|
-
name: "MCP servers (tavily/exa)",
|
|
7600
|
-
hosts: BOTH,
|
|
7601
|
-
fn: async () => (await Promise.resolve().then(() => (init_check_mcp_availability(), check_mcp_availability_exports))).checkMcpAvailability()
|
|
7602
|
-
},
|
|
7603
|
-
// Phase 18 — opt-in CodeGraph semantic-index detect (always 'pass'; absence of an
|
|
7604
|
-
// optional tool is not a health failure). Project-local `.codegraph/` — no host surface.
|
|
7605
|
-
{
|
|
7606
|
-
name: "codegraph",
|
|
7607
|
-
hosts: BOTH,
|
|
7608
|
-
fn: async () => (await Promise.resolve().then(() => (init_check_codegraph(), check_codegraph_exports))).checkCodeGraph(process.cwd())
|
|
7609
|
-
},
|
|
7610
|
-
// v4.16.1 T3 — bun presence (warn-only): gstack's upstream setup hard-requires
|
|
7611
|
-
// bun; missing bun is THE gstack refresh-failure cause on user dogfood machines.
|
|
7612
|
-
// Pure PATH probe.
|
|
7613
|
-
{ name: "bun present", hosts: BOTH, fn: async () => (await Promise.resolve().then(() => (init_check_bun(), check_bun_exports))).checkBun() },
|
|
7614
|
-
// 4.22.1 T4 — dual-guard conflict (warn-only): ECC GateGuard's filename policy
|
|
7615
|
-
// vs evidence-guard artifact contract names (subagents cannot fact-retry).
|
|
7616
|
-
// Both: only the settings.json signal degrades on codex — the ecc-plugin signal
|
|
7617
|
-
// goes through isPluginRegistered (which asks `codex plugin list` there) and the
|
|
7618
|
-
// env signal is host-free. ECC ships a codex channel, so the conflict is real there.
|
|
7619
|
-
{
|
|
7620
|
-
name: "guard conflict (GateGuard)",
|
|
7621
|
-
hosts: BOTH,
|
|
7622
|
-
fn: async () => (await Promise.resolve().then(() => (init_check_guard_conflict(), check_guard_conflict_exports))).checkGuardConflict()
|
|
7623
|
-
},
|
|
7624
|
-
// 4.23.0 (issue #3) — installed workflow-skill integrity (warn-only): flat
|
|
7625
|
-
// ~/.claude/skills packs can silently shadow shipped workflows; setup self-heals.
|
|
7626
|
-
// getSkillsDir() — per-host install dir, so it audits either harness.
|
|
7627
|
-
{
|
|
7628
|
-
name: "workflow skill integrity",
|
|
7629
|
-
hosts: BOTH,
|
|
7630
|
-
fn: async () => (await Promise.resolve().then(() => (init_check_skill_integrity(), check_skill_integrity_exports))).checkSkillIntegrity()
|
|
7631
|
-
},
|
|
7632
|
-
// Phase 20 — "update available" version check ('warn' only when behind; 'pass'
|
|
7633
|
-
// when current/ahead/npm-unreachable — fail-soft, never flips the summary).
|
|
7634
|
-
// Compares package.json against npm — no harness surface.
|
|
7635
|
-
{
|
|
7636
|
-
name: "update",
|
|
7637
|
-
hosts: BOTH,
|
|
7638
|
-
fn: async () => (await Promise.resolve().then(() => (init_check_update(), check_update_exports))).checkUpdate()
|
|
7639
|
-
},
|
|
7640
|
-
// 4.32.4 — dual install-channel conflict (warn-only): npm-global + standalone
|
|
7641
|
-
// binary both present → ambiguous PATH resolution + stale-update trap. The
|
|
7642
|
-
// harnessed CLI's own install, independent of which harness drives it.
|
|
7643
|
-
{
|
|
7644
|
-
name: "install channel",
|
|
7645
|
-
hosts: BOTH,
|
|
7646
|
-
fn: async () => (await Promise.resolve().then(() => (init_check_install_channels(), check_install_channels_exports))).checkInstallChannels()
|
|
7647
|
-
},
|
|
7648
|
-
// issue #8 — orphaned harnessed Stop/UserPromptSubmit hooks (warn-only): a hook
|
|
7649
|
-
// pointing at a deleted bin/*.mjs makes Claude Code error MODULE_NOT_FOUND every
|
|
7650
|
-
// prompt; `harnessed uninstall` now strips them. claude-only: the whole check is
|
|
7651
|
-
// a settings.json read, and getSettingsPath() is null on codex.
|
|
7652
|
-
{
|
|
7653
|
-
name: "stale hooks",
|
|
7654
|
-
hosts: ["claude"],
|
|
7655
|
-
fn: async () => (await Promise.resolve().then(() => (init_check_stale_hooks(), check_stale_hooks_exports))).checkStaleHooks()
|
|
7656
|
-
},
|
|
7657
|
-
// 4.32.22 — ECC per-harness detect (optional; pass unless CC-side ecc overlaps
|
|
7658
|
-
// the official chrome-devtools-mcp plugin → warn). CC plugin registry + codex
|
|
7659
|
-
// sync-clone probed independently — by construction a both-hosts check.
|
|
7660
|
-
{ name: "ecc", hosts: BOTH, fn: async () => (await Promise.resolve().then(() => (init_check_ecc(), check_ecc_exports))).checkEcc() },
|
|
7661
|
-
// 4.38.0 — half-installed per-turn injection (warn-only): perturn-inject
|
|
7662
|
-
// without perturn-inject-invalidate keeps skipping <project-context> after a
|
|
7663
|
-
// compact/clear has already dropped the copy it is skipping on behalf of.
|
|
7664
|
-
// claude-only: pairs two settings.json hook registrations (null path on codex).
|
|
7665
|
-
{
|
|
7666
|
-
name: "per-turn inject pairing",
|
|
7667
|
-
hosts: ["claude"],
|
|
7668
|
-
fn: async () => (await Promise.resolve().then(() => (init_check_inject_invalidate(), check_inject_invalidate_exports))).checkInjectInvalidate()
|
|
7669
|
-
},
|
|
7670
|
-
// Phase 56 — silently stale marketplace plugins (warn-only): `claude plugin
|
|
7671
|
-
// install` pins a version into a versioned cache dir and never re-resolves, so
|
|
7672
|
-
// the four cc-plugin-marketplace components drift behind without any signal.
|
|
7673
|
-
// The only comparison in the codebase between a genuinely DETECTED version and
|
|
7674
|
-
// a recorded one — see the header for why the installer-state layer cannot do it.
|
|
7675
|
-
// claude-only: needs the installed_plugins.json registry (null on codex).
|
|
7676
|
-
{
|
|
7677
|
-
name: "plugin install freshness",
|
|
7678
|
-
hosts: ["claude"],
|
|
7679
|
-
fn: async () => (await Promise.resolve().then(() => (init_check_plugin_staleness(), check_plugin_staleness_exports))).checkPluginStaleness()
|
|
7680
|
-
},
|
|
7681
|
-
// Phase 60 — HARNESSED_OFF left on (warn-only): the kill switch silences every
|
|
7682
|
-
// first-party hook, so a machine that forgot to unset it looks exactly like a
|
|
7683
|
-
// broken install. doctor is where that gets said out loud. Env var — and the
|
|
7684
|
-
// hooks it silences exist on both harnesses.
|
|
7685
|
-
{
|
|
7686
|
-
name: "ablation switch",
|
|
7687
|
-
hosts: BOTH,
|
|
7688
|
-
fn: async () => (await Promise.resolve().then(() => (init_check_ablation(), check_ablation_exports))).checkAblation()
|
|
7689
|
-
},
|
|
7690
|
-
// v16.0 Phase 64 (ADR 0041) — codex hook plugins (warn-only): codex silently
|
|
7691
|
-
// skips an untrusted / modified hook, so "installed" is not "running". codex-only:
|
|
7692
|
-
// the check early-returns unless the active platform id is `codex`.
|
|
7693
|
-
{
|
|
7694
|
-
name: "codex hook plugins",
|
|
7695
|
-
hosts: ["codex"],
|
|
7696
|
-
fn: async () => (await Promise.resolve().then(() => (init_check_codex_hooks(), check_codex_hooks_exports))).checkCodexHooks()
|
|
7697
|
-
}
|
|
7698
|
-
];
|
|
7699
|
-
}
|
|
7700
|
-
});
|
|
7701
|
-
function resolveLocaleYaml(dir, baseName, locale = getLocale()) {
|
|
7702
|
-
if (locale !== "en") {
|
|
7703
|
-
const sibling = join(dir, `${baseName}.${locale}.yaml`);
|
|
7704
|
-
if (existsSync(sibling)) return sibling;
|
|
7705
|
-
}
|
|
7706
|
-
return join(dir, `${baseName}.yaml`);
|
|
7707
|
-
}
|
|
7708
|
-
var init_localeYaml = __esm({
|
|
7709
|
-
"src/i18n/localeYaml.ts"() {
|
|
7710
|
-
init_i18n();
|
|
7725
|
+
init_confirm();
|
|
7726
|
+
init_diff();
|
|
7727
|
+
init_err();
|
|
7728
|
+
init_runClaudeArgs();
|
|
7729
|
+
init_safeCwd();
|
|
7730
|
+
init_state2();
|
|
7731
|
+
init_verifyMessage();
|
|
7732
|
+
TRUST_HINT = (name) => `codex hooks installed but NOT trusted yet \u2014 codex skips untrusted hooks. Re-run \`harnessed install ${name} --trust-codex-hooks\`, or trust them in codex's hook review.`;
|
|
7711
7733
|
}
|
|
7712
7734
|
});
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
const doc = parse(raw);
|
|
7722
|
-
return doc?.prompts ?? {};
|
|
7723
|
-
}
|
|
7724
|
-
function mapRolePromptText(rp, render) {
|
|
7725
|
-
const s = (v) => typeof v === "string" ? render(v) : v;
|
|
7735
|
+
|
|
7736
|
+
// src/cli/lib/check-codex-hooks.ts
|
|
7737
|
+
var check_codex_hooks_exports = {};
|
|
7738
|
+
__export(check_codex_hooks_exports, {
|
|
7739
|
+
checkCodexHooks: () => checkCodexHooks
|
|
7740
|
+
});
|
|
7741
|
+
function defaultDeps4() {
|
|
7742
|
+
const codexHome = resolveCodexHome();
|
|
7726
7743
|
return {
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7744
|
+
platformId: detectPlatform().id,
|
|
7745
|
+
codexHome,
|
|
7746
|
+
join: join,
|
|
7747
|
+
pluginDirs: async () => {
|
|
7748
|
+
try {
|
|
7749
|
+
return (await readdir(join(codexHome, "harnessed", "marketplace", "plugins"))).filter(
|
|
7750
|
+
(n) => n.startsWith("harnessed-")
|
|
7751
|
+
);
|
|
7752
|
+
} catch {
|
|
7753
|
+
return [];
|
|
7754
|
+
}
|
|
7755
|
+
},
|
|
7756
|
+
installedPlugins: listInstalledCodexPlugins,
|
|
7757
|
+
listHooks: () => listCodexHooks(),
|
|
7758
|
+
readText: (p8) => {
|
|
7759
|
+
try {
|
|
7760
|
+
return readFileSync(p8, "utf8");
|
|
7761
|
+
} catch {
|
|
7762
|
+
return null;
|
|
7763
|
+
}
|
|
7764
|
+
},
|
|
7765
|
+
exists: existsSync,
|
|
7766
|
+
onPath: (bin) => binaryOnPath(bin)
|
|
7732
7767
|
};
|
|
7733
7768
|
}
|
|
7734
|
-
function
|
|
7735
|
-
const
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
var init_rolePrompts = __esm({
|
|
7740
|
-
"src/workflow/rolePrompts.ts"() {
|
|
7741
|
-
init_i18n();
|
|
7742
|
-
init_localeYaml();
|
|
7743
|
-
}
|
|
7744
|
-
});
|
|
7745
|
-
function toHostId(id) {
|
|
7746
|
-
return id === "codex" ? "codex" : "claude";
|
|
7747
|
-
}
|
|
7748
|
-
async function loadHostPrimitives(opts) {
|
|
7749
|
-
const path = resolveLocaleYaml(opts.workflowsDir, YAML_BASE, opts.locale ?? getLocale());
|
|
7750
|
-
let raw;
|
|
7769
|
+
function hookIdOf(d, pluginName) {
|
|
7770
|
+
const raw = d.readText(
|
|
7771
|
+
d.join(d.codexHome, "harnessed", "marketplace", "plugins", pluginName, "hooks", "hooks.json")
|
|
7772
|
+
);
|
|
7773
|
+
let command = "";
|
|
7751
7774
|
try {
|
|
7752
|
-
|
|
7775
|
+
const hooks = JSON.parse(raw ?? "{}").hooks ?? {};
|
|
7776
|
+
const group = Object.values(hooks)[0]?.[0];
|
|
7777
|
+
command = group?.hooks?.[0]?.command ?? "";
|
|
7753
7778
|
} catch {
|
|
7754
|
-
return
|
|
7779
|
+
return null;
|
|
7755
7780
|
}
|
|
7756
|
-
const
|
|
7757
|
-
return
|
|
7781
|
+
const m = command.match(/(?:hook\.cjs"|^harnessed) ([a-z][a-z-]*)/);
|
|
7782
|
+
return m?.[1] ?? null;
|
|
7758
7783
|
}
|
|
7759
|
-
|
|
7760
|
-
const
|
|
7761
|
-
|
|
7784
|
+
function chainProblem(d, pluginName, id) {
|
|
7785
|
+
const infoPath = d.join(
|
|
7786
|
+
d.codexHome,
|
|
7787
|
+
"plugins",
|
|
7788
|
+
"data",
|
|
7789
|
+
`${pluginName}-${CODEX_HOOK_MARKETPLACE}`,
|
|
7790
|
+
"install.json"
|
|
7791
|
+
);
|
|
7792
|
+
let info = null;
|
|
7762
7793
|
try {
|
|
7763
|
-
|
|
7794
|
+
info = JSON.parse(d.readText(infoPath) ?? "null");
|
|
7764
7795
|
} catch {
|
|
7765
|
-
|
|
7796
|
+
info = null;
|
|
7766
7797
|
}
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
}
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
const key = `${opts.workflowsDir}|${locale}`;
|
|
7774
|
-
const hit = _tableCache.get(key);
|
|
7775
|
-
if (hit) return hit;
|
|
7776
|
-
const p8 = loadHostPrimitives({ workflowsDir: opts.workflowsDir, locale });
|
|
7777
|
-
_tableCache.set(key, p8);
|
|
7778
|
-
return p8;
|
|
7779
|
-
}
|
|
7780
|
-
function templateRe() {
|
|
7781
|
-
return new RegExp(HOST_PRIMITIVE_TEMPLATE.source, "g");
|
|
7782
|
-
}
|
|
7783
|
-
function lineOf2(body, offset) {
|
|
7784
|
-
let line = 1;
|
|
7785
|
-
for (let i = 0; i < offset && i < body.length; i++) if (body[i] === "\n") line++;
|
|
7786
|
-
return line;
|
|
7798
|
+
if (!info || typeof info.assetsRoot !== "string") return "shim: install.json missing";
|
|
7799
|
+
if (info.mode === "binary")
|
|
7800
|
+
return d.onPath("harnessed") ? null : "`harnessed` not on PATH (binary-mode hook command)";
|
|
7801
|
+
const bin = id ? d.join(info.assetsRoot, "bin", `harnessed-${id}.mjs`) : null;
|
|
7802
|
+
const cli = d.join(info.assetsRoot, "dist", "cli.mjs");
|
|
7803
|
+
return bin && d.exists(bin) || d.exists(cli) ? null : `shim: no entry under ${info.assetsRoot}`;
|
|
7787
7804
|
}
|
|
7788
|
-
function
|
|
7789
|
-
const {
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
}
|
|
7813
|
-
return text;
|
|
7805
|
+
async function checkCodexHooks(deps) {
|
|
7806
|
+
const d = { ...defaultDeps4(), ...deps };
|
|
7807
|
+
if (d.platformId !== "codex")
|
|
7808
|
+
return { name: NAME6, status: "skipped", message: `not codex (${d.platformId}) \u2014 skipped` };
|
|
7809
|
+
const plugins = await d.pluginDirs();
|
|
7810
|
+
if (plugins.length === 0)
|
|
7811
|
+
return { name: NAME6, status: "pass", message: "no harnessed codex hook plugins installed" };
|
|
7812
|
+
const [installed, listed] = await Promise.all([d.installedPlugins(), d.listHooks()]);
|
|
7813
|
+
const problems = [];
|
|
7814
|
+
const fixes = [];
|
|
7815
|
+
const ok = [];
|
|
7816
|
+
for (const pluginName of plugins.sort()) {
|
|
7817
|
+
const manifest = pluginName.replace(/^harnessed-/, "");
|
|
7818
|
+
const pluginId = `${pluginName}@${CODEX_HOOK_MARKETPLACE}`;
|
|
7819
|
+
const issues = [];
|
|
7820
|
+
if (installed && !installed.has(pluginId)) issues.push("not installed in codex");
|
|
7821
|
+
const hooks = listed.ok ? listed.value.filter((h) => h.key.startsWith(`${pluginId}:`)) : [];
|
|
7822
|
+
const trust = !listed.ok ? "unknown" : hooks.length === 0 ? "unknown" : hooks.find((h) => h.trustStatus !== "trusted")?.trustStatus ?? "trusted";
|
|
7823
|
+
if (trust !== "trusted") issues.push(`trust: ${trust}`);
|
|
7824
|
+
const chain = chainProblem(d, pluginName, hookIdOf(d, pluginName));
|
|
7825
|
+
if (chain) issues.push(chain);
|
|
7826
|
+
if (issues.length === 0) ok.push(manifest);
|
|
7827
|
+
else {
|
|
7828
|
+
problems.push(`${manifest} (${issues.join("; ")})`);
|
|
7829
|
+
fixes.push(`harnessed install ${manifest} --trust-codex-hooks`);
|
|
7814
7830
|
}
|
|
7815
|
-
);
|
|
7816
|
-
}
|
|
7817
|
-
function cell(text) {
|
|
7818
|
-
return text.replaceAll("|", "\\|");
|
|
7819
|
-
}
|
|
7820
|
-
function code(text) {
|
|
7821
|
-
return text.includes("`") ? text : `\`${text}\``;
|
|
7822
|
-
}
|
|
7823
|
-
function hostMapRows(table) {
|
|
7824
|
-
const rows = [];
|
|
7825
|
-
for (const primitive of Object.keys(table).sort()) {
|
|
7826
|
-
const entry = table[primitive]?.[DEFAULT_VARIANT];
|
|
7827
|
-
const claude = entry?.claude;
|
|
7828
|
-
const codex = entry?.codex;
|
|
7829
|
-
if (claude === void 0 || codex === void 0) continue;
|
|
7830
|
-
if (claude.includes("\n") || codex.includes("\n")) continue;
|
|
7831
|
-
if (claude.length > TERM_MAX_LEN || codex.length > TERM_MAX_LEN) continue;
|
|
7832
|
-
rows.push({ primitive, claude, codex });
|
|
7833
|
-
}
|
|
7834
|
-
return rows;
|
|
7835
|
-
}
|
|
7836
|
-
function buildHostMapSection(opts) {
|
|
7837
|
-
const { host, table } = opts;
|
|
7838
|
-
if (host === "claude") return "";
|
|
7839
|
-
const rows = hostMapRows(table);
|
|
7840
|
-
const notes = opts.notes ?? [];
|
|
7841
|
-
if (rows.length === 0 && notes.length === 0) return "";
|
|
7842
|
-
const skillsDir = table.skills_dir?.[DEFAULT_VARIANT]?.[host];
|
|
7843
|
-
const where = skillsDir ? ` and installed it under ${code(skillsDir)}` : "";
|
|
7844
|
-
const lines = [
|
|
7845
|
-
HOST_MAP_START,
|
|
7846
|
-
`## Host map \u2014 ${host}`,
|
|
7847
|
-
"",
|
|
7848
|
-
`harnessed rendered this artifact for the **${host}** harness${where}. The workflow prose was authored against Claude Code, so where a step names a tool it names the ${host} one. Use the table to decode any instruction that still reads as Claude-Code-shaped; do not substitute the Claude Code names back.`
|
|
7849
|
-
];
|
|
7850
|
-
if (rows.length > 0) {
|
|
7851
|
-
lines.push(
|
|
7852
|
-
"",
|
|
7853
|
-
`| primitive | Claude Code | ${host} |`,
|
|
7854
|
-
"| --- | --- | --- |",
|
|
7855
|
-
...rows.map(
|
|
7856
|
-
(r) => `| \`${r.primitive}\` | ${cell(code(r.claude))} | ${cell(code(r.codex))} |`
|
|
7857
|
-
)
|
|
7858
|
-
);
|
|
7859
|
-
}
|
|
7860
|
-
if (notes.length > 0) {
|
|
7861
|
-
lines.push("", "Caveats \u2014 these hold for the whole artifact:", "");
|
|
7862
|
-
for (const n of notes) lines.push(`- ${n}`);
|
|
7863
7831
|
}
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7832
|
+
if (problems.length === 0)
|
|
7833
|
+
return { name: NAME6, status: "pass", message: `installed + trusted: ${ok.join(", ")}` };
|
|
7834
|
+
return {
|
|
7835
|
+
name: NAME6,
|
|
7836
|
+
status: "warn",
|
|
7837
|
+
message: `codex skips hooks that are not installed/trusted \u2014 ${problems.join(", ")}`,
|
|
7838
|
+
fix: fixes.join(" && ")
|
|
7839
|
+
};
|
|
7870
7840
|
}
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7841
|
+
var NAME6;
|
|
7842
|
+
var init_check_codex_hooks = __esm({
|
|
7843
|
+
"src/cli/lib/check-codex-hooks.ts"() {
|
|
7844
|
+
init_codexHookAdd();
|
|
7845
|
+
init_binaryProbe();
|
|
7846
|
+
init_codexHookPlugin();
|
|
7847
|
+
init_codexHookTrust();
|
|
7848
|
+
init_codexPlugins();
|
|
7849
|
+
init_platform();
|
|
7850
|
+
NAME6 = "codex hook plugins";
|
|
7851
|
+
}
|
|
7852
|
+
});
|
|
7880
7853
|
|
|
7881
|
-
|
|
7854
|
+
// src/cli/lib/doctor-registry.ts
|
|
7855
|
+
function checksForHost(host) {
|
|
7856
|
+
return CHECKS.filter((c) => c.hosts.includes(host));
|
|
7882
7857
|
}
|
|
7883
|
-
var
|
|
7884
|
-
var
|
|
7885
|
-
"src/cli/lib/
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
|
|
7858
|
+
var ALL_HOSTS, BOTH, CHECKS;
|
|
7859
|
+
var init_doctor_registry = __esm({
|
|
7860
|
+
"src/cli/lib/doctor-registry.ts"() {
|
|
7861
|
+
init_check_builtin();
|
|
7862
|
+
ALL_HOSTS = ["claude", "codex"];
|
|
7863
|
+
BOTH = ALL_HOSTS;
|
|
7864
|
+
CHECKS = [
|
|
7865
|
+
// Node runtime version — `process.versions.node`, no harness surface at all.
|
|
7866
|
+
{ name: "node \u2265 22", hosts: BOTH, fn: async () => checkNodeVersion() },
|
|
7867
|
+
// claude-only: check-builtin.ts checkMcpScope early-returns unless
|
|
7868
|
+
// detectPlatform().id === 'claude'; it reads ~/.claude.json + project .mcp.json.
|
|
7869
|
+
{ name: "mcp scope", hosts: ["claude"], fn: checkMcpScope },
|
|
7870
|
+
// PATH probe (`where`/`which jq`) — the install hint switches on OS, not host.
|
|
7871
|
+
{ name: "jq present", hosts: BOTH, fn: async () => checkJq() },
|
|
7872
|
+
// resolveBash() PATH inspection. Its early return is an OS gate (non-Windows),
|
|
7873
|
+
// NOT a host gate — both harnesses need a usable bash on Windows.
|
|
7874
|
+
{ name: "bash flavor (win)", hosts: BOTH, fn: async () => checkWinBash() },
|
|
7875
|
+
// git remote of the cwd — no harness surface.
|
|
7876
|
+
{
|
|
7877
|
+
name: "origin URL",
|
|
7878
|
+
hosts: BOTH,
|
|
7879
|
+
fn: async () => {
|
|
7880
|
+
const { checkOrigin: checkOrigin2 } = await Promise.resolve().then(() => (init_origin_check(), origin_check_exports));
|
|
7881
|
+
const r = checkOrigin2(process.cwd(), { allowFork: true });
|
|
7882
|
+
return { name: "origin URL", status: r.status, message: r.detail, fix: r.fix };
|
|
7883
|
+
}
|
|
7884
|
+
},
|
|
7885
|
+
// PATH probe + harnessSkillsDirs() (which spans BOTH harnesses' skills dirs).
|
|
7886
|
+
{
|
|
7887
|
+
name: "gstack prefix",
|
|
7888
|
+
hosts: BOTH,
|
|
7889
|
+
fn: async () => {
|
|
7890
|
+
const { probeGstackPrefix: probeGstackPrefix2 } = await Promise.resolve().then(() => (init_probe_gstack(), probe_gstack_exports));
|
|
7891
|
+
const r = probeGstackPrefix2();
|
|
7892
|
+
return { name: "gstack prefix", status: r.status, message: r.detail, fix: r.fix };
|
|
7893
|
+
}
|
|
7894
|
+
},
|
|
7895
|
+
// Reads the packaged manifests/aliases.yaml — harness-independent.
|
|
7896
|
+
{
|
|
7897
|
+
name: "deprecated manifests",
|
|
7898
|
+
hosts: BOTH,
|
|
7899
|
+
fn: async () => (await Promise.resolve().then(() => (init_check_deprecations(), check_deprecations_exports))).checkDeprecations()
|
|
7900
|
+
},
|
|
7901
|
+
// getSkillsDir() — descriptor-resolved, so it audits whichever harness is active.
|
|
7902
|
+
{
|
|
7903
|
+
name: "token budget",
|
|
7904
|
+
hosts: BOTH,
|
|
7905
|
+
fn: async () => (await Promise.resolve().then(() => (init_check_token_budget(), check_token_budget_exports))).checkTokenBudget()
|
|
7906
|
+
},
|
|
7907
|
+
// claude-only: Agent Teams is a Claude Code env key; the check early-returns
|
|
7908
|
+
// unless detectPlatform().id === 'claude'.
|
|
7909
|
+
{
|
|
7910
|
+
name: "Agent Teams env",
|
|
7911
|
+
hosts: ["claude"],
|
|
7912
|
+
fn: async () => (await Promise.resolve().then(() => (init_check_agent_teams_doctor(), check_agent_teams_doctor_exports))).checkAgentTeamsDoctor()
|
|
7913
|
+
},
|
|
7914
|
+
// claude-only: probes the CC plugin CACHE and early-returns when
|
|
7915
|
+
// getPluginsRegistry() is null (codex has no installed_plugins.json).
|
|
7916
|
+
{
|
|
7917
|
+
name: "planning-with-files plugin",
|
|
7918
|
+
hosts: ["claude"],
|
|
7919
|
+
fn: async () => (await Promise.resolve().then(() => (init_check_planning_with_files(), check_planning_with_files_exports))).checkPlanningWithFiles()
|
|
7920
|
+
},
|
|
7921
|
+
// Both: the plugin-cache probe is registry-gated but the skill probes span
|
|
7922
|
+
// harnessSkillsDirs(), and install_commands computes `--agent` per host.
|
|
7923
|
+
{
|
|
7924
|
+
name: "mattpocock-skills",
|
|
7925
|
+
hosts: BOTH,
|
|
7926
|
+
fn: async () => (await Promise.resolve().then(() => (init_check_mattpocock_skills(), check_mattpocock_skills_exports))).checkMattpocockSkills()
|
|
7927
|
+
},
|
|
7928
|
+
// Both: isMcpServerRegistered branches on codex → `[mcp_servers.*]` in config.toml.
|
|
7929
|
+
{
|
|
7930
|
+
name: "MCP servers (tavily/exa)",
|
|
7931
|
+
hosts: BOTH,
|
|
7932
|
+
fn: async () => (await Promise.resolve().then(() => (init_check_mcp_availability(), check_mcp_availability_exports))).checkMcpAvailability()
|
|
7933
|
+
},
|
|
7934
|
+
// Phase 18 — opt-in CodeGraph semantic-index detect (always 'pass'; absence of an
|
|
7935
|
+
// optional tool is not a health failure). Project-local `.codegraph/` — no host surface.
|
|
7936
|
+
{
|
|
7937
|
+
name: "codegraph",
|
|
7938
|
+
hosts: BOTH,
|
|
7939
|
+
fn: async () => (await Promise.resolve().then(() => (init_check_codegraph(), check_codegraph_exports))).checkCodeGraph(process.cwd())
|
|
7940
|
+
},
|
|
7941
|
+
// v4.16.1 T3 — bun presence (warn-only): gstack's upstream setup hard-requires
|
|
7942
|
+
// bun; missing bun is THE gstack refresh-failure cause on user dogfood machines.
|
|
7943
|
+
// Pure PATH probe.
|
|
7944
|
+
{ name: "bun present", hosts: BOTH, fn: async () => (await Promise.resolve().then(() => (init_check_bun(), check_bun_exports))).checkBun() },
|
|
7945
|
+
// 4.22.1 T4 — dual-guard conflict (warn-only): ECC GateGuard's filename policy
|
|
7946
|
+
// vs evidence-guard artifact contract names (subagents cannot fact-retry).
|
|
7947
|
+
// Both: only the settings.json signal degrades on codex — the ecc-plugin signal
|
|
7948
|
+
// goes through isPluginRegistered (which asks `codex plugin list` there) and the
|
|
7949
|
+
// env signal is host-free. ECC ships a codex channel, so the conflict is real there.
|
|
7950
|
+
{
|
|
7951
|
+
name: "guard conflict (GateGuard)",
|
|
7952
|
+
hosts: BOTH,
|
|
7953
|
+
fn: async () => (await Promise.resolve().then(() => (init_check_guard_conflict(), check_guard_conflict_exports))).checkGuardConflict()
|
|
7954
|
+
},
|
|
7955
|
+
// 4.23.0 (issue #3) — installed workflow-skill integrity (warn-only): flat
|
|
7956
|
+
// ~/.claude/skills packs can silently shadow shipped workflows; setup self-heals.
|
|
7957
|
+
// getSkillsDir() — per-host install dir, so it audits either harness.
|
|
7958
|
+
{
|
|
7959
|
+
name: "workflow skill integrity",
|
|
7960
|
+
hosts: BOTH,
|
|
7961
|
+
fn: async () => (await Promise.resolve().then(() => (init_check_skill_integrity(), check_skill_integrity_exports))).checkSkillIntegrity()
|
|
7962
|
+
},
|
|
7963
|
+
// Phase 20 — "update available" version check ('warn' only when behind; 'pass'
|
|
7964
|
+
// when current/ahead/npm-unreachable — fail-soft, never flips the summary).
|
|
7965
|
+
// Compares package.json against npm — no harness surface.
|
|
7966
|
+
{
|
|
7967
|
+
name: "update",
|
|
7968
|
+
hosts: BOTH,
|
|
7969
|
+
fn: async () => (await Promise.resolve().then(() => (init_check_update(), check_update_exports))).checkUpdate()
|
|
7970
|
+
},
|
|
7971
|
+
// 4.32.4 — dual install-channel conflict (warn-only): npm-global + standalone
|
|
7972
|
+
// binary both present → ambiguous PATH resolution + stale-update trap. The
|
|
7973
|
+
// harnessed CLI's own install, independent of which harness drives it.
|
|
7974
|
+
{
|
|
7975
|
+
name: "install channel",
|
|
7976
|
+
hosts: BOTH,
|
|
7977
|
+
fn: async () => (await Promise.resolve().then(() => (init_check_install_channels(), check_install_channels_exports))).checkInstallChannels()
|
|
7978
|
+
},
|
|
7979
|
+
// issue #8 — orphaned harnessed Stop/UserPromptSubmit hooks (warn-only): a hook
|
|
7980
|
+
// pointing at a deleted bin/*.mjs makes Claude Code error MODULE_NOT_FOUND every
|
|
7981
|
+
// prompt; `harnessed uninstall` now strips them. claude-only: the whole check is
|
|
7982
|
+
// a settings.json read, and getSettingsPath() is null on codex.
|
|
7983
|
+
{
|
|
7984
|
+
name: "stale hooks",
|
|
7985
|
+
hosts: ["claude"],
|
|
7986
|
+
fn: async () => (await Promise.resolve().then(() => (init_check_stale_hooks(), check_stale_hooks_exports))).checkStaleHooks()
|
|
7987
|
+
},
|
|
7988
|
+
// 4.32.22 — ECC per-harness detect (optional; pass unless CC-side ecc overlaps
|
|
7989
|
+
// the official chrome-devtools-mcp plugin → warn). CC plugin registry + codex
|
|
7990
|
+
// sync-clone probed independently — by construction a both-hosts check.
|
|
7991
|
+
{ name: "ecc", hosts: BOTH, fn: async () => (await Promise.resolve().then(() => (init_check_ecc(), check_ecc_exports))).checkEcc() },
|
|
7992
|
+
// 4.38.0 — half-installed per-turn injection (warn-only): perturn-inject
|
|
7993
|
+
// without perturn-inject-invalidate keeps skipping <project-context> after a
|
|
7994
|
+
// compact/clear has already dropped the copy it is skipping on behalf of.
|
|
7995
|
+
// claude-only: pairs two settings.json hook registrations (null path on codex).
|
|
7996
|
+
{
|
|
7997
|
+
name: "per-turn inject pairing",
|
|
7998
|
+
hosts: ["claude"],
|
|
7999
|
+
fn: async () => (await Promise.resolve().then(() => (init_check_inject_invalidate(), check_inject_invalidate_exports))).checkInjectInvalidate()
|
|
8000
|
+
},
|
|
8001
|
+
// Phase 56 — silently stale marketplace plugins (warn-only): `claude plugin
|
|
8002
|
+
// install` pins a version into a versioned cache dir and never re-resolves, so
|
|
8003
|
+
// the four cc-plugin-marketplace components drift behind without any signal.
|
|
8004
|
+
// The only comparison in the codebase between a genuinely DETECTED version and
|
|
8005
|
+
// a recorded one — see the header for why the installer-state layer cannot do it.
|
|
8006
|
+
// claude-only: needs the installed_plugins.json registry (null on codex).
|
|
8007
|
+
{
|
|
8008
|
+
name: "plugin install freshness",
|
|
8009
|
+
hosts: ["claude"],
|
|
8010
|
+
fn: async () => (await Promise.resolve().then(() => (init_check_plugin_staleness(), check_plugin_staleness_exports))).checkPluginStaleness()
|
|
8011
|
+
},
|
|
8012
|
+
// Phase 60 — HARNESSED_OFF left on (warn-only): the kill switch silences every
|
|
8013
|
+
// first-party hook, so a machine that forgot to unset it looks exactly like a
|
|
8014
|
+
// broken install. doctor is where that gets said out loud. Env var — and the
|
|
8015
|
+
// hooks it silences exist on both harnesses.
|
|
8016
|
+
{
|
|
8017
|
+
name: "ablation switch",
|
|
8018
|
+
hosts: BOTH,
|
|
8019
|
+
fn: async () => (await Promise.resolve().then(() => (init_check_ablation(), check_ablation_exports))).checkAblation()
|
|
8020
|
+
},
|
|
8021
|
+
// v16.0 Phase 64 (ADR 0041) — codex hook plugins (warn-only): codex silently
|
|
8022
|
+
// skips an untrusted / modified hook, so "installed" is not "running". codex-only:
|
|
8023
|
+
// the check early-returns unless the active platform id is `codex`.
|
|
8024
|
+
{
|
|
8025
|
+
name: "codex hook plugins",
|
|
8026
|
+
hosts: ["codex"],
|
|
8027
|
+
fn: async () => (await Promise.resolve().then(() => (init_check_codex_hooks(), check_codex_hooks_exports))).checkCodexHooks()
|
|
8028
|
+
}
|
|
8029
|
+
];
|
|
7896
8030
|
}
|
|
7897
8031
|
});
|
|
7898
8032
|
|
|
@@ -8097,8 +8231,8 @@ var init_before_spawn = __esm({
|
|
|
8097
8231
|
_implCache = /* @__PURE__ */ new Map();
|
|
8098
8232
|
}
|
|
8099
8233
|
});
|
|
8100
|
-
function
|
|
8101
|
-
return e instanceof GateEvalError &&
|
|
8234
|
+
function isStaticGateConfigError(e) {
|
|
8235
|
+
return e instanceof GateEvalError && STATIC_CONFIG_ERROR.test(e.message);
|
|
8102
8236
|
}
|
|
8103
8237
|
function evalGate(expression, context) {
|
|
8104
8238
|
try {
|
|
@@ -8116,7 +8250,7 @@ function evalGate(expression, context) {
|
|
|
8116
8250
|
throw new GateEvalError(`Gate eval failed: ${err2.message}`, expression);
|
|
8117
8251
|
}
|
|
8118
8252
|
}
|
|
8119
|
-
var PARSER_OPTIONS, _parserSingleton, GateEvalError;
|
|
8253
|
+
var PARSER_OPTIONS, _parserSingleton, GateEvalError, STATIC_CONFIG_ERROR;
|
|
8120
8254
|
var init_exprBuilder = __esm({
|
|
8121
8255
|
"src/workflow/exprBuilder.ts"() {
|
|
8122
8256
|
PARSER_OPTIONS = {
|
|
@@ -8140,6 +8274,7 @@ var init_exprBuilder = __esm({
|
|
|
8140
8274
|
}
|
|
8141
8275
|
expression;
|
|
8142
8276
|
};
|
|
8277
|
+
STATIC_CONFIG_ERROR = /undefined variable|cannot read propert(?:y|ies) of (?:undefined|null)|parse error/i;
|
|
8143
8278
|
}
|
|
8144
8279
|
});
|
|
8145
8280
|
var GovernanceStatus, GovernanceV1;
|
|
@@ -9337,14 +9472,14 @@ async function runMasterOrchestrator(masterName, context, packageRoot, spawnDriv
|
|
|
9337
9472
|
const veto = await resolveSkipVeto(clause.skip_gate, context, packageRoot);
|
|
9338
9473
|
gateEvalled.push(veto ? { clause, passes: false, reason: veto } : { clause, passes: true });
|
|
9339
9474
|
} catch (e) {
|
|
9340
|
-
if (
|
|
9475
|
+
if (isStaticGateConfigError(e)) {
|
|
9341
9476
|
console.warn(
|
|
9342
|
-
`\u26A0\uFE0F master ${masterName} sub ${clause.sub} gate ${clause.gate}
|
|
9477
|
+
`\u26A0\uFE0F master ${masterName} sub ${clause.sub} gate ${clause.gate} cannot be evaluated against the gate context (${e.message}). Treating as NOT fired (fail-closed for config errors) \u2014 fix the judgments yaml expression or supply the variable via --context / gateContext defaults.`
|
|
9343
9478
|
);
|
|
9344
9479
|
gateEvalled.push({
|
|
9345
9480
|
clause,
|
|
9346
9481
|
passes: false,
|
|
9347
|
-
reason: `gate ${clause.gate} misconfigured (
|
|
9482
|
+
reason: `gate ${clause.gate} misconfigured (expression/context drift) \u2014 fail-closed, not fired`
|
|
9348
9483
|
});
|
|
9349
9484
|
} else {
|
|
9350
9485
|
console.warn(
|
|
@@ -9589,9 +9724,9 @@ async function runWorkflow(yamlPath, vars, opts = {}) {
|
|
|
9589
9724
|
try {
|
|
9590
9725
|
fires = await resolveJudgmentGate(ph.gate, gateContext, packageRoot);
|
|
9591
9726
|
} catch (err2) {
|
|
9592
|
-
if (
|
|
9727
|
+
if (isStaticGateConfigError(err2)) {
|
|
9593
9728
|
console.warn(
|
|
9594
|
-
`\u26A0\uFE0F phase ${ph.id} gate ${ph.gate}
|
|
9729
|
+
`\u26A0\uFE0F phase ${ph.id} gate ${ph.gate} cannot be evaluated against the gate context (${err2.message}) \u2014 a missing variable, \`in\` against a missing/null member, or an unparseable expression. Treating as NOT fired (fail-closed for config errors) \u2014 fix the judgments yaml expression or supply the fact via --context / gateContext defaults.`
|
|
9595
9730
|
);
|
|
9596
9731
|
fires = false;
|
|
9597
9732
|
} else {
|
|
@@ -9844,7 +9979,9 @@ function resolveCapabilityCmd(capability, installedPlugins, installedUserSkills,
|
|
|
9844
9979
|
anyDetected = true;
|
|
9845
9980
|
break;
|
|
9846
9981
|
}
|
|
9847
|
-
missingHints.push(
|
|
9982
|
+
missingHints.push(
|
|
9983
|
+
host === "codex" ? `plugin '${plugin_id}' is distributed as a Claude Code plugin and this host has no plugin registry \u2014 unavailable here, no install can change that; treat steps that call it as skipped (record the skip) rather than substituting an equivalent` : `plugin '${plugin_id}' (\`claude plugin install ${plugin_id}\`)`
|
|
9984
|
+
);
|
|
9848
9985
|
} else {
|
|
9849
9986
|
if (!skill_dir) {
|
|
9850
9987
|
missingHints.push(
|
|
@@ -9897,6 +10034,34 @@ var init_capabilityResolver = __esm({
|
|
|
9897
10034
|
CAPABILITY_CMD_TEMPLATE = /\{\{\s*capabilities\.([a-zA-Z0-9_-]+)\.cmd\s*\}\}/g;
|
|
9898
10035
|
}
|
|
9899
10036
|
});
|
|
10037
|
+
function userLangPinPath() {
|
|
10038
|
+
return join(detectPlatform().stateRoot, USER_LANG_PIN);
|
|
10039
|
+
}
|
|
10040
|
+
async function writeUserLangPin(code2) {
|
|
10041
|
+
const path = userLangPinPath();
|
|
10042
|
+
await mkdir(detectPlatform().stateRoot, { recursive: true });
|
|
10043
|
+
await writeFile(path, `${code2}
|
|
10044
|
+
`, "utf8");
|
|
10045
|
+
return path;
|
|
10046
|
+
}
|
|
10047
|
+
function readUserLangPin() {
|
|
10048
|
+
let raw;
|
|
10049
|
+
try {
|
|
10050
|
+
raw = readFileSync(userLangPinPath(), "utf8");
|
|
10051
|
+
} catch {
|
|
10052
|
+
return void 0;
|
|
10053
|
+
}
|
|
10054
|
+
const value = raw.trim();
|
|
10055
|
+
return SUPPORTED2.includes(value) ? value : void 0;
|
|
10056
|
+
}
|
|
10057
|
+
var SUPPORTED2, USER_LANG_PIN;
|
|
10058
|
+
var init_userLangPin = __esm({
|
|
10059
|
+
"src/cli/lib/userLangPin.ts"() {
|
|
10060
|
+
init_platform();
|
|
10061
|
+
SUPPORTED2 = ["en", "zh-Hans"];
|
|
10062
|
+
USER_LANG_PIN = "user-lang";
|
|
10063
|
+
}
|
|
10064
|
+
});
|
|
9900
10065
|
|
|
9901
10066
|
// src/cli/prompt.ts
|
|
9902
10067
|
var prompt_exports = {};
|
|
@@ -10017,7 +10182,7 @@ async function renderPreserveCategories(categories, packageRoot, host) {
|
|
|
10017
10182
|
}
|
|
10018
10183
|
}
|
|
10019
10184
|
async function buildLanguageSection(packageRoot, host = toHostId(detectPlatform().id)) {
|
|
10020
|
-
const code2 = process.env.HARNESSED_USER_LANG;
|
|
10185
|
+
const code2 = process.env.HARNESSED_USER_LANG || readUserLangPin();
|
|
10021
10186
|
if (!code2) return "";
|
|
10022
10187
|
const name = LANG_NAMES[code2] ?? code2;
|
|
10023
10188
|
const categories = await renderPreserveCategories(
|
|
@@ -10127,6 +10292,7 @@ var init_prompt = __esm({
|
|
|
10127
10292
|
init_capabilityResolver();
|
|
10128
10293
|
init_hostPrimitives();
|
|
10129
10294
|
init_rolePromptHostRender();
|
|
10295
|
+
init_userLangPin();
|
|
10130
10296
|
DEFAULT_MAX_ITERATIONS = 20;
|
|
10131
10297
|
DEFAULT_MODEL = "sonnet";
|
|
10132
10298
|
DEFAULT_SPECIALIST = "Implementation Engineer";
|
|
@@ -10412,13 +10578,13 @@ async function runGatesPlan(master, raw, deps = defaultRunDeps) {
|
|
|
10412
10578
|
if (veto) skip.push({ sub: clause.sub, reason: veto });
|
|
10413
10579
|
else fire.push(fireEntry(clause, master));
|
|
10414
10580
|
} catch (e) {
|
|
10415
|
-
if (
|
|
10581
|
+
if (isStaticGateConfigError(e)) {
|
|
10416
10582
|
deps.warn(
|
|
10417
|
-
`\u26A0\uFE0F master ${master} sub ${clause.sub} gate ${clause.gate}
|
|
10583
|
+
`\u26A0\uFE0F master ${master} sub ${clause.sub} gate ${clause.gate} cannot be evaluated against the gate context (${e.message}). Treating as NOT fired (fail-closed for config errors) \u2014 fix the judgments yaml expression or supply the variable via --context / gateContext defaults.`
|
|
10418
10584
|
);
|
|
10419
10585
|
skip.push({
|
|
10420
10586
|
sub: clause.sub,
|
|
10421
|
-
reason: `gate ${clause.gate} misconfigured (
|
|
10587
|
+
reason: `gate ${clause.gate} misconfigured (expression/context drift) \u2014 fail-closed, not fired`
|
|
10422
10588
|
});
|
|
10423
10589
|
} else {
|
|
10424
10590
|
deps.warn(
|
|
@@ -11825,6 +11991,7 @@ var init_mcpHttpAdd2 = __esm({
|
|
|
11825
11991
|
init_security();
|
|
11826
11992
|
init_platform();
|
|
11827
11993
|
init_backup();
|
|
11994
|
+
init_codexMcpServers();
|
|
11828
11995
|
init_confirm();
|
|
11829
11996
|
init_diff();
|
|
11830
11997
|
init_err();
|
|
@@ -11979,9 +12146,11 @@ ${newEntry}
|
|
|
11979
12146
|
)
|
|
11980
12147
|
};
|
|
11981
12148
|
}
|
|
12149
|
+
if (bin === "codex") invalidateCodexMcpCache();
|
|
11982
12150
|
const registered = await isMcpServerRegistered(name);
|
|
11983
12151
|
if (!registered) {
|
|
11984
|
-
const cfgLabel = bin === "codex" ? "
|
|
12152
|
+
const cfgLabel = bin === "codex" ? "the `codex mcp list --json` listing" : "mcpServers map of ~/.claude.json";
|
|
12153
|
+
const cfgHint = bin === "codex" ? "the add reported success but the listing does not show it \u2014 `codex mcp add` may have written under a different CODEX_HOME, or the listing could not be parsed" : `file may have been overwritten, or ${bin} mcp add wrote to a non-default location`;
|
|
11985
12154
|
return {
|
|
11986
12155
|
ok: false,
|
|
11987
12156
|
phase: "verify",
|
|
@@ -11989,7 +12158,7 @@ ${newEntry}
|
|
|
11989
12158
|
error: err(
|
|
11990
12159
|
ctx,
|
|
11991
12160
|
"/spec/verify/cmd",
|
|
11992
|
-
`verify: '${name}' not found in ${cfgLabel} after install spawn exit 0 (
|
|
12161
|
+
`verify: '${name}' not found in ${cfgLabel} after install spawn exit 0 (${cfgHint})`,
|
|
11993
12162
|
"verify-failed"
|
|
11994
12163
|
)
|
|
11995
12164
|
};
|
|
@@ -12007,6 +12176,7 @@ var init_mcpStdioAdd2 = __esm({
|
|
|
12007
12176
|
init_security();
|
|
12008
12177
|
init_platform();
|
|
12009
12178
|
init_backup();
|
|
12179
|
+
init_codexMcpServers();
|
|
12010
12180
|
init_confirm();
|
|
12011
12181
|
init_diff();
|
|
12012
12182
|
init_err();
|
|
@@ -12127,9 +12297,11 @@ ${newEntry}
|
|
|
12127
12297
|
)
|
|
12128
12298
|
};
|
|
12129
12299
|
}
|
|
12300
|
+
if (bin === "codex") invalidateCodexMcpCache();
|
|
12130
12301
|
const registered = await isMcpServerRegistered(name);
|
|
12131
12302
|
if (!registered) {
|
|
12132
|
-
const cfgLabel = bin === "codex" ? "
|
|
12303
|
+
const cfgLabel = bin === "codex" ? "the `codex mcp list --json` listing" : "mcpServers map of ~/.claude.json";
|
|
12304
|
+
const cfgHint = bin === "codex" ? "the add reported success but the listing does not show it \u2014 `codex mcp add` may have written under a different CODEX_HOME, or the listing could not be parsed" : `file may have been overwritten, or ${bin} mcp add wrote to a non-default location`;
|
|
12133
12305
|
return {
|
|
12134
12306
|
ok: false,
|
|
12135
12307
|
phase: "verify",
|
|
@@ -12137,7 +12309,7 @@ ${newEntry}
|
|
|
12137
12309
|
error: err(
|
|
12138
12310
|
ctx,
|
|
12139
12311
|
"/spec/verify/cmd",
|
|
12140
|
-
`verify: '${name}' not found in ${cfgLabel} after install spawn exit 0 (
|
|
12312
|
+
`verify: '${name}' not found in ${cfgLabel} after install spawn exit 0 (${cfgHint})`,
|
|
12141
12313
|
"verify-failed"
|
|
12142
12314
|
)
|
|
12143
12315
|
};
|
|
@@ -14054,6 +14226,61 @@ function registerAdvance(program2) {
|
|
|
14054
14226
|
});
|
|
14055
14227
|
}
|
|
14056
14228
|
|
|
14229
|
+
// src/cli/agents-md.ts
|
|
14230
|
+
init_i18n();
|
|
14231
|
+
init_assetsRoot();
|
|
14232
|
+
init_platform();
|
|
14233
|
+
init_agentsMd();
|
|
14234
|
+
function registerAgentsMd(program2) {
|
|
14235
|
+
program2.command("agents-md").description(
|
|
14236
|
+
"Write the harnessed block into <CODEX_HOME>/AGENTS.md (marker-delimited, idempotent) \u2014 command list + host-primitive glossary, all derived; your own prose outside the markers is untouched"
|
|
14237
|
+
).option("--dry-run", "print what would be written; touch nothing").option("--remove", "strip the harnessed block (leaves the rest of the file alone)").action(async (raw) => {
|
|
14238
|
+
const platform = detectPlatform();
|
|
14239
|
+
if (platform.id !== "codex") {
|
|
14240
|
+
console.error(
|
|
14241
|
+
`harness-mismatch: AGENTS.md is codex's session-start contract; this process resolved to '${platform.id}'. Nothing written \u2014 run this from codex, or force the host with HARNESSED_PLATFORM=codex, because a copy nobody reads is worse than no copy.`
|
|
14242
|
+
);
|
|
14243
|
+
process.exitCode = 1;
|
|
14244
|
+
return;
|
|
14245
|
+
}
|
|
14246
|
+
const locale = getLocale();
|
|
14247
|
+
try {
|
|
14248
|
+
const r = await runAgentsMd({
|
|
14249
|
+
workflowsDir: join(getAssetsRoot(), "workflows"),
|
|
14250
|
+
dryRun: raw.dryRun === true,
|
|
14251
|
+
remove: raw.remove === true,
|
|
14252
|
+
locale: locale === "zh-Hans" ? "zh-Hans" : "en"
|
|
14253
|
+
});
|
|
14254
|
+
switch (r.status) {
|
|
14255
|
+
case "preview":
|
|
14256
|
+
console.log(r.section.trimEnd());
|
|
14257
|
+
console.log(
|
|
14258
|
+
`
|
|
14259
|
+
[dry-run] would ${r.action} the block above in ${r.path}. Nothing outside the markers is touched.`
|
|
14260
|
+
);
|
|
14261
|
+
break;
|
|
14262
|
+
case "written":
|
|
14263
|
+
console.log(
|
|
14264
|
+
`${r.action === "replace" ? "refreshed" : "wrote"} the harnessed block in ${r.path}`
|
|
14265
|
+
);
|
|
14266
|
+
break;
|
|
14267
|
+
case "removed":
|
|
14268
|
+
console.log(`removed the harnessed block from ${r.path}`);
|
|
14269
|
+
break;
|
|
14270
|
+
case "unchanged":
|
|
14271
|
+
console.log(`${r.path} already up to date \u2014 nothing to do`);
|
|
14272
|
+
break;
|
|
14273
|
+
case "absent":
|
|
14274
|
+
console.log(`${r.path} does not exist \u2014 nothing to remove`);
|
|
14275
|
+
break;
|
|
14276
|
+
}
|
|
14277
|
+
} catch (e) {
|
|
14278
|
+
console.error(`agents-md failed: ${e.message}`);
|
|
14279
|
+
process.exitCode = 1;
|
|
14280
|
+
}
|
|
14281
|
+
});
|
|
14282
|
+
}
|
|
14283
|
+
|
|
14057
14284
|
// src/cli/audit.ts
|
|
14058
14285
|
init_validate();
|
|
14059
14286
|
|
|
@@ -16726,6 +16953,7 @@ async function enableAgentTeamsInSettings() {
|
|
|
16726
16953
|
// src/cli/lib/enableUserLangInSettings.ts
|
|
16727
16954
|
init_platform();
|
|
16728
16955
|
init_settingsWriter();
|
|
16956
|
+
init_userLangPin();
|
|
16729
16957
|
var ENV_KEY2 = "HARNESSED_USER_LANG";
|
|
16730
16958
|
function detectUserLang(override) {
|
|
16731
16959
|
if (override) {
|
|
@@ -16745,13 +16973,17 @@ function safeIntlLocale2() {
|
|
|
16745
16973
|
}
|
|
16746
16974
|
async function enableUserLangInSettings(override) {
|
|
16747
16975
|
const platform = detectPlatform();
|
|
16976
|
+
const detected = detectUserLang(override);
|
|
16748
16977
|
if (!platform.supportsEnvKeyWrite) {
|
|
16749
|
-
|
|
16750
|
-
status: "
|
|
16751
|
-
|
|
16752
|
-
|
|
16978
|
+
try {
|
|
16979
|
+
return { status: "pinned", path: await writeUserLangPin(detected), detected };
|
|
16980
|
+
} catch (e) {
|
|
16981
|
+
return {
|
|
16982
|
+
status: "warn",
|
|
16983
|
+
message: `platform '${platform.id}' has no env-key store and the ${ENV_KEY2} pin could not be written (${e.message})`
|
|
16984
|
+
};
|
|
16985
|
+
}
|
|
16753
16986
|
}
|
|
16754
|
-
const detected = detectUserLang(override);
|
|
16755
16987
|
const r = await mergeSettingsEnvKey(ENV_KEY2, detected, {
|
|
16756
16988
|
skipIfPresent: () => override === void 0
|
|
16757
16989
|
});
|
|
@@ -17010,7 +17242,7 @@ var V3_4_3_SIGNATURE_MASTER_RX = /\*\*Preferred path\*\*[\s\S]*dispatch to the p
|
|
|
17010
17242
|
function shouldOverwriteFile(content) {
|
|
17011
17243
|
return HARNESSED_MARKER_RX2.test(content) || V3_4_3_SIGNATURE_SUB_RX.test(content) || V3_4_3_SIGNATURE_MASTER_RX.test(content);
|
|
17012
17244
|
}
|
|
17013
|
-
async function writeAllCommands(slashNames, commandsDir, rolePrompts, capabilities, installedPlugins, installedUserSkills, writer, fileExists2 = existsSync,
|
|
17245
|
+
async function writeAllCommands(slashNames, commandsDir, rolePrompts, capabilities, installedPlugins, installedUserSkills, writer, fileExists2 = existsSync, readFileSync26 = (p8) => readFileSync(p8, "utf8"), hostRender) {
|
|
17014
17246
|
const results = [];
|
|
17015
17247
|
const aggregatedWarnings = /* @__PURE__ */ new Set();
|
|
17016
17248
|
for (const name of slashNames) {
|
|
@@ -17029,7 +17261,7 @@ async function writeAllCommands(slashNames, commandsDir, rolePrompts, capabiliti
|
|
|
17029
17261
|
if (fileExists2(path)) {
|
|
17030
17262
|
let existing = "";
|
|
17031
17263
|
try {
|
|
17032
|
-
existing =
|
|
17264
|
+
existing = readFileSync26(path);
|
|
17033
17265
|
} catch {
|
|
17034
17266
|
existing = "";
|
|
17035
17267
|
}
|
|
@@ -17151,6 +17383,7 @@ async function renderSkillFile(skillName, skillsBase, capabilities, installedPlu
|
|
|
17151
17383
|
const needsWrite = localeBodySelected || finalBody !== body;
|
|
17152
17384
|
if (!needsWrite) {
|
|
17153
17385
|
result.warnings = rendered.warnings;
|
|
17386
|
+
await stripLocaleSiblings(dir);
|
|
17154
17387
|
return result;
|
|
17155
17388
|
}
|
|
17156
17389
|
try {
|
|
@@ -17161,17 +17394,18 @@ async function renderSkillFile(skillName, skillsBase, capabilities, installedPlu
|
|
|
17161
17394
|
result.error = `write failed: ${e.message}`;
|
|
17162
17395
|
return result;
|
|
17163
17396
|
}
|
|
17164
|
-
|
|
17165
|
-
|
|
17166
|
-
|
|
17167
|
-
|
|
17168
|
-
|
|
17169
|
-
|
|
17170
|
-
|
|
17171
|
-
|
|
17397
|
+
await stripLocaleSiblings(dir);
|
|
17398
|
+
return result;
|
|
17399
|
+
}
|
|
17400
|
+
async function stripLocaleSiblings(dir) {
|
|
17401
|
+
for (const loc of LOCALE_SIBLINGS) {
|
|
17402
|
+
const sibling = skillBodyFilename(loc);
|
|
17403
|
+
if (sibling === "SKILL.md") continue;
|
|
17404
|
+
try {
|
|
17405
|
+
await rm(join(dir, sibling), { force: true });
|
|
17406
|
+
} catch {
|
|
17172
17407
|
}
|
|
17173
17408
|
}
|
|
17174
|
-
return result;
|
|
17175
17409
|
}
|
|
17176
17410
|
async function renderAllSkills(skillNames, skillsBase, workflowsDir, homedirOverride, locale, host) {
|
|
17177
17411
|
const resolvedLocale = locale ?? getLocale();
|
|
@@ -18503,6 +18737,20 @@ async function runUnifiedUninstall(home, dryRun) {
|
|
|
18503
18737
|
failures.push(`${path}: ${e.message}`);
|
|
18504
18738
|
}
|
|
18505
18739
|
}
|
|
18740
|
+
let removedAgentsMdBlock = false;
|
|
18741
|
+
if (platform.id === "codex") {
|
|
18742
|
+
try {
|
|
18743
|
+
const { agentsMdPath: agentsMdPath2, stripAgentsMdSection: stripAgentsMdSection2 } = await Promise.resolve().then(() => (init_agentsMd(), agentsMd_exports));
|
|
18744
|
+
const p8 = agentsMdPath2();
|
|
18745
|
+
const before = await readFile(p8, "utf8");
|
|
18746
|
+
const after = stripAgentsMdSection2(before);
|
|
18747
|
+
if (after !== before) {
|
|
18748
|
+
await writeFile(p8, after, "utf8");
|
|
18749
|
+
removedAgentsMdBlock = true;
|
|
18750
|
+
}
|
|
18751
|
+
} catch {
|
|
18752
|
+
}
|
|
18753
|
+
}
|
|
18506
18754
|
let removedAgentRoles = 0;
|
|
18507
18755
|
for (const path of agentRoleFiles) {
|
|
18508
18756
|
try {
|
|
@@ -18512,6 +18760,7 @@ async function runUnifiedUninstall(home, dryRun) {
|
|
|
18512
18760
|
failures.push(`${path}: ${e.message}`);
|
|
18513
18761
|
}
|
|
18514
18762
|
}
|
|
18763
|
+
if (removedAgentsMdBlock) console.log(` AGENTS.md: harnessed block removed`);
|
|
18515
18764
|
let removedSkills = 0;
|
|
18516
18765
|
for (const dir of skillDirs) {
|
|
18517
18766
|
try {
|
|
@@ -18875,6 +19124,7 @@ registerReject(program);
|
|
|
18875
19124
|
registerCompact(program);
|
|
18876
19125
|
registerWorkflows(program);
|
|
18877
19126
|
registerExemptGateguard(program);
|
|
19127
|
+
registerAgentsMd(program);
|
|
18878
19128
|
registerLearn(program);
|
|
18879
19129
|
registerUpdate(program);
|
|
18880
19130
|
registerReleasePreflight(program);
|