@mstar-harness/cli 3.8.1 → 3.8.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/mstar-harness.js +219 -177
- package/package.json +1 -1
package/dist/mstar-harness.js
CHANGED
|
@@ -2432,7 +2432,7 @@ var require_picocolors2 = __commonJS(function(exports, module) {
|
|
|
2432
2432
|
// src/index.ts
|
|
2433
2433
|
import { execFileSync as execFileSync10 } from "child_process";
|
|
2434
2434
|
import { createHash, randomUUID as randomUUID3 } from "crypto";
|
|
2435
|
-
import
|
|
2435
|
+
import fs10 from "fs";
|
|
2436
2436
|
import path14 from "path";
|
|
2437
2437
|
// ../../node_modules/.bun/@inquirer+core@12.0.3+72cd8510778f549e/node_modules/@inquirer/core/dist/lib/key.js
|
|
2438
2438
|
var keybindings = ["emacs", "vim"];
|
|
@@ -9487,6 +9487,7 @@ function harnessVersionFrom(moduleDir) {
|
|
|
9487
9487
|
function readHarnessVersion() {
|
|
9488
9488
|
return harnessVersionFrom(dirname7(fileURLToPath(import.meta.url)));
|
|
9489
9489
|
}
|
|
9490
|
+
var DSH_LLM_FALLBACKS_VERSION = "0.5.2";
|
|
9490
9491
|
var MSTARC_FILE2 = ".mstarc";
|
|
9491
9492
|
var MSTARC_SECTION2 = "config";
|
|
9492
9493
|
var MSTARC_HARNESS_DIR_KEY2 = "harness_dir";
|
|
@@ -12121,7 +12122,67 @@ var cursorAdapter = {
|
|
|
12121
12122
|
};
|
|
12122
12123
|
|
|
12123
12124
|
// src/adapters/dsh.ts
|
|
12125
|
+
import fs5 from "node:fs";
|
|
12124
12126
|
import os4 from "node:os";
|
|
12127
|
+
|
|
12128
|
+
// src/version-compare.ts
|
|
12129
|
+
function splitVersion(v) {
|
|
12130
|
+
const dash = v.indexOf("-");
|
|
12131
|
+
if (dash === -1)
|
|
12132
|
+
return [v, undefined];
|
|
12133
|
+
return [v.slice(0, dash), v.slice(dash + 1)];
|
|
12134
|
+
}
|
|
12135
|
+
function compareCore(a, b) {
|
|
12136
|
+
const pa = a.split(".").map((n) => parseInt(n, 10) || 0);
|
|
12137
|
+
const pb = b.split(".").map((n) => parseInt(n, 10) || 0);
|
|
12138
|
+
for (let i = 0;i < 3; i++) {
|
|
12139
|
+
const d = (pa[i] ?? 0) - (pb[i] ?? 0);
|
|
12140
|
+
if (d !== 0)
|
|
12141
|
+
return d;
|
|
12142
|
+
}
|
|
12143
|
+
return 0;
|
|
12144
|
+
}
|
|
12145
|
+
function comparePrerelease(a, b) {
|
|
12146
|
+
if (a === undefined && b === undefined)
|
|
12147
|
+
return 0;
|
|
12148
|
+
if (a === undefined)
|
|
12149
|
+
return 1;
|
|
12150
|
+
if (b === undefined)
|
|
12151
|
+
return -1;
|
|
12152
|
+
const ia = a.split(".");
|
|
12153
|
+
const ib = b.split(".");
|
|
12154
|
+
const n = Math.min(ia.length, ib.length);
|
|
12155
|
+
for (let i = 0;i < n; i++) {
|
|
12156
|
+
const d = compareIdentifier(ia[i], ib[i]);
|
|
12157
|
+
if (d !== 0)
|
|
12158
|
+
return d;
|
|
12159
|
+
}
|
|
12160
|
+
return ia.length - ib.length;
|
|
12161
|
+
}
|
|
12162
|
+
function compareIdentifier(a, b) {
|
|
12163
|
+
const aNum = /^\d+$/.test(a);
|
|
12164
|
+
const bNum = /^\d+$/.test(b);
|
|
12165
|
+
if (aNum && bNum) {
|
|
12166
|
+
const na = BigInt(a);
|
|
12167
|
+
const nb = BigInt(b);
|
|
12168
|
+
return na < nb ? -1 : na > nb ? 1 : 0;
|
|
12169
|
+
}
|
|
12170
|
+
if (aNum)
|
|
12171
|
+
return -1;
|
|
12172
|
+
if (bNum)
|
|
12173
|
+
return 1;
|
|
12174
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
12175
|
+
}
|
|
12176
|
+
function compareSemver(a, b) {
|
|
12177
|
+
const [coreA, preA] = splitVersion(a);
|
|
12178
|
+
const [coreB, preB] = splitVersion(b);
|
|
12179
|
+
const coreDiff = compareCore(coreA, coreB);
|
|
12180
|
+
if (coreDiff !== 0)
|
|
12181
|
+
return coreDiff;
|
|
12182
|
+
return comparePrerelease(preA, preB);
|
|
12183
|
+
}
|
|
12184
|
+
|
|
12185
|
+
// src/adapters/dsh.ts
|
|
12125
12186
|
import path7 from "node:path";
|
|
12126
12187
|
var DSH_BIN = "dsh";
|
|
12127
12188
|
var DSH_PROFILE = "web";
|
|
@@ -12140,13 +12201,35 @@ function addTimeoutMs() {
|
|
|
12140
12201
|
const parsed = Number(raw);
|
|
12141
12202
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : DSH_ADD_TIMEOUT_MS;
|
|
12142
12203
|
}
|
|
12143
|
-
var
|
|
12144
|
-
var DSH_PLUGIN_SPECS = ["@mstar-harness/dsh", `dsh-llm-fallbacks@${DSH_FALLBACKS_VERSION}`];
|
|
12204
|
+
var DSH_PLUGIN_SPECS = ["@mstar-harness/dsh", `dsh-llm-fallbacks@${DSH_LLM_FALLBACKS_VERSION}`];
|
|
12145
12205
|
var DSH_FALLBACKS_SPEC = DSH_PLUGIN_SPECS[1];
|
|
12146
12206
|
function dshLoaderName(spec) {
|
|
12147
12207
|
const at = spec.lastIndexOf("@");
|
|
12148
12208
|
return at > 0 ? spec.slice(0, at) : spec;
|
|
12149
12209
|
}
|
|
12210
|
+
var DSH_FALLBACKS_LOADER_NAME = dshLoaderName(DSH_FALLBACKS_SPEC);
|
|
12211
|
+
var FALLBACKS_VERSION_SHAPE_RE = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
|
|
12212
|
+
function readInstalledFallbacksVersion(profileDir) {
|
|
12213
|
+
const pkgJson = path7.join(profileDir, "node_modules", DSH_FALLBACKS_LOADER_NAME, "package.json");
|
|
12214
|
+
try {
|
|
12215
|
+
const raw = fs5.readFileSync(pkgJson, "utf8");
|
|
12216
|
+
const version = JSON.parse(raw).version;
|
|
12217
|
+
if (typeof version === "string") {
|
|
12218
|
+
const trimmed = version.trim();
|
|
12219
|
+
if (FALLBACKS_VERSION_SHAPE_RE.test(trimmed))
|
|
12220
|
+
return trimmed;
|
|
12221
|
+
}
|
|
12222
|
+
} catch {}
|
|
12223
|
+
return null;
|
|
12224
|
+
}
|
|
12225
|
+
function fallbacksVersionDrifted(profileDir) {
|
|
12226
|
+
if (!FALLBACKS_VERSION_SHAPE_RE.test(DSH_LLM_FALLBACKS_VERSION))
|
|
12227
|
+
return false;
|
|
12228
|
+
const installedVersion = readInstalledFallbacksVersion(profileDir);
|
|
12229
|
+
if (installedVersion === null)
|
|
12230
|
+
return true;
|
|
12231
|
+
return compareSemver(installedVersion, DSH_LLM_FALLBACKS_VERSION) !== 0;
|
|
12232
|
+
}
|
|
12150
12233
|
var DSH_INSTALL_HINT = "Install the DeepSeek Harness CLI (@deepseek-ai/dsh), e.g. `pnpm add -g @deepseek-ai/dsh` or `npm install -g @deepseek-ai/dsh`, then re-run init.";
|
|
12151
12234
|
function runDsh(args, dryRun, timeoutMs) {
|
|
12152
12235
|
return runCliCommand([DSH_BIN, ...args], { dryRun, timeoutMs, env: process.env });
|
|
@@ -12204,14 +12287,18 @@ function runInit2(scope, dryRun, initFlags) {
|
|
|
12204
12287
|
throw new Error(`${DSH_BIN} CLI not found on PATH. ${DSH_INSTALL_HINT}`);
|
|
12205
12288
|
}
|
|
12206
12289
|
const installed = new Set;
|
|
12290
|
+
const disabledLoaderNames = new Set;
|
|
12207
12291
|
if (!dryRun) {
|
|
12208
12292
|
try {
|
|
12209
12293
|
const entries = parseLoaderEntries(runDsh([DSH_PROFILE_FLAG, DSH_PROFILE, DSH_DUMP_FLAG], dryRun, DSH_LOCAL_TIMEOUT_MS));
|
|
12210
12294
|
if (entries === null) {
|
|
12211
12295
|
notes.push("Warning: could not parse installed plugins from dump (unexpected format); proceeding with add (idempotent).");
|
|
12212
12296
|
} else {
|
|
12213
|
-
for (const entry of entries)
|
|
12297
|
+
for (const entry of entries) {
|
|
12214
12298
|
installed.add(entry.name);
|
|
12299
|
+
if (!entry.enabled)
|
|
12300
|
+
disabledLoaderNames.add(entry.name);
|
|
12301
|
+
}
|
|
12215
12302
|
}
|
|
12216
12303
|
} catch (error) {
|
|
12217
12304
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -12224,8 +12311,13 @@ function runInit2(scope, dryRun, initFlags) {
|
|
|
12224
12311
|
continue;
|
|
12225
12312
|
}
|
|
12226
12313
|
if (!dryRun && (installed.has(spec) || installed.has(dshLoaderName(spec)))) {
|
|
12227
|
-
|
|
12228
|
-
|
|
12314
|
+
const isFallbacks = spec === DSH_FALLBACKS_SPEC;
|
|
12315
|
+
const disabledRow = disabledLoaderNames.has(spec) || disabledLoaderNames.has(dshLoaderName(spec));
|
|
12316
|
+
const needsVersionAlign = isFallbacks && fallbacksVersionDrifted(profileDir) && !disabledRow;
|
|
12317
|
+
if (!needsVersionAlign) {
|
|
12318
|
+
notes.push(`skipped-existing: ${spec} (already installed in profile ${DSH_PROFILE})`);
|
|
12319
|
+
continue;
|
|
12320
|
+
}
|
|
12229
12321
|
}
|
|
12230
12322
|
const addArgs = ["plugin", DSH_PROFILE_FLAG, DSH_PROFILE, "add", spec];
|
|
12231
12323
|
if (dryRun) {
|
|
@@ -12269,7 +12361,14 @@ function runDoctor2(scope) {
|
|
|
12269
12361
|
const byName = new Map(entries.map((entry) => [entry.name, entry]));
|
|
12270
12362
|
for (const spec of DSH_PLUGIN_SPECS) {
|
|
12271
12363
|
const entry = byName.get(spec) ?? byName.get(dshLoaderName(spec));
|
|
12272
|
-
|
|
12364
|
+
let state = !entry ? "uninstalled" : entry.enabled ? "mounted" : "disabled";
|
|
12365
|
+
if (spec === DSH_FALLBACKS_SPEC && state === "mounted" && fallbacksVersionDrifted(profileDir)) {
|
|
12366
|
+
const installedVersion = readInstalledFallbacksVersion(profileDir);
|
|
12367
|
+
const installedLabel = installedVersion ?? "unknown";
|
|
12368
|
+
notes.push(`${spec}: drifted (installed ${installedLabel}, pinned ${DSH_LLM_FALLBACKS_VERSION})`);
|
|
12369
|
+
errors2.push(`${spec} is drifted (profile has ${installedLabel}, harness pins ${DSH_LLM_FALLBACKS_VERSION}). Run: mstar-harness init --target dsh`);
|
|
12370
|
+
continue;
|
|
12371
|
+
}
|
|
12273
12372
|
notes.push(`${spec}: ${state}`);
|
|
12274
12373
|
if (state === "mounted")
|
|
12275
12374
|
continue;
|
|
@@ -12289,65 +12388,8 @@ var dshAdapter = {
|
|
|
12289
12388
|
import os5 from "node:os";
|
|
12290
12389
|
import path9 from "node:path";
|
|
12291
12390
|
|
|
12292
|
-
// src/version-compare.ts
|
|
12293
|
-
function splitVersion(v) {
|
|
12294
|
-
const dash = v.indexOf("-");
|
|
12295
|
-
if (dash === -1)
|
|
12296
|
-
return [v, undefined];
|
|
12297
|
-
return [v.slice(0, dash), v.slice(dash + 1)];
|
|
12298
|
-
}
|
|
12299
|
-
function compareCore(a, b) {
|
|
12300
|
-
const pa = a.split(".").map((n) => parseInt(n, 10) || 0);
|
|
12301
|
-
const pb = b.split(".").map((n) => parseInt(n, 10) || 0);
|
|
12302
|
-
for (let i = 0;i < 3; i++) {
|
|
12303
|
-
const d = (pa[i] ?? 0) - (pb[i] ?? 0);
|
|
12304
|
-
if (d !== 0)
|
|
12305
|
-
return d;
|
|
12306
|
-
}
|
|
12307
|
-
return 0;
|
|
12308
|
-
}
|
|
12309
|
-
function comparePrerelease(a, b) {
|
|
12310
|
-
if (a === undefined && b === undefined)
|
|
12311
|
-
return 0;
|
|
12312
|
-
if (a === undefined)
|
|
12313
|
-
return 1;
|
|
12314
|
-
if (b === undefined)
|
|
12315
|
-
return -1;
|
|
12316
|
-
const ia = a.split(".");
|
|
12317
|
-
const ib = b.split(".");
|
|
12318
|
-
const n = Math.min(ia.length, ib.length);
|
|
12319
|
-
for (let i = 0;i < n; i++) {
|
|
12320
|
-
const d = compareIdentifier(ia[i], ib[i]);
|
|
12321
|
-
if (d !== 0)
|
|
12322
|
-
return d;
|
|
12323
|
-
}
|
|
12324
|
-
return ia.length - ib.length;
|
|
12325
|
-
}
|
|
12326
|
-
function compareIdentifier(a, b) {
|
|
12327
|
-
const aNum = /^\d+$/.test(a);
|
|
12328
|
-
const bNum = /^\d+$/.test(b);
|
|
12329
|
-
if (aNum && bNum) {
|
|
12330
|
-
const na = BigInt(a);
|
|
12331
|
-
const nb = BigInt(b);
|
|
12332
|
-
return na < nb ? -1 : na > nb ? 1 : 0;
|
|
12333
|
-
}
|
|
12334
|
-
if (aNum)
|
|
12335
|
-
return -1;
|
|
12336
|
-
if (bNum)
|
|
12337
|
-
return 1;
|
|
12338
|
-
return a < b ? -1 : a > b ? 1 : 0;
|
|
12339
|
-
}
|
|
12340
|
-
function compareSemver(a, b) {
|
|
12341
|
-
const [coreA, preA] = splitVersion(a);
|
|
12342
|
-
const [coreB, preB] = splitVersion(b);
|
|
12343
|
-
const coreDiff = compareCore(coreA, coreB);
|
|
12344
|
-
if (coreDiff !== 0)
|
|
12345
|
-
return coreDiff;
|
|
12346
|
-
return comparePrerelease(preA, preB);
|
|
12347
|
-
}
|
|
12348
|
-
|
|
12349
12391
|
// src/adapters/omp.ts
|
|
12350
|
-
import
|
|
12392
|
+
import fs6 from "node:fs";
|
|
12351
12393
|
import path8 from "node:path";
|
|
12352
12394
|
import { execFileSync as execFileSync8 } from "node:child_process";
|
|
12353
12395
|
var OMP_PACKAGE_REL = path8.join("packages", "omp");
|
|
@@ -12420,28 +12462,28 @@ function findInstalledPlugin(plugins) {
|
|
|
12420
12462
|
function validatePluginTree(pluginRoot) {
|
|
12421
12463
|
const errors2 = [];
|
|
12422
12464
|
const markerPath = path8.join(pluginRoot, "plugin.json");
|
|
12423
|
-
if (!
|
|
12465
|
+
if (!fs6.existsSync(markerPath)) {
|
|
12424
12466
|
errors2.push(`Missing omp plugin marker: ${markerPath}`);
|
|
12425
12467
|
}
|
|
12426
12468
|
for (const skill of SKILL_SMOKE) {
|
|
12427
12469
|
const skillPath = path8.join(pluginRoot, "skills", skill, "SKILL.md");
|
|
12428
|
-
if (!
|
|
12470
|
+
if (!fs6.existsSync(skillPath))
|
|
12429
12471
|
errors2.push(`Missing skill: ${skillPath}`);
|
|
12430
12472
|
}
|
|
12431
12473
|
for (const command of COMMAND_SMOKE) {
|
|
12432
12474
|
const commandPath = path8.join(pluginRoot, "commands", `${command}.md`);
|
|
12433
|
-
if (!
|
|
12475
|
+
if (!fs6.existsSync(commandPath))
|
|
12434
12476
|
errors2.push(`Missing command: ${commandPath}`);
|
|
12435
12477
|
}
|
|
12436
12478
|
const hostRef = path8.join(pluginRoot, "skills", "mstar-host", "references", "omp.md");
|
|
12437
|
-
if (!
|
|
12479
|
+
if (!fs6.existsSync(hostRef))
|
|
12438
12480
|
errors2.push(`Missing omp host reference: ${hostRef}`);
|
|
12439
12481
|
return errors2;
|
|
12440
12482
|
}
|
|
12441
12483
|
function runInit3(scope, dryRun) {
|
|
12442
12484
|
const notes = ensureLocalHarnessRepo(dryRun);
|
|
12443
12485
|
const projectRoot = resolveProjectRoot2();
|
|
12444
|
-
if (
|
|
12486
|
+
if (fs6.existsSync(path8.join(HARNESS_REPO_PATH, ".git"))) {
|
|
12445
12487
|
if (dryRun) {
|
|
12446
12488
|
notes.push(`Would update local harness repo: git -C ${HARNESS_REPO_PATH} pull --ff-only`);
|
|
12447
12489
|
} else {
|
|
@@ -12461,7 +12503,7 @@ function runInit3(scope, dryRun) {
|
|
|
12461
12503
|
notes.push("omp CLI not found on PATH. Install Oh My Pi (`omp`), then re-run init or manually: omp plugin install @mstar-harness/omp");
|
|
12462
12504
|
} else {
|
|
12463
12505
|
const ompPackagePath = path8.join(HARNESS_REPO_PATH, OMP_PACKAGE_REL);
|
|
12464
|
-
if (!dryRun && !
|
|
12506
|
+
if (!dryRun && !fs6.existsSync(path8.join(ompPackagePath, "plugin.json"))) {
|
|
12465
12507
|
try {
|
|
12466
12508
|
runCliCommand(["bun", "install"], { cwd: HARNESS_REPO_PATH, dryRun });
|
|
12467
12509
|
runCliCommand(["bun", "run", "engine:build"], { cwd: HARNESS_REPO_PATH, dryRun });
|
|
@@ -12552,7 +12594,7 @@ function runDoctor3(scope) {
|
|
|
12552
12594
|
if (scope === "project") {
|
|
12553
12595
|
const projectRoot = resolveProjectRoot2();
|
|
12554
12596
|
const gitignorePath = path8.join(projectRoot, ".gitignore");
|
|
12555
|
-
const gitignore =
|
|
12597
|
+
const gitignore = fs6.existsSync(gitignorePath) ? fs6.readFileSync(gitignorePath, "utf8") : "";
|
|
12556
12598
|
for (const entry of missingHarnessProcessGitignoreEntries(gitignore)) {
|
|
12557
12599
|
errors2.push(`Missing .gitignore entry: ${entry}`);
|
|
12558
12600
|
}
|
|
@@ -12729,7 +12771,7 @@ var opencodeAdapter = {
|
|
|
12729
12771
|
};
|
|
12730
12772
|
|
|
12731
12773
|
// src/adapters/zcode.ts
|
|
12732
|
-
import
|
|
12774
|
+
import fs7 from "node:fs";
|
|
12733
12775
|
import os7 from "node:os";
|
|
12734
12776
|
import path11 from "node:path";
|
|
12735
12777
|
var MARKETPLACE_ID = "mstar-local";
|
|
@@ -12805,7 +12847,7 @@ function findMarketplacePlugin(raw) {
|
|
|
12805
12847
|
}
|
|
12806
12848
|
function validateMarketplaceJson() {
|
|
12807
12849
|
const errors2 = [];
|
|
12808
|
-
if (!
|
|
12850
|
+
if (!fs7.existsSync(MARKETPLACE_JSON_PATH)) {
|
|
12809
12851
|
errors2.push(`Missing ZCode marketplace: ${MARKETPLACE_JSON_PATH}`);
|
|
12810
12852
|
return errors2;
|
|
12811
12853
|
}
|
|
@@ -12830,7 +12872,7 @@ function validateMarketplaceJson() {
|
|
|
12830
12872
|
}
|
|
12831
12873
|
function validateKnownMarketplaces() {
|
|
12832
12874
|
const errors2 = [];
|
|
12833
|
-
if (!
|
|
12875
|
+
if (!fs7.existsSync(KNOWN_MARKETPLACES_PATH)) {
|
|
12834
12876
|
errors2.push(`Missing ZCode known_marketplaces.json: ${KNOWN_MARKETPLACES_PATH}`);
|
|
12835
12877
|
return errors2;
|
|
12836
12878
|
}
|
|
@@ -12854,13 +12896,13 @@ function validateKnownMarketplaces() {
|
|
|
12854
12896
|
function validatePluginAgents2(pluginRoot) {
|
|
12855
12897
|
const errors2 = [];
|
|
12856
12898
|
const agentsDir = path11.join(pluginRoot, "agents");
|
|
12857
|
-
if (!
|
|
12899
|
+
if (!fs7.existsSync(agentsDir)) {
|
|
12858
12900
|
errors2.push(`Missing plugin agents directory: ${agentsDir}`);
|
|
12859
12901
|
return errors2;
|
|
12860
12902
|
}
|
|
12861
12903
|
for (const agentName of ZCODE_AGENT_SMOKE_NAMES) {
|
|
12862
12904
|
const agentPath = path11.join(agentsDir, `${agentName}.md`);
|
|
12863
|
-
if (!
|
|
12905
|
+
if (!fs7.existsSync(agentPath)) {
|
|
12864
12906
|
errors2.push(`Missing plugin agent file: ${agentPath}`);
|
|
12865
12907
|
}
|
|
12866
12908
|
}
|
|
@@ -12884,8 +12926,8 @@ function runInit5(scope, dryRun) {
|
|
|
12884
12926
|
notes.push(`Materialized local ZCode plugin checkout at ${ZCODE_PLUGIN_CHECKOUT_PROJECT} for smoke checks (the registered marketplace still points at the github repo).`);
|
|
12885
12927
|
}
|
|
12886
12928
|
if (!dryRun) {
|
|
12887
|
-
if (!
|
|
12888
|
-
|
|
12929
|
+
if (!fs7.existsSync(MARKETPLACE_DIR))
|
|
12930
|
+
fs7.mkdirSync(MARKETPLACE_DIR, { recursive: true });
|
|
12889
12931
|
writeJson2(MARKETPLACE_JSON_PATH, buildMarketplaceJson());
|
|
12890
12932
|
}
|
|
12891
12933
|
notes.push(`Wrote ZCode marketplace: ${MARKETPLACE_JSON_PATH}`);
|
|
@@ -12908,7 +12950,7 @@ function runDoctor5(scope) {
|
|
|
12908
12950
|
const checkoutPath = path11.join(projectRoot, ZCODE_PLUGIN_CHECKOUT_PROJECT);
|
|
12909
12951
|
errors2.push(...validateGitCheckout(checkoutPath, ZCODE_PLUGIN_MARKER));
|
|
12910
12952
|
const gitignorePath = path11.join(projectRoot, ".gitignore");
|
|
12911
|
-
const gitignore =
|
|
12953
|
+
const gitignore = fs7.existsSync(gitignorePath) ? fs7.readFileSync(gitignorePath, "utf8") : "";
|
|
12912
12954
|
if (!gitignore.split(/\r?\n/).includes(ZCODE_PLUGIN_CHECKOUT_PROJECT)) {
|
|
12913
12955
|
errors2.push(`Missing .gitignore entry: ${ZCODE_PLUGIN_CHECKOUT_PROJECT}`);
|
|
12914
12956
|
}
|
|
@@ -13010,7 +13052,7 @@ function formatCliDoctorNote(detected, expected) {
|
|
|
13010
13052
|
}
|
|
13011
13053
|
|
|
13012
13054
|
// src/plugin-version-alignment.ts
|
|
13013
|
-
import
|
|
13055
|
+
import fs8 from "node:fs";
|
|
13014
13056
|
import os8 from "node:os";
|
|
13015
13057
|
import path12 from "node:path";
|
|
13016
13058
|
var PLUGIN_VERSION_SHAPE_RE = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
|
|
@@ -13024,7 +13066,7 @@ function highestVersion(current, candidate) {
|
|
|
13024
13066
|
function versionFromJsonFile(filePath) {
|
|
13025
13067
|
let raw;
|
|
13026
13068
|
try {
|
|
13027
|
-
raw =
|
|
13069
|
+
raw = fs8.readFileSync(filePath, "utf8");
|
|
13028
13070
|
} catch {
|
|
13029
13071
|
return null;
|
|
13030
13072
|
}
|
|
@@ -13049,7 +13091,7 @@ function defaultOpencodePackagesRoot() {
|
|
|
13049
13091
|
function detectOpencodePluginVersion(packagesRoot = defaultOpencodePackagesRoot()) {
|
|
13050
13092
|
let specs;
|
|
13051
13093
|
try {
|
|
13052
|
-
specs =
|
|
13094
|
+
specs = fs8.readdirSync(path12.join(packagesRoot, "@mstar-harness"), { withFileTypes: true });
|
|
13053
13095
|
} catch {
|
|
13054
13096
|
return null;
|
|
13055
13097
|
}
|
|
@@ -13082,7 +13124,7 @@ function readZcodeManifestVersion(versionDir) {
|
|
|
13082
13124
|
function detectZcodePluginVersion(cacheRoot = ZCODE_PLUGINS_CACHE_ROOT2) {
|
|
13083
13125
|
let marketplaceEntries;
|
|
13084
13126
|
try {
|
|
13085
|
-
marketplaceEntries =
|
|
13127
|
+
marketplaceEntries = fs8.readdirSync(cacheRoot, { withFileTypes: true });
|
|
13086
13128
|
} catch {
|
|
13087
13129
|
return null;
|
|
13088
13130
|
}
|
|
@@ -13093,7 +13135,7 @@ function detectZcodePluginVersion(cacheRoot = ZCODE_PLUGINS_CACHE_ROOT2) {
|
|
|
13093
13135
|
const pluginRoot = path12.join(cacheRoot, marketplace.name, PLUGIN_NAME);
|
|
13094
13136
|
let versionEntries;
|
|
13095
13137
|
try {
|
|
13096
|
-
versionEntries =
|
|
13138
|
+
versionEntries = fs8.readdirSync(pluginRoot, { withFileTypes: true });
|
|
13097
13139
|
} catch {
|
|
13098
13140
|
continue;
|
|
13099
13141
|
}
|
|
@@ -13129,7 +13171,7 @@ function listDirsToDepth(root, maxDepth) {
|
|
|
13129
13171
|
const visit = (dir, depth) => {
|
|
13130
13172
|
let entries;
|
|
13131
13173
|
try {
|
|
13132
|
-
entries =
|
|
13174
|
+
entries = fs8.readdirSync(dir, { withFileTypes: true });
|
|
13133
13175
|
} catch {
|
|
13134
13176
|
return;
|
|
13135
13177
|
}
|
|
@@ -13242,7 +13284,7 @@ function formatPluginVersionDoctorNote(target, cliVersion, installed) {
|
|
|
13242
13284
|
var SUPPORTED_TARGETS = ["opencode", "cursor", "codex", "zcode", "omp", "dsh", "kimi"];
|
|
13243
13285
|
|
|
13244
13286
|
// src/utils.ts
|
|
13245
|
-
import
|
|
13287
|
+
import fs9 from "node:fs";
|
|
13246
13288
|
import path13 from "node:path";
|
|
13247
13289
|
function parseCsv(raw) {
|
|
13248
13290
|
if (!raw)
|
|
@@ -13268,7 +13310,7 @@ function findUpPackageRoot(startDir, predicate) {
|
|
|
13268
13310
|
let dir = path13.resolve(startDir);
|
|
13269
13311
|
for (;; ) {
|
|
13270
13312
|
try {
|
|
13271
|
-
const manifest = JSON.parse(
|
|
13313
|
+
const manifest = JSON.parse(fs9.readFileSync(joinWithinRoot(dir, "package.json"), "utf8"));
|
|
13272
13314
|
if (predicate(manifest))
|
|
13273
13315
|
return dir;
|
|
13274
13316
|
} catch {}
|
|
@@ -13451,7 +13493,7 @@ function resolvePluginRoot(options) {
|
|
|
13451
13493
|
if (options.root)
|
|
13452
13494
|
return path14.resolve(options.root);
|
|
13453
13495
|
let candidate = resolveProjectRoot3();
|
|
13454
|
-
while (!
|
|
13496
|
+
while (!fs10.existsSync(path14.join(candidate, "plugin.json"))) {
|
|
13455
13497
|
const parent = path14.dirname(candidate);
|
|
13456
13498
|
if (parent === candidate)
|
|
13457
13499
|
break;
|
|
@@ -13521,7 +13563,7 @@ function runScaffold(pathArg) {
|
|
|
13521
13563
|
if (harnessKind === "mstar" && path14.resolve(harnessDir) === mstarDirAtWorkspaceRoot) {
|
|
13522
13564
|
const gitignorePath = workspaceRoot.endsWith(path14.sep) ? `${workspaceRoot}.gitignore` : `${workspaceRoot}${path14.sep}.gitignore`;
|
|
13523
13565
|
const snippet = emitGitignoreSnippet("mstar");
|
|
13524
|
-
const current =
|
|
13566
|
+
const current = fs10.existsSync(gitignorePath) ? fs10.readFileSync(gitignorePath, "utf8") : "";
|
|
13525
13567
|
const lines = new Set(current.split(/\r?\n/).map((line) => line.trim()));
|
|
13526
13568
|
const snippetLines = snippet.split(`
|
|
13527
13569
|
`).map((line) => line.trim());
|
|
@@ -13543,18 +13585,18 @@ function runScaffold(pathArg) {
|
|
|
13543
13585
|
`) ? "" : `
|
|
13544
13586
|
`}.mstarc
|
|
13545
13587
|
`;
|
|
13546
|
-
|
|
13588
|
+
fs10.writeFileSync(gitignorePath, next, "utf8");
|
|
13547
13589
|
} else {
|
|
13548
13590
|
const prefix = current && !current.endsWith(`
|
|
13549
13591
|
`) ? `
|
|
13550
13592
|
` : "";
|
|
13551
|
-
|
|
13593
|
+
fs10.appendFileSync(gitignorePath, `${prefix}${[...missingComments, ...missing].join(`
|
|
13552
13594
|
`)}
|
|
13553
13595
|
`, "utf8");
|
|
13554
13596
|
}
|
|
13555
13597
|
created.push(".gitignore (canonical harness snippet)");
|
|
13556
13598
|
}
|
|
13557
|
-
const finalLines =
|
|
13599
|
+
const finalLines = fs10.readFileSync(gitignorePath, "utf8").split(/\r?\n/);
|
|
13558
13600
|
const broadIndexes = finalLines.map((line, index) => line.trim() === ".mstar/**" ? index : -1).filter((index) => index !== -1);
|
|
13559
13601
|
const canonicalNegationIndexes = finalLines.map((line, index) => CANONICAL_NEGATIONS[line.trim()] === true ? index : -1).filter((index) => index !== -1);
|
|
13560
13602
|
const firstCanonicalNegationIndex = canonicalNegationIndexes[0] ?? -1;
|
|
@@ -13716,7 +13758,7 @@ function runScaffold(pathArg) {
|
|
|
13716
13758
|
finalLines.push("");
|
|
13717
13759
|
}
|
|
13718
13760
|
if (normalized) {
|
|
13719
|
-
|
|
13761
|
+
fs10.writeFileSync(gitignorePath, finalLines.join(`
|
|
13720
13762
|
`), "utf8");
|
|
13721
13763
|
created.push(".gitignore (canonical harness snippet reordered)");
|
|
13722
13764
|
} else if (missing.length === 0) {
|
|
@@ -13727,8 +13769,8 @@ function runScaffold(pathArg) {
|
|
|
13727
13769
|
}
|
|
13728
13770
|
const agentsPath = path14.join(harnessDir, "AGENTS.md");
|
|
13729
13771
|
const agentsLabel = `${path14.basename(harnessDir)}/AGENTS.md`;
|
|
13730
|
-
if (!
|
|
13731
|
-
|
|
13772
|
+
if (!fs10.existsSync(agentsPath)) {
|
|
13773
|
+
fs10.writeFileSync(agentsPath, HARNESS_AGENTS_TEMPLATE, "utf8");
|
|
13732
13774
|
created.push(agentsLabel);
|
|
13733
13775
|
} else {
|
|
13734
13776
|
skipped.push(`${agentsLabel} (already present)`);
|
|
@@ -13802,7 +13844,7 @@ statusCommand.command("validate").description("Validate a v2 status.json root or
|
|
|
13802
13844
|
let statusPath;
|
|
13803
13845
|
try {
|
|
13804
13846
|
statusPath = resolveStatusFilePath(pathArg);
|
|
13805
|
-
if (!
|
|
13847
|
+
if (!fs10.existsSync(statusPath)) {
|
|
13806
13848
|
throw new Error(`status file not found: ${statusPath}`);
|
|
13807
13849
|
}
|
|
13808
13850
|
const gate2 = path14.basename(statusPath) === WORKFLOW_SNAPSHOT_FILE ? validateWorkflowSnapshot(readJson2(statusPath)) : validateStatus(statusPath);
|
|
@@ -13826,7 +13868,7 @@ statusCommand.command("validate").description("Validate a v2 status.json root or
|
|
|
13826
13868
|
statusCommand.command("tech-debt").description("Print the residual tech-debt rollup aggregated over every {PROJECT_DIR}/<id>/residuals.json register " + "(total_open / by_severity / by_target / by_plan; the project register is the source of truth \u2014 " + "no stored-summary drift check, informational exit 0)").argument("[path]", "Project dir (default: resolved {PROJECT_DIR})").action((pathArg) => {
|
|
13827
13869
|
try {
|
|
13828
13870
|
const projectDir = pathArg ? path14.resolve(pathArg) : resolveProjectDir();
|
|
13829
|
-
if (!
|
|
13871
|
+
if (!fs10.existsSync(projectDir)) {
|
|
13830
13872
|
throw new Error(`project dir not found: ${projectDir}`);
|
|
13831
13873
|
}
|
|
13832
13874
|
const rollup = techDebtRollup(projectDir);
|
|
@@ -13845,7 +13887,7 @@ statusCommand.command("findings-cleanup").description("Enforce a plan's findings
|
|
|
13845
13887
|
try {
|
|
13846
13888
|
const projectDir = resolveProjectDir(process.cwd(), options.harness ? { harnessDir: options.harness } : {});
|
|
13847
13889
|
const registerPath = path14.join(projectDir, options.project ?? _DEFAULT_PROJECT, PROJECT_REGISTER_FILE);
|
|
13848
|
-
if (!
|
|
13890
|
+
if (!fs10.existsSync(registerPath)) {
|
|
13849
13891
|
throw new Error(`project register not found: ${registerPath}`);
|
|
13850
13892
|
}
|
|
13851
13893
|
const mode = options.mode === "zero-residual" || options.mode === "allow-residual" ? options.mode : undefined;
|
|
@@ -13965,12 +14007,12 @@ function readPersistPayload(options) {
|
|
|
13965
14007
|
}
|
|
13966
14008
|
if (options.file !== undefined) {
|
|
13967
14009
|
const requested = path14.isAbsolute(options.file) ? options.file : `${process.cwd()}${path14.sep}${options.file}`;
|
|
13968
|
-
if (!
|
|
14010
|
+
if (!fs10.existsSync(requested)) {
|
|
13969
14011
|
throw new Error(`persist payload file not found: ${requested}`);
|
|
13970
14012
|
}
|
|
13971
|
-
return
|
|
14013
|
+
return fs10.readFileSync(requested, "utf8");
|
|
13972
14014
|
}
|
|
13973
|
-
return
|
|
14015
|
+
return fs10.readFileSync(0, "utf8");
|
|
13974
14016
|
}
|
|
13975
14017
|
function validatePersistPayload(kind, payload) {
|
|
13976
14018
|
let gate2;
|
|
@@ -14128,7 +14170,7 @@ leaseCommand.command("verify").description("Verify a plan's execution_lease on t
|
|
|
14128
14170
|
throw new SddScriptError("usage: lease verify --workflow <id> [--plan <plan-id>] [--harness <path>]", 2);
|
|
14129
14171
|
}
|
|
14130
14172
|
const snapshotPath = resolveSnapshotPath(options.workflow, options.harness);
|
|
14131
|
-
if (!
|
|
14173
|
+
if (!fs10.existsSync(snapshotPath)) {
|
|
14132
14174
|
throw new Error(`workflow snapshot not found: ${snapshotPath}`);
|
|
14133
14175
|
}
|
|
14134
14176
|
const doc = readJson2(snapshotPath);
|
|
@@ -14166,7 +14208,7 @@ leaseCommand.command("verify-integration").description("Verify the workflow snap
|
|
|
14166
14208
|
throw new SddScriptError("usage: lease verify-integration --workflow <id> [--harness <path>]", 2);
|
|
14167
14209
|
}
|
|
14168
14210
|
const snapshotPath = resolveSnapshotPath(options.workflow, options.harness);
|
|
14169
|
-
if (!
|
|
14211
|
+
if (!fs10.existsSync(snapshotPath)) {
|
|
14170
14212
|
throw new Error(`workflow snapshot not found: ${snapshotPath}`);
|
|
14171
14213
|
}
|
|
14172
14214
|
const doc = readJson2(snapshotPath);
|
|
@@ -14201,7 +14243,7 @@ function loadSddContextFile(pathValue) {
|
|
|
14201
14243
|
}
|
|
14202
14244
|
let raw;
|
|
14203
14245
|
try {
|
|
14204
|
-
raw =
|
|
14246
|
+
raw = fs10.readFileSync(pathValue, "utf8");
|
|
14205
14247
|
} catch {
|
|
14206
14248
|
throw new SddScriptError(`no such context file: ${pathValue}`, 2);
|
|
14207
14249
|
}
|
|
@@ -14309,9 +14351,9 @@ iterationCommand.command("gate").description("Evaluate the phase-transition gate
|
|
|
14309
14351
|
try {
|
|
14310
14352
|
const snapshotPath = resolveSnapshotPath(options.workflow, options.harness);
|
|
14311
14353
|
const compassPath = path14.resolve(options.compass);
|
|
14312
|
-
if (!
|
|
14354
|
+
if (!fs10.existsSync(snapshotPath))
|
|
14313
14355
|
throw new Error(`workflow snapshot not found: ${snapshotPath}`);
|
|
14314
|
-
if (!
|
|
14356
|
+
if (!fs10.existsSync(compassPath))
|
|
14315
14357
|
throw new Error(`compass file not found: ${compassPath}`);
|
|
14316
14358
|
const result = evaluatePhaseGate(readJson2(snapshotPath), parseCompassFrontmatter(compassPath), {
|
|
14317
14359
|
currentBranch: options.branch,
|
|
@@ -14350,11 +14392,11 @@ dispatchCommand.command("validate").description("Validate an Assignment markdown
|
|
|
14350
14392
|
throw new SddScriptError("usage: dispatch validate <assignment-file> [--branch <branch>]", 2);
|
|
14351
14393
|
}
|
|
14352
14394
|
const fromCwd = path14.isAbsolute(assignmentFile) ? assignmentFile : path14.resolve(process.cwd(), assignmentFile);
|
|
14353
|
-
const file =
|
|
14354
|
-
if (!
|
|
14395
|
+
const file = fs10.existsSync(fromCwd) ? fromCwd : resolveCliPath(assignmentFile);
|
|
14396
|
+
if (!fs10.existsSync(file)) {
|
|
14355
14397
|
throw new Error(`assignment file not found: ${assignmentFile} (tried ${fromCwd} and ${resolveCliPath(assignmentFile)})`);
|
|
14356
14398
|
}
|
|
14357
|
-
const text =
|
|
14399
|
+
const text = fs10.readFileSync(file, "utf8");
|
|
14358
14400
|
const readOnly = isReadOnlyAssignmentRole(parseAssignmentFields(text).executeAs ?? "");
|
|
14359
14401
|
const violations = [...validateAssignmentFields(text, { writable: readOnly ? false : undefined }).violations];
|
|
14360
14402
|
if (!readOnly) {
|
|
@@ -14413,7 +14455,7 @@ worktreeCommand.command("check").description("L1: verify the plan's execution_le
|
|
|
14413
14455
|
throw new SddScriptError("usage: worktree check <plan-id> --workflow <id> [--harness <path>] [--control <path>] (or --plan <plan-id>)", 2);
|
|
14414
14456
|
}
|
|
14415
14457
|
const snapshotPath = resolveSnapshotPath(options.workflow, options.harness);
|
|
14416
|
-
if (!
|
|
14458
|
+
if (!fs10.existsSync(snapshotPath)) {
|
|
14417
14459
|
throw new Error(`workflow snapshot not found: ${snapshotPath}`);
|
|
14418
14460
|
}
|
|
14419
14461
|
const doc = readJson2(snapshotPath);
|
|
@@ -14471,10 +14513,10 @@ worktreeCommand.command("qc-alignment").description("Assert the QC/QA alignment
|
|
|
14471
14513
|
const assignments = [];
|
|
14472
14514
|
for (const fileArg of files) {
|
|
14473
14515
|
const file = path14.isAbsolute(fileArg) ? fileArg : `${process.cwd()}${path14.sep}${fileArg}`;
|
|
14474
|
-
if (!
|
|
14516
|
+
if (!fs10.existsSync(file)) {
|
|
14475
14517
|
throw new Error(`assignment file not found: ${file}`);
|
|
14476
14518
|
}
|
|
14477
|
-
const text =
|
|
14519
|
+
const text = fs10.readFileSync(file, "utf8");
|
|
14478
14520
|
const combinedRange = parseAssignmentHeaderField(text, "Review range / Diff basis");
|
|
14479
14521
|
const planId = parseAssignmentHeaderField(text, "plan_id");
|
|
14480
14522
|
const reviewRange = parseAssignmentHeaderField(text, "Review range") || combinedRange;
|
|
@@ -14517,10 +14559,10 @@ reviewCommand.command("seats").description("Map an Assignment's execution mode t
|
|
|
14517
14559
|
throw new SddScriptError("usage: review seats <assignment-file> [--mode sdd|inline|targeted] [--reviewers <role1,role2,...>]", 2);
|
|
14518
14560
|
}
|
|
14519
14561
|
const file = path14.isAbsolute(assignmentFile) ? assignmentFile : `${process.cwd()}${path14.sep}${assignmentFile}`;
|
|
14520
|
-
if (!
|
|
14562
|
+
if (!fs10.existsSync(file)) {
|
|
14521
14563
|
throw new Error(`assignment file not found: ${file}`);
|
|
14522
14564
|
}
|
|
14523
|
-
const text =
|
|
14565
|
+
const text = fs10.readFileSync(file, "utf8");
|
|
14524
14566
|
const mode = options.mode ?? parseAssignmentExecutionMode(text);
|
|
14525
14567
|
const reviewers = (options.reviewers ?? "").split(",").map((role) => role.trim()).filter((role) => role !== "");
|
|
14526
14568
|
const result = executionModeToN(mode, { seats: reviewers });
|
|
@@ -14596,7 +14638,7 @@ function lintTargetType(filePath) {
|
|
|
14596
14638
|
function collectLintTargets(dir) {
|
|
14597
14639
|
const targets = [];
|
|
14598
14640
|
const visit = (current) => {
|
|
14599
|
-
for (const entry of
|
|
14641
|
+
for (const entry of fs10.readdirSync(current, { withFileTypes: true })) {
|
|
14600
14642
|
if (entry.name.includes(path14.sep))
|
|
14601
14643
|
continue;
|
|
14602
14644
|
const child = current + entry.name;
|
|
@@ -14613,7 +14655,7 @@ function collectLintTargets(dir) {
|
|
|
14613
14655
|
return targets;
|
|
14614
14656
|
}
|
|
14615
14657
|
var lintIo = {
|
|
14616
|
-
readText: async (resolvedPath) =>
|
|
14658
|
+
readText: async (resolvedPath) => fs10.promises.readFile(resolvedPath, "utf8")
|
|
14617
14659
|
};
|
|
14618
14660
|
async function lintOneFile(filePath, forcedType, prVariant) {
|
|
14619
14661
|
const text = await lintIo.readText(filePath);
|
|
@@ -14668,9 +14710,9 @@ lintCommand.description("Lint <target> (file or dir) \u2014 exit 1 on violations
|
|
|
14668
14710
|
forcedType = forced;
|
|
14669
14711
|
}
|
|
14670
14712
|
const abs = resolveCliPath(target);
|
|
14671
|
-
if (!
|
|
14713
|
+
if (!fs10.existsSync(abs))
|
|
14672
14714
|
throw new Error(`lint target not found: ${abs}`);
|
|
14673
|
-
const targets =
|
|
14715
|
+
const targets = fs10.statSync(abs).isDirectory() ? collectLintTargets(abs) : [abs];
|
|
14674
14716
|
if (targets.length === 0) {
|
|
14675
14717
|
console.log(import_picocolors2.default.yellow(`lint: no lintable files under ${target}`));
|
|
14676
14718
|
return;
|
|
@@ -14716,16 +14758,16 @@ designMdCommand.command("validate").description("Validate DESIGN.md in <dir>: to
|
|
|
14716
14758
|
throw new SddScriptError("usage: design-md validate <dir>", 2);
|
|
14717
14759
|
const abs = resolveCliPath(dir);
|
|
14718
14760
|
const lightPath = `${abs}${path14.sep}DESIGN.md`;
|
|
14719
|
-
if (!
|
|
14761
|
+
if (!fs10.existsSync(lightPath))
|
|
14720
14762
|
throw new Error(`design file not found: ${lightPath}`);
|
|
14721
|
-
const light =
|
|
14763
|
+
const light = fs10.readFileSync(lightPath, "utf8");
|
|
14722
14764
|
const violations = [];
|
|
14723
14765
|
const tokens = validateDesignTokenFrontmatter(light);
|
|
14724
14766
|
printChecklist("design-md validate (tokens)", tokens);
|
|
14725
14767
|
violations.push(...tokens.violations);
|
|
14726
14768
|
const darkPath = `${abs}${path14.sep}DESIGN.dark.md`;
|
|
14727
|
-
if (
|
|
14728
|
-
const parity = assertLightDarkParity(light,
|
|
14769
|
+
if (fs10.existsSync(darkPath)) {
|
|
14770
|
+
const parity = assertLightDarkParity(light, fs10.readFileSync(darkPath, "utf8"));
|
|
14729
14771
|
printChecklist("design-md validate (light/dark parity)", parity);
|
|
14730
14772
|
violations.push(...parity.violations);
|
|
14731
14773
|
}
|
|
@@ -14873,7 +14915,7 @@ auditCommand.command("scaffold").description("Scaffold an audit-<date>/ plan dir
|
|
|
14873
14915
|
if (!findingsFile)
|
|
14874
14916
|
throw new SddScriptError("usage: audit scaffold <findings-file> [--dir <out-dir>]", 2);
|
|
14875
14917
|
const abs = resolveCliPath(findingsFile);
|
|
14876
|
-
if (!
|
|
14918
|
+
if (!fs10.existsSync(abs))
|
|
14877
14919
|
throw new Error(`findings file not found: ${abs}`);
|
|
14878
14920
|
if (options.date !== undefined && !/^\d{4}-\d{2}-\d{2}$/.test(options.date)) {
|
|
14879
14921
|
throw new SddScriptError("usage: audit scaffold \u2014 --date must be YYYY-MM-DD", 2);
|
|
@@ -14883,7 +14925,7 @@ auditCommand.command("scaffold").description("Scaffold an audit-<date>/ plan dir
|
|
|
14883
14925
|
}
|
|
14884
14926
|
const date = options.date ?? new Date().toISOString().slice(0, 10);
|
|
14885
14927
|
const outDir = options.dir !== undefined ? resolveCliPath(options.dir) : resolveCliPath(`audit-${date}`);
|
|
14886
|
-
const input = parseAuditScaffoldInput(
|
|
14928
|
+
const input = parseAuditScaffoldInput(fs10.readFileSync(abs, "utf8"));
|
|
14887
14929
|
const sha = resolveAuditShortSha(process.cwd(), options.sha);
|
|
14888
14930
|
const result = scaffoldAuditPlan(outDir, input.findings, {
|
|
14889
14931
|
date,
|
|
@@ -14910,7 +14952,7 @@ auditCommand.command("promote").description("Promote selected audit plans into t
|
|
|
14910
14952
|
throw new SddScriptError("usage: audit promote <audit-dir> --plans <ids> [--workflow <id>] [--harness <dir>]", 2);
|
|
14911
14953
|
}
|
|
14912
14954
|
const outDir = resolveCliPath(auditDir);
|
|
14913
|
-
if (!
|
|
14955
|
+
if (!fs10.existsSync(outDir)) {
|
|
14914
14956
|
throw new Error(`audit dir not found: ${outDir}`);
|
|
14915
14957
|
}
|
|
14916
14958
|
const harnessDir = resolveLeaseHarnessDir(options.harness);
|
|
@@ -14941,7 +14983,7 @@ function listTrackedFiles(root) {
|
|
|
14941
14983
|
auditCommand.command("secret-scan").description("Read-only credential-pattern scan over git-tracked files under [path] " + "(default cwd): prints {file, line, type} findings; never prints values. " + "Exit 1 on findings, 0 when clean, 2 when the tracked-file walk or reads fail").argument("[path]", "Directory to scan (default: cwd)").action((scanPath) => {
|
|
14942
14984
|
try {
|
|
14943
14985
|
const root = scanPath !== undefined ? resolveCliPath(scanPath) : process.cwd();
|
|
14944
|
-
if (!
|
|
14986
|
+
if (!fs10.existsSync(root) || !fs10.statSync(root).isDirectory()) {
|
|
14945
14987
|
throw new SddScriptError(`usage: audit secret-scan [path] \u2014 not a directory: ${root}`, 2);
|
|
14946
14988
|
}
|
|
14947
14989
|
const files = listTrackedFiles(root);
|
|
@@ -14968,7 +15010,7 @@ auditCommand.command("secret-scan").description("Read-only credential-pattern sc
|
|
|
14968
15010
|
auditCommand.command("supply-chain").description("Supply-chain checks over a repo root (read-only): root lockfile presence/duplication, " + "unpinned GitHub Actions refs, pull_request_target PR-head checkout. " + "Exit 1 on findings, 0 when clean").argument("[path]", "Repository root (default: cwd)").action((repoPath) => {
|
|
14969
15011
|
try {
|
|
14970
15012
|
const root = repoPath !== undefined ? resolveCliPath(repoPath) : process.cwd();
|
|
14971
|
-
if (!
|
|
15013
|
+
if (!fs10.existsSync(root) || !fs10.statSync(root).isDirectory()) {
|
|
14972
15014
|
throw new SddScriptError(`usage: audit supply-chain [path] \u2014 not a directory: ${root}`, 2);
|
|
14973
15015
|
}
|
|
14974
15016
|
const result = supplyChainChecks(root);
|
|
@@ -14995,9 +15037,9 @@ compoundCommand.command("validate").description("Validate a knowledge doc frontm
|
|
|
14995
15037
|
if (!docPath)
|
|
14996
15038
|
throw new SddScriptError("usage: compound validate <doc-path> [--knowledge-dir <dir>]", 2);
|
|
14997
15039
|
const abs = resolveCliPath(docPath);
|
|
14998
|
-
if (!
|
|
15040
|
+
if (!fs10.existsSync(abs))
|
|
14999
15041
|
throw new Error(`knowledge doc not found: ${abs}`);
|
|
15000
|
-
const text =
|
|
15042
|
+
const text = fs10.readFileSync(abs, "utf8");
|
|
15001
15043
|
const violations = [];
|
|
15002
15044
|
const schema = validateSchemaYaml(text);
|
|
15003
15045
|
printChecklist("compound validate (schema)", schema);
|
|
@@ -15088,9 +15130,9 @@ skillCommand.command("lint").description("Lint <skill-dir>/SKILL.md: frontmatter
|
|
|
15088
15130
|
if (!skillDir)
|
|
15089
15131
|
throw new SddScriptError("usage: skill lint <skill-dir>", 2);
|
|
15090
15132
|
const skillFile = path14.join(resolveCliPath(skillDir), "SKILL.md");
|
|
15091
|
-
if (!
|
|
15133
|
+
if (!fs10.existsSync(skillFile))
|
|
15092
15134
|
throw new Error(`SKILL.md not found: ${skillFile}`);
|
|
15093
|
-
const text =
|
|
15135
|
+
const text = fs10.readFileSync(skillFile, "utf8");
|
|
15094
15136
|
const violations = [];
|
|
15095
15137
|
const frontmatter = lintSkillFrontmatter(text);
|
|
15096
15138
|
printChecklist("skill lint (frontmatter)", frontmatter);
|
|
@@ -15132,14 +15174,14 @@ rolesCommand.command("validate").description("Validate the mstar-roles skill-dir
|
|
|
15132
15174
|
printChecklist("roles validate (mapping)", mapping);
|
|
15133
15175
|
violations.push(...mapping.violations);
|
|
15134
15176
|
const skillTexts = {};
|
|
15135
|
-
for (const entry of
|
|
15177
|
+
for (const entry of fs10.readdirSync(skillsRoot, { withFileTypes: true })) {
|
|
15136
15178
|
if (!entry.isDirectory() || !entry.name.startsWith("mstar-"))
|
|
15137
15179
|
continue;
|
|
15138
15180
|
const skillFile = path14.join(skillsRoot, entry.name, "SKILL.md");
|
|
15139
|
-
if (!
|
|
15181
|
+
if (!fs10.existsSync(skillFile))
|
|
15140
15182
|
continue;
|
|
15141
15183
|
try {
|
|
15142
|
-
skillTexts[entry.name] =
|
|
15184
|
+
skillTexts[entry.name] = fs10.readFileSync(skillFile, "utf8");
|
|
15143
15185
|
} catch {}
|
|
15144
15186
|
}
|
|
15145
15187
|
const loadOrder = lintLoadOrder(skillTexts);
|
|
@@ -15181,11 +15223,11 @@ function parsePrReviewTarget(raw) {
|
|
|
15181
15223
|
prReviewCommand.command("tally").description("Compute the locked-formula tally, verdict and score from accepted findings JSON ([{mergeClass}]) plus the " + "leftover unmet-AC / unverified counts; prints the two-line chat header + structured result (pr-review.md \xA7 Tally)").requiredOption("--findings <file.json>", "Accepted findings JSON \u2014 array of {mergeClass: must-fix|should-fix|nit}").option("--unverified <n>", "Count of residual - unverified: items (default 0)").option("--unmet-ac-unsafe <n>", "Leftover unmet ACs that are unsafe-to-ship (each \u2192 must_fix + 1)").option("--unmet-ac-safe <n>", "Leftover unmet ACs that are ship-safe (each \u2192 should_fix + 1)").action((options) => {
|
|
15182
15224
|
try {
|
|
15183
15225
|
const findingsPath = resolveCliPath(options.findings);
|
|
15184
|
-
if (!
|
|
15226
|
+
if (!fs10.existsSync(findingsPath))
|
|
15185
15227
|
throw new Error(`findings file not found: ${findingsPath}`);
|
|
15186
15228
|
let parsed;
|
|
15187
15229
|
try {
|
|
15188
|
-
parsed = JSON.parse(
|
|
15230
|
+
parsed = JSON.parse(fs10.readFileSync(findingsPath, "utf8"));
|
|
15189
15231
|
} catch (error) {
|
|
15190
15232
|
throw new Error(`--findings is not valid JSON: ${error.message}`);
|
|
15191
15233
|
}
|
|
@@ -15263,9 +15305,9 @@ prReviewCommand.command("report-path").description("Resolve the local-report (or
|
|
|
15263
15305
|
prReviewCommand.command("validate-report").description("Validate a saved local PR-review report against the machine-readable contract (frontmatter fields, verdict-from-tally, " + "locked-formula score recompute, comments tri-state; exit 1 with violations printed)").argument("<file.md>", "Saved report markdown file").action((reportFile) => {
|
|
15264
15306
|
try {
|
|
15265
15307
|
const abs = resolveCliPath(reportFile);
|
|
15266
|
-
if (!
|
|
15308
|
+
if (!fs10.existsSync(abs))
|
|
15267
15309
|
throw new Error(`report file not found: ${abs}`);
|
|
15268
|
-
const gate2 = validatePrReviewReport(
|
|
15310
|
+
const gate2 = validatePrReviewReport(fs10.readFileSync(abs, "utf8"));
|
|
15269
15311
|
printChecklist(abs, gate2);
|
|
15270
15312
|
if (!gate2.ok)
|
|
15271
15313
|
process.exitCode = 1;
|
|
@@ -15373,17 +15415,17 @@ prReviewCommand.command("post").description("Build and POST the GitHub Review pe
|
|
|
15373
15415
|
}
|
|
15374
15416
|
const prNumber = Number(options.pr);
|
|
15375
15417
|
const bodyPath = resolveCliPath(options.bodyFile);
|
|
15376
|
-
if (!
|
|
15418
|
+
if (!fs10.existsSync(bodyPath))
|
|
15377
15419
|
throw new Error(`body file not found: ${bodyPath}`);
|
|
15378
|
-
const body =
|
|
15420
|
+
const body = fs10.readFileSync(bodyPath, "utf8");
|
|
15379
15421
|
let comments = [];
|
|
15380
15422
|
if (options.findings !== undefined) {
|
|
15381
15423
|
const findingsPath = resolveCliPath(options.findings);
|
|
15382
|
-
if (!
|
|
15424
|
+
if (!fs10.existsSync(findingsPath))
|
|
15383
15425
|
throw new Error(`findings file not found: ${findingsPath}`);
|
|
15384
15426
|
let parsed;
|
|
15385
15427
|
try {
|
|
15386
|
-
parsed = JSON.parse(
|
|
15428
|
+
parsed = JSON.parse(fs10.readFileSync(findingsPath, "utf8"));
|
|
15387
15429
|
} catch (error) {
|
|
15388
15430
|
throw new Error(`--findings is not valid JSON: ${error.message}`);
|
|
15389
15431
|
}
|
|
@@ -15487,7 +15529,7 @@ prReviewCommand.command("worktree-setup").description("Create the isolated revie
|
|
|
15487
15529
|
throw new SddScriptError("usage: pr-review worktree-setup \u2014 the five input modes are mutually exclusive", 2);
|
|
15488
15530
|
}
|
|
15489
15531
|
const startDir = process.cwd();
|
|
15490
|
-
if (!
|
|
15532
|
+
if (!fs10.existsSync(path14.join(startDir, ".git")) && gitIf(["rev-parse", "--git-dir"], startDir) === "") {
|
|
15491
15533
|
throw new Error(`not a git repository: ${startDir}`);
|
|
15492
15534
|
}
|
|
15493
15535
|
const repoRoot = gitSync(["rev-parse", "--show-toplevel"], startDir);
|
|
@@ -15563,13 +15605,13 @@ prReviewCommand.command("worktree-setup").description("Create the isolated revie
|
|
|
15563
15605
|
const branchSuffix = mode === "pr" ? "" : `-${headSpec.slice(0, 8)}`;
|
|
15564
15606
|
const worktreePath = path14.resolve(options.path ?? path14.join(repoRoot, ".worktrees", `review-${reviewBranch}${branchSuffix}`));
|
|
15565
15607
|
if (options.path === undefined) {
|
|
15566
|
-
|
|
15608
|
+
fs10.mkdirSync(path14.join(repoRoot, ".worktrees"), { recursive: true });
|
|
15567
15609
|
if (gitIf(["check-ignore", ".worktrees/"], repoRoot) === "") {
|
|
15568
15610
|
const excludePath = path14.join(repoRoot, ".git", "info", "exclude");
|
|
15569
|
-
const existing2 =
|
|
15611
|
+
const existing2 = fs10.existsSync(excludePath) ? fs10.readFileSync(excludePath, "utf8") : "";
|
|
15570
15612
|
if (!existing2.split(`
|
|
15571
15613
|
`).some((line) => line.trim() === ".worktrees/")) {
|
|
15572
|
-
|
|
15614
|
+
fs10.appendFileSync(excludePath, `${existing2 === "" || existing2.endsWith(`
|
|
15573
15615
|
`) ? "" : `
|
|
15574
15616
|
`}.worktrees/
|
|
15575
15617
|
`);
|
|
@@ -15597,7 +15639,7 @@ prReviewCommand.command("worktree-setup").description("Create the isolated revie
|
|
|
15597
15639
|
let sidecarFd;
|
|
15598
15640
|
const cleanupOnFailure = (branchToDelete) => {
|
|
15599
15641
|
try {
|
|
15600
|
-
if (
|
|
15642
|
+
if (fs10.existsSync(worktreePath))
|
|
15601
15643
|
gitSync(["worktree", "remove", "--force", worktreePath], repoRoot);
|
|
15602
15644
|
gitSync(["worktree", "prune"], repoRoot);
|
|
15603
15645
|
if (branchToDelete !== "" && !existing.has(branchToDelete)) {
|
|
@@ -15688,7 +15730,7 @@ prReviewCommand.command("worktree-setup").description("Create the isolated revie
|
|
|
15688
15730
|
diffFileSha256: createHash("sha256").update(snapshot).digest("hex")
|
|
15689
15731
|
};
|
|
15690
15732
|
try {
|
|
15691
|
-
sidecarFd =
|
|
15733
|
+
sidecarFd = fs10.openSync(sidecarPath, "wx+");
|
|
15692
15734
|
} catch (error) {
|
|
15693
15735
|
if (error.code !== "EEXIST" && error.code !== "EISDIR")
|
|
15694
15736
|
throw error;
|
|
@@ -15697,21 +15739,21 @@ prReviewCommand.command("worktree-setup").description("Create the isolated revie
|
|
|
15697
15739
|
writeFdSync(sidecarFd, Buffer.from(JSON.stringify(sidecar2, null, 2), "utf8"));
|
|
15698
15740
|
wroteSidecar = true;
|
|
15699
15741
|
try {
|
|
15700
|
-
|
|
15742
|
+
fs10.writeFileSync(diffFile, snapshot, { flag: "wx" });
|
|
15701
15743
|
} catch (error) {
|
|
15702
15744
|
if (error.code !== "EEXIST" && error.code !== "EISDIR")
|
|
15703
15745
|
throw error;
|
|
15704
15746
|
throw new Error(`refusing to overwrite pre-existing non-snapshot path ${diffFile}`);
|
|
15705
15747
|
}
|
|
15706
15748
|
wroteSnapshot = true;
|
|
15707
|
-
const snapshotStat =
|
|
15749
|
+
const snapshotStat = fs10.lstatSync(diffFile);
|
|
15708
15750
|
sidecar2.diffFileDev = snapshotStat.dev;
|
|
15709
15751
|
sidecar2.diffFileIno = String(snapshotStat.ino);
|
|
15710
15752
|
sidecar2.diffFileMtimeMs = snapshotStat.mtimeMs;
|
|
15711
15753
|
pendingSidecar = sidecar2;
|
|
15712
|
-
|
|
15754
|
+
fs10.ftruncateSync(sidecarFd, 0);
|
|
15713
15755
|
writeFdSync(sidecarFd, Buffer.from(JSON.stringify(sidecar2, null, 2), "utf8"));
|
|
15714
|
-
|
|
15756
|
+
fs10.closeSync(sidecarFd);
|
|
15715
15757
|
sidecarFd = undefined;
|
|
15716
15758
|
return sidecar2;
|
|
15717
15759
|
};
|
|
@@ -15743,13 +15785,13 @@ function prReviewArtifactPathFor(worktreePath, suffix) {
|
|
|
15743
15785
|
function writeFdSync(fd, buf) {
|
|
15744
15786
|
let written = 0;
|
|
15745
15787
|
while (written < buf.length)
|
|
15746
|
-
written +=
|
|
15788
|
+
written += fs10.writeSync(fd, buf, written, buf.length - written, written);
|
|
15747
15789
|
}
|
|
15748
15790
|
function removeOwnedSnapshotFile(worktreePath, sidecar) {
|
|
15749
15791
|
const snapshotPath = prReviewArtifactPathFor(worktreePath, "diff");
|
|
15750
15792
|
let fd;
|
|
15751
15793
|
try {
|
|
15752
|
-
fd =
|
|
15794
|
+
fd = fs10.openSync(snapshotPath, "r");
|
|
15753
15795
|
} catch (error) {
|
|
15754
15796
|
if (error.code === "ENOENT")
|
|
15755
15797
|
return;
|
|
@@ -15757,7 +15799,7 @@ function removeOwnedSnapshotFile(worktreePath, sidecar) {
|
|
|
15757
15799
|
return;
|
|
15758
15800
|
}
|
|
15759
15801
|
try {
|
|
15760
|
-
const st =
|
|
15802
|
+
const st = fs10.fstatSync(fd);
|
|
15761
15803
|
if (!st.isFile())
|
|
15762
15804
|
return;
|
|
15763
15805
|
const recordedIno = sidecar.diffFileIno;
|
|
@@ -15774,28 +15816,28 @@ function removeOwnedSnapshotFile(worktreePath, sidecar) {
|
|
|
15774
15816
|
}
|
|
15775
15817
|
const tmp = `${snapshotPath}.cleanup.${process.pid}.${randomUUID3()}`;
|
|
15776
15818
|
try {
|
|
15777
|
-
|
|
15819
|
+
fs10.renameSync(snapshotPath, tmp);
|
|
15778
15820
|
} catch (error) {
|
|
15779
15821
|
console.error(import_picocolors2.default.yellow(`worktree-cleanup: snapshot at ${snapshotPath} left in place (cannot detach: ${error.message})`));
|
|
15780
15822
|
return;
|
|
15781
15823
|
}
|
|
15782
|
-
const st2 =
|
|
15824
|
+
const st2 = fs10.fstatSync(fd);
|
|
15783
15825
|
let tmpStat;
|
|
15784
15826
|
try {
|
|
15785
|
-
tmpStat =
|
|
15827
|
+
tmpStat = fs10.lstatSync(tmp);
|
|
15786
15828
|
} catch {
|
|
15787
15829
|
tmpStat = undefined;
|
|
15788
15830
|
}
|
|
15789
15831
|
if (tmpStat !== undefined && tmpStat.ino === st2.ino && tmpStat.dev === st2.dev && st2.nlink === 1 && tmpStat.nlink === 1) {
|
|
15790
|
-
|
|
15791
|
-
const st3 =
|
|
15832
|
+
fs10.unlinkSync(tmp);
|
|
15833
|
+
const st3 = fs10.fstatSync(fd);
|
|
15792
15834
|
if (st3.nlink !== 0) {
|
|
15793
15835
|
console.error(import_picocolors2.default.yellow(`worktree-cleanup: unlink at ${tmp} detached a pathname replacement, not the verified snapshot inode (${snapshotPath} still holds ${st3.nlink} link(s)) - the replacement is gone, the verified snapshot was NOT deleted`));
|
|
15794
15836
|
}
|
|
15795
15837
|
} else {
|
|
15796
15838
|
try {
|
|
15797
|
-
|
|
15798
|
-
|
|
15839
|
+
fs10.linkSync(tmp, snapshotPath);
|
|
15840
|
+
fs10.unlinkSync(tmp);
|
|
15799
15841
|
} catch (error) {
|
|
15800
15842
|
if (error.code === "EEXIST") {
|
|
15801
15843
|
console.error(import_picocolors2.default.yellow(`worktree-cleanup: snapshot replacement left at ${tmp} (snapshot path was recreated concurrently)`));
|
|
@@ -15805,41 +15847,41 @@ function removeOwnedSnapshotFile(worktreePath, sidecar) {
|
|
|
15805
15847
|
}
|
|
15806
15848
|
}
|
|
15807
15849
|
} finally {
|
|
15808
|
-
|
|
15850
|
+
fs10.closeSync(fd);
|
|
15809
15851
|
}
|
|
15810
15852
|
}
|
|
15811
15853
|
function removeOwnedFreshSidecarFile(sidecarFd, worktreePath) {
|
|
15812
15854
|
const sidecarPath = prReviewArtifactPathFor(worktreePath, "json");
|
|
15813
15855
|
try {
|
|
15814
|
-
const st =
|
|
15856
|
+
const st = fs10.fstatSync(sidecarFd);
|
|
15815
15857
|
if (!st.isFile() || st.nlink !== 1) {
|
|
15816
15858
|
console.error(import_picocolors2.default.yellow(`worktree-setup rollback: sidecar at ${sidecarPath} left in place (identity no longer held)`));
|
|
15817
15859
|
return;
|
|
15818
15860
|
}
|
|
15819
15861
|
const tmp = `${sidecarPath}.cleanup.${process.pid}.${randomUUID3()}`;
|
|
15820
15862
|
try {
|
|
15821
|
-
|
|
15863
|
+
fs10.renameSync(sidecarPath, tmp);
|
|
15822
15864
|
} catch (error) {
|
|
15823
15865
|
console.error(import_picocolors2.default.yellow(`worktree-setup rollback: sidecar at ${sidecarPath} left in place (cannot detach: ${error.message})`));
|
|
15824
15866
|
return;
|
|
15825
15867
|
}
|
|
15826
|
-
const st2 =
|
|
15868
|
+
const st2 = fs10.fstatSync(sidecarFd);
|
|
15827
15869
|
let tmpStat;
|
|
15828
15870
|
try {
|
|
15829
|
-
tmpStat =
|
|
15871
|
+
tmpStat = fs10.lstatSync(tmp);
|
|
15830
15872
|
} catch {
|
|
15831
15873
|
tmpStat = undefined;
|
|
15832
15874
|
}
|
|
15833
15875
|
if (tmpStat !== undefined && tmpStat.ino === st2.ino && tmpStat.dev === st2.dev) {
|
|
15834
|
-
|
|
15835
|
-
const st3 =
|
|
15876
|
+
fs10.unlinkSync(tmp);
|
|
15877
|
+
const st3 = fs10.fstatSync(sidecarFd);
|
|
15836
15878
|
if (st3.nlink !== 0) {
|
|
15837
15879
|
console.error(import_picocolors2.default.yellow(`worktree-setup rollback: unlink at ${tmp} detached a pathname replacement, not the verified sidecar inode (${sidecarPath} still holds ${st3.nlink} link(s)) - the replacement is gone, the verified sidecar was NOT deleted`));
|
|
15838
15880
|
}
|
|
15839
15881
|
} else {
|
|
15840
15882
|
try {
|
|
15841
|
-
|
|
15842
|
-
|
|
15883
|
+
fs10.linkSync(tmp, sidecarPath);
|
|
15884
|
+
fs10.unlinkSync(tmp);
|
|
15843
15885
|
} catch (error) {
|
|
15844
15886
|
if (error.code === "EEXIST") {
|
|
15845
15887
|
console.error(import_picocolors2.default.yellow(`worktree-setup rollback: sidecar replacement left at ${tmp} (sidecar path was recreated concurrently)`));
|
|
@@ -15850,7 +15892,7 @@ function removeOwnedFreshSidecarFile(sidecarFd, worktreePath) {
|
|
|
15850
15892
|
}
|
|
15851
15893
|
} finally {
|
|
15852
15894
|
try {
|
|
15853
|
-
|
|
15895
|
+
fs10.closeSync(sidecarFd);
|
|
15854
15896
|
} catch {}
|
|
15855
15897
|
}
|
|
15856
15898
|
}
|
|
@@ -15858,12 +15900,12 @@ prReviewCommand.command("worktree-cleanup").description("Remove the review workt
|
|
|
15858
15900
|
try {
|
|
15859
15901
|
const worktreePath = path14.resolve(resolveCliPath(options.path));
|
|
15860
15902
|
const sidecarPath = prReviewArtifactPathFor(worktreePath, "json");
|
|
15861
|
-
if (!
|
|
15903
|
+
if (!fs10.existsSync(sidecarPath)) {
|
|
15862
15904
|
throw new Error(`no setup sidecar found at ${sidecarPath} - run pr-review worktree-setup first (foreign worktrees are never cleaned here)`);
|
|
15863
15905
|
}
|
|
15864
15906
|
let sidecar;
|
|
15865
15907
|
try {
|
|
15866
|
-
sidecar = JSON.parse(
|
|
15908
|
+
sidecar = JSON.parse(fs10.readFileSync(sidecarPath, "utf8"));
|
|
15867
15909
|
} catch (error) {
|
|
15868
15910
|
throw new Error(`setup sidecar at ${sidecarPath} is not valid JSON: ${error.message}`);
|
|
15869
15911
|
}
|
|
@@ -15879,7 +15921,7 @@ prReviewCommand.command("worktree-cleanup").description("Remove the review workt
|
|
|
15879
15921
|
if (!savedOk) {
|
|
15880
15922
|
throw new Error("refusing cleanup: the local report is not saved yet - save it first or pass --report-saved (\xA7 Local report archive)");
|
|
15881
15923
|
}
|
|
15882
|
-
if (
|
|
15924
|
+
if (fs10.existsSync(worktreePath)) {
|
|
15883
15925
|
gitSync(["worktree", "remove", worktreePath], gitRoot);
|
|
15884
15926
|
}
|
|
15885
15927
|
gitSync(["worktree", "prune"], gitRoot);
|
|
@@ -15890,7 +15932,7 @@ prReviewCommand.command("worktree-cleanup").description("Remove the review workt
|
|
|
15890
15932
|
gitSync(["branch", "-D", sidecar.reviewBranch], gitRoot);
|
|
15891
15933
|
}
|
|
15892
15934
|
removeOwnedSnapshotFile(worktreePath, sidecar);
|
|
15893
|
-
|
|
15935
|
+
fs10.rmSync(sidecarPath, { force: true });
|
|
15894
15936
|
console.log(import_picocolors2.default.green(`worktree-cleanup: removed ${worktreePath}${sidecar.reviewBranch !== "" ? ` + deleted ${sidecar.reviewBranch}` : " (no local branch to delete)"}`));
|
|
15895
15937
|
} catch (error) {
|
|
15896
15938
|
failScript(error, "pr-review worktree-cleanup");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mstar-harness/cli",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.2",
|
|
4
4
|
"description": "Morning Star harness CLI — installer bootstrap + mstar workflow verbs (path/status/lease/sdd/iteration/dispatch/worktree/lint/design-md/audit/compound/host/skill).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|