harnessed 4.16.3 → 4.20.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/dist/cli.mjs +555 -120
- package/dist/cli.mjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/manifests/optional/codegraph.yaml +8 -2
- package/messages/en.json +2 -0
- package/messages/zh-Hans.json +2 -0
- package/package.json +3 -2
- package/workflows/role-prompts.yaml +2 -0
- package/workflows/role-prompts.zh-Hans.yaml +2 -0
- package/workflows/task/code/SKILL.md +9 -2
- package/workflows/task/code/SKILL.zh-Hans.md +9 -2
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { existsSync, mkdirSync, renameSync, writeFileSync, readFileSync, readdirSync, statSync } from 'fs';
|
|
3
3
|
import { homedir } from 'os';
|
|
4
|
-
import { join,
|
|
4
|
+
import { join, resolve, dirname, sep, win32, relative } from 'path';
|
|
5
5
|
import { Type } from '@sinclair/typebox';
|
|
6
6
|
import { readFile, readdir, unlink, writeFile, stat, rm, cp, mkdir, rename, access, appendFile } from 'fs/promises';
|
|
7
7
|
import { Value } from '@sinclair/typebox/value';
|
|
@@ -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.20.0",
|
|
42
42
|
description: "AI coding harness package manager + composition orchestrator",
|
|
43
43
|
type: "module",
|
|
44
44
|
license: "Apache-2.0",
|
|
@@ -106,7 +106,8 @@ var init_package = __esm({
|
|
|
106
106
|
bench: "vitest bench --run",
|
|
107
107
|
lint: "biome check .",
|
|
108
108
|
"lint:fix": "biome check --write .",
|
|
109
|
-
format: "biome format --write ."
|
|
109
|
+
format: "biome format --write .",
|
|
110
|
+
"build:binary": "bun scripts/build-binary.mjs"
|
|
110
111
|
},
|
|
111
112
|
dependencies: {
|
|
112
113
|
"@anthropic-ai/claude-agent-sdk": "0.3.142",
|
|
@@ -570,9 +571,9 @@ async function writeStoreRaw(store) {
|
|
|
570
571
|
const errs = [...Value.Errors(WorkflowStoreV1, store)].map((e) => e.message).join("; ");
|
|
571
572
|
throw new Error(`workflow-store schema validation failed: ${errs}`);
|
|
572
573
|
}
|
|
573
|
-
const
|
|
574
|
-
await mkdir(dirname(
|
|
575
|
-
await writeFileAtomic(
|
|
574
|
+
const p7 = storePath();
|
|
575
|
+
await mkdir(dirname(p7), { recursive: true });
|
|
576
|
+
await writeFileAtomic(p7, JSON.stringify(store, null, 2));
|
|
576
577
|
}
|
|
577
578
|
async function listWorkflows() {
|
|
578
579
|
const store = await readStoreRaw();
|
|
@@ -786,9 +787,9 @@ function scanPhases(repoRoot, includeTasks) {
|
|
|
786
787
|
function scanTasks(dirPath) {
|
|
787
788
|
for (const fname of ["task_plan.md", "progress.md"]) {
|
|
788
789
|
try {
|
|
789
|
-
const
|
|
790
|
-
if (!existsSync(
|
|
791
|
-
const m = /^[ \t]*- \[ \]\s+(.+)$/m.exec(readFileSync(
|
|
790
|
+
const p7 = join(dirPath, fname);
|
|
791
|
+
if (!existsSync(p7)) continue;
|
|
792
|
+
const m = /^[ \t]*- \[ \]\s+(.+)$/m.exec(readFileSync(p7, "utf8"));
|
|
792
793
|
const task = m?.[1];
|
|
793
794
|
if (task) return { nextUnchecked: task.trim() };
|
|
794
795
|
} catch {
|
|
@@ -867,7 +868,7 @@ function deriveNext(snapshot) {
|
|
|
867
868
|
reason: `sub '${failed.sub}' failed ${failed.fail_count}x \u2014 resolve before advancing`
|
|
868
869
|
};
|
|
869
870
|
}
|
|
870
|
-
const firstIncomplete = snapshot.phases.find((
|
|
871
|
+
const firstIncomplete = snapshot.phases.find((p7) => !p7.complete);
|
|
871
872
|
if (firstIncomplete) {
|
|
872
873
|
const task = firstIncomplete.tasks?.nextUnchecked;
|
|
873
874
|
if (task) return { kind: "task", phase: firstIncomplete.phase, task };
|
|
@@ -903,7 +904,7 @@ function describeUnit(unit) {
|
|
|
903
904
|
}
|
|
904
905
|
}
|
|
905
906
|
function remainingPhases(snapshot) {
|
|
906
|
-
return snapshot.phases.filter((
|
|
907
|
+
return snapshot.phases.filter((p7) => !p7.complete).length;
|
|
907
908
|
}
|
|
908
909
|
function pluralPhases(n) {
|
|
909
910
|
return `${n} phase${n === 1 ? "" : "s"} remain`;
|
|
@@ -1555,8 +1556,8 @@ function checkSecurityViolations(doc, filename, lineCounter) {
|
|
|
1555
1556
|
["spec", "verify", "cmd"],
|
|
1556
1557
|
["spec", "uninstall", "cmd"]
|
|
1557
1558
|
];
|
|
1558
|
-
for (const
|
|
1559
|
-
const err2 = checkScalarCmd(doc, lineCounter,
|
|
1559
|
+
for (const p7 of cmdPaths) {
|
|
1560
|
+
const err2 = checkScalarCmd(doc, lineCounter, p7, filename);
|
|
1560
1561
|
if (err2) errors.push(err2);
|
|
1561
1562
|
}
|
|
1562
1563
|
const cleanupNode = doc.getIn(["spec", "uninstall", "cleanup_paths"], true);
|
|
@@ -1735,6 +1736,112 @@ var init_origin_check = __esm({
|
|
|
1735
1736
|
"src/cli/lib/origin-check.ts"() {
|
|
1736
1737
|
}
|
|
1737
1738
|
});
|
|
1739
|
+
|
|
1740
|
+
// messages/en.json
|
|
1741
|
+
var en_default;
|
|
1742
|
+
var init_en = __esm({
|
|
1743
|
+
"messages/en.json"() {
|
|
1744
|
+
en_default = {
|
|
1745
|
+
"setup.workflows_not_found": "error: workflows directory not found at {{path}}",
|
|
1746
|
+
"setup.nothing_to_install": "setup: no workflow directories with SKILL.md found \u2014 nothing to install",
|
|
1747
|
+
"setup.dry_run.header": "[dry-run] setup would install {{count}} workflow(s) to {{path}}:",
|
|
1748
|
+
"setup.dry_run.run_hint": " run without --dry-run to execute",
|
|
1749
|
+
"setup.copy_failed": " error: failed to copy {{name}}: {{message}}",
|
|
1750
|
+
"setup.step_a_complete": "Step A: {{count}} workflows installed to {{path}}",
|
|
1751
|
+
"setup.step_a_render.complete": " generated {{count}}/{{total}} command files",
|
|
1752
|
+
"setup.step_a_render.warnings_header": " [A.5] warnings \u2014 some capability cmds could not be fully resolved:",
|
|
1753
|
+
"setup.step_c.created": " [C] created {{path}} + enabled Agent Teams",
|
|
1754
|
+
"setup.step_c.already_enabled": " [C] Agent Teams already enabled ({{path}})",
|
|
1755
|
+
"setup.step_c.enabled_backup": " [C] enabled Agent Teams in {{path}} (backup saved \u2192 {{backupPath}})",
|
|
1756
|
+
"setup.step_c.skipped": " [C] Agent Teams enable skipped: {{message}}",
|
|
1757
|
+
"setup.step_d.created": " [D] created {{path}} + wrote env.HARNESSED_USER_LANG={{lang}}",
|
|
1758
|
+
"setup.step_d.already_set": " [D] env.HARNESSED_USER_LANG={{lang}} already set in {{path}} \u2014 respecting user override",
|
|
1759
|
+
"setup.step_d.enabled_backup": " [D] wrote env.HARNESSED_USER_LANG={{lang}} in {{path}} (backup saved \u2192 {{backupPath}})",
|
|
1760
|
+
"setup.step_d.skipped": " [D] User language write skipped: {{message}}",
|
|
1761
|
+
"setup.step_b_complete": "Upstream components: {{installed}} installed / {{already}} already-installed / {{skipped}} skipped / {{failed}} failed [{{seconds}}s]",
|
|
1762
|
+
"setup.complete": "setup complete \u2014 {{skills}} workflows + {{manifests}} base manifests configured",
|
|
1763
|
+
"setup.mcp_hint": "Run /mcp in Claude Code to verify MCP server connections.",
|
|
1764
|
+
"setup.mcp_hint_codex": "Run codex mcp list to verify MCP server connections.",
|
|
1765
|
+
"setup.bundled_summary": "\nharnessed workflows bundled at <packageRoot>/workflows/ (share-only, read-only)",
|
|
1766
|
+
"setup.bundled_location": "",
|
|
1767
|
+
"setup.doctor_hint": "\nRun harnessed doctor to verify your environment.",
|
|
1768
|
+
"agent_teams.missing_header": "\n\u26A0\uFE0F Agent Teams not enabled \u2014 parallelism upgrade path unavailable",
|
|
1769
|
+
"agent_teams.missing_fix": " fix: claude config set env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS 1",
|
|
1770
|
+
"agent_teams.missing_explanation": " harnessed task parallelism uses Subagent or Agent Teams (CC 2.1.133+)",
|
|
1771
|
+
"agent_teams.missing_nonblocking": " non-blocking \u2014 auto-degrades to subagent fan-out\n",
|
|
1772
|
+
"install.manifest_not_found": "error: manifest '{{name}}' not found",
|
|
1773
|
+
"install.manifest_not_found.fix": " fix: ensure manifests/tools/{{name}}.yaml, manifests/skill-packs/{{name}}.yaml, or manifests/optional/{{name}}.yaml exists",
|
|
1774
|
+
"install.audit_hint": " fix: run 'harnessed audit' to inspect manifest issues",
|
|
1775
|
+
"install.success": "installed {{name}}",
|
|
1776
|
+
"install.success_with_version": "installed {{name}}@{{version}}",
|
|
1777
|
+
"install.already_installed": "already-installed {{name}} (idempotent check hit; nothing to do)",
|
|
1778
|
+
"install.already_installed_with_version": "already-installed {{name}}@{{version}} (idempotent check hit; nothing to do)",
|
|
1779
|
+
"install.aborted": "aborted: {{reason}}",
|
|
1780
|
+
"uninstall.dry_run.preview": "[dry-run] would uninstall '{{name}}' via method '{{method}}'",
|
|
1781
|
+
"uninstall.dry_run.run_hint": " run without --dry-run to execute",
|
|
1782
|
+
"uninstall.confirm.prompt": "Uninstall '{{name}}'? This cannot be undone.",
|
|
1783
|
+
"uninstall.cancelled": "aborted: user cancelled",
|
|
1784
|
+
"uninstall.completed": "uninstalled {{name}}",
|
|
1785
|
+
"uninstall.unified.nothing": "nothing to do \u2014 no harnessed artifacts found",
|
|
1786
|
+
"uninstall.unified.header": "harnessed uninstall will remove the following:",
|
|
1787
|
+
"uninstall.unified.commands": " Commands: {{count}} harnessed-generated slash command file(s) in ~/.claude/commands/",
|
|
1788
|
+
"uninstall.unified.skills": " Skills: {{count}} workflow skill directory(ies) in ~/.claude/skills/",
|
|
1789
|
+
"uninstall.unified.settings": " Settings: harnessed env vars (CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS, HARNESSED_USER_LANG) from ~/.claude/settings.json",
|
|
1790
|
+
"uninstall.unified.state_dir": " State directory: ~/.claude/harnessed/ (includes backups, audit log, state, lock)",
|
|
1791
|
+
"uninstall.unified.upstream_note": "\nUpstream components (npm packages, MCP servers, CC plugins, git-cloned repos, npx skills) are NOT affected.",
|
|
1792
|
+
"uninstall.unified.dry_run_hint": "\n(dry-run \u2014 re-run without --dry-run to actually remove)",
|
|
1793
|
+
"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.",
|
|
1794
|
+
"uninstall.unified.removing": "removing harnessed files...",
|
|
1795
|
+
"uninstall.unified.removed_commands": " removed {{count}} command file(s)",
|
|
1796
|
+
"uninstall.unified.removed_skills": " removed {{count}} skill directory(ies)",
|
|
1797
|
+
"uninstall.unified.removed_settings": " removed harnessed env vars from ~/.claude/settings.json",
|
|
1798
|
+
"uninstall.unified.removed_state_dir": " removed ~/.claude/harnessed/",
|
|
1799
|
+
"uninstall.unified.partial_failure": "\n{{count}} item(s) could not be removed (permission denied or already gone):",
|
|
1800
|
+
"uninstall.unified.complete": "uninstall complete \u2014 harnessed's own files have been removed",
|
|
1801
|
+
"gc.invalid_duration": "error: invalid --older-than '{{value}}'",
|
|
1802
|
+
"gc.invalid_duration.fix": " fix: use format <N>{d|h|m|w} e.g. 30d / 24h / 60m / 4w",
|
|
1803
|
+
"gc.no_backups": "no backups found ({{root}} absent) \u2014 nothing to gc",
|
|
1804
|
+
"gc.no_old_snapshots": "no snapshots older than {{cutoff}} (kept {{keptCount}} most-recent)",
|
|
1805
|
+
"gc.summary_will_delete": "would delete {{count}} snapshot(s), ~{{sizeKb}} KB total:",
|
|
1806
|
+
"gc.summary_deleting": "deleting {{count}} snapshot(s), ~{{sizeKb}} KB total:",
|
|
1807
|
+
"gc.dry_run_rerun_hint": "\n(dry-run \u2014 re-run without --dry-run to actually delete)",
|
|
1808
|
+
"doctor.summary.fail": "\nsome checks failed (see fix hints above)",
|
|
1809
|
+
"doctor.summary.warn": "\nall checks ok (with warnings \u2014 see hints above)",
|
|
1810
|
+
"doctor.summary.pass": "\nall checks passed",
|
|
1811
|
+
"backup.no_backups": "no backups found ({{root}} absent)",
|
|
1812
|
+
"backup.no_backups_empty": "no backups found ({{root}} empty)",
|
|
1813
|
+
"backup.total_snapshots": "\n{{count}} snapshot(s) total",
|
|
1814
|
+
"rollback.metadata_unreadable": "error: cannot read {{path}}: {{message}}",
|
|
1815
|
+
"rollback.metadata_unreadable.fix": " fix: run 'harnessed backup list' to see available timestamps",
|
|
1816
|
+
"rollback.checksum_mismatch": "error: backup checksum mismatch for {{target}} (expected {{expected}}, got {{actual}})",
|
|
1817
|
+
"rollback.restored": "restored {{count}} file(s) from {{timestamp}}",
|
|
1818
|
+
"status.no_installs": "no installs recorded ({{path}} absent or empty)",
|
|
1819
|
+
"status.summary_installs": "\n{{count}} install(s) recorded",
|
|
1820
|
+
"status.lock_held": "\nlock: held (since {{since}}){{staleSuffix}}",
|
|
1821
|
+
"status.lock_held.stale_suffix": " \u2014 STALE",
|
|
1822
|
+
"status.lock_release_hint": " to release: wait for process to finish or delete {{path}}",
|
|
1823
|
+
"status.lock_free": "\nlock: free",
|
|
1824
|
+
"here.no_workflow": "no active workflow for this repo ({{path}} has no entry for cwd)",
|
|
1825
|
+
"here.no_workflow.hint": " to start: run a stage (e.g. `harnessed gates discuss`) or `harnessed run <workflow>`",
|
|
1826
|
+
"audit_log.no_records_file": "no audit records found ({{path}} does not exist)",
|
|
1827
|
+
"audit_log.no_records_empty": "no audit records found (audit.log is empty)",
|
|
1828
|
+
"audit_log.jq_missing": "\u2717 jq not found in PATH \u2014 run: harnessed doctor",
|
|
1829
|
+
"audit_log.tail_invalid": "\u2717 --tail must be a positive integer",
|
|
1830
|
+
"audit_log.head_invalid": "\u2717 --head must be a positive integer",
|
|
1831
|
+
"execute_task.require_task": "error: --task <text> is required",
|
|
1832
|
+
"execute_task.load_phases_failed": "error: failed to load workflows/{{workflow}}/phases.yaml \u2014 {{message}}",
|
|
1833
|
+
"execute_task.precommit_skipped": "\u26A0\uFE0F before-commit pre-flight skipped ({{message}}); subagent will biome-check at commit time.",
|
|
1834
|
+
"research.require_query": "error: --query <text> is required",
|
|
1835
|
+
"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.",
|
|
1836
|
+
"manifest_add.dry_run_preview": "[manifest-add] dry-run preview for upstream: {{upstream}} \u2192 {{path}}",
|
|
1837
|
+
"manifest_add.empty_answer": "error: EE-5 gate requires non-empty answer",
|
|
1838
|
+
"manifest_add.gate_passed_wrote": "[manifest-add] EE-5 gate passed; wrote {{path}}",
|
|
1839
|
+
"manifest_add.gate_passed_dry_run": "[manifest-add] EE-5 gate passed (dry-run); would write {{path}}",
|
|
1840
|
+
"resume.fail": "\u2717 {{error}}",
|
|
1841
|
+
"resume.corrupt": "\u2717 {{error}}\n path: {{path}}"
|
|
1842
|
+
};
|
|
1843
|
+
}
|
|
1844
|
+
});
|
|
1738
1845
|
function mapToSupported(raw) {
|
|
1739
1846
|
if (!raw) return "en";
|
|
1740
1847
|
if (/^zh([^a-z]|$)/i.test(raw)) return "zh-Hans";
|
|
@@ -1751,9 +1858,19 @@ function safeIntlLocale() {
|
|
|
1751
1858
|
return void 0;
|
|
1752
1859
|
}
|
|
1753
1860
|
}
|
|
1861
|
+
function wireMessagesDir(provider) {
|
|
1862
|
+
wiredMessagesDirProvider = provider;
|
|
1863
|
+
}
|
|
1754
1864
|
function messagesDir() {
|
|
1755
1865
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
1756
|
-
const candidates = [
|
|
1866
|
+
const candidates = [];
|
|
1867
|
+
if (wiredMessagesDirProvider) {
|
|
1868
|
+
try {
|
|
1869
|
+
candidates.push(wiredMessagesDirProvider());
|
|
1870
|
+
} catch {
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
candidates.push(resolve(here, "..", "..", "messages"), resolve(here, "..", "messages"));
|
|
1757
1874
|
for (const c of candidates) {
|
|
1758
1875
|
try {
|
|
1759
1876
|
readFileSync(join(c, "en.json"), "utf8");
|
|
@@ -1770,7 +1887,7 @@ function loadLocale(locale) {
|
|
|
1770
1887
|
const raw = readFileSync(path, "utf8");
|
|
1771
1888
|
cache[locale] = JSON.parse(raw);
|
|
1772
1889
|
} catch {
|
|
1773
|
-
cache[locale] = {};
|
|
1890
|
+
cache[locale] = locale === "en" ? en_default : {};
|
|
1774
1891
|
}
|
|
1775
1892
|
return cache[locale];
|
|
1776
1893
|
}
|
|
@@ -1797,12 +1914,14 @@ function t(key, params) {
|
|
|
1797
1914
|
return v === void 0 ? `{{${name}}}` : String(v);
|
|
1798
1915
|
});
|
|
1799
1916
|
}
|
|
1800
|
-
var SUPPORTED, currentLocale, cache;
|
|
1917
|
+
var SUPPORTED, currentLocale, cache, wiredMessagesDirProvider;
|
|
1801
1918
|
var init_i18n = __esm({
|
|
1802
1919
|
"src/i18n/index.ts"() {
|
|
1920
|
+
init_en();
|
|
1803
1921
|
SUPPORTED = /* @__PURE__ */ new Set(["en", "zh-Hans"]);
|
|
1804
1922
|
currentLocale = null;
|
|
1805
1923
|
cache = {};
|
|
1924
|
+
wiredMessagesDirProvider = null;
|
|
1806
1925
|
}
|
|
1807
1926
|
});
|
|
1808
1927
|
function getBackupRoot() {
|
|
@@ -2504,7 +2623,7 @@ function nameToYamlHintPath(name) {
|
|
|
2504
2623
|
function shouldOverwriteFile(content) {
|
|
2505
2624
|
return HARNESSED_MARKER_RX.test(content) || V3_4_3_SIGNATURE_SUB_RX.test(content) || V3_4_3_SIGNATURE_MASTER_RX.test(content);
|
|
2506
2625
|
}
|
|
2507
|
-
async function writeAllCommands(slashNames, commandsDir, rolePrompts, capabilities, installedPlugins, installedUserSkills, writer, fileExists2 = existsSync, readFileSync14 = (
|
|
2626
|
+
async function writeAllCommands(slashNames, commandsDir, rolePrompts, capabilities, installedPlugins, installedUserSkills, writer, fileExists2 = existsSync, readFileSync14 = (p7) => readFileSync(p7, "utf8")) {
|
|
2508
2627
|
const results = [];
|
|
2509
2628
|
const aggregatedWarnings = /* @__PURE__ */ new Set();
|
|
2510
2629
|
for (const name of slashNames) {
|
|
@@ -3461,10 +3580,10 @@ ${rp.checklist.map((c, i) => ` ${i + 1}. ${c}`).join("\n")}` : "";
|
|
|
3461
3580
|
}
|
|
3462
3581
|
function isRalphLoopOptIn(phase) {
|
|
3463
3582
|
if (!phase || typeof phase !== "object") return false;
|
|
3464
|
-
const
|
|
3465
|
-
if (
|
|
3466
|
-
if (
|
|
3467
|
-
const fb =
|
|
3583
|
+
const p7 = phase;
|
|
3584
|
+
if (p7.max_iterations !== void 0 && p7.max_iterations !== null) return true;
|
|
3585
|
+
if (p7.upstream === "ralph-loop") return true;
|
|
3586
|
+
const fb = p7.fallback;
|
|
3468
3587
|
if (fb?.max_iterations_exceeded !== void 0) return true;
|
|
3469
3588
|
return false;
|
|
3470
3589
|
}
|
|
@@ -3729,6 +3848,87 @@ This applies to: strategic-layer review skip / phase-layer clarification skip /
|
|
|
3729
3848
|
};
|
|
3730
3849
|
}
|
|
3731
3850
|
});
|
|
3851
|
+
function getPackageRoot() {
|
|
3852
|
+
const thisFile = fileURLToPath(import.meta.url);
|
|
3853
|
+
const thisDir = dirname(thisFile);
|
|
3854
|
+
if (thisDir.endsWith("dist") || thisDir.replace(/\\/g, "/").endsWith("/dist")) {
|
|
3855
|
+
return resolve(thisDir, "..");
|
|
3856
|
+
}
|
|
3857
|
+
return resolve(thisDir, "..", "..", "..");
|
|
3858
|
+
}
|
|
3859
|
+
var init_packagePath = __esm({
|
|
3860
|
+
"src/cli/lib/packagePath.ts"() {
|
|
3861
|
+
}
|
|
3862
|
+
});
|
|
3863
|
+
|
|
3864
|
+
// src/cli/lib/assetsRoot.ts
|
|
3865
|
+
var assetsRoot_exports = {};
|
|
3866
|
+
__export(assetsRoot_exports, {
|
|
3867
|
+
compiledAssetsDir: () => compiledAssetsDir,
|
|
3868
|
+
computeAssetsRoot: () => computeAssetsRoot,
|
|
3869
|
+
getAssetsRoot: () => getAssetsRoot,
|
|
3870
|
+
isCompiledModuleUrl: () => isCompiledModuleUrl
|
|
3871
|
+
});
|
|
3872
|
+
function isCompiledModuleUrl(url) {
|
|
3873
|
+
let s = url;
|
|
3874
|
+
try {
|
|
3875
|
+
s = decodeURIComponent(url);
|
|
3876
|
+
} catch {
|
|
3877
|
+
}
|
|
3878
|
+
const normalized = s.replace(/\\/g, "/").toLowerCase();
|
|
3879
|
+
return BUNFS_MARKERS.some((m) => normalized.includes(m));
|
|
3880
|
+
}
|
|
3881
|
+
function computeAssetsRoot(d) {
|
|
3882
|
+
const override = d.env.HARNESSED_ASSETS_OVERRIDE;
|
|
3883
|
+
if (override && override.trim().length > 0) {
|
|
3884
|
+
return { root: override.trim(), source: "override", compiledAssetsMissing: false };
|
|
3885
|
+
}
|
|
3886
|
+
if (isCompiledModuleUrl(d.moduleUrl)) {
|
|
3887
|
+
const root = join(d.stateRoot(), "assets", d.version);
|
|
3888
|
+
const present = d.exists(join(root, "workflows"));
|
|
3889
|
+
return { root, source: "compiled", compiledAssetsMissing: !present };
|
|
3890
|
+
}
|
|
3891
|
+
return { root: d.packageRoot, source: "package", compiledAssetsMissing: false };
|
|
3892
|
+
}
|
|
3893
|
+
function compiledAssetsDir(version) {
|
|
3894
|
+
return join(detectPlatform().stateRoot, "assets", version);
|
|
3895
|
+
}
|
|
3896
|
+
function realDeps() {
|
|
3897
|
+
return {
|
|
3898
|
+
env: process.env,
|
|
3899
|
+
moduleUrl: import.meta.url,
|
|
3900
|
+
exists: (p7) => {
|
|
3901
|
+
try {
|
|
3902
|
+
return existsSync(p7);
|
|
3903
|
+
} catch {
|
|
3904
|
+
return false;
|
|
3905
|
+
}
|
|
3906
|
+
},
|
|
3907
|
+
stateRoot: () => detectPlatform().stateRoot,
|
|
3908
|
+
packageRoot: getPackageRoot(),
|
|
3909
|
+
version: package_default.version
|
|
3910
|
+
};
|
|
3911
|
+
}
|
|
3912
|
+
function getAssetsRoot() {
|
|
3913
|
+
const r = computeAssetsRoot(realDeps());
|
|
3914
|
+
if (r.source === "compiled" && r.compiledAssetsMissing && !warnedMissing) {
|
|
3915
|
+
warnedMissing = true;
|
|
3916
|
+
console.error(
|
|
3917
|
+
`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)`
|
|
3918
|
+
);
|
|
3919
|
+
}
|
|
3920
|
+
return r.root;
|
|
3921
|
+
}
|
|
3922
|
+
var BUNFS_MARKERS, warnedMissing;
|
|
3923
|
+
var init_assetsRoot = __esm({
|
|
3924
|
+
"src/cli/lib/assetsRoot.ts"() {
|
|
3925
|
+
init_package();
|
|
3926
|
+
init_platform();
|
|
3927
|
+
init_packagePath();
|
|
3928
|
+
BUNFS_MARKERS = ["/$bunfs/", "/~bun/"];
|
|
3929
|
+
warnedMissing = false;
|
|
3930
|
+
}
|
|
3931
|
+
});
|
|
3732
3932
|
async function loadUserOverrides(packageRoot) {
|
|
3733
3933
|
const yamlPath = resolve(packageRoot, "workflows", "judgments", "user-overrides.yaml");
|
|
3734
3934
|
let raw;
|
|
@@ -3837,24 +4037,6 @@ var init_gateContext = __esm({
|
|
|
3837
4037
|
"src/cli/lib/gateContext.ts"() {
|
|
3838
4038
|
}
|
|
3839
4039
|
});
|
|
3840
|
-
|
|
3841
|
-
// src/cli/lib/packagePath.ts
|
|
3842
|
-
var packagePath_exports = {};
|
|
3843
|
-
__export(packagePath_exports, {
|
|
3844
|
-
getPackageRoot: () => getPackageRoot
|
|
3845
|
-
});
|
|
3846
|
-
function getPackageRoot() {
|
|
3847
|
-
const thisFile = fileURLToPath(import.meta.url);
|
|
3848
|
-
const thisDir = dirname(thisFile);
|
|
3849
|
-
if (thisDir.endsWith("dist") || thisDir.replace(/\\/g, "/").endsWith("/dist")) {
|
|
3850
|
-
return resolve(thisDir, "..");
|
|
3851
|
-
}
|
|
3852
|
-
return resolve(thisDir, "..", "..", "..");
|
|
3853
|
-
}
|
|
3854
|
-
var init_packagePath = __esm({
|
|
3855
|
-
"src/cli/lib/packagePath.ts"() {
|
|
3856
|
-
}
|
|
3857
|
-
});
|
|
3858
4040
|
function registerRun(program2) {
|
|
3859
4041
|
program2.command("run").description(
|
|
3860
4042
|
"Run a harnessed workflow via in-process SDK spawn (CI/headless mode \u2014 blocks, no Agent Teams, no clarification round-trip). Slash commands use CC-native spawn via gates/prompt/checkpoint instead."
|
|
@@ -3973,19 +4155,19 @@ async function listWorkflowNames(workflowsDir) {
|
|
|
3973
4155
|
const names = [];
|
|
3974
4156
|
const entries = await readdir(workflowsDir);
|
|
3975
4157
|
for (const e of entries.sort()) {
|
|
3976
|
-
const
|
|
3977
|
-
const s = await stat(
|
|
4158
|
+
const p7 = join(workflowsDir, e);
|
|
4159
|
+
const s = await stat(p7).catch(() => null);
|
|
3978
4160
|
if (!s?.isDirectory()) continue;
|
|
3979
|
-
if (await fileExists(join(
|
|
4161
|
+
if (await fileExists(join(p7, "workflow.yaml"))) {
|
|
3980
4162
|
names.push(e);
|
|
3981
4163
|
continue;
|
|
3982
4164
|
}
|
|
3983
|
-
if (await fileExists(join(
|
|
4165
|
+
if (await fileExists(join(p7, "auto", "workflow.yaml"))) {
|
|
3984
4166
|
names.push(e);
|
|
3985
|
-
const subs = await readdir(
|
|
4167
|
+
const subs = await readdir(p7).catch(() => []);
|
|
3986
4168
|
for (const sub of subs.sort()) {
|
|
3987
4169
|
if (sub === "auto") continue;
|
|
3988
|
-
if (await fileExists(join(
|
|
4170
|
+
if (await fileExists(join(p7, sub, "workflow.yaml"))) {
|
|
3989
4171
|
names.push(`${e}-${sub}`);
|
|
3990
4172
|
}
|
|
3991
4173
|
}
|
|
@@ -4049,10 +4231,10 @@ var init_run2 = __esm({
|
|
|
4049
4231
|
init_path_guard();
|
|
4050
4232
|
init_loadPhases();
|
|
4051
4233
|
init_run();
|
|
4234
|
+
init_assetsRoot();
|
|
4052
4235
|
init_extract_user_overrides();
|
|
4053
4236
|
init_gateContext();
|
|
4054
|
-
|
|
4055
|
-
PACKAGE_ROOT = getPackageRoot();
|
|
4237
|
+
PACKAGE_ROOT = getAssetsRoot();
|
|
4056
4238
|
WORKFLOWS_DIR = join(PACKAGE_ROOT, "workflows");
|
|
4057
4239
|
_autoChainCache = null;
|
|
4058
4240
|
_autoChainLoadFailed = false;
|
|
@@ -4202,10 +4384,10 @@ function learningsPath(repoRoot) {
|
|
|
4202
4384
|
return join(repoRoot, ".planning", "LEARNINGS.md");
|
|
4203
4385
|
}
|
|
4204
4386
|
async function appendLearning(repoRoot, entry) {
|
|
4205
|
-
const
|
|
4206
|
-
await mkdir(dirname(
|
|
4207
|
-
if (!existsSync(
|
|
4208
|
-
await appendFile(
|
|
4387
|
+
const p7 = learningsPath(repoRoot);
|
|
4388
|
+
await mkdir(dirname(p7), { recursive: true });
|
|
4389
|
+
if (!existsSync(p7)) await writeFile(p7, HEADER, "utf8");
|
|
4390
|
+
await appendFile(p7, entry, "utf8");
|
|
4209
4391
|
}
|
|
4210
4392
|
async function captureWorkflowLearnings(ledger, phase) {
|
|
4211
4393
|
const signals = extractLearnings(ledger);
|
|
@@ -4411,10 +4593,10 @@ var init_breakLoop = __esm({
|
|
|
4411
4593
|
LOOP_THRESHOLD = 3;
|
|
4412
4594
|
}
|
|
4413
4595
|
});
|
|
4414
|
-
function realProbe(
|
|
4596
|
+
function realProbe(p7) {
|
|
4415
4597
|
try {
|
|
4416
4598
|
if (typeof spawnSync !== "function") return null;
|
|
4417
|
-
const r = spawnSync(
|
|
4599
|
+
const r = spawnSync(p7, ["-c", "echo harnessed-bash-ok"], { encoding: "utf8", timeout: 5e3 });
|
|
4418
4600
|
if (!r || r.error) return null;
|
|
4419
4601
|
return r.status === 0;
|
|
4420
4602
|
} catch {
|
|
@@ -4431,9 +4613,9 @@ function realWhere(name) {
|
|
|
4431
4613
|
return [];
|
|
4432
4614
|
}
|
|
4433
4615
|
}
|
|
4434
|
-
function realExists(
|
|
4616
|
+
function realExists(p7) {
|
|
4435
4617
|
try {
|
|
4436
|
-
return existsSync(
|
|
4618
|
+
return existsSync(p7);
|
|
4437
4619
|
} catch {
|
|
4438
4620
|
return false;
|
|
4439
4621
|
}
|
|
@@ -4463,14 +4645,14 @@ function compute(d) {
|
|
|
4463
4645
|
const pathLines = d.where("bash");
|
|
4464
4646
|
const first = pathLines[0];
|
|
4465
4647
|
const wslOnPath = first && WSL_STUB_RE.test(first) ? first : void 0;
|
|
4466
|
-
const usable = (
|
|
4648
|
+
const usable = (p7) => !WSL_STUB_RE.test(p7) && d.probe(p7) !== false;
|
|
4467
4649
|
if (first && usable(first)) {
|
|
4468
4650
|
return { path: first, source: "path" };
|
|
4469
4651
|
}
|
|
4470
4652
|
const gitFirst = d.where("git")[0];
|
|
4471
4653
|
if (gitFirst && /git\.exe$/i.test(gitFirst)) {
|
|
4472
4654
|
const root = dirname8(dirname8(gitFirst));
|
|
4473
|
-
for (const cand of [
|
|
4655
|
+
for (const cand of [join18(root, "bin", "bash.exe"), join18(root, "usr", "bin", "bash.exe")]) {
|
|
4474
4656
|
if (d.exists(cand) && usable(cand)) return { path: cand, source: "git-derived", wslOnPath };
|
|
4475
4657
|
}
|
|
4476
4658
|
}
|
|
@@ -4478,13 +4660,13 @@ function compute(d) {
|
|
|
4478
4660
|
d.env.ProgramFiles,
|
|
4479
4661
|
d.env.ProgramW6432,
|
|
4480
4662
|
d.env["ProgramFiles(x86)"],
|
|
4481
|
-
d.env.LOCALAPPDATA ?
|
|
4663
|
+
d.env.LOCALAPPDATA ? join18(d.env.LOCALAPPDATA, "Programs") : void 0
|
|
4482
4664
|
];
|
|
4483
4665
|
for (const base of bases) {
|
|
4484
4666
|
if (!base) continue;
|
|
4485
4667
|
for (const cand of [
|
|
4486
|
-
|
|
4487
|
-
|
|
4668
|
+
join18(base, "Git", "bin", "bash.exe"),
|
|
4669
|
+
join18(base, "Git", "usr", "bin", "bash.exe")
|
|
4488
4670
|
]) {
|
|
4489
4671
|
if (d.exists(cand) && usable(cand))
|
|
4490
4672
|
return { path: cand, source: "standard-location", wslOnPath };
|
|
@@ -4497,10 +4679,10 @@ function compute(d) {
|
|
|
4497
4679
|
}
|
|
4498
4680
|
return { path: "bash", source: "path-fallback" };
|
|
4499
4681
|
}
|
|
4500
|
-
var dirname8,
|
|
4682
|
+
var dirname8, join18, WSL_STUB_RE, cache2;
|
|
4501
4683
|
var init_resolveBash = __esm({
|
|
4502
4684
|
"src/installers/lib/resolveBash.ts"() {
|
|
4503
|
-
({ dirname: dirname8, join:
|
|
4685
|
+
({ dirname: dirname8, join: join18 } = win32);
|
|
4504
4686
|
WSL_STUB_RE = /[\\/](windows[\\/](system32|sysnative|syswow64)|microsoft[\\/]windowsapps)[\\/]bash\.exe$/i;
|
|
4505
4687
|
cache2 = null;
|
|
4506
4688
|
}
|
|
@@ -4669,9 +4851,9 @@ function gstackSkillsDirInstalled(exists) {
|
|
|
4669
4851
|
return null;
|
|
4670
4852
|
}
|
|
4671
4853
|
function probeGstackPrefix(deps) {
|
|
4672
|
-
const exists = deps?.exists ?? ((
|
|
4854
|
+
const exists = deps?.exists ?? ((p7) => {
|
|
4673
4855
|
try {
|
|
4674
|
-
return existsSync(
|
|
4856
|
+
return existsSync(p7);
|
|
4675
4857
|
} catch {
|
|
4676
4858
|
return false;
|
|
4677
4859
|
}
|
|
@@ -5199,7 +5381,11 @@ function checkCodeGraph(cwd = process.cwd()) {
|
|
|
5199
5381
|
name: "codegraph",
|
|
5200
5382
|
status: "pass",
|
|
5201
5383
|
message: "CodeGraph not configured (optional semantic index \u2014 fewer tool-calls on code navigation)",
|
|
5202
|
-
|
|
5384
|
+
// v4.17.0 — BOTH enable steps: `npx @colbymchenry/codegraph` only wires the
|
|
5385
|
+
// MCP server into agents (upstream README step 2); the per-project index is
|
|
5386
|
+
// the separate `codegraph init` (step 3). The pre-4.17.0 hint stopped at
|
|
5387
|
+
// step 1, leaving `.codegraph/` absent and this check forever "not configured".
|
|
5388
|
+
fix: "npx @colbymchenry/codegraph to wire agents, then `codegraph init` in each project to build the index (MIT, 100% local; auto-sync keeps it fresh)"
|
|
5203
5389
|
};
|
|
5204
5390
|
}
|
|
5205
5391
|
var init_check_codegraph = __esm({
|
|
@@ -5484,6 +5670,90 @@ var init_err = __esm({
|
|
|
5484
5670
|
"src/installers/lib/err.ts"() {
|
|
5485
5671
|
}
|
|
5486
5672
|
});
|
|
5673
|
+
function isRelativeFileToken(token) {
|
|
5674
|
+
if (!/[\\/]/.test(token)) return false;
|
|
5675
|
+
if (ABSOLUTE_RE.test(token)) return false;
|
|
5676
|
+
if (/[*?$`]/.test(token)) return false;
|
|
5677
|
+
return true;
|
|
5678
|
+
}
|
|
5679
|
+
function stripQuotes(token) {
|
|
5680
|
+
const m = token.match(/^"(.*)"$/);
|
|
5681
|
+
if (m?.[1] !== void 0) return { bare: m[1], quoted: true };
|
|
5682
|
+
return { bare: token, quoted: false };
|
|
5683
|
+
}
|
|
5684
|
+
function resolveHookCommand(raw, deps) {
|
|
5685
|
+
let root = null;
|
|
5686
|
+
const tokens = raw.split(/\s+/).filter((t2) => t2.length > 0);
|
|
5687
|
+
const out = tokens.map((token) => {
|
|
5688
|
+
const { bare: bare2 } = stripQuotes(token);
|
|
5689
|
+
if (!isRelativeFileToken(bare2)) return token;
|
|
5690
|
+
root = root ?? deps.assetsRoot();
|
|
5691
|
+
const abs = join(root, bare2);
|
|
5692
|
+
if (!deps.exists(abs)) return token;
|
|
5693
|
+
return abs.includes(" ") ? `"${abs}"` : abs;
|
|
5694
|
+
});
|
|
5695
|
+
return out.join(" ");
|
|
5696
|
+
}
|
|
5697
|
+
function hookScriptMarker(raw) {
|
|
5698
|
+
for (const token of raw.split(/\s+/)) {
|
|
5699
|
+
const { bare: bare2 } = stripQuotes(token);
|
|
5700
|
+
if (isRelativeFileToken(bare2)) {
|
|
5701
|
+
const seg = bare2.split(/[\\/]/);
|
|
5702
|
+
return seg[seg.length - 1] ?? null;
|
|
5703
|
+
}
|
|
5704
|
+
}
|
|
5705
|
+
return null;
|
|
5706
|
+
}
|
|
5707
|
+
function entryCommands(entry) {
|
|
5708
|
+
const cmds = [];
|
|
5709
|
+
if (typeof entry.command === "string") cmds.push(entry.command);
|
|
5710
|
+
if (Array.isArray(entry.hooks)) {
|
|
5711
|
+
for (const h of entry.hooks) {
|
|
5712
|
+
if (h && typeof h.command === "string") cmds.push(h.command);
|
|
5713
|
+
}
|
|
5714
|
+
}
|
|
5715
|
+
return cmds;
|
|
5716
|
+
}
|
|
5717
|
+
function entryMatchesRegistration(entry, raw, resolved, marker) {
|
|
5718
|
+
const cmds = entryCommands(entry);
|
|
5719
|
+
if (cmds.length === 0) return false;
|
|
5720
|
+
if (marker) return cmds.some((c) => c.includes(marker));
|
|
5721
|
+
return cmds.some((c) => c === raw || c === resolved);
|
|
5722
|
+
}
|
|
5723
|
+
function desiredHookEntry(matcher, resolvedCmd) {
|
|
5724
|
+
return {
|
|
5725
|
+
...matcher !== void 0 ? { matcher } : {},
|
|
5726
|
+
hooks: [{ type: "command", command: resolvedCmd }]
|
|
5727
|
+
};
|
|
5728
|
+
}
|
|
5729
|
+
function isDesiredHookEntry(entry, matcher, resolvedCmd) {
|
|
5730
|
+
if (typeof entry.command === "string") return false;
|
|
5731
|
+
if (entry.matcher !== matcher) return false;
|
|
5732
|
+
if (!Array.isArray(entry.hooks) || entry.hooks.length !== 1) return false;
|
|
5733
|
+
const h = entry.hooks[0];
|
|
5734
|
+
return !!h && h.type === "command" && h.command === resolvedCmd;
|
|
5735
|
+
}
|
|
5736
|
+
function detectCcHookInstalled(settingsRaw, ev, raw, matcher, deps) {
|
|
5737
|
+
if (settingsRaw === null) return false;
|
|
5738
|
+
let parsed;
|
|
5739
|
+
try {
|
|
5740
|
+
parsed = JSON.parse(settingsRaw);
|
|
5741
|
+
} catch {
|
|
5742
|
+
return false;
|
|
5743
|
+
}
|
|
5744
|
+
const arr = parsed.hooks?.[ev];
|
|
5745
|
+
if (!Array.isArray(arr)) return false;
|
|
5746
|
+
const resolved = resolveHookCommand(raw, deps);
|
|
5747
|
+
const marker = hookScriptMarker(raw);
|
|
5748
|
+
const matching = arr.filter((e) => entryMatchesRegistration(e, raw, resolved, marker));
|
|
5749
|
+
return matching.length === 1 && isDesiredHookEntry(matching[0] ?? {}, matcher, resolved);
|
|
5750
|
+
}
|
|
5751
|
+
var ABSOLUTE_RE;
|
|
5752
|
+
var init_hookEntry = __esm({
|
|
5753
|
+
"src/installers/lib/hookEntry.ts"() {
|
|
5754
|
+
ABSOLUTE_RE = /^([A-Za-z]:[\\/]|[\\/])/;
|
|
5755
|
+
}
|
|
5756
|
+
});
|
|
5487
5757
|
|
|
5488
5758
|
// src/installers/lib/preflight.ts
|
|
5489
5759
|
function preflight(ctx) {
|
|
@@ -5587,10 +5857,12 @@ var init_state2 = __esm({
|
|
|
5587
5857
|
var installCcHookAdd;
|
|
5588
5858
|
var init_ccHookAdd2 = __esm({
|
|
5589
5859
|
"src/installers/ccHookAdd.ts"() {
|
|
5860
|
+
init_assetsRoot();
|
|
5590
5861
|
init_backup();
|
|
5591
5862
|
init_confirm();
|
|
5592
5863
|
init_diff();
|
|
5593
5864
|
init_err();
|
|
5865
|
+
init_hookEntry();
|
|
5594
5866
|
init_platform();
|
|
5595
5867
|
init_preflight();
|
|
5596
5868
|
init_state2();
|
|
@@ -5641,11 +5913,16 @@ var init_ccHookAdd2 = __esm({
|
|
|
5641
5913
|
const ev = install.hook_event;
|
|
5642
5914
|
const matcher = install.hook_matcher;
|
|
5643
5915
|
const cmd = install.hook_command;
|
|
5644
|
-
|
|
5645
|
-
|
|
5916
|
+
const cmdDeps = { assetsRoot: getAssetsRoot, exists: existsSync };
|
|
5917
|
+
const resolvedCmd = resolveHookCommand(cmd, cmdDeps);
|
|
5918
|
+
const marker = hookScriptMarker(cmd);
|
|
5919
|
+
const arr = settings.hooks[ev] ?? [];
|
|
5920
|
+
const ours = arr.filter((e) => entryMatchesRegistration(e, cmd, resolvedCmd, marker));
|
|
5921
|
+
if (ours.length === 1 && isDesiredHookEntry(ours[0] ?? {}, matcher, resolvedCmd)) {
|
|
5646
5922
|
return { ok: true, backupId: "idempotent-skip", appliedFiles: [] };
|
|
5647
5923
|
}
|
|
5648
|
-
|
|
5924
|
+
const others = arr.filter((e) => !entryMatchesRegistration(e, cmd, resolvedCmd, marker));
|
|
5925
|
+
settings.hooks[ev] = [...others, desiredHookEntry(matcher, resolvedCmd)];
|
|
5649
5926
|
const newText = `${JSON.stringify(settings, null, 2)}
|
|
5650
5927
|
`;
|
|
5651
5928
|
const plan = {
|
|
@@ -5677,7 +5954,7 @@ var init_ccHookAdd2 = __esm({
|
|
|
5677
5954
|
)
|
|
5678
5955
|
};
|
|
5679
5956
|
}
|
|
5680
|
-
if (!verify.hooks?.[ev]?.some((
|
|
5957
|
+
if (!verify.hooks?.[ev]?.some((e) => isDesiredHookEntry(e, matcher, resolvedCmd))) {
|
|
5681
5958
|
return {
|
|
5682
5959
|
ok: false,
|
|
5683
5960
|
phase: "verify",
|
|
@@ -5685,7 +5962,7 @@ var init_ccHookAdd2 = __esm({
|
|
|
5685
5962
|
error: err(
|
|
5686
5963
|
ctx,
|
|
5687
5964
|
"/spec/install/hook_command",
|
|
5688
|
-
`hook '${
|
|
5965
|
+
`hook '${resolvedCmd.slice(0, 80)}' missing in hooks.${ev}[] after write`,
|
|
5689
5966
|
"verify-failed"
|
|
5690
5967
|
)
|
|
5691
5968
|
};
|
|
@@ -5750,13 +6027,13 @@ function evalClause(clause, home) {
|
|
|
5750
6027
|
const m = clause.match(CLAUSE_RE);
|
|
5751
6028
|
if (!m?.[1] || !m[2]) return null;
|
|
5752
6029
|
const flag = m[1];
|
|
5753
|
-
let
|
|
5754
|
-
if (UNSAFE_PATH_RE.test(
|
|
5755
|
-
if (
|
|
5756
|
-
else if (
|
|
5757
|
-
else if (
|
|
6030
|
+
let p7 = m[2];
|
|
6031
|
+
if (UNSAFE_PATH_RE.test(p7)) return null;
|
|
6032
|
+
if (p7 === "~") p7 = home;
|
|
6033
|
+
else if (p7.startsWith("~/")) p7 = `${home}/${p7.slice(2)}`;
|
|
6034
|
+
else if (p7.startsWith("~")) return null;
|
|
5758
6035
|
try {
|
|
5759
|
-
const st = statSync(
|
|
6036
|
+
const st = statSync(p7);
|
|
5760
6037
|
if (flag === "f") return st.isFile();
|
|
5761
6038
|
if (flag === "d") return st.isDirectory();
|
|
5762
6039
|
return true;
|
|
@@ -6066,6 +6343,25 @@ async function isAlreadyInstalled(ctx, opts = {}) {
|
|
|
6066
6343
|
const honorUpdateFlag = opts.honorUpdateFlag !== false;
|
|
6067
6344
|
if (honorUpdateFlag && ctx.opts.updateInstalled === true) return false;
|
|
6068
6345
|
if (ctx.opts.dryRun) return false;
|
|
6346
|
+
const installCfg = ctx.manifest.spec.install;
|
|
6347
|
+
if (installCfg.method === "cc-hook-add") {
|
|
6348
|
+
let raw;
|
|
6349
|
+
try {
|
|
6350
|
+
raw = await readFile(getSettingsPath(), "utf8");
|
|
6351
|
+
} catch {
|
|
6352
|
+
raw = null;
|
|
6353
|
+
}
|
|
6354
|
+
return detectCcHookInstalled(
|
|
6355
|
+
raw,
|
|
6356
|
+
installCfg.hook_event,
|
|
6357
|
+
installCfg.hook_command,
|
|
6358
|
+
installCfg.hook_matcher,
|
|
6359
|
+
{
|
|
6360
|
+
assetsRoot: getAssetsRoot,
|
|
6361
|
+
exists: existsSync
|
|
6362
|
+
}
|
|
6363
|
+
);
|
|
6364
|
+
}
|
|
6069
6365
|
const native = await detectNative(ctx);
|
|
6070
6366
|
if (native) return true;
|
|
6071
6367
|
const idempotentCmd = ctx.manifest.spec.install.idempotent_check;
|
|
@@ -6079,7 +6375,9 @@ async function isAlreadyInstalled(ctx, opts = {}) {
|
|
|
6079
6375
|
var IDEMPOTENT_CHECK_TIMEOUT_MS, INSTALLED_INDICATORS;
|
|
6080
6376
|
var init_idempotent = __esm({
|
|
6081
6377
|
"src/installers/lib/idempotent.ts"() {
|
|
6378
|
+
init_assetsRoot();
|
|
6082
6379
|
init_binaryProbe();
|
|
6380
|
+
init_hookEntry();
|
|
6083
6381
|
init_platform();
|
|
6084
6382
|
init_readClaudeConfig();
|
|
6085
6383
|
init_spawn();
|
|
@@ -7306,7 +7604,7 @@ async function installBaseProfile(opts) {
|
|
|
7306
7604
|
const alreadyInstalled = [];
|
|
7307
7605
|
const skipped = [];
|
|
7308
7606
|
const failed = [];
|
|
7309
|
-
for (const path of await listBaseManifests(
|
|
7607
|
+
for (const path of await listBaseManifests(getAssetsRoot())) {
|
|
7310
7608
|
let yamlSrc;
|
|
7311
7609
|
try {
|
|
7312
7610
|
yamlSrc = await readFile(path, "utf8");
|
|
@@ -7360,7 +7658,7 @@ var init_install_base = __esm({
|
|
|
7360
7658
|
"src/cli/install-base.ts"() {
|
|
7361
7659
|
init_installers();
|
|
7362
7660
|
init_validate();
|
|
7363
|
-
|
|
7661
|
+
init_assetsRoot();
|
|
7364
7662
|
}
|
|
7365
7663
|
});
|
|
7366
7664
|
|
|
@@ -7649,6 +7947,127 @@ var init_l4_rescue = __esm({
|
|
|
7649
7947
|
}
|
|
7650
7948
|
});
|
|
7651
7949
|
|
|
7950
|
+
// src/cli/lib/optional-offer.ts
|
|
7951
|
+
var optional_offer_exports = {};
|
|
7952
|
+
__export(optional_offer_exports, {
|
|
7953
|
+
runOptionalOffer: () => runOptionalOffer
|
|
7954
|
+
});
|
|
7955
|
+
function truncateHint(desc) {
|
|
7956
|
+
return desc.length > 80 ? `${desc.slice(0, 80)}\u2026` : desc;
|
|
7957
|
+
}
|
|
7958
|
+
async function loadOptionalManifests(optionalDir) {
|
|
7959
|
+
let entries;
|
|
7960
|
+
try {
|
|
7961
|
+
entries = await readdir(optionalDir);
|
|
7962
|
+
} catch {
|
|
7963
|
+
return [];
|
|
7964
|
+
}
|
|
7965
|
+
const out = [];
|
|
7966
|
+
for (const f of entries.sort()) {
|
|
7967
|
+
if (!f.endsWith(".yaml")) continue;
|
|
7968
|
+
try {
|
|
7969
|
+
const v = validateManifestFile(await readFile(join(optionalDir, f), "utf8"), f);
|
|
7970
|
+
if (v.ok) out.push(v.manifest);
|
|
7971
|
+
} catch {
|
|
7972
|
+
}
|
|
7973
|
+
}
|
|
7974
|
+
return out;
|
|
7975
|
+
}
|
|
7976
|
+
async function runOptionalOffer(optionalDir, offerOpts) {
|
|
7977
|
+
const out = { installed: [], alreadyInstalled: [], skipped: [], failed: [] };
|
|
7978
|
+
const manifests = await loadOptionalManifests(optionalDir);
|
|
7979
|
+
if (manifests.length === 0) return out;
|
|
7980
|
+
const pending = [];
|
|
7981
|
+
for (const manifest of manifests) {
|
|
7982
|
+
const ctx = { manifest, opts: PROBE_OPTS, level: "L2", cwd: process.cwd() };
|
|
7983
|
+
let present = false;
|
|
7984
|
+
try {
|
|
7985
|
+
present = await isAlreadyInstalled(ctx);
|
|
7986
|
+
} catch {
|
|
7987
|
+
present = false;
|
|
7988
|
+
}
|
|
7989
|
+
if (present) out.alreadyInstalled.push(manifest.metadata.name);
|
|
7990
|
+
else pending.push(manifest);
|
|
7991
|
+
}
|
|
7992
|
+
if (pending.length === 0) return out;
|
|
7993
|
+
if (!offerOpts.interactive) {
|
|
7994
|
+
const names = pending.map((m) => m.metadata.name);
|
|
7995
|
+
console.log(
|
|
7996
|
+
`
|
|
7997
|
+
${names.length} optional component(s) available (opt-in, not part of base setup) \u2014 install with \`harnessed install <name>\`: ${names.join(", ")}`
|
|
7998
|
+
);
|
|
7999
|
+
out.skipped.push(...names);
|
|
8000
|
+
return out;
|
|
8001
|
+
}
|
|
8002
|
+
console.log(
|
|
8003
|
+
`
|
|
8004
|
+
${pending.length} optional component(s) available (opt-in \u2014 none selected by default):`
|
|
8005
|
+
);
|
|
8006
|
+
const ans = await p.multiselect({
|
|
8007
|
+
message: "Select optional components to install (space to toggle, enter to continue \u2014 empty = install nothing)",
|
|
8008
|
+
options: pending.map((m) => ({
|
|
8009
|
+
value: m.metadata.name,
|
|
8010
|
+
label: m.metadata.display_name ?? m.metadata.name,
|
|
8011
|
+
hint: truncateHint(m.metadata.description)
|
|
8012
|
+
})),
|
|
8013
|
+
initialValues: [],
|
|
8014
|
+
required: false
|
|
8015
|
+
});
|
|
8016
|
+
if (p.isCancel(ans)) {
|
|
8017
|
+
out.skipped.push(...pending.map((m) => m.metadata.name));
|
|
8018
|
+
return out;
|
|
8019
|
+
}
|
|
8020
|
+
const chosen = new Set(ans);
|
|
8021
|
+
for (const manifest of pending) {
|
|
8022
|
+
const name = manifest.metadata.name;
|
|
8023
|
+
if (!chosen.has(name)) {
|
|
8024
|
+
out.skipped.push(name);
|
|
8025
|
+
continue;
|
|
8026
|
+
}
|
|
8027
|
+
console.log(`
|
|
8028
|
+
${name}: $ ${manifest.spec.install.cmd}`);
|
|
8029
|
+
const opts = {
|
|
8030
|
+
...PROBE_OPTS,
|
|
8031
|
+
apply: true,
|
|
8032
|
+
// see IMPL NOTE header — this confirm IS the L4 opt-in for npm-cli globals.
|
|
8033
|
+
system: manifest.spec.install.method === "npm-cli"
|
|
8034
|
+
};
|
|
8035
|
+
const r = await runInstall(manifest, opts);
|
|
8036
|
+
if ("aborted" in r) {
|
|
8037
|
+
out.skipped.push(name);
|
|
8038
|
+
console.log(` \u21B7 skipped ${name} (${r.reason})`);
|
|
8039
|
+
} else if (r.ok) {
|
|
8040
|
+
out.installed.push(name);
|
|
8041
|
+
console.log(` \u2713 installed ${name}`);
|
|
8042
|
+
if (name === "codegraph") {
|
|
8043
|
+
console.log(" run `codegraph init` in each project to build its index");
|
|
8044
|
+
}
|
|
8045
|
+
} else {
|
|
8046
|
+
out.failed.push({ name, reason: r.error.message });
|
|
8047
|
+
console.error(` \u2717 failed ${name}: ${r.error.message}`);
|
|
8048
|
+
}
|
|
8049
|
+
}
|
|
8050
|
+
return out;
|
|
8051
|
+
}
|
|
8052
|
+
var PROBE_OPTS;
|
|
8053
|
+
var init_optional_offer = __esm({
|
|
8054
|
+
"src/cli/lib/optional-offer.ts"() {
|
|
8055
|
+
init_installers();
|
|
8056
|
+
init_idempotent();
|
|
8057
|
+
init_validate();
|
|
8058
|
+
PROBE_OPTS = {
|
|
8059
|
+
apply: false,
|
|
8060
|
+
dryRun: false,
|
|
8061
|
+
system: false,
|
|
8062
|
+
nonInteractive: true,
|
|
8063
|
+
fullDiff: false,
|
|
8064
|
+
color: "auto",
|
|
8065
|
+
updateInstalled: false,
|
|
8066
|
+
quiet: true
|
|
8067
|
+
};
|
|
8068
|
+
}
|
|
8069
|
+
});
|
|
8070
|
+
|
|
7652
8071
|
// src/cli/lib/auto-install.ts
|
|
7653
8072
|
var auto_install_exports = {};
|
|
7654
8073
|
__export(auto_install_exports, {
|
|
@@ -8130,15 +8549,15 @@ async function parsePlan(raw) {
|
|
|
8130
8549
|
} catch {
|
|
8131
8550
|
return null;
|
|
8132
8551
|
}
|
|
8133
|
-
const
|
|
8134
|
-
if (!Array.isArray(
|
|
8552
|
+
const p7 = parsed;
|
|
8553
|
+
if (!Array.isArray(p7.fire) && !Array.isArray(p7.skip)) return null;
|
|
8135
8554
|
const plan = {
|
|
8136
|
-
fire: Array.isArray(
|
|
8137
|
-
skip: Array.isArray(
|
|
8555
|
+
fire: Array.isArray(p7.fire) ? p7.fire : [],
|
|
8556
|
+
skip: Array.isArray(p7.skip) ? p7.skip : []
|
|
8138
8557
|
};
|
|
8139
|
-
if (typeof
|
|
8140
|
-
if (
|
|
8141
|
-
plan.parallelism =
|
|
8558
|
+
if (typeof p7.master === "string") plan.master = p7.master;
|
|
8559
|
+
if (p7.parallelism && typeof p7.parallelism === "object" && !Array.isArray(p7.parallelism)) {
|
|
8560
|
+
plan.parallelism = p7.parallelism;
|
|
8142
8561
|
}
|
|
8143
8562
|
return plan;
|
|
8144
8563
|
}
|
|
@@ -8183,8 +8602,8 @@ function registerCheckpoint(program2) {
|
|
|
8183
8602
|
if (action === "complete") {
|
|
8184
8603
|
const { checkArtifacts: checkArtifacts2 } = await Promise.resolve().then(() => (init_evidence(), evidence_exports));
|
|
8185
8604
|
const { mutateSubProgress: mutateSubProgress3 } = await Promise.resolve().then(() => (init_state(), state_exports));
|
|
8186
|
-
const {
|
|
8187
|
-
const result = await checkArtifacts2(sub,
|
|
8605
|
+
const { getAssetsRoot: getAssetsRoot2 } = await Promise.resolve().then(() => (init_assetsRoot(), assetsRoot_exports));
|
|
8606
|
+
const result = await checkArtifacts2(sub, getAssetsRoot2());
|
|
8188
8607
|
const { checkPlanningSync: checkPlanningSync2 } = await Promise.resolve().then(() => (init_evidence(), evidence_exports));
|
|
8189
8608
|
const syncResult = await checkPlanningSync2(process.cwd(), null);
|
|
8190
8609
|
const allMissing = [...result.missing, ...syncResult.missing];
|
|
@@ -8349,8 +8768,8 @@ function registerDoctor(program2) {
|
|
|
8349
8768
|
// src/cli/gates.ts
|
|
8350
8769
|
init_path_guard();
|
|
8351
8770
|
init_judgmentResolver();
|
|
8771
|
+
init_assetsRoot();
|
|
8352
8772
|
init_gateContext();
|
|
8353
|
-
init_packagePath();
|
|
8354
8773
|
var VALID_MASTERS = /* @__PURE__ */ new Set(["auto", "discuss", "plan", "task", "verify"]);
|
|
8355
8774
|
var STAGE_MASTERS = /* @__PURE__ */ new Set(["discuss", "plan", "task", "verify"]);
|
|
8356
8775
|
var PARALLELISM_GATE = "judgments.parallelism-gate.agent-teams-upgrade.fires";
|
|
@@ -8375,7 +8794,7 @@ function registerGates(program2) {
|
|
|
8375
8794
|
process.exit(1);
|
|
8376
8795
|
return;
|
|
8377
8796
|
}
|
|
8378
|
-
const packageRoot =
|
|
8797
|
+
const packageRoot = getAssetsRoot();
|
|
8379
8798
|
const yamlPath = resolveMasterYamlPath2(master, packageRoot);
|
|
8380
8799
|
let raw_yaml;
|
|
8381
8800
|
try {
|
|
@@ -8493,10 +8912,10 @@ async function dirSizeKb(dir) {
|
|
|
8493
8912
|
if (!cur) break;
|
|
8494
8913
|
const entries = await readdir(cur, { withFileTypes: true });
|
|
8495
8914
|
for (const e of entries) {
|
|
8496
|
-
const
|
|
8497
|
-
if (e.isDirectory()) stack.push(
|
|
8915
|
+
const p7 = join(cur, e.name);
|
|
8916
|
+
if (e.isDirectory()) stack.push(p7);
|
|
8498
8917
|
else if (e.isFile()) {
|
|
8499
|
-
const st = await stat(
|
|
8918
|
+
const st = await stat(p7);
|
|
8500
8919
|
total += st.size;
|
|
8501
8920
|
}
|
|
8502
8921
|
}
|
|
@@ -8569,7 +8988,7 @@ init_i18n();
|
|
|
8569
8988
|
init_installers();
|
|
8570
8989
|
init_path_guard();
|
|
8571
8990
|
init_validate();
|
|
8572
|
-
|
|
8991
|
+
init_assetsRoot();
|
|
8573
8992
|
function formatError(e) {
|
|
8574
8993
|
const head = `error: ${e.message}`;
|
|
8575
8994
|
const where = e.path && e.path !== "/" ? `
|
|
@@ -8587,14 +9006,14 @@ function registerInstall(program2) {
|
|
|
8587
9006
|
const resolvedName = resolveAlias2(name) ?? name;
|
|
8588
9007
|
checkPathSafe(resolvedName);
|
|
8589
9008
|
const candidatePaths = ["tools", "skill-packs", "optional"].map(
|
|
8590
|
-
(dir) => resolve(
|
|
9009
|
+
(dir) => resolve(getAssetsRoot(), `manifests/${dir}/${resolvedName}.yaml`)
|
|
8591
9010
|
);
|
|
8592
9011
|
let yamlSrc;
|
|
8593
9012
|
let chosenPath;
|
|
8594
|
-
for (const
|
|
9013
|
+
for (const p7 of candidatePaths) {
|
|
8595
9014
|
try {
|
|
8596
|
-
yamlSrc = await readFile(
|
|
8597
|
-
chosenPath =
|
|
9015
|
+
yamlSrc = await readFile(p7, "utf8");
|
|
9016
|
+
chosenPath = p7;
|
|
8598
9017
|
break;
|
|
8599
9018
|
} catch {
|
|
8600
9019
|
}
|
|
@@ -8636,8 +9055,10 @@ ${t("install.manifest_not_found.fix", { name: resolvedName })}`
|
|
|
8636
9055
|
}
|
|
8637
9056
|
if (result.ok) {
|
|
8638
9057
|
const version = v.manifest.spec.install.method === "npm-cli" && "npm_version" in v.manifest.spec.install ? v.manifest.spec.install.npm_version : "";
|
|
9058
|
+
const already = "alreadyInstalled" in result && result.alreadyInstalled === true;
|
|
9059
|
+
const keyBase = already ? "install.already_installed" : "install.success";
|
|
8639
9060
|
console.log(
|
|
8640
|
-
version ? t(
|
|
9061
|
+
version ? t(`${keyBase}_with_version`, { name: v.manifest.metadata.name, version }) : t(keyBase, { name: v.manifest.metadata.name })
|
|
8641
9062
|
);
|
|
8642
9063
|
process.exit(0);
|
|
8643
9064
|
}
|
|
@@ -8666,6 +9087,9 @@ function registerLearn(program2) {
|
|
|
8666
9087
|
});
|
|
8667
9088
|
}
|
|
8668
9089
|
|
|
9090
|
+
// src/cli.ts
|
|
9091
|
+
init_assetsRoot();
|
|
9092
|
+
|
|
8669
9093
|
// src/cli/lib/here.ts
|
|
8670
9094
|
init_nextStep();
|
|
8671
9095
|
init_i18n();
|
|
@@ -8932,8 +9356,8 @@ function registerNext(program2) {
|
|
|
8932
9356
|
init_i18n();
|
|
8933
9357
|
init_localeYaml();
|
|
8934
9358
|
init_run();
|
|
9359
|
+
init_assetsRoot();
|
|
8935
9360
|
init_generateCommands();
|
|
8936
|
-
init_packagePath();
|
|
8937
9361
|
init_run2();
|
|
8938
9362
|
var DEFAULT_MAX_ITERATIONS = 20;
|
|
8939
9363
|
var DEFAULT_MODEL = "sonnet";
|
|
@@ -9050,7 +9474,7 @@ function registerPrompt(program2) {
|
|
|
9050
9474
|
program2.command("prompt").description(
|
|
9051
9475
|
"Print a spawn-ready prompt for a sub-workflow (role + checklist + protocols, no spawn)."
|
|
9052
9476
|
).argument("<sub>", "sub-workflow name (e.g. task-code, verify-paranoid)").option("--task <text>", "task description prepended as a ## Task section").option("--json", "emit JSON {prompt, max_iterations, model, specialist} instead of text").action(async (sub, raw) => {
|
|
9053
|
-
const packageRoot =
|
|
9477
|
+
const packageRoot = getAssetsRoot();
|
|
9054
9478
|
const workflowsDir = resolve(packageRoot, "workflows");
|
|
9055
9479
|
const rolePrompts = await loadRolePrompts(workflowsDir);
|
|
9056
9480
|
const def = buildAgentDef(sub, rolePrompts);
|
|
@@ -9136,9 +9560,9 @@ function registerReleasePreflight(program2) {
|
|
|
9136
9560
|
// src/cli/research.ts
|
|
9137
9561
|
init_i18n();
|
|
9138
9562
|
init_run();
|
|
9139
|
-
|
|
9563
|
+
init_assetsRoot();
|
|
9140
9564
|
init_run2();
|
|
9141
|
-
var PACKAGE_ROOT2 =
|
|
9565
|
+
var PACKAGE_ROOT2 = getAssetsRoot();
|
|
9142
9566
|
var WORKFLOWS_DIR2 = join(PACKAGE_ROOT2, "workflows");
|
|
9143
9567
|
function registerResearch(program2) {
|
|
9144
9568
|
program2.command("research").description(
|
|
@@ -9319,6 +9743,7 @@ init_run2();
|
|
|
9319
9743
|
// src/cli/setup.ts
|
|
9320
9744
|
init_i18n();
|
|
9321
9745
|
init_platform();
|
|
9746
|
+
init_assetsRoot();
|
|
9322
9747
|
|
|
9323
9748
|
// src/cli/lib/capabilityResolver.ts
|
|
9324
9749
|
init_platform();
|
|
@@ -9571,7 +9996,6 @@ async function enableUserLangInSettings(override) {
|
|
|
9571
9996
|
|
|
9572
9997
|
// src/cli/setup.ts
|
|
9573
9998
|
init_generateCommands();
|
|
9574
|
-
init_packagePath();
|
|
9575
9999
|
|
|
9576
10000
|
// src/cli/lib/renderSkillTemplates.ts
|
|
9577
10001
|
init_i18n();
|
|
@@ -10054,7 +10478,7 @@ function registerSetup(program2) {
|
|
|
10054
10478
|
await printSetupVersionBanner();
|
|
10055
10479
|
const dryRun = raw.dryRun === true;
|
|
10056
10480
|
if (raw.platform !== void 0) await applyPlatformOption(raw.platform);
|
|
10057
|
-
const pkgRoot =
|
|
10481
|
+
const pkgRoot = getAssetsRoot();
|
|
10058
10482
|
const workflowsDir = resolve(pkgRoot, "workflows");
|
|
10059
10483
|
const skillsBase = getSkillsDir();
|
|
10060
10484
|
await warnIfAgentTeamsMissing();
|
|
@@ -10132,7 +10556,7 @@ function registerSetup(program2) {
|
|
|
10132
10556
|
capabilitiesMap,
|
|
10133
10557
|
installedPlugins,
|
|
10134
10558
|
installedUserSkills,
|
|
10135
|
-
async (
|
|
10559
|
+
async (p7, c) => writeFile(p7, c, "utf8")
|
|
10136
10560
|
);
|
|
10137
10561
|
const writtenCount = cmdResult.results.filter((r) => r.written).length;
|
|
10138
10562
|
const skippedCount = cmdResult.results.filter((r) => !r.written && r.warning).length;
|
|
@@ -10169,12 +10593,12 @@ installing ${manifestPaths.length} upstream components (MCP serialized, rest par
|
|
|
10169
10593
|
if (!forceFirstPass && !dryRun && raw.nonInteractive !== true && b.alreadyInstalled.length > 0) {
|
|
10170
10594
|
const isTty = process.stdin.isTTY === true && process.stdout.isTTY === true;
|
|
10171
10595
|
if (isTty) {
|
|
10172
|
-
const { confirm: confirm5, isCancel:
|
|
10596
|
+
const { confirm: confirm5, isCancel: isCancel7 } = await import('@clack/prompts');
|
|
10173
10597
|
const ans = await confirm5({
|
|
10174
10598
|
message: `Update ${b.alreadyInstalled.length} already-installed plugin(s) listed above? (MCP servers excluded \u2014 they ignore force-update)`,
|
|
10175
10599
|
initialValue: false
|
|
10176
10600
|
});
|
|
10177
|
-
if (!
|
|
10601
|
+
if (!isCancel7(ans) && ans === true) {
|
|
10178
10602
|
console.log(`
|
|
10179
10603
|
force-updating ${b.alreadyInstalled.length} plugin(s)...`);
|
|
10180
10604
|
const b2 = await runStepBInstall(manifestPaths, {
|
|
@@ -10208,6 +10632,13 @@ Force-update pass complete: ${b2.installed.length} installed / ${b2.keptExisting
|
|
|
10208
10632
|
await runL4Rescue2(manifestPaths, b.skipped);
|
|
10209
10633
|
}
|
|
10210
10634
|
}
|
|
10635
|
+
if (!dryRun) {
|
|
10636
|
+
const optIsTty = process.stdin.isTTY === true && process.stdout.isTTY === true;
|
|
10637
|
+
const { runOptionalOffer: runOptionalOffer2 } = await Promise.resolve().then(() => (init_optional_offer(), optional_offer_exports));
|
|
10638
|
+
await runOptionalOffer2(resolve(pkgRoot, "manifests", "optional"), {
|
|
10639
|
+
interactive: optIsTty && raw.nonInteractive !== true
|
|
10640
|
+
});
|
|
10641
|
+
}
|
|
10211
10642
|
if (b.failed.length > 0) {
|
|
10212
10643
|
console.error(
|
|
10213
10644
|
`
|
|
@@ -10247,6 +10678,8 @@ init_path_guard();
|
|
|
10247
10678
|
init_validate();
|
|
10248
10679
|
|
|
10249
10680
|
// src/uninstallers/ccHookAdd.ts
|
|
10681
|
+
init_assetsRoot();
|
|
10682
|
+
init_hookEntry();
|
|
10250
10683
|
init_platform();
|
|
10251
10684
|
|
|
10252
10685
|
// src/uninstallers/lib/runOrPreview.ts
|
|
@@ -10282,13 +10715,14 @@ var uninstallCcHookAdd = async (ctx) => {
|
|
|
10282
10715
|
}
|
|
10283
10716
|
const ev = install.hook_event;
|
|
10284
10717
|
const cmd = install.hook_command;
|
|
10285
|
-
const matcher = install.hook_matcher;
|
|
10286
10718
|
if (!settings.hooks?.[ev]) {
|
|
10287
10719
|
return { ok: true, removedPaths: [] };
|
|
10288
10720
|
}
|
|
10721
|
+
const resolved = resolveHookCommand(cmd, { assetsRoot: getAssetsRoot, exists: existsSync });
|
|
10722
|
+
const marker = hookScriptMarker(cmd);
|
|
10289
10723
|
const before = settings.hooks[ev].length;
|
|
10290
10724
|
settings.hooks[ev] = settings.hooks[ev].filter(
|
|
10291
|
-
(h) => !(h
|
|
10725
|
+
(h) => !entryMatchesRegistration(h, cmd, resolved, marker)
|
|
10292
10726
|
);
|
|
10293
10727
|
if (settings.hooks[ev].length === 0) delete settings.hooks[ev];
|
|
10294
10728
|
if (Object.keys(settings.hooks).length === 0) delete settings.hooks;
|
|
@@ -10509,8 +10943,8 @@ async function runUninstall(manifest, opts) {
|
|
|
10509
10943
|
}
|
|
10510
10944
|
|
|
10511
10945
|
// src/cli/uninstall.ts
|
|
10946
|
+
init_assetsRoot();
|
|
10512
10947
|
init_generateCommands();
|
|
10513
|
-
init_packagePath();
|
|
10514
10948
|
async function discoverCommandFiles(commandsDir) {
|
|
10515
10949
|
const owned = [];
|
|
10516
10950
|
let entries;
|
|
@@ -10521,10 +10955,10 @@ async function discoverCommandFiles(commandsDir) {
|
|
|
10521
10955
|
}
|
|
10522
10956
|
for (const entry of entries) {
|
|
10523
10957
|
if (!entry.endsWith(".md")) continue;
|
|
10524
|
-
const
|
|
10958
|
+
const p7 = join(commandsDir, entry);
|
|
10525
10959
|
try {
|
|
10526
|
-
const content = await readFile(
|
|
10527
|
-
if (shouldOverwriteFile(content)) owned.push(
|
|
10960
|
+
const content = await readFile(p7, "utf8");
|
|
10961
|
+
if (shouldOverwriteFile(content)) owned.push(p7);
|
|
10528
10962
|
} catch {
|
|
10529
10963
|
}
|
|
10530
10964
|
}
|
|
@@ -10569,7 +11003,7 @@ async function runUnifiedUninstall(home, dryRun) {
|
|
|
10569
11003
|
const skillsDir = platform.skillsDir;
|
|
10570
11004
|
const settingsPath = platform.settingsPath;
|
|
10571
11005
|
const harnessedRoot = getHarnessedRoot();
|
|
10572
|
-
const pkgRoot =
|
|
11006
|
+
const pkgRoot = getAssetsRoot();
|
|
10573
11007
|
let workflowNames = [];
|
|
10574
11008
|
try {
|
|
10575
11009
|
const wfEntries = await readdir(resolve(pkgRoot, "workflows"));
|
|
@@ -10679,9 +11113,9 @@ function registerUninstall(program2) {
|
|
|
10679
11113
|
const { resolveAlias: resolveAlias2 } = await Promise.resolve().then(() => (init_aliases(), aliases_exports));
|
|
10680
11114
|
const resolvedName = resolveAlias2(name) ?? name;
|
|
10681
11115
|
checkPathSafe(resolvedName);
|
|
10682
|
-
const manifestPath = resolve(
|
|
11116
|
+
const manifestPath = resolve(getAssetsRoot(), `manifests/tools/${resolvedName}.yaml`);
|
|
10683
11117
|
const skillPackPath = resolve(
|
|
10684
|
-
|
|
11118
|
+
getAssetsRoot(),
|
|
10685
11119
|
`manifests/skill-packs/${resolvedName}.yaml`
|
|
10686
11120
|
);
|
|
10687
11121
|
let yamlSrc;
|
|
@@ -10740,15 +11174,15 @@ ${t("install.manifest_not_found.fix", { name: resolvedName })}`
|
|
|
10740
11174
|
// src/cli/update.ts
|
|
10741
11175
|
init_package();
|
|
10742
11176
|
init_harnessedRoot();
|
|
10743
|
-
|
|
11177
|
+
init_assetsRoot();
|
|
10744
11178
|
function npmExecutable2() {
|
|
10745
11179
|
return process.platform === "win32" ? "npm.cmd" : "npm";
|
|
10746
11180
|
}
|
|
10747
11181
|
function changelogTop() {
|
|
10748
11182
|
try {
|
|
10749
|
-
const
|
|
10750
|
-
if (!existsSync(
|
|
10751
|
-
const body = readFileSync(
|
|
11183
|
+
const p7 = join(getAssetsRoot(), "CHANGELOG.md");
|
|
11184
|
+
if (!existsSync(p7)) return null;
|
|
11185
|
+
const body = readFileSync(p7, "utf8");
|
|
10752
11186
|
const start = body.indexOf("\n## ");
|
|
10753
11187
|
if (start < 0) return null;
|
|
10754
11188
|
const rest = body.slice(start + 1);
|
|
@@ -10837,6 +11271,7 @@ function registerWorkflows(program2) {
|
|
|
10837
11271
|
// src/cli.ts
|
|
10838
11272
|
init_i18n();
|
|
10839
11273
|
init_harnessedRoot();
|
|
11274
|
+
wireMessagesDir(() => join(getAssetsRoot(), "messages"));
|
|
10840
11275
|
migrateLegacyHarnessedRoot();
|
|
10841
11276
|
var argv = process.argv;
|
|
10842
11277
|
for (let i = 2; i < argv.length; i++) {
|