harnessed 4.16.0 → 4.16.2
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 +154 -9
- package/dist/cli.mjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/manifests/skill-packs/gstack.yaml +7 -4
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -38,7 +38,7 @@ var init_package = __esm({
|
|
|
38
38
|
"package.json"() {
|
|
39
39
|
package_default = {
|
|
40
40
|
name: "harnessed",
|
|
41
|
-
version: "4.16.
|
|
41
|
+
version: "4.16.2",
|
|
42
42
|
description: "AI coding harness package manager + composition orchestrator",
|
|
43
43
|
type: "module",
|
|
44
44
|
license: "Apache-2.0",
|
|
@@ -4512,15 +4512,26 @@ function sanitizeOutputTail(raw, cap = 160) {
|
|
|
4512
4512
|
const printable = firstNonEmpty.replace(/[^\x20-\x7E]/g, "").trim();
|
|
4513
4513
|
return printable.length > 0 ? printable.slice(0, cap) : "(unreadable output)";
|
|
4514
4514
|
}
|
|
4515
|
+
function sanitizeOutputTailEnd(raw, cap = 300) {
|
|
4516
|
+
const lines = raw.split(/\r?\n/).map((l) => l.replace(/[^\x20-\x7E]/g, "").trim()).filter((l) => l.length > 0);
|
|
4517
|
+
if (lines.length === 0) return "(unreadable output)";
|
|
4518
|
+
let out = "";
|
|
4519
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
4520
|
+
const cand = out ? `${lines[i]} | ${out}` : lines[i];
|
|
4521
|
+
if (cand.length > cap) break;
|
|
4522
|
+
out = cand;
|
|
4523
|
+
}
|
|
4524
|
+
return out || `${lines[lines.length - 1].slice(0, cap)}\u2026`;
|
|
4525
|
+
}
|
|
4515
4526
|
function formatSpawnFail(label, exitCode, stdout2, stderr) {
|
|
4516
4527
|
const rawTail = stderr.trim() || stdout2.trim();
|
|
4517
|
-
const tail = rawTail.length > 0 ?
|
|
4528
|
+
const tail = rawTail.length > 0 ? sanitizeOutputTailEnd(rawTail, 300) : "(no output)";
|
|
4518
4529
|
return `${label} exited ${exitCode}: ${tail}`;
|
|
4519
4530
|
}
|
|
4520
4531
|
function formatVerifyFail(cmd, exitCode, expected, stdout2, stderr) {
|
|
4521
4532
|
const cmdPart = cmd.length > 80 ? `${cmd.slice(0, 80)}\u2026` : cmd;
|
|
4522
4533
|
const rawTail = stderr.trim() || stdout2.trim();
|
|
4523
|
-
const tail = rawTail.length > 0 ?
|
|
4534
|
+
const tail = rawTail.length > 0 ? sanitizeOutputTailEnd(rawTail, 160) : "(no output)";
|
|
4524
4535
|
return `verify failed (exit ${exitCode} \u2260 expected ${expected}): \`${cmdPart}\` \u2014 ${tail}`;
|
|
4525
4536
|
}
|
|
4526
4537
|
var init_verifyMessage = __esm({
|
|
@@ -5196,6 +5207,62 @@ var init_check_codegraph = __esm({
|
|
|
5196
5207
|
}
|
|
5197
5208
|
});
|
|
5198
5209
|
|
|
5210
|
+
// src/cli/lib/check-bun.ts
|
|
5211
|
+
var check_bun_exports = {};
|
|
5212
|
+
__export(check_bun_exports, {
|
|
5213
|
+
checkBun: () => checkBun
|
|
5214
|
+
});
|
|
5215
|
+
function realRun(finder) {
|
|
5216
|
+
try {
|
|
5217
|
+
if (typeof spawnSync !== "function") return null;
|
|
5218
|
+
const r = spawnSync(finder, ["bun"], { encoding: "utf8" });
|
|
5219
|
+
if (!r || r.error) return null;
|
|
5220
|
+
return { status: r.status, stdout: r.stdout ?? "" };
|
|
5221
|
+
} catch {
|
|
5222
|
+
return null;
|
|
5223
|
+
}
|
|
5224
|
+
}
|
|
5225
|
+
function checkBun(deps) {
|
|
5226
|
+
const platform = deps?.platform ?? process.platform;
|
|
5227
|
+
const run = deps?.run ?? realRun;
|
|
5228
|
+
const finder = platform === "win32" ? "where" : "which";
|
|
5229
|
+
const r = run(finder);
|
|
5230
|
+
if (r && r.status === 0 && r.stdout.trim().length > 0) {
|
|
5231
|
+
return {
|
|
5232
|
+
name: "bun present",
|
|
5233
|
+
status: "pass",
|
|
5234
|
+
message: r.stdout.split(/\r?\n/)[0]?.trim() ?? "bun found"
|
|
5235
|
+
};
|
|
5236
|
+
}
|
|
5237
|
+
const missing = {
|
|
5238
|
+
name: "bun present",
|
|
5239
|
+
status: "warn",
|
|
5240
|
+
message: "bun not found in PATH \u2014 gstack setup builds its browse binary with bun (gstack refresh will fail without it)"
|
|
5241
|
+
};
|
|
5242
|
+
if (platform === "win32") {
|
|
5243
|
+
return {
|
|
5244
|
+
...missing,
|
|
5245
|
+
fix: "winget install Oven-sh.Bun",
|
|
5246
|
+
install_commands: ["winget install Oven-sh.Bun"]
|
|
5247
|
+
};
|
|
5248
|
+
}
|
|
5249
|
+
if (platform === "darwin") {
|
|
5250
|
+
return {
|
|
5251
|
+
...missing,
|
|
5252
|
+
fix: "brew install oven-sh/bun/bun",
|
|
5253
|
+
install_commands: ["brew install oven-sh/bun/bun"]
|
|
5254
|
+
};
|
|
5255
|
+
}
|
|
5256
|
+
return {
|
|
5257
|
+
...missing,
|
|
5258
|
+
fix: "see https://bun.sh/docs/installation (curl -fsSL https://bun.sh/install | bash \u2014 review the script first)"
|
|
5259
|
+
};
|
|
5260
|
+
}
|
|
5261
|
+
var init_check_bun = __esm({
|
|
5262
|
+
"src/cli/lib/check-bun.ts"() {
|
|
5263
|
+
}
|
|
5264
|
+
});
|
|
5265
|
+
|
|
5199
5266
|
// src/cli/lib/version-check.ts
|
|
5200
5267
|
var version_check_exports = {};
|
|
5201
5268
|
__export(version_check_exports, {
|
|
@@ -5303,6 +5370,9 @@ var init_doctor_registry = __esm({
|
|
|
5303
5370
|
// Phase 18 — opt-in CodeGraph semantic-index detect (always 'pass'; absence of an
|
|
5304
5371
|
// optional tool is not a health failure).
|
|
5305
5372
|
async () => (await Promise.resolve().then(() => (init_check_codegraph(), check_codegraph_exports))).checkCodeGraph(process.cwd()),
|
|
5373
|
+
// v4.16.1 T3 — bun presence (warn-only): gstack's upstream setup hard-requires
|
|
5374
|
+
// bun; missing bun is THE gstack refresh-failure cause on user dogfood machines.
|
|
5375
|
+
async () => (await Promise.resolve().then(() => (init_check_bun(), check_bun_exports))).checkBun(),
|
|
5306
5376
|
// Phase 20 — "update available" version check ('warn' only when behind; 'pass'
|
|
5307
5377
|
// when current/ahead/npm-unreachable — fail-soft, never flips the summary).
|
|
5308
5378
|
async () => (await Promise.resolve().then(() => (init_check_update(), check_update_exports))).checkUpdate()
|
|
@@ -5625,6 +5695,57 @@ var init_ccHookAdd2 = __esm({
|
|
|
5625
5695
|
};
|
|
5626
5696
|
}
|
|
5627
5697
|
});
|
|
5698
|
+
function extractVerifyBinary(verifyCmd, fallback) {
|
|
5699
|
+
const token = verifyCmd?.trim().split(/\s+/)[0];
|
|
5700
|
+
if (token && BARE_BIN_RE.test(token) && !NON_COMPONENT_TOKENS.has(token)) return token;
|
|
5701
|
+
if (BARE_BIN_RE.test(fallback) && !NON_COMPONENT_TOKENS.has(fallback)) return fallback;
|
|
5702
|
+
return null;
|
|
5703
|
+
}
|
|
5704
|
+
function realRun2(finder, bin) {
|
|
5705
|
+
try {
|
|
5706
|
+
if (typeof spawnSync !== "function") return null;
|
|
5707
|
+
const r = spawnSync(finder, [bin], { encoding: "utf8" });
|
|
5708
|
+
if (!r || r.error) return null;
|
|
5709
|
+
return { status: r.status, stdout: r.stdout ?? "" };
|
|
5710
|
+
} catch {
|
|
5711
|
+
return null;
|
|
5712
|
+
}
|
|
5713
|
+
}
|
|
5714
|
+
function binaryOnPath(bin, deps) {
|
|
5715
|
+
const platform = process.platform;
|
|
5716
|
+
const run = realRun2;
|
|
5717
|
+
const finder = platform === "win32" ? "where" : "which";
|
|
5718
|
+
const r = run(finder, bin);
|
|
5719
|
+
if (!r || r.status !== 0) return false;
|
|
5720
|
+
return r.stdout.trim().length > 0;
|
|
5721
|
+
}
|
|
5722
|
+
var NON_COMPONENT_TOKENS, BARE_BIN_RE;
|
|
5723
|
+
var init_binaryProbe = __esm({
|
|
5724
|
+
"src/installers/lib/binaryProbe.ts"() {
|
|
5725
|
+
NON_COMPONENT_TOKENS = /* @__PURE__ */ new Set([
|
|
5726
|
+
"test",
|
|
5727
|
+
"grep",
|
|
5728
|
+
"ls",
|
|
5729
|
+
"cat",
|
|
5730
|
+
"echo",
|
|
5731
|
+
"command",
|
|
5732
|
+
"sh",
|
|
5733
|
+
"bash",
|
|
5734
|
+
"[",
|
|
5735
|
+
"npx",
|
|
5736
|
+
"npm",
|
|
5737
|
+
"node",
|
|
5738
|
+
"corepack",
|
|
5739
|
+
"pnpm",
|
|
5740
|
+
"yarn",
|
|
5741
|
+
"bun",
|
|
5742
|
+
"git",
|
|
5743
|
+
"claude",
|
|
5744
|
+
"codex"
|
|
5745
|
+
]);
|
|
5746
|
+
BARE_BIN_RE = /^[A-Za-z0-9][\w.@-]*$/;
|
|
5747
|
+
}
|
|
5748
|
+
});
|
|
5628
5749
|
function evalClause(clause, home) {
|
|
5629
5750
|
const m = clause.match(CLAUSE_RE);
|
|
5630
5751
|
if (!m?.[1] || !m[2]) return null;
|
|
@@ -5765,7 +5886,8 @@ async function spawnCmd(ctx, cmd, args, timeoutMs, opts) {
|
|
|
5765
5886
|
// some CLIs write their error text to stdout; a bare trailing colon
|
|
5766
5887
|
// read as "no reason" in user dogfood). v4.15.2 — sanitized (CP936
|
|
5767
5888
|
// mojibake was embedded verbatim in the ctx7 dogfood error).
|
|
5768
|
-
|
|
5889
|
+
// v4.16.1 T2 — tail-END biased (errors live at the end of output).
|
|
5890
|
+
message: `spawn timed out after ${effectiveTimeoutMs}ms (cmd: ${cmd}); partial output: ${(stderr || stdout2).trim() ? sanitizeOutputTailEnd(stderr || stdout2, 200) : "(no output)"}`,
|
|
5769
5891
|
line: null,
|
|
5770
5892
|
column: null,
|
|
5771
5893
|
keyword: "spawn-timeout"
|
|
@@ -5921,6 +6043,8 @@ async function detectNative(ctx) {
|
|
|
5921
6043
|
}
|
|
5922
6044
|
}
|
|
5923
6045
|
if (method === "npm-cli") {
|
|
6046
|
+
const bin = extractVerifyBinary(ctx.manifest.spec.verify?.cmd, name);
|
|
6047
|
+
if (bin && binaryOnPath(bin)) return true;
|
|
5924
6048
|
const skillDir = join(getSkillsDir(), name);
|
|
5925
6049
|
try {
|
|
5926
6050
|
await access(skillDir);
|
|
@@ -5955,6 +6079,7 @@ async function isAlreadyInstalled(ctx, opts = {}) {
|
|
|
5955
6079
|
var IDEMPOTENT_CHECK_TIMEOUT_MS, INSTALLED_INDICATORS;
|
|
5956
6080
|
var init_idempotent = __esm({
|
|
5957
6081
|
"src/installers/lib/idempotent.ts"() {
|
|
6082
|
+
init_binaryProbe();
|
|
5958
6083
|
init_platform();
|
|
5959
6084
|
init_readClaudeConfig();
|
|
5960
6085
|
init_spawn();
|
|
@@ -6205,7 +6330,7 @@ function gitRevParseHead(cwd, timeoutMs = 1e4) {
|
|
|
6205
6330
|
});
|
|
6206
6331
|
});
|
|
6207
6332
|
}
|
|
6208
|
-
function
|
|
6333
|
+
function extractRawCloneDest(cmd) {
|
|
6209
6334
|
const idx = cmd.indexOf("git clone");
|
|
6210
6335
|
if (idx < 0) return null;
|
|
6211
6336
|
const tail = cmd.slice(idx + "git clone".length).trim();
|
|
@@ -6224,6 +6349,12 @@ function extractCloneTarget(cmd) {
|
|
|
6224
6349
|
}
|
|
6225
6350
|
const dest = tokens[i + 1];
|
|
6226
6351
|
if (!dest || dest === "&&" || dest === ";" || dest === "|") return null;
|
|
6352
|
+
return { raw: dest, cloneIdx: idx };
|
|
6353
|
+
}
|
|
6354
|
+
function extractCloneTarget(cmd) {
|
|
6355
|
+
const parsed = extractRawCloneDest(cmd);
|
|
6356
|
+
if (!parsed) return null;
|
|
6357
|
+
const dest = parsed.raw;
|
|
6227
6358
|
if (dest.startsWith("~/")) {
|
|
6228
6359
|
const home = process.env.HOME ?? process.env.USERPROFILE;
|
|
6229
6360
|
if (!home) return null;
|
|
@@ -6231,6 +6362,18 @@ function extractCloneTarget(cmd) {
|
|
|
6231
6362
|
}
|
|
6232
6363
|
return dest;
|
|
6233
6364
|
}
|
|
6365
|
+
function isSelfCleaningCloneCmd(cmd) {
|
|
6366
|
+
const parsed = extractRawCloneDest(cmd);
|
|
6367
|
+
if (!parsed) return false;
|
|
6368
|
+
const needle = `rm -rf ${parsed.raw}`;
|
|
6369
|
+
let idx = cmd.indexOf(needle, parsed.cloneIdx);
|
|
6370
|
+
while (idx >= 0) {
|
|
6371
|
+
const after = cmd[idx + needle.length];
|
|
6372
|
+
if (after === void 0 || /\s/.test(after)) return true;
|
|
6373
|
+
idx = cmd.indexOf(needle, idx + 1);
|
|
6374
|
+
}
|
|
6375
|
+
return false;
|
|
6376
|
+
}
|
|
6234
6377
|
var installGitCloneWithSetup;
|
|
6235
6378
|
var init_gitCloneWithSetup2 = __esm({
|
|
6236
6379
|
"src/installers/gitCloneWithSetup.ts"() {
|
|
@@ -6336,8 +6479,8 @@ var init_gitCloneWithSetup2 = __esm({
|
|
|
6336
6479
|
)
|
|
6337
6480
|
};
|
|
6338
6481
|
}
|
|
6339
|
-
const rp = await gitRevParseHead(cloneTarget);
|
|
6340
|
-
if (rp.exit !== 0 || !rp.sha) {
|
|
6482
|
+
const rp = isSelfCleaningCloneCmd(install.cmd) ? null : await gitRevParseHead(cloneTarget);
|
|
6483
|
+
if (rp === null) ; else if (rp.exit !== 0 || !rp.sha) {
|
|
6341
6484
|
console.warn(
|
|
6342
6485
|
` \u26A0 ${name}: git_ref SHA pin '${install.git_ref}' unverifiable \u2014 \`git rev-parse HEAD\` exit ${rp.exit} in ${cloneTarget} (the install cmd may remove its own clone dir); falling back to the manifest verify cmd as the install authority`
|
|
6343
6486
|
);
|
|
@@ -9665,7 +9808,7 @@ async function runStepBInstall(manifestPaths, runOpts = {}) {
|
|
|
9665
9808
|
try {
|
|
9666
9809
|
const r = await runInstall(manifest, opts);
|
|
9667
9810
|
if ("aborted" in r) {
|
|
9668
|
-
const reason = r.reason === "harness-mismatch" ? `harness-mismatch \u2014 claude-only install method (no ${detectPlatform().id} equivalent)` : r.reason;
|
|
9811
|
+
const reason = r.reason === "harness-mismatch" ? `harness-mismatch \u2014 claude-only install method (no ${detectPlatform().id} equivalent)` : r.reason === "level-flag-missing" && runOpts.updateInstalled === true ? `L4 system-scope \u2014 excluded from force-update; update manually: \`${manifest.spec.install.cmd}\`` : r.reason;
|
|
9669
9812
|
return emit({ status: "skipped", name, reason });
|
|
9670
9813
|
}
|
|
9671
9814
|
if (r.ok && "alreadyInstalled" in r && r.alreadyInstalled)
|
|
@@ -9882,7 +10025,9 @@ function printGrouped(b, prefix = "") {
|
|
|
9882
10025
|
else console.log(r.line);
|
|
9883
10026
|
}
|
|
9884
10027
|
for (const e of entries) {
|
|
9885
|
-
if (!e.full
|
|
10028
|
+
if (!e.full) continue;
|
|
10029
|
+
const shownNote = (e.note ?? "").slice(0, NOTE_MAX);
|
|
10030
|
+
if (shownNote.includes(e.full)) continue;
|
|
9886
10031
|
const full = e.full.length > 400 ? `${e.full.slice(0, 400)}\u2026` : e.full;
|
|
9887
10032
|
const line = ` \u21B3 ${e.name}: ${full}`;
|
|
9888
10033
|
if (e.status === "failed") console.error(line);
|