@mstar-harness/cli 3.9.2 → 3.9.3
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 +69 -5
- package/package.json +1 -1
package/dist/mstar-harness.js
CHANGED
|
@@ -7218,6 +7218,51 @@ function findEphemeralCitations(skillText) {
|
|
|
7218
7218
|
}
|
|
7219
7219
|
return citations;
|
|
7220
7220
|
}
|
|
7221
|
+
var DATED_SLUG_TOKEN_SOURCE = "\\b20\\d{6}-[a-z0-9][a-z0-9-]*\\b(?!\\.\\d)";
|
|
7222
|
+
var DATED_SLUG_TOKEN_RE = new RegExp(DATED_SLUG_TOKEN_SOURCE, "g");
|
|
7223
|
+
var HARNESS_PATH_RE = /\.(?:mstar|agents)\/[^\s<>{}\[\]"'\*\?]+/g;
|
|
7224
|
+
var SDD_DEEPLINK_PREFIX_RE = /^\.(?:mstar|agents)\/sdd(?:\/|$)/;
|
|
7225
|
+
var TRAILING_SENTENCE_PUNCT_RE = /[.,;:!?]+$/;
|
|
7226
|
+
function isExampleSlug(token) {
|
|
7227
|
+
return token.split("-").includes("example");
|
|
7228
|
+
}
|
|
7229
|
+
function qualifyingDatedToken(text) {
|
|
7230
|
+
for (const m of text.matchAll(DATED_SLUG_TOKEN_RE)) {
|
|
7231
|
+
if (!isExampleSlug(m[0]))
|
|
7232
|
+
return m[0];
|
|
7233
|
+
}
|
|
7234
|
+
return null;
|
|
7235
|
+
}
|
|
7236
|
+
function findProvenanceCitations(text) {
|
|
7237
|
+
const citations = [];
|
|
7238
|
+
const lines = text.split(/\r?\n/);
|
|
7239
|
+
for (let i = 0;i < lines.length; i++) {
|
|
7240
|
+
const found = [];
|
|
7241
|
+
const pathRanges = [];
|
|
7242
|
+
for (const m of lines[i].matchAll(HARNESS_PATH_RE)) {
|
|
7243
|
+
const start = m.index;
|
|
7244
|
+
pathRanges.push([start, start + m[0].length]);
|
|
7245
|
+
if (SDD_DEEPLINK_PREFIX_RE.test(m[0]))
|
|
7246
|
+
continue;
|
|
7247
|
+
if (qualifyingDatedToken(m[0]) !== null) {
|
|
7248
|
+
found.push({ index: start, match: m[0], kind: "harness-path" });
|
|
7249
|
+
}
|
|
7250
|
+
}
|
|
7251
|
+
const inPath = (index) => pathRanges.some(([from, to]) => index >= from && index < to);
|
|
7252
|
+
for (const m of lines[i].matchAll(DATED_SLUG_TOKEN_RE)) {
|
|
7253
|
+
if (inPath(m.index))
|
|
7254
|
+
continue;
|
|
7255
|
+
if (isExampleSlug(m[0]))
|
|
7256
|
+
continue;
|
|
7257
|
+
found.push({ index: m.index, match: m[0], kind: "plan-id" });
|
|
7258
|
+
}
|
|
7259
|
+
found.sort((a, b) => a.index - b.index);
|
|
7260
|
+
for (const f of found) {
|
|
7261
|
+
citations.push({ line: i + 1, match: f.match.replace(TRAILING_SENTENCE_PUNCT_RE, ""), kind: f.kind });
|
|
7262
|
+
}
|
|
7263
|
+
}
|
|
7264
|
+
return citations;
|
|
7265
|
+
}
|
|
7221
7266
|
var TEST_FILE_PATH_RE = /[\w./-]+\.(?:test|spec)\.[a-z0-9]+/i;
|
|
7222
7267
|
var TEST_FILE_PHRASE_RE = /\btest file(?:s|\(s\))?\s*:[ \t]*(.+)/i;
|
|
7223
7268
|
var COMMAND_PROMPT_RE = /^\s*[$>]\s*\S/;
|
|
@@ -13646,6 +13691,8 @@ var AUDIT_EFFORTS2 = ["XS", "S", "M", "L", "XL"];
|
|
|
13646
13691
|
var AUDIT_RISKS2 = ["LOW", "MED", "HIGH"];
|
|
13647
13692
|
var AUDIT_CONFIDENCES2 = ["HIGH", "MED", "LOW"];
|
|
13648
13693
|
var WALK_SKIP_DIRS2 = new Set(["node_modules", ".git", "dist"]);
|
|
13694
|
+
var DATED_SLUG_TOKEN_SOURCE2 = "\\b20\\d{6}-[a-z0-9][a-z0-9-]*\\b(?!\\.\\d)";
|
|
13695
|
+
var DATED_SLUG_TOKEN_RE2 = new RegExp(DATED_SLUG_TOKEN_SOURCE2, "g");
|
|
13649
13696
|
var PR_REVIEW_TIER_BUDGETS2 = Object.freeze({
|
|
13650
13697
|
quick: Object.freeze({ wallClockMinutes: 5, maxSeats: 1, perSeatFindingsCap: 5, evidenceTokensCap: 600, fileOpenCap: 12 }),
|
|
13651
13698
|
default: Object.freeze({ wallClockMinutes: 10, maxSeats: 2, perSeatFindingsCap: 6, evidenceTokensCap: 900, fileOpenCap: 20 }),
|
|
@@ -19366,6 +19413,10 @@ var LINT_CODE_EXTENSIONS = {
|
|
|
19366
19413
|
".kt": true,
|
|
19367
19414
|
".swift": true
|
|
19368
19415
|
};
|
|
19416
|
+
var PROVENANCE_LINT_EXTENSIONS = {
|
|
19417
|
+
".md": true,
|
|
19418
|
+
".ts": true
|
|
19419
|
+
};
|
|
19369
19420
|
function lintTargetType(filePath) {
|
|
19370
19421
|
const base = path15.basename(filePath);
|
|
19371
19422
|
if (base === "STRATEGY.md")
|
|
@@ -19383,7 +19434,7 @@ function lintTargetType(filePath) {
|
|
|
19383
19434
|
return "code";
|
|
19384
19435
|
return null;
|
|
19385
19436
|
}
|
|
19386
|
-
function collectLintTargets(dir) {
|
|
19437
|
+
function collectLintTargets(dir, accept = (file) => lintTargetType(file) !== null) {
|
|
19387
19438
|
const targets = [];
|
|
19388
19439
|
const visit = (current) => {
|
|
19389
19440
|
for (const entry of fs12.readdirSync(current, { withFileTypes: true })) {
|
|
@@ -19393,7 +19444,7 @@ function collectLintTargets(dir) {
|
|
|
19393
19444
|
if (entry.isDirectory()) {
|
|
19394
19445
|
if (LINT_SKIP_DIRS[entry.name] !== true)
|
|
19395
19446
|
visit(child + path15.sep);
|
|
19396
|
-
} else if (entry.isFile() &&
|
|
19447
|
+
} else if (entry.isFile() && accept(child)) {
|
|
19397
19448
|
targets.push(child);
|
|
19398
19449
|
}
|
|
19399
19450
|
}
|
|
@@ -19438,20 +19489,32 @@ async function lintOneFile(filePath, forcedType, prVariant) {
|
|
|
19438
19489
|
case "finding":
|
|
19439
19490
|
violations.push(...validateFindingDoc(text, { ...prVariant ? { prVariant: true } : {} }).violations);
|
|
19440
19491
|
break;
|
|
19492
|
+
case "provenance": {
|
|
19493
|
+
for (const citation of findProvenanceCitations(text)) {
|
|
19494
|
+
violations.push({
|
|
19495
|
+
ok: false,
|
|
19496
|
+
severity: "medium",
|
|
19497
|
+
code: `lint.provenance.${citation.kind}`,
|
|
19498
|
+
message: `provenance ${citation.kind} citation at line ${citation.line}: "${citation.match}" \u2014 tracked content must not disclose local plan/iteration ids or dated harness deep paths`,
|
|
19499
|
+
fix: `rewrite "${citation.match}" as a placeholder form (e.g. task-N-report, <plan-id>) or a synthetic example slug (any -example- segment)`
|
|
19500
|
+
});
|
|
19501
|
+
}
|
|
19502
|
+
break;
|
|
19503
|
+
}
|
|
19441
19504
|
default:
|
|
19442
19505
|
throw new SddScriptError(`usage: lint <target> \u2014 unsupported file type "${path15.basename(filePath)}" (lintable: plan files, SKILL.md, STRATEGY.md, task-N-report.md, code files)`, 2);
|
|
19443
19506
|
}
|
|
19444
19507
|
return { violations, markers };
|
|
19445
19508
|
}
|
|
19446
19509
|
var lintCommand = program2.command("lint").description("lint harness artifacts by content type (engine-backed): plan files \u2192 quality bar, SKILL.md \u2192 frontmatter, " + "STRATEGY.md \u2192 required sections, task-N-report.md \u2192 SDD TDD triple, code files \u2192 simplify:/temporary markers");
|
|
19447
|
-
lintCommand.description("Lint <target> (file or dir) \u2014 exit 1 on violations, 2 on usage. --type forces one content type " + "(plan | skill | strategy | report | code | finding); finding docs are explicit-only").argument("[target]", "File or directory to lint").option("--type <type>", "Force the content type (plan | skill | strategy | report | code | finding)").option("--pr-variant", "With --type finding: enforce the PR-only Merge class contract (presence, enum, placement after Confidence)").action(async (target, options) => {
|
|
19510
|
+
lintCommand.description("Lint <target> (file or dir) \u2014 exit 1 on violations, 2 on usage. --type forces one content type " + "(plan | skill | strategy | report | code | finding | provenance); finding docs are explicit-only, " + "and --type provenance is a content-agnostic citation scan applied to every collected target " + "(forced-provenance dir walks collect the .md/.ts text face)").argument("[target]", "File or directory to lint").option("--type <type>", "Force the content type (plan | skill | strategy | report | code | finding | provenance); " + "provenance dir walks collect the .md/.ts text face").option("--pr-variant", "With --type finding: enforce the PR-only Merge class contract (presence, enum, placement after Confidence)").action(async (target, options) => {
|
|
19448
19511
|
try {
|
|
19449
19512
|
if (!target)
|
|
19450
19513
|
throw new SddScriptError("usage: lint <target> (file or dir)", 2);
|
|
19451
19514
|
let forcedType = null;
|
|
19452
19515
|
if (options.type !== undefined) {
|
|
19453
19516
|
const forced = options.type.trim().toLowerCase();
|
|
19454
|
-
const KNOWN = ["plan", "skill", "strategy", "report", "code", "finding"];
|
|
19517
|
+
const KNOWN = ["plan", "skill", "strategy", "report", "code", "finding", "provenance"];
|
|
19455
19518
|
if (!KNOWN.includes(forced)) {
|
|
19456
19519
|
throw new SddScriptError(`usage: lint --type must be one of ${KNOWN.join(" | ")}, got ${JSON.stringify(options.type)}`, 2);
|
|
19457
19520
|
}
|
|
@@ -19460,7 +19523,8 @@ lintCommand.description("Lint <target> (file or dir) \u2014 exit 1 on violations
|
|
|
19460
19523
|
const abs = resolveCliPath(target);
|
|
19461
19524
|
if (!fs12.existsSync(abs))
|
|
19462
19525
|
throw new Error(`lint target not found: ${abs}`);
|
|
19463
|
-
const
|
|
19526
|
+
const isDir = fs12.statSync(abs).isDirectory();
|
|
19527
|
+
const targets = !isDir ? [abs] : forcedType === "provenance" ? collectLintTargets(abs, (file) => PROVENANCE_LINT_EXTENSIONS[path15.extname(file).toLowerCase()] === true) : collectLintTargets(abs);
|
|
19464
19528
|
if (targets.length === 0) {
|
|
19465
19529
|
console.log(import_picocolors3.default.yellow(`lint: no lintable files under ${target}`));
|
|
19466
19530
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mstar-harness/cli",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.3",
|
|
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": {
|