@moda-ai/cli 1.55.52 → 1.55.54
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/{agent-nxn5df1w.js → agent-rmmtap23.js} +4 -4
- package/dist/{cli-zgmxsmbt.js → cli-4vc2cksg.js} +2 -2
- package/dist/{cli-wqyrcnm1.js → cli-6hdqp65a.js} +48 -0
- package/dist/{cli-xx73daeb.js → cli-7ye5004e.js} +336 -61
- package/dist/{cli-arze1hgb.js → cli-c1vmgdjb.js} +4 -4
- package/dist/cli.js +7 -7
- package/dist/{doctor-66qe8hq9.js → doctor-b34em2fm.js} +2 -2
- package/dist/{harness-github-actions-p3g8cjf2.js → harness-github-actions-rayyxh1w.js} +2 -2
- package/dist/{harness-t2xjak6g.js → harness-jcqwf5h6.js} +2 -2
- package/dist/{harness-report-d64517j4.js → harness-report-rjcjbh93.js} +1 -1
- package/dist/{index-tt5rmqyq.js → index-cqnp8pfv.js} +4 -4
- package/dist/{prompt-attribution-ey193cg9.js → prompt-attribution-gyx0g661.js} +2 -2
- package/dist/prompt-source-mcp.js +2 -2
- package/dist/{prompts-z2v4k4q7.js → prompts-s4y90zs7.js} +1 -1
- package/dist/{sync-tzvrgzqs.js → sync-qxf3gkhy.js} +3 -3
- package/package.json +1 -1
- package/skills/integration/index.json +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildDoctorReport
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-4vc2cksg.js";
|
|
4
4
|
import"./cli-rdh9jjr2.js";
|
|
5
|
-
import"./cli-
|
|
5
|
+
import"./cli-c1vmgdjb.js";
|
|
6
6
|
import"./cli-mm48br00.js";
|
|
7
7
|
import {
|
|
8
8
|
readHarnessSyncState
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
hashStableJson,
|
|
27
27
|
readHarnessReport,
|
|
28
28
|
validateHarnessReport
|
|
29
|
-
} from "./cli-
|
|
29
|
+
} from "./cli-6hdqp65a.js";
|
|
30
30
|
import {
|
|
31
31
|
CliInputError
|
|
32
32
|
} from "./cli-k4tqwah4.js";
|
|
@@ -95,7 +95,7 @@ async function buildAgentContext(context) {
|
|
|
95
95
|
const graph = readHarnessGraphIfPresent(context.cwd);
|
|
96
96
|
const reportState = readHarnessReportState(context.cwd);
|
|
97
97
|
const syncState = readHarnessSyncState(context.cwd);
|
|
98
|
-
const harness = graph ? await import("./harness-
|
|
98
|
+
const harness = graph ? await import("./harness-jcqwf5h6.js") : undefined;
|
|
99
99
|
const topFindings = doctor.checks.filter((check) => check.status === "fail" || check.status === "warning").slice(0, 12).map(checkToFinding);
|
|
100
100
|
const evidenceRefs = [
|
|
101
101
|
...doctor.checks.map(checkToEvidenceRef),
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./cli-rdh9jjr2.js";
|
|
5
5
|
import {
|
|
6
6
|
inspectPromptManifest
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-c1vmgdjb.js";
|
|
8
8
|
import {
|
|
9
9
|
readHarnessSyncState,
|
|
10
10
|
renderDoctorHuman,
|
|
@@ -395,7 +395,7 @@ async function harnessCurrentCheck(cwd, manifestPath, manifestExists, tenantId)
|
|
|
395
395
|
};
|
|
396
396
|
}
|
|
397
397
|
try {
|
|
398
|
-
const { scanHarness } = await import("./harness-
|
|
398
|
+
const { scanHarness } = await import("./harness-jcqwf5h6.js");
|
|
399
399
|
const current = scanHarness({
|
|
400
400
|
rootDir: cwd,
|
|
401
401
|
scannerVersion: "doctor",
|
|
@@ -882,6 +882,28 @@ function hasEvidenceLine(evidence) {
|
|
|
882
882
|
line: typeof entry.line === "number" ? entry.line : undefined
|
|
883
883
|
}) !== undefined);
|
|
884
884
|
}
|
|
885
|
+
var RUNTIME_AGENT_LINK_FIELDS = [
|
|
886
|
+
"entrypointIds",
|
|
887
|
+
"channelAdapterIds",
|
|
888
|
+
"artifactIds",
|
|
889
|
+
"identityNamespaceIds",
|
|
890
|
+
"deploymentIds",
|
|
891
|
+
"frameworkIds",
|
|
892
|
+
"modelProviderIds",
|
|
893
|
+
"evidence"
|
|
894
|
+
];
|
|
895
|
+
var HARNESS_ARTIFACT_TYPES = new Set([
|
|
896
|
+
"entrypoint",
|
|
897
|
+
"prompt",
|
|
898
|
+
"tool",
|
|
899
|
+
"skill",
|
|
900
|
+
"eval",
|
|
901
|
+
"retrieval_index",
|
|
902
|
+
"memory",
|
|
903
|
+
"guardrail",
|
|
904
|
+
"model_config",
|
|
905
|
+
"unknown"
|
|
906
|
+
]);
|
|
885
907
|
function normalizeGraphItemFieldAliases(collection, item) {
|
|
886
908
|
if (!isRecord(item))
|
|
887
909
|
return;
|
|
@@ -890,6 +912,32 @@ function normalizeGraphItemFieldAliases(collection, item) {
|
|
|
890
912
|
if (typeof item.sourcePath !== "string")
|
|
891
913
|
item.sourcePath = firstEvidencePath(item) ?? ".";
|
|
892
914
|
}
|
|
915
|
+
if (collection === "runtimeAgents") {
|
|
916
|
+
if (typeof item.kind !== "string")
|
|
917
|
+
item.kind = "runtime_agent";
|
|
918
|
+
if (typeof item.root !== "string" || item.root.length === 0)
|
|
919
|
+
item.root = ".";
|
|
920
|
+
for (const key of RUNTIME_AGENT_LINK_FIELDS) {
|
|
921
|
+
if (!Array.isArray(item[key]))
|
|
922
|
+
item[key] = [];
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
if (collection === "artifacts") {
|
|
926
|
+
if (typeof item.type !== "string" || item.type.length === 0) {
|
|
927
|
+
item.type = typeof item.kind === "string" && HARNESS_ARTIFACT_TYPES.has(item.kind) ? item.kind : "unknown";
|
|
928
|
+
}
|
|
929
|
+
if (typeof item.sourcePath !== "string" && typeof item.path === "string" && item.path.length > 0) {
|
|
930
|
+
item.sourcePath = item.path;
|
|
931
|
+
}
|
|
932
|
+
if (typeof item.name !== "string" || item.name.length === 0) {
|
|
933
|
+
item.name = firstEvidencePath(item) ?? (typeof item.id === "string" ? item.id : "unnamed");
|
|
934
|
+
}
|
|
935
|
+
if (typeof item.scope !== "string" || item.scope.length === 0) {
|
|
936
|
+
item.scope = typeof item.ownedByAgentId === "string" ? "agent" : "shared";
|
|
937
|
+
}
|
|
938
|
+
if (!Array.isArray(item.usedByAgentIds))
|
|
939
|
+
item.usedByAgentIds = [];
|
|
940
|
+
}
|
|
893
941
|
if (collection === "channelAdapters" && typeof item.kind !== "string")
|
|
894
942
|
item.kind = "unknown";
|
|
895
943
|
if (collection === "identityNamespaces" && typeof item.kind !== "string")
|
|
@@ -90,7 +90,7 @@ import {
|
|
|
90
90
|
stampRemoteSnapshotTruncation,
|
|
91
91
|
validateHarnessReport,
|
|
92
92
|
writeHarnessReportArtifacts
|
|
93
|
-
} from "./cli-
|
|
93
|
+
} from "./cli-6hdqp65a.js";
|
|
94
94
|
import {
|
|
95
95
|
CliInputError,
|
|
96
96
|
CliInputRequiredError
|
|
@@ -107,15 +107,15 @@ import { homedir, tmpdir as tmpdir2 } from "node:os";
|
|
|
107
107
|
import { fileURLToPath } from "node:url";
|
|
108
108
|
import {
|
|
109
109
|
existsSync as existsSync8,
|
|
110
|
-
lstatSync as
|
|
110
|
+
lstatSync as lstatSync8,
|
|
111
111
|
mkdtempSync as mkdtempSync2,
|
|
112
112
|
mkdirSync as mkdirSync5,
|
|
113
|
-
readFileSync as
|
|
114
|
-
readdirSync as
|
|
113
|
+
readFileSync as readFileSync13,
|
|
114
|
+
readdirSync as readdirSync5,
|
|
115
115
|
writeFileSync as writeFileSync5,
|
|
116
116
|
rmSync as rmSync4
|
|
117
117
|
} from "node:fs";
|
|
118
|
-
import { basename as basename6, delimiter, dirname as dirname7, join as
|
|
118
|
+
import { basename as basename6, delimiter, dirname as dirname7, join as join10, relative as relative7, resolve as resolve10, sep as sep5 } from "node:path";
|
|
119
119
|
import { confirm, select } from "@inquirer/prompts";
|
|
120
120
|
|
|
121
121
|
// src/analyst-tui.ts
|
|
@@ -12320,6 +12320,7 @@ var LINE_PATTERNS = [
|
|
|
12320
12320
|
];
|
|
12321
12321
|
var CODE_EXTENSIONS = new Set([...JS, ...PY]);
|
|
12322
12322
|
var PROMPT_DOC_EXTENSIONS = new Set([".md", ".mdc", ".txt", ".prompt", ".jinja", ".jinja2", ".j2", ".hbs", ".tpl"]);
|
|
12323
|
+
var UPPERCASE_DOC_NAME = /^[A-Z0-9][A-Z0-9_-]*\.(?:md|mdc|txt)$/;
|
|
12323
12324
|
var NON_PROMPT_DOC_BASENAMES = new Set([
|
|
12324
12325
|
"readme.md",
|
|
12325
12326
|
"agents.md",
|
|
@@ -12536,7 +12537,7 @@ function detectPromptFile(file, out) {
|
|
|
12536
12537
|
} else if (PROMPTS_DIR.test(dir)) {
|
|
12537
12538
|
confidence2 = "high";
|
|
12538
12539
|
signal = "prompt_file.prompts_dir";
|
|
12539
|
-
} else if (dirHint && score >= 3) {
|
|
12540
|
+
} else if (dirHint && score >= 3 && !UPPERCASE_DOC_NAME.test(basename5(file.path))) {
|
|
12540
12541
|
confidence2 = "medium";
|
|
12541
12542
|
signal = "prompt_file.agent_dir_instruction_text";
|
|
12542
12543
|
} else if (score >= 5) {
|
|
@@ -13632,6 +13633,36 @@ function promoteToolCandidate(candidate, rootDir, confidence2, fileCache) {
|
|
|
13632
13633
|
body: extractToolBody({ path: candidate.path, rootDir }, { name, reason: candidate.signal })
|
|
13633
13634
|
};
|
|
13634
13635
|
}
|
|
13636
|
+
var UTILITY_EXPORT = /^(?:classify|measure|log|count|parse|validate|detect|is|has|should|estimate|truncate|strip|normalize|hash)(?:[A-Z_]|$)/;
|
|
13637
|
+
var BUILDER_VERB = /^(?:build|render|compose|assemble|generate)(?:[A-Z_]|$)/;
|
|
13638
|
+
var PROMPT_NOUN_LAST = /(?:prompt|instructions?|section|block|template|system)(?:_?for[_A-Z]\w*)?$/i;
|
|
13639
|
+
function exportedNames(path, lines) {
|
|
13640
|
+
const python = path.endsWith(".py");
|
|
13641
|
+
return lines.flatMap((line) => {
|
|
13642
|
+
if (python) {
|
|
13643
|
+
const match = /^(?:async\s+)?(?:def|class)\s+([A-Za-z]\w*)|^([A-Za-z]\w*)\s*(?::[^=]+)?=(?!=)/.exec(line);
|
|
13644
|
+
return match ? [match[1] ?? match[2]] : [];
|
|
13645
|
+
}
|
|
13646
|
+
const declared = /^\s*export\s+(?:default\s+)?(?:async\s+)?(?:function\*?|const|let|var|class)\s+([A-Za-z_$][\w$]*)/.exec(line);
|
|
13647
|
+
if (declared)
|
|
13648
|
+
return [declared[1]];
|
|
13649
|
+
const commonJs = /^\s*(?:module\.)?exports\.([A-Za-z_$][\w$]*)\s*=/.exec(line);
|
|
13650
|
+
if (commonJs)
|
|
13651
|
+
return [commonJs[1]];
|
|
13652
|
+
const list = /^\s*(?:export|module\.exports\s*=)\s*\{([^}]*)\}/.exec(line);
|
|
13653
|
+
if (!list)
|
|
13654
|
+
return [];
|
|
13655
|
+
return list[1].split(",").flatMap((entry) => {
|
|
13656
|
+
const name = entry.trim().replace(/^type\s+/, "").split(/\s+as\s+|\s*:\s*/).pop()?.trim();
|
|
13657
|
+
return name && /^[A-Za-z_$][\w$]*$/.test(name) ? [name] : [];
|
|
13658
|
+
});
|
|
13659
|
+
});
|
|
13660
|
+
}
|
|
13661
|
+
function buildsPrompts(path, lines) {
|
|
13662
|
+
if (!lines)
|
|
13663
|
+
return false;
|
|
13664
|
+
return exportedNames(path, lines).some((name) => !UTILITY_EXPORT.test(name) && (BUILDER_VERB.test(name) || PROMPT_NOUN_LAST.test(name)));
|
|
13665
|
+
}
|
|
13635
13666
|
function promotePromptFileCandidate(candidate, confidence2) {
|
|
13636
13667
|
return {
|
|
13637
13668
|
id: stableId("prompt", candidate.path),
|
|
@@ -14469,7 +14500,7 @@ function promoteHarnessCandidates(report, rootDir) {
|
|
|
14469
14500
|
artifact = promoteToolCandidate(candidate, rootDir, confidence2, fileCache);
|
|
14470
14501
|
break;
|
|
14471
14502
|
case "prompt_file":
|
|
14472
|
-
if (candidate.signal === "prompt_module.name_hint")
|
|
14503
|
+
if (candidate.signal === "prompt_module.name_hint" && (TEST_PATH2.test(candidate.path) || !buildsPrompts(candidate.path, readFileLines(rootDir, candidate.path, fileCache))))
|
|
14473
14504
|
break;
|
|
14474
14505
|
artifact = promotePromptFileCandidate(candidate, confidence2);
|
|
14475
14506
|
break;
|
|
@@ -14497,6 +14528,245 @@ function promoteHarnessCandidates(report, rootDir) {
|
|
|
14497
14528
|
return [...byId.values()];
|
|
14498
14529
|
}
|
|
14499
14530
|
|
|
14531
|
+
// src/harness-wrangler-bindings.ts
|
|
14532
|
+
import { lstatSync as lstatSync7, readdirSync as readdirSync4, readFileSync as readFileSync12 } from "node:fs";
|
|
14533
|
+
import { join as join9, relative as relative6 } from "node:path";
|
|
14534
|
+
var WRANGLER_FILE = /^wrangler\.jsonc?$/;
|
|
14535
|
+
var SKIPPED_DIRS2 = new Set(["node_modules", ".git", ".wrangler", "dist", "build", ".next", ".turbo", "vendor"]);
|
|
14536
|
+
var MAX_DEPTH = 4;
|
|
14537
|
+
var AGENT_CLASS = /Agent(?:V\d+)?$/;
|
|
14538
|
+
function stripJsonc2(text) {
|
|
14539
|
+
let out = "";
|
|
14540
|
+
let inString = false;
|
|
14541
|
+
for (let i = 0;i < text.length; i += 1) {
|
|
14542
|
+
const ch = text[i];
|
|
14543
|
+
if (inString) {
|
|
14544
|
+
out += ch;
|
|
14545
|
+
if (ch === "\\") {
|
|
14546
|
+
out += text[i + 1] ?? "";
|
|
14547
|
+
i += 1;
|
|
14548
|
+
} else if (ch === '"') {
|
|
14549
|
+
inString = false;
|
|
14550
|
+
}
|
|
14551
|
+
continue;
|
|
14552
|
+
}
|
|
14553
|
+
if (ch === '"') {
|
|
14554
|
+
inString = true;
|
|
14555
|
+
out += ch;
|
|
14556
|
+
} else if (ch === "/" && text[i + 1] === "/") {
|
|
14557
|
+
while (i < text.length && text[i] !== `
|
|
14558
|
+
`)
|
|
14559
|
+
i += 1;
|
|
14560
|
+
out += `
|
|
14561
|
+
`;
|
|
14562
|
+
} else if (ch === "/" && text[i + 1] === "*") {
|
|
14563
|
+
i += 2;
|
|
14564
|
+
while (i < text.length && !(text[i] === "*" && text[i + 1] === "/")) {
|
|
14565
|
+
if (text[i] === `
|
|
14566
|
+
`)
|
|
14567
|
+
out += `
|
|
14568
|
+
`;
|
|
14569
|
+
i += 1;
|
|
14570
|
+
}
|
|
14571
|
+
i += 1;
|
|
14572
|
+
} else {
|
|
14573
|
+
out += ch;
|
|
14574
|
+
}
|
|
14575
|
+
}
|
|
14576
|
+
return out.replace(/,(\s*[}\]])/g, "$1");
|
|
14577
|
+
}
|
|
14578
|
+
function findWranglerFiles(rootDir) {
|
|
14579
|
+
const found = [];
|
|
14580
|
+
const walk = (dir, depth) => {
|
|
14581
|
+
let entries;
|
|
14582
|
+
try {
|
|
14583
|
+
entries = readdirSync4(dir);
|
|
14584
|
+
} catch {
|
|
14585
|
+
return;
|
|
14586
|
+
}
|
|
14587
|
+
for (const name of entries) {
|
|
14588
|
+
const abs = join9(dir, name);
|
|
14589
|
+
let stat;
|
|
14590
|
+
try {
|
|
14591
|
+
stat = lstatSync7(abs);
|
|
14592
|
+
} catch {
|
|
14593
|
+
continue;
|
|
14594
|
+
}
|
|
14595
|
+
if (stat.isDirectory()) {
|
|
14596
|
+
if (depth < MAX_DEPTH && !SKIPPED_DIRS2.has(name) && !name.startsWith("."))
|
|
14597
|
+
walk(abs, depth + 1);
|
|
14598
|
+
} else if (stat.isFile() && WRANGLER_FILE.test(name)) {
|
|
14599
|
+
found.push(abs);
|
|
14600
|
+
}
|
|
14601
|
+
}
|
|
14602
|
+
};
|
|
14603
|
+
walk(rootDir, 0);
|
|
14604
|
+
return found.sort();
|
|
14605
|
+
}
|
|
14606
|
+
function lineOf(text, className) {
|
|
14607
|
+
const index = text.search(new RegExp(`"class_name"\\s*:\\s*"${className.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}"`));
|
|
14608
|
+
return index < 0 ? undefined : text.slice(0, index).split(`
|
|
14609
|
+
`).length;
|
|
14610
|
+
}
|
|
14611
|
+
function workerDir(path) {
|
|
14612
|
+
const slash = path.lastIndexOf("/");
|
|
14613
|
+
return slash < 0 ? "" : path.slice(0, slash);
|
|
14614
|
+
}
|
|
14615
|
+
function detectBoundRuntimeClasses(rootDir) {
|
|
14616
|
+
const byClass = new Map;
|
|
14617
|
+
for (const abs of findWranglerFiles(rootDir)) {
|
|
14618
|
+
let text;
|
|
14619
|
+
let config2;
|
|
14620
|
+
try {
|
|
14621
|
+
text = readFileSync12(abs, "utf8");
|
|
14622
|
+
config2 = JSON.parse(stripJsonc2(text));
|
|
14623
|
+
} catch {
|
|
14624
|
+
continue;
|
|
14625
|
+
}
|
|
14626
|
+
if (!config2 || typeof config2 !== "object")
|
|
14627
|
+
continue;
|
|
14628
|
+
const path = relative6(rootDir, abs).split("\\").join("/");
|
|
14629
|
+
const root = config2;
|
|
14630
|
+
const sections2 = [root, ...Object.values(root.env ?? {})];
|
|
14631
|
+
for (const section of sections2) {
|
|
14632
|
+
if (!section || typeof section !== "object")
|
|
14633
|
+
continue;
|
|
14634
|
+
const s = section;
|
|
14635
|
+
const durable = s.durable_objects?.bindings;
|
|
14636
|
+
const entries = [
|
|
14637
|
+
...Array.isArray(durable) ? durable.map((b) => ["durable_object", b]) : [],
|
|
14638
|
+
...Array.isArray(s.workflows) ? s.workflows.map((w) => ["workflow", w]) : []
|
|
14639
|
+
];
|
|
14640
|
+
for (const [kind, raw] of entries) {
|
|
14641
|
+
if (!raw || typeof raw !== "object")
|
|
14642
|
+
continue;
|
|
14643
|
+
const entry = raw;
|
|
14644
|
+
const className = typeof entry.class_name === "string" ? entry.class_name : "";
|
|
14645
|
+
const scriptName = typeof entry.script_name === "string" && entry.script_name ? entry.script_name : undefined;
|
|
14646
|
+
const key = `${className}|${scriptName ? "external" : `config:${path}`}`;
|
|
14647
|
+
if (!className || byClass.has(key))
|
|
14648
|
+
continue;
|
|
14649
|
+
const binding = typeof (kind === "workflow" ? entry.binding : entry.name) === "string" ? String(kind === "workflow" ? entry.binding : entry.name) : className;
|
|
14650
|
+
byClass.set(key, {
|
|
14651
|
+
className,
|
|
14652
|
+
kind,
|
|
14653
|
+
binding,
|
|
14654
|
+
...scriptName ? { scriptName } : {},
|
|
14655
|
+
path,
|
|
14656
|
+
line: lineOf(text, className)
|
|
14657
|
+
});
|
|
14658
|
+
}
|
|
14659
|
+
}
|
|
14660
|
+
}
|
|
14661
|
+
return [...byClass.values()];
|
|
14662
|
+
}
|
|
14663
|
+
function norm(value) {
|
|
14664
|
+
return typeof value === "string" ? value.toLowerCase().replace(/[^a-z0-9]/g, "") : "";
|
|
14665
|
+
}
|
|
14666
|
+
function itemPaths(item) {
|
|
14667
|
+
const paths = [];
|
|
14668
|
+
for (const value of [item.root, item.sourcePath]) {
|
|
14669
|
+
if (typeof value === "string" && value && value !== ".")
|
|
14670
|
+
paths.push(value.replace(/^\.\//, ""));
|
|
14671
|
+
}
|
|
14672
|
+
for (const entry of Array.isArray(item.evidence) ? item.evidence : []) {
|
|
14673
|
+
const path = entry && typeof entry === "object" ? entry.path : undefined;
|
|
14674
|
+
if (typeof path === "string" && path)
|
|
14675
|
+
paths.push(path.replace(/^\.\//, ""));
|
|
14676
|
+
}
|
|
14677
|
+
return paths;
|
|
14678
|
+
}
|
|
14679
|
+
function withinWorker(path, dir, otherDirs) {
|
|
14680
|
+
const inside = (d) => d === "" || path === d || path.startsWith(`${d}/`);
|
|
14681
|
+
return inside(dir) && !otherDirs.some((other) => other.length > dir.length && inside(other));
|
|
14682
|
+
}
|
|
14683
|
+
function graphNamesClass(graph, bound, all) {
|
|
14684
|
+
const target = norm(bound.className);
|
|
14685
|
+
const named = (name) => {
|
|
14686
|
+
if (typeof name !== "string")
|
|
14687
|
+
return false;
|
|
14688
|
+
const bare = name.replace(/\s*\([^)]*\)\s*$/, "");
|
|
14689
|
+
return norm(bare) === target || bare.split(/[^A-Za-z0-9_]+/).some((word) => norm(word) === target);
|
|
14690
|
+
};
|
|
14691
|
+
const sameName = bound.scriptName ? [bound] : all.filter((other) => other.className === bound.className && !other.scriptName);
|
|
14692
|
+
const dir = workerDir(bound.path);
|
|
14693
|
+
const otherDirs = sameName.map((other) => workerDir(other.path)).filter((other) => other !== dir);
|
|
14694
|
+
const covers = (item) => {
|
|
14695
|
+
if (!named(item.name))
|
|
14696
|
+
return false;
|
|
14697
|
+
if (sameName.length < 2)
|
|
14698
|
+
return true;
|
|
14699
|
+
return itemPaths(item).some((path) => withinWorker(path, dir, otherDirs));
|
|
14700
|
+
};
|
|
14701
|
+
return graph.runtimeAgents.some(covers) || graph.artifacts.some(covers);
|
|
14702
|
+
}
|
|
14703
|
+
function bindingReason(bound) {
|
|
14704
|
+
const what = bound.kind === "workflow" ? "Workflow" : "Durable Object";
|
|
14705
|
+
const where = bound.scriptName ? ` served by the external Worker "${bound.scriptName}"` : "";
|
|
14706
|
+
return `${what} binding ${bound.binding} -> class ${bound.className}${where}`;
|
|
14707
|
+
}
|
|
14708
|
+
function uniqueId(base, taken) {
|
|
14709
|
+
let id = base;
|
|
14710
|
+
for (let n = 2;taken.has(id); n += 1)
|
|
14711
|
+
id = `${base}-${n}`;
|
|
14712
|
+
taken.add(id);
|
|
14713
|
+
return id;
|
|
14714
|
+
}
|
|
14715
|
+
function mergeBoundRuntimeClasses(graph, rootDir) {
|
|
14716
|
+
if (process.env.MODA_HARNESS_DETERMINISTIC_MERGE === "0")
|
|
14717
|
+
return { added: 0 };
|
|
14718
|
+
let bound;
|
|
14719
|
+
try {
|
|
14720
|
+
bound = detectBoundRuntimeClasses(rootDir);
|
|
14721
|
+
} catch {
|
|
14722
|
+
return { added: 0 };
|
|
14723
|
+
}
|
|
14724
|
+
const taken = new Set([
|
|
14725
|
+
...graph.runtimeAgents.map((agent) => agent.id),
|
|
14726
|
+
...graph.artifacts.map((artifact) => artifact.id)
|
|
14727
|
+
]);
|
|
14728
|
+
let added = 0;
|
|
14729
|
+
for (const entry of bound) {
|
|
14730
|
+
if (graphNamesClass(graph, entry, bound))
|
|
14731
|
+
continue;
|
|
14732
|
+
const evidence = [{ path: entry.path, ...entry.line ? { line: entry.line } : {}, reason: bindingReason(entry) }];
|
|
14733
|
+
const slug = entry.className.replace(/[^A-Za-z0-9]+/g, "-").toLowerCase();
|
|
14734
|
+
if (entry.kind === "durable_object" && AGENT_CLASS.test(entry.className) && !entry.scriptName) {
|
|
14735
|
+
const agent = {
|
|
14736
|
+
id: uniqueId(`agent.bound.${slug}`, taken),
|
|
14737
|
+
name: entry.className,
|
|
14738
|
+
kind: "runtime_agent",
|
|
14739
|
+
purpose: "Agent class bound as a Durable Object.",
|
|
14740
|
+
root: ".",
|
|
14741
|
+
entrypointIds: [],
|
|
14742
|
+
channelAdapterIds: [],
|
|
14743
|
+
artifactIds: [],
|
|
14744
|
+
identityNamespaceIds: [],
|
|
14745
|
+
deploymentIds: [],
|
|
14746
|
+
frameworkIds: [],
|
|
14747
|
+
modelProviderIds: [],
|
|
14748
|
+
confidence: 0.6,
|
|
14749
|
+
evidence
|
|
14750
|
+
};
|
|
14751
|
+
graph.runtimeAgents.push(agent);
|
|
14752
|
+
} else {
|
|
14753
|
+
const artifact = {
|
|
14754
|
+
id: uniqueId(`entrypoint.bound.${slug}`, taken),
|
|
14755
|
+
type: "entrypoint",
|
|
14756
|
+
name: entry.className,
|
|
14757
|
+
scope: "shared",
|
|
14758
|
+
sourcePath: entry.path,
|
|
14759
|
+
usedByAgentIds: [],
|
|
14760
|
+
confidence: 0.6,
|
|
14761
|
+
evidence
|
|
14762
|
+
};
|
|
14763
|
+
graph.artifacts.push(artifact);
|
|
14764
|
+
}
|
|
14765
|
+
added += 1;
|
|
14766
|
+
}
|
|
14767
|
+
return { added };
|
|
14768
|
+
}
|
|
14769
|
+
|
|
14500
14770
|
// src/harness-sync-limits.ts
|
|
14501
14771
|
var MAX_HARNESS_SYNC_GRAPH_BYTES = 2000000;
|
|
14502
14772
|
function assertHarnessGraphSyncSize(graph) {
|
|
@@ -14515,8 +14785,8 @@ function assertHarnessGraphSyncSize(graph) {
|
|
|
14515
14785
|
}
|
|
14516
14786
|
// src/harness.ts
|
|
14517
14787
|
var MODA_DIR = ".moda";
|
|
14518
|
-
var HARNESS_PATH =
|
|
14519
|
-
var HARNESS_SUMMARY_PATH =
|
|
14788
|
+
var HARNESS_PATH = join10(MODA_DIR, "harness.json");
|
|
14789
|
+
var HARNESS_SUMMARY_PATH = join10(MODA_DIR, "HARNESS.md");
|
|
14520
14790
|
var SCHEMA_VERSION = "harness.v0.1";
|
|
14521
14791
|
var REPORT_JSON_BEGIN = "MODA_HARNESS_REPORT_JSON_BEGIN";
|
|
14522
14792
|
var REPORT_JSON_END = "MODA_HARNESS_REPORT_JSON_END";
|
|
@@ -14682,7 +14952,7 @@ async function runHarnessCommand(context) {
|
|
|
14682
14952
|
report: {
|
|
14683
14953
|
reportId: report.reportId,
|
|
14684
14954
|
reportHash,
|
|
14685
|
-
path: normalizePath2(
|
|
14955
|
+
path: normalizePath2(relative7(rootDir, reportPath)) || ".moda/harness-report.json"
|
|
14686
14956
|
},
|
|
14687
14957
|
validation,
|
|
14688
14958
|
approval: {
|
|
@@ -14828,7 +15098,7 @@ async function runHarnessCommand(context) {
|
|
|
14828
15098
|
throw new CliInputError("Focused remote prompt analysis is not supported yet.", "Use local --analyst=claude|codex|cursor|local-scan, or drop --concern for a full remote report.");
|
|
14829
15099
|
}
|
|
14830
15100
|
if (context.flags["github-actions"] === "true") {
|
|
14831
|
-
const { runGithubActionsAnalyze } = await import("./harness-github-actions-
|
|
15101
|
+
const { runGithubActionsAnalyze } = await import("./harness-github-actions-rayyxh1w.js");
|
|
14832
15102
|
const result = await runGithubActionsAnalyze(rootDir, {
|
|
14833
15103
|
writeReport: (report2) => {
|
|
14834
15104
|
const normalized = normalizeHarnessReport(report2);
|
|
@@ -14950,7 +15220,7 @@ async function runHarnessCommand(context) {
|
|
|
14950
15220
|
report: {
|
|
14951
15221
|
reportId: approval.report.reportId,
|
|
14952
15222
|
reportHash: hashHarnessReport(approval.report),
|
|
14953
|
-
path: normalizePath2(
|
|
15223
|
+
path: normalizePath2(relative7(rootDir, reportPath)) || ".moda/harness-report.json"
|
|
14954
15224
|
},
|
|
14955
15225
|
validation: approval.validation,
|
|
14956
15226
|
approval: approval.approval
|
|
@@ -15040,7 +15310,7 @@ async function runHarnessCommand(context) {
|
|
|
15040
15310
|
return { exitCode: 0 };
|
|
15041
15311
|
}
|
|
15042
15312
|
case "status": {
|
|
15043
|
-
const manifestPath =
|
|
15313
|
+
const manifestPath = join10(rootDir, HARNESS_PATH);
|
|
15044
15314
|
const graph = existsSync8(manifestPath) ? readHarnessGraph(manifestPath) : scanHarness({
|
|
15045
15315
|
rootDir,
|
|
15046
15316
|
tenantId: tenant?.tenantId,
|
|
@@ -15181,10 +15451,10 @@ function emitWrittenArtifacts(context, written, description) {
|
|
|
15181
15451
|
}
|
|
15182
15452
|
}
|
|
15183
15453
|
async function runPromptConcernAnalysis(context, rootDir, scanPlan, tenant) {
|
|
15184
|
-
const manifest =
|
|
15454
|
+
const manifest = join10(rootDir, ".moda/prompts.yml");
|
|
15185
15455
|
let existing = [];
|
|
15186
15456
|
if (existsSync8(manifest)) {
|
|
15187
|
-
const document = $parseDocument(
|
|
15457
|
+
const document = $parseDocument(readFileSync13(manifest, "utf8"));
|
|
15188
15458
|
if (document.errors.length)
|
|
15189
15459
|
throw new CliInputError("Invalid prompt manifest.", document.errors[0].message);
|
|
15190
15460
|
existing = document.toJS({ maxAliasCount: 20 })?.sources ?? [];
|
|
@@ -15438,7 +15708,7 @@ function readExternalAnalystReport(rootDir, result, adapter, concern) {
|
|
|
15438
15708
|
result.stderr
|
|
15439
15709
|
].join(`
|
|
15440
15710
|
`));
|
|
15441
|
-
debugHint = `Raw analyst output saved to ${
|
|
15711
|
+
debugHint = `Raw analyst output saved to ${join10(MODA_DIR, "analyst-debug.log")} for debugging.`;
|
|
15442
15712
|
} catch {}
|
|
15443
15713
|
throw new CliInputError(`Harness analyst ${adapter} did not return a harness report.`, [
|
|
15444
15714
|
`Expected ${HARNESS_REPORT_PATH} or final JSON between ${REPORT_JSON_BEGIN} and ${REPORT_JSON_END}.`,
|
|
@@ -15547,6 +15817,8 @@ function repairExternalAnalystReport(report, rootDir, options = {}) {
|
|
|
15547
15817
|
const normalized = normalizeHarnessReport(report);
|
|
15548
15818
|
repairCitationLines(normalized, rootDir);
|
|
15549
15819
|
mergeDeterministicArtifacts(normalized.graph, rootDir, { concern: options.concern });
|
|
15820
|
+
if (!options.concern || options.concern === "topology")
|
|
15821
|
+
mergeBoundRuntimeClasses(normalized.graph, rootDir);
|
|
15550
15822
|
hydratePromptAndToolBodies(normalized.graph, rootDir);
|
|
15551
15823
|
const unverified = new Set;
|
|
15552
15824
|
for (const artifact of normalized.graph.artifacts) {
|
|
@@ -15793,7 +16065,8 @@ function artifactSourceKey(artifact) {
|
|
|
15793
16065
|
}
|
|
15794
16066
|
function graphCoversPromotedArtifact(graph, promoted) {
|
|
15795
16067
|
const promotedName = promoted.name.toLowerCase();
|
|
15796
|
-
const
|
|
16068
|
+
const isDefinitionLine = (entry) => typeof entry.line === "number" && !/^(?:passed to a model call|prompt-named literal referenced)/.test(entry.reason ?? "");
|
|
16069
|
+
const promotedLines = promoted.evidence.filter(isDefinitionLine);
|
|
15797
16070
|
const promotedSource = artifactSourceKey(promoted);
|
|
15798
16071
|
const isWholeFilePrompt = promoted.type === "prompt" && Boolean(promoted.sourcePath);
|
|
15799
16072
|
return graph.artifacts.some((existing) => {
|
|
@@ -15801,10 +16074,12 @@ function graphCoversPromotedArtifact(graph, promoted) {
|
|
|
15801
16074
|
return true;
|
|
15802
16075
|
if (existing.type === promoted.type && existing.name?.toLowerCase() === promotedName) {
|
|
15803
16076
|
const existingSource = artifactSourceKey(existing);
|
|
15804
|
-
|
|
16077
|
+
const existingLines = Array.isArray(existing.evidence) ? existing.evidence.filter(isDefinitionLine) : [];
|
|
16078
|
+
const distinctInline = !existing.sourcePath && !promoted.sourcePath && existingLines.length > 0 && promotedLines.length > 0;
|
|
16079
|
+
if (!existingSource || !promotedSource || existingSource === promotedSource && !distinctInline)
|
|
15805
16080
|
return true;
|
|
15806
16081
|
}
|
|
15807
|
-
if (existing.type === promoted.type && Array.isArray(existing.evidence) && existing.evidence.some((entry) =>
|
|
16082
|
+
if (existing.type === promoted.type && Array.isArray(existing.evidence) && existing.evidence.some((entry) => isDefinitionLine(entry) && promotedLines.some((line) => line.path === entry.path && line.line === entry.line))) {
|
|
15808
16083
|
return true;
|
|
15809
16084
|
}
|
|
15810
16085
|
if (isWholeFilePrompt && existing.sourcePath === promoted.sourcePath)
|
|
@@ -15840,7 +16115,7 @@ function repairCitationLines(report, rootDir) {
|
|
|
15840
16115
|
continue;
|
|
15841
16116
|
let text;
|
|
15842
16117
|
try {
|
|
15843
|
-
text =
|
|
16118
|
+
text = readFileSync13(candidatePath, "utf8");
|
|
15844
16119
|
} catch {
|
|
15845
16120
|
continue;
|
|
15846
16121
|
}
|
|
@@ -16446,14 +16721,14 @@ function createPromptAnalystIsolation(adapter, rootDir) {
|
|
|
16446
16721
|
const serverPath = bundledServer ? bundled : source;
|
|
16447
16722
|
const command = bundledServer ? process.execPath : resolveBunRuntime();
|
|
16448
16723
|
const serverArgs = [serverPath, "--root", rootDir];
|
|
16449
|
-
const tempPath = mkdtempSync2(
|
|
16724
|
+
const tempPath = mkdtempSync2(join10(tmpdir2(), "moda-prompt-analyst-"));
|
|
16450
16725
|
const cleanup = () => {
|
|
16451
16726
|
try {
|
|
16452
16727
|
rmSync4(tempPath, { recursive: true, force: true });
|
|
16453
16728
|
} catch {}
|
|
16454
16729
|
};
|
|
16455
16730
|
if (adapter === "claude") {
|
|
16456
|
-
const configPath =
|
|
16731
|
+
const configPath = join10(tempPath, "claude-mcp.json");
|
|
16457
16732
|
writeFileSync5(configPath, JSON.stringify({ mcpServers: { "moda-prompt-source": { command, args: serverArgs } } }));
|
|
16458
16733
|
return { configPath, cleanup };
|
|
16459
16734
|
}
|
|
@@ -16869,10 +17144,10 @@ function readDirectoryPreflightPaths(rootDir) {
|
|
|
16869
17144
|
const stack = ["."];
|
|
16870
17145
|
while (stack.length > 0 && paths.length < 2000) {
|
|
16871
17146
|
const current = stack.pop() ?? ".";
|
|
16872
|
-
const absolute = current === "." ? rootDir :
|
|
17147
|
+
const absolute = current === "." ? rootDir : join10(rootDir, current);
|
|
16873
17148
|
let entries;
|
|
16874
17149
|
try {
|
|
16875
|
-
entries =
|
|
17150
|
+
entries = readdirSync5(absolute);
|
|
16876
17151
|
} catch {
|
|
16877
17152
|
continue;
|
|
16878
17153
|
}
|
|
@@ -16880,10 +17155,10 @@ function readDirectoryPreflightPaths(rootDir) {
|
|
|
16880
17155
|
const child = current === "." ? entry : `${current}/${entry}`;
|
|
16881
17156
|
if (shouldSkipPreflightPath(child))
|
|
16882
17157
|
continue;
|
|
16883
|
-
const childAbsolute =
|
|
17158
|
+
const childAbsolute = join10(rootDir, child);
|
|
16884
17159
|
let stat;
|
|
16885
17160
|
try {
|
|
16886
|
-
stat =
|
|
17161
|
+
stat = lstatSync8(childAbsolute);
|
|
16887
17162
|
} catch {
|
|
16888
17163
|
continue;
|
|
16889
17164
|
}
|
|
@@ -16945,7 +17220,7 @@ function findOnPath(command) {
|
|
|
16945
17220
|
if (command.includes("/") && existsSync8(command))
|
|
16946
17221
|
return command;
|
|
16947
17222
|
for (const dir of (process.env.PATH ?? "").split(delimiter).filter(Boolean)) {
|
|
16948
|
-
const candidate =
|
|
17223
|
+
const candidate = join10(dir, command);
|
|
16949
17224
|
if (existsSync8(candidate))
|
|
16950
17225
|
return candidate;
|
|
16951
17226
|
}
|
|
@@ -17023,10 +17298,10 @@ function collectSnapshotInputs(rootDir, maxFiles, maxTextBytes) {
|
|
|
17023
17298
|
let inventoryFileCount = 0;
|
|
17024
17299
|
let inventoryTextBytes = 0;
|
|
17025
17300
|
function walk(current) {
|
|
17026
|
-
const path = normalizePath2(
|
|
17301
|
+
const path = normalizePath2(relative7(rootDir, current)) || ".";
|
|
17027
17302
|
let stat;
|
|
17028
17303
|
try {
|
|
17029
|
-
stat =
|
|
17304
|
+
stat = lstatSync8(current);
|
|
17030
17305
|
} catch {
|
|
17031
17306
|
return;
|
|
17032
17307
|
}
|
|
@@ -17037,8 +17312,8 @@ function collectSnapshotInputs(rootDir, maxFiles, maxTextBytes) {
|
|
|
17037
17312
|
if (stat.isDirectory()) {
|
|
17038
17313
|
if (path !== "." && (isSkippedDir(path) || isSkippedPathPrefix(path)))
|
|
17039
17314
|
return;
|
|
17040
|
-
for (const entry of
|
|
17041
|
-
walk(
|
|
17315
|
+
for (const entry of readdirSync5(current).sort())
|
|
17316
|
+
walk(join10(current, entry));
|
|
17042
17317
|
return;
|
|
17043
17318
|
}
|
|
17044
17319
|
if (!stat.isFile())
|
|
@@ -17061,7 +17336,7 @@ function collectSnapshotInputs(rootDir, maxFiles, maxTextBytes) {
|
|
|
17061
17336
|
let text = "";
|
|
17062
17337
|
if (isTextFile(path)) {
|
|
17063
17338
|
try {
|
|
17064
|
-
text =
|
|
17339
|
+
text = readFileSync13(current, "utf8");
|
|
17065
17340
|
inventoryTextBytes += Buffer.byteLength(text, "utf8");
|
|
17066
17341
|
} catch {
|
|
17067
17342
|
return;
|
|
@@ -17080,7 +17355,7 @@ function buildSourceSnapshot(rootDir) {
|
|
|
17080
17355
|
const inputs = collectSnapshotInputs(root, maxFiles, maxTextBytes);
|
|
17081
17356
|
const repo = detectRepo(root, inputs.map((input) => ({
|
|
17082
17357
|
path: input.path,
|
|
17083
|
-
absPath:
|
|
17358
|
+
absPath: join10(root, input.path),
|
|
17084
17359
|
rootDir: root,
|
|
17085
17360
|
text: input.text
|
|
17086
17361
|
})));
|
|
@@ -17094,7 +17369,7 @@ function buildSourceSnapshot(rootDir) {
|
|
|
17094
17369
|
}
|
|
17095
17370
|
function buildCommandScanPlan(context, rootDir) {
|
|
17096
17371
|
const explicitPath = context.flags.path !== undefined;
|
|
17097
|
-
const rel2 = normalizePath2(
|
|
17372
|
+
const rel2 = normalizePath2(relative7(context.cwd, rootDir)) || ".";
|
|
17098
17373
|
const scope = explicitPath && rel2 !== "." ? "narrow" : "broad";
|
|
17099
17374
|
const machineReadable = context.outputMode !== "human";
|
|
17100
17375
|
const approvalRequired = context.positional === "analyze" && scope === "broad" && !context.yes;
|
|
@@ -17179,7 +17454,7 @@ function writeHumanBlock(context, message) {
|
|
|
17179
17454
|
function buildHarnessReadPlan(rootDir, pathWasExplicit) {
|
|
17180
17455
|
return {
|
|
17181
17456
|
scope: pathWasExplicit ? "narrow" : "broad",
|
|
17182
|
-
rootPaths: [normalizePath2(
|
|
17457
|
+
rootPaths: [normalizePath2(relative7(rootDir, rootDir)) || "."],
|
|
17183
17458
|
willRead: [
|
|
17184
17459
|
"package manifests",
|
|
17185
17460
|
"source files under the selected path",
|
|
@@ -17297,7 +17572,7 @@ async function syncHarnessWithRemote(context, body) {
|
|
|
17297
17572
|
}, profileOptions);
|
|
17298
17573
|
}
|
|
17299
17574
|
function writeHarnessSyncState(rootDir, state) {
|
|
17300
|
-
const path =
|
|
17575
|
+
const path = join10(rootDir, SYNC_STATE_PATH);
|
|
17301
17576
|
mkdirSync5(dirname7(path), { recursive: true });
|
|
17302
17577
|
writeFileSync5(path, `${JSON.stringify(state, null, 2)}
|
|
17303
17578
|
`);
|
|
@@ -17311,7 +17586,7 @@ function selectedRuntimeAgentId(flags) {
|
|
|
17311
17586
|
return;
|
|
17312
17587
|
}
|
|
17313
17588
|
function loadOrScanHarness(rootDir, tenant, context) {
|
|
17314
|
-
const manifestPath =
|
|
17589
|
+
const manifestPath = join10(rootDir, HARNESS_PATH);
|
|
17315
17590
|
if (existsSync8(manifestPath))
|
|
17316
17591
|
return readHarnessGraph(manifestPath);
|
|
17317
17592
|
if (context) {
|
|
@@ -17368,7 +17643,7 @@ var FRESHER_REPORT_MAX_DIRS = 4000;
|
|
|
17368
17643
|
function findFresherHarnessReports(rootDir) {
|
|
17369
17644
|
let rootMtimeMs = 0;
|
|
17370
17645
|
try {
|
|
17371
|
-
rootMtimeMs =
|
|
17646
|
+
rootMtimeMs = lstatSync8(join10(rootDir, HARNESS_REPORT_PATH)).mtimeMs;
|
|
17372
17647
|
} catch {
|
|
17373
17648
|
rootMtimeMs = 0;
|
|
17374
17649
|
}
|
|
@@ -17380,19 +17655,19 @@ function findFresherHarnessReports(rootDir) {
|
|
|
17380
17655
|
visited += 1;
|
|
17381
17656
|
let entries;
|
|
17382
17657
|
try {
|
|
17383
|
-
entries =
|
|
17658
|
+
entries = readdirSync5(dir, { withFileTypes: true });
|
|
17384
17659
|
} catch {
|
|
17385
17660
|
return;
|
|
17386
17661
|
}
|
|
17387
17662
|
for (const entry of entries) {
|
|
17388
17663
|
if (!entry.isDirectory() || entry.name.startsWith(".") || SKIPPED_DIRS.has(entry.name))
|
|
17389
17664
|
continue;
|
|
17390
|
-
const child =
|
|
17665
|
+
const child = join10(dir, entry.name);
|
|
17391
17666
|
try {
|
|
17392
|
-
const candidate =
|
|
17667
|
+
const candidate = lstatSync8(join10(child, HARNESS_REPORT_PATH));
|
|
17393
17668
|
if (candidate.isFile() && candidate.mtimeMs > rootMtimeMs) {
|
|
17394
17669
|
fresher.push({
|
|
17395
|
-
path: normalizePath2(
|
|
17670
|
+
path: normalizePath2(relative7(rootDir, join10(child, HARNESS_REPORT_PATH))),
|
|
17396
17671
|
mtimeMs: candidate.mtimeMs
|
|
17397
17672
|
});
|
|
17398
17673
|
}
|
|
@@ -17404,7 +17679,7 @@ function findFresherHarnessReports(rootDir) {
|
|
|
17404
17679
|
return fresher.sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
17405
17680
|
}
|
|
17406
17681
|
function warnFresherSubdirHarnessReports(context, rootDir, explicitReport) {
|
|
17407
|
-
const explicitReportPath = explicitReport && explicitReport !== "true" ? normalizePath2(
|
|
17682
|
+
const explicitReportPath = explicitReport && explicitReport !== "true" ? normalizePath2(relative7(rootDir, resolve10(rootDir, explicitReport))) : undefined;
|
|
17408
17683
|
if (explicitReportPath && explicitReportPath !== normalizePath2(HARNESS_REPORT_PATH))
|
|
17409
17684
|
return;
|
|
17410
17685
|
let fresher;
|
|
@@ -17417,16 +17692,16 @@ function warnFresherSubdirHarnessReports(context, rootDir, explicitReport) {
|
|
|
17417
17692
|
return;
|
|
17418
17693
|
const newest = fresher[0];
|
|
17419
17694
|
const subdir = normalizePath2(dirname7(dirname7(newest.path)));
|
|
17420
|
-
const rootState = existsSync8(
|
|
17695
|
+
const rootState = existsSync8(join10(rootDir, HARNESS_REPORT_PATH)) ? `older ${HARNESS_REPORT_PATH}` : `no ${HARNESS_REPORT_PATH}`;
|
|
17421
17696
|
writeHarnessNotice(context, `A fresher harness report exists at ${newest.path} (this directory has ${rootState}). If you meant that report, re-run with --path=${subdir}.`);
|
|
17422
17697
|
}
|
|
17423
17698
|
function readHarnessGraph(manifestPath) {
|
|
17424
|
-
return JSON.parse(
|
|
17699
|
+
return JSON.parse(readFileSync13(manifestPath, "utf8"));
|
|
17425
17700
|
}
|
|
17426
17701
|
function writeHarnessArtifacts(graph, rootDir, options = {}) {
|
|
17427
|
-
const modaDir =
|
|
17702
|
+
const modaDir = join10(rootDir, MODA_DIR);
|
|
17428
17703
|
mkdirSync5(modaDir, { recursive: true });
|
|
17429
|
-
const manifestPath =
|
|
17704
|
+
const manifestPath = join10(rootDir, HARNESS_PATH);
|
|
17430
17705
|
writeFileSync5(manifestPath, `${JSON.stringify(graph, null, 2)}
|
|
17431
17706
|
`);
|
|
17432
17707
|
const written = [HARNESS_PATH];
|
|
@@ -17436,7 +17711,7 @@ function writeHarnessArtifacts(graph, rootDir, options = {}) {
|
|
|
17436
17711
|
return written;
|
|
17437
17712
|
}
|
|
17438
17713
|
function writeHarnessSummary(graph, rootDir) {
|
|
17439
|
-
const summaryPath =
|
|
17714
|
+
const summaryPath = join10(rootDir, HARNESS_SUMMARY_PATH);
|
|
17440
17715
|
mkdirSync5(dirname7(summaryPath), { recursive: true });
|
|
17441
17716
|
writeFileSync5(summaryPath, renderHarnessMarkdown(graph));
|
|
17442
17717
|
return HARNESS_SUMMARY_PATH;
|
|
@@ -17611,10 +17886,10 @@ function inventoryFiles(rootDir, skipped, options = {}) {
|
|
|
17611
17886
|
const maxTextBytes = numericEnv("MODA_HARNESS_MAX_TEXT_BYTES", DEFAULT_MAX_INVENTORY_TEXT_BYTES);
|
|
17612
17887
|
let textBytes = 0;
|
|
17613
17888
|
function walk(current) {
|
|
17614
|
-
const rel2 = normalizePath2(
|
|
17889
|
+
const rel2 = normalizePath2(relative7(rootReal, current)) || ".";
|
|
17615
17890
|
let stat;
|
|
17616
17891
|
try {
|
|
17617
|
-
stat =
|
|
17892
|
+
stat = lstatSync8(current);
|
|
17618
17893
|
} catch {
|
|
17619
17894
|
recordSkipped(skipped, { path: rel2, reason: "stat failed" });
|
|
17620
17895
|
return;
|
|
@@ -17628,8 +17903,8 @@ function inventoryFiles(rootDir, skipped, options = {}) {
|
|
|
17628
17903
|
recordSkipped(skipped, { path: rel2, reason: "ignored directory" });
|
|
17629
17904
|
return;
|
|
17630
17905
|
}
|
|
17631
|
-
for (const entry of
|
|
17632
|
-
walk(
|
|
17906
|
+
for (const entry of readdirSync5(current).sort()) {
|
|
17907
|
+
walk(join10(current, entry));
|
|
17633
17908
|
}
|
|
17634
17909
|
return;
|
|
17635
17910
|
}
|
|
@@ -17660,7 +17935,7 @@ function inventoryFiles(rootDir, skipped, options = {}) {
|
|
|
17660
17935
|
recordSkipped(skipped, { path: rel2, reason: "scan text budget exceeded" });
|
|
17661
17936
|
} else {
|
|
17662
17937
|
try {
|
|
17663
|
-
item.text =
|
|
17938
|
+
item.text = readFileSync13(current, "utf8");
|
|
17664
17939
|
textBytes += Buffer.byteLength(item.text, "utf8");
|
|
17665
17940
|
} catch {
|
|
17666
17941
|
recordSkipped(skipped, { path: rel2, reason: "text read failed" });
|
|
@@ -17967,7 +18242,7 @@ function maybeAddPromptArtifact(graph, file) {
|
|
|
17967
18242
|
if (!isPrompt)
|
|
17968
18243
|
return;
|
|
17969
18244
|
const id = stableId("prompt", file.path);
|
|
17970
|
-
const text = file.text ??
|
|
18245
|
+
const text = file.text ?? readFileSync13(file.absPath, "utf8");
|
|
17971
18246
|
upsertArtifact(graph, {
|
|
17972
18247
|
id,
|
|
17973
18248
|
type: "prompt",
|
|
@@ -18545,10 +18820,10 @@ function computeDeterministicFloor(rootDir) {
|
|
|
18545
18820
|
}
|
|
18546
18821
|
function detectProviderPackagesInManifests(rootDir) {
|
|
18547
18822
|
const present = new Set;
|
|
18548
|
-
const packageJsonPath =
|
|
18823
|
+
const packageJsonPath = join10(rootDir, "package.json");
|
|
18549
18824
|
if (existsSync8(packageJsonPath)) {
|
|
18550
18825
|
try {
|
|
18551
|
-
const deps = packageDependencyNames(
|
|
18826
|
+
const deps = packageDependencyNames(readFileSync13(packageJsonPath, "utf8"));
|
|
18552
18827
|
for (const provider of PROVIDER_CATALOG) {
|
|
18553
18828
|
for (const name of provider.packageNames) {
|
|
18554
18829
|
if (deps.has(name))
|
|
@@ -18557,10 +18832,10 @@ function detectProviderPackagesInManifests(rootDir) {
|
|
|
18557
18832
|
}
|
|
18558
18833
|
} catch {}
|
|
18559
18834
|
}
|
|
18560
|
-
const pyprojectPath =
|
|
18835
|
+
const pyprojectPath = join10(rootDir, "pyproject.toml");
|
|
18561
18836
|
if (existsSync8(pyprojectPath)) {
|
|
18562
18837
|
try {
|
|
18563
|
-
const deps = pyprojectDependencyNames(
|
|
18838
|
+
const deps = pyprojectDependencyNames(readFileSync13(pyprojectPath, "utf8"));
|
|
18564
18839
|
for (const provider of PROVIDER_CATALOG) {
|
|
18565
18840
|
for (const name of provider.packageNames) {
|
|
18566
18841
|
if (deps.has(name.toLowerCase()))
|
|
@@ -18962,12 +19237,12 @@ function contentHashForAnnotatedSource(sourcePath, annotation) {
|
|
|
18962
19237
|
function readSmallTextFileForHash(absPath, rootDir) {
|
|
18963
19238
|
if (!existsSync8(absPath))
|
|
18964
19239
|
return;
|
|
18965
|
-
const rel2 = normalizePath2(
|
|
19240
|
+
const rel2 = normalizePath2(relative7(rootDir, absPath));
|
|
18966
19241
|
if (isSecretishPath(rel2))
|
|
18967
19242
|
return;
|
|
18968
19243
|
let stat;
|
|
18969
19244
|
try {
|
|
18970
|
-
stat =
|
|
19245
|
+
stat = lstatSync8(absPath);
|
|
18971
19246
|
} catch {
|
|
18972
19247
|
return;
|
|
18973
19248
|
}
|
|
@@ -18977,7 +19252,7 @@ function readSmallTextFileForHash(absPath, rootDir) {
|
|
|
18977
19252
|
if (!isTextFile(rel2))
|
|
18978
19253
|
return;
|
|
18979
19254
|
try {
|
|
18980
|
-
return
|
|
19255
|
+
return readFileSync13(absPath, "utf8");
|
|
18981
19256
|
} catch {
|
|
18982
19257
|
return;
|
|
18983
19258
|
}
|
|
@@ -5768,7 +5768,7 @@ async function runPromptSyncExclusive(flags, profileOptions, options) {
|
|
|
5768
5768
|
const analyzedDefinitions = new Map;
|
|
5769
5769
|
if (flags["no-analyze"] !== "true") {
|
|
5770
5770
|
options.onProgress?.("Analyzing prompt sources before sync.");
|
|
5771
|
-
const { analyzeHarnessPrompts } = await import("./harness-
|
|
5771
|
+
const { analyzeHarnessPrompts } = await import("./harness-jcqwf5h6.js");
|
|
5772
5772
|
const result = await analyzeHarnessPrompts({
|
|
5773
5773
|
rootDir: process.cwd(),
|
|
5774
5774
|
existing: established.flatMap((prompt) => prompt.sourceDefinition ? [prompt.sourceDefinition.source] : []),
|
|
@@ -5796,7 +5796,7 @@ async function runPromptSyncExclusive(flags, profileOptions, options) {
|
|
|
5796
5796
|
const mergedSources = mergePromptSources(manifest.sources, extraSources);
|
|
5797
5797
|
const manifestUpdate = stableJson(mergedSources) === stableJson(mergePromptSources(manifest.sources, [])) ? undefined : $stringify({ version: 2, prompt_paths: manifest.promptPaths, sources: mergedSources });
|
|
5798
5798
|
const prompts = await discoverPrompts(extraSources);
|
|
5799
|
-
const { checkPromptAttribution } = await import("./prompt-attribution-
|
|
5799
|
+
const { checkPromptAttribution } = await import("./prompt-attribution-gyx0g661.js");
|
|
5800
5800
|
const attribution = checkPromptAttribution(process.cwd(), prompts.map((prompt) => prompt.key));
|
|
5801
5801
|
const brokenAttribution = attribution.references.filter((reference) => reference.status === "missing");
|
|
5802
5802
|
if (brokenAttribution.length) {
|
|
@@ -6102,7 +6102,7 @@ async function migratePromptManifest(options = {}) {
|
|
|
6102
6102
|
let addedSources = [];
|
|
6103
6103
|
let pendingSources = [];
|
|
6104
6104
|
if (options.discover) {
|
|
6105
|
-
const { analyzeHarnessPrompts } = await import("./harness-
|
|
6105
|
+
const { analyzeHarnessPrompts } = await import("./harness-jcqwf5h6.js");
|
|
6106
6106
|
const result = await analyzeHarnessPrompts({
|
|
6107
6107
|
rootDir: root,
|
|
6108
6108
|
existing: manifest.sources,
|
|
@@ -6303,7 +6303,7 @@ async function readHarnessSources(reportPath) {
|
|
|
6303
6303
|
if (!graph) {
|
|
6304
6304
|
throw new CliInputError(`${selected} is not a harness report with a graph (schema: ${schemaLabel}). Regenerate it with \`${HARNESS_REANALYZE_COMMAND}\`.`);
|
|
6305
6305
|
}
|
|
6306
|
-
const { normalizeHarnessReport } = await import("./harness-report-
|
|
6306
|
+
const { normalizeHarnessReport } = await import("./harness-report-rjcjbh93.js");
|
|
6307
6307
|
const { backfillPromptSource, resolvePromptSource } = await loadPromptSources();
|
|
6308
6308
|
const report = normalizeHarnessReport(raw);
|
|
6309
6309
|
const artifacts = (report.graph.artifacts ?? []).filter((artifact) => artifact.type === "prompt");
|
package/dist/cli.js
CHANGED
|
@@ -2968,25 +2968,25 @@ function leafManifestFields(leaf, commands) {
|
|
|
2968
2968
|
import { fileURLToPath } from "url";
|
|
2969
2969
|
import { realpathSync } from "fs";
|
|
2970
2970
|
async function runPromptsCommand(...args) {
|
|
2971
|
-
return (await import("./prompts-
|
|
2971
|
+
return (await import("./prompts-s4y90zs7.js")).runPromptsCommand(...args);
|
|
2972
2972
|
}
|
|
2973
2973
|
async function runSkillsCommand(...args) {
|
|
2974
2974
|
return (await import("./skills-mwftqzyk.js")).runSkillsCommand(...args);
|
|
2975
2975
|
}
|
|
2976
2976
|
async function runHarnessCommand(...args) {
|
|
2977
|
-
return (await import("./harness-
|
|
2977
|
+
return (await import("./harness-jcqwf5h6.js")).runHarnessCommand(...args);
|
|
2978
2978
|
}
|
|
2979
2979
|
async function runSyncCommand(...args) {
|
|
2980
|
-
return (await import("./sync-
|
|
2980
|
+
return (await import("./sync-qxf3gkhy.js")).runSyncCommand(...args);
|
|
2981
2981
|
}
|
|
2982
2982
|
async function runRegistryCommand(...args) {
|
|
2983
2983
|
return (await import("./registry-tv8fktxc.js")).runRegistryCommand(...args);
|
|
2984
2984
|
}
|
|
2985
2985
|
async function runDoctorCommand(...args) {
|
|
2986
|
-
return (await import("./doctor-
|
|
2986
|
+
return (await import("./doctor-b34em2fm.js")).runDoctorCommand(...args);
|
|
2987
2987
|
}
|
|
2988
2988
|
async function runStatusCommand(...args) {
|
|
2989
|
-
return (await import("./doctor-
|
|
2989
|
+
return (await import("./doctor-b34em2fm.js")).runStatusCommand(...args);
|
|
2990
2990
|
}
|
|
2991
2991
|
async function runAuthCommand(...args) {
|
|
2992
2992
|
return (await import("./profile-commands-nbaec4y9.js")).runAuthCommand(...args);
|
|
@@ -2998,7 +2998,7 @@ async function runProfilesCommand(...args) {
|
|
|
2998
2998
|
return (await import("./profile-commands-nbaec4y9.js")).runProfilesCommand(...args);
|
|
2999
2999
|
}
|
|
3000
3000
|
async function runAgentCommand(...args) {
|
|
3001
|
-
return (await import("./agent-
|
|
3001
|
+
return (await import("./agent-rmmtap23.js")).runAgentCommand(...args);
|
|
3002
3002
|
}
|
|
3003
3003
|
async function runProductionCommand(...args) {
|
|
3004
3004
|
return (await import("./production-intelligence-zek0rkzj.js")).runProductionCommand(...args);
|
|
@@ -6762,7 +6762,7 @@ var commandRegistry = createCommandRegistry([
|
|
|
6762
6762
|
resetApiRequestCountBeforeRun: true,
|
|
6763
6763
|
telemetry: "result-and-error",
|
|
6764
6764
|
handler: async (context) => {
|
|
6765
|
-
const { runInit } = await import("./index-
|
|
6765
|
+
const { runInit } = await import("./index-cqnp8pfv.js");
|
|
6766
6766
|
if (context.outputMode === "agent-stream") {
|
|
6767
6767
|
context.output.writeEvent({
|
|
6768
6768
|
event: "started",
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
promptsDiscoveredCheck,
|
|
4
4
|
runDoctorCommand,
|
|
5
5
|
runStatusCommand
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-4vc2cksg.js";
|
|
7
7
|
import"./cli-rdh9jjr2.js";
|
|
8
|
-
import"./cli-
|
|
8
|
+
import"./cli-c1vmgdjb.js";
|
|
9
9
|
import"./cli-mm48br00.js";
|
|
10
10
|
import"./cli-xq45etg1.js";
|
|
11
11
|
import"./cli-gtke9wrw.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildSourceSnapshot
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-7ye5004e.js";
|
|
4
4
|
import"./cli-97fnztpy.js";
|
|
5
5
|
import"./cli-xq45etg1.js";
|
|
6
6
|
import"./cli-gtke9wrw.js";
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
import"./cli-vswckv9g.js";
|
|
14
14
|
import"./cli-9kfxkxmk.js";
|
|
15
15
|
import"./cli-c1k20j6e.js";
|
|
16
|
-
import"./cli-
|
|
16
|
+
import"./cli-6hdqp65a.js";
|
|
17
17
|
import"./cli-k4tqwah4.js";
|
|
18
18
|
import"./cli-0v6na3yp.js";
|
|
19
19
|
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
writeHarnessAnalyzeResult,
|
|
44
44
|
writeHarnessArtifacts,
|
|
45
45
|
writeHumanProgress
|
|
46
|
-
} from "./cli-
|
|
46
|
+
} from "./cli-7ye5004e.js";
|
|
47
47
|
import"./cli-97fnztpy.js";
|
|
48
48
|
import"./cli-xq45etg1.js";
|
|
49
49
|
import"./cli-gtke9wrw.js";
|
|
@@ -56,7 +56,7 @@ import"./cli-9kfxkxmk.js";
|
|
|
56
56
|
import"./cli-c1k20j6e.js";
|
|
57
57
|
import {
|
|
58
58
|
HARNESS_ANALYZE_CONCERNS
|
|
59
|
-
} from "./cli-
|
|
59
|
+
} from "./cli-6hdqp65a.js";
|
|
60
60
|
import"./cli-k4tqwah4.js";
|
|
61
61
|
import"./cli-0v6na3yp.js";
|
|
62
62
|
export {
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
} from "./cli-hcwdz9sd.js";
|
|
22
22
|
import {
|
|
23
23
|
buildDoctorReport
|
|
24
|
-
} from "./cli-
|
|
24
|
+
} from "./cli-4vc2cksg.js";
|
|
25
25
|
import {
|
|
26
26
|
ConnectCodeError,
|
|
27
27
|
connectWithCode,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
import {
|
|
33
33
|
initPrompts,
|
|
34
34
|
runPromptSync
|
|
35
|
-
} from "./cli-
|
|
35
|
+
} from "./cli-c1vmgdjb.js";
|
|
36
36
|
import"./cli-mm48br00.js";
|
|
37
37
|
import {
|
|
38
38
|
codingAgentDisplayName,
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
runCodingAgent,
|
|
47
47
|
runHarnessCommand,
|
|
48
48
|
startRemoteAnalyze
|
|
49
|
-
} from "./cli-
|
|
49
|
+
} from "./cli-7ye5004e.js";
|
|
50
50
|
import {
|
|
51
51
|
stripAnsi
|
|
52
52
|
} from "./cli-97fnztpy.js";
|
|
@@ -74,7 +74,7 @@ import {
|
|
|
74
74
|
import"./cli-vswckv9g.js";
|
|
75
75
|
import"./cli-9kfxkxmk.js";
|
|
76
76
|
import"./cli-c1k20j6e.js";
|
|
77
|
-
import"./cli-
|
|
77
|
+
import"./cli-6hdqp65a.js";
|
|
78
78
|
import {
|
|
79
79
|
CliAuthError,
|
|
80
80
|
CliInputError
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
inventoryFiles,
|
|
3
3
|
safePromptEvidencePath
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-7ye5004e.js";
|
|
5
5
|
import"./cli-97fnztpy.js";
|
|
6
6
|
import"./cli-xq45etg1.js";
|
|
7
7
|
import"./cli-gtke9wrw.js";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./cli-vswckv9g.js";
|
|
15
15
|
import"./cli-9kfxkxmk.js";
|
|
16
16
|
import"./cli-c1k20j6e.js";
|
|
17
|
-
import"./cli-
|
|
17
|
+
import"./cli-6hdqp65a.js";
|
|
18
18
|
import"./cli-k4tqwah4.js";
|
|
19
19
|
import {
|
|
20
20
|
__toESM
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
checkPromptMapping,
|
|
4
4
|
discoverHarnessPromptSources,
|
|
5
5
|
safePromptEvidencePath
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-7ye5004e.js";
|
|
7
7
|
import"./cli-97fnztpy.js";
|
|
8
8
|
import"./cli-xq45etg1.js";
|
|
9
9
|
import"./cli-gtke9wrw.js";
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "./cli-vswckv9g.js";
|
|
18
18
|
import"./cli-9kfxkxmk.js";
|
|
19
19
|
import"./cli-c1k20j6e.js";
|
|
20
|
-
import"./cli-
|
|
20
|
+
import"./cli-6hdqp65a.js";
|
|
21
21
|
import"./cli-k4tqwah4.js";
|
|
22
22
|
import {
|
|
23
23
|
__commonJS,
|
|
@@ -6,11 +6,11 @@ import"./cli-rjav0vj1.js";
|
|
|
6
6
|
import"./cli-hcwdz9sd.js";
|
|
7
7
|
import {
|
|
8
8
|
runPromptsCommand
|
|
9
|
-
} from "./cli-
|
|
9
|
+
} from "./cli-c1vmgdjb.js";
|
|
10
10
|
import"./cli-mm48br00.js";
|
|
11
11
|
import {
|
|
12
12
|
runHarnessCommand
|
|
13
|
-
} from "./cli-
|
|
13
|
+
} from "./cli-7ye5004e.js";
|
|
14
14
|
import"./cli-97fnztpy.js";
|
|
15
15
|
import"./cli-xq45etg1.js";
|
|
16
16
|
import"./cli-gtke9wrw.js";
|
|
@@ -21,7 +21,7 @@ import"./cli-40fqk078.js";
|
|
|
21
21
|
import"./cli-vswckv9g.js";
|
|
22
22
|
import"./cli-9kfxkxmk.js";
|
|
23
23
|
import"./cli-c1k20j6e.js";
|
|
24
|
-
import"./cli-
|
|
24
|
+
import"./cli-6hdqp65a.js";
|
|
25
25
|
import {
|
|
26
26
|
CliInputError
|
|
27
27
|
} from "./cli-k4tqwah4.js";
|
package/package.json
CHANGED