harnessed 4.16.2 → 4.19.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 +418 -112
- 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/manifests/skill-packs/mattpocock-skills.yaml +1 -1
- package/messages/en.json +2 -0
- package/messages/zh-Hans.json +2 -0
- package/package.json +1 -1
- package/routing/decision_rules.yaml +2 -5
- package/workflows/capabilities.yaml +25 -24
- package/workflows/role-prompts.yaml +9 -10
- package/workflows/role-prompts.zh-Hans.yaml +8 -10
- package/workflows/task/auto/SKILL.md +1 -2
- package/workflows/task/auto/SKILL.zh-Hans.md +1 -2
- package/workflows/task/auto/workflow.yaml +1 -2
- package/workflows/task/code/SKILL.md +13 -7
- package/workflows/task/code/SKILL.zh-Hans.md +13 -7
- package/workflows/task/code/workflow.yaml +6 -9
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.19.0",
|
|
42
42
|
description: "AI coding harness package manager + composition orchestrator",
|
|
43
43
|
type: "module",
|
|
44
44
|
license: "Apache-2.0",
|
|
@@ -570,9 +570,9 @@ async function writeStoreRaw(store) {
|
|
|
570
570
|
const errs = [...Value.Errors(WorkflowStoreV1, store)].map((e) => e.message).join("; ");
|
|
571
571
|
throw new Error(`workflow-store schema validation failed: ${errs}`);
|
|
572
572
|
}
|
|
573
|
-
const
|
|
574
|
-
await mkdir(dirname(
|
|
575
|
-
await writeFileAtomic(
|
|
573
|
+
const p7 = storePath();
|
|
574
|
+
await mkdir(dirname(p7), { recursive: true });
|
|
575
|
+
await writeFileAtomic(p7, JSON.stringify(store, null, 2));
|
|
576
576
|
}
|
|
577
577
|
async function listWorkflows() {
|
|
578
578
|
const store = await readStoreRaw();
|
|
@@ -786,9 +786,9 @@ function scanPhases(repoRoot, includeTasks) {
|
|
|
786
786
|
function scanTasks(dirPath) {
|
|
787
787
|
for (const fname of ["task_plan.md", "progress.md"]) {
|
|
788
788
|
try {
|
|
789
|
-
const
|
|
790
|
-
if (!existsSync(
|
|
791
|
-
const m = /^[ \t]*- \[ \]\s+(.+)$/m.exec(readFileSync(
|
|
789
|
+
const p7 = join(dirPath, fname);
|
|
790
|
+
if (!existsSync(p7)) continue;
|
|
791
|
+
const m = /^[ \t]*- \[ \]\s+(.+)$/m.exec(readFileSync(p7, "utf8"));
|
|
792
792
|
const task = m?.[1];
|
|
793
793
|
if (task) return { nextUnchecked: task.trim() };
|
|
794
794
|
} catch {
|
|
@@ -867,7 +867,7 @@ function deriveNext(snapshot) {
|
|
|
867
867
|
reason: `sub '${failed.sub}' failed ${failed.fail_count}x \u2014 resolve before advancing`
|
|
868
868
|
};
|
|
869
869
|
}
|
|
870
|
-
const firstIncomplete = snapshot.phases.find((
|
|
870
|
+
const firstIncomplete = snapshot.phases.find((p7) => !p7.complete);
|
|
871
871
|
if (firstIncomplete) {
|
|
872
872
|
const task = firstIncomplete.tasks?.nextUnchecked;
|
|
873
873
|
if (task) return { kind: "task", phase: firstIncomplete.phase, task };
|
|
@@ -903,7 +903,7 @@ function describeUnit(unit) {
|
|
|
903
903
|
}
|
|
904
904
|
}
|
|
905
905
|
function remainingPhases(snapshot) {
|
|
906
|
-
return snapshot.phases.filter((
|
|
906
|
+
return snapshot.phases.filter((p7) => !p7.complete).length;
|
|
907
907
|
}
|
|
908
908
|
function pluralPhases(n) {
|
|
909
909
|
return `${n} phase${n === 1 ? "" : "s"} remain`;
|
|
@@ -1555,8 +1555,8 @@ function checkSecurityViolations(doc, filename, lineCounter) {
|
|
|
1555
1555
|
["spec", "verify", "cmd"],
|
|
1556
1556
|
["spec", "uninstall", "cmd"]
|
|
1557
1557
|
];
|
|
1558
|
-
for (const
|
|
1559
|
-
const err2 = checkScalarCmd(doc, lineCounter,
|
|
1558
|
+
for (const p7 of cmdPaths) {
|
|
1559
|
+
const err2 = checkScalarCmd(doc, lineCounter, p7, filename);
|
|
1560
1560
|
if (err2) errors.push(err2);
|
|
1561
1561
|
}
|
|
1562
1562
|
const cleanupNode = doc.getIn(["spec", "uninstall", "cleanup_paths"], true);
|
|
@@ -1735,6 +1735,112 @@ var init_origin_check = __esm({
|
|
|
1735
1735
|
"src/cli/lib/origin-check.ts"() {
|
|
1736
1736
|
}
|
|
1737
1737
|
});
|
|
1738
|
+
|
|
1739
|
+
// messages/en.json
|
|
1740
|
+
var en_default;
|
|
1741
|
+
var init_en = __esm({
|
|
1742
|
+
"messages/en.json"() {
|
|
1743
|
+
en_default = {
|
|
1744
|
+
"setup.workflows_not_found": "error: workflows directory not found at {{path}}",
|
|
1745
|
+
"setup.nothing_to_install": "setup: no workflow directories with SKILL.md found \u2014 nothing to install",
|
|
1746
|
+
"setup.dry_run.header": "[dry-run] setup would install {{count}} workflow(s) to {{path}}:",
|
|
1747
|
+
"setup.dry_run.run_hint": " run without --dry-run to execute",
|
|
1748
|
+
"setup.copy_failed": " error: failed to copy {{name}}: {{message}}",
|
|
1749
|
+
"setup.step_a_complete": "Step A: {{count}} workflows installed to {{path}}",
|
|
1750
|
+
"setup.step_a_render.complete": " generated {{count}}/{{total}} command files",
|
|
1751
|
+
"setup.step_a_render.warnings_header": " [A.5] warnings \u2014 some capability cmds could not be fully resolved:",
|
|
1752
|
+
"setup.step_c.created": " [C] created {{path}} + enabled Agent Teams",
|
|
1753
|
+
"setup.step_c.already_enabled": " [C] Agent Teams already enabled ({{path}})",
|
|
1754
|
+
"setup.step_c.enabled_backup": " [C] enabled Agent Teams in {{path}} (backup saved \u2192 {{backupPath}})",
|
|
1755
|
+
"setup.step_c.skipped": " [C] Agent Teams enable skipped: {{message}}",
|
|
1756
|
+
"setup.step_d.created": " [D] created {{path}} + wrote env.HARNESSED_USER_LANG={{lang}}",
|
|
1757
|
+
"setup.step_d.already_set": " [D] env.HARNESSED_USER_LANG={{lang}} already set in {{path}} \u2014 respecting user override",
|
|
1758
|
+
"setup.step_d.enabled_backup": " [D] wrote env.HARNESSED_USER_LANG={{lang}} in {{path}} (backup saved \u2192 {{backupPath}})",
|
|
1759
|
+
"setup.step_d.skipped": " [D] User language write skipped: {{message}}",
|
|
1760
|
+
"setup.step_b_complete": "Upstream components: {{installed}} installed / {{already}} already-installed / {{skipped}} skipped / {{failed}} failed [{{seconds}}s]",
|
|
1761
|
+
"setup.complete": "setup complete \u2014 {{skills}} workflows + {{manifests}} base manifests configured",
|
|
1762
|
+
"setup.mcp_hint": "Run /mcp in Claude Code to verify MCP server connections.",
|
|
1763
|
+
"setup.mcp_hint_codex": "Run codex mcp list to verify MCP server connections.",
|
|
1764
|
+
"setup.bundled_summary": "\nharnessed workflows bundled at <packageRoot>/workflows/ (share-only, read-only)",
|
|
1765
|
+
"setup.bundled_location": "",
|
|
1766
|
+
"setup.doctor_hint": "\nRun harnessed doctor to verify your environment.",
|
|
1767
|
+
"agent_teams.missing_header": "\n\u26A0\uFE0F Agent Teams not enabled \u2014 parallelism upgrade path unavailable",
|
|
1768
|
+
"agent_teams.missing_fix": " fix: claude config set env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS 1",
|
|
1769
|
+
"agent_teams.missing_explanation": " harnessed task parallelism uses Subagent or Agent Teams (CC 2.1.133+)",
|
|
1770
|
+
"agent_teams.missing_nonblocking": " non-blocking \u2014 auto-degrades to subagent fan-out\n",
|
|
1771
|
+
"install.manifest_not_found": "error: manifest '{{name}}' not found",
|
|
1772
|
+
"install.manifest_not_found.fix": " fix: ensure manifests/tools/{{name}}.yaml, manifests/skill-packs/{{name}}.yaml, or manifests/optional/{{name}}.yaml exists",
|
|
1773
|
+
"install.audit_hint": " fix: run 'harnessed audit' to inspect manifest issues",
|
|
1774
|
+
"install.success": "installed {{name}}",
|
|
1775
|
+
"install.success_with_version": "installed {{name}}@{{version}}",
|
|
1776
|
+
"install.already_installed": "already-installed {{name}} (idempotent check hit; nothing to do)",
|
|
1777
|
+
"install.already_installed_with_version": "already-installed {{name}}@{{version}} (idempotent check hit; nothing to do)",
|
|
1778
|
+
"install.aborted": "aborted: {{reason}}",
|
|
1779
|
+
"uninstall.dry_run.preview": "[dry-run] would uninstall '{{name}}' via method '{{method}}'",
|
|
1780
|
+
"uninstall.dry_run.run_hint": " run without --dry-run to execute",
|
|
1781
|
+
"uninstall.confirm.prompt": "Uninstall '{{name}}'? This cannot be undone.",
|
|
1782
|
+
"uninstall.cancelled": "aborted: user cancelled",
|
|
1783
|
+
"uninstall.completed": "uninstalled {{name}}",
|
|
1784
|
+
"uninstall.unified.nothing": "nothing to do \u2014 no harnessed artifacts found",
|
|
1785
|
+
"uninstall.unified.header": "harnessed uninstall will remove the following:",
|
|
1786
|
+
"uninstall.unified.commands": " Commands: {{count}} harnessed-generated slash command file(s) in ~/.claude/commands/",
|
|
1787
|
+
"uninstall.unified.skills": " Skills: {{count}} workflow skill directory(ies) in ~/.claude/skills/",
|
|
1788
|
+
"uninstall.unified.settings": " Settings: harnessed env vars (CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS, HARNESSED_USER_LANG) from ~/.claude/settings.json",
|
|
1789
|
+
"uninstall.unified.state_dir": " State directory: ~/.claude/harnessed/ (includes backups, audit log, state, lock)",
|
|
1790
|
+
"uninstall.unified.upstream_note": "\nUpstream components (npm packages, MCP servers, CC plugins, git-cloned repos, npx skills) are NOT affected.",
|
|
1791
|
+
"uninstall.unified.dry_run_hint": "\n(dry-run \u2014 re-run without --dry-run to actually remove)",
|
|
1792
|
+
"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.",
|
|
1793
|
+
"uninstall.unified.removing": "removing harnessed files...",
|
|
1794
|
+
"uninstall.unified.removed_commands": " removed {{count}} command file(s)",
|
|
1795
|
+
"uninstall.unified.removed_skills": " removed {{count}} skill directory(ies)",
|
|
1796
|
+
"uninstall.unified.removed_settings": " removed harnessed env vars from ~/.claude/settings.json",
|
|
1797
|
+
"uninstall.unified.removed_state_dir": " removed ~/.claude/harnessed/",
|
|
1798
|
+
"uninstall.unified.partial_failure": "\n{{count}} item(s) could not be removed (permission denied or already gone):",
|
|
1799
|
+
"uninstall.unified.complete": "uninstall complete \u2014 harnessed's own files have been removed",
|
|
1800
|
+
"gc.invalid_duration": "error: invalid --older-than '{{value}}'",
|
|
1801
|
+
"gc.invalid_duration.fix": " fix: use format <N>{d|h|m|w} e.g. 30d / 24h / 60m / 4w",
|
|
1802
|
+
"gc.no_backups": "no backups found ({{root}} absent) \u2014 nothing to gc",
|
|
1803
|
+
"gc.no_old_snapshots": "no snapshots older than {{cutoff}} (kept {{keptCount}} most-recent)",
|
|
1804
|
+
"gc.summary_will_delete": "would delete {{count}} snapshot(s), ~{{sizeKb}} KB total:",
|
|
1805
|
+
"gc.summary_deleting": "deleting {{count}} snapshot(s), ~{{sizeKb}} KB total:",
|
|
1806
|
+
"gc.dry_run_rerun_hint": "\n(dry-run \u2014 re-run without --dry-run to actually delete)",
|
|
1807
|
+
"doctor.summary.fail": "\nsome checks failed (see fix hints above)",
|
|
1808
|
+
"doctor.summary.warn": "\nall checks ok (with warnings \u2014 see hints above)",
|
|
1809
|
+
"doctor.summary.pass": "\nall checks passed",
|
|
1810
|
+
"backup.no_backups": "no backups found ({{root}} absent)",
|
|
1811
|
+
"backup.no_backups_empty": "no backups found ({{root}} empty)",
|
|
1812
|
+
"backup.total_snapshots": "\n{{count}} snapshot(s) total",
|
|
1813
|
+
"rollback.metadata_unreadable": "error: cannot read {{path}}: {{message}}",
|
|
1814
|
+
"rollback.metadata_unreadable.fix": " fix: run 'harnessed backup list' to see available timestamps",
|
|
1815
|
+
"rollback.checksum_mismatch": "error: backup checksum mismatch for {{target}} (expected {{expected}}, got {{actual}})",
|
|
1816
|
+
"rollback.restored": "restored {{count}} file(s) from {{timestamp}}",
|
|
1817
|
+
"status.no_installs": "no installs recorded ({{path}} absent or empty)",
|
|
1818
|
+
"status.summary_installs": "\n{{count}} install(s) recorded",
|
|
1819
|
+
"status.lock_held": "\nlock: held (since {{since}}){{staleSuffix}}",
|
|
1820
|
+
"status.lock_held.stale_suffix": " \u2014 STALE",
|
|
1821
|
+
"status.lock_release_hint": " to release: wait for process to finish or delete {{path}}",
|
|
1822
|
+
"status.lock_free": "\nlock: free",
|
|
1823
|
+
"here.no_workflow": "no active workflow for this repo ({{path}} has no entry for cwd)",
|
|
1824
|
+
"here.no_workflow.hint": " to start: run a stage (e.g. `harnessed gates discuss`) or `harnessed run <workflow>`",
|
|
1825
|
+
"audit_log.no_records_file": "no audit records found ({{path}} does not exist)",
|
|
1826
|
+
"audit_log.no_records_empty": "no audit records found (audit.log is empty)",
|
|
1827
|
+
"audit_log.jq_missing": "\u2717 jq not found in PATH \u2014 run: harnessed doctor",
|
|
1828
|
+
"audit_log.tail_invalid": "\u2717 --tail must be a positive integer",
|
|
1829
|
+
"audit_log.head_invalid": "\u2717 --head must be a positive integer",
|
|
1830
|
+
"execute_task.require_task": "error: --task <text> is required",
|
|
1831
|
+
"execute_task.load_phases_failed": "error: failed to load workflows/{{workflow}}/phases.yaml \u2014 {{message}}",
|
|
1832
|
+
"execute_task.precommit_skipped": "\u26A0\uFE0F before-commit pre-flight skipped ({{message}}); subagent will biome-check at commit time.",
|
|
1833
|
+
"research.require_query": "error: --query <text> is required",
|
|
1834
|
+
"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.",
|
|
1835
|
+
"manifest_add.dry_run_preview": "[manifest-add] dry-run preview for upstream: {{upstream}} \u2192 {{path}}",
|
|
1836
|
+
"manifest_add.empty_answer": "error: EE-5 gate requires non-empty answer",
|
|
1837
|
+
"manifest_add.gate_passed_wrote": "[manifest-add] EE-5 gate passed; wrote {{path}}",
|
|
1838
|
+
"manifest_add.gate_passed_dry_run": "[manifest-add] EE-5 gate passed (dry-run); would write {{path}}",
|
|
1839
|
+
"resume.fail": "\u2717 {{error}}",
|
|
1840
|
+
"resume.corrupt": "\u2717 {{error}}\n path: {{path}}"
|
|
1841
|
+
};
|
|
1842
|
+
}
|
|
1843
|
+
});
|
|
1738
1844
|
function mapToSupported(raw) {
|
|
1739
1845
|
if (!raw) return "en";
|
|
1740
1846
|
if (/^zh([^a-z]|$)/i.test(raw)) return "zh-Hans";
|
|
@@ -1770,7 +1876,7 @@ function loadLocale(locale) {
|
|
|
1770
1876
|
const raw = readFileSync(path, "utf8");
|
|
1771
1877
|
cache[locale] = JSON.parse(raw);
|
|
1772
1878
|
} catch {
|
|
1773
|
-
cache[locale] = {};
|
|
1879
|
+
cache[locale] = locale === "en" ? en_default : {};
|
|
1774
1880
|
}
|
|
1775
1881
|
return cache[locale];
|
|
1776
1882
|
}
|
|
@@ -1800,6 +1906,7 @@ function t(key, params) {
|
|
|
1800
1906
|
var SUPPORTED, currentLocale, cache;
|
|
1801
1907
|
var init_i18n = __esm({
|
|
1802
1908
|
"src/i18n/index.ts"() {
|
|
1909
|
+
init_en();
|
|
1803
1910
|
SUPPORTED = /* @__PURE__ */ new Set(["en", "zh-Hans"]);
|
|
1804
1911
|
currentLocale = null;
|
|
1805
1912
|
cache = {};
|
|
@@ -2504,7 +2611,7 @@ function nameToYamlHintPath(name) {
|
|
|
2504
2611
|
function shouldOverwriteFile(content) {
|
|
2505
2612
|
return HARNESSED_MARKER_RX.test(content) || V3_4_3_SIGNATURE_SUB_RX.test(content) || V3_4_3_SIGNATURE_MASTER_RX.test(content);
|
|
2506
2613
|
}
|
|
2507
|
-
async function writeAllCommands(slashNames, commandsDir, rolePrompts, capabilities, installedPlugins, installedUserSkills, writer, fileExists2 = existsSync, readFileSync14 = (
|
|
2614
|
+
async function writeAllCommands(slashNames, commandsDir, rolePrompts, capabilities, installedPlugins, installedUserSkills, writer, fileExists2 = existsSync, readFileSync14 = (p7) => readFileSync(p7, "utf8")) {
|
|
2508
2615
|
const results = [];
|
|
2509
2616
|
const aggregatedWarnings = /* @__PURE__ */ new Set();
|
|
2510
2617
|
for (const name of slashNames) {
|
|
@@ -3461,10 +3568,10 @@ ${rp.checklist.map((c, i) => ` ${i + 1}. ${c}`).join("\n")}` : "";
|
|
|
3461
3568
|
}
|
|
3462
3569
|
function isRalphLoopOptIn(phase) {
|
|
3463
3570
|
if (!phase || typeof phase !== "object") return false;
|
|
3464
|
-
const
|
|
3465
|
-
if (
|
|
3466
|
-
if (
|
|
3467
|
-
const fb =
|
|
3571
|
+
const p7 = phase;
|
|
3572
|
+
if (p7.max_iterations !== void 0 && p7.max_iterations !== null) return true;
|
|
3573
|
+
if (p7.upstream === "ralph-loop") return true;
|
|
3574
|
+
const fb = p7.fallback;
|
|
3468
3575
|
if (fb?.max_iterations_exceeded !== void 0) return true;
|
|
3469
3576
|
return false;
|
|
3470
3577
|
}
|
|
@@ -3729,6 +3836,83 @@ This applies to: strategic-layer review skip / phase-layer clarification skip /
|
|
|
3729
3836
|
};
|
|
3730
3837
|
}
|
|
3731
3838
|
});
|
|
3839
|
+
function getPackageRoot() {
|
|
3840
|
+
const thisFile = fileURLToPath(import.meta.url);
|
|
3841
|
+
const thisDir = dirname(thisFile);
|
|
3842
|
+
if (thisDir.endsWith("dist") || thisDir.replace(/\\/g, "/").endsWith("/dist")) {
|
|
3843
|
+
return resolve(thisDir, "..");
|
|
3844
|
+
}
|
|
3845
|
+
return resolve(thisDir, "..", "..", "..");
|
|
3846
|
+
}
|
|
3847
|
+
var init_packagePath = __esm({
|
|
3848
|
+
"src/cli/lib/packagePath.ts"() {
|
|
3849
|
+
}
|
|
3850
|
+
});
|
|
3851
|
+
|
|
3852
|
+
// src/cli/lib/assetsRoot.ts
|
|
3853
|
+
var assetsRoot_exports = {};
|
|
3854
|
+
__export(assetsRoot_exports, {
|
|
3855
|
+
computeAssetsRoot: () => computeAssetsRoot,
|
|
3856
|
+
getAssetsRoot: () => getAssetsRoot,
|
|
3857
|
+
isCompiledModuleUrl: () => isCompiledModuleUrl
|
|
3858
|
+
});
|
|
3859
|
+
function isCompiledModuleUrl(url) {
|
|
3860
|
+
let s = url;
|
|
3861
|
+
try {
|
|
3862
|
+
s = decodeURIComponent(url);
|
|
3863
|
+
} catch {
|
|
3864
|
+
}
|
|
3865
|
+
const normalized = s.replace(/\\/g, "/").toLowerCase();
|
|
3866
|
+
return BUNFS_MARKERS.some((m) => normalized.includes(m));
|
|
3867
|
+
}
|
|
3868
|
+
function computeAssetsRoot(d) {
|
|
3869
|
+
const override = d.env.HARNESSED_ASSETS_OVERRIDE;
|
|
3870
|
+
if (override && override.trim().length > 0) {
|
|
3871
|
+
return { root: override.trim(), source: "override", compiledAssetsMissing: false };
|
|
3872
|
+
}
|
|
3873
|
+
if (isCompiledModuleUrl(d.moduleUrl)) {
|
|
3874
|
+
const root = join(d.stateRoot(), "assets", d.version);
|
|
3875
|
+
const present = d.exists(join(root, "workflows"));
|
|
3876
|
+
return { root, source: "compiled", compiledAssetsMissing: !present };
|
|
3877
|
+
}
|
|
3878
|
+
return { root: d.packageRoot, source: "package", compiledAssetsMissing: false };
|
|
3879
|
+
}
|
|
3880
|
+
function realDeps() {
|
|
3881
|
+
return {
|
|
3882
|
+
env: process.env,
|
|
3883
|
+
moduleUrl: import.meta.url,
|
|
3884
|
+
exists: (p7) => {
|
|
3885
|
+
try {
|
|
3886
|
+
return existsSync(p7);
|
|
3887
|
+
} catch {
|
|
3888
|
+
return false;
|
|
3889
|
+
}
|
|
3890
|
+
},
|
|
3891
|
+
stateRoot: () => detectPlatform().stateRoot,
|
|
3892
|
+
packageRoot: getPackageRoot(),
|
|
3893
|
+
version: package_default.version
|
|
3894
|
+
};
|
|
3895
|
+
}
|
|
3896
|
+
function getAssetsRoot() {
|
|
3897
|
+
const r = computeAssetsRoot(realDeps());
|
|
3898
|
+
if (r.source === "compiled" && r.compiledAssetsMissing && !warnedMissing) {
|
|
3899
|
+
warnedMissing = true;
|
|
3900
|
+
console.error(
|
|
3901
|
+
`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)`
|
|
3902
|
+
);
|
|
3903
|
+
}
|
|
3904
|
+
return r.root;
|
|
3905
|
+
}
|
|
3906
|
+
var BUNFS_MARKERS, warnedMissing;
|
|
3907
|
+
var init_assetsRoot = __esm({
|
|
3908
|
+
"src/cli/lib/assetsRoot.ts"() {
|
|
3909
|
+
init_package();
|
|
3910
|
+
init_platform();
|
|
3911
|
+
init_packagePath();
|
|
3912
|
+
BUNFS_MARKERS = ["/$bunfs/", "/~bun/"];
|
|
3913
|
+
warnedMissing = false;
|
|
3914
|
+
}
|
|
3915
|
+
});
|
|
3732
3916
|
async function loadUserOverrides(packageRoot) {
|
|
3733
3917
|
const yamlPath = resolve(packageRoot, "workflows", "judgments", "user-overrides.yaml");
|
|
3734
3918
|
let raw;
|
|
@@ -3837,24 +4021,6 @@ var init_gateContext = __esm({
|
|
|
3837
4021
|
"src/cli/lib/gateContext.ts"() {
|
|
3838
4022
|
}
|
|
3839
4023
|
});
|
|
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
4024
|
function registerRun(program2) {
|
|
3859
4025
|
program2.command("run").description(
|
|
3860
4026
|
"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 +4139,19 @@ async function listWorkflowNames(workflowsDir) {
|
|
|
3973
4139
|
const names = [];
|
|
3974
4140
|
const entries = await readdir(workflowsDir);
|
|
3975
4141
|
for (const e of entries.sort()) {
|
|
3976
|
-
const
|
|
3977
|
-
const s = await stat(
|
|
4142
|
+
const p7 = join(workflowsDir, e);
|
|
4143
|
+
const s = await stat(p7).catch(() => null);
|
|
3978
4144
|
if (!s?.isDirectory()) continue;
|
|
3979
|
-
if (await fileExists(join(
|
|
4145
|
+
if (await fileExists(join(p7, "workflow.yaml"))) {
|
|
3980
4146
|
names.push(e);
|
|
3981
4147
|
continue;
|
|
3982
4148
|
}
|
|
3983
|
-
if (await fileExists(join(
|
|
4149
|
+
if (await fileExists(join(p7, "auto", "workflow.yaml"))) {
|
|
3984
4150
|
names.push(e);
|
|
3985
|
-
const subs = await readdir(
|
|
4151
|
+
const subs = await readdir(p7).catch(() => []);
|
|
3986
4152
|
for (const sub of subs.sort()) {
|
|
3987
4153
|
if (sub === "auto") continue;
|
|
3988
|
-
if (await fileExists(join(
|
|
4154
|
+
if (await fileExists(join(p7, sub, "workflow.yaml"))) {
|
|
3989
4155
|
names.push(`${e}-${sub}`);
|
|
3990
4156
|
}
|
|
3991
4157
|
}
|
|
@@ -4049,10 +4215,10 @@ var init_run2 = __esm({
|
|
|
4049
4215
|
init_path_guard();
|
|
4050
4216
|
init_loadPhases();
|
|
4051
4217
|
init_run();
|
|
4218
|
+
init_assetsRoot();
|
|
4052
4219
|
init_extract_user_overrides();
|
|
4053
4220
|
init_gateContext();
|
|
4054
|
-
|
|
4055
|
-
PACKAGE_ROOT = getPackageRoot();
|
|
4221
|
+
PACKAGE_ROOT = getAssetsRoot();
|
|
4056
4222
|
WORKFLOWS_DIR = join(PACKAGE_ROOT, "workflows");
|
|
4057
4223
|
_autoChainCache = null;
|
|
4058
4224
|
_autoChainLoadFailed = false;
|
|
@@ -4202,10 +4368,10 @@ function learningsPath(repoRoot) {
|
|
|
4202
4368
|
return join(repoRoot, ".planning", "LEARNINGS.md");
|
|
4203
4369
|
}
|
|
4204
4370
|
async function appendLearning(repoRoot, entry) {
|
|
4205
|
-
const
|
|
4206
|
-
await mkdir(dirname(
|
|
4207
|
-
if (!existsSync(
|
|
4208
|
-
await appendFile(
|
|
4371
|
+
const p7 = learningsPath(repoRoot);
|
|
4372
|
+
await mkdir(dirname(p7), { recursive: true });
|
|
4373
|
+
if (!existsSync(p7)) await writeFile(p7, HEADER, "utf8");
|
|
4374
|
+
await appendFile(p7, entry, "utf8");
|
|
4209
4375
|
}
|
|
4210
4376
|
async function captureWorkflowLearnings(ledger, phase) {
|
|
4211
4377
|
const signals = extractLearnings(ledger);
|
|
@@ -4411,10 +4577,10 @@ var init_breakLoop = __esm({
|
|
|
4411
4577
|
LOOP_THRESHOLD = 3;
|
|
4412
4578
|
}
|
|
4413
4579
|
});
|
|
4414
|
-
function realProbe(
|
|
4580
|
+
function realProbe(p7) {
|
|
4415
4581
|
try {
|
|
4416
4582
|
if (typeof spawnSync !== "function") return null;
|
|
4417
|
-
const r = spawnSync(
|
|
4583
|
+
const r = spawnSync(p7, ["-c", "echo harnessed-bash-ok"], { encoding: "utf8", timeout: 5e3 });
|
|
4418
4584
|
if (!r || r.error) return null;
|
|
4419
4585
|
return r.status === 0;
|
|
4420
4586
|
} catch {
|
|
@@ -4431,9 +4597,9 @@ function realWhere(name) {
|
|
|
4431
4597
|
return [];
|
|
4432
4598
|
}
|
|
4433
4599
|
}
|
|
4434
|
-
function realExists(
|
|
4600
|
+
function realExists(p7) {
|
|
4435
4601
|
try {
|
|
4436
|
-
return existsSync(
|
|
4602
|
+
return existsSync(p7);
|
|
4437
4603
|
} catch {
|
|
4438
4604
|
return false;
|
|
4439
4605
|
}
|
|
@@ -4463,14 +4629,14 @@ function compute(d) {
|
|
|
4463
4629
|
const pathLines = d.where("bash");
|
|
4464
4630
|
const first = pathLines[0];
|
|
4465
4631
|
const wslOnPath = first && WSL_STUB_RE.test(first) ? first : void 0;
|
|
4466
|
-
const usable = (
|
|
4632
|
+
const usable = (p7) => !WSL_STUB_RE.test(p7) && d.probe(p7) !== false;
|
|
4467
4633
|
if (first && usable(first)) {
|
|
4468
4634
|
return { path: first, source: "path" };
|
|
4469
4635
|
}
|
|
4470
4636
|
const gitFirst = d.where("git")[0];
|
|
4471
4637
|
if (gitFirst && /git\.exe$/i.test(gitFirst)) {
|
|
4472
4638
|
const root = dirname8(dirname8(gitFirst));
|
|
4473
|
-
for (const cand of [
|
|
4639
|
+
for (const cand of [join18(root, "bin", "bash.exe"), join18(root, "usr", "bin", "bash.exe")]) {
|
|
4474
4640
|
if (d.exists(cand) && usable(cand)) return { path: cand, source: "git-derived", wslOnPath };
|
|
4475
4641
|
}
|
|
4476
4642
|
}
|
|
@@ -4478,13 +4644,13 @@ function compute(d) {
|
|
|
4478
4644
|
d.env.ProgramFiles,
|
|
4479
4645
|
d.env.ProgramW6432,
|
|
4480
4646
|
d.env["ProgramFiles(x86)"],
|
|
4481
|
-
d.env.LOCALAPPDATA ?
|
|
4647
|
+
d.env.LOCALAPPDATA ? join18(d.env.LOCALAPPDATA, "Programs") : void 0
|
|
4482
4648
|
];
|
|
4483
4649
|
for (const base of bases) {
|
|
4484
4650
|
if (!base) continue;
|
|
4485
4651
|
for (const cand of [
|
|
4486
|
-
|
|
4487
|
-
|
|
4652
|
+
join18(base, "Git", "bin", "bash.exe"),
|
|
4653
|
+
join18(base, "Git", "usr", "bin", "bash.exe")
|
|
4488
4654
|
]) {
|
|
4489
4655
|
if (d.exists(cand) && usable(cand))
|
|
4490
4656
|
return { path: cand, source: "standard-location", wslOnPath };
|
|
@@ -4497,10 +4663,10 @@ function compute(d) {
|
|
|
4497
4663
|
}
|
|
4498
4664
|
return { path: "bash", source: "path-fallback" };
|
|
4499
4665
|
}
|
|
4500
|
-
var dirname8,
|
|
4666
|
+
var dirname8, join18, WSL_STUB_RE, cache2;
|
|
4501
4667
|
var init_resolveBash = __esm({
|
|
4502
4668
|
"src/installers/lib/resolveBash.ts"() {
|
|
4503
|
-
({ dirname: dirname8, join:
|
|
4669
|
+
({ dirname: dirname8, join: join18 } = win32);
|
|
4504
4670
|
WSL_STUB_RE = /[\\/](windows[\\/](system32|sysnative|syswow64)|microsoft[\\/]windowsapps)[\\/]bash\.exe$/i;
|
|
4505
4671
|
cache2 = null;
|
|
4506
4672
|
}
|
|
@@ -4669,9 +4835,9 @@ function gstackSkillsDirInstalled(exists) {
|
|
|
4669
4835
|
return null;
|
|
4670
4836
|
}
|
|
4671
4837
|
function probeGstackPrefix(deps) {
|
|
4672
|
-
const exists = deps?.exists ?? ((
|
|
4838
|
+
const exists = deps?.exists ?? ((p7) => {
|
|
4673
4839
|
try {
|
|
4674
|
-
return existsSync(
|
|
4840
|
+
return existsSync(p7);
|
|
4675
4841
|
} catch {
|
|
4676
4842
|
return false;
|
|
4677
4843
|
}
|
|
@@ -5199,7 +5365,11 @@ function checkCodeGraph(cwd = process.cwd()) {
|
|
|
5199
5365
|
name: "codegraph",
|
|
5200
5366
|
status: "pass",
|
|
5201
5367
|
message: "CodeGraph not configured (optional semantic index \u2014 fewer tool-calls on code navigation)",
|
|
5202
|
-
|
|
5368
|
+
// v4.17.0 — BOTH enable steps: `npx @colbymchenry/codegraph` only wires the
|
|
5369
|
+
// MCP server into agents (upstream README step 2); the per-project index is
|
|
5370
|
+
// the separate `codegraph init` (step 3). The pre-4.17.0 hint stopped at
|
|
5371
|
+
// step 1, leaving `.codegraph/` absent and this check forever "not configured".
|
|
5372
|
+
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
5373
|
};
|
|
5204
5374
|
}
|
|
5205
5375
|
var init_check_codegraph = __esm({
|
|
@@ -5750,13 +5920,13 @@ function evalClause(clause, home) {
|
|
|
5750
5920
|
const m = clause.match(CLAUSE_RE);
|
|
5751
5921
|
if (!m?.[1] || !m[2]) return null;
|
|
5752
5922
|
const flag = m[1];
|
|
5753
|
-
let
|
|
5754
|
-
if (UNSAFE_PATH_RE.test(
|
|
5755
|
-
if (
|
|
5756
|
-
else if (
|
|
5757
|
-
else if (
|
|
5923
|
+
let p7 = m[2];
|
|
5924
|
+
if (UNSAFE_PATH_RE.test(p7)) return null;
|
|
5925
|
+
if (p7 === "~") p7 = home;
|
|
5926
|
+
else if (p7.startsWith("~/")) p7 = `${home}/${p7.slice(2)}`;
|
|
5927
|
+
else if (p7.startsWith("~")) return null;
|
|
5758
5928
|
try {
|
|
5759
|
-
const st = statSync(
|
|
5929
|
+
const st = statSync(p7);
|
|
5760
5930
|
if (flag === "f") return st.isFile();
|
|
5761
5931
|
if (flag === "d") return st.isDirectory();
|
|
5762
5932
|
return true;
|
|
@@ -6578,6 +6748,7 @@ var init_mcpHttpAdd2 = __esm({
|
|
|
6578
6748
|
init_runClaudeArgs();
|
|
6579
6749
|
init_safeCwd();
|
|
6580
6750
|
init_state2();
|
|
6751
|
+
init_verifyMessage();
|
|
6581
6752
|
installMcpHttpAdd = async (ctx) => {
|
|
6582
6753
|
const install = ctx.manifest.spec.install;
|
|
6583
6754
|
if (install.method !== "mcp-http-add") {
|
|
@@ -6713,7 +6884,9 @@ ${newEntry}
|
|
|
6713
6884
|
error: err(
|
|
6714
6885
|
ctx,
|
|
6715
6886
|
"/spec/install/cmd",
|
|
6716
|
-
|
|
6887
|
+
// v4.16.3 — formatSpawnFail parity with the other 4 installers
|
|
6888
|
+
// (tail-END + stdout fallback; CC CLI errors can land on stdout).
|
|
6889
|
+
formatSpawnFail(`${bin} mcp add (http)`, r.exitCode, r.stdout, r.stderr),
|
|
6717
6890
|
"install-failed"
|
|
6718
6891
|
)
|
|
6719
6892
|
};
|
|
@@ -6755,6 +6928,7 @@ var init_mcpStdioAdd2 = __esm({
|
|
|
6755
6928
|
init_runClaudeArgs();
|
|
6756
6929
|
init_safeCwd();
|
|
6757
6930
|
init_state2();
|
|
6931
|
+
init_verifyMessage();
|
|
6758
6932
|
installMcpStdioAdd = async (ctx) => {
|
|
6759
6933
|
const install = ctx.manifest.spec.install;
|
|
6760
6934
|
if (install.method !== "mcp-stdio-add") {
|
|
@@ -6856,7 +7030,9 @@ ${newEntry}
|
|
|
6856
7030
|
error: err(
|
|
6857
7031
|
ctx,
|
|
6858
7032
|
"/spec/install/cmd",
|
|
6859
|
-
|
|
7033
|
+
// v4.16.3 — formatSpawnFail parity with the other 4 installers
|
|
7034
|
+
// (tail-END + stdout fallback; CC CLI errors can land on stdout).
|
|
7035
|
+
formatSpawnFail(`${bin} mcp add`, r.exitCode, r.stdout, r.stderr),
|
|
6860
7036
|
"install-failed"
|
|
6861
7037
|
)
|
|
6862
7038
|
};
|
|
@@ -7300,7 +7476,7 @@ async function installBaseProfile(opts) {
|
|
|
7300
7476
|
const alreadyInstalled = [];
|
|
7301
7477
|
const skipped = [];
|
|
7302
7478
|
const failed = [];
|
|
7303
|
-
for (const path of await listBaseManifests(
|
|
7479
|
+
for (const path of await listBaseManifests(getAssetsRoot())) {
|
|
7304
7480
|
let yamlSrc;
|
|
7305
7481
|
try {
|
|
7306
7482
|
yamlSrc = await readFile(path, "utf8");
|
|
@@ -7354,7 +7530,7 @@ var init_install_base = __esm({
|
|
|
7354
7530
|
"src/cli/install-base.ts"() {
|
|
7355
7531
|
init_installers();
|
|
7356
7532
|
init_validate();
|
|
7357
|
-
|
|
7533
|
+
init_assetsRoot();
|
|
7358
7534
|
}
|
|
7359
7535
|
});
|
|
7360
7536
|
|
|
@@ -7643,6 +7819,127 @@ var init_l4_rescue = __esm({
|
|
|
7643
7819
|
}
|
|
7644
7820
|
});
|
|
7645
7821
|
|
|
7822
|
+
// src/cli/lib/optional-offer.ts
|
|
7823
|
+
var optional_offer_exports = {};
|
|
7824
|
+
__export(optional_offer_exports, {
|
|
7825
|
+
runOptionalOffer: () => runOptionalOffer
|
|
7826
|
+
});
|
|
7827
|
+
function truncateHint(desc) {
|
|
7828
|
+
return desc.length > 80 ? `${desc.slice(0, 80)}\u2026` : desc;
|
|
7829
|
+
}
|
|
7830
|
+
async function loadOptionalManifests(optionalDir) {
|
|
7831
|
+
let entries;
|
|
7832
|
+
try {
|
|
7833
|
+
entries = await readdir(optionalDir);
|
|
7834
|
+
} catch {
|
|
7835
|
+
return [];
|
|
7836
|
+
}
|
|
7837
|
+
const out = [];
|
|
7838
|
+
for (const f of entries.sort()) {
|
|
7839
|
+
if (!f.endsWith(".yaml")) continue;
|
|
7840
|
+
try {
|
|
7841
|
+
const v = validateManifestFile(await readFile(join(optionalDir, f), "utf8"), f);
|
|
7842
|
+
if (v.ok) out.push(v.manifest);
|
|
7843
|
+
} catch {
|
|
7844
|
+
}
|
|
7845
|
+
}
|
|
7846
|
+
return out;
|
|
7847
|
+
}
|
|
7848
|
+
async function runOptionalOffer(optionalDir, offerOpts) {
|
|
7849
|
+
const out = { installed: [], alreadyInstalled: [], skipped: [], failed: [] };
|
|
7850
|
+
const manifests = await loadOptionalManifests(optionalDir);
|
|
7851
|
+
if (manifests.length === 0) return out;
|
|
7852
|
+
const pending = [];
|
|
7853
|
+
for (const manifest of manifests) {
|
|
7854
|
+
const ctx = { manifest, opts: PROBE_OPTS, level: "L2", cwd: process.cwd() };
|
|
7855
|
+
let present = false;
|
|
7856
|
+
try {
|
|
7857
|
+
present = await isAlreadyInstalled(ctx);
|
|
7858
|
+
} catch {
|
|
7859
|
+
present = false;
|
|
7860
|
+
}
|
|
7861
|
+
if (present) out.alreadyInstalled.push(manifest.metadata.name);
|
|
7862
|
+
else pending.push(manifest);
|
|
7863
|
+
}
|
|
7864
|
+
if (pending.length === 0) return out;
|
|
7865
|
+
if (!offerOpts.interactive) {
|
|
7866
|
+
const names = pending.map((m) => m.metadata.name);
|
|
7867
|
+
console.log(
|
|
7868
|
+
`
|
|
7869
|
+
${names.length} optional component(s) available (opt-in, not part of base setup) \u2014 install with \`harnessed install <name>\`: ${names.join(", ")}`
|
|
7870
|
+
);
|
|
7871
|
+
out.skipped.push(...names);
|
|
7872
|
+
return out;
|
|
7873
|
+
}
|
|
7874
|
+
console.log(
|
|
7875
|
+
`
|
|
7876
|
+
${pending.length} optional component(s) available (opt-in \u2014 none selected by default):`
|
|
7877
|
+
);
|
|
7878
|
+
const ans = await p.multiselect({
|
|
7879
|
+
message: "Select optional components to install (space to toggle, enter to continue \u2014 empty = install nothing)",
|
|
7880
|
+
options: pending.map((m) => ({
|
|
7881
|
+
value: m.metadata.name,
|
|
7882
|
+
label: m.metadata.display_name ?? m.metadata.name,
|
|
7883
|
+
hint: truncateHint(m.metadata.description)
|
|
7884
|
+
})),
|
|
7885
|
+
initialValues: [],
|
|
7886
|
+
required: false
|
|
7887
|
+
});
|
|
7888
|
+
if (p.isCancel(ans)) {
|
|
7889
|
+
out.skipped.push(...pending.map((m) => m.metadata.name));
|
|
7890
|
+
return out;
|
|
7891
|
+
}
|
|
7892
|
+
const chosen = new Set(ans);
|
|
7893
|
+
for (const manifest of pending) {
|
|
7894
|
+
const name = manifest.metadata.name;
|
|
7895
|
+
if (!chosen.has(name)) {
|
|
7896
|
+
out.skipped.push(name);
|
|
7897
|
+
continue;
|
|
7898
|
+
}
|
|
7899
|
+
console.log(`
|
|
7900
|
+
${name}: $ ${manifest.spec.install.cmd}`);
|
|
7901
|
+
const opts = {
|
|
7902
|
+
...PROBE_OPTS,
|
|
7903
|
+
apply: true,
|
|
7904
|
+
// see IMPL NOTE header — this confirm IS the L4 opt-in for npm-cli globals.
|
|
7905
|
+
system: manifest.spec.install.method === "npm-cli"
|
|
7906
|
+
};
|
|
7907
|
+
const r = await runInstall(manifest, opts);
|
|
7908
|
+
if ("aborted" in r) {
|
|
7909
|
+
out.skipped.push(name);
|
|
7910
|
+
console.log(` \u21B7 skipped ${name} (${r.reason})`);
|
|
7911
|
+
} else if (r.ok) {
|
|
7912
|
+
out.installed.push(name);
|
|
7913
|
+
console.log(` \u2713 installed ${name}`);
|
|
7914
|
+
if (name === "codegraph") {
|
|
7915
|
+
console.log(" run `codegraph init` in each project to build its index");
|
|
7916
|
+
}
|
|
7917
|
+
} else {
|
|
7918
|
+
out.failed.push({ name, reason: r.error.message });
|
|
7919
|
+
console.error(` \u2717 failed ${name}: ${r.error.message}`);
|
|
7920
|
+
}
|
|
7921
|
+
}
|
|
7922
|
+
return out;
|
|
7923
|
+
}
|
|
7924
|
+
var PROBE_OPTS;
|
|
7925
|
+
var init_optional_offer = __esm({
|
|
7926
|
+
"src/cli/lib/optional-offer.ts"() {
|
|
7927
|
+
init_installers();
|
|
7928
|
+
init_idempotent();
|
|
7929
|
+
init_validate();
|
|
7930
|
+
PROBE_OPTS = {
|
|
7931
|
+
apply: false,
|
|
7932
|
+
dryRun: false,
|
|
7933
|
+
system: false,
|
|
7934
|
+
nonInteractive: true,
|
|
7935
|
+
fullDiff: false,
|
|
7936
|
+
color: "auto",
|
|
7937
|
+
updateInstalled: false,
|
|
7938
|
+
quiet: true
|
|
7939
|
+
};
|
|
7940
|
+
}
|
|
7941
|
+
});
|
|
7942
|
+
|
|
7646
7943
|
// src/cli/lib/auto-install.ts
|
|
7647
7944
|
var auto_install_exports = {};
|
|
7648
7945
|
__export(auto_install_exports, {
|
|
@@ -8124,15 +8421,15 @@ async function parsePlan(raw) {
|
|
|
8124
8421
|
} catch {
|
|
8125
8422
|
return null;
|
|
8126
8423
|
}
|
|
8127
|
-
const
|
|
8128
|
-
if (!Array.isArray(
|
|
8424
|
+
const p7 = parsed;
|
|
8425
|
+
if (!Array.isArray(p7.fire) && !Array.isArray(p7.skip)) return null;
|
|
8129
8426
|
const plan = {
|
|
8130
|
-
fire: Array.isArray(
|
|
8131
|
-
skip: Array.isArray(
|
|
8427
|
+
fire: Array.isArray(p7.fire) ? p7.fire : [],
|
|
8428
|
+
skip: Array.isArray(p7.skip) ? p7.skip : []
|
|
8132
8429
|
};
|
|
8133
|
-
if (typeof
|
|
8134
|
-
if (
|
|
8135
|
-
plan.parallelism =
|
|
8430
|
+
if (typeof p7.master === "string") plan.master = p7.master;
|
|
8431
|
+
if (p7.parallelism && typeof p7.parallelism === "object" && !Array.isArray(p7.parallelism)) {
|
|
8432
|
+
plan.parallelism = p7.parallelism;
|
|
8136
8433
|
}
|
|
8137
8434
|
return plan;
|
|
8138
8435
|
}
|
|
@@ -8177,8 +8474,8 @@ function registerCheckpoint(program2) {
|
|
|
8177
8474
|
if (action === "complete") {
|
|
8178
8475
|
const { checkArtifacts: checkArtifacts2 } = await Promise.resolve().then(() => (init_evidence(), evidence_exports));
|
|
8179
8476
|
const { mutateSubProgress: mutateSubProgress3 } = await Promise.resolve().then(() => (init_state(), state_exports));
|
|
8180
|
-
const {
|
|
8181
|
-
const result = await checkArtifacts2(sub,
|
|
8477
|
+
const { getAssetsRoot: getAssetsRoot2 } = await Promise.resolve().then(() => (init_assetsRoot(), assetsRoot_exports));
|
|
8478
|
+
const result = await checkArtifacts2(sub, getAssetsRoot2());
|
|
8182
8479
|
const { checkPlanningSync: checkPlanningSync2 } = await Promise.resolve().then(() => (init_evidence(), evidence_exports));
|
|
8183
8480
|
const syncResult = await checkPlanningSync2(process.cwd(), null);
|
|
8184
8481
|
const allMissing = [...result.missing, ...syncResult.missing];
|
|
@@ -8343,8 +8640,8 @@ function registerDoctor(program2) {
|
|
|
8343
8640
|
// src/cli/gates.ts
|
|
8344
8641
|
init_path_guard();
|
|
8345
8642
|
init_judgmentResolver();
|
|
8643
|
+
init_assetsRoot();
|
|
8346
8644
|
init_gateContext();
|
|
8347
|
-
init_packagePath();
|
|
8348
8645
|
var VALID_MASTERS = /* @__PURE__ */ new Set(["auto", "discuss", "plan", "task", "verify"]);
|
|
8349
8646
|
var STAGE_MASTERS = /* @__PURE__ */ new Set(["discuss", "plan", "task", "verify"]);
|
|
8350
8647
|
var PARALLELISM_GATE = "judgments.parallelism-gate.agent-teams-upgrade.fires";
|
|
@@ -8369,7 +8666,7 @@ function registerGates(program2) {
|
|
|
8369
8666
|
process.exit(1);
|
|
8370
8667
|
return;
|
|
8371
8668
|
}
|
|
8372
|
-
const packageRoot =
|
|
8669
|
+
const packageRoot = getAssetsRoot();
|
|
8373
8670
|
const yamlPath = resolveMasterYamlPath2(master, packageRoot);
|
|
8374
8671
|
let raw_yaml;
|
|
8375
8672
|
try {
|
|
@@ -8487,10 +8784,10 @@ async function dirSizeKb(dir) {
|
|
|
8487
8784
|
if (!cur) break;
|
|
8488
8785
|
const entries = await readdir(cur, { withFileTypes: true });
|
|
8489
8786
|
for (const e of entries) {
|
|
8490
|
-
const
|
|
8491
|
-
if (e.isDirectory()) stack.push(
|
|
8787
|
+
const p7 = join(cur, e.name);
|
|
8788
|
+
if (e.isDirectory()) stack.push(p7);
|
|
8492
8789
|
else if (e.isFile()) {
|
|
8493
|
-
const st = await stat(
|
|
8790
|
+
const st = await stat(p7);
|
|
8494
8791
|
total += st.size;
|
|
8495
8792
|
}
|
|
8496
8793
|
}
|
|
@@ -8563,7 +8860,7 @@ init_i18n();
|
|
|
8563
8860
|
init_installers();
|
|
8564
8861
|
init_path_guard();
|
|
8565
8862
|
init_validate();
|
|
8566
|
-
|
|
8863
|
+
init_assetsRoot();
|
|
8567
8864
|
function formatError(e) {
|
|
8568
8865
|
const head = `error: ${e.message}`;
|
|
8569
8866
|
const where = e.path && e.path !== "/" ? `
|
|
@@ -8581,14 +8878,14 @@ function registerInstall(program2) {
|
|
|
8581
8878
|
const resolvedName = resolveAlias2(name) ?? name;
|
|
8582
8879
|
checkPathSafe(resolvedName);
|
|
8583
8880
|
const candidatePaths = ["tools", "skill-packs", "optional"].map(
|
|
8584
|
-
(dir) => resolve(
|
|
8881
|
+
(dir) => resolve(getAssetsRoot(), `manifests/${dir}/${resolvedName}.yaml`)
|
|
8585
8882
|
);
|
|
8586
8883
|
let yamlSrc;
|
|
8587
8884
|
let chosenPath;
|
|
8588
|
-
for (const
|
|
8885
|
+
for (const p7 of candidatePaths) {
|
|
8589
8886
|
try {
|
|
8590
|
-
yamlSrc = await readFile(
|
|
8591
|
-
chosenPath =
|
|
8887
|
+
yamlSrc = await readFile(p7, "utf8");
|
|
8888
|
+
chosenPath = p7;
|
|
8592
8889
|
break;
|
|
8593
8890
|
} catch {
|
|
8594
8891
|
}
|
|
@@ -8630,8 +8927,10 @@ ${t("install.manifest_not_found.fix", { name: resolvedName })}`
|
|
|
8630
8927
|
}
|
|
8631
8928
|
if (result.ok) {
|
|
8632
8929
|
const version = v.manifest.spec.install.method === "npm-cli" && "npm_version" in v.manifest.spec.install ? v.manifest.spec.install.npm_version : "";
|
|
8930
|
+
const already = "alreadyInstalled" in result && result.alreadyInstalled === true;
|
|
8931
|
+
const keyBase = already ? "install.already_installed" : "install.success";
|
|
8633
8932
|
console.log(
|
|
8634
|
-
version ? t(
|
|
8933
|
+
version ? t(`${keyBase}_with_version`, { name: v.manifest.metadata.name, version }) : t(keyBase, { name: v.manifest.metadata.name })
|
|
8635
8934
|
);
|
|
8636
8935
|
process.exit(0);
|
|
8637
8936
|
}
|
|
@@ -8926,8 +9225,8 @@ function registerNext(program2) {
|
|
|
8926
9225
|
init_i18n();
|
|
8927
9226
|
init_localeYaml();
|
|
8928
9227
|
init_run();
|
|
9228
|
+
init_assetsRoot();
|
|
8929
9229
|
init_generateCommands();
|
|
8930
|
-
init_packagePath();
|
|
8931
9230
|
init_run2();
|
|
8932
9231
|
var DEFAULT_MAX_ITERATIONS = 20;
|
|
8933
9232
|
var DEFAULT_MODEL = "sonnet";
|
|
@@ -9044,7 +9343,7 @@ function registerPrompt(program2) {
|
|
|
9044
9343
|
program2.command("prompt").description(
|
|
9045
9344
|
"Print a spawn-ready prompt for a sub-workflow (role + checklist + protocols, no spawn)."
|
|
9046
9345
|
).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) => {
|
|
9047
|
-
const packageRoot =
|
|
9346
|
+
const packageRoot = getAssetsRoot();
|
|
9048
9347
|
const workflowsDir = resolve(packageRoot, "workflows");
|
|
9049
9348
|
const rolePrompts = await loadRolePrompts(workflowsDir);
|
|
9050
9349
|
const def = buildAgentDef(sub, rolePrompts);
|
|
@@ -9130,9 +9429,9 @@ function registerReleasePreflight(program2) {
|
|
|
9130
9429
|
// src/cli/research.ts
|
|
9131
9430
|
init_i18n();
|
|
9132
9431
|
init_run();
|
|
9133
|
-
|
|
9432
|
+
init_assetsRoot();
|
|
9134
9433
|
init_run2();
|
|
9135
|
-
var PACKAGE_ROOT2 =
|
|
9434
|
+
var PACKAGE_ROOT2 = getAssetsRoot();
|
|
9136
9435
|
var WORKFLOWS_DIR2 = join(PACKAGE_ROOT2, "workflows");
|
|
9137
9436
|
function registerResearch(program2) {
|
|
9138
9437
|
program2.command("research").description(
|
|
@@ -9313,6 +9612,7 @@ init_run2();
|
|
|
9313
9612
|
// src/cli/setup.ts
|
|
9314
9613
|
init_i18n();
|
|
9315
9614
|
init_platform();
|
|
9615
|
+
init_assetsRoot();
|
|
9316
9616
|
|
|
9317
9617
|
// src/cli/lib/capabilityResolver.ts
|
|
9318
9618
|
init_platform();
|
|
@@ -9565,7 +9865,6 @@ async function enableUserLangInSettings(override) {
|
|
|
9565
9865
|
|
|
9566
9866
|
// src/cli/setup.ts
|
|
9567
9867
|
init_generateCommands();
|
|
9568
|
-
init_packagePath();
|
|
9569
9868
|
|
|
9570
9869
|
// src/cli/lib/renderSkillTemplates.ts
|
|
9571
9870
|
init_i18n();
|
|
@@ -10048,7 +10347,7 @@ function registerSetup(program2) {
|
|
|
10048
10347
|
await printSetupVersionBanner();
|
|
10049
10348
|
const dryRun = raw.dryRun === true;
|
|
10050
10349
|
if (raw.platform !== void 0) await applyPlatformOption(raw.platform);
|
|
10051
|
-
const pkgRoot =
|
|
10350
|
+
const pkgRoot = getAssetsRoot();
|
|
10052
10351
|
const workflowsDir = resolve(pkgRoot, "workflows");
|
|
10053
10352
|
const skillsBase = getSkillsDir();
|
|
10054
10353
|
await warnIfAgentTeamsMissing();
|
|
@@ -10126,7 +10425,7 @@ function registerSetup(program2) {
|
|
|
10126
10425
|
capabilitiesMap,
|
|
10127
10426
|
installedPlugins,
|
|
10128
10427
|
installedUserSkills,
|
|
10129
|
-
async (
|
|
10428
|
+
async (p7, c) => writeFile(p7, c, "utf8")
|
|
10130
10429
|
);
|
|
10131
10430
|
const writtenCount = cmdResult.results.filter((r) => r.written).length;
|
|
10132
10431
|
const skippedCount = cmdResult.results.filter((r) => !r.written && r.warning).length;
|
|
@@ -10163,12 +10462,12 @@ installing ${manifestPaths.length} upstream components (MCP serialized, rest par
|
|
|
10163
10462
|
if (!forceFirstPass && !dryRun && raw.nonInteractive !== true && b.alreadyInstalled.length > 0) {
|
|
10164
10463
|
const isTty = process.stdin.isTTY === true && process.stdout.isTTY === true;
|
|
10165
10464
|
if (isTty) {
|
|
10166
|
-
const { confirm: confirm5, isCancel:
|
|
10465
|
+
const { confirm: confirm5, isCancel: isCancel7 } = await import('@clack/prompts');
|
|
10167
10466
|
const ans = await confirm5({
|
|
10168
10467
|
message: `Update ${b.alreadyInstalled.length} already-installed plugin(s) listed above? (MCP servers excluded \u2014 they ignore force-update)`,
|
|
10169
10468
|
initialValue: false
|
|
10170
10469
|
});
|
|
10171
|
-
if (!
|
|
10470
|
+
if (!isCancel7(ans) && ans === true) {
|
|
10172
10471
|
console.log(`
|
|
10173
10472
|
force-updating ${b.alreadyInstalled.length} plugin(s)...`);
|
|
10174
10473
|
const b2 = await runStepBInstall(manifestPaths, {
|
|
@@ -10202,6 +10501,13 @@ Force-update pass complete: ${b2.installed.length} installed / ${b2.keptExisting
|
|
|
10202
10501
|
await runL4Rescue2(manifestPaths, b.skipped);
|
|
10203
10502
|
}
|
|
10204
10503
|
}
|
|
10504
|
+
if (!dryRun) {
|
|
10505
|
+
const optIsTty = process.stdin.isTTY === true && process.stdout.isTTY === true;
|
|
10506
|
+
const { runOptionalOffer: runOptionalOffer2 } = await Promise.resolve().then(() => (init_optional_offer(), optional_offer_exports));
|
|
10507
|
+
await runOptionalOffer2(resolve(pkgRoot, "manifests", "optional"), {
|
|
10508
|
+
interactive: optIsTty && raw.nonInteractive !== true
|
|
10509
|
+
});
|
|
10510
|
+
}
|
|
10205
10511
|
if (b.failed.length > 0) {
|
|
10206
10512
|
console.error(
|
|
10207
10513
|
`
|
|
@@ -10503,8 +10809,8 @@ async function runUninstall(manifest, opts) {
|
|
|
10503
10809
|
}
|
|
10504
10810
|
|
|
10505
10811
|
// src/cli/uninstall.ts
|
|
10812
|
+
init_assetsRoot();
|
|
10506
10813
|
init_generateCommands();
|
|
10507
|
-
init_packagePath();
|
|
10508
10814
|
async function discoverCommandFiles(commandsDir) {
|
|
10509
10815
|
const owned = [];
|
|
10510
10816
|
let entries;
|
|
@@ -10515,10 +10821,10 @@ async function discoverCommandFiles(commandsDir) {
|
|
|
10515
10821
|
}
|
|
10516
10822
|
for (const entry of entries) {
|
|
10517
10823
|
if (!entry.endsWith(".md")) continue;
|
|
10518
|
-
const
|
|
10824
|
+
const p7 = join(commandsDir, entry);
|
|
10519
10825
|
try {
|
|
10520
|
-
const content = await readFile(
|
|
10521
|
-
if (shouldOverwriteFile(content)) owned.push(
|
|
10826
|
+
const content = await readFile(p7, "utf8");
|
|
10827
|
+
if (shouldOverwriteFile(content)) owned.push(p7);
|
|
10522
10828
|
} catch {
|
|
10523
10829
|
}
|
|
10524
10830
|
}
|
|
@@ -10563,7 +10869,7 @@ async function runUnifiedUninstall(home, dryRun) {
|
|
|
10563
10869
|
const skillsDir = platform.skillsDir;
|
|
10564
10870
|
const settingsPath = platform.settingsPath;
|
|
10565
10871
|
const harnessedRoot = getHarnessedRoot();
|
|
10566
|
-
const pkgRoot =
|
|
10872
|
+
const pkgRoot = getAssetsRoot();
|
|
10567
10873
|
let workflowNames = [];
|
|
10568
10874
|
try {
|
|
10569
10875
|
const wfEntries = await readdir(resolve(pkgRoot, "workflows"));
|
|
@@ -10673,9 +10979,9 @@ function registerUninstall(program2) {
|
|
|
10673
10979
|
const { resolveAlias: resolveAlias2 } = await Promise.resolve().then(() => (init_aliases(), aliases_exports));
|
|
10674
10980
|
const resolvedName = resolveAlias2(name) ?? name;
|
|
10675
10981
|
checkPathSafe(resolvedName);
|
|
10676
|
-
const manifestPath = resolve(
|
|
10982
|
+
const manifestPath = resolve(getAssetsRoot(), `manifests/tools/${resolvedName}.yaml`);
|
|
10677
10983
|
const skillPackPath = resolve(
|
|
10678
|
-
|
|
10984
|
+
getAssetsRoot(),
|
|
10679
10985
|
`manifests/skill-packs/${resolvedName}.yaml`
|
|
10680
10986
|
);
|
|
10681
10987
|
let yamlSrc;
|
|
@@ -10734,15 +11040,15 @@ ${t("install.manifest_not_found.fix", { name: resolvedName })}`
|
|
|
10734
11040
|
// src/cli/update.ts
|
|
10735
11041
|
init_package();
|
|
10736
11042
|
init_harnessedRoot();
|
|
10737
|
-
|
|
11043
|
+
init_assetsRoot();
|
|
10738
11044
|
function npmExecutable2() {
|
|
10739
11045
|
return process.platform === "win32" ? "npm.cmd" : "npm";
|
|
10740
11046
|
}
|
|
10741
11047
|
function changelogTop() {
|
|
10742
11048
|
try {
|
|
10743
|
-
const
|
|
10744
|
-
if (!existsSync(
|
|
10745
|
-
const body = readFileSync(
|
|
11049
|
+
const p7 = join(getAssetsRoot(), "CHANGELOG.md");
|
|
11050
|
+
if (!existsSync(p7)) return null;
|
|
11051
|
+
const body = readFileSync(p7, "utf8");
|
|
10746
11052
|
const start = body.indexOf("\n## ");
|
|
10747
11053
|
if (start < 0) return null;
|
|
10748
11054
|
const rest = body.slice(start + 1);
|