harnessed 4.14.2 → 4.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +273 -49
- package/dist/cli.mjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/workflows/auto/SKILL.md +1 -1
- package/workflows/auto/SKILL.zh-Hans.md +1 -1
- package/workflows/capabilities.yaml +5 -1
- package/workflows/plan/architecture/SKILL.md +1 -1
- package/workflows/plan/architecture/SKILL.zh-Hans.md +1 -1
- package/workflows/plan/auto/SKILL.md +1 -1
- package/workflows/plan/auto/SKILL.zh-Hans.md +1 -1
- package/workflows/plan/phase/SKILL.md +1 -1
- package/workflows/plan/phase/SKILL.zh-Hans.md +1 -1
- package/workflows/research/SKILL.md +1 -1
- package/workflows/research/SKILL.zh-Hans.md +1 -1
- package/workflows/retro/SKILL.md +1 -1
- package/workflows/retro/SKILL.zh-Hans.md +1 -1
- package/workflows/ship/auto/SKILL.md +1 -1
- package/workflows/ship/auto/SKILL.zh-Hans.md +1 -1
- package/workflows/ship/preflight/SKILL.md +1 -1
- package/workflows/ship/preflight/SKILL.zh-Hans.md +1 -1
- package/workflows/task/auto/SKILL.md +1 -1
- package/workflows/task/auto/SKILL.zh-Hans.md +1 -1
- package/workflows/task/code/SKILL.md +1 -1
- package/workflows/task/code/SKILL.zh-Hans.md +1 -1
- package/workflows/task/deliver/SKILL.md +6 -1
- package/workflows/task/deliver/SKILL.zh-Hans.md +6 -1
- package/workflows/task/deliver/workflow.yaml +4 -0
- package/workflows/task/test/SKILL.md +1 -1
- package/workflows/task/test/SKILL.zh-Hans.md +1 -1
- package/workflows/verify/auto/SKILL.md +1 -1
- package/workflows/verify/auto/SKILL.zh-Hans.md +1 -1
- package/workflows/verify/code-review/SKILL.md +1 -1
- package/workflows/verify/code-review/SKILL.zh-Hans.md +1 -1
- package/workflows/verify/design/SKILL.md +1 -1
- package/workflows/verify/design/SKILL.zh-Hans.md +1 -1
- package/workflows/verify/eval-review/SKILL.md +1 -1
- package/workflows/verify/eval-review/SKILL.zh-Hans.md +1 -1
- package/workflows/verify/multispec/SKILL.md +1 -1
- package/workflows/verify/multispec/SKILL.zh-Hans.md +1 -1
- package/workflows/verify/paranoid/SKILL.md +1 -1
- package/workflows/verify/paranoid/SKILL.zh-Hans.md +1 -1
- package/workflows/verify/progress/SKILL.md +1 -1
- package/workflows/verify/progress/SKILL.zh-Hans.md +1 -1
- package/workflows/verify/qa/SKILL.md +1 -1
- package/workflows/verify/qa/SKILL.zh-Hans.md +1 -1
- package/workflows/verify/security/SKILL.md +1 -1
- package/workflows/verify/security/SKILL.zh-Hans.md +1 -1
- package/workflows/verify/simplify/SKILL.md +1 -1
- package/workflows/verify/simplify/SKILL.zh-Hans.md +1 -1
- package/workflows/verify/validate-phase/SKILL.md +1 -1
- package/workflows/verify/validate-phase/SKILL.zh-Hans.md +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { existsSync, mkdirSync, renameSync, writeFileSync, readFileSync, readdirSync } from 'fs';
|
|
2
|
+
import { existsSync, mkdirSync, renameSync, writeFileSync, readFileSync, readdirSync, statSync } from 'fs';
|
|
3
3
|
import { homedir } from 'os';
|
|
4
4
|
import { join, dirname, resolve, sep, relative } from 'path';
|
|
5
5
|
import { Type } from '@sinclair/typebox';
|
|
@@ -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.15.1",
|
|
42
42
|
description: "AI coding harness package manager + composition orchestrator",
|
|
43
43
|
type: "module",
|
|
44
44
|
license: "Apache-2.0",
|
|
@@ -2357,7 +2357,9 @@ function spawnLoopSteps(indent) {
|
|
|
2357
2357
|
`${i}a. Bash: \`harnessed prompt <sub> --task "<spec>" --json\` \u2192 parse \`{prompt, max_iterations, model}\`.`,
|
|
2358
2358
|
`${i}b. Spawn a CC-native subagent (Task / Agent tool) with that \`prompt\` and \`model\`. Wrap in the ralph-loop plugin for completion-promise enforcement:`,
|
|
2359
2359
|
`${i} \`/ralph-loop "<prompt>" --max-iterations <max_iterations> --completion-promise "COMPLETE"\``,
|
|
2360
|
-
|
|
2360
|
+
// v4.15.0 (ADR 0036) — 3-tier preference chain: plugin → native /goal → self-loop.
|
|
2361
|
+
`${i} If the ralph-loop plugin is not installed, use the native goal gate instead (Claude Code 2.1.139+ / Codex): \`/goal "this subtask is delivered: the subagent's final output contains verbatim <promise>COMPLETE</promise>; or stop after <max_iterations> turns"\` then spawn the subagent and let the goal evaluator drive re-spawns until it clears. Set the goal only at the leaf subtask level (\`/goal\` is single-slot per session).`,
|
|
2362
|
+
`${i} If \`/goal\` is unavailable too, self-loop: spawn \u2192 check output for \`<promise>COMPLETE</promise>\` \u2192 if absent, re-spawn with the prior output appended (up to max_iterations).`,
|
|
2361
2363
|
`${i}c. If the subagent output contains \`STATUS: NEEDS_CLARIFICATION\` + a question list: STOP. Use AskUserQuestion to relay those exact questions to the user. Append the user's answers to the spec, then re-spawn the same sub. (This is the round-trip headless spawn cannot do.)`,
|
|
2362
2364
|
`${i}d. On \`<promise>COMPLETE</promise>\`: Bash \`harnessed checkpoint complete <sub> --summary "<one-line>"\`.`
|
|
2363
2365
|
];
|
|
@@ -2400,7 +2402,7 @@ function buildOrchestratorBody(name, prompt) {
|
|
|
2400
2402
|
];
|
|
2401
2403
|
const leafIndent = " ";
|
|
2402
2404
|
const leafSpawnLoop = [
|
|
2403
|
-
...spawnLoopSteps(leafIndent).slice(0,
|
|
2405
|
+
...spawnLoopSteps(leafIndent).slice(0, 6),
|
|
2404
2406
|
`${leafIndent}d. On \`<promise>COMPLETE</promise>\`: Bash \`harnessed checkpoint complete <sub> --summary "<one-line>"\`. The evidence guard runs here (fail-CLOSED): if it exits non-zero because a declared \`artifacts_expected\` file is missing, the sub is NOT done \u2014 re-spawn to produce the artifact, or pass \`--force\` only to deliberately override (records \`evidence_status: overridden\`).`,
|
|
2405
2407
|
`${leafIndent}e. If the sub cannot reach COMPLETE (max_iterations exhausted, unrecoverable error): Bash \`harnessed checkpoint fail <sub> --summary "<why>"\` to flip the ledger entry to \`failed\`, then STOP and report to the user.`
|
|
2406
2408
|
];
|
|
@@ -4409,6 +4411,86 @@ var init_breakLoop = __esm({
|
|
|
4409
4411
|
LOOP_THRESHOLD = 3;
|
|
4410
4412
|
}
|
|
4411
4413
|
});
|
|
4414
|
+
function realWhere(name) {
|
|
4415
|
+
try {
|
|
4416
|
+
if (typeof spawnSync !== "function") return [];
|
|
4417
|
+
const r = spawnSync("where", [name], { encoding: "utf8" });
|
|
4418
|
+
if (!r || r.status !== 0) return [];
|
|
4419
|
+
return (r.stdout ?? "").split(/\r?\n/).map((s) => s.trim()).filter((s) => s.length > 0);
|
|
4420
|
+
} catch {
|
|
4421
|
+
return [];
|
|
4422
|
+
}
|
|
4423
|
+
}
|
|
4424
|
+
function realExists(p6) {
|
|
4425
|
+
try {
|
|
4426
|
+
return existsSync(p6);
|
|
4427
|
+
} catch {
|
|
4428
|
+
return false;
|
|
4429
|
+
}
|
|
4430
|
+
}
|
|
4431
|
+
function defaultDeps() {
|
|
4432
|
+
return {
|
|
4433
|
+
platform: process.platform,
|
|
4434
|
+
env: process.env,
|
|
4435
|
+
where: realWhere,
|
|
4436
|
+
exists: realExists
|
|
4437
|
+
};
|
|
4438
|
+
}
|
|
4439
|
+
function resolveBash(deps) {
|
|
4440
|
+
if (cache2) return cache2;
|
|
4441
|
+
cache2 = compute({ ...defaultDeps(), ...deps });
|
|
4442
|
+
return cache2;
|
|
4443
|
+
}
|
|
4444
|
+
function compute(d) {
|
|
4445
|
+
if (d.platform !== "win32") {
|
|
4446
|
+
return { path: null, source: "path", reason: "not-applicable" };
|
|
4447
|
+
}
|
|
4448
|
+
const envBash = d.env.HARNESSED_BASH;
|
|
4449
|
+
if (envBash && envBash.trim().length > 0) {
|
|
4450
|
+
return { path: envBash.trim(), source: "env" };
|
|
4451
|
+
}
|
|
4452
|
+
const pathLines = d.where("bash");
|
|
4453
|
+
const first = pathLines[0];
|
|
4454
|
+
const wslOnPath = first && WSL_STUB_RE.test(first) ? first : void 0;
|
|
4455
|
+
if (first && !WSL_STUB_RE.test(first)) {
|
|
4456
|
+
return { path: first, source: "path" };
|
|
4457
|
+
}
|
|
4458
|
+
const gitFirst = d.where("git")[0];
|
|
4459
|
+
if (gitFirst && /git\.exe$/i.test(gitFirst)) {
|
|
4460
|
+
const root = dirname(dirname(gitFirst));
|
|
4461
|
+
for (const cand of [join(root, "bin", "bash.exe"), join(root, "usr", "bin", "bash.exe")]) {
|
|
4462
|
+
if (d.exists(cand)) return { path: cand, source: "git-derived", wslOnPath };
|
|
4463
|
+
}
|
|
4464
|
+
}
|
|
4465
|
+
const bases = [
|
|
4466
|
+
d.env.ProgramFiles,
|
|
4467
|
+
d.env.ProgramW6432,
|
|
4468
|
+
d.env["ProgramFiles(x86)"],
|
|
4469
|
+
d.env.LOCALAPPDATA ? join(d.env.LOCALAPPDATA, "Programs") : void 0
|
|
4470
|
+
];
|
|
4471
|
+
for (const base of bases) {
|
|
4472
|
+
if (!base) continue;
|
|
4473
|
+
for (const cand of [
|
|
4474
|
+
join(base, "Git", "bin", "bash.exe"),
|
|
4475
|
+
join(base, "Git", "usr", "bin", "bash.exe")
|
|
4476
|
+
]) {
|
|
4477
|
+
if (d.exists(cand)) return { path: cand, source: "standard-location", wslOnPath };
|
|
4478
|
+
}
|
|
4479
|
+
}
|
|
4480
|
+
const laterNonWsl = pathLines.find((l) => !WSL_STUB_RE.test(l));
|
|
4481
|
+
if (laterNonWsl) return { path: laterNonWsl, source: "path", wslOnPath };
|
|
4482
|
+
if (pathLines.length > 0) {
|
|
4483
|
+
return { path: null, source: "path", reason: "wsl-only", wslOnPath: first };
|
|
4484
|
+
}
|
|
4485
|
+
return { path: "bash", source: "path-fallback" };
|
|
4486
|
+
}
|
|
4487
|
+
var WSL_STUB_RE, cache2;
|
|
4488
|
+
var init_resolveBash = __esm({
|
|
4489
|
+
"src/installers/lib/resolveBash.ts"() {
|
|
4490
|
+
WSL_STUB_RE = /[\\/]windows[\\/](system32|sysnative|syswow64)[\\/]bash\.exe$/i;
|
|
4491
|
+
cache2 = null;
|
|
4492
|
+
}
|
|
4493
|
+
});
|
|
4412
4494
|
function checkNodeVersion() {
|
|
4413
4495
|
const v = process.versions.node;
|
|
4414
4496
|
const major = Number.parseInt(v.split(".")[0] ?? "0", 10);
|
|
@@ -4422,7 +4504,7 @@ function checkNodeVersion() {
|
|
|
4422
4504
|
async function checkMcpScope() {
|
|
4423
4505
|
if (detectPlatform().id !== "claude") {
|
|
4424
4506
|
return {
|
|
4425
|
-
name: "mcp scope
|
|
4507
|
+
name: "mcp scope",
|
|
4426
4508
|
status: "pass",
|
|
4427
4509
|
message: "skipped (claude-only check)"
|
|
4428
4510
|
};
|
|
@@ -4435,25 +4517,23 @@ async function checkMcpScope() {
|
|
|
4435
4517
|
projectExists = true;
|
|
4436
4518
|
} catch {
|
|
4437
4519
|
}
|
|
4438
|
-
let
|
|
4520
|
+
let userCount = 0;
|
|
4439
4521
|
try {
|
|
4440
4522
|
const raw = await readFile(userClaude, "utf8");
|
|
4441
4523
|
const parsed = JSON.parse(raw);
|
|
4442
|
-
|
|
4524
|
+
userCount = parsed.mcpServers ? Object.keys(parsed.mcpServers).length : 0;
|
|
4443
4525
|
} catch {
|
|
4444
4526
|
}
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
};
|
|
4452
|
-
}
|
|
4527
|
+
const parts = [];
|
|
4528
|
+
if (userCount > 0)
|
|
4529
|
+
parts.push(
|
|
4530
|
+
`${userCount} user-scope server(s) (~/.claude.json \u2014 harnessed default since v3.0.2)`
|
|
4531
|
+
);
|
|
4532
|
+
if (projectExists) parts.push("project .mcp.json present");
|
|
4453
4533
|
return {
|
|
4454
|
-
name: "mcp scope
|
|
4534
|
+
name: "mcp scope",
|
|
4455
4535
|
status: "pass",
|
|
4456
|
-
message:
|
|
4536
|
+
message: parts.length > 0 ? parts.join("; ") : "no MCP servers installed"
|
|
4457
4537
|
};
|
|
4458
4538
|
}
|
|
4459
4539
|
function checkJq() {
|
|
@@ -4469,13 +4549,25 @@ function checkJq() {
|
|
|
4469
4549
|
const fix = process.platform === "win32" ? "winget install jqlang.jq (or: scoop install jq)" : process.platform === "darwin" ? "brew install jq" : "apt-get install jq (or: dnf install jq)";
|
|
4470
4550
|
return { name: "jq present", status: "fail", message: "jq not found in PATH", fix };
|
|
4471
4551
|
}
|
|
4552
|
+
function sanitizeToolOutput(raw, cap = 60) {
|
|
4553
|
+
const first = raw.split(/\r?\n/)[0] ?? "";
|
|
4554
|
+
const printable = first.replace(/[^\x20-\x7E]/g, "").trim();
|
|
4555
|
+
return printable.length > 0 ? printable.slice(0, cap) : "(unreadable output)";
|
|
4556
|
+
}
|
|
4472
4557
|
function checkWinBash() {
|
|
4473
4558
|
if (process.platform !== "win32") {
|
|
4474
4559
|
return { name: "bash flavor (win)", status: "pass", message: "skipped (non-Windows)" };
|
|
4475
4560
|
}
|
|
4476
|
-
const
|
|
4477
|
-
|
|
4478
|
-
|
|
4561
|
+
const r = resolveBash();
|
|
4562
|
+
if (r.path === null) {
|
|
4563
|
+
return {
|
|
4564
|
+
name: "bash flavor (win)",
|
|
4565
|
+
status: "fail",
|
|
4566
|
+
message: `only the WSL stub is on PATH (${sanitizeToolOutput(r.wslOnPath ?? "")}) \u2014 harnessed verify/install cmds cannot run`,
|
|
4567
|
+
fix: "install Git for Windows (https://git-scm.com/download/win), reorder PATH so Git Bash precedes WSL bash.exe, or set HARNESSED_BASH to a Git Bash path"
|
|
4568
|
+
};
|
|
4569
|
+
}
|
|
4570
|
+
if (r.source === "path-fallback") {
|
|
4479
4571
|
return {
|
|
4480
4572
|
name: "bash flavor (win)",
|
|
4481
4573
|
status: "fail",
|
|
@@ -4483,21 +4575,24 @@ function checkWinBash() {
|
|
|
4483
4575
|
fix: "install Git for Windows (Git Bash) and ensure it is on PATH"
|
|
4484
4576
|
};
|
|
4485
4577
|
}
|
|
4486
|
-
|
|
4487
|
-
const distro = (probe.stdout ?? "").trim();
|
|
4488
|
-
if (distro.length > 0) {
|
|
4578
|
+
if (r.wslOnPath) {
|
|
4489
4579
|
return {
|
|
4490
4580
|
name: "bash flavor (win)",
|
|
4491
|
-
status: "
|
|
4492
|
-
message: `
|
|
4581
|
+
status: "warn",
|
|
4582
|
+
message: `PATH-first bash is the WSL stub (${sanitizeToolOutput(r.wslOnPath)}); harnessed resolved Git Bash at ${r.path} \u2014 but OTHER tools (e.g. ralph-loop plugin forks) may still hit WSL`,
|
|
4493
4583
|
fix: "reorder PATH so Git Bash precedes WSL bash.exe (Settings \u2192 System \u2192 Environment Variables)"
|
|
4494
4584
|
};
|
|
4495
4585
|
}
|
|
4496
|
-
return {
|
|
4586
|
+
return {
|
|
4587
|
+
name: "bash flavor (win)",
|
|
4588
|
+
status: "pass",
|
|
4589
|
+
message: `${r.path} (Git Bash / native, via ${r.source})`
|
|
4590
|
+
};
|
|
4497
4591
|
}
|
|
4498
4592
|
var init_check_builtin = __esm({
|
|
4499
4593
|
"src/cli/lib/check-builtin.ts"() {
|
|
4500
4594
|
init_platform();
|
|
4595
|
+
init_resolveBash();
|
|
4501
4596
|
}
|
|
4502
4597
|
});
|
|
4503
4598
|
|
|
@@ -4511,7 +4606,23 @@ function probeOne(cmd) {
|
|
|
4511
4606
|
const r = spawnSync(finder, [cmd], { encoding: "utf8" });
|
|
4512
4607
|
return r.status === 0 && (r.stdout?.trim().length ?? 0) > 0;
|
|
4513
4608
|
}
|
|
4514
|
-
function
|
|
4609
|
+
function gstackSkillsDirInstalled(exists) {
|
|
4610
|
+
for (const dir of harnessSkillsDirs()) {
|
|
4611
|
+
const root = join(dir, "gstack");
|
|
4612
|
+
if (exists(join(root, "office-hours", "SKILL.md")) || exists(join(root, "skills", "office-hours.md"))) {
|
|
4613
|
+
return root;
|
|
4614
|
+
}
|
|
4615
|
+
}
|
|
4616
|
+
return null;
|
|
4617
|
+
}
|
|
4618
|
+
function probeGstackPrefix(deps) {
|
|
4619
|
+
const exists = deps?.exists ?? ((p6) => {
|
|
4620
|
+
try {
|
|
4621
|
+
return existsSync(p6);
|
|
4622
|
+
} catch {
|
|
4623
|
+
return false;
|
|
4624
|
+
}
|
|
4625
|
+
});
|
|
4515
4626
|
const hasGstack = probeOne("gstack-office-hours");
|
|
4516
4627
|
const hasBare = probeOne("office-hours");
|
|
4517
4628
|
if (hasGstack && !hasBare) {
|
|
@@ -4527,14 +4638,23 @@ function probeGstackPrefix() {
|
|
|
4527
4638
|
fix: `edit .harnessed/config.json manually: '{"gstack_prefix":"gstack-"}' OR '{"gstack_prefix":""}'`
|
|
4528
4639
|
};
|
|
4529
4640
|
}
|
|
4641
|
+
const skillsRoot = gstackSkillsDirInstalled(exists);
|
|
4642
|
+
if (skillsRoot !== null) {
|
|
4643
|
+
return {
|
|
4644
|
+
status: "pass",
|
|
4645
|
+
prefix: "",
|
|
4646
|
+
detail: `gstack skills dir found (${skillsRoot})`
|
|
4647
|
+
};
|
|
4648
|
+
}
|
|
4530
4649
|
return {
|
|
4531
4650
|
status: "fail",
|
|
4532
|
-
detail: "neither gstack-office-hours nor office-hours found in PATH",
|
|
4533
|
-
fix: "install gstack: `
|
|
4651
|
+
detail: "neither gstack-office-hours nor office-hours found in PATH, and no gstack skills dir",
|
|
4652
|
+
fix: "install gstack: run `harnessed setup` (git-clones gstack into ~/.claude/skills/gstack) \u2014 see https://github.com/garrytan/gstack"
|
|
4534
4653
|
};
|
|
4535
4654
|
}
|
|
4536
4655
|
var init_probe_gstack = __esm({
|
|
4537
4656
|
"src/cli/lib/probe-gstack.ts"() {
|
|
4657
|
+
init_platform();
|
|
4538
4658
|
}
|
|
4539
4659
|
});
|
|
4540
4660
|
var AliasEntryV1, AliasesV1;
|
|
@@ -5463,6 +5583,56 @@ var init_ccHookAdd2 = __esm({
|
|
|
5463
5583
|
};
|
|
5464
5584
|
}
|
|
5465
5585
|
});
|
|
5586
|
+
function evalClause(clause, home) {
|
|
5587
|
+
const m = clause.match(CLAUSE_RE);
|
|
5588
|
+
if (!m?.[1] || !m[2]) return null;
|
|
5589
|
+
const flag = m[1];
|
|
5590
|
+
let p6 = m[2];
|
|
5591
|
+
if (UNSAFE_PATH_RE.test(p6)) return null;
|
|
5592
|
+
if (p6 === "~") p6 = home;
|
|
5593
|
+
else if (p6.startsWith("~/")) p6 = `${home}/${p6.slice(2)}`;
|
|
5594
|
+
else if (p6.startsWith("~")) return null;
|
|
5595
|
+
try {
|
|
5596
|
+
const st = statSync(p6);
|
|
5597
|
+
if (flag === "f") return st.isFile();
|
|
5598
|
+
if (flag === "d") return st.isDirectory();
|
|
5599
|
+
return true;
|
|
5600
|
+
} catch {
|
|
5601
|
+
return false;
|
|
5602
|
+
}
|
|
5603
|
+
}
|
|
5604
|
+
function evalTestChain(cmd, home = homedir()) {
|
|
5605
|
+
const trimmed = cmd.trim();
|
|
5606
|
+
if (trimmed.length === 0 || !trimmed.startsWith("test ")) return null;
|
|
5607
|
+
const parts = trimmed.split(/\s*(\|\||&&)\s*/);
|
|
5608
|
+
if (parts.length % 2 === 0) return null;
|
|
5609
|
+
let acc = null;
|
|
5610
|
+
let pendingOp = null;
|
|
5611
|
+
for (let i = 0; i < parts.length; i++) {
|
|
5612
|
+
const part = parts[i] ?? "";
|
|
5613
|
+
if (i % 2 === 1) {
|
|
5614
|
+
pendingOp = part;
|
|
5615
|
+
continue;
|
|
5616
|
+
}
|
|
5617
|
+
const v = evalClause(part, home);
|
|
5618
|
+
if (v === null) return null;
|
|
5619
|
+
if (acc === null) {
|
|
5620
|
+
acc = v;
|
|
5621
|
+
} else if (pendingOp === "||") {
|
|
5622
|
+
acc = acc || v;
|
|
5623
|
+
} else {
|
|
5624
|
+
acc = acc && v;
|
|
5625
|
+
}
|
|
5626
|
+
}
|
|
5627
|
+
return acc;
|
|
5628
|
+
}
|
|
5629
|
+
var CLAUSE_RE, UNSAFE_PATH_RE;
|
|
5630
|
+
var init_nativeTest = __esm({
|
|
5631
|
+
"src/installers/lib/nativeTest.ts"() {
|
|
5632
|
+
CLAUSE_RE = /^test\s+-(f|d|e)\s+(\S+)$/;
|
|
5633
|
+
UNSAFE_PATH_RE = /[|&;<>()*?"'`$={}[\]]/;
|
|
5634
|
+
}
|
|
5635
|
+
});
|
|
5466
5636
|
function expandTildeForWindows(cmd) {
|
|
5467
5637
|
const home = homedir().replace(/\\/g, "/");
|
|
5468
5638
|
return cmd.replace(/(^|[\s"'`(])~\//g, `$1${home}/`);
|
|
@@ -5483,6 +5653,11 @@ async function spawnCmd(ctx, cmd, args, timeoutMs, opts) {
|
|
|
5483
5653
|
}
|
|
5484
5654
|
};
|
|
5485
5655
|
}
|
|
5656
|
+
const joinedCmd = args.length > 0 ? `${cmd} ${args.join(" ")}` : cmd;
|
|
5657
|
+
const nativeResult = evalTestChain(joinedCmd);
|
|
5658
|
+
if (nativeResult !== null) {
|
|
5659
|
+
return { ok: true, exitCode: nativeResult ? 0 : 1, stdout: "", stderr: "" };
|
|
5660
|
+
}
|
|
5486
5661
|
const installCfg = ctx.manifest.spec.install;
|
|
5487
5662
|
const effectiveTimeoutMs = timeoutMs ?? DEFAULT_INSTALL_TIMEOUT_MS;
|
|
5488
5663
|
const env = { ...process.env, ...installCfg.env ?? {} };
|
|
@@ -5492,9 +5667,23 @@ async function spawnCmd(ctx, cmd, args, timeoutMs, opts) {
|
|
|
5492
5667
|
const stdio = ["ignore", "pipe", "pipe"];
|
|
5493
5668
|
if (process.platform === "win32") {
|
|
5494
5669
|
if (opts?.posixShell) {
|
|
5495
|
-
const
|
|
5670
|
+
const bash = resolveBash();
|
|
5671
|
+
if (bash.path === null) {
|
|
5672
|
+
return {
|
|
5673
|
+
ok: false,
|
|
5674
|
+
phase: "spawn",
|
|
5675
|
+
error: {
|
|
5676
|
+
file: ctx.manifest.metadata.name,
|
|
5677
|
+
path: "/spec/install/cmd",
|
|
5678
|
+
message: `the only \`bash\` on PATH is the WSL stub (${bash.wslOnPath ?? "C:\\Windows\\System32\\bash.exe"}) \u2014 it cannot run harnessed verify/install commands (WSL '~' is the Linux home, and distro-less stubs exit 1). Install Git for Windows (https://git-scm.com/download/win), reorder PATH so Git Bash precedes WSL bash.exe, or set HARNESSED_BASH to a Git Bash path, then re-run \`harnessed setup\`.`,
|
|
5679
|
+
line: null,
|
|
5680
|
+
column: null,
|
|
5681
|
+
keyword: "bash-missing"
|
|
5682
|
+
}
|
|
5683
|
+
};
|
|
5684
|
+
}
|
|
5496
5685
|
triedBash = true;
|
|
5497
|
-
child = spawn(
|
|
5686
|
+
child = spawn(bash.path, ["-c", joinedCmd], { cwd, env, windowsHide: true, stdio });
|
|
5498
5687
|
} else {
|
|
5499
5688
|
const expandedCmd = expandTildeForWindows(cmd);
|
|
5500
5689
|
const expandedArgs = args.map(expandTildeForWindows);
|
|
@@ -5506,8 +5695,7 @@ async function spawnCmd(ctx, cmd, args, timeoutMs, opts) {
|
|
|
5506
5695
|
});
|
|
5507
5696
|
}
|
|
5508
5697
|
} else {
|
|
5509
|
-
|
|
5510
|
-
child = spawn("/bin/sh", ["-c", joined], { cwd, env, stdio });
|
|
5698
|
+
child = spawn("/bin/sh", ["-c", joinedCmd], { cwd, env, stdio });
|
|
5511
5699
|
}
|
|
5512
5700
|
let stdout2 = "";
|
|
5513
5701
|
let stderr = "";
|
|
@@ -5526,7 +5714,10 @@ async function spawnCmd(ctx, cmd, args, timeoutMs, opts) {
|
|
|
5526
5714
|
error: {
|
|
5527
5715
|
file: ctx.manifest.metadata.name,
|
|
5528
5716
|
path: "/spec/install/cmd",
|
|
5529
|
-
|
|
5717
|
+
// v4.15.1 — fall back to stdout when stderr is empty (WSL stubs and
|
|
5718
|
+
// some CLIs write their error text to stdout; a bare trailing colon
|
|
5719
|
+
// read as "no reason" in user dogfood).
|
|
5720
|
+
message: `spawn timed out after ${effectiveTimeoutMs}ms (cmd: ${cmd}); partial output: ${(stderr || stdout2).slice(0, 200) || "(no output)"}`,
|
|
5530
5721
|
line: null,
|
|
5531
5722
|
column: null,
|
|
5532
5723
|
keyword: "spawn-timeout"
|
|
@@ -5559,6 +5750,8 @@ var DEFAULT_VERIFY_TIMEOUT_MS, DEFAULT_INSTALL_TIMEOUT_MS;
|
|
|
5559
5750
|
var init_spawn = __esm({
|
|
5560
5751
|
"src/installers/lib/spawn.ts"() {
|
|
5561
5752
|
init_security();
|
|
5753
|
+
init_nativeTest();
|
|
5754
|
+
init_resolveBash();
|
|
5562
5755
|
DEFAULT_VERIFY_TIMEOUT_MS = 15e3;
|
|
5563
5756
|
DEFAULT_INSTALL_TIMEOUT_MS = 3e5;
|
|
5564
5757
|
}
|
|
@@ -5914,6 +6107,17 @@ ${newEntry}
|
|
|
5914
6107
|
};
|
|
5915
6108
|
}
|
|
5916
6109
|
});
|
|
6110
|
+
|
|
6111
|
+
// src/installers/lib/verifyMessage.ts
|
|
6112
|
+
function formatVerifyFail(cmd, exitCode, expected, stdout2, stderr) {
|
|
6113
|
+
const cmdPart = cmd.length > 80 ? `${cmd.slice(0, 80)}\u2026` : cmd;
|
|
6114
|
+
const tail = stderr.trim().slice(0, 160) || stdout2.trim().slice(0, 160) || "(no output)";
|
|
6115
|
+
return `verify failed (exit ${exitCode} \u2260 expected ${expected}): \`${cmdPart}\` \u2014 ${tail}`;
|
|
6116
|
+
}
|
|
6117
|
+
var init_verifyMessage = __esm({
|
|
6118
|
+
"src/installers/lib/verifyMessage.ts"() {
|
|
6119
|
+
}
|
|
6120
|
+
});
|
|
5917
6121
|
function gitRevParseHead(cwd, timeoutMs = 1e4) {
|
|
5918
6122
|
return new Promise((resolve17) => {
|
|
5919
6123
|
const isWin = process.platform === "win32";
|
|
@@ -5973,6 +6177,7 @@ var init_gitCloneWithSetup2 = __esm({
|
|
|
5973
6177
|
init_preflight();
|
|
5974
6178
|
init_spawn();
|
|
5975
6179
|
init_state2();
|
|
6180
|
+
init_verifyMessage();
|
|
5976
6181
|
installGitCloneWithSetup = async (ctx) => {
|
|
5977
6182
|
const install = ctx.manifest.spec.install;
|
|
5978
6183
|
if (install.method !== "git-clone-with-setup") {
|
|
@@ -6106,7 +6311,8 @@ var init_gitCloneWithSetup2 = __esm({
|
|
|
6106
6311
|
error: err(
|
|
6107
6312
|
ctx,
|
|
6108
6313
|
"/spec/verify/cmd",
|
|
6109
|
-
|
|
6314
|
+
// v4.15.1 — unified verify-fail format (cmd + output tail; no dangling colon).
|
|
6315
|
+
formatVerifyFail(ctx.manifest.spec.verify.cmd, vr.exitCode, expected, vr.stdout, vr.stderr),
|
|
6110
6316
|
"verify-failed"
|
|
6111
6317
|
)
|
|
6112
6318
|
};
|
|
@@ -6485,6 +6691,7 @@ var init_npmCli2 = __esm({
|
|
|
6485
6691
|
init_preflight();
|
|
6486
6692
|
init_spawn();
|
|
6487
6693
|
init_state2();
|
|
6694
|
+
init_verifyMessage();
|
|
6488
6695
|
installNpmCli = async (ctx) => {
|
|
6489
6696
|
const install = ctx.manifest.spec.install;
|
|
6490
6697
|
if (install.method !== "npm-cli") {
|
|
@@ -6512,9 +6719,11 @@ var init_npmCli2 = __esm({
|
|
|
6512
6719
|
let level = detectLevel(install.cmd);
|
|
6513
6720
|
let cmd = install.cmd;
|
|
6514
6721
|
const plan = { files: [] };
|
|
6515
|
-
if (!ctx.opts.quiet)
|
|
6516
|
-
|
|
6517
|
-
|
|
6722
|
+
if (!ctx.opts.quiet) {
|
|
6723
|
+
process.stdout.write(renderDiff(plan, ctx));
|
|
6724
|
+
if (level === "L4")
|
|
6725
|
+
process.stdout.write(" (L4 system install \u2014 global PATH change; see cmd above)\n");
|
|
6726
|
+
}
|
|
6518
6727
|
const conf = await confirmAt(level, { ...ctx});
|
|
6519
6728
|
if (!conf.proceed) {
|
|
6520
6729
|
if (level === "L4" && conf.reason === "flag-missing" && !ctx.opts.nonInteractive) {
|
|
@@ -6570,7 +6779,8 @@ var init_npmCli2 = __esm({
|
|
|
6570
6779
|
error: err(
|
|
6571
6780
|
ctx,
|
|
6572
6781
|
"/spec/verify/cmd",
|
|
6573
|
-
|
|
6782
|
+
// v4.15.1 — unified verify-fail format (cmd + output tail; no dangling colon).
|
|
6783
|
+
formatVerifyFail(ctx.manifest.spec.verify.cmd, vr.exitCode, expected, vr.stdout, vr.stderr),
|
|
6574
6784
|
"verify-failed"
|
|
6575
6785
|
)
|
|
6576
6786
|
};
|
|
@@ -6592,6 +6802,7 @@ var init_npxSkillInstaller2 = __esm({
|
|
|
6592
6802
|
init_preflight();
|
|
6593
6803
|
init_spawn();
|
|
6594
6804
|
init_state2();
|
|
6805
|
+
init_verifyMessage();
|
|
6595
6806
|
installNpxSkillInstaller = async (ctx) => {
|
|
6596
6807
|
const install = ctx.manifest.spec.install;
|
|
6597
6808
|
if (install.method !== "npx-skill-installer") {
|
|
@@ -6709,7 +6920,8 @@ var init_npxSkillInstaller2 = __esm({
|
|
|
6709
6920
|
error: err(
|
|
6710
6921
|
ctx,
|
|
6711
6922
|
"/spec/verify/cmd",
|
|
6712
|
-
|
|
6923
|
+
// v4.15.1 — unified verify-fail format (cmd + output tail; no dangling colon).
|
|
6924
|
+
formatVerifyFail(ctx.manifest.spec.verify.cmd, vr.exitCode, expected, vr.stdout, vr.stderr),
|
|
6713
6925
|
"verify-failed"
|
|
6714
6926
|
)
|
|
6715
6927
|
};
|
|
@@ -6963,7 +7175,7 @@ var release_preflight_exports = {};
|
|
|
6963
7175
|
__export(release_preflight_exports, {
|
|
6964
7176
|
anyFailed: () => anyFailed,
|
|
6965
7177
|
collectPreflight: () => collectPreflight,
|
|
6966
|
-
defaultDeps: () =>
|
|
7178
|
+
defaultDeps: () => defaultDeps2
|
|
6967
7179
|
});
|
|
6968
7180
|
function unreleasedSection(changelog) {
|
|
6969
7181
|
const start = changelog.indexOf("## [Unreleased]");
|
|
@@ -7018,7 +7230,7 @@ function collectPreflight(deps) {
|
|
|
7018
7230
|
function anyFailed(checks) {
|
|
7019
7231
|
return checks.some((c) => c.status === "fail");
|
|
7020
7232
|
}
|
|
7021
|
-
function
|
|
7233
|
+
function defaultDeps2(cwd) {
|
|
7022
7234
|
let changelog = "";
|
|
7023
7235
|
let version = "";
|
|
7024
7236
|
try {
|
|
@@ -8684,8 +8896,8 @@ function registerReleasePreflight(program2) {
|
|
|
8684
8896
|
program2.command("release-preflight").description(
|
|
8685
8897
|
"Read-only release-readiness gate (CHANGELOG / version / git-clean / tag). Exits 1 if not ready."
|
|
8686
8898
|
).action(async () => {
|
|
8687
|
-
const { collectPreflight: collectPreflight2, anyFailed: anyFailed2, defaultDeps:
|
|
8688
|
-
const checks = collectPreflight2(
|
|
8899
|
+
const { collectPreflight: collectPreflight2, anyFailed: anyFailed2, defaultDeps: defaultDeps3 } = await Promise.resolve().then(() => (init_release_preflight(), release_preflight_exports));
|
|
8900
|
+
const checks = collectPreflight2(defaultDeps3(process.cwd()));
|
|
8689
8901
|
console.log("\n release preflight (read-only \u2014 nothing is pushed/published):\n");
|
|
8690
8902
|
for (const c of checks) {
|
|
8691
8903
|
const mark = c.status === "pass" ? "\u2713" : c.status === "warn" ? "\u26A0" : "\u2717";
|
|
@@ -9581,13 +9793,17 @@ function printGrouped(b, prefix = "") {
|
|
|
9581
9793
|
console.log(`
|
|
9582
9794
|
${prefix}${GROUP_LABELS[g] ?? g} (${entries.length})`);
|
|
9583
9795
|
const nameW = Math.max(...entries.map((e) => e.name.length), "component".length);
|
|
9584
|
-
|
|
9585
|
-
for (const e of entries) {
|
|
9796
|
+
const rows = entries.map((e) => {
|
|
9586
9797
|
const note2 = e.note && e.note.length > NOTE_MAX ? `${e.note.slice(0, NOTE_MAX)}\u2026` : e.note;
|
|
9587
9798
|
const line = ` ${GLYPHS[e.status] ?? " "} ${e.status.padEnd(18)} ${e.name.padEnd(nameW)}${note2 ? ` ${note2}` : ""}`;
|
|
9588
|
-
|
|
9589
|
-
|
|
9590
|
-
|
|
9799
|
+
return { status: e.status, line };
|
|
9800
|
+
});
|
|
9801
|
+
const sepW = Math.max(...rows.map((r) => r.line.length)) - 4;
|
|
9802
|
+
console.log(` ${"\u2014".repeat(sepW)}`);
|
|
9803
|
+
for (const r of rows) {
|
|
9804
|
+
if (r.status === "failed") console.error(r.line);
|
|
9805
|
+
else if (r.status === "kept-existing") console.warn(r.line);
|
|
9806
|
+
else console.log(r.line);
|
|
9591
9807
|
}
|
|
9592
9808
|
}
|
|
9593
9809
|
}
|
|
@@ -9725,6 +9941,8 @@ installing ${manifestPaths.length} upstream components (MCP serialized, rest par
|
|
|
9725
9941
|
initialValue: false
|
|
9726
9942
|
});
|
|
9727
9943
|
if (!isCancel6(ans) && ans === true) {
|
|
9944
|
+
console.log(`
|
|
9945
|
+
force-updating ${b.alreadyInstalled.length} plugin(s)...`);
|
|
9728
9946
|
const b2 = await runStepBInstall(manifestPaths, {
|
|
9729
9947
|
updateInstalled: true,
|
|
9730
9948
|
quiet: true,
|
|
@@ -9756,6 +9974,12 @@ Force-update pass complete: ${b2.installed.length} installed / ${b2.keptExisting
|
|
|
9756
9974
|
await runL4Rescue2(manifestPaths, b.skipped);
|
|
9757
9975
|
}
|
|
9758
9976
|
}
|
|
9977
|
+
if (b.failed.length > 0) {
|
|
9978
|
+
console.error(
|
|
9979
|
+
`
|
|
9980
|
+
${b.failed.length} component(s) failed \u2014 see the notes in the tables above; re-run \`harnessed setup\` to retry, or run \`harnessed doctor\` for environment diagnostics.`
|
|
9981
|
+
);
|
|
9982
|
+
}
|
|
9759
9983
|
console.log(
|
|
9760
9984
|
t("setup.complete", {
|
|
9761
9985
|
skills: skillsInstalled,
|