@vantageos/mcp-doctor 0.21.0 → 0.23.0
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/CHANGELOG.md +15 -0
- package/README.md +47 -56
- package/dist/doctor.d.ts +24 -0
- package/dist/doctor.js +1456 -556
- package/package.json +1 -1
package/dist/doctor.js
CHANGED
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
} from "./chunk-OLW7SIJF.js";
|
|
7
7
|
|
|
8
8
|
// src/doctor.ts
|
|
9
|
-
import { readFileSync as
|
|
10
|
-
import { dirname as
|
|
9
|
+
import { readFileSync as readFileSync30, realpathSync, statSync as statSync27 } from "fs";
|
|
10
|
+
import { dirname as dirname20, join as join38, resolve as resolve4 } from "path";
|
|
11
11
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
12
12
|
|
|
13
13
|
// src/scan.ts
|
|
@@ -681,12 +681,12 @@ function findDiskFiles(tree, pred) {
|
|
|
681
681
|
}
|
|
682
682
|
walk3(full);
|
|
683
683
|
} else {
|
|
684
|
-
const
|
|
685
|
-
if (!pred(name,
|
|
684
|
+
const rel2 = relative2(base, full).split(sep2).join("/");
|
|
685
|
+
if (!pred(name, rel2)) continue;
|
|
686
686
|
if (!st.isFile()) {
|
|
687
687
|
const why = "not a regular file (FIFO, socket or device) \u2014 not read";
|
|
688
688
|
recordSkip(tree, full, base, why);
|
|
689
|
-
refused.push({ rel, reason: why });
|
|
689
|
+
refused.push({ rel: rel2, reason: why });
|
|
690
690
|
continue;
|
|
691
691
|
}
|
|
692
692
|
try {
|
|
@@ -694,10 +694,10 @@ function findDiskFiles(tree, pred) {
|
|
|
694
694
|
} catch (err) {
|
|
695
695
|
const why = `could not be read (${fsErrorCode(err)}) \u2014 not read`;
|
|
696
696
|
recordSkip(tree, full, base, why);
|
|
697
|
-
refused.push({ rel, reason: why });
|
|
697
|
+
refused.push({ rel: rel2, reason: why });
|
|
698
698
|
continue;
|
|
699
699
|
}
|
|
700
|
-
out.push({ path: full, rel, name });
|
|
700
|
+
out.push({ path: full, rel: rel2, name });
|
|
701
701
|
}
|
|
702
702
|
}
|
|
703
703
|
};
|
|
@@ -800,6 +800,7 @@ var MANUFACT_RULES_PIN = "7e5513eff22c0e2174c100d26e0aa40f642a562f";
|
|
|
800
800
|
var C40_RULES_PIN = "941156e5734007188d1e3c54adadf3f1a3f84761";
|
|
801
801
|
var C19_RULES_PIN = "1596b8c552d8b836f4d6044569fb2e15c3bfe6cb";
|
|
802
802
|
var S51_RULES_PIN = "3b4982f7da3d34f0dc3bb42f8d3f3c5f9480943a";
|
|
803
|
+
var C41_RULES_PIN = "173d3f0bef155a362ffce9fbe9bb4f1d1115e5b8";
|
|
803
804
|
|
|
804
805
|
// src/detectors/dLocalIdentity.ts
|
|
805
806
|
var CLOUD_IDENTITY_PACKAGE = "@vantageos/cloud-identity";
|
|
@@ -1979,7 +1980,7 @@ function scanWrappers(tree) {
|
|
|
1979
1980
|
lineStart.push(off);
|
|
1980
1981
|
off += l.raw.length + 1;
|
|
1981
1982
|
}
|
|
1982
|
-
const
|
|
1983
|
+
const lineOf5 = (idx) => {
|
|
1983
1984
|
let lo = 0;
|
|
1984
1985
|
let hi = lineStart.length - 1;
|
|
1985
1986
|
while (lo < hi) {
|
|
@@ -2030,7 +2031,7 @@ function scanWrappers(tree) {
|
|
|
2030
2031
|
const k = paramNames.indexOf(c[1]);
|
|
2031
2032
|
if (k < 0) continue;
|
|
2032
2033
|
idxs.add(k);
|
|
2033
|
-
scan.internal.add(`${file.rel}:${
|
|
2034
|
+
scan.internal.add(`${file.rel}:${lineOf5(bodyOpen + (c.index ?? 0))}`);
|
|
2034
2035
|
const after = body.slice((c.index ?? 0) + c[0].length, (c.index ?? 0) + c[0].length + 3e3);
|
|
2035
2036
|
const dm = after.match(/(?:^|[\s{,])description\b\s*(?::\s*([A-Za-z_$][\w$]*))?\s*[,}]/);
|
|
2036
2037
|
if (dm) {
|
|
@@ -2045,7 +2046,7 @@ function scanWrappers(tree) {
|
|
|
2045
2046
|
descIdx,
|
|
2046
2047
|
file,
|
|
2047
2048
|
declLine: line.n,
|
|
2048
|
-
endLine:
|
|
2049
|
+
endLine: lineOf5(bodyEnd)
|
|
2049
2050
|
});
|
|
2050
2051
|
});
|
|
2051
2052
|
}
|
|
@@ -2725,11 +2726,11 @@ var presentResult = (id, anchor, verdict3) => ({
|
|
|
2725
2726
|
state: "present",
|
|
2726
2727
|
verdict: verdict3
|
|
2727
2728
|
});
|
|
2728
|
-
function isProductSource(
|
|
2729
|
+
function isProductSource(rel2) {
|
|
2729
2730
|
return !/(^|\/)(scripts|evals|examples|docs|e2e|test|tests|__tests__|spec|specs|fixtures|mocks?)\//.test(
|
|
2730
|
-
|
|
2731
|
+
rel2
|
|
2731
2732
|
) && // `bin/` is tooling only at the top of the tree: `src/bin/server.ts` is the stdio entry of a server.
|
|
2732
|
-
!/^bin\//.test(
|
|
2733
|
+
!/^bin\//.test(rel2) && !/\.(?:test|spec)\.[jt]sx?$/.test(rel2);
|
|
2733
2734
|
}
|
|
2734
2735
|
function productHits(tree, re) {
|
|
2735
2736
|
return lineHits(tree, re).filter((h) => isProductSource(h.file.rel));
|
|
@@ -3161,30 +3162,30 @@ function collect(base) {
|
|
|
3161
3162
|
}
|
|
3162
3163
|
for (const name of entries.sort()) {
|
|
3163
3164
|
const full = join4(dir, name);
|
|
3164
|
-
const
|
|
3165
|
-
const candidate = BUNDLE_EXT_RE.test(name) && UI_PATH_RE.test(
|
|
3165
|
+
const rel2 = relOf(full);
|
|
3166
|
+
const candidate = BUNDLE_EXT_RE.test(name) && UI_PATH_RE.test(rel2);
|
|
3166
3167
|
let st;
|
|
3167
3168
|
try {
|
|
3168
3169
|
st = statSync5(full);
|
|
3169
3170
|
} catch {
|
|
3170
|
-
if (candidate) unmeasured.push(`${
|
|
3171
|
+
if (candidate) unmeasured.push(`${rel2} (cannot be read: dangling link or permission)`);
|
|
3171
3172
|
continue;
|
|
3172
3173
|
}
|
|
3173
3174
|
if (st.isDirectory()) {
|
|
3174
3175
|
if (!WALK_SKIP.has(name)) walk3(full, depth + 1);
|
|
3175
3176
|
} else if (candidate) {
|
|
3176
3177
|
if (!st.isFile()) {
|
|
3177
|
-
unmeasured.push(`${
|
|
3178
|
+
unmeasured.push(`${rel2} (not a regular file, not read)`);
|
|
3178
3179
|
continue;
|
|
3179
3180
|
}
|
|
3180
3181
|
if (st.size > MAX_MEASURE_BYTES) {
|
|
3181
|
-
unmeasured.push(`${
|
|
3182
|
+
unmeasured.push(`${rel2} (${(st.size / 1048576).toFixed(0)} MB, too large to measure)`);
|
|
3182
3183
|
continue;
|
|
3183
3184
|
}
|
|
3184
3185
|
try {
|
|
3185
|
-
out.push({ rel, gz: gzipSync(readFileSync4(full), { level: 9 }).length });
|
|
3186
|
+
out.push({ rel: rel2, gz: gzipSync(readFileSync4(full), { level: 9 }).length });
|
|
3186
3187
|
} catch {
|
|
3187
|
-
unmeasured.push(`${
|
|
3188
|
+
unmeasured.push(`${rel2} (read or compression failed)`);
|
|
3188
3189
|
}
|
|
3189
3190
|
}
|
|
3190
3191
|
}
|
|
@@ -4546,7 +4547,7 @@ function readDeclaredUpstreams(tree) {
|
|
|
4546
4547
|
const decls = [];
|
|
4547
4548
|
const unreadable2 = [];
|
|
4548
4549
|
let located = false;
|
|
4549
|
-
const fromJson = (
|
|
4550
|
+
const fromJson = (rel2, v) => {
|
|
4550
4551
|
if (v === null || typeof v !== "object") return;
|
|
4551
4552
|
const root = v;
|
|
4552
4553
|
const holders = [
|
|
@@ -4562,7 +4563,7 @@ function readDeclaredUpstreams(tree) {
|
|
|
4562
4563
|
const add = (name, o) => {
|
|
4563
4564
|
if (typeof name !== "string") return;
|
|
4564
4565
|
const t = o && typeof o === "object" ? o.tenancy : void 0;
|
|
4565
|
-
decls.push({ name, tenancy: typeof t === "string" ? t : void 0, anchor: `${
|
|
4566
|
+
decls.push({ name, tenancy: typeof t === "string" ? t : void 0, anchor: `${rel2}:1` });
|
|
4566
4567
|
};
|
|
4567
4568
|
if (Array.isArray(u)) {
|
|
4568
4569
|
for (const e of u) {
|
|
@@ -4573,8 +4574,8 @@ function readDeclaredUpstreams(tree) {
|
|
|
4573
4574
|
for (const [k, e] of Object.entries(u)) add(k, e);
|
|
4574
4575
|
} else {
|
|
4575
4576
|
unreadable2.push({
|
|
4576
|
-
anchor: `${
|
|
4577
|
-
reason: `${
|
|
4577
|
+
anchor: `${rel2}:1`,
|
|
4578
|
+
reason: `${rel2} has an \`upstreams\` key that is neither a list nor an object`
|
|
4578
4579
|
});
|
|
4579
4580
|
}
|
|
4580
4581
|
}
|
|
@@ -4695,9 +4696,9 @@ function insideLoop(s, off) {
|
|
|
4695
4696
|
function controlTree(files) {
|
|
4696
4697
|
return {
|
|
4697
4698
|
root: "/nonexistent-control-root",
|
|
4698
|
-
files: Object.entries(files).map(([
|
|
4699
|
-
path:
|
|
4700
|
-
rel,
|
|
4699
|
+
files: Object.entries(files).map(([rel2, text]) => ({
|
|
4700
|
+
path: rel2,
|
|
4701
|
+
rel: rel2,
|
|
4701
4702
|
lines: text.split("\n").map((raw, i) => ({ n: i + 1, raw, comment: false }))
|
|
4702
4703
|
})),
|
|
4703
4704
|
packageJson: null,
|
|
@@ -6413,8 +6414,8 @@ function skillsCacheProblems(tree) {
|
|
|
6413
6414
|
let first = "";
|
|
6414
6415
|
for (const [method, anchors] of sites) {
|
|
6415
6416
|
for (const anchor of anchors) {
|
|
6416
|
-
const
|
|
6417
|
-
if (!(ttl.some((h) => h.file.rel ===
|
|
6417
|
+
const rel2 = anchor.slice(0, anchor.lastIndexOf(":"));
|
|
6418
|
+
if (!(ttl.some((h) => h.file.rel === rel2) && scope2.some((h) => h.file.rel === rel2))) {
|
|
6418
6419
|
problems.push(`${method} (${anchor})`);
|
|
6419
6420
|
first = first || anchor;
|
|
6420
6421
|
}
|
|
@@ -6736,11 +6737,11 @@ function hostToolProblems(tree) {
|
|
|
6736
6737
|
text: `${n.from} tool \`${n.name}\` does not list "app" in ui.visibility`
|
|
6737
6738
|
});
|
|
6738
6739
|
}
|
|
6739
|
-
const
|
|
6740
|
-
if (!lineHits(tree, /resource_link|ResourceLink/).some((h) => h.file.rel ===
|
|
6740
|
+
const rel2 = t.anchor.slice(0, t.anchor.lastIndexOf(":"));
|
|
6741
|
+
if (!lineHits(tree, /resource_link|ResourceLink/).some((h) => h.file.rel === rel2)) {
|
|
6741
6742
|
problems.push({
|
|
6742
6743
|
anchor: t.anchor,
|
|
6743
|
-
text: `${n.from} tool \`${n.name}\` never returns a ResourceLink (no resource_link in ${
|
|
6744
|
+
text: `${n.from} tool \`${n.name}\` never returns a ResourceLink (no resource_link in ${rel2})`
|
|
6744
6745
|
});
|
|
6745
6746
|
}
|
|
6746
6747
|
}
|
|
@@ -6865,8 +6866,8 @@ var a9Entrypoint = {
|
|
|
6865
6866
|
reason: "no ontoolresult / onToolResult handler is found in the tree \u2014 whether the first view renders from the initial tool result is unread"
|
|
6866
6867
|
});
|
|
6867
6868
|
}
|
|
6868
|
-
for (const
|
|
6869
|
-
const file = tree.files.find((f) => f.rel ===
|
|
6869
|
+
for (const rel2 of handlerFiles) {
|
|
6870
|
+
const file = tree.files.find((f) => f.rel === rel2);
|
|
6870
6871
|
if (!file) continue;
|
|
6871
6872
|
const handler = codeSites(
|
|
6872
6873
|
{ ...tree, files: [file] },
|
|
@@ -6876,7 +6877,7 @@ var a9Entrypoint = {
|
|
|
6876
6877
|
if (handler && connect && connect.line.n < handler.line.n) {
|
|
6877
6878
|
reds.push({
|
|
6878
6879
|
anchor: handler.anchor,
|
|
6879
|
-
text: `${
|
|
6880
|
+
text: `${rel2}: ontoolresult is registered at line ${handler.line.n}, AFTER connect at line ${connect.line.n} \u2014 the initial tool result can arrive before the handler exists (register ontoolresult before connect)`
|
|
6880
6881
|
});
|
|
6881
6882
|
}
|
|
6882
6883
|
}
|
|
@@ -7216,8 +7217,8 @@ function resourceCallEnd(file, n) {
|
|
|
7216
7217
|
}
|
|
7217
7218
|
return file.lines.length;
|
|
7218
7219
|
}
|
|
7219
|
-
var within = (r,
|
|
7220
|
-
var addRange = (r,
|
|
7220
|
+
var within = (r, rel2, n) => (r.get(rel2) ?? []).some(([a, b]) => n >= a && n <= b);
|
|
7221
|
+
var addRange = (r, rel2, a, b) => r.set(rel2, [...r.get(rel2) ?? [], [a, b]]);
|
|
7221
7222
|
function run(tree) {
|
|
7222
7223
|
const covered = /* @__PURE__ */ new Map();
|
|
7223
7224
|
const consts = /* @__PURE__ */ new Set();
|
|
@@ -7685,7 +7686,7 @@ var MECHANISM_BASE_SET = /* @__PURE__ */ new Set([
|
|
|
7685
7686
|
"indexed-hybrid-rrf",
|
|
7686
7687
|
"upstream-delegated"
|
|
7687
7688
|
]);
|
|
7688
|
-
var isDataLayerFile = (
|
|
7689
|
+
var isDataLayerFile = (rel2) => /(^|\/)convex\//.test(rel2);
|
|
7689
7690
|
function judgeIndexedFromSource(tree, id, indexed) {
|
|
7690
7691
|
const names2 = indexed.map((t) => `"${t.name}" (${t.searchMechanism})`).join(", ");
|
|
7691
7692
|
const dataLayer = tree.files.filter((f) => isJudgeable(f) && isDataLayerFile(f.rel));
|
|
@@ -11030,8 +11031,8 @@ function findProvenanceClaim(tree, root, unreadable2) {
|
|
|
11030
11031
|
const hit = workflowStatements(text).find(([, l]) => PROVENANCE_RE2.test(l));
|
|
11031
11032
|
if (hit) {
|
|
11032
11033
|
const line = hit[0];
|
|
11033
|
-
const
|
|
11034
|
-
return { site: `${
|
|
11034
|
+
const rel2 = relative4(root, workflowsDir) || WORKFLOW_DIR;
|
|
11035
|
+
return { site: `${rel2}/${name}:${line}`, text };
|
|
11035
11036
|
}
|
|
11036
11037
|
}
|
|
11037
11038
|
}
|
|
@@ -11471,15 +11472,15 @@ function findInlineDescription(tree, siteAnchor, toolName2) {
|
|
|
11471
11472
|
if (v.kind === "literal" && v.text.length > 0) return v.text;
|
|
11472
11473
|
if (v.kind === "non-literal") return v;
|
|
11473
11474
|
}
|
|
11474
|
-
const [
|
|
11475
|
-
const file = tree.files.find((f) => f.rel ===
|
|
11475
|
+
const [rel2, lineStr] = siteAnchor.split(":");
|
|
11476
|
+
const file = tree.files.find((f) => f.rel === rel2);
|
|
11476
11477
|
if (!file) return void 0;
|
|
11477
11478
|
const siteLine = Number.parseInt(lineStr, 10);
|
|
11478
11479
|
let floor = 1;
|
|
11479
11480
|
for (const other of findRegisteredTools(tree)) {
|
|
11480
11481
|
const [orel, oline] = other.anchor.split(":");
|
|
11481
11482
|
const n = Number.parseInt(oline, 10);
|
|
11482
|
-
if (orel ===
|
|
11483
|
+
if (orel === rel2 && n < siteLine) floor = Math.max(floor, ownCallEnd(file, n) + 1);
|
|
11483
11484
|
}
|
|
11484
11485
|
const start = Math.max(floor, siteLine - BACKWARD_LOOKBACK);
|
|
11485
11486
|
const end = Math.min(siteLine + FORWARD_LOOKAHEAD, file.lines.length + 1);
|
|
@@ -12162,7 +12163,7 @@ var c24AcceptanceAtDispatch = {
|
|
|
12162
12163
|
`C24 positive control FAILED: ${JSON.stringify(ctl)} \u2014 the dispatch matcher cannot tell an instrument job from another, verdict untrustworthy`
|
|
12163
12164
|
);
|
|
12164
12165
|
}
|
|
12165
|
-
const candidates = diskText(tree, (_name,
|
|
12166
|
+
const candidates = diskText(tree, (_name, rel2) => DISPATCH_PATH_RE.test(rel2));
|
|
12166
12167
|
const docs = candidates.filter((d) => INSTRUMENT_RE.test(d.text) && ACTION_RE.test(d.text));
|
|
12167
12168
|
const unreadDocs = refusedAsUnreadable(
|
|
12168
12169
|
candidates.refused,
|
|
@@ -12829,10 +12830,10 @@ function renderCoverage(scope2, verdicts) {
|
|
|
12829
12830
|
}
|
|
12830
12831
|
}
|
|
12831
12832
|
return verdicts.map((v) => {
|
|
12832
|
-
const
|
|
12833
|
-
if (v.status === "skipped") return `SKIPPED ${
|
|
12834
|
-
if (v.status === "unreadable") return `UNREAD ${
|
|
12835
|
-
return `ANALYSED ${
|
|
12833
|
+
const rel2 = relative5(process.cwd(), v.site.dir) || v.site.dir;
|
|
12834
|
+
if (v.status === "skipped") return `SKIPPED ${rel2} (${v.reason})`;
|
|
12835
|
+
if (v.status === "unreadable") return `UNREAD ${rel2} (${v.reason})`;
|
|
12836
|
+
return `ANALYSED ${rel2} -> ${v.ok ? "GREEN" : "RED"}: ${v.detail}`;
|
|
12836
12837
|
}).join(" | ");
|
|
12837
12838
|
}
|
|
12838
12839
|
var c26SubpackageLockfile = {
|
|
@@ -13192,7 +13193,7 @@ function pluginPackages(tree) {
|
|
|
13192
13193
|
}
|
|
13193
13194
|
return [...out].sort();
|
|
13194
13195
|
}
|
|
13195
|
-
function filesUnder(dir, unread2,
|
|
13196
|
+
function filesUnder(dir, unread2, rel2) {
|
|
13196
13197
|
const out = /* @__PURE__ */ new Map();
|
|
13197
13198
|
let incomplete = false;
|
|
13198
13199
|
const walk3 = (d, prefix) => {
|
|
@@ -13200,7 +13201,7 @@ function filesUnder(dir, unread2, rel) {
|
|
|
13200
13201
|
try {
|
|
13201
13202
|
names2 = readdirSync8(d);
|
|
13202
13203
|
} catch (e) {
|
|
13203
|
-
unread2.push({ anchor:
|
|
13204
|
+
unread2.push({ anchor: rel2, reason: `${prefix || "."} not listed (${e.message})` });
|
|
13204
13205
|
incomplete = true;
|
|
13205
13206
|
return;
|
|
13206
13207
|
}
|
|
@@ -13213,7 +13214,7 @@ function filesUnder(dir, unread2, rel) {
|
|
|
13213
13214
|
} catch (e) {
|
|
13214
13215
|
out.set(r, null);
|
|
13215
13216
|
unread2.push({
|
|
13216
|
-
anchor: `${
|
|
13217
|
+
anchor: `${rel2}/${r}`,
|
|
13217
13218
|
reason: `not read (${e.message}): not compared`
|
|
13218
13219
|
});
|
|
13219
13220
|
}
|
|
@@ -13222,15 +13223,15 @@ function filesUnder(dir, unread2, rel) {
|
|
|
13222
13223
|
walk3(dir, "");
|
|
13223
13224
|
return { files: out, incomplete };
|
|
13224
13225
|
}
|
|
13225
|
-
function absenceOf(base,
|
|
13226
|
+
function absenceOf(base, rel2) {
|
|
13226
13227
|
try {
|
|
13227
|
-
statSync11(join12(base,
|
|
13228
|
-
return `${
|
|
13228
|
+
statSync11(join12(base, rel2));
|
|
13229
|
+
return `${rel2} exists but was not read by the scan`;
|
|
13229
13230
|
} catch (e) {
|
|
13230
13231
|
if (e.code !== "ENOENT")
|
|
13231
|
-
return `${
|
|
13232
|
+
return `${rel2} not read (${e.message})`;
|
|
13232
13233
|
}
|
|
13233
|
-
const parts =
|
|
13234
|
+
const parts = rel2.split("/");
|
|
13234
13235
|
for (let i = parts.length - 1; i >= 0; i--) {
|
|
13235
13236
|
const dir = parts.slice(0, i).join("/");
|
|
13236
13237
|
try {
|
|
@@ -13238,7 +13239,7 @@ function absenceOf(base, rel) {
|
|
|
13238
13239
|
return true;
|
|
13239
13240
|
} catch (e) {
|
|
13240
13241
|
if (e.code === "ENOENT") continue;
|
|
13241
|
-
return `${dir || "."} not listed (${e.message}): whether ${
|
|
13242
|
+
return `${dir || "."} not listed (${e.message}): whether ${rel2} is there is not read`;
|
|
13242
13243
|
}
|
|
13243
13244
|
}
|
|
13244
13245
|
return true;
|
|
@@ -13248,22 +13249,22 @@ function packageSkillProblems(tree, skillFiles, unread2) {
|
|
|
13248
13249
|
const packages = pluginPackages(tree);
|
|
13249
13250
|
if (packages.length === 0 || skillFiles.length === 0) return [];
|
|
13250
13251
|
const skillsRoot = (pkg) => pkg ? `${pkg}/skills` : "skills";
|
|
13251
|
-
const inPackage = (
|
|
13252
|
+
const inPackage = (rel2) => packages.some((p) => rel2.startsWith(`${skillsRoot(p)}/`));
|
|
13252
13253
|
const names2 = [...new Set(skillFiles.map((s) => s.dir))].sort();
|
|
13253
13254
|
const out = [];
|
|
13254
13255
|
for (const pkg of packages) {
|
|
13255
13256
|
const at = pkg || ".";
|
|
13256
13257
|
const missing = [];
|
|
13257
13258
|
for (const name of names2) {
|
|
13258
|
-
const
|
|
13259
|
-
const copy = skillFiles.find((s) => s.rel ===
|
|
13259
|
+
const rel2 = `${skillsRoot(pkg)}/${name}/SKILL.md`;
|
|
13260
|
+
const copy = skillFiles.find((s) => s.rel === rel2);
|
|
13260
13261
|
if (!copy) {
|
|
13261
|
-
const absent = absenceOf(base,
|
|
13262
|
+
const absent = absenceOf(base, rel2);
|
|
13262
13263
|
if (absent === true) missing.push(name);
|
|
13263
|
-
else unread2.push({ anchor:
|
|
13264
|
+
else unread2.push({ anchor: rel2, reason: absent });
|
|
13264
13265
|
continue;
|
|
13265
13266
|
}
|
|
13266
|
-
const served = skillFiles.find((s) => s.dir === name && s.rel !==
|
|
13267
|
+
const served = skillFiles.find((s) => s.dir === name && s.rel !== rel2 && !inPackage(s.rel));
|
|
13267
13268
|
if (!served) {
|
|
13268
13269
|
if (pkg) {
|
|
13269
13270
|
const servedRel = `skills/${name}/SKILL.md`;
|
|
@@ -13273,7 +13274,7 @@ function packageSkillProblems(tree, skillFiles, unread2) {
|
|
|
13273
13274
|
continue;
|
|
13274
13275
|
}
|
|
13275
13276
|
const servedDir = served.rel.slice(0, -"/SKILL.md".length);
|
|
13276
|
-
const copyDir =
|
|
13277
|
+
const copyDir = rel2.slice(0, -"/SKILL.md".length);
|
|
13277
13278
|
const servedWalk = filesUnder(join12(base, servedDir), unread2, servedDir);
|
|
13278
13279
|
const copyWalk = filesUnder(join12(base, copyDir), unread2, copyDir);
|
|
13279
13280
|
const a = servedWalk.files;
|
|
@@ -13287,7 +13288,7 @@ function packageSkillProblems(tree, skillFiles, unread2) {
|
|
|
13287
13288
|
});
|
|
13288
13289
|
if (missingFiles.length + extraFiles.length + differing.length > 0)
|
|
13289
13290
|
out.push({
|
|
13290
|
-
anchor:
|
|
13291
|
+
anchor: rel2,
|
|
13291
13292
|
text: `the package copy ${copyDir}/ is not derived from the served ${servedDir}/: ${[
|
|
13292
13293
|
missingFiles.length ? `missing ${missingFiles.join(", ")}` : "",
|
|
13293
13294
|
differing.length ? `differing ${differing.join(", ")}` : "",
|
|
@@ -13599,16 +13600,16 @@ function judgeServers(servers, anchor, out) {
|
|
|
13599
13600
|
}
|
|
13600
13601
|
}
|
|
13601
13602
|
function judgeFolder(tree, folder, manifestPath2, out) {
|
|
13602
|
-
const
|
|
13603
|
+
const rel2 = (p) => relative8(tree.root, p).split(sep5).join("/") || ".";
|
|
13603
13604
|
const manifest = readJsonRecord(manifestPath2);
|
|
13604
13605
|
if (!manifest) {
|
|
13605
13606
|
out.unreadable.push({
|
|
13606
|
-
anchor:
|
|
13607
|
-
reason: `${
|
|
13607
|
+
anchor: rel2(manifestPath2),
|
|
13608
|
+
reason: `${rel2(manifestPath2)} is present but is not a parseable JSON object \u2014 the plugin cannot be judged`
|
|
13608
13609
|
});
|
|
13609
13610
|
return;
|
|
13610
13611
|
}
|
|
13611
|
-
const a =
|
|
13612
|
+
const a = rel2(manifestPath2);
|
|
13612
13613
|
const name = manifest.name;
|
|
13613
13614
|
if (typeof name !== "string" || !KEBAB_RE.test(name)) {
|
|
13614
13615
|
out.reds.push({
|
|
@@ -13637,8 +13638,8 @@ function judgeFolder(tree, folder, manifestPath2, out) {
|
|
|
13637
13638
|
} catch (err) {
|
|
13638
13639
|
folderListed = false;
|
|
13639
13640
|
out.unreadable.push({
|
|
13640
|
-
anchor:
|
|
13641
|
-
reason: `${
|
|
13641
|
+
anchor: rel2(folder),
|
|
13642
|
+
reason: `${rel2(folder)} cannot be listed (${fsErrorCode(err)}) \u2014 whether it carries a LICENSE file is unread`
|
|
13642
13643
|
});
|
|
13643
13644
|
}
|
|
13644
13645
|
if (!hasLicenseField && !hasLicenseFile && folderListed) {
|
|
@@ -13651,16 +13652,16 @@ function judgeFolder(tree, folder, manifestPath2, out) {
|
|
|
13651
13652
|
const readme = readText(readmePath);
|
|
13652
13653
|
if (readme === null && existsSync11(readmePath)) {
|
|
13653
13654
|
out.unreadable.push({
|
|
13654
|
-
anchor:
|
|
13655
|
-
reason: `${
|
|
13655
|
+
anchor: rel2(readmePath),
|
|
13656
|
+
reason: `${rel2(readmePath)} is present but cannot be read as text (permission, or not a regular file) \u2014 its length and credential content are unread`
|
|
13656
13657
|
});
|
|
13657
13658
|
} else if (readme === null) {
|
|
13658
|
-
out.reds.push({ anchor:
|
|
13659
|
+
out.reds.push({ anchor: rel2(folder), text: "no README.md at the plugin folder root" });
|
|
13659
13660
|
} else {
|
|
13660
13661
|
const n = proseWordCount(readme);
|
|
13661
13662
|
if (n < MIN_README_WORDS) {
|
|
13662
13663
|
out.reds.push({
|
|
13663
|
-
anchor:
|
|
13664
|
+
anchor: rel2(readmePath),
|
|
13664
13665
|
text: `README.md has ${n} words outside code blocks (minimum ${MIN_README_WORDS})`
|
|
13665
13666
|
});
|
|
13666
13667
|
}
|
|
@@ -13669,8 +13670,8 @@ function judgeFolder(tree, folder, manifestPath2, out) {
|
|
|
13669
13670
|
for (const shape of CREDENTIAL_SHAPES) {
|
|
13670
13671
|
if (shape.re.test(lines2[i])) {
|
|
13671
13672
|
out.reds.push({
|
|
13672
|
-
anchor: `${
|
|
13673
|
-
text: `${
|
|
13673
|
+
anchor: `${rel2(readmePath)}:${i + 1}`,
|
|
13674
|
+
text: `${rel2(readmePath)}:${i + 1} carries a literal credential (${shape.id}) \u2014 a README template shows an environment-variable reference, never a value`
|
|
13674
13675
|
});
|
|
13675
13676
|
break;
|
|
13676
13677
|
}
|
|
@@ -13678,7 +13679,7 @@ function judgeFolder(tree, folder, manifestPath2, out) {
|
|
|
13678
13679
|
}
|
|
13679
13680
|
}
|
|
13680
13681
|
let servers = null;
|
|
13681
|
-
let mcpAnchor =
|
|
13682
|
+
let mcpAnchor = rel2(join13(folder, ".mcp.json"));
|
|
13682
13683
|
const inline = manifest.mcpServers;
|
|
13683
13684
|
if (isRecord(inline)) {
|
|
13684
13685
|
servers = inline;
|
|
@@ -13686,7 +13687,7 @@ function judgeFolder(tree, folder, manifestPath2, out) {
|
|
|
13686
13687
|
} else if (typeof inline === "string") {
|
|
13687
13688
|
const target = join13(folder, inline);
|
|
13688
13689
|
const j = readJsonRecord(target);
|
|
13689
|
-
mcpAnchor =
|
|
13690
|
+
mcpAnchor = rel2(target);
|
|
13690
13691
|
if (j) servers = isRecord(j.mcpServers) ? j.mcpServers : j;
|
|
13691
13692
|
else
|
|
13692
13693
|
out.unreadable.push({
|
|
@@ -13703,7 +13704,7 @@ function judgeFolder(tree, folder, manifestPath2, out) {
|
|
|
13703
13704
|
});
|
|
13704
13705
|
} else {
|
|
13705
13706
|
out.reds.push({
|
|
13706
|
-
anchor:
|
|
13707
|
+
anchor: rel2(folder),
|
|
13707
13708
|
text: "no .mcp.json (and no plugin.json mcpServers): the plugin does not reference the MCP server it ships"
|
|
13708
13709
|
});
|
|
13709
13710
|
}
|
|
@@ -13716,7 +13717,7 @@ function judgeFolder(tree, folder, manifestPath2, out) {
|
|
|
13716
13717
|
try {
|
|
13717
13718
|
if (statSync12(join13(folder, "bin")).isDirectory()) {
|
|
13718
13719
|
out.reds.push({
|
|
13719
|
-
anchor:
|
|
13720
|
+
anchor: rel2(join13(folder, "bin")),
|
|
13720
13721
|
text: "a top-level bin/ directory (a plugin ships no bin/ at its top level)"
|
|
13721
13722
|
});
|
|
13722
13723
|
}
|
|
@@ -13724,8 +13725,8 @@ function judgeFolder(tree, folder, manifestPath2, out) {
|
|
|
13724
13725
|
const code = fsErrorCode(err);
|
|
13725
13726
|
if (code !== "ENOENT" && code !== "ENOTDIR") {
|
|
13726
13727
|
out.unreadable.push({
|
|
13727
|
-
anchor:
|
|
13728
|
-
reason: `${
|
|
13728
|
+
anchor: rel2(join13(folder, "bin")),
|
|
13729
|
+
reason: `${rel2(join13(folder, "bin"))} could not be probed (${code}) \u2014 whether the plugin ships a top-level bin/ is unread`
|
|
13729
13730
|
});
|
|
13730
13731
|
}
|
|
13731
13732
|
}
|
|
@@ -13755,7 +13756,7 @@ var c31PluginInstallable = {
|
|
|
13755
13756
|
}
|
|
13756
13757
|
const manifests = findDiskFiles(
|
|
13757
13758
|
tree,
|
|
13758
|
-
(_n,
|
|
13759
|
+
(_n, rel2) => rel2 === ".claude-plugin/plugin.json" || rel2.endsWith("/.claude-plugin/plugin.json")
|
|
13759
13760
|
);
|
|
13760
13761
|
const refusedManifests = refusedAsUnreadable(
|
|
13761
13762
|
manifests.refused,
|
|
@@ -13991,8 +13992,8 @@ import { readFileSync as readFileSync12, readdirSync as readdirSync10, statSync
|
|
|
13991
13992
|
import { join as join14 } from "path";
|
|
13992
13993
|
var ID3 = "C34 plugin-families";
|
|
13993
13994
|
var RULE3 = "C-34";
|
|
13994
|
-
function familyOf(
|
|
13995
|
-
const segs =
|
|
13995
|
+
function familyOf(rel2) {
|
|
13996
|
+
const segs = rel2.split("/");
|
|
13996
13997
|
const name = segs[segs.length - 1];
|
|
13997
13998
|
const parent = segs[segs.length - 2] ?? "";
|
|
13998
13999
|
if (name === "plugin.json" && parent === ".claude-plugin")
|
|
@@ -14075,12 +14076,12 @@ function writesFile(text, f) {
|
|
|
14075
14076
|
function testFiles(tree, unread2) {
|
|
14076
14077
|
const base = baseOf(tree);
|
|
14077
14078
|
const out = [];
|
|
14078
|
-
const walk3 = (dir,
|
|
14079
|
+
const walk3 = (dir, rel2) => {
|
|
14079
14080
|
let names2;
|
|
14080
14081
|
try {
|
|
14081
14082
|
names2 = readdirSync10(dir);
|
|
14082
14083
|
} catch (err) {
|
|
14083
|
-
unread2.push(`${
|
|
14084
|
+
unread2.push(`${rel2}/ (not listed: ${err.message})`);
|
|
14084
14085
|
return;
|
|
14085
14086
|
}
|
|
14086
14087
|
for (const name of names2) {
|
|
@@ -14092,9 +14093,9 @@ function testFiles(tree, unread2) {
|
|
|
14092
14093
|
} catch {
|
|
14093
14094
|
continue;
|
|
14094
14095
|
}
|
|
14095
|
-
if (st.isDirectory()) walk3(full, `${
|
|
14096
|
+
if (st.isDirectory()) walk3(full, `${rel2}/${name}`);
|
|
14096
14097
|
else if (/\.[cm]?[jt]sx?$/.test(name))
|
|
14097
|
-
out.push({ rel: `${
|
|
14098
|
+
out.push({ rel: `${rel2}/${name}`, text: readText(full) ?? "" });
|
|
14098
14099
|
}
|
|
14099
14100
|
};
|
|
14100
14101
|
for (const d of ["tests", "test", "__tests__"]) {
|
|
@@ -14110,9 +14111,9 @@ function testFiles(tree, unread2) {
|
|
|
14110
14111
|
function run2(tree) {
|
|
14111
14112
|
const found = findDiskFiles(
|
|
14112
14113
|
tree,
|
|
14113
|
-
(name,
|
|
14114
|
+
(name, rel2) => familyOf(rel2) !== null && !/(^|\/)(dist|node_modules)\//.test(rel2) && name.endsWith(".json")
|
|
14114
14115
|
);
|
|
14115
|
-
const dirOf = (
|
|
14116
|
+
const dirOf = (rel2) => rel2.split("/").slice(0, -1).join("/");
|
|
14116
14117
|
const agentDirs = new Set(
|
|
14117
14118
|
found.filter((f) => f.name === "plugin.json" && familyOf(f.rel)?.id === "agent").map((f) => dirOf(f.rel))
|
|
14118
14119
|
);
|
|
@@ -14129,12 +14130,12 @@ function run2(tree) {
|
|
|
14129
14130
|
const unread2 = found.refused.map((r) => `${r.rel} (${r.reason})`);
|
|
14130
14131
|
const scripts = findDiskFiles(
|
|
14131
14132
|
tree,
|
|
14132
|
-
(name,
|
|
14133
|
+
(name, rel2) => /\.(?:mjs|cjs|js|ts)$/.test(name) && !/(^|\/)(dist|node_modules|tests?|__tests__)\//.test(rel2) && !/\.(?:test|spec)\.[cm]?[jt]s$/.test(name)
|
|
14133
14134
|
).map((f) => ({ file: f, text: readText(f.path) ?? "" }));
|
|
14134
14135
|
const tests = testFiles(tree, unread2);
|
|
14135
14136
|
const wiring = findDiskFiles(
|
|
14136
14137
|
tree,
|
|
14137
|
-
(name,
|
|
14138
|
+
(name, rel2) => name === "package.json" && !rel2.includes("node_modules/") || /\.github\/workflows\/[^/]+\.ya?ml$/.test(rel2)
|
|
14138
14139
|
).map((f) => ({ file: f, text: readText(f.path) ?? "" }));
|
|
14139
14140
|
const badManifests = wiring.filter((w) => w.file.name === "package.json").filter((w) => {
|
|
14140
14141
|
try {
|
|
@@ -14233,7 +14234,7 @@ function readJson2(path) {
|
|
|
14233
14234
|
function pluginManifests(tree) {
|
|
14234
14235
|
return findDiskFiles(
|
|
14235
14236
|
tree,
|
|
14236
|
-
(name,
|
|
14237
|
+
(name, rel2) => name === "plugin.json" && !/(^|\/)(dist|node_modules)\//.test(rel2)
|
|
14237
14238
|
).map((f) => {
|
|
14238
14239
|
const r = readJson2(f.path);
|
|
14239
14240
|
const d = r.ok && r.value && typeof r.value === "object" ? r.value.description : void 0;
|
|
@@ -14459,11 +14460,11 @@ function registrationWindow(tree, anchor) {
|
|
|
14459
14460
|
}
|
|
14460
14461
|
function findManifestsUnder(root) {
|
|
14461
14462
|
const out = [];
|
|
14462
|
-
for (const
|
|
14463
|
-
const r = readJson2(join15(root,
|
|
14463
|
+
for (const rel2 of ["plugin.json", ".claude-plugin/plugin.json", ".cursor-plugin/plugin.json"]) {
|
|
14464
|
+
const r = readJson2(join15(root, rel2));
|
|
14464
14465
|
if (!r.ok) continue;
|
|
14465
14466
|
const d = r.value && typeof r.value === "object" ? r.value.description : void 0;
|
|
14466
|
-
out.push({ rel, description: typeof d === "string" ? d : void 0 });
|
|
14467
|
+
out.push({ rel: rel2, description: typeof d === "string" ? d : void 0 });
|
|
14467
14468
|
}
|
|
14468
14469
|
return out;
|
|
14469
14470
|
}
|
|
@@ -14969,15 +14970,192 @@ function sourced(d, served) {
|
|
|
14969
14970
|
if (/["'`][^"'`\s]{1,64}["'`]/.test(d)) return true;
|
|
14970
14971
|
return /\b(name|ID)\b/.test(d);
|
|
14971
14972
|
}
|
|
14972
|
-
|
|
14973
|
+
var IDENT3 = "[A-Za-z_$][A-Za-z0-9_$]*";
|
|
14974
|
+
var OPEN2 = { "{": "}", "[": "]", "(": ")" };
|
|
14975
|
+
function closeOf2(s, i) {
|
|
14976
|
+
const stack = [];
|
|
14977
|
+
for (let j = i; j < s.length; j++) {
|
|
14978
|
+
const c = s[j];
|
|
14979
|
+
if (OPEN2[c]) stack.push(OPEN2[c]);
|
|
14980
|
+
else if (c === "}" || c === "]" || c === ")") {
|
|
14981
|
+
if (stack.pop() !== c) return -1;
|
|
14982
|
+
if (stack.length === 0) return j;
|
|
14983
|
+
}
|
|
14984
|
+
}
|
|
14985
|
+
return -1;
|
|
14986
|
+
}
|
|
14987
|
+
function splitTop2(s) {
|
|
14973
14988
|
const out = [];
|
|
14974
|
-
|
|
14975
|
-
|
|
14976
|
-
|
|
14977
|
-
|
|
14989
|
+
let depth = 0;
|
|
14990
|
+
let cur = "";
|
|
14991
|
+
for (const c of s) {
|
|
14992
|
+
if (OPEN2[c]) depth++;
|
|
14993
|
+
else if (c === "}" || c === "]" || c === ")") depth--;
|
|
14994
|
+
if (c === "," && depth === 0) {
|
|
14995
|
+
out.push(cur);
|
|
14996
|
+
cur = "";
|
|
14997
|
+
} else cur += c;
|
|
14998
|
+
}
|
|
14999
|
+
out.push(cur);
|
|
15000
|
+
return out.map((x) => x.trim()).filter((x) => x.length > 0);
|
|
15001
|
+
}
|
|
15002
|
+
function clauseEnd(d, from) {
|
|
15003
|
+
for (let j = from; j < d.length; j++) {
|
|
15004
|
+
const c = d[j];
|
|
15005
|
+
if (OPEN2[c]) {
|
|
15006
|
+
const k = closeOf2(d, j);
|
|
15007
|
+
if (k === -1) return -1;
|
|
15008
|
+
j = k;
|
|
15009
|
+
continue;
|
|
14978
15010
|
}
|
|
15011
|
+
if (c === ";") return j;
|
|
15012
|
+
if ((c === "." || c === ":") && (j + 1 === d.length || /\s/.test(d[j + 1]))) return j;
|
|
14979
15013
|
}
|
|
14980
|
-
return
|
|
15014
|
+
return d.length;
|
|
15015
|
+
}
|
|
15016
|
+
function literalNames(inner) {
|
|
15017
|
+
const names2 = [];
|
|
15018
|
+
const unread2 = [];
|
|
15019
|
+
const member = new RegExp(`^(${IDENT3})\\??((?:\\s+or\\s+${IDENT3}\\??)*)\\s*([:[{].*)?$`, "s");
|
|
15020
|
+
for (const m of splitTop2(inner)) {
|
|
15021
|
+
const r = member.exec(m);
|
|
15022
|
+
if (!r) {
|
|
15023
|
+
unread2.push(`member "${m}" is not a field name`);
|
|
15024
|
+
continue;
|
|
15025
|
+
}
|
|
15026
|
+
names2.push(r[1]);
|
|
15027
|
+
for (const alt of (r[2] ?? "").matchAll(new RegExp(`or\\s+(${IDENT3})`, "g")))
|
|
15028
|
+
names2.push(alt[1]);
|
|
15029
|
+
}
|
|
15030
|
+
return { names: names2, unread: unread2 };
|
|
15031
|
+
}
|
|
15032
|
+
var plusNames = (s) => [...s.matchAll(new RegExp(`\\bplus\\s+(${IDENT3})`, "g"))].map((m) => m[1]);
|
|
15033
|
+
function returnsClauses(d) {
|
|
15034
|
+
const out = [];
|
|
15035
|
+
for (const m of d.matchAll(/\bReturns\b/g)) {
|
|
15036
|
+
const at = m.index;
|
|
15037
|
+
const before = d.slice(0, at);
|
|
15038
|
+
if (!(before.trim() === "" || /[.;:]\s+$/.test(before))) {
|
|
15039
|
+
out.push({
|
|
15040
|
+
form: "prose",
|
|
15041
|
+
text: d.slice(at, at + 60),
|
|
15042
|
+
names: [],
|
|
15043
|
+
literalRead: false,
|
|
15044
|
+
unread: [
|
|
15045
|
+
`"Returns" at "${d.slice(Math.max(0, at - 20), at + 20)}" does not open a sentence`
|
|
15046
|
+
]
|
|
15047
|
+
});
|
|
15048
|
+
continue;
|
|
15049
|
+
}
|
|
15050
|
+
const start = at + "Returns".length;
|
|
15051
|
+
const end = clauseEnd(d, start);
|
|
15052
|
+
const body = d.slice(start, end === -1 ? d.length : end);
|
|
15053
|
+
const text = `Returns${body}`;
|
|
15054
|
+
if (end === -1) {
|
|
15055
|
+
out.push({
|
|
15056
|
+
form: "prose",
|
|
15057
|
+
text,
|
|
15058
|
+
names: [],
|
|
15059
|
+
literalRead: false,
|
|
15060
|
+
unread: [`"${text}": unbalanced bracket`]
|
|
15061
|
+
});
|
|
15062
|
+
continue;
|
|
15063
|
+
}
|
|
15064
|
+
const names2 = [];
|
|
15065
|
+
const unread2 = [];
|
|
15066
|
+
if (/^\s*\{/.test(body)) {
|
|
15067
|
+
let first = true;
|
|
15068
|
+
for (let j = 0; j < body.length; j++) {
|
|
15069
|
+
const c = body[j];
|
|
15070
|
+
if (!OPEN2[c]) continue;
|
|
15071
|
+
const k = closeOf2(body, j);
|
|
15072
|
+
if (c === "{") {
|
|
15073
|
+
if (!first && !/\bor\s*$/.test(body.slice(0, j)))
|
|
15074
|
+
unread2.push(`"${body.slice(j, k + 1)}": a second literal not introduced by "or"`);
|
|
15075
|
+
else {
|
|
15076
|
+
const r = literalNames(body.slice(j + 1, k));
|
|
15077
|
+
names2.push(...r.names);
|
|
15078
|
+
unread2.push(...r.unread.map((u) => `"${text}": ${u}`));
|
|
15079
|
+
}
|
|
15080
|
+
first = false;
|
|
15081
|
+
}
|
|
15082
|
+
j = k;
|
|
15083
|
+
}
|
|
15084
|
+
names2.push(...plusNames(body.replace(/\{[\s\S]*\}/, "")));
|
|
15085
|
+
out.push({
|
|
15086
|
+
form: "object-literal",
|
|
15087
|
+
text,
|
|
15088
|
+
names: [...new Set(names2)],
|
|
15089
|
+
// A member it could not read may be any property: the "left out" direction is then not judged.
|
|
15090
|
+
literalRead: unread2.length === 0,
|
|
15091
|
+
unread: unread2
|
|
15092
|
+
});
|
|
15093
|
+
continue;
|
|
15094
|
+
}
|
|
15095
|
+
let literal = false;
|
|
15096
|
+
let list = false;
|
|
15097
|
+
for (let j = 0; j < body.length; j++) {
|
|
15098
|
+
const c = body[j];
|
|
15099
|
+
if (!OPEN2[c]) continue;
|
|
15100
|
+
const k = closeOf2(body, j);
|
|
15101
|
+
const group = body.slice(j, k + 1);
|
|
15102
|
+
if (c === "{") {
|
|
15103
|
+
literal = true;
|
|
15104
|
+
unread2.push(
|
|
15105
|
+
`"${text}": an object literal inside prose (${group}) cannot be placed at the top level`
|
|
15106
|
+
);
|
|
15107
|
+
} else if (c === "(") {
|
|
15108
|
+
const members3 = splitTop2(group.slice(1, -1));
|
|
15109
|
+
const named = new RegExp(`^(${IDENT3})\\??(?:\\s*\\{[\\s\\S]*\\})?$`);
|
|
15110
|
+
const isName = members3.map((x) => named.exec(x)?.[1]);
|
|
15111
|
+
if (isName.every((x) => x !== void 0)) {
|
|
15112
|
+
list = true;
|
|
15113
|
+
names2.push(...isName);
|
|
15114
|
+
} else if (isName.some((x) => x !== void 0))
|
|
15115
|
+
unread2.push(
|
|
15116
|
+
`"${text}": the group ${group} mixes field names and prose (${members3.filter((_, i) => isName[i] === void 0).join(", ")})`
|
|
15117
|
+
);
|
|
15118
|
+
}
|
|
15119
|
+
j = k;
|
|
15120
|
+
}
|
|
15121
|
+
names2.push(...plusNames(body));
|
|
15122
|
+
out.push({
|
|
15123
|
+
form: literal ? "literal-in-prose" : list ? "field-list" : "prose",
|
|
15124
|
+
text,
|
|
15125
|
+
names: [...new Set(names2)],
|
|
15126
|
+
literalRead: false,
|
|
15127
|
+
unread: unread2
|
|
15128
|
+
});
|
|
15129
|
+
}
|
|
15130
|
+
return out;
|
|
15131
|
+
}
|
|
15132
|
+
function returnsAlignment(d, top, fields) {
|
|
15133
|
+
const clauses = returnsClauses(d);
|
|
15134
|
+
if (top === null) {
|
|
15135
|
+
const given = clauses.flatMap((c) => c.names);
|
|
15136
|
+
return {
|
|
15137
|
+
bad: [],
|
|
15138
|
+
notes: [],
|
|
15139
|
+
cnj: [
|
|
15140
|
+
...given.length > 0 ? [
|
|
15141
|
+
`outputSchema has no top-level properties object: the Returns clause names (${given.join(", ")}) and cannot be aligned`
|
|
15142
|
+
] : [],
|
|
15143
|
+
...clauses.flatMap((c) => c.unread)
|
|
15144
|
+
]
|
|
15145
|
+
};
|
|
15146
|
+
}
|
|
15147
|
+
const named = new Set(clauses.flatMap((c) => c.names));
|
|
15148
|
+
const bad = [...named].filter((k) => !top.includes(k)).map((k) => {
|
|
15149
|
+
const deeper = fields.find((f) => f.key === k)?.path;
|
|
15150
|
+
return deeper ? `${k}: named as returned, not in outputSchema at the top level (it is ${deeper})` : `${k}: named as returned, not in outputSchema`;
|
|
15151
|
+
});
|
|
15152
|
+
const left = new Set(
|
|
15153
|
+
clauses.filter((c) => c.literalRead).flatMap((c) => top.filter((p) => !c.names.includes(p)))
|
|
15154
|
+
);
|
|
15155
|
+
const notes = [...left].map(
|
|
15156
|
+
(p) => `${p} is a top-level property of the outputSchema that the Returns { \u2026 } literal does not name`
|
|
15157
|
+
);
|
|
15158
|
+
return { bad, notes, cnj: clauses.flatMap((c) => c.unread) };
|
|
14981
15159
|
}
|
|
14982
15160
|
var HINTS = ["readOnlyHint", "destructiveHint", "idempotentHint", "openWorldHint"];
|
|
14983
15161
|
function scoreTools(tools) {
|
|
@@ -15041,13 +15219,18 @@ function scoreTools(tools) {
|
|
|
15041
15219
|
);
|
|
15042
15220
|
else {
|
|
15043
15221
|
const fields = fieldsOf(output);
|
|
15044
|
-
const
|
|
15045
|
-
|
|
15046
|
-
|
|
15222
|
+
const top = isObj3(output.properties) ? Object.keys(output.properties) : null;
|
|
15223
|
+
const aligned = returnsAlignment(t.description ?? "", top, fields);
|
|
15224
|
+
const verdict3 = v(
|
|
15225
|
+
"output-described-aligned",
|
|
15226
|
+
[
|
|
15047
15227
|
...fields.filter((f) => !f.node || !desc(f.node).trim()).map((f) => `${f.path}: no description`),
|
|
15048
|
-
...
|
|
15049
|
-
]
|
|
15228
|
+
...aligned.bad
|
|
15229
|
+
],
|
|
15230
|
+
aligned.cnj
|
|
15050
15231
|
);
|
|
15232
|
+
if (aligned.notes.length > 0) verdict3.notes = aligned.notes;
|
|
15233
|
+
out.push(verdict3);
|
|
15051
15234
|
}
|
|
15052
15235
|
}
|
|
15053
15236
|
return out;
|
|
@@ -15095,6 +15278,10 @@ function runServed4(runtime) {
|
|
|
15095
15278
|
const head = `${runtime.tools.length} served tool(s) x ${CRITERIA.length} criteria \u2014 ${tally.join(" | ")}`;
|
|
15096
15279
|
const reds = lines2("non-conforming");
|
|
15097
15280
|
const unread2 = lines2("could-not-judge");
|
|
15281
|
+
const noted = verdicts.filter((x) => (x.notes ?? []).length > 0).map((x) => `${x.tool} ${x.criterion}: note: ${(x.notes ?? []).join("; ")}`);
|
|
15282
|
+
const noteBlock = noted.length > 0 ? `
|
|
15283
|
+
notes (not defects):
|
|
15284
|
+
${noted.join("\n")}` : "";
|
|
15098
15285
|
if (reds.length > 0)
|
|
15099
15286
|
return {
|
|
15100
15287
|
id: ID8,
|
|
@@ -15103,12 +15290,12 @@ function runServed4(runtime) {
|
|
|
15103
15290
|
verdict: `${RULE8}: ${head}
|
|
15104
15291
|
${reds.join("\n")}${unread2.length > 0 ? `
|
|
15105
15292
|
could not judge:
|
|
15106
|
-
${unread2.join("\n")}` : ""}`
|
|
15293
|
+
${unread2.join("\n")}` : ""}${noteBlock}`
|
|
15107
15294
|
};
|
|
15108
15295
|
if (unread2.length > 0)
|
|
15109
15296
|
return couldNotJudge(ID8, anchor, `${head}
|
|
15110
|
-
${unread2.join("\n")} (${RULE8})`);
|
|
15111
|
-
return { id: ID8, anchor, state: "present", verdict: `${head} (${RULE8})` };
|
|
15297
|
+
${unread2.join("\n")}${noteBlock} (${RULE8})`);
|
|
15298
|
+
return { id: ID8, anchor, state: "present", verdict: `${head}${noteBlock} (${RULE8})` };
|
|
15112
15299
|
}
|
|
15113
15300
|
var c40ToolDocumentation = {
|
|
15114
15301
|
id: ID8,
|
|
@@ -15118,6 +15305,290 @@ var c40ToolDocumentation = {
|
|
|
15118
15305
|
runServed: runServed4
|
|
15119
15306
|
};
|
|
15120
15307
|
|
|
15308
|
+
// src/detectors/c41-vantageos-latest.ts
|
|
15309
|
+
import { spawnSync as spawnSync2 } from "child_process";
|
|
15310
|
+
import { readFileSync as readFileSync16, readdirSync as readdirSync12 } from "fs";
|
|
15311
|
+
import { join as join18, relative as relative9, sep as sep6 } from "path";
|
|
15312
|
+
var RULE9 = "C-41";
|
|
15313
|
+
var SCOPE = "@vantageos/";
|
|
15314
|
+
var FIELDS = [
|
|
15315
|
+
"dependencies",
|
|
15316
|
+
"devDependencies",
|
|
15317
|
+
"peerDependencies",
|
|
15318
|
+
"optionalDependencies"
|
|
15319
|
+
];
|
|
15320
|
+
var NON_REGISTRY_SPEC = /^(?:file|link|workspace|portal|patch|git|git\+[a-z]+|github|gitlab|bitbucket|gist|https?|npm):/i;
|
|
15321
|
+
var OWNER_REPO_SHORTHAND = /^[^\s@/]+\/[^\s/]+$/;
|
|
15322
|
+
function rel(root, p) {
|
|
15323
|
+
return relative9(root, p).split(sep6).join("/") || ".";
|
|
15324
|
+
}
|
|
15325
|
+
function walkManifests(tree, dir, out, unread2) {
|
|
15326
|
+
let entries;
|
|
15327
|
+
try {
|
|
15328
|
+
entries = readdirSync12(dir, { withFileTypes: true });
|
|
15329
|
+
} catch (e) {
|
|
15330
|
+
unread2.push({
|
|
15331
|
+
manifest: `${rel(tree.root, dir)}/`,
|
|
15332
|
+
reason: `directory unreadable (${fsErrorCode(e)})`
|
|
15333
|
+
});
|
|
15334
|
+
return;
|
|
15335
|
+
}
|
|
15336
|
+
for (const e of entries) {
|
|
15337
|
+
const p = join18(dir, e.name);
|
|
15338
|
+
if (e.isDirectory()) {
|
|
15339
|
+
if (SKIP_DIRS.has(e.name)) {
|
|
15340
|
+
recordSkip(tree, p, tree.root);
|
|
15341
|
+
continue;
|
|
15342
|
+
}
|
|
15343
|
+
walkManifests(tree, p, out, unread2);
|
|
15344
|
+
} else if (e.isFile() && e.name === "package.json") {
|
|
15345
|
+
out.push(p);
|
|
15346
|
+
}
|
|
15347
|
+
}
|
|
15348
|
+
}
|
|
15349
|
+
function lineOf2(text, pkg) {
|
|
15350
|
+
const i = text.split("\n").findIndex((l) => l.includes(`"${pkg}"`));
|
|
15351
|
+
return i < 0 ? 1 : i + 1;
|
|
15352
|
+
}
|
|
15353
|
+
function parseVantageosAlias(spec) {
|
|
15354
|
+
const m = /^npm:(@vantageos\/[^@\s]+)(?:@(.*))?$/.exec(spec.trim());
|
|
15355
|
+
if (!m) return void 0;
|
|
15356
|
+
return { pkg: m[1], spec: m[2] === void 0 || m[2].trim() === "" ? "*" : m[2].trim() };
|
|
15357
|
+
}
|
|
15358
|
+
function c41Collect(tree) {
|
|
15359
|
+
const files = [];
|
|
15360
|
+
const unreadable2 = [];
|
|
15361
|
+
walkManifests(tree, tree.root, files, unreadable2);
|
|
15362
|
+
const decls = [];
|
|
15363
|
+
for (const file of files.sort()) {
|
|
15364
|
+
const manifest = rel(tree.root, file);
|
|
15365
|
+
let text;
|
|
15366
|
+
let json;
|
|
15367
|
+
try {
|
|
15368
|
+
text = readFileSync16(file, "utf8");
|
|
15369
|
+
json = JSON.parse(text);
|
|
15370
|
+
} catch (e) {
|
|
15371
|
+
unreadable2.push({ manifest, reason: e instanceof Error ? e.message : String(e) });
|
|
15372
|
+
continue;
|
|
15373
|
+
}
|
|
15374
|
+
if (typeof json !== "object" || json === null || Array.isArray(json)) {
|
|
15375
|
+
unreadable2.push({ manifest, reason: "not a JSON object" });
|
|
15376
|
+
continue;
|
|
15377
|
+
}
|
|
15378
|
+
for (const field of FIELDS) {
|
|
15379
|
+
const block = json[field];
|
|
15380
|
+
if (block === void 0) continue;
|
|
15381
|
+
if (typeof block !== "object" || block === null || Array.isArray(block)) {
|
|
15382
|
+
unreadable2.push({ manifest, reason: `${field} is not an object` });
|
|
15383
|
+
continue;
|
|
15384
|
+
}
|
|
15385
|
+
for (const [pkg, spec] of Object.entries(block)) {
|
|
15386
|
+
const alias = typeof spec === "string" ? parseVantageosAlias(spec) : void 0;
|
|
15387
|
+
if (alias) {
|
|
15388
|
+
decls.push({
|
|
15389
|
+
manifest,
|
|
15390
|
+
line: lineOf2(text, pkg),
|
|
15391
|
+
field: `${field} (alias ${pkg})`,
|
|
15392
|
+
pkg: alias.pkg,
|
|
15393
|
+
spec: alias.spec
|
|
15394
|
+
});
|
|
15395
|
+
continue;
|
|
15396
|
+
}
|
|
15397
|
+
if (!pkg.startsWith(SCOPE)) continue;
|
|
15398
|
+
decls.push({ manifest, line: lineOf2(text, pkg), field, pkg, spec });
|
|
15399
|
+
}
|
|
15400
|
+
}
|
|
15401
|
+
}
|
|
15402
|
+
return { decls, unreadable: unreadable2 };
|
|
15403
|
+
}
|
|
15404
|
+
function isRegistrySpec(spec) {
|
|
15405
|
+
const s = spec.trim();
|
|
15406
|
+
return !NON_REGISTRY_SPEC.test(s) && !OWNER_REPO_SHORTHAND.test(s) && !s.includes("://");
|
|
15407
|
+
}
|
|
15408
|
+
function c41JudgeDeclarations(id, { decls, unreadable: unreadable2 }, resolver) {
|
|
15409
|
+
const lagging = [];
|
|
15410
|
+
const unjudged = unreadable2.map((u) => ({
|
|
15411
|
+
anchor: u.manifest,
|
|
15412
|
+
reason: `${u.manifest} could not be read (${u.reason})`
|
|
15413
|
+
}));
|
|
15414
|
+
let firstLagAnchor;
|
|
15415
|
+
for (const d of decls) {
|
|
15416
|
+
const anchor = `${d.manifest}:${d.line}`;
|
|
15417
|
+
const where = `${d.manifest} ${d.field}`;
|
|
15418
|
+
if (typeof d.spec !== "string") {
|
|
15419
|
+
unjudged.push({
|
|
15420
|
+
anchor,
|
|
15421
|
+
reason: `${d.pkg} in ${where} has a non-string spec (${JSON.stringify(d.spec)})`
|
|
15422
|
+
});
|
|
15423
|
+
continue;
|
|
15424
|
+
}
|
|
15425
|
+
if (!isRegistrySpec(d.spec)) {
|
|
15426
|
+
unjudged.push({
|
|
15427
|
+
anchor,
|
|
15428
|
+
reason: `${d.pkg} in ${where} is declared as "${d.spec}", not a registry spec: which published version it installs is not decidable from the registry`
|
|
15429
|
+
});
|
|
15430
|
+
continue;
|
|
15431
|
+
}
|
|
15432
|
+
const latest = resolver.latest(d.pkg);
|
|
15433
|
+
if (!latest.ok) {
|
|
15434
|
+
unjudged.push({
|
|
15435
|
+
anchor,
|
|
15436
|
+
reason: `registry did not give the latest version of ${d.pkg} (${latest.reason})`
|
|
15437
|
+
});
|
|
15438
|
+
continue;
|
|
15439
|
+
}
|
|
15440
|
+
const selected = resolver.satisfying(d.pkg, d.spec);
|
|
15441
|
+
if (!selected.ok) {
|
|
15442
|
+
unjudged.push({
|
|
15443
|
+
anchor,
|
|
15444
|
+
reason: `registry did not give the versions "${d.spec}" selects for ${d.pkg} (${selected.reason})`
|
|
15445
|
+
});
|
|
15446
|
+
continue;
|
|
15447
|
+
}
|
|
15448
|
+
if (!selected.value.includes(latest.value)) {
|
|
15449
|
+
lagging.push(
|
|
15450
|
+
`${d.pkg} "${d.spec}" does not accept latest ${latest.value} (${where}, ${anchor})`
|
|
15451
|
+
);
|
|
15452
|
+
firstLagAnchor ??= anchor;
|
|
15453
|
+
}
|
|
15454
|
+
}
|
|
15455
|
+
if (lagging.length > 0) {
|
|
15456
|
+
const tail = unjudged.length > 0 ? `; ${unjudged.length} other declaration(s) not judged: ${unjudged.map((u) => u.reason).join("; ")}` : "";
|
|
15457
|
+
return {
|
|
15458
|
+
id,
|
|
15459
|
+
anchor: firstLagAnchor ?? "-",
|
|
15460
|
+
state: "non-conforming",
|
|
15461
|
+
verdict: `${lagging.length} @vantageos/* dependenc${lagging.length === 1 ? "y is" : "ies are"} behind latest: ${lagging.join("; ")}${tail} (${RULE9})`
|
|
15462
|
+
};
|
|
15463
|
+
}
|
|
15464
|
+
if (unjudged.length > 0) {
|
|
15465
|
+
return couldNotJudge(
|
|
15466
|
+
id,
|
|
15467
|
+
unjudged[0].anchor,
|
|
15468
|
+
`${unjudged.length} @vantageos/* declaration(s) not judged: ${unjudged.map((u) => u.reason).join("; ")} (${RULE9})`
|
|
15469
|
+
);
|
|
15470
|
+
}
|
|
15471
|
+
if (decls.length === 0) {
|
|
15472
|
+
return {
|
|
15473
|
+
id,
|
|
15474
|
+
anchor: "-",
|
|
15475
|
+
state: "absent",
|
|
15476
|
+
verdict: `no @vantageos/* dependency declared in any package.json; ${RULE9} does not oblige (said aloud)`
|
|
15477
|
+
};
|
|
15478
|
+
}
|
|
15479
|
+
return {
|
|
15480
|
+
id,
|
|
15481
|
+
anchor: `${decls[0].manifest}:${decls[0].line}`,
|
|
15482
|
+
state: "present",
|
|
15483
|
+
verdict: `${decls.length} @vantageos/* declaration(s), each accepting the registry's latest (${RULE9})`
|
|
15484
|
+
};
|
|
15485
|
+
}
|
|
15486
|
+
function c41Judge(tree, resolver) {
|
|
15487
|
+
return c41JudgeDeclarations(c41VantageosLatest.id, c41Collect(tree), resolver);
|
|
15488
|
+
}
|
|
15489
|
+
function npmView(args, registry, timeoutMs) {
|
|
15490
|
+
const full = [
|
|
15491
|
+
"view",
|
|
15492
|
+
...args,
|
|
15493
|
+
"--json",
|
|
15494
|
+
"--fetch-retries=0",
|
|
15495
|
+
...registry ? [`--registry=${registry}`] : []
|
|
15496
|
+
];
|
|
15497
|
+
const r = spawnSync2("npm", full, { encoding: "utf8", timeout: timeoutMs });
|
|
15498
|
+
if (r.error) return { ok: false, reason: `npm ${full.join(" ")}: ${r.error.message}` };
|
|
15499
|
+
let parsed;
|
|
15500
|
+
try {
|
|
15501
|
+
parsed = r.stdout.trim() === "" ? void 0 : JSON.parse(r.stdout);
|
|
15502
|
+
} catch {
|
|
15503
|
+
return { ok: false, reason: `npm ${args.join(" ")}: unparseable reply (exit ${r.status})` };
|
|
15504
|
+
}
|
|
15505
|
+
if (r.status !== 0) {
|
|
15506
|
+
const err = parsed?.error;
|
|
15507
|
+
const summary = err?.summary ?? (r.stderr.split("\n").find((l) => l.includes("error")) || `exit ${r.status}`);
|
|
15508
|
+
if (err?.code === "E404" && /^No match found for version/.test(err.summary ?? "")) {
|
|
15509
|
+
return { ok: false, reason: summary, noMatch: true };
|
|
15510
|
+
}
|
|
15511
|
+
return { ok: false, reason: `npm ${args.join(" ")}: ${err?.code ?? ""} ${summary}`.trim() };
|
|
15512
|
+
}
|
|
15513
|
+
if (parsed === void 0) return { ok: false, reason: `npm ${args.join(" ")}: empty reply` };
|
|
15514
|
+
return { ok: true, value: parsed };
|
|
15515
|
+
}
|
|
15516
|
+
function npmResolver(opts = {}) {
|
|
15517
|
+
const timeoutMs = opts.timeoutMs ?? 3e4;
|
|
15518
|
+
const latestCache = /* @__PURE__ */ new Map();
|
|
15519
|
+
const setCache = /* @__PURE__ */ new Map();
|
|
15520
|
+
return {
|
|
15521
|
+
latest(pkg) {
|
|
15522
|
+
const hit = latestCache.get(pkg);
|
|
15523
|
+
if (hit) return hit;
|
|
15524
|
+
const r = npmView([pkg, "dist-tags.latest"], opts.registry, timeoutMs);
|
|
15525
|
+
const out = !r.ok ? { ok: false, reason: r.reason } : typeof r.value === "string" ? { ok: true, value: r.value } : {
|
|
15526
|
+
ok: false,
|
|
15527
|
+
reason: `npm view ${pkg} dist-tags.latest: not a version (${JSON.stringify(r.value)})`
|
|
15528
|
+
};
|
|
15529
|
+
if (out.ok) latestCache.set(pkg, out);
|
|
15530
|
+
return out;
|
|
15531
|
+
},
|
|
15532
|
+
satisfying(pkg, spec) {
|
|
15533
|
+
const key = `${pkg}@${spec}`;
|
|
15534
|
+
const hit = setCache.get(key);
|
|
15535
|
+
if (hit) return hit;
|
|
15536
|
+
const r = npmView([key, "version"], opts.registry, timeoutMs);
|
|
15537
|
+
let out;
|
|
15538
|
+
if (!r.ok) out = "noMatch" in r ? { ok: true, value: [] } : { ok: false, reason: r.reason };
|
|
15539
|
+
else if (typeof r.value === "string") out = { ok: true, value: [r.value] };
|
|
15540
|
+
else if (Array.isArray(r.value) && r.value.every((v) => typeof v === "string"))
|
|
15541
|
+
out = { ok: true, value: r.value };
|
|
15542
|
+
else
|
|
15543
|
+
out = {
|
|
15544
|
+
ok: false,
|
|
15545
|
+
reason: `npm view ${key} version: not a version list (${JSON.stringify(r.value)})`
|
|
15546
|
+
};
|
|
15547
|
+
if (out.ok) setCache.set(key, out);
|
|
15548
|
+
return out;
|
|
15549
|
+
}
|
|
15550
|
+
};
|
|
15551
|
+
}
|
|
15552
|
+
function c41PositiveControls() {
|
|
15553
|
+
const decl = (spec) => ({
|
|
15554
|
+
manifest: "package.json",
|
|
15555
|
+
line: 1,
|
|
15556
|
+
field: "dependencies",
|
|
15557
|
+
pkg: "@vantageos/x",
|
|
15558
|
+
spec
|
|
15559
|
+
});
|
|
15560
|
+
const reg = {
|
|
15561
|
+
latest: () => ({ ok: true, value: "1.1.0" }),
|
|
15562
|
+
satisfying: (_p, s) => ({ ok: true, value: s === "^1.0.0" ? ["1.0.0", "1.1.0"] : ["0.9.0"] })
|
|
15563
|
+
};
|
|
15564
|
+
const dead = {
|
|
15565
|
+
latest: () => ({ ok: false, reason: "offline" }),
|
|
15566
|
+
satisfying: () => ({ ok: false, reason: "offline" })
|
|
15567
|
+
};
|
|
15568
|
+
const cases = [
|
|
15569
|
+
["lag", { decls: [decl("^0.9.0")], unreadable: [] }, reg, "non-conforming"],
|
|
15570
|
+
["accepts", { decls: [decl("^1.0.0")], unreadable: [] }, reg, "present"],
|
|
15571
|
+
["offline", { decls: [decl("^1.0.0")], unreadable: [] }, dead, "could-not-judge"],
|
|
15572
|
+
["file spec", { decls: [decl("file:../x")], unreadable: [] }, reg, "could-not-judge"],
|
|
15573
|
+
["none", { decls: [], unreadable: [] }, reg, "absent"]
|
|
15574
|
+
];
|
|
15575
|
+
for (const [name, input, resolver, want] of cases) {
|
|
15576
|
+
const got = c41JudgeDeclarations("C41 control", input, resolver).state;
|
|
15577
|
+
if (got !== want)
|
|
15578
|
+
throw new Error(`C41 positive control "${name}": expected ${want}, got ${got}`);
|
|
15579
|
+
}
|
|
15580
|
+
}
|
|
15581
|
+
var c41VantageosLatest = {
|
|
15582
|
+
id: "C41 vantageos-latest",
|
|
15583
|
+
rule: RULE9,
|
|
15584
|
+
pin: C41_RULES_PIN,
|
|
15585
|
+
run(tree) {
|
|
15586
|
+
c41PositiveControls();
|
|
15587
|
+
return c41Judge(tree, defaultResolver);
|
|
15588
|
+
}
|
|
15589
|
+
};
|
|
15590
|
+
var defaultResolver = npmResolver();
|
|
15591
|
+
|
|
15121
15592
|
// src/detectors/d2.ts
|
|
15122
15593
|
var SESSION_RE = /mcp-session-id/i;
|
|
15123
15594
|
var GENERATOR_RE = /\bsessionIdGenerator\s*:\s*(?!undefined\b)\S/;
|
|
@@ -16007,7 +16478,7 @@ var d6 = {
|
|
|
16007
16478
|
|
|
16008
16479
|
// src/detectors/d8.ts
|
|
16009
16480
|
import { existsSync as existsSync12, statSync as statSync15 } from "fs";
|
|
16010
|
-
import { dirname as dirname6, join as
|
|
16481
|
+
import { dirname as dirname6, join as join19, relative as relative10 } from "path";
|
|
16011
16482
|
var POSITIVE_CONTROL2 = 'server.registerTool("list_items", { ... }, handler);';
|
|
16012
16483
|
function d8PositiveControl() {
|
|
16013
16484
|
return {
|
|
@@ -16027,7 +16498,7 @@ function resolveBaseDir(tree) {
|
|
|
16027
16498
|
function findEvalsFile(tree) {
|
|
16028
16499
|
let dir = resolveBaseDir(tree);
|
|
16029
16500
|
for (let depth = 0; depth < 8; depth++) {
|
|
16030
|
-
const candidate =
|
|
16501
|
+
const candidate = join19(dir, "evals", "evals.json");
|
|
16031
16502
|
if (existsSync12(candidate)) return candidate;
|
|
16032
16503
|
const parent = dirname6(dir);
|
|
16033
16504
|
if (parent === dir) break;
|
|
@@ -16090,7 +16561,7 @@ var d8 = {
|
|
|
16090
16561
|
};
|
|
16091
16562
|
}
|
|
16092
16563
|
const baseDir = resolveBaseDir(tree);
|
|
16093
|
-
const displayPath =
|
|
16564
|
+
const displayPath = relative10(baseDir, evalsPath) || evalsPath;
|
|
16094
16565
|
const parsed = readJsonObject(evalsPath);
|
|
16095
16566
|
if (parsed === null || !Array.isArray(parsed.cases)) {
|
|
16096
16567
|
return couldNotJudge(
|
|
@@ -16181,7 +16652,7 @@ var d8 = {
|
|
|
16181
16652
|
|
|
16182
16653
|
// src/detectors/d9.ts
|
|
16183
16654
|
import { existsSync as existsSync13 } from "fs";
|
|
16184
|
-
import { dirname as dirname7, join as
|
|
16655
|
+
import { dirname as dirname7, join as join20 } from "path";
|
|
16185
16656
|
var SEMVER_RE = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
|
|
16186
16657
|
var POSITIVE_CONTROL3 = "1.2.3-beta.1+build.7";
|
|
16187
16658
|
function d9PositiveControl() {
|
|
@@ -16230,7 +16701,7 @@ var d9Inner = {
|
|
|
16230
16701
|
};
|
|
16231
16702
|
}
|
|
16232
16703
|
const projectDir = dirname7(pkgPath);
|
|
16233
|
-
const changelogPath =
|
|
16704
|
+
const changelogPath = join20(projectDir, "CHANGELOG.md");
|
|
16234
16705
|
const hasChangelog = existsSync13(changelogPath);
|
|
16235
16706
|
const validSemver = SEMVER_RE.test(version);
|
|
16236
16707
|
if (validSemver && hasChangelog) {
|
|
@@ -16261,7 +16732,7 @@ var d9 = guardUnreadablePackageJson(d9Inner, { authoritative: false });
|
|
|
16261
16732
|
|
|
16262
16733
|
// src/detectors/d10.ts
|
|
16263
16734
|
import { existsSync as existsSync14 } from "fs";
|
|
16264
|
-
import { dirname as dirname8, join as
|
|
16735
|
+
import { dirname as dirname8, join as join21 } from "path";
|
|
16265
16736
|
var DESCRIPTION_FR_RE = /"description_fr"\s*:\s*"[^"]+"/;
|
|
16266
16737
|
var POSITIVE_CONTROL4 = '"description_fr": "Un serveur MCP conforme.",';
|
|
16267
16738
|
function d10PositiveControl() {
|
|
@@ -16394,7 +16865,7 @@ var d10Inner = {
|
|
|
16394
16865
|
};
|
|
16395
16866
|
}
|
|
16396
16867
|
const hasDescriptionFr = hasDescriptionFrJson || sourceScan.present;
|
|
16397
|
-
const readmeFrPath =
|
|
16868
|
+
const readmeFrPath = join21(root, "README.fr.md");
|
|
16398
16869
|
const hasReadmeFr = existsSync14(readmeFrPath);
|
|
16399
16870
|
const missing = [];
|
|
16400
16871
|
if (!hasDescriptionFr) missing.push("description_fr (package.json or source _meta)");
|
|
@@ -16693,8 +17164,8 @@ var d15 = {
|
|
|
16693
17164
|
};
|
|
16694
17165
|
|
|
16695
17166
|
// src/detectors/d16.ts
|
|
16696
|
-
import { existsSync as existsSync15, readFileSync as
|
|
16697
|
-
import { dirname as dirname9, join as
|
|
17167
|
+
import { existsSync as existsSync15, readFileSync as readFileSync17, statSync as statSync16 } from "fs";
|
|
17168
|
+
import { dirname as dirname9, join as join22 } from "path";
|
|
16698
17169
|
var DISCOVER_RE2 = /server\/discover|DiscoverResult|ServerDiscover|handleServerDiscover/;
|
|
16699
17170
|
var HEALTH_ROUTE_FRAMEWORK_RE = /\b[A-Za-z_$][\w$]*\.(?:get|post|put|patch|delete|all|route|use)\s*\(\s*["'`][^"'`]*\/health/;
|
|
16700
17171
|
var HEALTH_ROUTE_RAWPATH_RE = /\bpathname\s*===?\s*["'`][^"'`]*\/health/;
|
|
@@ -16778,7 +17249,7 @@ function manifestVersionEqualsPackage(tree) {
|
|
|
16778
17249
|
if (typeof pkgVersion !== "string" || pkgVersion.length === 0 || !tree.packageJson) return false;
|
|
16779
17250
|
try {
|
|
16780
17251
|
const manifest = JSON.parse(
|
|
16781
|
-
|
|
17252
|
+
readFileSync17(join22(dirname9(tree.packageJson.path), "mcp-server.json"), "utf8")
|
|
16782
17253
|
);
|
|
16783
17254
|
return manifest.version === pkgVersion;
|
|
16784
17255
|
} catch {
|
|
@@ -17066,10 +17537,10 @@ function readPackageVersion(root) {
|
|
|
17066
17537
|
try {
|
|
17067
17538
|
let dir = statSync16(root).isDirectory() ? root : dirname9(root);
|
|
17068
17539
|
for (let depth = 0; depth < 8; depth++) {
|
|
17069
|
-
const candidate =
|
|
17540
|
+
const candidate = join22(dir, "package.json");
|
|
17070
17541
|
if (existsSync15(candidate)) {
|
|
17071
17542
|
if (!statSync16(candidate).isFile()) return null;
|
|
17072
|
-
const pkg = JSON.parse(
|
|
17543
|
+
const pkg = JSON.parse(readFileSync17(candidate, "utf8"));
|
|
17073
17544
|
return typeof pkg.version === "string" ? pkg.version : null;
|
|
17074
17545
|
}
|
|
17075
17546
|
const parent = dirname9(dir);
|
|
@@ -17083,8 +17554,8 @@ function readPackageVersion(root) {
|
|
|
17083
17554
|
}
|
|
17084
17555
|
|
|
17085
17556
|
// src/detectors/dAppI18n.ts
|
|
17086
|
-
import { existsSync as existsSync16, readFileSync as
|
|
17087
|
-
import { dirname as dirname10, join as
|
|
17557
|
+
import { existsSync as existsSync16, readFileSync as readFileSync18, statSync as statSync17 } from "fs";
|
|
17558
|
+
import { dirname as dirname10, join as join23 } from "path";
|
|
17088
17559
|
function flattenKeys(obj, prefix = "") {
|
|
17089
17560
|
if (obj === null || typeof obj !== "object" || Array.isArray(obj)) {
|
|
17090
17561
|
return prefix ? [prefix] : [];
|
|
@@ -17118,7 +17589,7 @@ function dAppI18nPositiveControls() {
|
|
|
17118
17589
|
function readJson3(path) {
|
|
17119
17590
|
try {
|
|
17120
17591
|
if (!statSync17(path).isFile()) return { ok: false };
|
|
17121
|
-
return { ok: true, value: JSON.parse(
|
|
17592
|
+
return { ok: true, value: JSON.parse(readFileSync18(path, "utf8")) };
|
|
17122
17593
|
} catch {
|
|
17123
17594
|
return { ok: false };
|
|
17124
17595
|
}
|
|
@@ -17135,9 +17606,9 @@ var dAppI18n = {
|
|
|
17135
17606
|
);
|
|
17136
17607
|
}
|
|
17137
17608
|
const root = tree.packageJson ? dirname10(tree.packageJson.path) : tree.root;
|
|
17138
|
-
const i18nDir =
|
|
17139
|
-
const enPath =
|
|
17140
|
-
const frPath =
|
|
17609
|
+
const i18nDir = join23(root, "i18n");
|
|
17610
|
+
const enPath = join23(i18nDir, "en.json");
|
|
17611
|
+
const frPath = join23(i18nDir, "fr.json");
|
|
17141
17612
|
const hasI18n = existsSync16(i18nDir);
|
|
17142
17613
|
const hasFr = existsSync16(frPath);
|
|
17143
17614
|
if (!hasI18n && !hasFr) {
|
|
@@ -17316,27 +17787,27 @@ var dDebugOptIn = {
|
|
|
17316
17787
|
};
|
|
17317
17788
|
|
|
17318
17789
|
// src/detectors/extManifests.ts
|
|
17319
|
-
import { readdirSync as
|
|
17320
|
-
import { join as
|
|
17790
|
+
import { readdirSync as readdirSync13, statSync as statSync18 } from "fs";
|
|
17791
|
+
import { join as join24 } from "path";
|
|
17321
17792
|
function findExtensionManifests(tree) {
|
|
17322
17793
|
const out = [];
|
|
17323
17794
|
const root = tree.root;
|
|
17324
17795
|
let base;
|
|
17325
17796
|
try {
|
|
17326
|
-
base = statSync18(root).isDirectory() ? root :
|
|
17797
|
+
base = statSync18(root).isDirectory() ? root : join24(root, "..");
|
|
17327
17798
|
} catch {
|
|
17328
17799
|
return out;
|
|
17329
17800
|
}
|
|
17330
17801
|
const walk3 = (dir) => {
|
|
17331
17802
|
let entries;
|
|
17332
17803
|
try {
|
|
17333
|
-
entries =
|
|
17804
|
+
entries = readdirSync13(dir);
|
|
17334
17805
|
} catch (err) {
|
|
17335
17806
|
recordSkip(tree, dir, base, `could not be listed (${fsErrorCode(err)}) \u2014 not read`);
|
|
17336
17807
|
return;
|
|
17337
17808
|
}
|
|
17338
17809
|
for (const name of entries) {
|
|
17339
|
-
const full =
|
|
17810
|
+
const full = join24(dir, name);
|
|
17340
17811
|
let st;
|
|
17341
17812
|
try {
|
|
17342
17813
|
st = statSync18(full);
|
|
@@ -17364,8 +17835,8 @@ function findExtensionManifests(tree) {
|
|
|
17364
17835
|
}
|
|
17365
17836
|
|
|
17366
17837
|
// src/detectors/vendorRegistry.ts
|
|
17367
|
-
import { existsSync as existsSync17, readFileSync as
|
|
17368
|
-
import { dirname as dirname11, join as
|
|
17838
|
+
import { existsSync as existsSync17, readFileSync as readFileSync19 } from "fs";
|
|
17839
|
+
import { dirname as dirname11, join as join25 } from "path";
|
|
17369
17840
|
import { fileURLToPath } from "url";
|
|
17370
17841
|
function locateRegistry() {
|
|
17371
17842
|
let dir;
|
|
@@ -17375,7 +17846,7 @@ function locateRegistry() {
|
|
|
17375
17846
|
return null;
|
|
17376
17847
|
}
|
|
17377
17848
|
for (let depth = 0; depth < 5; depth++) {
|
|
17378
|
-
const candidate =
|
|
17849
|
+
const candidate = join25(dir, "vendor-namespaces.json");
|
|
17379
17850
|
if (existsSync17(candidate)) return candidate;
|
|
17380
17851
|
const parent = dirname11(dir);
|
|
17381
17852
|
if (parent === dir) break;
|
|
@@ -17393,7 +17864,7 @@ function loadRegistry(path) {
|
|
|
17393
17864
|
}
|
|
17394
17865
|
let parsed;
|
|
17395
17866
|
try {
|
|
17396
|
-
parsed = JSON.parse(
|
|
17867
|
+
parsed = JSON.parse(readFileSync19(p, "utf8"));
|
|
17397
17868
|
} catch (err) {
|
|
17398
17869
|
return {
|
|
17399
17870
|
ok: false,
|
|
@@ -18023,8 +18494,8 @@ var dExt3 = {
|
|
|
18023
18494
|
};
|
|
18024
18495
|
|
|
18025
18496
|
// src/detectors/dExt4.ts
|
|
18026
|
-
import { readdirSync as
|
|
18027
|
-
import { join as
|
|
18497
|
+
import { readdirSync as readdirSync14, statSync as statSync19 } from "fs";
|
|
18498
|
+
import { join as join26, relative as relative11 } from "path";
|
|
18028
18499
|
function canonical(name) {
|
|
18029
18500
|
return name.replace(/[-_]/g, "").toLowerCase();
|
|
18030
18501
|
}
|
|
@@ -18048,13 +18519,13 @@ function findHooksDirs(tree, unreadable2, gaps) {
|
|
|
18048
18519
|
const out = [];
|
|
18049
18520
|
let base;
|
|
18050
18521
|
try {
|
|
18051
|
-
base = statSync19(root).isDirectory() ? root :
|
|
18522
|
+
base = statSync19(root).isDirectory() ? root : join26(root, "..");
|
|
18052
18523
|
} catch {
|
|
18053
18524
|
return out;
|
|
18054
18525
|
}
|
|
18055
18526
|
const noteUnread = (path, what, err) => {
|
|
18056
18527
|
gaps.count++;
|
|
18057
|
-
const anchor =
|
|
18528
|
+
const anchor = relative11(base, path) || ".";
|
|
18058
18529
|
const reason = `${anchor} ${what} (${fsErrorCode(err)}) \u2014 a hooks/ directory under it may exist unseen, so the implemented hooks are unverifiable (Extension Rule 4)`;
|
|
18059
18530
|
if (!unreadable2.some((u) => u.anchor === anchor && u.reason === reason)) {
|
|
18060
18531
|
unreadable2.push({ anchor, reason });
|
|
@@ -18063,13 +18534,13 @@ function findHooksDirs(tree, unreadable2, gaps) {
|
|
|
18063
18534
|
const walk3 = (dir) => {
|
|
18064
18535
|
let entries;
|
|
18065
18536
|
try {
|
|
18066
|
-
entries =
|
|
18537
|
+
entries = readdirSync14(dir);
|
|
18067
18538
|
} catch (err) {
|
|
18068
18539
|
noteUnread(dir, "could not be listed", err);
|
|
18069
18540
|
return;
|
|
18070
18541
|
}
|
|
18071
18542
|
for (const name of entries) {
|
|
18072
|
-
const full =
|
|
18543
|
+
const full = join26(dir, name);
|
|
18073
18544
|
let st;
|
|
18074
18545
|
try {
|
|
18075
18546
|
st = statSync19(full);
|
|
@@ -18087,7 +18558,7 @@ function findHooksDirs(tree, unreadable2, gaps) {
|
|
|
18087
18558
|
const tokens = /* @__PURE__ */ new Set();
|
|
18088
18559
|
let files;
|
|
18089
18560
|
try {
|
|
18090
|
-
files =
|
|
18561
|
+
files = readdirSync14(full);
|
|
18091
18562
|
} catch (err) {
|
|
18092
18563
|
noteUnread(full, "could not be listed", err);
|
|
18093
18564
|
files = [];
|
|
@@ -18251,7 +18722,7 @@ var dExt4 = {
|
|
|
18251
18722
|
|
|
18252
18723
|
// src/detectors/dExt5.ts
|
|
18253
18724
|
import { existsSync as existsSync18 } from "fs";
|
|
18254
|
-
import { dirname as dirname12, join as
|
|
18725
|
+
import { dirname as dirname12, join as join27 } from "path";
|
|
18255
18726
|
function nonEmptyString(v) {
|
|
18256
18727
|
return typeof v === "string" && v.trim().length > 0;
|
|
18257
18728
|
}
|
|
@@ -18313,7 +18784,7 @@ var dExt5 = {
|
|
|
18313
18784
|
if (!nonEmptyString(parsed.description_fr)) {
|
|
18314
18785
|
missing.push("description_fr (extension.json)");
|
|
18315
18786
|
}
|
|
18316
|
-
if (!existsSync18(
|
|
18787
|
+
if (!existsSync18(join27(root, "README.fr.md"))) {
|
|
18317
18788
|
missing.push("README.fr.md");
|
|
18318
18789
|
}
|
|
18319
18790
|
if (isToolExtension(parsed.type) && "tools" in parsed) {
|
|
@@ -18357,7 +18828,7 @@ var dExt5 = {
|
|
|
18357
18828
|
|
|
18358
18829
|
// src/detectors/dExt7.ts
|
|
18359
18830
|
import { existsSync as existsSync19 } from "fs";
|
|
18360
|
-
import { dirname as dirname13, join as
|
|
18831
|
+
import { dirname as dirname13, join as join28 } from "path";
|
|
18361
18832
|
var ABSENCE_FLAG_FIELDS = [
|
|
18362
18833
|
"extensionAbsent",
|
|
18363
18834
|
"extension_absent",
|
|
@@ -18429,7 +18900,7 @@ var dExt7 = {
|
|
|
18429
18900
|
for (const manifestPath2 of manifests) {
|
|
18430
18901
|
const extDir = dirname13(manifestPath2);
|
|
18431
18902
|
const extLabel = extDir.split("/").pop() ?? extDir;
|
|
18432
|
-
const evalsPath =
|
|
18903
|
+
const evalsPath = join28(extDir, "evals", "evals.json");
|
|
18433
18904
|
const shortPath = `${extLabel}/evals/evals.json`;
|
|
18434
18905
|
if (!existsSync19(evalsPath)) {
|
|
18435
18906
|
return {
|
|
@@ -18496,7 +18967,7 @@ var dExt7 = {
|
|
|
18496
18967
|
|
|
18497
18968
|
// src/detectors/dExt8.ts
|
|
18498
18969
|
import { existsSync as existsSync20 } from "fs";
|
|
18499
|
-
import { dirname as dirname14, join as
|
|
18970
|
+
import { dirname as dirname14, join as join29 } from "path";
|
|
18500
18971
|
var SEMVER_RE2 = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
|
|
18501
18972
|
var POSITIVE_CONTROL5 = "1.2.3-beta.1+build.7";
|
|
18502
18973
|
function dExt8PositiveControl() {
|
|
@@ -18532,7 +19003,7 @@ var dExt8 = {
|
|
|
18532
19003
|
for (const manifestPath2 of manifests) {
|
|
18533
19004
|
const extDir = dirname14(manifestPath2);
|
|
18534
19005
|
const extLabel = extDir.split("/").pop() ?? extDir;
|
|
18535
|
-
const pkgPath =
|
|
19006
|
+
const pkgPath = join29(extDir, "package.json");
|
|
18536
19007
|
const shortPkgPath = `${extLabel}/package.json`;
|
|
18537
19008
|
if (!existsSync20(pkgPath)) {
|
|
18538
19009
|
unreadable2.push({
|
|
@@ -18569,7 +19040,7 @@ var dExt8 = {
|
|
|
18569
19040
|
continue;
|
|
18570
19041
|
}
|
|
18571
19042
|
const validSemver = SEMVER_RE2.test(version);
|
|
18572
|
-
const changelogPath =
|
|
19043
|
+
const changelogPath = join29(extDir, "CHANGELOG.md");
|
|
18573
19044
|
const hasChangelog = existsSync20(changelogPath);
|
|
18574
19045
|
if (!validSemver) {
|
|
18575
19046
|
finding ??= {
|
|
@@ -18604,20 +19075,20 @@ var dExt8 = {
|
|
|
18604
19075
|
};
|
|
18605
19076
|
|
|
18606
19077
|
// src/detectors/dExt9.ts
|
|
18607
|
-
import { readFileSync as
|
|
18608
|
-
import { join as
|
|
19078
|
+
import { readFileSync as readFileSync20, readdirSync as readdirSync15, statSync as statSync20 } from "fs";
|
|
19079
|
+
import { join as join30, relative as relative12 } from "path";
|
|
18609
19080
|
function collectHooksDirSources(tree, unreadable2, gaps) {
|
|
18610
19081
|
const root = tree.root;
|
|
18611
19082
|
const out = [];
|
|
18612
19083
|
let base;
|
|
18613
19084
|
try {
|
|
18614
|
-
base = statSync20(root).isDirectory() ? root :
|
|
19085
|
+
base = statSync20(root).isDirectory() ? root : join30(root, "..");
|
|
18615
19086
|
} catch {
|
|
18616
19087
|
return out;
|
|
18617
19088
|
}
|
|
18618
19089
|
const noteUnread = (path, what, err) => {
|
|
18619
19090
|
gaps.count++;
|
|
18620
|
-
const anchor =
|
|
19091
|
+
const anchor = relative12(base, path) || ".";
|
|
18621
19092
|
const reason = `${anchor} ${what} (${fsErrorCode(err)}) \u2014 a hooks/ directory under it may exist unseen, so the timeout guards are undeterminable (Extension Rule 9)`;
|
|
18622
19093
|
if (!unreadable2.some((u) => u.anchor === anchor && u.reason === reason)) {
|
|
18623
19094
|
unreadable2.push({ anchor, reason });
|
|
@@ -18626,13 +19097,13 @@ function collectHooksDirSources(tree, unreadable2, gaps) {
|
|
|
18626
19097
|
const walk3 = (dir) => {
|
|
18627
19098
|
let entries;
|
|
18628
19099
|
try {
|
|
18629
|
-
entries =
|
|
19100
|
+
entries = readdirSync15(dir);
|
|
18630
19101
|
} catch (err) {
|
|
18631
19102
|
noteUnread(dir, "could not be listed", err);
|
|
18632
19103
|
return;
|
|
18633
19104
|
}
|
|
18634
19105
|
for (const name of entries) {
|
|
18635
|
-
const full =
|
|
19106
|
+
const full = join30(dir, name);
|
|
18636
19107
|
let st;
|
|
18637
19108
|
try {
|
|
18638
19109
|
st = statSync20(full);
|
|
@@ -18649,7 +19120,7 @@ function collectHooksDirSources(tree, unreadable2, gaps) {
|
|
|
18649
19120
|
if (name === "hooks") {
|
|
18650
19121
|
let files;
|
|
18651
19122
|
try {
|
|
18652
|
-
files =
|
|
19123
|
+
files = readdirSync15(full);
|
|
18653
19124
|
} catch (err) {
|
|
18654
19125
|
noteUnread(full, "could not be listed", err);
|
|
18655
19126
|
files = [];
|
|
@@ -18658,11 +19129,11 @@ function collectHooksDirSources(tree, unreadable2, gaps) {
|
|
|
18658
19129
|
if (!f.endsWith(".ts") || f.endsWith(".d.ts")) continue;
|
|
18659
19130
|
const stem = f.replace(/\.ts$/, "");
|
|
18660
19131
|
if (stem === "index") continue;
|
|
18661
|
-
const filePath =
|
|
19132
|
+
const filePath = join30(full, f);
|
|
18662
19133
|
let body;
|
|
18663
19134
|
try {
|
|
18664
19135
|
if (!statSync20(filePath).isFile()) throw new Error("not a regular file");
|
|
18665
|
-
body =
|
|
19136
|
+
body = readFileSync20(filePath, "utf8");
|
|
18666
19137
|
} catch {
|
|
18667
19138
|
const shortPath = filePath.split("/").slice(-2).join("/");
|
|
18668
19139
|
unreadable2.push({
|
|
@@ -19754,7 +20225,7 @@ function codeText(file) {
|
|
|
19754
20225
|
}
|
|
19755
20226
|
return { file, text: parts.join(""), kind: Uint8Array.from(kinds), lineStart };
|
|
19756
20227
|
}
|
|
19757
|
-
function
|
|
20228
|
+
function lineOf3(ct, off) {
|
|
19758
20229
|
let lo = 0;
|
|
19759
20230
|
let hi = ct.lineStart.length - 1;
|
|
19760
20231
|
while (lo < hi) {
|
|
@@ -19880,8 +20351,8 @@ function on401Path(ct, siteStart, siteEnd) {
|
|
|
19880
20351
|
}
|
|
19881
20352
|
}
|
|
19882
20353
|
}
|
|
19883
|
-
const first = Math.max(1,
|
|
19884
|
-
const last = Math.min(ct.lineStart.length,
|
|
20354
|
+
const first = Math.max(1, lineOf3(ct, siteStart) - PATH_LINES_BEFORE);
|
|
20355
|
+
const last = Math.min(ct.lineStart.length, lineOf3(ct, siteEnd) + PATH_LINES_AFTER);
|
|
19885
20356
|
const from = Math.max(blockStart, ct.lineStart[first - 1]);
|
|
19886
20357
|
const to = Math.min(blockEnd2, last < ct.lineStart.length ? ct.lineStart[last] : t.length);
|
|
19887
20358
|
for (const m of t.slice(from, to).matchAll(/\b401\b/g)) {
|
|
@@ -19899,7 +20370,7 @@ function scanChallengeSites(files) {
|
|
|
19899
20370
|
const open = m.index ?? 0;
|
|
19900
20371
|
const close2 = open + m[0].length - 1;
|
|
19901
20372
|
if (ct.kind[open] !== 1 || ct.kind[close2] !== 1) continue;
|
|
19902
|
-
const anchor = `${file.rel}:${
|
|
20373
|
+
const anchor = `${file.rel}:${lineOf3(ct, open)}`;
|
|
19903
20374
|
const before = t.slice(Math.max(0, open - 200), open);
|
|
19904
20375
|
const after = t.slice(close2 + 1, close2 + 200);
|
|
19905
20376
|
let form = null;
|
|
@@ -20500,7 +20971,7 @@ function configPlaces(tree, reg) {
|
|
|
20500
20971
|
meta: placeOf(tree, config, "_meta")
|
|
20501
20972
|
};
|
|
20502
20973
|
}
|
|
20503
|
-
function
|
|
20974
|
+
function lineOf4(anchor) {
|
|
20504
20975
|
const i = anchor.lastIndexOf(":");
|
|
20505
20976
|
return [anchor.slice(0, i), Number(anchor.slice(i + 1))];
|
|
20506
20977
|
}
|
|
@@ -20606,8 +21077,8 @@ function judgeStatic(tree, id) {
|
|
|
20606
21077
|
to: fn ? lineAt(gate.src.shape, fn.close) : lineAt(gate.src.shape, gate.at) + 1
|
|
20607
21078
|
}));
|
|
20608
21079
|
regUnread = unread2.filter((u) => {
|
|
20609
|
-
const [
|
|
20610
|
-
return !spans.some((sp) => sp.rel ===
|
|
21080
|
+
const [rel2, n] = lineOf4(u.anchor);
|
|
21081
|
+
return !spans.some((sp) => sp.rel === rel2 && n >= sp.from && n <= sp.to);
|
|
20611
21082
|
});
|
|
20612
21083
|
for (const { gate, fn } of installers) {
|
|
20613
21084
|
const ex = gateExemptions(tree, gate, fn);
|
|
@@ -20658,7 +21129,7 @@ function judgeStatic(tree, id) {
|
|
|
20658
21129
|
}
|
|
20659
21130
|
const decided = problems.length > 0 ? {
|
|
20660
21131
|
id,
|
|
20661
|
-
anchor:
|
|
21132
|
+
anchor: lineOf4(problems[0].match(/\(([^()\s]+:\d+)\)/)?.[1] ?? "-:0").join(":"),
|
|
20662
21133
|
state: "non-conforming",
|
|
20663
21134
|
verdict: `${problems.join("; ")} -> every tool declares { domain, mode } (mode exactly read | write, read <-> readOnlyHint true), and the shared decision of ${CLOUD_IDENTITY} refuses tools/call and filters tools/list for every registered tool (mcp-server-standard "Agent tool roles", rules 2-4, 7)`
|
|
20664
21135
|
} : {
|
|
@@ -21207,7 +21678,7 @@ var e10MrtrOnly = {
|
|
|
21207
21678
|
|
|
21208
21679
|
// src/detectors/e11-surfaces-derived.ts
|
|
21209
21680
|
import { existsSync as existsSync21, statSync as statSync21 } from "fs";
|
|
21210
|
-
import { dirname as dirname15, join as
|
|
21681
|
+
import { dirname as dirname15, join as join31, relative as relative13, sep as sep7 } from "path";
|
|
21211
21682
|
var ALL = ["chat", "cowork", "claude-code"];
|
|
21212
21683
|
function excludedSurfaces(c) {
|
|
21213
21684
|
const cause = /* @__PURE__ */ new Map();
|
|
@@ -21279,7 +21750,7 @@ var e11SurfacesDerived = {
|
|
|
21279
21750
|
continue;
|
|
21280
21751
|
}
|
|
21281
21752
|
const folder = dirname15(m.path);
|
|
21282
|
-
const
|
|
21753
|
+
const rel2 = (p) => relative13(tree.root, p).split(sep7).join("/") || ".";
|
|
21283
21754
|
if (!Array.isArray(j.surfaces)) {
|
|
21284
21755
|
reds.push({
|
|
21285
21756
|
anchor: m.rel,
|
|
@@ -21296,14 +21767,14 @@ var e11SurfacesDerived = {
|
|
|
21296
21767
|
text: `${m.rel} surfaces ${unknown.join(", ")} are not in {${ALL.join(", ")}}`
|
|
21297
21768
|
});
|
|
21298
21769
|
}
|
|
21299
|
-
const mcp =
|
|
21770
|
+
const mcp = join31(folder, ".mcp.json");
|
|
21300
21771
|
let localMcp = false;
|
|
21301
21772
|
if (existsSync21(mcp)) {
|
|
21302
21773
|
const mj = readJsonRecord(mcp);
|
|
21303
21774
|
if (!mj)
|
|
21304
21775
|
unreadable2.push({
|
|
21305
|
-
anchor:
|
|
21306
|
-
reason: `${
|
|
21776
|
+
anchor: rel2(mcp),
|
|
21777
|
+
reason: `${rel2(mcp)} is not a parseable JSON object \u2014 local MCP commands are unread`
|
|
21307
21778
|
});
|
|
21308
21779
|
else {
|
|
21309
21780
|
const servers = isRecord(mj.mcpServers) ? mj.mcpServers : mj;
|
|
@@ -21315,9 +21786,9 @@ var e11SurfacesDerived = {
|
|
|
21315
21786
|
}
|
|
21316
21787
|
}
|
|
21317
21788
|
const cause = excludedSurfaces({
|
|
21318
|
-
bin: isDir(
|
|
21319
|
-
hooks: isDir(
|
|
21320
|
-
agents: isDir(
|
|
21789
|
+
bin: isDir(join31(folder, "bin"), rel2(join31(folder, "bin")), unreadable2),
|
|
21790
|
+
hooks: isDir(join31(folder, "hooks"), rel2(join31(folder, "hooks")), unreadable2),
|
|
21791
|
+
agents: isDir(join31(folder, "agents"), rel2(join31(folder, "agents")), unreadable2),
|
|
21321
21792
|
localMcp
|
|
21322
21793
|
});
|
|
21323
21794
|
for (const s of declared) {
|
|
@@ -21441,8 +21912,8 @@ var e12HostCapabilityPlacement = {
|
|
|
21441
21912
|
};
|
|
21442
21913
|
|
|
21443
21914
|
// src/detectors/installedAs.ts
|
|
21444
|
-
import { readdirSync as
|
|
21445
|
-
import { join as
|
|
21915
|
+
import { readFileSync as readFileSync21, readdirSync as readdirSync16, statSync as statSync22 } from "fs";
|
|
21916
|
+
import { dirname as dirname16, join as join32, relative as relative14, sep as sep8 } from "path";
|
|
21446
21917
|
var KEY = (k) => `(?:\\[\\s*["'\`]${k}["'\`]\\s*\\]|["']${k}["']|\\b${k}\\b)`;
|
|
21447
21918
|
function keyRe(key) {
|
|
21448
21919
|
return new RegExp(`${KEY(key)}\\s*(?<sep>:)`);
|
|
@@ -21463,17 +21934,193 @@ var REGISTER_HANDLER_RE = /\.(?:get|post|put|all|on|route)\s*(?<sep>\()\s*(?:["'
|
|
|
21463
21934
|
var REGISTER_MOUNT_RE = /\.use\s*(?<sep>\()\s*["'`]\/register["'`]/;
|
|
21464
21935
|
var REGISTER_LITERAL_RE = /(?<sep>["'`])\/register["'`]/;
|
|
21465
21936
|
var ROUTE_RE = /["'`]\/?\.well-known\/oauth-authorization-server["'`]/;
|
|
21937
|
+
var ENTRY_FIELDS = ["exports", "main", "module", "bin"];
|
|
21938
|
+
var IMPORT_RE = /\b(?:from|import)\s*(["'])([^"'\n]+)\1|\b(?:import|require)\s*\(\s*(["'`])([^"'`\n]+)\3\s*\)/g;
|
|
21939
|
+
var NONLITERAL_IMPORT_RE = /\b(?:import|require)\s*\((?!\s*["'`])/g;
|
|
21940
|
+
var RESOLVE_SUFFIXES = [
|
|
21941
|
+
"",
|
|
21942
|
+
".js",
|
|
21943
|
+
".mjs",
|
|
21944
|
+
".cjs",
|
|
21945
|
+
".json",
|
|
21946
|
+
"/index.js",
|
|
21947
|
+
"/index.mjs",
|
|
21948
|
+
"/index.cjs"
|
|
21949
|
+
];
|
|
21950
|
+
var FIXTURE_DIRS = /* @__PURE__ */ new Set([
|
|
21951
|
+
"test",
|
|
21952
|
+
"tests",
|
|
21953
|
+
"__test__",
|
|
21954
|
+
"__tests__",
|
|
21955
|
+
"test-utils",
|
|
21956
|
+
"spec",
|
|
21957
|
+
"specs",
|
|
21958
|
+
"e2e",
|
|
21959
|
+
"__mocks__",
|
|
21960
|
+
"mocks",
|
|
21961
|
+
"__fixtures__",
|
|
21962
|
+
"fixture",
|
|
21963
|
+
"fixtures",
|
|
21964
|
+
"example",
|
|
21965
|
+
"examples",
|
|
21966
|
+
"samples",
|
|
21967
|
+
"demo",
|
|
21968
|
+
"docs"
|
|
21969
|
+
]);
|
|
21466
21970
|
var MAX_BYTES = 1e6;
|
|
21467
21971
|
var MAX_FILES_PER_PACKAGE = 3e3;
|
|
21468
21972
|
var SOURCE_EXT = /\.(?:js|mjs|cjs|json)$/;
|
|
21973
|
+
var FACT_KEYS = ["cimd", "registration", "iss", "none"];
|
|
21974
|
+
var countFacts = (f) => FACT_KEYS.filter((k) => f[k]).length;
|
|
21469
21975
|
function declaredDependencies(tree) {
|
|
21470
21976
|
const json = tree.packageJson?.json;
|
|
21471
21977
|
const deps = json && typeof json.dependencies === "object" ? json.dependencies : null;
|
|
21472
21978
|
return deps && !Array.isArray(deps) ? Object.keys(deps).sort() : [];
|
|
21473
21979
|
}
|
|
21980
|
+
function declaredEntries(dir, dep, unread2) {
|
|
21981
|
+
let json;
|
|
21982
|
+
try {
|
|
21983
|
+
json = JSON.parse(readFileSync21(join32(dir, "package.json"), "utf8"));
|
|
21984
|
+
} catch (e) {
|
|
21985
|
+
if (e.code === "ENOENT") return null;
|
|
21986
|
+
unread2.push(
|
|
21987
|
+
`${dep}/package.json (not parsed: ${e.message}; the package is not read)`
|
|
21988
|
+
);
|
|
21989
|
+
return [];
|
|
21990
|
+
}
|
|
21991
|
+
if (!json || typeof json !== "object" || Array.isArray(json)) {
|
|
21992
|
+
unread2.push(`${dep}/package.json (not an object; the package is not read)`);
|
|
21993
|
+
return [];
|
|
21994
|
+
}
|
|
21995
|
+
const pj = json;
|
|
21996
|
+
if (!ENTRY_FIELDS.some((f) => pj[f] !== void 0)) return null;
|
|
21997
|
+
const targets = [];
|
|
21998
|
+
const collect2 = (v, field) => {
|
|
21999
|
+
if (typeof v === "string") targets.push(v);
|
|
22000
|
+
else if (Array.isArray(v)) for (const x of v) collect2(x, field);
|
|
22001
|
+
else if (v === null)
|
|
22002
|
+
return;
|
|
22003
|
+
else if (typeof v === "object")
|
|
22004
|
+
for (const x of Object.values(v)) collect2(x, field);
|
|
22005
|
+
else
|
|
22006
|
+
unread2.push(
|
|
22007
|
+
`${dep}/package.json (${field}: a ${typeof v} is not an entry form this reader knows: not followed)`
|
|
22008
|
+
);
|
|
22009
|
+
};
|
|
22010
|
+
for (const f of ENTRY_FIELDS) if (pj[f] !== void 0) collect2(pj[f], f);
|
|
22011
|
+
return targets;
|
|
22012
|
+
}
|
|
22013
|
+
function walkPackage(dir, nm, skipFixtures, unread2) {
|
|
22014
|
+
const files = [];
|
|
22015
|
+
const walk3 = (d) => {
|
|
22016
|
+
let names2;
|
|
22017
|
+
try {
|
|
22018
|
+
names2 = readdirSync16(d).sort();
|
|
22019
|
+
} catch (e) {
|
|
22020
|
+
unread2.push(`${d.slice(nm.length + 1)} (directory not listed: ${e.message})`);
|
|
22021
|
+
return;
|
|
22022
|
+
}
|
|
22023
|
+
for (const n of names2) {
|
|
22024
|
+
if (files.length >= MAX_FILES_PER_PACKAGE) return;
|
|
22025
|
+
if (n === "node_modules") continue;
|
|
22026
|
+
const full = join32(d, n);
|
|
22027
|
+
let st;
|
|
22028
|
+
try {
|
|
22029
|
+
st = statSync22(full);
|
|
22030
|
+
} catch (e) {
|
|
22031
|
+
unread2.push(`${full.slice(nm.length + 1)} (not stat'ed: ${e.message})`);
|
|
22032
|
+
continue;
|
|
22033
|
+
}
|
|
22034
|
+
if (st.isDirectory()) {
|
|
22035
|
+
if (skipFixtures && FIXTURE_DIRS.has(n.toLowerCase())) {
|
|
22036
|
+
unread2.push(`${full.slice(nm.length + 1)} (test/example directory: not read)`);
|
|
22037
|
+
continue;
|
|
22038
|
+
}
|
|
22039
|
+
walk3(full);
|
|
22040
|
+
} else if (st.isFile() && SOURCE_EXT.test(n)) files.push(full);
|
|
22041
|
+
}
|
|
22042
|
+
};
|
|
22043
|
+
walk3(dir);
|
|
22044
|
+
return files;
|
|
22045
|
+
}
|
|
22046
|
+
var escapeRe4 = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
22047
|
+
function followEntries(dir, nm, targets, files, load2, unread2) {
|
|
22048
|
+
const dep = dir.slice(nm.length + 1);
|
|
22049
|
+
const show = (f) => f.slice(nm.length + 1);
|
|
22050
|
+
const reached = /* @__PURE__ */ new Set();
|
|
22051
|
+
const queue = [];
|
|
22052
|
+
const enqueue = (f) => {
|
|
22053
|
+
if (reached.has(f)) return;
|
|
22054
|
+
reached.add(f);
|
|
22055
|
+
queue.push(f);
|
|
22056
|
+
};
|
|
22057
|
+
const resolve5 = (base, spec) => {
|
|
22058
|
+
for (const suffix of RESOLVE_SUFFIXES) {
|
|
22059
|
+
const f = join32(base, spec + suffix);
|
|
22060
|
+
if (f !== dir && !f.startsWith(dir + sep8)) return "outside";
|
|
22061
|
+
let st;
|
|
22062
|
+
try {
|
|
22063
|
+
st = statSync22(f);
|
|
22064
|
+
} catch {
|
|
22065
|
+
continue;
|
|
22066
|
+
}
|
|
22067
|
+
if (!st.isFile()) continue;
|
|
22068
|
+
return SOURCE_EXT.test(f) ? { path: f } : "not-source";
|
|
22069
|
+
}
|
|
22070
|
+
return "not-found";
|
|
22071
|
+
};
|
|
22072
|
+
const take = (r, where, spec) => {
|
|
22073
|
+
if (typeof r === "object") enqueue(r.path);
|
|
22074
|
+
else if (r === "not-found") unread2.push(`${where} ("${spec}" not resolved: not followed)`);
|
|
22075
|
+
else if (r === "outside") unread2.push(`${where} ("${spec}" leaves the package: not followed)`);
|
|
22076
|
+
};
|
|
22077
|
+
for (const t of targets) {
|
|
22078
|
+
if (t.includes("*")) {
|
|
22079
|
+
const re = new RegExp(`^${t.replace(/^\.\//, "").split("*").map(escapeRe4).join(".*")}$`);
|
|
22080
|
+
for (const f of files) if (re.test(relative14(dir, f).split(sep8).join("/"))) enqueue(f);
|
|
22081
|
+
continue;
|
|
22082
|
+
}
|
|
22083
|
+
take(resolve5(dir, t), `${dep}/package.json`, t);
|
|
22084
|
+
}
|
|
22085
|
+
while (queue.length > 0) {
|
|
22086
|
+
if (reached.size > MAX_FILES_PER_PACKAGE) {
|
|
22087
|
+
unread2.push(
|
|
22088
|
+
`${dep} (more than ${MAX_FILES_PER_PACKAGE} files reached: the rest were not read)`
|
|
22089
|
+
);
|
|
22090
|
+
break;
|
|
22091
|
+
}
|
|
22092
|
+
const f = queue.shift();
|
|
22093
|
+
const file = load2(f);
|
|
22094
|
+
if (!file || f.endsWith(".json")) continue;
|
|
22095
|
+
const text = file.lines.map((l) => l.raw).join("\n");
|
|
22096
|
+
const at = (index) => {
|
|
22097
|
+
const head = text.slice(0, index);
|
|
22098
|
+
return { n: head.split("\n").length, col: index - (head.lastIndexOf("\n") + 1) };
|
|
22099
|
+
};
|
|
22100
|
+
for (const m of text.matchAll(IMPORT_RE)) {
|
|
22101
|
+
const { n, col } = at(m.index);
|
|
22102
|
+
if (!isCodeAt(file, n, col)) continue;
|
|
22103
|
+
const spec = m[2] ?? m[4];
|
|
22104
|
+
const where = `${show(f)}:${n}`;
|
|
22105
|
+
if (spec.includes("${")) unread2.push(`${where} (import of a computed path: not followed)`);
|
|
22106
|
+
else if (spec.startsWith("./") || spec.startsWith("../"))
|
|
22107
|
+
take(resolve5(dirname16(f), spec), where, spec);
|
|
22108
|
+
else if (spec.startsWith("#"))
|
|
22109
|
+
unread2.push(`${where} (subpath import "${spec}": not followed)`);
|
|
22110
|
+
else if (spec.startsWith("/") || spec.startsWith("file:"))
|
|
22111
|
+
unread2.push(`${where} (absolute import "${spec}": not followed)`);
|
|
22112
|
+
}
|
|
22113
|
+
for (const m of text.matchAll(NONLITERAL_IMPORT_RE)) {
|
|
22114
|
+
const { n, col } = at(m.index);
|
|
22115
|
+
if (isCodeAt(file, n, col))
|
|
22116
|
+
unread2.push(`${show(f)}:${n} (non-literal import/require: its target not followed)`);
|
|
22117
|
+
}
|
|
22118
|
+
}
|
|
22119
|
+
return reached;
|
|
22120
|
+
}
|
|
21474
22121
|
function readInstalledAs(tree) {
|
|
21475
22122
|
const out = { installed: false, missing: [], publishers: [], unread: [] };
|
|
21476
|
-
const nm =
|
|
22123
|
+
const nm = join32(baseOf(tree), "node_modules");
|
|
21477
22124
|
try {
|
|
21478
22125
|
out.installed = statSync22(nm).isDirectory();
|
|
21479
22126
|
} catch {
|
|
@@ -21481,74 +22128,75 @@ function readInstalledAs(tree) {
|
|
|
21481
22128
|
}
|
|
21482
22129
|
if (!out.installed) return out;
|
|
21483
22130
|
const methods = authMethodsRe();
|
|
22131
|
+
const perPublisher = [];
|
|
21484
22132
|
for (const dep of declaredDependencies(tree)) {
|
|
21485
|
-
const dir =
|
|
22133
|
+
const dir = join32(nm, dep);
|
|
21486
22134
|
try {
|
|
21487
22135
|
if (!statSync22(dir).isDirectory()) throw new Error("not a directory");
|
|
21488
22136
|
} catch {
|
|
21489
22137
|
out.missing.push(dep);
|
|
21490
22138
|
continue;
|
|
21491
22139
|
}
|
|
21492
|
-
const
|
|
21493
|
-
const
|
|
21494
|
-
let names2;
|
|
21495
|
-
try {
|
|
21496
|
-
names2 = readdirSync15(d).sort();
|
|
21497
|
-
} catch (e) {
|
|
21498
|
-
out.unread.push(
|
|
21499
|
-
`${d.slice(nm.length + 1)} (directory not listed: ${e.message})`
|
|
21500
|
-
);
|
|
21501
|
-
return;
|
|
21502
|
-
}
|
|
21503
|
-
for (const n of names2) {
|
|
21504
|
-
if (files.length >= MAX_FILES_PER_PACKAGE) return;
|
|
21505
|
-
if (n === "node_modules") continue;
|
|
21506
|
-
const full = join31(d, n);
|
|
21507
|
-
let st;
|
|
21508
|
-
try {
|
|
21509
|
-
st = statSync22(full);
|
|
21510
|
-
} catch (e) {
|
|
21511
|
-
out.unread.push(`${full.slice(nm.length + 1)} (not stat'ed: ${e.message})`);
|
|
21512
|
-
continue;
|
|
21513
|
-
}
|
|
21514
|
-
if (st.isDirectory()) walk3(full);
|
|
21515
|
-
else if (st.isFile() && SOURCE_EXT.test(n) && !n.endsWith(".d.ts")) files.push(full);
|
|
21516
|
-
}
|
|
21517
|
-
};
|
|
21518
|
-
walk3(dir);
|
|
22140
|
+
const entries = declaredEntries(dir, dep, out.unread);
|
|
22141
|
+
const files = walkPackage(dir, nm, entries === null, out.unread);
|
|
21519
22142
|
if (files.length >= MAX_FILES_PER_PACKAGE) {
|
|
21520
22143
|
out.unread.push(`${dep} (more than ${MAX_FILES_PER_PACKAGE} files: the rest were not read)`);
|
|
21521
22144
|
}
|
|
21522
22145
|
const read = [];
|
|
21523
|
-
|
|
21524
|
-
const
|
|
22146
|
+
const load2 = (f) => {
|
|
22147
|
+
const rel2 = f.slice(nm.length + 1);
|
|
21525
22148
|
try {
|
|
21526
22149
|
if (statSync22(f).size > MAX_BYTES) {
|
|
21527
|
-
out.unread.push(`${
|
|
21528
|
-
|
|
22150
|
+
out.unread.push(`${rel2} (larger than ${MAX_BYTES} bytes: not read)`);
|
|
22151
|
+
return void 0;
|
|
21529
22152
|
}
|
|
21530
22153
|
const file = loadSourceFile(f, nm);
|
|
21531
|
-
read.push({ rel, file, rows: uncommentedLines(file) });
|
|
22154
|
+
read.push({ rel: rel2, file, rows: uncommentedLines(file) });
|
|
22155
|
+
return file;
|
|
21532
22156
|
} catch (e) {
|
|
21533
|
-
out.unread.push(`${
|
|
22157
|
+
out.unread.push(`${rel2} (not read: ${e.message})`);
|
|
22158
|
+
return void 0;
|
|
22159
|
+
}
|
|
22160
|
+
};
|
|
22161
|
+
if (entries === null) {
|
|
22162
|
+
for (const f of files) load2(f);
|
|
22163
|
+
} else {
|
|
22164
|
+
const reached = followEntries(dir, nm, entries, files, load2, out.unread);
|
|
22165
|
+
const manifest = join32(dir, "package.json");
|
|
22166
|
+
const outside = files.filter((f) => f !== manifest && !reached.has(f)).length;
|
|
22167
|
+
if (outside > 0) {
|
|
22168
|
+
out.unread.push(
|
|
22169
|
+
`${dep} (${outside} file${outside === 1 ? "" : "s"} outside what its declared entry points load: not read)`
|
|
22170
|
+
);
|
|
21534
22171
|
}
|
|
21535
22172
|
}
|
|
21536
|
-
|
|
22173
|
+
const routeFiles = read.filter((r) => r.rows.some((row) => ROUTE_RE.test(row)));
|
|
22174
|
+
if (routeFiles.length === 0) continue;
|
|
21537
22175
|
out.publishers.push(dep);
|
|
21538
22176
|
const find = (...res) => {
|
|
21539
22177
|
for (const re of res) {
|
|
21540
|
-
for (const r of
|
|
22178
|
+
for (const r of routeFiles) {
|
|
21541
22179
|
const n = separatorLines(r.file, re)[0];
|
|
21542
22180
|
if (n !== void 0) return { anchor: `node_modules/${r.rel}:${n}` };
|
|
21543
22181
|
}
|
|
21544
22182
|
}
|
|
21545
22183
|
return void 0;
|
|
21546
22184
|
};
|
|
21547
|
-
|
|
21548
|
-
|
|
21549
|
-
|
|
21550
|
-
|
|
21551
|
-
|
|
22185
|
+
const facts = {
|
|
22186
|
+
cimd: find(flagTrueRe("client_id_metadata_document_supported")),
|
|
22187
|
+
registration: find(REGISTRATION_KEY_RE, REGISTER_HANDLER_RE, REGISTER_MOUNT_RE),
|
|
22188
|
+
iss: find(flagTrueRe("authorization_response_iss_parameter_supported")),
|
|
22189
|
+
none: find(methods.none)
|
|
22190
|
+
};
|
|
22191
|
+
perPublisher.push({ dep, facts });
|
|
22192
|
+
}
|
|
22193
|
+
let best;
|
|
22194
|
+
for (const p of perPublisher) {
|
|
22195
|
+
if (!best || countFacts(p.facts) > countFacts(best.facts)) best = p;
|
|
22196
|
+
}
|
|
22197
|
+
if (best && countFacts(best.facts) > 0) {
|
|
22198
|
+
out.factsFrom = best.dep;
|
|
22199
|
+
for (const k of FACT_KEYS) if (best.facts[k]) out[k] = best.facts[k];
|
|
21552
22200
|
}
|
|
21553
22201
|
return out;
|
|
21554
22202
|
}
|
|
@@ -21606,7 +22254,7 @@ function delegatedAsElements(tree, fallbackAnchor) {
|
|
|
21606
22254
|
const g = inst.cimd && inst.none ? [
|
|
21607
22255
|
{
|
|
21608
22256
|
status: "ok",
|
|
21609
|
-
text: `CIMD announced (${inst.cimd.anchor}) and "none" listed (${inst.none.anchor}) by the installed ${pk}`,
|
|
22257
|
+
text: `CIMD announced (${inst.cimd.anchor}) and "none" listed (${inst.none.anchor}) by the installed ${inst.factsFrom ?? pk}`,
|
|
21610
22258
|
anchor: inst.cimd.anchor
|
|
21611
22259
|
}
|
|
21612
22260
|
] : owed(
|
|
@@ -21615,7 +22263,7 @@ function delegatedAsElements(tree, fallbackAnchor) {
|
|
|
21615
22263
|
const l = inst.iss ? [
|
|
21616
22264
|
{
|
|
21617
22265
|
status: "owed",
|
|
21618
|
-
text: `the installed ${pk} announces authorization_response_iss_parameter_supported: true (${inst.iss.anchor}); owed (probe): \`iss\` is returned on every authorization response, error responses included`,
|
|
22266
|
+
text: `the installed ${inst.factsFrom ?? pk} announces authorization_response_iss_parameter_supported: true (${inst.iss.anchor}); owed (probe): \`iss\` is returned on every authorization response, error responses included`,
|
|
21619
22267
|
anchor: inst.iss.anchor
|
|
21620
22268
|
}
|
|
21621
22269
|
] : owed(
|
|
@@ -21948,73 +22596,291 @@ var s5AuthzElements = {
|
|
|
21948
22596
|
);
|
|
21949
22597
|
},
|
|
21950
22598
|
/**
|
|
21951
|
-
* SERVED half (
|
|
21952
|
-
*
|
|
21953
|
-
* is an array listing "none". (l): `authorization_response_iss_parameter_supported` is the boolean true.
|
|
21954
|
-
* The other elements, and `iss` on every authorization response, are not readable from a metadata
|
|
21955
|
-
* document: the result says so and stays could-not-judge unless an element is contradicted.
|
|
22599
|
+
* SERVED half (--url, or a launched server): every element the wire can answer is READ; every other is NAMED with
|
|
22600
|
+
* the reason it is not read. See `judgeServed` for the decision per element.
|
|
21956
22601
|
*/
|
|
21957
22602
|
runServed(runtime) {
|
|
21958
|
-
|
|
21959
|
-
|
|
21960
|
-
|
|
21961
|
-
|
|
21962
|
-
|
|
21963
|
-
|
|
21964
|
-
|
|
21965
|
-
|
|
21966
|
-
|
|
21967
|
-
|
|
22603
|
+
return judgeServed(this.id, runtime);
|
|
22604
|
+
}
|
|
22605
|
+
};
|
|
22606
|
+
var JWT_BEARER = "urn:ietf:params:oauth:grant-type:jwt-bearer";
|
|
22607
|
+
function unreadGet(g) {
|
|
22608
|
+
if (g.status === void 0) return g.detail ?? "no answer";
|
|
22609
|
+
if (g.status >= 200 && g.status < 300)
|
|
22610
|
+
return g.json ? void 0 : `HTTP ${g.status} with no JSON object`;
|
|
22611
|
+
return `HTTP ${g.status}`;
|
|
22612
|
+
}
|
|
22613
|
+
var isNotServed = (g) => g.status !== void 0 && g.status >= 400 && g.status < 500;
|
|
22614
|
+
function noPrmAt(g) {
|
|
22615
|
+
if (isNotServed(g)) return `HTTP ${g.status}`;
|
|
22616
|
+
if (unreadGet(g) !== void 0) return void 0;
|
|
22617
|
+
const doc = g.json;
|
|
22618
|
+
return "resource" in doc || "authorization_servers" in doc ? void 0 : `HTTP ${g.status}, a JSON object with neither resource nor authorization_servers`;
|
|
22619
|
+
}
|
|
22620
|
+
function prmElements(docs) {
|
|
22621
|
+
if (!docs)
|
|
22622
|
+
return [
|
|
22623
|
+
{
|
|
22624
|
+
id: "f",
|
|
22625
|
+
status: "unread",
|
|
22626
|
+
text: "(f) the PRM copies were not recorded by this run (a runtime record that predates the read)"
|
|
22627
|
+
}
|
|
22628
|
+
];
|
|
22629
|
+
if (docs.kind === "not-run")
|
|
22630
|
+
return [{ id: "f", status: "unread", text: `(f) the PRM was not read: ${docs.reason}` }];
|
|
22631
|
+
const copies = [docs.prm.suffixed, docs.prm.bare].filter((g) => g !== void 0);
|
|
22632
|
+
if (copies.every((g) => noPrmAt(g) !== void 0))
|
|
22633
|
+
return [
|
|
22634
|
+
{
|
|
22635
|
+
id: "f",
|
|
22636
|
+
status: "unread",
|
|
22637
|
+
text: `(f) no PRM is served (${copies.map((g) => `${noPrmAt(g)} at ${g.url}`).join(", ")}): whether S-5 applies to this server, ${S5_CONDITION}, is a statement of its source tree, not of the wire`
|
|
22638
|
+
}
|
|
22639
|
+
];
|
|
22640
|
+
const out = [];
|
|
22641
|
+
for (const g of copies) {
|
|
22642
|
+
const none = noPrmAt(g);
|
|
22643
|
+
if (none !== void 0) {
|
|
22644
|
+
out.push({ id: "f", status: "red", text: `(f) the PRM is not served at ${g.url} (${none})` });
|
|
22645
|
+
continue;
|
|
21968
22646
|
}
|
|
21969
|
-
const
|
|
21970
|
-
|
|
21971
|
-
|
|
21972
|
-
|
|
21973
|
-
const unreadable2 = [];
|
|
21974
|
-
const cimd = doc.client_id_metadata_document_supported;
|
|
21975
|
-
if (cimd === true) oks.push("client_id_metadata_document_supported true");
|
|
21976
|
-
else
|
|
21977
|
-
reds.push(
|
|
21978
|
-
`(g) the served AS metadata ${cimd === void 0 ? "does not announce" : `announces ${JSON.stringify(cimd)} for`} client_id_metadata_document_supported: true`
|
|
21979
|
-
);
|
|
21980
|
-
const methods = doc.token_endpoint_auth_methods_supported;
|
|
21981
|
-
if (Array.isArray(methods)) {
|
|
21982
|
-
if (methods.includes("none"))
|
|
21983
|
-
oks.push(`"none" in token_endpoint_auth_methods_supported ${JSON.stringify(methods)}`);
|
|
21984
|
-
else
|
|
21985
|
-
reds.push(
|
|
21986
|
-
`(g) the served AS metadata lists ${JSON.stringify(methods)} in token_endpoint_auth_methods_supported, without "none"`
|
|
21987
|
-
);
|
|
21988
|
-
} else if (methods === void 0) {
|
|
21989
|
-
reds.push(
|
|
21990
|
-
'(g) the served AS metadata has no token_endpoint_auth_methods_supported (so no "none")'
|
|
21991
|
-
);
|
|
21992
|
-
} else {
|
|
21993
|
-
unreadable2.push(
|
|
21994
|
-
`token_endpoint_auth_methods_supported is served as ${JSON.stringify(methods)}, not an array`
|
|
21995
|
-
);
|
|
22647
|
+
const why = unreadGet(g);
|
|
22648
|
+
if (why) {
|
|
22649
|
+
out.push({ id: "f", status: "unread", text: `(f) the PRM at ${g.url} was not read: ${why}` });
|
|
22650
|
+
continue;
|
|
21996
22651
|
}
|
|
21997
|
-
const
|
|
21998
|
-
if (
|
|
22652
|
+
const resource = g.json.resource;
|
|
22653
|
+
if (typeof resource !== "string")
|
|
22654
|
+
out.push({
|
|
22655
|
+
id: "f",
|
|
22656
|
+
status: "red",
|
|
22657
|
+
text: `(f) the PRM served at ${g.url} has no string resource (${JSON.stringify(resource) ?? "absent"})`
|
|
22658
|
+
});
|
|
22659
|
+
else if (resource !== docs.mcpUrl)
|
|
22660
|
+
out.push({
|
|
22661
|
+
id: "f",
|
|
22662
|
+
status: "red",
|
|
22663
|
+
text: `(f) the PRM served at ${g.url} names resource ${JSON.stringify(resource)}, not the MCP URL ${docs.mcpUrl} (path included)`
|
|
22664
|
+
});
|
|
22665
|
+
}
|
|
22666
|
+
if (out.length === 0)
|
|
22667
|
+
out.push({
|
|
22668
|
+
id: "f",
|
|
22669
|
+
status: "ok",
|
|
22670
|
+
text: `(f) the PRM resource equals the MCP URL ${docs.mcpUrl} at ${copies.map((g) => g.url).join(" and at ")}`
|
|
22671
|
+
});
|
|
22672
|
+
return out;
|
|
22673
|
+
}
|
|
22674
|
+
function asElements(as) {
|
|
22675
|
+
if (as.kind !== "document") {
|
|
22676
|
+
const why = `the authorization-server metadata was not read: ${as.kind === "not-run" ? as.reason : `${as.url}: ${as.reason}`}`;
|
|
22677
|
+
return ["g", "j", "l"].map((id) => ({ id, status: "unread", text: `(${id}) ${why}` }));
|
|
22678
|
+
}
|
|
22679
|
+
const doc = as.document;
|
|
22680
|
+
const out = [];
|
|
22681
|
+
const g = [];
|
|
22682
|
+
const cimd = doc.client_id_metadata_document_supported;
|
|
22683
|
+
if (cimd === true) g.push("client_id_metadata_document_supported true");
|
|
22684
|
+
else
|
|
22685
|
+
out.push({
|
|
22686
|
+
id: "g",
|
|
22687
|
+
status: "red",
|
|
22688
|
+
text: `(g) the served AS metadata ${cimd === void 0 ? "does not announce" : `announces ${JSON.stringify(cimd)} for`} client_id_metadata_document_supported: true`
|
|
22689
|
+
});
|
|
22690
|
+
const methods = doc.token_endpoint_auth_methods_supported;
|
|
22691
|
+
if (Array.isArray(methods)) {
|
|
22692
|
+
if (methods.includes("none"))
|
|
22693
|
+
g.push(`"none" in token_endpoint_auth_methods_supported ${JSON.stringify(methods)}`);
|
|
21999
22694
|
else
|
|
22000
|
-
|
|
22001
|
-
|
|
22002
|
-
|
|
22003
|
-
|
|
22004
|
-
|
|
22005
|
-
|
|
22006
|
-
|
|
22007
|
-
|
|
22008
|
-
|
|
22009
|
-
|
|
22010
|
-
}
|
|
22011
|
-
|
|
22012
|
-
|
|
22013
|
-
|
|
22014
|
-
|
|
22015
|
-
|
|
22695
|
+
out.push({
|
|
22696
|
+
id: "g",
|
|
22697
|
+
status: "red",
|
|
22698
|
+
text: `(g) the served AS metadata lists ${JSON.stringify(methods)} in token_endpoint_auth_methods_supported, without "none"`
|
|
22699
|
+
});
|
|
22700
|
+
} else if (methods === void 0) {
|
|
22701
|
+
out.push({
|
|
22702
|
+
id: "g",
|
|
22703
|
+
status: "red",
|
|
22704
|
+
text: '(g) the served AS metadata has no token_endpoint_auth_methods_supported (so no "none")'
|
|
22705
|
+
});
|
|
22706
|
+
} else {
|
|
22707
|
+
out.push({
|
|
22708
|
+
id: "g",
|
|
22709
|
+
status: "unread",
|
|
22710
|
+
text: `(g) token_endpoint_auth_methods_supported is served as ${JSON.stringify(methods)}, not an array`
|
|
22711
|
+
});
|
|
22016
22712
|
}
|
|
22713
|
+
if (g.length === 2)
|
|
22714
|
+
out.push({ id: "g", status: "ok", text: `(g) served at ${as.url}: ${g.join(", ")}` });
|
|
22715
|
+
const grants = doc.grant_types_supported;
|
|
22716
|
+
if (Array.isArray(grants) && grants.includes(JWT_BEARER))
|
|
22717
|
+
out.push({
|
|
22718
|
+
id: "j",
|
|
22719
|
+
status: "unread",
|
|
22720
|
+
text: `(j) the jwt-bearer grant is announced at ${as.url}: whether it keeps trusted issuers PER TENANT is served by no metadata (a human verdict)`
|
|
22721
|
+
});
|
|
22722
|
+
else if (grants === void 0 || Array.isArray(grants))
|
|
22723
|
+
out.push({
|
|
22724
|
+
id: "j",
|
|
22725
|
+
status: "unestablished",
|
|
22726
|
+
text: "(j) no jwt-bearer grant announced in the served AS metadata, owed only to a server offered to Team/Enterprise clients, which no source states"
|
|
22727
|
+
});
|
|
22728
|
+
else
|
|
22729
|
+
out.push({
|
|
22730
|
+
id: "j",
|
|
22731
|
+
status: "unread",
|
|
22732
|
+
text: `(j) grant_types_supported is served as ${JSON.stringify(grants)}, not an array`
|
|
22733
|
+
});
|
|
22734
|
+
const iss = doc.authorization_response_iss_parameter_supported;
|
|
22735
|
+
if (iss === true)
|
|
22736
|
+
out.push({
|
|
22737
|
+
id: "l",
|
|
22738
|
+
status: "ok",
|
|
22739
|
+
text: `(l) authorization_response_iss_parameter_supported true at ${as.url}`
|
|
22740
|
+
});
|
|
22741
|
+
else
|
|
22742
|
+
out.push({
|
|
22743
|
+
id: "l",
|
|
22744
|
+
status: "red",
|
|
22745
|
+
text: `(l) the served AS metadata ${iss === void 0 ? "does not announce" : `announces ${JSON.stringify(iss)} for`} authorization_response_iss_parameter_supported: true (RFC 9207)`
|
|
22746
|
+
});
|
|
22747
|
+
return out;
|
|
22748
|
+
}
|
|
22749
|
+
function oidcElements(docs) {
|
|
22750
|
+
if (!docs || docs.kind === "not-run")
|
|
22751
|
+
return [
|
|
22752
|
+
{
|
|
22753
|
+
id: "k",
|
|
22754
|
+
status: "unread",
|
|
22755
|
+
text: `(k) the OIDC discovery was not read: ${docs ? docs.reason : "a runtime record that predates the read"}`
|
|
22756
|
+
}
|
|
22757
|
+
];
|
|
22758
|
+
const o = docs.oidc;
|
|
22759
|
+
if ("skipped" in o)
|
|
22760
|
+
return [
|
|
22761
|
+
{ id: "k", status: "unread", text: `(k) the OIDC discovery was not read: ${o.skipped}` }
|
|
22762
|
+
];
|
|
22763
|
+
if (isNotServed(o))
|
|
22764
|
+
return [
|
|
22765
|
+
{
|
|
22766
|
+
id: "k",
|
|
22767
|
+
status: "unestablished",
|
|
22768
|
+
text: `(k) no OIDC discovery published at ${o.url} (HTTP ${o.status}), owed only to a server aimed at a host that binds enterprise accounts, which no source states`
|
|
22769
|
+
}
|
|
22770
|
+
];
|
|
22771
|
+
const why = unreadGet(o);
|
|
22772
|
+
if (why)
|
|
22773
|
+
return [
|
|
22774
|
+
{
|
|
22775
|
+
id: "k",
|
|
22776
|
+
status: "unread",
|
|
22777
|
+
text: `(k) the OIDC discovery at ${o.url} was not read: ${why}`
|
|
22778
|
+
}
|
|
22779
|
+
];
|
|
22780
|
+
const doc = o.json;
|
|
22781
|
+
const out = [];
|
|
22782
|
+
const scopes = doc.scopes_supported;
|
|
22783
|
+
if (Array.isArray(scopes)) {
|
|
22784
|
+
const missing = ["openid", "email"].filter((x) => !scopes.includes(x));
|
|
22785
|
+
if (missing.length > 0)
|
|
22786
|
+
out.push({
|
|
22787
|
+
id: "k",
|
|
22788
|
+
status: "red",
|
|
22789
|
+
text: `(k) OIDC discovery served at ${o.url} lacks ${missing.map((x) => JSON.stringify(x)).join(" and ")} in scopes_supported`
|
|
22790
|
+
});
|
|
22791
|
+
} else {
|
|
22792
|
+
out.push({
|
|
22793
|
+
id: "k",
|
|
22794
|
+
status: "unread",
|
|
22795
|
+
text: `(k) OIDC discovery served at ${o.url} states no scopes_supported array, so openid and email are unread`
|
|
22796
|
+
});
|
|
22797
|
+
}
|
|
22798
|
+
const userinfo = doc.userinfo_endpoint;
|
|
22799
|
+
if (typeof userinfo !== "string")
|
|
22800
|
+
out.push({
|
|
22801
|
+
id: "k",
|
|
22802
|
+
status: "red",
|
|
22803
|
+
text: `(k) OIDC discovery served at ${o.url} lacks a userinfo_endpoint`
|
|
22804
|
+
});
|
|
22805
|
+
if (out.length > 0) return out;
|
|
22806
|
+
const claims = doc.claims_supported;
|
|
22807
|
+
if (Array.isArray(claims) && claims.includes("email") && claims.includes("email_verified"))
|
|
22808
|
+
return [
|
|
22809
|
+
{
|
|
22810
|
+
id: "k",
|
|
22811
|
+
status: "ok",
|
|
22812
|
+
text: `(k) OIDC discovery served at ${o.url} with openid and email, userinfo_endpoint ${userinfo}, claims email and email_verified`
|
|
22813
|
+
}
|
|
22814
|
+
];
|
|
22815
|
+
return [
|
|
22816
|
+
{
|
|
22817
|
+
id: "k",
|
|
22818
|
+
status: "unread",
|
|
22819
|
+
text: `(k) OIDC discovery served at ${o.url} with openid and email and userinfo_endpoint ${userinfo}, but claims_supported does not list email and email_verified (an inexhaustive list): what UserInfo returns needs an authenticated GET`
|
|
22820
|
+
}
|
|
22821
|
+
];
|
|
22822
|
+
}
|
|
22823
|
+
var H_UNREAD = {
|
|
22824
|
+
id: "h",
|
|
22825
|
+
status: "unread",
|
|
22826
|
+
text: "(h) needs an authorization-request probe: only a request the AS answers proves it accepts https://claude.ai/api/mcp/auth_callback and a loopback redirect on any port, and no known client document lists the claude.ai callback"
|
|
22827
|
+
};
|
|
22828
|
+
var I_UNREAD = {
|
|
22829
|
+
id: "i",
|
|
22830
|
+
status: "unread",
|
|
22831
|
+
text: "(i) whether /authorize authenticates a person is a human verdict plus a sign-in probe with a test client on a development deployment, stated by no metadata"
|
|
22017
22832
|
};
|
|
22833
|
+
var ISS_UNREAD = {
|
|
22834
|
+
id: "l",
|
|
22835
|
+
status: "unread",
|
|
22836
|
+
text: "(l) `iss` on every authorization response, error responses included, needs an authorization-request probe"
|
|
22837
|
+
};
|
|
22838
|
+
function judgeServed(id, runtime) {
|
|
22839
|
+
let facts;
|
|
22840
|
+
let note = "";
|
|
22841
|
+
if (!runtime.served && runtime.publicAuth) {
|
|
22842
|
+
facts = runtime.publicAuth;
|
|
22843
|
+
note = ` [the MCP handshake failed: ${runtime.launchError ?? "no reason given"}; the public authorization reads were made]`;
|
|
22844
|
+
} else {
|
|
22845
|
+
const got = servedOrCouldNotJudge(id, "S-5", runtime);
|
|
22846
|
+
if ("cnj" in got) return got.cnj;
|
|
22847
|
+
facts = got.served;
|
|
22848
|
+
}
|
|
22849
|
+
const anchor = `${runtime.root} (served authorization-server metadata)`;
|
|
22850
|
+
const els = [
|
|
22851
|
+
...prmElements(facts.authDocs),
|
|
22852
|
+
...asElements(facts.authServer),
|
|
22853
|
+
H_UNREAD,
|
|
22854
|
+
I_UNREAD,
|
|
22855
|
+
...oidcElements(facts.authDocs),
|
|
22856
|
+
ISS_UNREAD
|
|
22857
|
+
].sort((a, b) => a.id < b.id ? -1 : a.id > b.id ? 1 : 0);
|
|
22858
|
+
const of = (st) => els.filter((e) => e.status === st).map((e) => e.text);
|
|
22859
|
+
const [reds, oks, uns, unread2] = [of("red"), of("ok"), of("unestablished"), of("unread")];
|
|
22860
|
+
if (reds.length > 0)
|
|
22861
|
+
return {
|
|
22862
|
+
id,
|
|
22863
|
+
anchor,
|
|
22864
|
+
state: "non-conforming",
|
|
22865
|
+
verdict: `${reds.join("; ")} (S-5 (f)..(l), read on the wire)${unread2.length > 0 ? `; also not read on the wire: ${unread2.join("; ")}` : ""}${note}`
|
|
22866
|
+
};
|
|
22867
|
+
const parts = [
|
|
22868
|
+
oks.length > 0 ? `established: ${oks.join("; ")}` : "",
|
|
22869
|
+
uns.length > 0 ? `unestablished condition: ${uns.join("; ")}` : ""
|
|
22870
|
+
].filter(Boolean);
|
|
22871
|
+
if (unread2.length === 0)
|
|
22872
|
+
return {
|
|
22873
|
+
id,
|
|
22874
|
+
anchor,
|
|
22875
|
+
state: "present",
|
|
22876
|
+
verdict: `${parts.join(". ")} (S-5 (f)..(l), read on the wire)${note}`
|
|
22877
|
+
};
|
|
22878
|
+
return couldNotJudge(
|
|
22879
|
+
id,
|
|
22880
|
+
anchor,
|
|
22881
|
+
`no element (f)..(l) is contradicted on the wire. ${parts.length > 0 ? `${parts.join(". ")}. ` : ""}not read on the wire: ${unread2.join("; ")} (S-5 (f)..(l))${note}`
|
|
22882
|
+
);
|
|
22883
|
+
}
|
|
22018
22884
|
|
|
22019
22885
|
// src/detectors/s8-token-passthrough.ts
|
|
22020
22886
|
var INCOMING_RE = new RegExp(
|
|
@@ -22537,8 +23403,8 @@ var s12ListPagination = {
|
|
|
22537
23403
|
for (const [method, anchors] of sites) {
|
|
22538
23404
|
for (const a of anchors) {
|
|
22539
23405
|
handled++;
|
|
22540
|
-
const
|
|
22541
|
-
if (!withCursor.has(
|
|
23406
|
+
const rel2 = a.slice(0, a.lastIndexOf(":"));
|
|
23407
|
+
if (!withCursor.has(rel2)) {
|
|
22542
23408
|
reds.push({
|
|
22543
23409
|
anchor: a,
|
|
22544
23410
|
text: `${method} is handled at ${a} in a file with no nextCursor (a list that can exceed a page returns nextCursor)`
|
|
@@ -23648,7 +24514,7 @@ var s20ScopeMinimization = {
|
|
|
23648
24514
|
|
|
23649
24515
|
// src/detectors/s21-stdio-proxy-sandbox.ts
|
|
23650
24516
|
var LAUNCH_RE = /(?<![.\w$])(?:spawn|spawnSync|exec|execSync|execFile|execFileSync|fork)\s*\(|child_process\s*\.\s*(?:spawn|spawnSync|exec|execSync|execFile|execFileSync|fork)\s*\(|\bnew\s+StdioClientTransport\s*\(/g;
|
|
23651
|
-
var
|
|
24517
|
+
var IMPORT_RE2 = /child_process|\bexeca\b|StdioClientTransport/;
|
|
23652
24518
|
var SANDBOX_RE = /\b(?:docker|podman|bwrap|bubblewrap|firejail|nsjail|chroot|seccomp|unshare|landlock|gvisor|runsc)\b|\bsandbox\w*\b|--network[= ]none|--read-only/i;
|
|
23653
24519
|
var LOG_RE = /\blogger\s*\.\s*\w+\s*\(|\blog\s*\.\s*\w+\s*\(|\bconsole\s*\.\s*(?:log|info|warn|error|debug)\s*\(|\b(?:audit|logLaunch|logSpawn|logProcess|logCommand)\w*\s*\(/i;
|
|
23654
24520
|
var DANGEROUS_RE = /shell\s*:\s*true|["'`](?:sh|bash|zsh|sudo|cmd(?:\.exe)?|powershell(?:\.exe)?)["'`]/;
|
|
@@ -23678,7 +24544,7 @@ var s21StdioProxySandbox = {
|
|
|
23678
24544
|
if (!isProductSource(file.rel)) continue;
|
|
23679
24545
|
const rows = uncommentedLines(file);
|
|
23680
24546
|
const text = rows.join("\n");
|
|
23681
|
-
if (!
|
|
24547
|
+
if (!IMPORT_RE2.test(text)) continue;
|
|
23682
24548
|
const launches = [];
|
|
23683
24549
|
rows.forEach((row, i) => {
|
|
23684
24550
|
if (new RegExp(LAUNCH_RE.source).test(row)) launches.push(i);
|
|
@@ -24594,8 +25460,8 @@ var s27ElicitationFloor = {
|
|
|
24594
25460
|
};
|
|
24595
25461
|
|
|
24596
25462
|
// src/detectors/s28-claim-forwarded.ts
|
|
24597
|
-
import { existsSync as existsSync22, readFileSync as
|
|
24598
|
-
import { dirname as
|
|
25463
|
+
import { existsSync as existsSync22, readFileSync as readFileSync22, readdirSync as readdirSync17, statSync as statSync23 } from "fs";
|
|
25464
|
+
import { dirname as dirname17, join as join33, relative as relative15 } from "path";
|
|
24599
25465
|
|
|
24600
25466
|
// src/detectors/backendReceiver.ts
|
|
24601
25467
|
var CLIENT_NAME = /convex|client/i;
|
|
@@ -24671,12 +25537,12 @@ function lineAt2(text, offset) {
|
|
|
24671
25537
|
for (let i = 0; i < offset && i < text.length; i++) if (text.charCodeAt(i) === 10) n++;
|
|
24672
25538
|
return n;
|
|
24673
25539
|
}
|
|
24674
|
-
var
|
|
25540
|
+
var OPEN3 = { "(": ")", "[": "]", "{": "}" };
|
|
24675
25541
|
function matchClose2(m, open) {
|
|
24676
25542
|
const stack = [];
|
|
24677
25543
|
for (let i = open; i < m.length; i++) {
|
|
24678
25544
|
const ch = m[i];
|
|
24679
|
-
if (
|
|
25545
|
+
if (OPEN3[ch] !== void 0) stack.push(OPEN3[ch]);
|
|
24680
25546
|
else if (ch === ")" || ch === "]" || ch === "}") {
|
|
24681
25547
|
if (stack.pop() !== ch) return -1;
|
|
24682
25548
|
if (stack.length === 0) return i;
|
|
@@ -24684,13 +25550,13 @@ function matchClose2(m, open) {
|
|
|
24684
25550
|
}
|
|
24685
25551
|
return -1;
|
|
24686
25552
|
}
|
|
24687
|
-
function
|
|
25553
|
+
function splitTop3(m, from, to) {
|
|
24688
25554
|
const parts = [];
|
|
24689
25555
|
let depth = 0;
|
|
24690
25556
|
let start = from;
|
|
24691
25557
|
for (let i = from; i < to; i++) {
|
|
24692
25558
|
const ch = m[i];
|
|
24693
|
-
if (
|
|
25559
|
+
if (OPEN3[ch] !== void 0) depth++;
|
|
24694
25560
|
else if (ch === ")" || ch === "]" || ch === "}") depth--;
|
|
24695
25561
|
else if (ch === "," && depth === 0) {
|
|
24696
25562
|
parts.push([start, i]);
|
|
@@ -24703,14 +25569,14 @@ function splitTop2(m, from, to) {
|
|
|
24703
25569
|
function listTs(dir, unread2, out = []) {
|
|
24704
25570
|
let names2;
|
|
24705
25571
|
try {
|
|
24706
|
-
names2 =
|
|
25572
|
+
names2 = readdirSync17(dir);
|
|
24707
25573
|
} catch (err) {
|
|
24708
25574
|
unread2.push(`${dir} could not be listed (${fsErrorCode(err)})`);
|
|
24709
25575
|
return out;
|
|
24710
25576
|
}
|
|
24711
25577
|
for (const n of names2) {
|
|
24712
25578
|
if (n === "node_modules" || n === "_generated" || n === "__tests__") continue;
|
|
24713
|
-
const p =
|
|
25579
|
+
const p = join33(dir, n);
|
|
24714
25580
|
let st;
|
|
24715
25581
|
try {
|
|
24716
25582
|
st = statSync23(p);
|
|
@@ -24729,14 +25595,14 @@ function listTs(dir, unread2, out = []) {
|
|
|
24729
25595
|
function discoverBackend(root) {
|
|
24730
25596
|
let dir = root;
|
|
24731
25597
|
try {
|
|
24732
|
-
if (!statSync23(root).isDirectory()) dir =
|
|
25598
|
+
if (!statSync23(root).isDirectory()) dir = dirname17(root);
|
|
24733
25599
|
} catch {
|
|
24734
25600
|
return void 0;
|
|
24735
25601
|
}
|
|
24736
25602
|
for (let up2 = 0; up2 < 5; up2++) {
|
|
24737
|
-
const cand =
|
|
24738
|
-
if (existsSync22(
|
|
24739
|
-
const parent =
|
|
25603
|
+
const cand = join33(dir, "convex");
|
|
25604
|
+
if (existsSync22(join33(cand, "schema.ts"))) return cand;
|
|
25605
|
+
const parent = dirname17(dir);
|
|
24740
25606
|
if (parent === dir) break;
|
|
24741
25607
|
dir = parent;
|
|
24742
25608
|
}
|
|
@@ -24747,18 +25613,18 @@ function readDoors(backendRoot, unread2) {
|
|
|
24747
25613
|
for (const path of listTs(backendRoot, unread2)) {
|
|
24748
25614
|
let text;
|
|
24749
25615
|
try {
|
|
24750
|
-
text =
|
|
25616
|
+
text = readFileSync22(path, "utf8");
|
|
24751
25617
|
} catch (err) {
|
|
24752
25618
|
unread2.push(`${path} could not be read (${fsErrorCode(err)})`);
|
|
24753
25619
|
continue;
|
|
24754
25620
|
}
|
|
24755
25621
|
const file = {
|
|
24756
25622
|
path,
|
|
24757
|
-
rel:
|
|
25623
|
+
rel: relative15(backendRoot, path),
|
|
24758
25624
|
lines: text.split("\n").map((raw, i) => ({ n: i + 1, raw, comment: false }))
|
|
24759
25625
|
};
|
|
24760
25626
|
const m = masked(file);
|
|
24761
|
-
const module =
|
|
25627
|
+
const module = relative15(backendRoot, path).replace(/\.ts$/, "").split("\\").join("/");
|
|
24762
25628
|
const re = /\bexport\s+const\s+([A-Za-z_$][\w$]*)\s*=\s*(?:query|mutation|action)\s*\(/g;
|
|
24763
25629
|
for (let hit = re.exec(m); hit; hit = re.exec(m)) {
|
|
24764
25630
|
const open = hit.index + hit[0].length - 1;
|
|
@@ -24820,7 +25686,7 @@ function definitionOf(name, files) {
|
|
|
24820
25686
|
let depth = 0;
|
|
24821
25687
|
for (let i = hit.index + hit[0].length; i < f.m.length; i++) {
|
|
24822
25688
|
const ch = f.m[i];
|
|
24823
|
-
if (
|
|
25689
|
+
if (OPEN3[ch] !== void 0) {
|
|
24824
25690
|
depth++;
|
|
24825
25691
|
} else if (ch === ")" || ch === "]" || ch === "}") {
|
|
24826
25692
|
depth--;
|
|
@@ -24853,7 +25719,7 @@ function readHelper(name, files, seen = /* @__PURE__ */ new Set(), depth = 0) {
|
|
|
24853
25719
|
}
|
|
24854
25720
|
return { forwards, optional };
|
|
24855
25721
|
}
|
|
24856
|
-
var
|
|
25722
|
+
var IDENT4 = /^\s*([A-Za-z_$][\w$]*)\s*(?:as\s+[\w$.<>[\]]+\s*)?$/;
|
|
24857
25723
|
function esc6(name) {
|
|
24858
25724
|
return name.replace(/\$/g, "\\$");
|
|
24859
25725
|
}
|
|
@@ -24885,7 +25751,7 @@ function enclosingCall(m, offset) {
|
|
|
24885
25751
|
return void 0;
|
|
24886
25752
|
const close2 = matchClose2(m, i);
|
|
24887
25753
|
if (close2 < 0) return void 0;
|
|
24888
|
-
const index =
|
|
25754
|
+
const index = splitTop3(m, i + 1, close2).findIndex(([a, b]) => offset >= a && offset < b);
|
|
24889
25755
|
return index < 0 ? void 0 : { callee: callee[1], index };
|
|
24890
25756
|
}
|
|
24891
25757
|
}
|
|
@@ -24902,7 +25768,7 @@ function paramOf(callee, index, files) {
|
|
|
24902
25768
|
const open = hit.index + hit[0].length - 1;
|
|
24903
25769
|
const close2 = matchClose2(fr.m, open);
|
|
24904
25770
|
if (close2 < 0) return { file: fr, text: void 0 };
|
|
24905
|
-
const part =
|
|
25771
|
+
const part = splitTop3(fr.m, open + 1, close2)[index];
|
|
24906
25772
|
return part ? { file: fr, text: fr.m.slice(part[0], part[1]).trim(), span: part } : { file: fr, text: void 0 };
|
|
24907
25773
|
}
|
|
24908
25774
|
return void 0;
|
|
@@ -24970,8 +25836,8 @@ function readFetchers(files, scan, onCall) {
|
|
|
24970
25836
|
const open = hit.index + hit[0].length - 1;
|
|
24971
25837
|
const close2 = matchClose2(fr.m, open);
|
|
24972
25838
|
if (close2 < 0) continue;
|
|
24973
|
-
const parts =
|
|
24974
|
-
const first = parts[0] ?
|
|
25839
|
+
const parts = splitTop3(fr.m, open + 1, close2);
|
|
25840
|
+
const first = parts[0] ? IDENT4.exec(fr.m.slice(parts[0][0], parts[0][1])) : null;
|
|
24975
25841
|
if (!first) continue;
|
|
24976
25842
|
const fn = enclosingFn(fr.m, hit.index, first[1]);
|
|
24977
25843
|
if (!fn) continue;
|
|
@@ -25049,7 +25915,7 @@ function readFetchers(files, scan, onCall) {
|
|
|
25049
25915
|
cnj(at, o, "has a call here that could not be read");
|
|
25050
25916
|
continue;
|
|
25051
25917
|
}
|
|
25052
|
-
const cp =
|
|
25918
|
+
const cp = splitTop3(at.m, po + 1, pc);
|
|
25053
25919
|
const raw = cp[0] ? at.text.slice(cp[0][0], cp[0][1]) : "";
|
|
25054
25920
|
const lit = /^\s*(?:\/\/[^\n]*\n\s*)*["'`]([\w/]+:[\w]+)["'`]/.exec(raw);
|
|
25055
25921
|
const ref = /^\s*(?:api|internal)\.([\w]+)\.([\w]+)/.exec(raw);
|
|
@@ -25271,7 +26137,7 @@ function scanS28(tree) {
|
|
|
25271
26137
|
scan.calls++;
|
|
25272
26138
|
const line = lineAt2(text, hit.index);
|
|
25273
26139
|
const tool = toolNameBefore(text, hit.index);
|
|
25274
|
-
const parts =
|
|
26140
|
+
const parts = splitTop3(m, open + 1, close2);
|
|
25275
26141
|
let door;
|
|
25276
26142
|
if (parts[0]) {
|
|
25277
26143
|
const rawFirst = text.slice(parts[0][0], parts[0][1]);
|
|
@@ -25719,7 +26585,7 @@ function matchClose3(m, open) {
|
|
|
25719
26585
|
}
|
|
25720
26586
|
return -1;
|
|
25721
26587
|
}
|
|
25722
|
-
function
|
|
26588
|
+
function splitTop4(m, from, to) {
|
|
25723
26589
|
const out = [];
|
|
25724
26590
|
let depth = 0;
|
|
25725
26591
|
let start = from;
|
|
@@ -25810,7 +26676,7 @@ function inlineNarrowing(m, start, close2, end) {
|
|
|
25810
26676
|
const open = p + chain[0].length - 1;
|
|
25811
26677
|
const cbClose = matchClose3(m, open);
|
|
25812
26678
|
if (cbClose < 0) return { unreadable: `a .${chain[1]}( whose closing paren is not found` };
|
|
25813
|
-
const argSpans =
|
|
26679
|
+
const argSpans = splitTop4(m, open + 1, cbClose);
|
|
25814
26680
|
const cbSpan = argSpans[0];
|
|
25815
26681
|
const cb = cbSpan ? m.slice(cbSpan[0], cbSpan[1]) : "";
|
|
25816
26682
|
if (chain[1] === "filter") {
|
|
@@ -25903,7 +26769,7 @@ function scanS35(tree) {
|
|
|
25903
26769
|
if (close2 < 0) continue;
|
|
25904
26770
|
res.calls++;
|
|
25905
26771
|
const anchor = `${file.rel}:${lineAt3(m, start)}`;
|
|
25906
|
-
const parts =
|
|
26772
|
+
const parts = splitTop4(m, open + 1, close2);
|
|
25907
26773
|
const first = parts[0] ? raw.slice(parts[0][0], parts[0][1]) : "";
|
|
25908
26774
|
const cast = String.raw`(?:\s+as\s+[\w$.<>[\] ]+)?\s*$`;
|
|
25909
26775
|
const lit = new RegExp(String.raw`^\s*["'\x60]([\w/]+:[\w]+)["'\x60]${cast}`).exec(first);
|
|
@@ -28246,10 +29112,10 @@ var s41LakeReader = {
|
|
|
28246
29112
|
};
|
|
28247
29113
|
|
|
28248
29114
|
// src/detectors/s42-write-read-claims.ts
|
|
28249
|
-
import { readFileSync as
|
|
28250
|
-
import { relative as
|
|
29115
|
+
import { readFileSync as readFileSync23 } from "fs";
|
|
29116
|
+
import { relative as relative16 } from "path";
|
|
28251
29117
|
var ID9 = "S42 write-read-claims";
|
|
28252
|
-
var
|
|
29118
|
+
var RULE10 = "S-42";
|
|
28253
29119
|
var CLAIMS = ["verifiedOrg", "verifiedPerson", "verifiedActor", "seatOrgSlug"];
|
|
28254
29120
|
var KEY_RE = new RegExp(`\\b(${CLAIMS.join("|")})\\s*\\??\\s*:`, "g");
|
|
28255
29121
|
var CALL_RE4 = /\b([A-Za-z_$][\w$]*)\s*\.\s*(query|mutation|action)\s*\(/g;
|
|
@@ -28294,18 +29160,18 @@ function readDoorAccess(backendRoot, unread2) {
|
|
|
28294
29160
|
for (const path of listTs(backendRoot, unread2)) {
|
|
28295
29161
|
let text;
|
|
28296
29162
|
try {
|
|
28297
|
-
text =
|
|
29163
|
+
text = readFileSync23(path, "utf8");
|
|
28298
29164
|
} catch (err) {
|
|
28299
29165
|
unread2.push(`${path} could not be read (${fsErrorCode(err)})`);
|
|
28300
29166
|
continue;
|
|
28301
29167
|
}
|
|
28302
29168
|
const file = {
|
|
28303
29169
|
path,
|
|
28304
|
-
rel:
|
|
29170
|
+
rel: relative16(backendRoot, path),
|
|
28305
29171
|
lines: text.split("\n").map((raw, i) => ({ n: i + 1, raw, comment: false }))
|
|
28306
29172
|
};
|
|
28307
29173
|
const m = masked(file);
|
|
28308
|
-
const module =
|
|
29174
|
+
const module = relative16(backendRoot, path).replace(/\.ts$/, "").split("\\").join("/");
|
|
28309
29175
|
const re = /\bexport\s+const\s+([A-Za-z_$][\w$]*)\s*=\s*(query|mutation|action|internalMutation|internalQuery)\s*\(/g;
|
|
28310
29176
|
for (let hit = re.exec(m); hit; hit = re.exec(m)) {
|
|
28311
29177
|
const open = hit.index + hit[0].length - 1;
|
|
@@ -28369,7 +29235,7 @@ function scanS42(tree) {
|
|
|
28369
29235
|
if (close2 < 0) continue;
|
|
28370
29236
|
const at = `${f.rel}:${lineAt2(text, hit.index)}`;
|
|
28371
29237
|
const tool = toolNameBefore(text, hit.index).name ?? "(unnamed tool)";
|
|
28372
|
-
const parts =
|
|
29238
|
+
const parts = splitTop3(m, open + 1, close2);
|
|
28373
29239
|
const first = parts[0] ? text.slice(parts[0][0], parts[0][1]) : "";
|
|
28374
29240
|
const lit = /^\s*["'`]([\w/]+:[\w]+)["'`]/.exec(first);
|
|
28375
29241
|
const ref = /^\s*(?:api|internal)\.([\w]+)\.([\w]+)/.exec(first);
|
|
@@ -28378,14 +29244,14 @@ function scanS42(tree) {
|
|
|
28378
29244
|
if (door !== void 0 || importsConvex(m, text))
|
|
28379
29245
|
unread2.push({
|
|
28380
29246
|
anchor: at,
|
|
28381
|
-
reason: `${tool}: the receiver is not resolved to a backend client \u2014 ${rcv.why} (${
|
|
29247
|
+
reason: `${tool}: the receiver is not resolved to a backend client \u2014 ${rcv.why} (${RULE10})`
|
|
28382
29248
|
});
|
|
28383
29249
|
continue;
|
|
28384
29250
|
}
|
|
28385
29251
|
if (door === void 0) {
|
|
28386
29252
|
unread2.push({
|
|
28387
29253
|
anchor: at,
|
|
28388
|
-
reason: `${tool}: a backend door named by an expression (${
|
|
29254
|
+
reason: `${tool}: a backend door named by an expression (${RULE10})`
|
|
28389
29255
|
});
|
|
28390
29256
|
continue;
|
|
28391
29257
|
}
|
|
@@ -28411,7 +29277,7 @@ function scanS42(tree) {
|
|
|
28411
29277
|
if (unresolved !== void 0) {
|
|
28412
29278
|
unread2.push({
|
|
28413
29279
|
anchor: at,
|
|
28414
|
-
reason: `${tool}: the claims spread by ${unresolved}(...) cannot be resolved (no definition with readable claim keys in the tree) (${
|
|
29280
|
+
reason: `${tool}: the claims spread by ${unresolved}(...) cannot be resolved (no definition with readable claim keys in the tree) (${RULE10})`
|
|
28415
29281
|
});
|
|
28416
29282
|
continue;
|
|
28417
29283
|
}
|
|
@@ -28422,12 +29288,12 @@ function scanS42(tree) {
|
|
|
28422
29288
|
if (calls.length > 0 && !backendRoot)
|
|
28423
29289
|
unread2.push({
|
|
28424
29290
|
anchor: tree.root,
|
|
28425
|
-
reason: `no backend source found above the scanned tree, so no door's table can be read (${
|
|
29291
|
+
reason: `no backend source found above the scanned tree, so no door's table can be read (${RULE10})`
|
|
28426
29292
|
});
|
|
28427
29293
|
const fsUnread = [];
|
|
28428
29294
|
const access = backendRoot ? readDoorAccess(backendRoot, fsUnread) : /* @__PURE__ */ new Map();
|
|
28429
29295
|
for (const u of fsUnread)
|
|
28430
|
-
unread2.push({ anchor: backendRoot ?? tree.root, reason: `${u} (${
|
|
29296
|
+
unread2.push({ anchor: backendRoot ?? tree.root, reason: `${u} (${RULE10})` });
|
|
28431
29297
|
return { calls, unread: unread2, backend: backendRoot, access };
|
|
28432
29298
|
}
|
|
28433
29299
|
function runStatic3(tree) {
|
|
@@ -28437,7 +29303,7 @@ function runStatic3(tree) {
|
|
|
28437
29303
|
id: ID9,
|
|
28438
29304
|
anchor: tree.root,
|
|
28439
29305
|
state: "absent",
|
|
28440
|
-
verdict: `no backend door call in the tree \u2014 ${
|
|
29306
|
+
verdict: `no backend door call in the tree \u2014 ${RULE10} n/a`
|
|
28441
29307
|
};
|
|
28442
29308
|
const writesOf = /* @__PURE__ */ new Map();
|
|
28443
29309
|
const readsOf = /* @__PURE__ */ new Map();
|
|
@@ -28447,7 +29313,7 @@ function runStatic3(tree) {
|
|
|
28447
29313
|
if (c.claims.size > 0 || c.keyed)
|
|
28448
29314
|
unread2.push({
|
|
28449
29315
|
anchor: c.at,
|
|
28450
|
-
reason: `${c.tool}: door ${c.door} is not defined in the backend read (${
|
|
29316
|
+
reason: `${c.tool}: door ${c.door} is not defined in the backend read (${RULE10})`
|
|
28451
29317
|
});
|
|
28452
29318
|
continue;
|
|
28453
29319
|
}
|
|
@@ -28481,29 +29347,29 @@ function runStatic3(tree) {
|
|
|
28481
29347
|
id: ID9,
|
|
28482
29348
|
anchor: red[0].slice(red[0].indexOf("(") + 1).split(", ")[1]?.replace(")", "") ?? tree.root,
|
|
28483
29349
|
state: "non-conforming",
|
|
28484
|
-
verdict: `${red.length} write/read claim mismatch(es): a row written without a claim its reads forward is stored where those reads cannot return it (${
|
|
29350
|
+
verdict: `${red.length} write/read claim mismatch(es): a row written without a claim its reads forward is stored where those reads cannot return it (${RULE10}): ${red.join("; ")}.`
|
|
28485
29351
|
} : {
|
|
28486
29352
|
id: ID9,
|
|
28487
29353
|
anchor: tree.root,
|
|
28488
29354
|
state: "present",
|
|
28489
|
-
verdict: `${compared} table(s) with both a write and a read tool compared: every write forwards the claims its reads forward${keyedTables.length > 0 ? `; resolved by one helper keyed by the door on ${keyedTables.join(", ")}` : ""} (${
|
|
29355
|
+
verdict: `${compared} table(s) with both a write and a read tool compared: every write forwards the claims its reads forward${keyedTables.length > 0 ? `; resolved by one helper keyed by the door on ${keyedTables.join(", ")}` : ""} (${RULE10}).`
|
|
28490
29356
|
};
|
|
28491
29357
|
return settle(ID9, decided, unread2);
|
|
28492
29358
|
}
|
|
28493
29359
|
var s42WriteReadClaims = {
|
|
28494
29360
|
id: ID9,
|
|
28495
|
-
rule:
|
|
29361
|
+
rule: RULE10,
|
|
28496
29362
|
pin: STANDARD_PIN,
|
|
28497
29363
|
run: runStatic3
|
|
28498
29364
|
};
|
|
28499
29365
|
|
|
28500
29366
|
// src/detectors/s44-closed-output.ts
|
|
28501
29367
|
var ID10 = "S44 closed-output";
|
|
28502
|
-
var
|
|
29368
|
+
var RULE11 = "S-44";
|
|
28503
29369
|
function judge(sites, j) {
|
|
28504
29370
|
for (const s of sites) {
|
|
28505
29371
|
if (s.kind === "unread")
|
|
28506
|
-
j.unread.push({ anchor: s.anchor, reason: `${s.path}: ${s.form} (${
|
|
29372
|
+
j.unread.push({ anchor: s.anchor, reason: `${s.path}: ${s.form} (${RULE11})` });
|
|
28507
29373
|
else if (s.exempt) j.exempt.push(s);
|
|
28508
29374
|
else j.violations.push(s);
|
|
28509
29375
|
}
|
|
@@ -28515,18 +29381,18 @@ function verdictOf2(j, scope2, anchorFallback) {
|
|
|
28515
29381
|
id: ID10,
|
|
28516
29382
|
anchor: anchorFallback,
|
|
28517
29383
|
state: "absent",
|
|
28518
|
-
verdict: `${j.toolCount} tool(s) read (${scope2}), none declares an output schema \u2014 ${
|
|
29384
|
+
verdict: `${j.toolCount} tool(s) read (${scope2}), none declares an output schema \u2014 ${RULE11} n/a`
|
|
28519
29385
|
};
|
|
28520
29386
|
const decided = j.violations.length > 0 ? {
|
|
28521
29387
|
id: ID10,
|
|
28522
29388
|
anchor: j.violations[0].anchor,
|
|
28523
29389
|
state: "non-conforming",
|
|
28524
|
-
verdict: `${j.violations.length} closed object(s) in the output schemas of ${j.withOutput} tool(s): each refuses a field added later, which breaks every client connected before the release (${
|
|
29390
|
+
verdict: `${j.violations.length} closed object(s) in the output schemas of ${j.withOutput} tool(s): each refuses a field added later, which breaks every client connected before the release (${RULE11}): ${j.violations.map((v) => `${v.path} (${v.form}, ${v.anchor})`).join(", ")}.${ex}`
|
|
28525
29391
|
} : {
|
|
28526
29392
|
id: ID10,
|
|
28527
29393
|
anchor: anchorFallback,
|
|
28528
29394
|
state: "present",
|
|
28529
|
-
verdict: `${j.withOutput} output schema(s) read (${scope2}): no object refuses an added field (${
|
|
29395
|
+
verdict: `${j.withOutput} output schema(s) read (${scope2}): no object refuses an added field (${RULE11}).${ex}`
|
|
28530
29396
|
};
|
|
28531
29397
|
return settle(ID10, decided, j.unread);
|
|
28532
29398
|
}
|
|
@@ -28558,7 +29424,7 @@ function runStatic4(tree) {
|
|
|
28558
29424
|
if (tools.length === 0) {
|
|
28559
29425
|
const surface = toolSurfaceAnchor(tree);
|
|
28560
29426
|
if (surface || unresolved.length > 0) {
|
|
28561
|
-
const reason = noToolsLocatedReason(tree, `no output schema could be read (${
|
|
29427
|
+
const reason = noToolsLocatedReason(tree, `no output schema could be read (${RULE11})`);
|
|
28562
29428
|
return couldNotJudge(
|
|
28563
29429
|
ID10,
|
|
28564
29430
|
surface ?? unresolved[0],
|
|
@@ -28569,7 +29435,7 @@ function runStatic4(tree) {
|
|
|
28569
29435
|
id: ID10,
|
|
28570
29436
|
anchor: tree.root,
|
|
28571
29437
|
state: "absent",
|
|
28572
|
-
verdict: `no MCP tool registered in product source \u2014 ${
|
|
29438
|
+
verdict: `no MCP tool registered in product source \u2014 ${RULE11} n/a`
|
|
28573
29439
|
};
|
|
28574
29440
|
}
|
|
28575
29441
|
const j = {
|
|
@@ -28582,7 +29448,7 @@ function runStatic4(tree) {
|
|
|
28582
29448
|
for (const a of unresolved)
|
|
28583
29449
|
j.unread.push({
|
|
28584
29450
|
anchor: a,
|
|
28585
|
-
reason: `a tool registered here has a name the scan cannot resolve, so its output schema is unread (${
|
|
29451
|
+
reason: `a tool registered here has a name the scan cannot resolve, so its output schema is unread (${RULE11})`
|
|
28586
29452
|
});
|
|
28587
29453
|
for (const tool of tools) {
|
|
28588
29454
|
const read = closedOutputSites(tree, tool.name, tool.anchor);
|
|
@@ -28598,7 +29464,7 @@ function runServedHalf2(runtime) {
|
|
|
28598
29464
|
return couldNotJudge(
|
|
28599
29465
|
ID10,
|
|
28600
29466
|
anchor,
|
|
28601
|
-
`the server could not be started/introspected, so no served outputSchema was read: ${runtime.launchError} (${
|
|
29467
|
+
`the server could not be started/introspected, so no served outputSchema was read: ${runtime.launchError} (${RULE11})`
|
|
28602
29468
|
);
|
|
28603
29469
|
const j = {
|
|
28604
29470
|
violations: [],
|
|
@@ -28616,15 +29482,15 @@ function runServedHalf2(runtime) {
|
|
|
28616
29482
|
}
|
|
28617
29483
|
var s44ClosedOutput = {
|
|
28618
29484
|
id: ID10,
|
|
28619
|
-
rule:
|
|
29485
|
+
rule: RULE11,
|
|
28620
29486
|
pin: STANDARD_PIN,
|
|
28621
29487
|
run: runStatic4,
|
|
28622
29488
|
runServed: (runtime) => runServedHalf2(runtime)
|
|
28623
29489
|
};
|
|
28624
29490
|
|
|
28625
29491
|
// src/detectors/s45-origin-targets.ts
|
|
28626
|
-
import { readFileSync as
|
|
28627
|
-
import { join as
|
|
29492
|
+
import { readFileSync as readFileSync24 } from "fs";
|
|
29493
|
+
import { join as join34 } from "path";
|
|
28628
29494
|
|
|
28629
29495
|
// src/detectors/data/pslPrivate.ts
|
|
28630
29496
|
var PSL_PRIVATE_RULES = [
|
|
@@ -32081,7 +32947,7 @@ var PSL_PRIVATE_RULES = [
|
|
|
32081
32947
|
// src/detectors/s45-origin-targets.ts
|
|
32082
32948
|
var HOSTS_VERIFICATION = (id) => HOSTS[id]?.verification;
|
|
32083
32949
|
var ID11 = "S45 origin-targets";
|
|
32084
|
-
var
|
|
32950
|
+
var RULE12 = "S-45";
|
|
32085
32951
|
var PIN12 = STANDARD_PIN;
|
|
32086
32952
|
var PLATFORM_HOSTS = PSL_PRIVATE_RULES.map((r) => r.startsWith("*.") ? r.slice(2) : r);
|
|
32087
32953
|
var TRANSPORT_RE4 = /\bStreamableHTTPServerTransport\b|\bWebStandardStreamableHTTPServerTransport\b|\bcreateMcpHandler\s*\(|\.(?:post|all)\(\s*["'`]\/mcp["'`]|\bbuildHttpApp\s*\(/;
|
|
@@ -32144,16 +33010,16 @@ function servesStreamableHttp(tree, manifest) {
|
|
|
32144
33010
|
});
|
|
32145
33011
|
}
|
|
32146
33012
|
function run7(tree) {
|
|
32147
|
-
const manifestPath2 =
|
|
33013
|
+
const manifestPath2 = join34(tree.root, "mcp-server.json");
|
|
32148
33014
|
let manifest = {};
|
|
32149
33015
|
try {
|
|
32150
|
-
manifest = JSON.parse(
|
|
33016
|
+
manifest = JSON.parse(readFileSync24(manifestPath2, "utf8"));
|
|
32151
33017
|
} catch (err) {
|
|
32152
33018
|
if (fsErrorCode(err) !== "ENOENT")
|
|
32153
33019
|
return couldNotJudge(
|
|
32154
33020
|
ID11,
|
|
32155
33021
|
manifestPath2,
|
|
32156
|
-
`mcp-server.json could not be read or parsed (${fsErrorCode(err)}) (${
|
|
33022
|
+
`mcp-server.json could not be read or parsed (${fsErrorCode(err)}) (${RULE12})`
|
|
32157
33023
|
);
|
|
32158
33024
|
}
|
|
32159
33025
|
const files = tree.files.map((f) => ({ f, text: textOf(f) }));
|
|
@@ -32164,11 +33030,11 @@ function run7(tree) {
|
|
|
32164
33030
|
id: ID11,
|
|
32165
33031
|
anchor: manifestPath2,
|
|
32166
33032
|
state: "absent",
|
|
32167
|
-
verdict: hasHttp ? `no target host declared (mcp-server.json distribution.targets is absent): the server is not distributed on hosts \u2014 ${
|
|
33033
|
+
verdict: hasHttp ? `no target host declared (mcp-server.json distribution.targets is absent): the server is not distributed on hosts \u2014 ${RULE12} n/a` : `no HTTP transport and no target host declared (mcp-server.json distribution.targets): not a remote server \u2014 ${RULE12} n/a`
|
|
32168
33034
|
};
|
|
32169
33035
|
}
|
|
32170
33036
|
if (read.kind === "unreadable")
|
|
32171
|
-
return couldNotJudge(ID11, manifestPath2, `${read.reason} (${
|
|
33037
|
+
return couldNotJudge(ID11, manifestPath2, `${read.reason} (${RULE12})`);
|
|
32172
33038
|
const targets = read.targets;
|
|
32173
33039
|
const red = [];
|
|
32174
33040
|
const unread2 = [];
|
|
@@ -32198,7 +33064,7 @@ function run7(tree) {
|
|
|
32198
33064
|
}
|
|
32199
33065
|
}
|
|
32200
33066
|
try {
|
|
32201
|
-
const env =
|
|
33067
|
+
const env = readFileSync24(join34(tree.root, ".env.example"), "utf8");
|
|
32202
33068
|
for (const m of env.matchAll(/^PUBLIC_BASE_URL=(\S+)/gm))
|
|
32203
33069
|
urls.push({ url: m[1], where: ".env.example" });
|
|
32204
33070
|
} catch {
|
|
@@ -32256,28 +33122,28 @@ function run7(tree) {
|
|
|
32256
33122
|
id: ID11,
|
|
32257
33123
|
anchor: manifestPath2,
|
|
32258
33124
|
state: "non-conforming",
|
|
32259
|
-
verdict: `${
|
|
33125
|
+
verdict: `${RULE12}: ${red.join("; ")}${unread2.length > 0 ? `; also could not judge: ${unread2.join("; ")}` : ""}`
|
|
32260
33126
|
};
|
|
32261
|
-
if (unread2.length > 0) return couldNotJudge(ID11, manifestPath2, `${unread2.join("; ")} (${
|
|
33127
|
+
if (unread2.length > 0) return couldNotJudge(ID11, manifestPath2, `${unread2.join("; ")} (${RULE12})`);
|
|
32262
33128
|
return {
|
|
32263
33129
|
id: ID11,
|
|
32264
33130
|
anchor: manifestPath2,
|
|
32265
33131
|
state: "present",
|
|
32266
|
-
verdict: `declared targets ${targets.join(", ")}: owned origin (${publicUrls.map((u) => hostOf2(u.url)).join(", ")}), Streamable HTTP served, every declared verification path read from configuration (${
|
|
33132
|
+
verdict: `declared targets ${targets.join(", ")}: owned origin (${publicUrls.map((u) => hostOf2(u.url)).join(", ")}), Streamable HTTP served, every declared verification path read from configuration (${RULE12})`
|
|
32267
33133
|
};
|
|
32268
33134
|
}
|
|
32269
33135
|
var s45OriginTargets = {
|
|
32270
33136
|
id: ID11,
|
|
32271
|
-
rule:
|
|
33137
|
+
rule: RULE12,
|
|
32272
33138
|
pin: PIN12,
|
|
32273
33139
|
run: run7
|
|
32274
33140
|
};
|
|
32275
33141
|
|
|
32276
33142
|
// src/detectors/s46-registration-redirects.ts
|
|
32277
|
-
import { readFileSync as
|
|
32278
|
-
import { join as
|
|
33143
|
+
import { readFileSync as readFileSync25 } from "fs";
|
|
33144
|
+
import { join as join35 } from "path";
|
|
32279
33145
|
var ID12 = "S46 registration-redirects";
|
|
32280
|
-
var
|
|
33146
|
+
var RULE13 = "S-46";
|
|
32281
33147
|
var AS_ROUTE = /["'`]\/?\.well-known\/oauth-authorization-server["'`]/;
|
|
32282
33148
|
var CIMD_RE2 = flagTrueRe("client_id_metadata_document_supported");
|
|
32283
33149
|
function textOf2(f) {
|
|
@@ -32296,16 +33162,16 @@ function siteOf(files, re) {
|
|
|
32296
33162
|
return void 0;
|
|
32297
33163
|
}
|
|
32298
33164
|
function run8(tree) {
|
|
32299
|
-
const manifestPath2 =
|
|
33165
|
+
const manifestPath2 = join35(tree.root, "mcp-server.json");
|
|
32300
33166
|
let manifest = {};
|
|
32301
33167
|
try {
|
|
32302
|
-
manifest = JSON.parse(
|
|
33168
|
+
manifest = JSON.parse(readFileSync25(manifestPath2, "utf8"));
|
|
32303
33169
|
} catch (err) {
|
|
32304
33170
|
if (fsErrorCode(err) !== "ENOENT")
|
|
32305
33171
|
return couldNotJudge(
|
|
32306
33172
|
ID12,
|
|
32307
33173
|
manifestPath2,
|
|
32308
|
-
`mcp-server.json could not be read or parsed (${fsErrorCode(err)}) (${
|
|
33174
|
+
`mcp-server.json could not be read or parsed (${fsErrorCode(err)}) (${RULE13})`
|
|
32309
33175
|
);
|
|
32310
33176
|
}
|
|
32311
33177
|
const read = readTargets(manifest);
|
|
@@ -32314,10 +33180,10 @@ function run8(tree) {
|
|
|
32314
33180
|
id: ID12,
|
|
32315
33181
|
anchor: manifestPath2,
|
|
32316
33182
|
state: "absent",
|
|
32317
|
-
verdict: `no target host declared (mcp-server.json distribution.targets is absent) \u2014 ${
|
|
33183
|
+
verdict: `no target host declared (mcp-server.json distribution.targets is absent) \u2014 ${RULE13} n/a`
|
|
32318
33184
|
};
|
|
32319
33185
|
if (read.kind === "unreadable")
|
|
32320
|
-
return couldNotJudge(ID12, manifestPath2, `${read.reason} (${
|
|
33186
|
+
return couldNotJudge(ID12, manifestPath2, `${read.reason} (${RULE13})`);
|
|
32321
33187
|
const installed = readInstalledAs(tree);
|
|
32322
33188
|
const asSite = siteOf(tree.files, AS_ROUTE);
|
|
32323
33189
|
if (!asSite && installed.publishers.length === 0)
|
|
@@ -32325,7 +33191,7 @@ function run8(tree) {
|
|
|
32325
33191
|
id: ID12,
|
|
32326
33192
|
anchor: manifestPath2,
|
|
32327
33193
|
state: "absent",
|
|
32328
|
-
verdict: `no authorization server in the tree or installed (no ${".well-known/oauth-authorization-server"} route): the server authenticates no person \u2014 ${
|
|
33194
|
+
verdict: `no authorization server in the tree or installed (no ${".well-known/oauth-authorization-server"} route): the server authenticates no person \u2014 ${RULE13} n/a`
|
|
32329
33195
|
};
|
|
32330
33196
|
const first = (...res) => {
|
|
32331
33197
|
for (const re of res) {
|
|
@@ -32362,19 +33228,19 @@ function run8(tree) {
|
|
|
32362
33228
|
id: ID12,
|
|
32363
33229
|
anchor: asSite ?? manifestPath2,
|
|
32364
33230
|
state: "non-conforming",
|
|
32365
|
-
verdict: `${
|
|
33231
|
+
verdict: `${RULE13}: ${red.join("; ")}${unread2.length > 0 ? `; also could not judge: ${unread2.join("; ")}` : ""}`
|
|
32366
33232
|
};
|
|
32367
33233
|
if (unread2.length > 0)
|
|
32368
33234
|
return couldNotJudge(
|
|
32369
33235
|
ID12,
|
|
32370
33236
|
asSite ?? manifestPath2,
|
|
32371
|
-
`CIMD (${cimd}) and DCR (${dcr}) offered; ${unread2.join("; ")} (${
|
|
33237
|
+
`CIMD (${cimd}) and DCR (${dcr}) offered; ${unread2.join("; ")} (${RULE13})`
|
|
32372
33238
|
);
|
|
32373
33239
|
return {
|
|
32374
33240
|
id: ID12,
|
|
32375
33241
|
anchor: asSite ?? manifestPath2,
|
|
32376
33242
|
state: "present",
|
|
32377
|
-
verdict: `CIMD (${cimd}) and DCR (${dcr}) offered; no declared host needs a redirect callback (${
|
|
33243
|
+
verdict: `CIMD (${cimd}) and DCR (${dcr}) offered; no declared host needs a redirect callback (${RULE13})`
|
|
32378
33244
|
};
|
|
32379
33245
|
}
|
|
32380
33246
|
function sameTarget(location, redirect) {
|
|
@@ -32428,7 +33294,7 @@ function judgeAttempt(a) {
|
|
|
32428
33294
|
return { kind: "unread", text: `${at} (neither accepted nor refused)` };
|
|
32429
33295
|
}
|
|
32430
33296
|
function runServed5(runtime) {
|
|
32431
|
-
const r =
|
|
33297
|
+
const r = judgeServed2(runtime);
|
|
32432
33298
|
if (!runtime.launchError || !runtime.publicAuth) return r;
|
|
32433
33299
|
const note = ` [the MCP handshake failed: ${runtime.launchError}; the public authorization reads were made]`;
|
|
32434
33300
|
return {
|
|
@@ -32437,11 +33303,11 @@ function runServed5(runtime) {
|
|
|
32437
33303
|
...r.reason !== void 0 ? { reason: `${r.reason}${note}` } : {}
|
|
32438
33304
|
};
|
|
32439
33305
|
}
|
|
32440
|
-
function
|
|
33306
|
+
function judgeServed2(runtime) {
|
|
32441
33307
|
let facts;
|
|
32442
33308
|
if (!runtime.served && runtime.publicAuth) facts = runtime.publicAuth;
|
|
32443
33309
|
else {
|
|
32444
|
-
const got = servedOrCouldNotJudge(ID12,
|
|
33310
|
+
const got = servedOrCouldNotJudge(ID12, RULE13, runtime);
|
|
32445
33311
|
if ("cnj" in got) return got.cnj;
|
|
32446
33312
|
facts = got.served;
|
|
32447
33313
|
}
|
|
@@ -32451,17 +33317,17 @@ function judgeServed(runtime) {
|
|
|
32451
33317
|
return couldNotJudge(
|
|
32452
33318
|
ID12,
|
|
32453
33319
|
anchor,
|
|
32454
|
-
`no source tree was given (--source), so the declared targets (mcp-server.json distribution.targets) were not read (${
|
|
33320
|
+
`no source tree was given (--source), so the declared targets (mcp-server.json distribution.targets) were not read (${RULE13})`
|
|
32455
33321
|
);
|
|
32456
33322
|
let manifest = {};
|
|
32457
33323
|
try {
|
|
32458
|
-
manifest = JSON.parse(
|
|
33324
|
+
manifest = JSON.parse(readFileSync25(join35(src, "mcp-server.json"), "utf8"));
|
|
32459
33325
|
} catch (err) {
|
|
32460
33326
|
if (fsErrorCode(err) !== "ENOENT")
|
|
32461
33327
|
return couldNotJudge(
|
|
32462
33328
|
ID12,
|
|
32463
33329
|
anchor,
|
|
32464
|
-
`mcp-server.json not read: ${err.message} (${
|
|
33330
|
+
`mcp-server.json not read: ${err.message} (${RULE13})`
|
|
32465
33331
|
);
|
|
32466
33332
|
}
|
|
32467
33333
|
const read = readTargets(manifest);
|
|
@@ -32470,15 +33336,15 @@ function judgeServed(runtime) {
|
|
|
32470
33336
|
id: ID12,
|
|
32471
33337
|
anchor,
|
|
32472
33338
|
state: "absent",
|
|
32473
|
-
verdict: `no target host declared (mcp-server.json distribution.targets is absent) \u2014 ${
|
|
33339
|
+
verdict: `no target host declared (mcp-server.json distribution.targets is absent) \u2014 ${RULE13} n/a`
|
|
32474
33340
|
};
|
|
32475
|
-
if (read.kind === "unreadable") return couldNotJudge(ID12, anchor, `${read.reason} (${
|
|
33341
|
+
if (read.kind === "unreadable") return couldNotJudge(ID12, anchor, `${read.reason} (${RULE13})`);
|
|
32476
33342
|
const as = facts.authServer;
|
|
32477
33343
|
if (as.kind !== "document")
|
|
32478
33344
|
return couldNotJudge(
|
|
32479
33345
|
ID12,
|
|
32480
33346
|
anchor,
|
|
32481
|
-
`the authorization-server metadata was not read: ${as.kind === "not-run" ? as.reason : `${as.url}: ${as.reason}`} (${
|
|
33347
|
+
`the authorization-server metadata was not read: ${as.kind === "not-run" ? as.reason : `${as.url}: ${as.reason}`} (${RULE13})`
|
|
32482
33348
|
);
|
|
32483
33349
|
const doc = as.document;
|
|
32484
33350
|
const red = [];
|
|
@@ -32531,15 +33397,15 @@ function judgeServed(runtime) {
|
|
|
32531
33397
|
id: ID12,
|
|
32532
33398
|
anchor,
|
|
32533
33399
|
state: "non-conforming",
|
|
32534
|
-
verdict: `${
|
|
33400
|
+
verdict: `${RULE13} (served): ${red.join("; ")}${unread2.length > 0 ? `; also could not judge: ${unread2.join("; ")}` : ""}`
|
|
32535
33401
|
};
|
|
32536
33402
|
if (unread2.length > 0)
|
|
32537
|
-
return couldNotJudge(ID12, anchor, `${ok.join("; ")}; ${unread2.join("; ")} (${
|
|
32538
|
-
return { id: ID12, anchor, state: "present", verdict: `${ok.join("; ")} (${
|
|
33403
|
+
return couldNotJudge(ID12, anchor, `${ok.join("; ")}; ${unread2.join("; ")} (${RULE13}, served)`);
|
|
33404
|
+
return { id: ID12, anchor, state: "present", verdict: `${ok.join("; ")} (${RULE13}, served)` };
|
|
32539
33405
|
}
|
|
32540
33406
|
var s46RegistrationRedirects = {
|
|
32541
33407
|
id: ID12,
|
|
32542
|
-
rule:
|
|
33408
|
+
rule: RULE13,
|
|
32543
33409
|
pin: STANDARD_PIN,
|
|
32544
33410
|
run: run8,
|
|
32545
33411
|
runServed: runServed5
|
|
@@ -32547,7 +33413,7 @@ var s46RegistrationRedirects = {
|
|
|
32547
33413
|
|
|
32548
33414
|
// src/detectors/s47-webhook-delivery.ts
|
|
32549
33415
|
var ID13 = "S47 webhook-delivery";
|
|
32550
|
-
var
|
|
33416
|
+
var RULE14 = "S-47";
|
|
32551
33417
|
var OUTBOUND_RE = /\bfetch\s*\(|\b(?:undici\.)?request\s*\(|\.post\s*\(|\bhttps?\.request\s*\(/;
|
|
32552
33418
|
var CALLBACK_RE = /\b(?:callbackUrl|callback_url|webhookUrl|webhook_url)\b|\b(?:subscription|subscriber|sub|delivery|callback|webhook|target)\w*\??\.(?:url|uri|href|endpoint)\b/;
|
|
32553
33419
|
var HEADERS = ["webhook-id", "webhook-timestamp", "webhook-signature"];
|
|
@@ -32701,7 +33567,7 @@ function bodyOf(file, line, col, levels = 0) {
|
|
|
32701
33567
|
return { start: b.startLine, end: b.endLine, text: b.text };
|
|
32702
33568
|
}
|
|
32703
33569
|
function run9(tree) {
|
|
32704
|
-
const { surface, early } = eventsGate(ID13, tree,
|
|
33570
|
+
const { surface, early } = eventsGate(ID13, tree, RULE14);
|
|
32705
33571
|
if (early) return early;
|
|
32706
33572
|
const anchor = surface.declared?.anchor ?? surface.methods.get("events/subscribe")?.[0] ?? "-";
|
|
32707
33573
|
const outbound2 = lineHits(tree, OUTBOUND_RE);
|
|
@@ -32761,28 +33627,28 @@ function run9(tree) {
|
|
|
32761
33627
|
return couldNotJudge(
|
|
32762
33628
|
ID13,
|
|
32763
33629
|
anchor,
|
|
32764
|
-
`${[...red, ...unread2].join("; ")} in this tree, but ${surface.helpers.join(", ")} is imported and may deliver events from outside it (${
|
|
33630
|
+
`${[...red, ...unread2].join("; ")} in this tree, but ${surface.helpers.join(", ")} is imported and may deliver events from outside it (${RULE14})`
|
|
32765
33631
|
);
|
|
32766
33632
|
if (red.length > 0)
|
|
32767
33633
|
return {
|
|
32768
33634
|
id: ID13,
|
|
32769
33635
|
anchor,
|
|
32770
33636
|
state: "non-conforming",
|
|
32771
|
-
verdict: `${
|
|
33637
|
+
verdict: `${RULE14}: ${red.join("; ")}${unread2.length > 0 ? `; also could not judge: ${unread2.join("; ")}` : ""}`
|
|
32772
33638
|
};
|
|
32773
|
-
if (unread2.length > 0) return couldNotJudge(ID13, anchor, `${unread2.join("; ")} (${
|
|
33639
|
+
if (unread2.length > 0) return couldNotJudge(ID13, anchor, `${unread2.join("; ")} (${RULE14})`);
|
|
32774
33640
|
return {
|
|
32775
33641
|
id: ID13,
|
|
32776
33642
|
anchor: delivery?.anchor ?? anchor,
|
|
32777
33643
|
state: "present",
|
|
32778
|
-
verdict: `events delivered by webhook (${delivery?.anchor}), signed with ${HEADERS.join(", ")}, callback verified before the first delivery (${
|
|
33644
|
+
verdict: `events delivered by webhook (${delivery?.anchor}), signed with ${HEADERS.join(", ")}, callback verified before the first delivery (${RULE14})`
|
|
32779
33645
|
};
|
|
32780
33646
|
}
|
|
32781
|
-
var s47WebhookDelivery = { id: ID13, rule:
|
|
33647
|
+
var s47WebhookDelivery = { id: ID13, rule: RULE14, pin: STANDARD_PIN, run: run9 };
|
|
32782
33648
|
|
|
32783
33649
|
// src/detectors/s48-per-member.ts
|
|
32784
33650
|
var ID14 = "S48 per-member";
|
|
32785
|
-
var
|
|
33651
|
+
var RULE15 = "S-48";
|
|
32786
33652
|
var AS_ROUTE2 = /["'`]\/?\.well-known\/oauth-authorization-server["'`]/;
|
|
32787
33653
|
var CRED = "(?:TOKEN|KEY|SECRET|BEARER|CREDENTIAL|PASSWORD)";
|
|
32788
33654
|
var CRED_CAMEL = "(?:[Tt]oken|[Kk]ey|[Ss]ecret|[Bb]earer|[Cc]redential|[Pp]assword)";
|
|
@@ -32821,12 +33687,12 @@ function run10(tree) {
|
|
|
32821
33687
|
id: ID14,
|
|
32822
33688
|
anchor: "-",
|
|
32823
33689
|
state: "absent",
|
|
32824
|
-
verdict: `no authorization server in the tree or installed, and the ${
|
|
33690
|
+
verdict: `no authorization server in the tree or installed, and the ${RULE15} scope condition ${S48_CONDITION} is false here: ${scope2.found} \u2014 ${RULE15} n/a`
|
|
32825
33691
|
};
|
|
32826
33692
|
return couldNotJudge(
|
|
32827
33693
|
ID14,
|
|
32828
33694
|
scope2.anchor,
|
|
32829
|
-
`the ${
|
|
33695
|
+
`the ${RULE15} scope condition ${S48_CONDITION} cannot be read: ${scope2.why} (${RULE15})`
|
|
32830
33696
|
);
|
|
32831
33697
|
}
|
|
32832
33698
|
const anchor = asSite?.anchor ?? `node_modules/${installed.publishers[0]}`;
|
|
@@ -32853,26 +33719,26 @@ function run10(tree) {
|
|
|
32853
33719
|
id: ID14,
|
|
32854
33720
|
anchor: fallbacks[0]?.anchor ?? anchor,
|
|
32855
33721
|
state: "non-conforming",
|
|
32856
|
-
verdict: `${
|
|
33722
|
+
verdict: `${RULE15}: ${red.join("; ")}${unread2.length > 0 ? `; also could not judge: ${unread2.join("; ")}` : ""}`
|
|
32857
33723
|
};
|
|
32858
33724
|
if (unread2.length > 0)
|
|
32859
33725
|
return couldNotJudge(
|
|
32860
33726
|
ID14,
|
|
32861
33727
|
anchor,
|
|
32862
|
-
`no shared-credential fallback found; ${unread2.join("; ")} (${
|
|
33728
|
+
`no shared-credential fallback found; ${unread2.join("; ")} (${RULE15})`
|
|
32863
33729
|
);
|
|
32864
33730
|
return {
|
|
32865
33731
|
id: ID14,
|
|
32866
33732
|
anchor: challenge?.anchor ?? anchor,
|
|
32867
33733
|
state: "present",
|
|
32868
|
-
verdict: `no shared-credential fallback on the request path; a member with no credential is refused with a 401 challenge (${challenge?.anchor}) (${
|
|
33734
|
+
verdict: `no shared-credential fallback on the request path; a member with no credential is refused with a 401 challenge (${challenge?.anchor}) (${RULE15})`
|
|
32869
33735
|
};
|
|
32870
33736
|
}
|
|
32871
|
-
var s48PerMember = { id: ID14, rule:
|
|
33737
|
+
var s48PerMember = { id: ID14, rule: RULE15, pin: STANDARD_PIN, run: run10 };
|
|
32872
33738
|
|
|
32873
33739
|
// src/detectors/s49-server-metadata.ts
|
|
32874
33740
|
var ID15 = "S49 server-metadata";
|
|
32875
|
-
var
|
|
33741
|
+
var RULE16 = "S-49";
|
|
32876
33742
|
var PLACEHOLDER = /^(?:|\?+|tbd|tba|todo|n\/a|xxx+|placeholder|changeme|lorem ipsum.*|-+)$/i;
|
|
32877
33743
|
var RESERVED_HOST = /(?:^|\.)(?:example\.(?:com|net|org)|example|test|invalid|localhost)$/i;
|
|
32878
33744
|
function isPlaceholder(v) {
|
|
@@ -32947,15 +33813,15 @@ function verdict2(anchor, v, note) {
|
|
|
32947
33813
|
id: ID15,
|
|
32948
33814
|
anchor,
|
|
32949
33815
|
state: "non-conforming",
|
|
32950
|
-
verdict: `${
|
|
33816
|
+
verdict: `${RULE16}: ${v.red.join("; ")}${v.unread.length > 0 ? `; also could not judge: ${v.unread.join("; ")}` : ""}${v.ok.length > 0 ? ` (found: ${v.ok.join("; ")})` : ""}${note}`
|
|
32951
33817
|
};
|
|
32952
33818
|
if (v.unread.length > 0)
|
|
32953
33819
|
return couldNotJudge(
|
|
32954
33820
|
ID15,
|
|
32955
33821
|
anchor,
|
|
32956
|
-
`${v.unread.join("; ")}${v.ok.length > 0 ? ` (found: ${v.ok.join("; ")})` : ""} (${
|
|
33822
|
+
`${v.unread.join("; ")}${v.ok.length > 0 ? ` (found: ${v.ok.join("; ")})` : ""} (${RULE16}${note})`
|
|
32957
33823
|
);
|
|
32958
|
-
return { id: ID15, anchor, state: "present", verdict: `${v.ok.join("; ")} (${
|
|
33824
|
+
return { id: ID15, anchor, state: "present", verdict: `${v.ok.join("; ")} (${RULE16}${note})` };
|
|
32959
33825
|
}
|
|
32960
33826
|
var MANIFEST_FIELDS = [
|
|
32961
33827
|
["name", "string"],
|
|
@@ -32996,13 +33862,13 @@ function run11(tree) {
|
|
|
32996
33862
|
id: ID15,
|
|
32997
33863
|
anchor: "-",
|
|
32998
33864
|
state: "absent",
|
|
32999
|
-
verdict: `no server manifest and no MCP server surface (S-14's predicate: no server construction, no registered tool): not an MCP server \u2014 ${
|
|
33865
|
+
verdict: `no server manifest and no MCP server surface (S-14's predicate: no server construction, no registered tool): not an MCP server \u2014 ${RULE16} n/a`
|
|
33000
33866
|
};
|
|
33001
33867
|
const what = read.length > 0 ? `read ${read.join(", ")}: no placeholder` : "no server manifest (mcp-server.json, mcp.json, server.json) at the tree root";
|
|
33002
33868
|
return couldNotJudge(
|
|
33003
33869
|
ID15,
|
|
33004
33870
|
read[0] ?? "-",
|
|
33005
|
-
`${what}${v.unread.length > 0 ? `; ${v.unread.join("; ")}` : ""}; the eight items are judged on the served initialize answer (serverInfo, instructions, capabilities) \u2014 decided by the served half (${
|
|
33871
|
+
`${what}${v.unread.length > 0 ? `; ${v.unread.join("; ")}` : ""}; the eight items are judged on the served initialize answer (serverInfo, instructions, capabilities) \u2014 decided by the served half (${RULE16})`
|
|
33006
33872
|
);
|
|
33007
33873
|
}
|
|
33008
33874
|
function runServed6(runtime) {
|
|
@@ -33011,14 +33877,14 @@ function runServed6(runtime) {
|
|
|
33011
33877
|
return couldNotJudge(
|
|
33012
33878
|
ID15,
|
|
33013
33879
|
anchor,
|
|
33014
|
-
`the initialize answer was not read: ${runtime.launchError} (${
|
|
33880
|
+
`the initialize answer was not read: ${runtime.launchError} (${RULE16})`
|
|
33015
33881
|
);
|
|
33016
33882
|
const init = runtime.served?.initialize;
|
|
33017
33883
|
if (!init)
|
|
33018
33884
|
return couldNotJudge(
|
|
33019
33885
|
ID15,
|
|
33020
33886
|
anchor,
|
|
33021
|
-
`the introspector recorded no initialize result (instructions unread) (${
|
|
33887
|
+
`the introspector recorded no initialize result (instructions unread) (${RULE16})`
|
|
33022
33888
|
);
|
|
33023
33889
|
const v = { red: [], unread: [], ok: [] };
|
|
33024
33890
|
const si = runtime.serverInfo;
|
|
@@ -33041,7 +33907,7 @@ function runServed6(runtime) {
|
|
|
33041
33907
|
}
|
|
33042
33908
|
var s49ServerMetadata = {
|
|
33043
33909
|
id: ID15,
|
|
33044
|
-
rule:
|
|
33910
|
+
rule: RULE16,
|
|
33045
33911
|
pin: MANUFACT_RULES_PIN,
|
|
33046
33912
|
run: run11,
|
|
33047
33913
|
runServed: runServed6
|
|
@@ -33049,7 +33915,7 @@ var s49ServerMetadata = {
|
|
|
33049
33915
|
|
|
33050
33916
|
// src/detectors/s50-served-discovery.ts
|
|
33051
33917
|
var ID16 = "S50 served-discovery";
|
|
33052
|
-
var
|
|
33918
|
+
var RULE17 = "S-50";
|
|
33053
33919
|
function pathOf(url) {
|
|
33054
33920
|
try {
|
|
33055
33921
|
return new URL(url).pathname;
|
|
@@ -33120,19 +33986,19 @@ function judgeLanding(landing, v) {
|
|
|
33120
33986
|
function run12(tree) {
|
|
33121
33987
|
const read = readDeclaredTargets(tree.root);
|
|
33122
33988
|
if (read.targets.kind === "unreadable")
|
|
33123
|
-
return couldNotJudge(ID16, read.file ?? "-", `${read.targets.reason} (${
|
|
33989
|
+
return couldNotJudge(ID16, read.file ?? "-", `${read.targets.reason} (${RULE17})`);
|
|
33124
33990
|
const manifest = read.manifest ?? {};
|
|
33125
33991
|
if (!servesStreamableHttp(tree, manifest))
|
|
33126
33992
|
return {
|
|
33127
33993
|
id: ID16,
|
|
33128
33994
|
anchor: "-",
|
|
33129
33995
|
state: "absent",
|
|
33130
|
-
verdict: `no Streamable HTTP transport (none in the source, none in the server manifest): no MCP URL to discover the server from \u2014 ${
|
|
33996
|
+
verdict: `no Streamable HTTP transport (none in the source, none in the server manifest): no MCP URL to discover the server from \u2014 ${RULE17} n/a`
|
|
33131
33997
|
};
|
|
33132
33998
|
return couldNotJudge(
|
|
33133
33999
|
ID16,
|
|
33134
34000
|
"-",
|
|
33135
|
-
`the server serves Streamable HTTP: the server card and the setup page are read on the served URL \u2014 run with --url (${
|
|
34001
|
+
`the server serves Streamable HTTP: the server card and the setup page are read on the served URL \u2014 run with --url (${RULE17})`
|
|
33136
34002
|
);
|
|
33137
34003
|
}
|
|
33138
34004
|
function runServed7(runtime) {
|
|
@@ -33142,9 +34008,9 @@ function runServed7(runtime) {
|
|
|
33142
34008
|
return couldNotJudge(
|
|
33143
34009
|
ID16,
|
|
33144
34010
|
anchor,
|
|
33145
|
-
runtime.launchError ? `the server was not read (${runtime.launchError}) and no public read was recorded (${
|
|
34011
|
+
runtime.launchError ? `the server was not read (${runtime.launchError}) and no public read was recorded (${RULE17})` : `the introspector recorded no server-card or setup-page read (${RULE17})`
|
|
33146
34012
|
);
|
|
33147
|
-
if (d.kind === "not-run") return couldNotJudge(ID16, anchor, `${d.reason} (${
|
|
34013
|
+
if (d.kind === "not-run") return couldNotJudge(ID16, anchor, `${d.reason} (${RULE17})`);
|
|
33148
34014
|
const v = { red: [], unread: [], ok: [] };
|
|
33149
34015
|
judgeCards(d.cards, v);
|
|
33150
34016
|
judgeLanding(d.landing, v);
|
|
@@ -33152,7 +34018,7 @@ function runServed7(runtime) {
|
|
|
33152
34018
|
return couldNotJudge(
|
|
33153
34019
|
ID16,
|
|
33154
34020
|
anchor,
|
|
33155
|
-
`the MCP handshake failed: ${runtime.launchError}; the public reads found: ${[...v.red, ...v.unread, ...v.ok].join("; ")} (${
|
|
34021
|
+
`the MCP handshake failed: ${runtime.launchError}; the public reads found: ${[...v.red, ...v.unread, ...v.ok].join("; ")} (${RULE17})`
|
|
33156
34022
|
);
|
|
33157
34023
|
const scope2 = " \u2014 read without a credential, on the endpoint's origin only";
|
|
33158
34024
|
if (v.red.length > 0)
|
|
@@ -33160,19 +34026,19 @@ function runServed7(runtime) {
|
|
|
33160
34026
|
id: ID16,
|
|
33161
34027
|
anchor,
|
|
33162
34028
|
state: "non-conforming",
|
|
33163
|
-
verdict: `${
|
|
34029
|
+
verdict: `${RULE17}: ${v.red.join("; ")}${v.unread.length > 0 ? `; also could not judge: ${v.unread.join("; ")}` : ""}${v.ok.length > 0 ? ` (found: ${v.ok.join("; ")})` : ""}${scope2}`
|
|
33164
34030
|
};
|
|
33165
34031
|
if (v.unread.length > 0)
|
|
33166
34032
|
return couldNotJudge(
|
|
33167
34033
|
ID16,
|
|
33168
34034
|
anchor,
|
|
33169
|
-
`${v.unread.join("; ")}${v.ok.length > 0 ? ` (found: ${v.ok.join("; ")})` : ""} (${
|
|
34035
|
+
`${v.unread.join("; ")}${v.ok.length > 0 ? ` (found: ${v.ok.join("; ")})` : ""} (${RULE17})`
|
|
33170
34036
|
);
|
|
33171
|
-
return { id: ID16, anchor, state: "present", verdict: `${v.ok.join("; ")} (${
|
|
34037
|
+
return { id: ID16, anchor, state: "present", verdict: `${v.ok.join("; ")} (${RULE17}${scope2})` };
|
|
33172
34038
|
}
|
|
33173
34039
|
var s50ServedDiscovery = {
|
|
33174
34040
|
id: ID16,
|
|
33175
|
-
rule:
|
|
34041
|
+
rule: RULE17,
|
|
33176
34042
|
pin: MANUFACT_RULES_PIN,
|
|
33177
34043
|
run: run12,
|
|
33178
34044
|
runServed: runServed7
|
|
@@ -33573,12 +34439,12 @@ function stmtCompletes(s) {
|
|
|
33573
34439
|
}
|
|
33574
34440
|
return true;
|
|
33575
34441
|
}
|
|
33576
|
-
function collectReturns(body, sf,
|
|
34442
|
+
function collectReturns(body, sf, rel2, out, inCatch = false) {
|
|
33577
34443
|
const visit = (n, catching) => {
|
|
33578
34444
|
if (n !== body && ts.isFunctionLike(n)) return;
|
|
33579
34445
|
if (ts.isReturnStatement(n)) {
|
|
33580
34446
|
out.push({
|
|
33581
|
-
anchor: `${
|
|
34447
|
+
anchor: `${rel2}:${startLine(n)}`,
|
|
33582
34448
|
...n.expression ? { expr: n.expression } : {},
|
|
33583
34449
|
form: n.expression ? "return" : "bare-return",
|
|
33584
34450
|
inCatch: catching
|
|
@@ -33594,23 +34460,23 @@ function collectReturns(body, sf, rel, out, inCatch = false) {
|
|
|
33594
34460
|
visit(body, inCatch);
|
|
33595
34461
|
void sf;
|
|
33596
34462
|
}
|
|
33597
|
-
function functionReturns(fn, sf,
|
|
34463
|
+
function functionReturns(fn, sf, rel2) {
|
|
33598
34464
|
const out = [];
|
|
33599
34465
|
const body = fn.body;
|
|
33600
34466
|
if (!body) return out;
|
|
33601
34467
|
if (!ts.isBlock(body)) {
|
|
33602
34468
|
out.push({
|
|
33603
|
-
anchor: `${
|
|
34469
|
+
anchor: `${rel2}:${startLine(body)}`,
|
|
33604
34470
|
expr: body,
|
|
33605
34471
|
form: "concise",
|
|
33606
34472
|
inCatch: false
|
|
33607
34473
|
});
|
|
33608
34474
|
return out;
|
|
33609
34475
|
}
|
|
33610
|
-
collectReturns(body, sf,
|
|
34476
|
+
collectReturns(body, sf, rel2, out);
|
|
33611
34477
|
if (completes(body.statements))
|
|
33612
34478
|
out.push({
|
|
33613
|
-
anchor: `${
|
|
34479
|
+
anchor: `${rel2}:${lineOfPos(sf, body.getEnd())}`,
|
|
33614
34480
|
form: "fall-through",
|
|
33615
34481
|
inCatch: false
|
|
33616
34482
|
});
|
|
@@ -33661,9 +34527,9 @@ function sourceFileOf(f) {
|
|
|
33661
34527
|
}
|
|
33662
34528
|
function readHandler(tree, tool) {
|
|
33663
34529
|
const cut = tool.anchor.lastIndexOf(":");
|
|
33664
|
-
const
|
|
34530
|
+
const rel2 = tool.anchor.slice(0, cut);
|
|
33665
34531
|
const line = Number(tool.anchor.slice(cut + 1));
|
|
33666
|
-
const file = tree.files.find((f) => f.rel ===
|
|
34532
|
+
const file = tree.files.find((f) => f.rel === rel2);
|
|
33667
34533
|
if (!file)
|
|
33668
34534
|
return {
|
|
33669
34535
|
kind: "unread",
|
|
@@ -33683,8 +34549,8 @@ function readHandler(tree, tool) {
|
|
|
33683
34549
|
if (u && isFunctionLikeExpr(u))
|
|
33684
34550
|
return {
|
|
33685
34551
|
kind: "read",
|
|
33686
|
-
anchor: `${
|
|
33687
|
-
returns: functionReturns(u, sf,
|
|
34552
|
+
anchor: `${rel2}:${startLine(u)}`,
|
|
34553
|
+
returns: functionReturns(u, sf, rel2),
|
|
33688
34554
|
sf,
|
|
33689
34555
|
file
|
|
33690
34556
|
};
|
|
@@ -33693,15 +34559,15 @@ function readHandler(tree, tool) {
|
|
|
33693
34559
|
if (fn)
|
|
33694
34560
|
return {
|
|
33695
34561
|
kind: "read",
|
|
33696
|
-
anchor: `${
|
|
33697
|
-
returns: functionReturns(fn, sf,
|
|
34562
|
+
anchor: `${rel2}:${startLine(fn)}`,
|
|
34563
|
+
returns: functionReturns(fn, sf, rel2),
|
|
33698
34564
|
sf,
|
|
33699
34565
|
file
|
|
33700
34566
|
};
|
|
33701
34567
|
return {
|
|
33702
34568
|
kind: "unread",
|
|
33703
|
-
anchor: `${
|
|
33704
|
-
reason: `${tool.name}: its handler \`${u.text}\` is not a function declared in ${
|
|
34569
|
+
anchor: `${rel2}:${startLine(u)}`,
|
|
34570
|
+
reason: `${tool.name}: its handler \`${u.text}\` is not a function declared in ${rel2}`
|
|
33705
34571
|
};
|
|
33706
34572
|
}
|
|
33707
34573
|
}
|
|
@@ -33851,7 +34717,7 @@ function names(list, max = 400) {
|
|
|
33851
34717
|
|
|
33852
34718
|
// src/detectors/s51-served-output.ts
|
|
33853
34719
|
var ID17 = "S51 served-output";
|
|
33854
|
-
var
|
|
34720
|
+
var RULE18 = "S-51";
|
|
33855
34721
|
var isNullish = (e) => {
|
|
33856
34722
|
let x = e;
|
|
33857
34723
|
while (ts2.isParenthesizedExpression(x) || ts2.isAsExpression(x)) x = x.expression;
|
|
@@ -33893,9 +34759,9 @@ function underCondition(n) {
|
|
|
33893
34759
|
}
|
|
33894
34760
|
return false;
|
|
33895
34761
|
}
|
|
33896
|
-
function exemptionSites(sf,
|
|
34762
|
+
function exemptionSites(sf, rel2) {
|
|
33897
34763
|
const out = [];
|
|
33898
|
-
const at = (n) => `${
|
|
34764
|
+
const at = (n) => `${rel2}:${sf.getLineAndCharacterOfPosition(n.getStart(sf)).line + 1}`;
|
|
33899
34765
|
const text = (n) => n.getText(sf).replace(/\s+/g, " ").slice(0, 120);
|
|
33900
34766
|
const visit = (n) => {
|
|
33901
34767
|
if (ts2.isSpreadAssignment(n)) {
|
|
@@ -33946,18 +34812,18 @@ function runStatic5(tree) {
|
|
|
33946
34812
|
return couldNotJudge(
|
|
33947
34813
|
ID17,
|
|
33948
34814
|
surface ?? unresolved[0],
|
|
33949
|
-
noToolsLocatedReason(tree, `no registration was read (${
|
|
34815
|
+
noToolsLocatedReason(tree, `no registration was read (${RULE18})`)
|
|
33950
34816
|
);
|
|
33951
34817
|
return {
|
|
33952
34818
|
id: ID17,
|
|
33953
34819
|
anchor: tree.root,
|
|
33954
34820
|
state: "absent",
|
|
33955
|
-
verdict: `no MCP tool registered in product source \u2014 ${
|
|
34821
|
+
verdict: `no MCP tool registered in product source \u2014 ${RULE18} n/a`
|
|
33956
34822
|
};
|
|
33957
34823
|
}
|
|
33958
34824
|
const unread2 = unresolved.map((a) => ({
|
|
33959
34825
|
anchor: a,
|
|
33960
|
-
reason: `a tool registered here has a name the scan cannot resolve, so whether it declares an output schema is unread (${
|
|
34826
|
+
reason: `a tool registered here has a name the scan cannot resolve, so whether it declares an output schema is unread (${RULE18})`
|
|
33961
34827
|
}));
|
|
33962
34828
|
const missing = [];
|
|
33963
34829
|
const declared = [];
|
|
@@ -33968,7 +34834,7 @@ function runStatic5(tree) {
|
|
|
33968
34834
|
const loc = r.sites.find(
|
|
33969
34835
|
(s) => s.path === t.name && s.kind === "unread" && /^registration/.test(s.form)
|
|
33970
34836
|
);
|
|
33971
|
-
if (loc) unread2.push({ anchor: loc.anchor, reason: `${loc.form} (${
|
|
34837
|
+
if (loc) unread2.push({ anchor: loc.anchor, reason: `${loc.form} (${RULE18})` });
|
|
33972
34838
|
else declared.push(t.name);
|
|
33973
34839
|
}
|
|
33974
34840
|
}
|
|
@@ -33991,7 +34857,7 @@ function runStatic5(tree) {
|
|
|
33991
34857
|
id: ID17,
|
|
33992
34858
|
anchor: exemptions[0]?.anchor ?? missing[0].replace(/^.* \((.*)\)$/, "$1"),
|
|
33993
34859
|
state: "non-conforming",
|
|
33994
|
-
verdict: `${parts.join("; ")} \u2014 every served tool carries an outputSchema and no code path exempts one (${
|
|
34860
|
+
verdict: `${parts.join("; ")} \u2014 every served tool carries an outputSchema and no code path exempts one (${RULE18})`
|
|
33995
34861
|
},
|
|
33996
34862
|
unread2
|
|
33997
34863
|
);
|
|
@@ -34001,17 +34867,17 @@ function runStatic5(tree) {
|
|
|
34001
34867
|
couldNotJudge(
|
|
34002
34868
|
ID17,
|
|
34003
34869
|
tools[0].anchor,
|
|
34004
|
-
`static half: ${declared.length} registered tool(s) declare an outputSchema and no exemption mechanism (X1..X3) is in the registration code; unread by a static run: whether each served result's structuredContent validates against it (${names(declared)}) \u2014 run --mode=dynamic (${
|
|
34870
|
+
`static half: ${declared.length} registered tool(s) declare an outputSchema and no exemption mechanism (X1..X3) is in the registration code; unread by a static run: whether each served result's structuredContent validates against it (${names(declared)}) \u2014 run --mode=dynamic (${RULE18})`
|
|
34005
34871
|
),
|
|
34006
34872
|
unread2
|
|
34007
34873
|
);
|
|
34008
34874
|
}
|
|
34009
34875
|
function runServedHalf3(runtime) {
|
|
34010
|
-
const got = servedToolCalls(ID17,
|
|
34876
|
+
const got = servedToolCalls(ID17, RULE18, runtime);
|
|
34011
34877
|
if ("cnj" in got) return got.cnj;
|
|
34012
34878
|
const { calls, tools, anchor } = got;
|
|
34013
34879
|
if (tools.length === 0)
|
|
34014
|
-
return { id: ID17, anchor, state: "absent", verdict: `the server serves no tool \u2014 ${
|
|
34880
|
+
return { id: ID17, anchor, state: "absent", verdict: `the server serves no tool \u2014 ${RULE18} n/a` };
|
|
34015
34881
|
const noSchema = tools.filter((t) => t.outputSchema === void 0).map((t) => t.name);
|
|
34016
34882
|
const invalid = [];
|
|
34017
34883
|
const unread2 = [];
|
|
@@ -34023,7 +34889,7 @@ function runServedHalf3(runtime) {
|
|
|
34023
34889
|
if (why || !c || c.kind !== "result") {
|
|
34024
34890
|
unread2.push({
|
|
34025
34891
|
anchor: `${anchor} tools/call ${t.name}`,
|
|
34026
|
-
reason: `${t.name}: ${why} (${
|
|
34892
|
+
reason: `${t.name}: ${why} (${RULE18})`
|
|
34027
34893
|
});
|
|
34028
34894
|
continue;
|
|
34029
34895
|
}
|
|
@@ -34038,7 +34904,7 @@ function runServedHalf3(runtime) {
|
|
|
34038
34904
|
else if (v.kind === "unread")
|
|
34039
34905
|
unread2.push({
|
|
34040
34906
|
anchor: `${anchor} tools/list ${t.name}`,
|
|
34041
|
-
reason: `${t.name}: the outputSchema could not be read at ${v.path} \u2014 ${v.why} (${
|
|
34907
|
+
reason: `${t.name}: the outputSchema could not be read at ${v.path} \u2014 ${v.why} (${RULE18})`
|
|
34042
34908
|
});
|
|
34043
34909
|
else validated++;
|
|
34044
34910
|
}
|
|
@@ -34052,7 +34918,7 @@ function runServedHalf3(runtime) {
|
|
|
34052
34918
|
parts.push(`${invalid.length} served result(s) do not validate: ${invalid.join("; ")}`);
|
|
34053
34919
|
return settle(
|
|
34054
34920
|
ID17,
|
|
34055
|
-
{ id: ID17, anchor, state: "non-conforming", verdict: `${parts.join("; ")} (${
|
|
34921
|
+
{ id: ID17, anchor, state: "non-conforming", verdict: `${parts.join("; ")} (${RULE18})` },
|
|
34056
34922
|
unread2
|
|
34057
34923
|
);
|
|
34058
34924
|
}
|
|
@@ -34062,14 +34928,14 @@ function runServedHalf3(runtime) {
|
|
|
34062
34928
|
id: ID17,
|
|
34063
34929
|
anchor,
|
|
34064
34930
|
state: "present",
|
|
34065
|
-
verdict: `${tools.length} served tool(s) declare an outputSchema; ${validated} successful result(s) read, each structuredContent valid against it (${
|
|
34931
|
+
verdict: `${tools.length} served tool(s) declare an outputSchema; ${validated} successful result(s) read, each structuredContent valid against it (${RULE18})`
|
|
34066
34932
|
},
|
|
34067
34933
|
unread2
|
|
34068
34934
|
);
|
|
34069
34935
|
}
|
|
34070
34936
|
var s51ServedOutput = {
|
|
34071
34937
|
id: ID17,
|
|
34072
|
-
rule:
|
|
34938
|
+
rule: RULE18,
|
|
34073
34939
|
pin: S51_RULES_PIN,
|
|
34074
34940
|
run: runStatic5,
|
|
34075
34941
|
runServed: (runtime) => runServedHalf3(runtime)
|
|
@@ -34078,7 +34944,7 @@ var s51ServedOutput = {
|
|
|
34078
34944
|
// src/detectors/s52-no-null-success.ts
|
|
34079
34945
|
import * as ts3 from "typescript";
|
|
34080
34946
|
var ID18 = "S52 no-null-success";
|
|
34081
|
-
var
|
|
34947
|
+
var RULE19 = "S-52";
|
|
34082
34948
|
function nullReturns(tool, read) {
|
|
34083
34949
|
const red = [];
|
|
34084
34950
|
const unread2 = [];
|
|
@@ -34097,7 +34963,7 @@ function nullReturns(tool, read) {
|
|
|
34097
34963
|
else if (v.kind === "unread")
|
|
34098
34964
|
unread2.push({
|
|
34099
34965
|
anchor: r.anchor,
|
|
34100
|
-
reason: `${tool}: the returned value is ${v.form} (${
|
|
34966
|
+
reason: `${tool}: the returned value is ${v.form} (${RULE19})`
|
|
34101
34967
|
});
|
|
34102
34968
|
else {
|
|
34103
34969
|
if (isErrorObject(v.node)) continue;
|
|
@@ -34142,25 +35008,25 @@ function runStatic6(tree) {
|
|
|
34142
35008
|
return couldNotJudge(
|
|
34143
35009
|
ID18,
|
|
34144
35010
|
surface ?? unresolved[0],
|
|
34145
|
-
noToolsLocatedReason(tree, `no handler was read (${
|
|
35011
|
+
noToolsLocatedReason(tree, `no handler was read (${RULE19})`)
|
|
34146
35012
|
);
|
|
34147
35013
|
return {
|
|
34148
35014
|
id: ID18,
|
|
34149
35015
|
anchor: tree.root,
|
|
34150
35016
|
state: "absent",
|
|
34151
|
-
verdict: `no MCP tool registered in product source \u2014 ${
|
|
35017
|
+
verdict: `no MCP tool registered in product source \u2014 ${RULE19} n/a`
|
|
34152
35018
|
};
|
|
34153
35019
|
}
|
|
34154
35020
|
const red = [];
|
|
34155
35021
|
const unread2 = unresolved.map((a) => ({
|
|
34156
35022
|
anchor: a,
|
|
34157
|
-
reason: `a tool registered here has a name the scan cannot resolve, so its handler is unread (${
|
|
35023
|
+
reason: `a tool registered here has a name the scan cannot resolve, so its handler is unread (${RULE19})`
|
|
34158
35024
|
}));
|
|
34159
35025
|
const read = [];
|
|
34160
35026
|
for (const t of tools) {
|
|
34161
35027
|
const h = readHandler(tree, t);
|
|
34162
35028
|
if (h.kind === "unread") {
|
|
34163
|
-
unread2.push({ anchor: h.anchor, reason: `${h.reason} (${
|
|
35029
|
+
unread2.push({ anchor: h.anchor, reason: `${h.reason} (${RULE19})` });
|
|
34164
35030
|
continue;
|
|
34165
35031
|
}
|
|
34166
35032
|
read.push(t.name);
|
|
@@ -34175,7 +35041,7 @@ function runStatic6(tree) {
|
|
|
34175
35041
|
id: ID18,
|
|
34176
35042
|
anchor: red[0].anchor,
|
|
34177
35043
|
state: "non-conforming",
|
|
34178
|
-
verdict: `${red.length} success-path return(s) answer null or empty: ${red.map((f) => `${f.tool} ${f.form} (${f.anchor})`).join("; ")} \u2014 a tool that found nothing returns a typed empty value (${
|
|
35044
|
+
verdict: `${red.length} success-path return(s) answer null or empty: ${red.map((f) => `${f.tool} ${f.form} (${f.anchor})`).join("; ")} \u2014 a tool that found nothing returns a typed empty value (${RULE19})`
|
|
34179
35045
|
},
|
|
34180
35046
|
unread2
|
|
34181
35047
|
);
|
|
@@ -34184,17 +35050,17 @@ function runStatic6(tree) {
|
|
|
34184
35050
|
couldNotJudge(
|
|
34185
35051
|
ID18,
|
|
34186
35052
|
tools[0].anchor,
|
|
34187
|
-
`static half: no success-path return writes null or empty in the ${read.length} handler(s) read (${names(read)}); unread by a static run: what each returned expression evaluates to \u2014 run --mode=dynamic (${
|
|
35053
|
+
`static half: no success-path return writes null or empty in the ${read.length} handler(s) read (${names(read)}); unread by a static run: what each returned expression evaluates to \u2014 run --mode=dynamic (${RULE19})`
|
|
34188
35054
|
),
|
|
34189
35055
|
unread2
|
|
34190
35056
|
);
|
|
34191
35057
|
}
|
|
34192
35058
|
function runServedHalf4(runtime) {
|
|
34193
|
-
const got = servedToolCalls(ID18,
|
|
35059
|
+
const got = servedToolCalls(ID18, RULE19, runtime);
|
|
34194
35060
|
if ("cnj" in got) return got.cnj;
|
|
34195
35061
|
const { calls, anchor } = got;
|
|
34196
35062
|
if (runtime.tools.length === 0)
|
|
34197
|
-
return { id: ID18, anchor, state: "absent", verdict: `the server serves no tool \u2014 ${
|
|
35063
|
+
return { id: ID18, anchor, state: "absent", verdict: `the server serves no tool \u2014 ${RULE19} n/a` };
|
|
34198
35064
|
const red = [];
|
|
34199
35065
|
const unread2 = [];
|
|
34200
35066
|
let ok = 0;
|
|
@@ -34204,7 +35070,7 @@ function runServedHalf4(runtime) {
|
|
|
34204
35070
|
if (why || !c || c.kind !== "result") {
|
|
34205
35071
|
unread2.push({
|
|
34206
35072
|
anchor: `${anchor} tools/call ${t.name}`,
|
|
34207
|
-
reason: `${t.name}: ${why} (${
|
|
35073
|
+
reason: `${t.name}: ${why} (${RULE19})`
|
|
34208
35074
|
});
|
|
34209
35075
|
continue;
|
|
34210
35076
|
}
|
|
@@ -34219,7 +35085,7 @@ function runServedHalf4(runtime) {
|
|
|
34219
35085
|
id: ID18,
|
|
34220
35086
|
anchor,
|
|
34221
35087
|
state: "non-conforming",
|
|
34222
|
-
verdict: `${red.length} successful result(s) answer null or empty: ${red.join("; ")} (${
|
|
35088
|
+
verdict: `${red.length} successful result(s) answer null or empty: ${red.join("; ")} (${RULE19})`
|
|
34223
35089
|
},
|
|
34224
35090
|
unread2
|
|
34225
35091
|
);
|
|
@@ -34229,14 +35095,14 @@ function runServedHalf4(runtime) {
|
|
|
34229
35095
|
id: ID18,
|
|
34230
35096
|
anchor,
|
|
34231
35097
|
state: "present",
|
|
34232
|
-
verdict: `${ok} successful result(s) read, each carrying a typed value (${
|
|
35098
|
+
verdict: `${ok} successful result(s) read, each carrying a typed value (${RULE19})`
|
|
34233
35099
|
},
|
|
34234
35100
|
unread2
|
|
34235
35101
|
);
|
|
34236
35102
|
}
|
|
34237
35103
|
var s52NoNullSuccess = {
|
|
34238
35104
|
id: ID18,
|
|
34239
|
-
rule:
|
|
35105
|
+
rule: RULE19,
|
|
34240
35106
|
pin: S51_RULES_PIN,
|
|
34241
35107
|
run: runStatic6,
|
|
34242
35108
|
runServed: (runtime) => runServedHalf4(runtime)
|
|
@@ -34245,7 +35111,7 @@ var s52NoNullSuccess = {
|
|
|
34245
35111
|
// src/detectors/s53-structured-not-text.ts
|
|
34246
35112
|
import * as ts4 from "typescript";
|
|
34247
35113
|
var ID19 = "S53 structured-not-text";
|
|
34248
|
-
var
|
|
35114
|
+
var RULE20 = "S-53";
|
|
34249
35115
|
function classifyTextExpr(e, sf, depth = 0) {
|
|
34250
35116
|
let x = e;
|
|
34251
35117
|
while (ts4.isParenthesizedExpression(x) || ts4.isAsExpression(x)) x = x.expression;
|
|
@@ -34332,26 +35198,26 @@ function runStatic7(tree) {
|
|
|
34332
35198
|
return couldNotJudge(
|
|
34333
35199
|
ID19,
|
|
34334
35200
|
surface ?? unresolved[0],
|
|
34335
|
-
noToolsLocatedReason(tree, `no handler was read (${
|
|
35201
|
+
noToolsLocatedReason(tree, `no handler was read (${RULE20})`)
|
|
34336
35202
|
);
|
|
34337
35203
|
return {
|
|
34338
35204
|
id: ID19,
|
|
34339
35205
|
anchor: tree.root,
|
|
34340
35206
|
state: "absent",
|
|
34341
|
-
verdict: `no MCP tool registered in product source \u2014 ${
|
|
35207
|
+
verdict: `no MCP tool registered in product source \u2014 ${RULE20} n/a`
|
|
34342
35208
|
};
|
|
34343
35209
|
}
|
|
34344
35210
|
const red = [];
|
|
34345
35211
|
const unread2 = unresolved.map((a) => ({
|
|
34346
35212
|
anchor: a,
|
|
34347
|
-
reason: `a tool registered here has a name the scan cannot resolve, so its handler is unread (${
|
|
35213
|
+
reason: `a tool registered here has a name the scan cannot resolve, so its handler is unread (${RULE20})`
|
|
34348
35214
|
}));
|
|
34349
35215
|
const read = [];
|
|
34350
35216
|
let firstRed = "";
|
|
34351
35217
|
for (const t of tools) {
|
|
34352
35218
|
const h = readHandler(tree, t);
|
|
34353
35219
|
if (h.kind === "unread") {
|
|
34354
|
-
unread2.push({ anchor: h.anchor, reason: `${h.reason} (${
|
|
35220
|
+
unread2.push({ anchor: h.anchor, reason: `${h.reason} (${RULE20})` });
|
|
34355
35221
|
continue;
|
|
34356
35222
|
}
|
|
34357
35223
|
read.push(t.name);
|
|
@@ -34362,7 +35228,7 @@ function runStatic7(tree) {
|
|
|
34362
35228
|
if (v.kind === "unread")
|
|
34363
35229
|
unread2.push({
|
|
34364
35230
|
anchor: r.anchor,
|
|
34365
|
-
reason: `${t.name}: the returned value is ${v.form} (${
|
|
35231
|
+
reason: `${t.name}: the returned value is ${v.form} (${RULE20})`
|
|
34366
35232
|
});
|
|
34367
35233
|
continue;
|
|
34368
35234
|
}
|
|
@@ -34371,7 +35237,7 @@ function runStatic7(tree) {
|
|
|
34371
35237
|
if (sc.kind === "spread") {
|
|
34372
35238
|
unread2.push({
|
|
34373
35239
|
anchor: r.anchor,
|
|
34374
|
-
reason: `${t.name}: a result object built with a spread, structuredContent unread (${
|
|
35240
|
+
reason: `${t.name}: a result object built with a spread, structuredContent unread (${RULE20})`
|
|
34375
35241
|
});
|
|
34376
35242
|
continue;
|
|
34377
35243
|
}
|
|
@@ -34381,7 +35247,7 @@ function runStatic7(tree) {
|
|
|
34381
35247
|
red.push(`${t.name} ${c.form}, no structuredContent (${r.anchor})`);
|
|
34382
35248
|
firstRed ||= r.anchor;
|
|
34383
35249
|
} else if (c.kind === "unread")
|
|
34384
|
-
unread2.push({ anchor: r.anchor, reason: `${t.name}: ${c.form} (${
|
|
35250
|
+
unread2.push({ anchor: r.anchor, reason: `${t.name}: ${c.form} (${RULE20})` });
|
|
34385
35251
|
}
|
|
34386
35252
|
}
|
|
34387
35253
|
}
|
|
@@ -34392,7 +35258,7 @@ function runStatic7(tree) {
|
|
|
34392
35258
|
id: ID19,
|
|
34393
35259
|
anchor: firstRed,
|
|
34394
35260
|
state: "non-conforming",
|
|
34395
|
-
verdict: `${red.length} success-path return(s) carry data in the text only: ${red.join("; ")} \u2014 return it as structuredContent under the outputSchema, the text being its serialization (${
|
|
35261
|
+
verdict: `${red.length} success-path return(s) carry data in the text only: ${red.join("; ")} \u2014 return it as structuredContent under the outputSchema, the text being its serialization (${RULE20})`
|
|
34396
35262
|
},
|
|
34397
35263
|
unread2
|
|
34398
35264
|
);
|
|
@@ -34401,7 +35267,7 @@ function runStatic7(tree) {
|
|
|
34401
35267
|
couldNotJudge(
|
|
34402
35268
|
ID19,
|
|
34403
35269
|
tools[0].anchor,
|
|
34404
|
-
`static half: no text-only return carrying data in the ${read.length} handler(s) read (${names(read)}); unread by a static run: whether each served text is the serialization of its structuredContent \u2014 run --mode=dynamic (${
|
|
35270
|
+
`static half: no text-only return carrying data in the ${read.length} handler(s) read (${names(read)}); unread by a static run: whether each served text is the serialization of its structuredContent \u2014 run --mode=dynamic (${RULE20})`
|
|
34405
35271
|
),
|
|
34406
35272
|
unread2
|
|
34407
35273
|
);
|
|
@@ -34496,11 +35362,11 @@ function servedTextForm(c) {
|
|
|
34496
35362
|
return { kind: "green" };
|
|
34497
35363
|
}
|
|
34498
35364
|
function runServedHalf5(runtime) {
|
|
34499
|
-
const got = servedToolCalls(ID19,
|
|
35365
|
+
const got = servedToolCalls(ID19, RULE20, runtime);
|
|
34500
35366
|
if ("cnj" in got) return got.cnj;
|
|
34501
35367
|
const { calls, anchor } = got;
|
|
34502
35368
|
if (runtime.tools.length === 0)
|
|
34503
|
-
return { id: ID19, anchor, state: "absent", verdict: `the server serves no tool \u2014 ${
|
|
35369
|
+
return { id: ID19, anchor, state: "absent", verdict: `the server serves no tool \u2014 ${RULE20} n/a` };
|
|
34504
35370
|
const red = [];
|
|
34505
35371
|
const unread2 = [];
|
|
34506
35372
|
let ok = 0;
|
|
@@ -34510,7 +35376,7 @@ function runServedHalf5(runtime) {
|
|
|
34510
35376
|
if (why || !c || c.kind !== "result") {
|
|
34511
35377
|
unread2.push({
|
|
34512
35378
|
anchor: `${anchor} tools/call ${t.name}`,
|
|
34513
|
-
reason: `${t.name}: ${why} (${
|
|
35379
|
+
reason: `${t.name}: ${why} (${RULE20})`
|
|
34514
35380
|
});
|
|
34515
35381
|
continue;
|
|
34516
35382
|
}
|
|
@@ -34519,7 +35385,7 @@ function runServedHalf5(runtime) {
|
|
|
34519
35385
|
else if (v.kind === "unread")
|
|
34520
35386
|
unread2.push({
|
|
34521
35387
|
anchor: `${anchor} tools/call ${t.name}`,
|
|
34522
|
-
reason: `${t.name}: ${v.form} (${
|
|
35388
|
+
reason: `${t.name}: ${v.form} (${RULE20})`
|
|
34523
35389
|
});
|
|
34524
35390
|
else ok++;
|
|
34525
35391
|
}
|
|
@@ -34530,7 +35396,7 @@ function runServedHalf5(runtime) {
|
|
|
34530
35396
|
id: ID19,
|
|
34531
35397
|
anchor,
|
|
34532
35398
|
state: "non-conforming",
|
|
34533
|
-
verdict: `${red.length} successful result(s) carry data in free text: ${red.join("; ")} (${
|
|
35399
|
+
verdict: `${red.length} successful result(s) carry data in free text: ${red.join("; ")} (${RULE20})`
|
|
34534
35400
|
},
|
|
34535
35401
|
unread2
|
|
34536
35402
|
);
|
|
@@ -34540,25 +35406,25 @@ function runServedHalf5(runtime) {
|
|
|
34540
35406
|
id: ID19,
|
|
34541
35407
|
anchor,
|
|
34542
35408
|
state: "present",
|
|
34543
|
-
verdict: `${ok} successful result(s) read: data in structuredContent, text its serialization or summary (${
|
|
35409
|
+
verdict: `${ok} successful result(s) read: data in structuredContent, text its serialization or summary (${RULE20})`
|
|
34544
35410
|
},
|
|
34545
35411
|
unread2
|
|
34546
35412
|
);
|
|
34547
35413
|
}
|
|
34548
35414
|
var s53StructuredNotText = {
|
|
34549
35415
|
id: ID19,
|
|
34550
|
-
rule:
|
|
35416
|
+
rule: RULE20,
|
|
34551
35417
|
pin: S51_RULES_PIN,
|
|
34552
35418
|
run: runStatic7,
|
|
34553
35419
|
runServed: (runtime) => runServedHalf5(runtime)
|
|
34554
35420
|
};
|
|
34555
35421
|
|
|
34556
35422
|
// src/detectors/s54-tools-tested.ts
|
|
34557
|
-
import { readFileSync as
|
|
34558
|
-
import { join as
|
|
35423
|
+
import { readFileSync as readFileSync26, readdirSync as readdirSync18, statSync as statSync24 } from "fs";
|
|
35424
|
+
import { join as join36, relative as relative17, sep as sep9 } from "path";
|
|
34559
35425
|
import * as ts5 from "typescript";
|
|
34560
35426
|
var ID20 = "S54 tools-tested";
|
|
34561
|
-
var
|
|
35427
|
+
var RULE21 = "S-54";
|
|
34562
35428
|
var TEST_DIR = /(^|\/)(test|tests|__tests__|spec|specs|e2e)\//;
|
|
34563
35429
|
var TEST_NAME = /\.(test|spec)\.[cm]?[jt]sx?$/;
|
|
34564
35430
|
var CODE2 = /\.[cm]?[jt]sx?$/;
|
|
@@ -34566,8 +35432,8 @@ var NOT_TESTS = /* @__PURE__ */ new Set([
|
|
|
34566
35432
|
...Object.keys(SKIP_DIR_INFO).filter((d) => !SKIP_DIR_INFO[d].authored),
|
|
34567
35433
|
"fixtures"
|
|
34568
35434
|
]);
|
|
34569
|
-
function isTestFile(
|
|
34570
|
-
return CODE2.test(
|
|
35435
|
+
function isTestFile(rel2) {
|
|
35436
|
+
return CODE2.test(rel2) && !/\.d\.[cm]?ts$/.test(rel2) && (TEST_NAME.test(rel2) || TEST_DIR.test(rel2));
|
|
34571
35437
|
}
|
|
34572
35438
|
function testFiles2(root) {
|
|
34573
35439
|
const files = [];
|
|
@@ -34575,23 +35441,23 @@ function testFiles2(root) {
|
|
|
34575
35441
|
const walk3 = (dir) => {
|
|
34576
35442
|
let entries;
|
|
34577
35443
|
try {
|
|
34578
|
-
entries =
|
|
35444
|
+
entries = readdirSync18(dir);
|
|
34579
35445
|
} catch (e) {
|
|
34580
35446
|
unread2.push({
|
|
34581
|
-
anchor:
|
|
34582
|
-
reason: `directory not listed (${e.message}) (${
|
|
35447
|
+
anchor: relative17(root, dir) || ".",
|
|
35448
|
+
reason: `directory not listed (${e.message}) (${RULE21})`
|
|
34583
35449
|
});
|
|
34584
35450
|
return;
|
|
34585
35451
|
}
|
|
34586
35452
|
for (const name of entries) {
|
|
34587
|
-
const full =
|
|
35453
|
+
const full = join36(dir, name);
|
|
34588
35454
|
let st;
|
|
34589
35455
|
try {
|
|
34590
35456
|
st = statSync24(full);
|
|
34591
35457
|
} catch (e) {
|
|
34592
35458
|
unread2.push({
|
|
34593
|
-
anchor:
|
|
34594
|
-
reason: `not read (${e.message}) (${
|
|
35459
|
+
anchor: relative17(root, full),
|
|
35460
|
+
reason: `not read (${e.message}) (${RULE21})`
|
|
34595
35461
|
});
|
|
34596
35462
|
continue;
|
|
34597
35463
|
}
|
|
@@ -34599,16 +35465,16 @@ function testFiles2(root) {
|
|
|
34599
35465
|
if (!NOT_TESTS.has(name)) walk3(full);
|
|
34600
35466
|
continue;
|
|
34601
35467
|
}
|
|
34602
|
-
const
|
|
34603
|
-
if (!st.isFile() || !isTestFile(
|
|
35468
|
+
const rel2 = relative17(root, full).split(sep9).join("/");
|
|
35469
|
+
if (!st.isFile() || !isTestFile(rel2)) continue;
|
|
34604
35470
|
try {
|
|
34605
|
-
const text =
|
|
34606
|
-
const kind = /x$/.test(
|
|
34607
|
-
files.push({ rel, sf: ts5.createSourceFile(
|
|
35471
|
+
const text = readFileSync26(full, "utf8");
|
|
35472
|
+
const kind = /x$/.test(rel2) ? ts5.ScriptKind.TSX : /\.[cm]?js$/.test(rel2) ? ts5.ScriptKind.JS : ts5.ScriptKind.TS;
|
|
35473
|
+
files.push({ rel: rel2, sf: ts5.createSourceFile(rel2, text, ts5.ScriptTarget.Latest, true, kind) });
|
|
34608
35474
|
} catch (e) {
|
|
34609
35475
|
unread2.push({
|
|
34610
|
-
anchor:
|
|
34611
|
-
reason: `test file not read (${e.message}) (${
|
|
35476
|
+
anchor: rel2,
|
|
35477
|
+
reason: `test file not read (${e.message}) (${RULE21})`
|
|
34612
35478
|
});
|
|
34613
35479
|
}
|
|
34614
35480
|
}
|
|
@@ -34721,10 +35587,10 @@ function testCalls(files, tools) {
|
|
|
34721
35587
|
const helpers = deriveHelpers(files);
|
|
34722
35588
|
const wanted = new Set(tools);
|
|
34723
35589
|
const out = new Map(tools.map((t) => [t, []]));
|
|
34724
|
-
for (const { rel, sf } of files) {
|
|
35590
|
+
for (const { rel: rel2, sf } of files) {
|
|
34725
35591
|
const visit = (n) => {
|
|
34726
35592
|
if ((ts5.isStringLiteral(n) || ts5.isNoSubstitutionTemplateLiteral(n)) && wanted.has(n.text) && callsAt(n, helpers))
|
|
34727
|
-
out.get(n.text)?.push(`${
|
|
35593
|
+
out.get(n.text)?.push(`${rel2}:${sf.getLineAndCharacterOfPosition(n.getStart(sf)).line + 1}`);
|
|
34728
35594
|
ts5.forEachChild(n, visit);
|
|
34729
35595
|
};
|
|
34730
35596
|
visit(sf);
|
|
@@ -34757,25 +35623,25 @@ function runStatic8(tree) {
|
|
|
34757
35623
|
return couldNotJudge(
|
|
34758
35624
|
ID20,
|
|
34759
35625
|
surface ?? unresolved[0],
|
|
34760
|
-
noToolsLocatedReason(tree, `no tool name was derived (${
|
|
35626
|
+
noToolsLocatedReason(tree, `no tool name was derived (${RULE21})`)
|
|
34761
35627
|
);
|
|
34762
35628
|
return {
|
|
34763
35629
|
id: ID20,
|
|
34764
35630
|
anchor: tree.root,
|
|
34765
35631
|
state: "absent",
|
|
34766
|
-
verdict: `no MCP tool registered in product source \u2014 ${
|
|
35632
|
+
verdict: `no MCP tool registered in product source \u2014 ${RULE21} n/a`
|
|
34767
35633
|
};
|
|
34768
35634
|
}
|
|
34769
35635
|
let root = tree.root;
|
|
34770
35636
|
try {
|
|
34771
|
-
if (!statSync24(root).isDirectory()) root =
|
|
35637
|
+
if (!statSync24(root).isDirectory()) root = join36(root, "..");
|
|
34772
35638
|
} catch {
|
|
34773
35639
|
}
|
|
34774
35640
|
const { files, unread: unread2 } = testFiles2(root);
|
|
34775
35641
|
for (const a of unresolved)
|
|
34776
35642
|
unread2.push({
|
|
34777
35643
|
anchor: a,
|
|
34778
|
-
reason: `a tool registered here has a computed name, so whether a test calls it is unread (${
|
|
35644
|
+
reason: `a tool registered here has a computed name, so whether a test calls it is unread (${RULE21})`
|
|
34779
35645
|
});
|
|
34780
35646
|
if (files.length === 0)
|
|
34781
35647
|
return settle(
|
|
@@ -34783,7 +35649,7 @@ function runStatic8(tree) {
|
|
|
34783
35649
|
couldNotJudge(
|
|
34784
35650
|
ID20,
|
|
34785
35651
|
tools[0].anchor,
|
|
34786
|
-
`no test file under ${root} (searched: *.test.* / *.spec.* and test/, tests/, __tests__/, spec/, specs/, e2e/ directories): a suite outside the scanned root is not read, so whether the ${tools.length} registered tool(s) are called is unread (${
|
|
35652
|
+
`no test file under ${root} (searched: *.test.* / *.spec.* and test/, tests/, __tests__/, spec/, specs/, e2e/ directories): a suite outside the scanned root is not read, so whether the ${tools.length} registered tool(s) are called is unread (${RULE21})`
|
|
34787
35653
|
),
|
|
34788
35654
|
unread2
|
|
34789
35655
|
);
|
|
@@ -34799,7 +35665,7 @@ function runStatic8(tree) {
|
|
|
34799
35665
|
id: ID20,
|
|
34800
35666
|
anchor: untested[0].anchor,
|
|
34801
35667
|
state: "non-conforming",
|
|
34802
|
-
verdict: `${untested.length} of ${tools.length} registered tool(s) are called by no test (${files.length} test file(s) read under ${root}; call positions K1..K4): ${names(untested.map((t) => `${t.name} (${t.anchor})`))} (${
|
|
35668
|
+
verdict: `${untested.length} of ${tools.length} registered tool(s) are called by no test (${files.length} test file(s) read under ${root}; call positions K1..K4): ${names(untested.map((t) => `${t.name} (${t.anchor})`))} (${RULE21})`
|
|
34803
35669
|
},
|
|
34804
35670
|
unread2
|
|
34805
35671
|
);
|
|
@@ -34809,14 +35675,14 @@ function runStatic8(tree) {
|
|
|
34809
35675
|
id: ID20,
|
|
34810
35676
|
anchor: tools[0].anchor,
|
|
34811
35677
|
state: "present",
|
|
34812
|
-
verdict: `${tools.length} registered tool(s), each called by at least one test (${files.length} test file(s) read under ${root}) (${
|
|
35678
|
+
verdict: `${tools.length} registered tool(s), each called by at least one test (${files.length} test file(s) read under ${root}) (${RULE21})`
|
|
34813
35679
|
},
|
|
34814
35680
|
unread2
|
|
34815
35681
|
);
|
|
34816
35682
|
}
|
|
34817
35683
|
function runServedHalf6(runtime) {
|
|
34818
35684
|
const anchor = `${runtime.root} (served)`;
|
|
34819
|
-
const why = runtime.remote ? `a URL scan has no repository: S-54 reads the repository's test files, which the served list does not carry (${
|
|
35685
|
+
const why = runtime.remote ? `a URL scan has no repository: S-54 reads the repository's test files, which the served list does not carry (${RULE21})` : `the served tools/list does not say which tests call a tool: S-54 is read from the repository (static) (${RULE21})`;
|
|
34820
35686
|
return couldNotJudge(
|
|
34821
35687
|
ID20,
|
|
34822
35688
|
anchor,
|
|
@@ -34825,7 +35691,7 @@ function runServedHalf6(runtime) {
|
|
|
34825
35691
|
}
|
|
34826
35692
|
var s54ToolsTested = {
|
|
34827
35693
|
id: ID20,
|
|
34828
|
-
rule:
|
|
35694
|
+
rule: RULE21,
|
|
34829
35695
|
pin: S51_RULES_PIN,
|
|
34830
35696
|
run: runStatic8,
|
|
34831
35697
|
runServed: (runtime) => runServedHalf6(runtime)
|
|
@@ -34871,6 +35737,7 @@ var registered = [
|
|
|
34871
35737
|
c37DirectoryListing,
|
|
34872
35738
|
c38FieldBudget,
|
|
34873
35739
|
c40ToolDocumentation,
|
|
35740
|
+
c41VantageosLatest,
|
|
34874
35741
|
s45OriginTargets,
|
|
34875
35742
|
s46RegistrationRedirects,
|
|
34876
35743
|
s47WebhookDelivery,
|
|
@@ -35115,13 +35982,13 @@ function parseEventsArgs(args) {
|
|
|
35115
35982
|
}
|
|
35116
35983
|
|
|
35117
35984
|
// src/gate.ts
|
|
35118
|
-
import { readFileSync as
|
|
35985
|
+
import { readFileSync as readFileSync27 } from "fs";
|
|
35119
35986
|
var OWED_FILE_NAME = "mcp-doctor.owed.json";
|
|
35120
35987
|
var FORMAT = `expected {"owed": [{"id": "<detector id, the table's first column>", "reason": "<why this row may publish undecided>"}, ...]}`;
|
|
35121
35988
|
function readOwedFile(path, opts) {
|
|
35122
35989
|
let text;
|
|
35123
35990
|
try {
|
|
35124
|
-
text =
|
|
35991
|
+
text = readFileSync27(path, "utf8");
|
|
35125
35992
|
} catch (err) {
|
|
35126
35993
|
const code = err.code;
|
|
35127
35994
|
if (code === "ENOENT" && !opts.explicit) return { kind: "none", path };
|
|
@@ -35323,7 +36190,7 @@ import { createServer } from "https";
|
|
|
35323
36190
|
import { Webhook } from "standardwebhooks";
|
|
35324
36191
|
|
|
35325
36192
|
// src/runtime/publicTarget.ts
|
|
35326
|
-
import { spawnSync as
|
|
36193
|
+
import { spawnSync as spawnSync3 } from "child_process";
|
|
35327
36194
|
import { isIP } from "net";
|
|
35328
36195
|
|
|
35329
36196
|
// src/runtime/ianaSpecial.ts
|
|
@@ -35755,7 +36622,7 @@ function resolveHost(host) {
|
|
|
35755
36622
|
const bare = host.replace(/^\[|\]$/g, "");
|
|
35756
36623
|
if (isIP(bare) !== 0) return { addresses: [bare] };
|
|
35757
36624
|
const script = "require('node:dns').promises.lookup(process.argv[1], { all: true, verbatim: true }).then((a) => process.stdout.write(JSON.stringify(a.map((x) => x.address)))).catch((e) => { process.stdout.write(JSON.stringify({ error: e && e.code ? e.code : String(e) })); })";
|
|
35758
|
-
const out =
|
|
36625
|
+
const out = spawnSync3(process.execPath, ["-e", script, bare], {
|
|
35759
36626
|
encoding: "utf8",
|
|
35760
36627
|
timeout: 1e4
|
|
35761
36628
|
});
|
|
@@ -36671,19 +37538,19 @@ function verifySignature(secret, h) {
|
|
|
36671
37538
|
}
|
|
36672
37539
|
|
|
36673
37540
|
// src/runtime/launch.ts
|
|
36674
|
-
import { spawnSync as
|
|
36675
|
-
import { existsSync as existsSync23, readFileSync as
|
|
36676
|
-
import { dirname as
|
|
37541
|
+
import { spawnSync as spawnSync4 } from "child_process";
|
|
37542
|
+
import { existsSync as existsSync23, readFileSync as readFileSync28, statSync as statSync25 } from "fs";
|
|
37543
|
+
import { dirname as dirname18, isAbsolute, join as join37, resolve as resolve3 } from "path";
|
|
36677
37544
|
function findPackageDir(target) {
|
|
36678
37545
|
let dir;
|
|
36679
37546
|
try {
|
|
36680
|
-
dir = statSync25(target).isDirectory() ? target :
|
|
37547
|
+
dir = statSync25(target).isDirectory() ? target : dirname18(target);
|
|
36681
37548
|
} catch {
|
|
36682
37549
|
return null;
|
|
36683
37550
|
}
|
|
36684
37551
|
for (let depth = 0; depth < 8; depth++) {
|
|
36685
|
-
if (existsSync23(
|
|
36686
|
-
const parent =
|
|
37552
|
+
if (existsSync23(join37(dir, "package.json"))) return dir;
|
|
37553
|
+
const parent = dirname18(dir);
|
|
36687
37554
|
if (parent === dir) break;
|
|
36688
37555
|
dir = parent;
|
|
36689
37556
|
}
|
|
@@ -36707,13 +37574,13 @@ function deriveLaunchPlan(target) {
|
|
|
36707
37574
|
}
|
|
36708
37575
|
let pkg;
|
|
36709
37576
|
try {
|
|
36710
|
-
if (!statSync25(
|
|
36711
|
-
return { error: `${
|
|
37577
|
+
if (!statSync25(join37(pkgDir, "package.json")).isFile()) {
|
|
37578
|
+
return { error: `${join37(pkgDir, "package.json")} is not a regular file \u2014 not read` };
|
|
36712
37579
|
}
|
|
36713
|
-
pkg = JSON.parse(
|
|
37580
|
+
pkg = JSON.parse(readFileSync28(join37(pkgDir, "package.json"), "utf8"));
|
|
36714
37581
|
} catch (err) {
|
|
36715
37582
|
return {
|
|
36716
|
-
error: `could not parse ${
|
|
37583
|
+
error: `could not parse ${join37(pkgDir, "package.json")}: ${err instanceof Error ? err.message : String(err)}`
|
|
36717
37584
|
};
|
|
36718
37585
|
}
|
|
36719
37586
|
const bin = firstBinEntry(pkg.bin);
|
|
@@ -36784,10 +37651,10 @@ let transport;
|
|
|
36784
37651
|
const publicAuthAfterFailure = async () => {
|
|
36785
37652
|
if (plan.kind !== "http") return undefined;
|
|
36786
37653
|
try {
|
|
36787
|
-
const authServer = await
|
|
37654
|
+
const { authServer, authDocs } = await readAuth();
|
|
36788
37655
|
const authorize = authServer.kind === "document" ? await probeAuthorize(authServer.document) : { kind: "not-run", reason: "the authorization-server metadata was not read, so no authorization_endpoint is known" };
|
|
36789
37656
|
const discovery = await readDiscovery().catch((e) => ({ kind: "not-run", reason: "the discovery reads failed: " + (e && e.message ? e.message : String(e)) }));
|
|
36790
|
-
return { authServer, authorize, discovery };
|
|
37657
|
+
return { authServer, authDocs, authorize, discovery };
|
|
36791
37658
|
} catch (e) { return { authServer: { kind: "unavailable", url: plan.url, reason: "the public read failed: " + (e && e.message ? e.message : String(e)) } }; }
|
|
36792
37659
|
};
|
|
36793
37660
|
const fail = (msg) => { if (settled) return; settled = true; Promise.resolve(transport && transport.close()).then(() => publicAuthAfterFailure()).catch(() => undefined).then((publicAuth) => done({ launchError: msg, ...(publicAuth ? { publicAuth } : {}) })); };
|
|
@@ -36962,22 +37829,29 @@ const getPublicJson = async (url) => {
|
|
|
36962
37829
|
// The authorization server the PRM names (RFC 9728), then its metadata (RFC 8414). The doctor fetches
|
|
36963
37830
|
// ONLY a URL on the endpoint's own origin (so the scheme the caller already vetted): a server that names another origin never makes the
|
|
36964
37831
|
// doctor request it (no SSRF from the audit tool); that case is reported as unavailable, naming it.
|
|
36965
|
-
|
|
37832
|
+
// S-5 (f)(k): the two PRM copies (path-suffixed, bare) are RECORDED as served, whatever they answer, and the OIDC
|
|
37833
|
+
// discovery is read at the same-origin issuer (OIDC Discovery 1.0: the issuer, then /.well-known/openid-configuration).
|
|
37834
|
+
const readAuth = async () => {
|
|
36966
37835
|
const ep = new URL(plan.url);
|
|
36967
|
-
const
|
|
37836
|
+
const mcpUrl = ep.origin + ep.pathname;
|
|
37837
|
+
const bareUrl = ep.origin + "/.well-known/oauth-protected-resource";
|
|
37838
|
+
const suffixedUrl = ep.pathname === "/" ? undefined : bareUrl + ep.pathname;
|
|
37839
|
+
const [suffixed, bare] = await Promise.all([suffixedUrl ? publicGet(suffixedUrl, "application/json") : Promise.resolve(undefined), publicGet(bareUrl, "application/json")]);
|
|
37840
|
+
const prm = { ...(suffixed ? { suffixed } : {}), bare };
|
|
37841
|
+
const docs = (oidc) => ({ kind: "probed", mcpUrl, prm, oidc });
|
|
36968
37842
|
let issuer;
|
|
36969
|
-
for (const
|
|
36970
|
-
const
|
|
36971
|
-
const names = r.ok && Array.isArray(r.doc.authorization_servers) ? r.doc.authorization_servers.filter((x) => typeof x === "string") : [];
|
|
37843
|
+
for (const r of [suffixed, bare]) {
|
|
37844
|
+
const names = r && r.status === 200 && r.json && Array.isArray(r.json.authorization_servers) ? r.json.authorization_servers.filter((x) => typeof x === "string") : [];
|
|
36972
37845
|
if (names.length > 0) { issuer = names[0]; break; }
|
|
36973
37846
|
}
|
|
36974
|
-
if (!issuer) return { kind: "unavailable", url:
|
|
36975
|
-
let iu; try { iu = new URL(issuer); } catch { return { kind: "unavailable", url:
|
|
36976
|
-
if (iu.origin !== ep.origin) return { kind: "unavailable", url: iu.origin, reason: "the authorization server is on another origin (" + iu.host + "): not fetched from here, only a same-origin authorization server is read" };
|
|
37847
|
+
if (!issuer) return { authServer: { kind: "unavailable", url: suffixedUrl || bareUrl, reason: "the protected-resource metadata names no authorization server (read at the suffixed and the bare path)" }, authDocs: docs({ skipped: "the protected-resource metadata names no authorization server, so no issuer is known" }) };
|
|
37848
|
+
let iu; try { iu = new URL(issuer); } catch { return { authServer: { kind: "unavailable", url: suffixedUrl || bareUrl, reason: "the protected-resource metadata names an authorization server that is not a URL" }, authDocs: docs({ skipped: "the authorization server named is not a URL" }) }; }
|
|
37849
|
+
if (iu.origin !== ep.origin) return { authServer: { kind: "unavailable", url: iu.origin, reason: "the authorization server is on another origin (" + iu.host + "): not fetched from here, only a same-origin authorization server is read" }, authDocs: docs({ skipped: "the authorization server is on another origin (" + iu.host + "): its OIDC discovery is not fetched from here" }) };
|
|
36977
37850
|
const url = iu.origin + "/.well-known/oauth-authorization-server" + (iu.pathname === "/" ? "" : iu.pathname);
|
|
36978
|
-
const r = await getPublicJson(url);
|
|
36979
|
-
|
|
36980
|
-
return { kind: "
|
|
37851
|
+
const [r, oidc] = await Promise.all([getPublicJson(url), publicGet(iu.origin + iu.pathname.replace(/\/$/, "") + "/.well-known/openid-configuration", "application/json")]);
|
|
37852
|
+
const authDocs = docs(oidc);
|
|
37853
|
+
if (!r.ok) return { authServer: { kind: "unavailable", url, reason: r.reason }, authDocs };
|
|
37854
|
+
return { authServer: { kind: "document", url, status: r.status, document: r.doc }, authDocs };
|
|
36981
37855
|
};
|
|
36982
37856
|
// S-46 served half: for each known CIMD client, read ITS metadata document (the redirect URIs as the client sends
|
|
36983
37857
|
// them), then start one authorization request per redirect at the served authorization_endpoint. NO credential is
|
|
@@ -37053,9 +37927,10 @@ const extras = async (served) => {
|
|
|
37053
37927
|
served.versionProbe = { kind: "not-run", reason: "stdio transport: the MCP-Protocol-Version header exists on HTTP only" };
|
|
37054
37928
|
served.authServer = { kind: "not-run", reason: "stdio transport: no authorization-server metadata is served" };
|
|
37055
37929
|
served.authorize = { kind: "not-run", reason: "stdio transport: no authorization endpoint is served" };
|
|
37930
|
+
served.authDocs = { kind: "not-run", reason: "stdio transport: no protected-resource metadata is served" };
|
|
37056
37931
|
return;
|
|
37057
37932
|
}
|
|
37058
|
-
const [vp,
|
|
37933
|
+
const [vp, auth, discovery] = await Promise.all([
|
|
37059
37934
|
(async () => {
|
|
37060
37935
|
const v = transport.negotiatedVersion();
|
|
37061
37936
|
if (!v) return { kind: "not-run", reason: "no protocol version was negotiated, so no supported-version control request can be sent" };
|
|
@@ -37065,12 +37940,14 @@ const extras = async (served) => {
|
|
|
37065
37940
|
return { kind: "statuses", supportedVersion: v, supported, unsupported };
|
|
37066
37941
|
} catch (e) { return { kind: "not-run", reason: "the header probe failed: " + (e && e.message ? e.message : String(e)) }; }
|
|
37067
37942
|
})(),
|
|
37068
|
-
|
|
37943
|
+
readAuth().catch((e) => ({ authServer: { kind: "unavailable", url: plan.url, reason: "the read failed: " + (e && e.message ? e.message : String(e)) }, authDocs: { kind: "not-run", reason: "the read failed: " + (e && e.message ? e.message : String(e)) } })),
|
|
37069
37944
|
readDiscovery().catch((e) => ({ kind: "not-run", reason: "the discovery reads failed: " + (e && e.message ? e.message : String(e)) })),
|
|
37070
37945
|
]);
|
|
37071
37946
|
served.discovery = discovery;
|
|
37072
37947
|
served.versionProbe = vp;
|
|
37948
|
+
const as = auth.authServer;
|
|
37073
37949
|
served.authServer = as;
|
|
37950
|
+
served.authDocs = auth.authDocs;
|
|
37074
37951
|
served.authorize = as.kind === "document"
|
|
37075
37952
|
? await probeAuthorize(as.document).catch((e) => ({ kind: "not-run", reason: "the sign-in probe failed: " + (e && e.message ? e.message : String(e)) }))
|
|
37076
37953
|
: { kind: "not-run", reason: "the authorization-server metadata was not read, so no authorization_endpoint is known" };
|
|
@@ -37349,6 +38226,7 @@ function readServed(raw) {
|
|
|
37349
38226
|
reason: isObj6(as) && as.kind === "not-run" && typeof as.reason === "string" ? as.reason : "unreadable authorization-server record"
|
|
37350
38227
|
};
|
|
37351
38228
|
const authorize = readAuthorize(raw.authorize);
|
|
38229
|
+
const authDocs = readAuthDocs(raw.authDocs);
|
|
37352
38230
|
const init = isObj6(raw.initialize) ? raw.initialize : void 0;
|
|
37353
38231
|
const discovery = readDiscovery(raw.discovery);
|
|
37354
38232
|
return {
|
|
@@ -37359,6 +38237,7 @@ function readServed(raw) {
|
|
|
37359
38237
|
versionProbe,
|
|
37360
38238
|
authServer,
|
|
37361
38239
|
...authorize ? { authorize } : {},
|
|
38240
|
+
...authDocs ? { authDocs } : {},
|
|
37362
38241
|
...init ? {
|
|
37363
38242
|
initialize: {
|
|
37364
38243
|
resultKeys: Array.isArray(init.resultKeys) ? init.resultKeys.map(String) : [],
|
|
@@ -37412,19 +38291,39 @@ function readToolCall(raw) {
|
|
|
37412
38291
|
if (r.kind === "no-answer") return { tool, kind: "no-answer", reason };
|
|
37413
38292
|
return { tool, kind: "no-answer", reason: "unreadable tool-call record" };
|
|
37414
38293
|
}
|
|
37415
|
-
function
|
|
38294
|
+
function readGet(g) {
|
|
38295
|
+
const r = isObj6(g) ? g : {};
|
|
38296
|
+
return {
|
|
38297
|
+
url: typeof r.url === "string" ? r.url : "<unnamed url>",
|
|
38298
|
+
...typeof r.status === "number" ? { status: r.status } : {},
|
|
38299
|
+
...typeof r.contentType === "string" ? { contentType: r.contentType } : {},
|
|
38300
|
+
...isObj6(r.json) ? { json: r.json } : {},
|
|
38301
|
+
...typeof r.text === "string" ? { text: r.text } : {},
|
|
38302
|
+
...typeof r.detail === "string" ? { detail: r.detail } : isObj6(g) ? {} : { detail: "unreadable GET record" }
|
|
38303
|
+
};
|
|
38304
|
+
}
|
|
38305
|
+
function readAuthDocs(raw) {
|
|
37416
38306
|
if (raw === void 0) return void 0;
|
|
37417
|
-
|
|
37418
|
-
const
|
|
38307
|
+
if (isObj6(raw) && raw.kind === "probed" && typeof raw.mcpUrl === "string" && isObj6(raw.prm) && isObj6(raw.prm.bare)) {
|
|
38308
|
+
const oidc = isObj6(raw.oidc) && typeof raw.oidc.skipped === "string" ? { skipped: raw.oidc.skipped } : readGet(raw.oidc);
|
|
37419
38309
|
return {
|
|
37420
|
-
|
|
37421
|
-
|
|
37422
|
-
|
|
37423
|
-
|
|
37424
|
-
|
|
37425
|
-
|
|
38310
|
+
kind: "probed",
|
|
38311
|
+
mcpUrl: raw.mcpUrl,
|
|
38312
|
+
prm: {
|
|
38313
|
+
...raw.prm.suffixed !== void 0 ? { suffixed: readGet(raw.prm.suffixed) } : {},
|
|
38314
|
+
bare: readGet(raw.prm.bare)
|
|
38315
|
+
},
|
|
38316
|
+
oidc
|
|
37426
38317
|
};
|
|
38318
|
+
}
|
|
38319
|
+
return {
|
|
38320
|
+
kind: "not-run",
|
|
38321
|
+
reason: isObj6(raw) && raw.kind === "not-run" && typeof raw.reason === "string" ? raw.reason : "unreadable protected-resource record"
|
|
37427
38322
|
};
|
|
38323
|
+
}
|
|
38324
|
+
function readDiscovery(raw) {
|
|
38325
|
+
if (raw === void 0) return void 0;
|
|
38326
|
+
const get = readGet;
|
|
37428
38327
|
if (isObj6(raw) && raw.kind === "probed" && Array.isArray(raw.cards) && isObj6(raw.landing))
|
|
37429
38328
|
return { kind: "probed", cards: raw.cards.map(get), landing: get(raw.landing) };
|
|
37430
38329
|
return {
|
|
@@ -37462,14 +38361,14 @@ function readEvalCounts(target) {
|
|
|
37462
38361
|
if (!pkgDir) return { counts };
|
|
37463
38362
|
let dir = pkgDir;
|
|
37464
38363
|
for (let depth = 0; depth < 8; depth++) {
|
|
37465
|
-
const candidate =
|
|
38364
|
+
const candidate = join37(dir, "evals", "evals.json");
|
|
37466
38365
|
if (existsSync23(candidate)) {
|
|
37467
38366
|
let text;
|
|
37468
38367
|
try {
|
|
37469
38368
|
if (!statSync25(candidate).isFile()) {
|
|
37470
38369
|
return { counts, unreadable: `${candidate} is not a regular file \u2014 not read` };
|
|
37471
38370
|
}
|
|
37472
|
-
text =
|
|
38371
|
+
text = readFileSync28(candidate, "utf8");
|
|
37473
38372
|
} catch (err) {
|
|
37474
38373
|
return {
|
|
37475
38374
|
counts,
|
|
@@ -37485,7 +38384,7 @@ function readEvalCounts(target) {
|
|
|
37485
38384
|
}
|
|
37486
38385
|
return { counts };
|
|
37487
38386
|
}
|
|
37488
|
-
const parent =
|
|
38387
|
+
const parent = dirname18(dir);
|
|
37489
38388
|
if (parent === dir) break;
|
|
37490
38389
|
dir = parent;
|
|
37491
38390
|
}
|
|
@@ -37500,7 +38399,7 @@ function statSyncSafe(p) {
|
|
|
37500
38399
|
}
|
|
37501
38400
|
function deriveExpectedCommit(cwd) {
|
|
37502
38401
|
try {
|
|
37503
|
-
const out =
|
|
38402
|
+
const out = spawnSync4("git", ["rev-parse", "HEAD"], {
|
|
37504
38403
|
cwd,
|
|
37505
38404
|
encoding: "utf8",
|
|
37506
38405
|
timeout: 5e3
|
|
@@ -37594,7 +38493,7 @@ function displayUrl(url) {
|
|
|
37594
38493
|
}
|
|
37595
38494
|
}
|
|
37596
38495
|
function introspect(plan, root, evalSource, expectedCommit, evalsNote, secrets) {
|
|
37597
|
-
const proc =
|
|
38496
|
+
const proc = spawnSync4(process.execPath, ["--input-type=module", "-e", INTROSPECTOR], {
|
|
37598
38497
|
env: { ...process.env, MCP_DOCTOR_PLAN: JSON.stringify(plan) },
|
|
37599
38498
|
encoding: "utf8",
|
|
37600
38499
|
timeout: 2e4,
|
|
@@ -37639,6 +38538,7 @@ function introspect(plan, root, evalSource, expectedCommit, evalsNote, secrets)
|
|
|
37639
38538
|
publicAuth: {
|
|
37640
38539
|
authServer: pub.authServer,
|
|
37641
38540
|
...pub.authorize ? { authorize: pub.authorize } : {},
|
|
38541
|
+
...pub.authDocs ? { authDocs: pub.authDocs } : {},
|
|
37642
38542
|
...pub.discovery ? { discovery: pub.discovery } : {}
|
|
37643
38543
|
}
|
|
37644
38544
|
} : {}
|
|
@@ -37858,7 +38758,7 @@ function parseUrlArgs(args, env) {
|
|
|
37858
38758
|
}
|
|
37859
38759
|
|
|
37860
38760
|
// src/kit/rule-ids.ts
|
|
37861
|
-
import { readFileSync as
|
|
38761
|
+
import { readFileSync as readFileSync29 } from "fs";
|
|
37862
38762
|
var StandardUnreadableError = class extends Error {
|
|
37863
38763
|
constructor(path, cause) {
|
|
37864
38764
|
super(
|
|
@@ -37898,7 +38798,7 @@ function stateless(pattern) {
|
|
|
37898
38798
|
function deriveRuleIds(path, pattern) {
|
|
37899
38799
|
let blob;
|
|
37900
38800
|
try {
|
|
37901
|
-
blob =
|
|
38801
|
+
blob = readFileSync29(path, "utf8");
|
|
37902
38802
|
} catch (e) {
|
|
37903
38803
|
throw new StandardUnreadableError(path, e);
|
|
37904
38804
|
}
|
|
@@ -38014,7 +38914,7 @@ function checkedRuleIds(entries) {
|
|
|
38014
38914
|
|
|
38015
38915
|
// src/kit/report.ts
|
|
38016
38916
|
import { mkdirSync, writeFileSync as writeFileSync2 } from "fs";
|
|
38017
|
-
import { dirname as
|
|
38917
|
+
import { dirname as dirname19 } from "path";
|
|
38018
38918
|
function renderReport(ctx) {
|
|
38019
38919
|
const lines2 = [];
|
|
38020
38920
|
lines2.push(`${ctx.title} report \u2014 target: ${ctx.target}`);
|
|
@@ -38032,7 +38932,7 @@ function renderReport(ctx) {
|
|
|
38032
38932
|
return lines2.join("\n");
|
|
38033
38933
|
}
|
|
38034
38934
|
function writeReport(path, ctx) {
|
|
38035
|
-
mkdirSync(
|
|
38935
|
+
mkdirSync(dirname19(path), { recursive: true });
|
|
38036
38936
|
writeFileSync2(path, renderReport(ctx), "utf8");
|
|
38037
38937
|
}
|
|
38038
38938
|
|
|
@@ -38359,11 +39259,11 @@ function renderJson(surface, results, skipped, coverage, gate) {
|
|
|
38359
39259
|
function renderResults(surface, results, coverageLine) {
|
|
38360
39260
|
const cols = { item: 24, anchor: 26, state: 15 };
|
|
38361
39261
|
const header = `${pad("item", cols.item)} | ${pad("file:line", cols.anchor)} | ${pad("state", cols.state)} | verdict`;
|
|
38362
|
-
const
|
|
39262
|
+
const sep10 = "-".repeat(header.length);
|
|
38363
39263
|
const rows = results.map(
|
|
38364
39264
|
(r) => `${pad(r.id, cols.item)} | ${pad(r.anchor, cols.anchor)} | ${pad(r.state, cols.state)} | ${r.verdict}`
|
|
38365
39265
|
);
|
|
38366
|
-
const table = [`surface: ${surface}`, coverageLine, header,
|
|
39266
|
+
const table = [`surface: ${surface}`, coverageLine, header, sep10, ...rows].join("\n");
|
|
38367
39267
|
const unjudged = results.filter((r) => r.state === "could-not-judge");
|
|
38368
39268
|
if (unjudged.length === 0) return table;
|
|
38369
39269
|
const cnjHeader = `could-not-judge (${unjudged.length}) \u2014 the doctor could NOT read these; this is NOT a clean bill:`;
|
|
@@ -38445,8 +39345,8 @@ var USAGE = [
|
|
|
38445
39345
|
].join("\n");
|
|
38446
39346
|
function readVersion() {
|
|
38447
39347
|
try {
|
|
38448
|
-
const here =
|
|
38449
|
-
const manifest = JSON.parse(
|
|
39348
|
+
const here = dirname20(fileURLToPath2(import.meta.url));
|
|
39349
|
+
const manifest = JSON.parse(readFileSync30(join38(here, "..", "package.json"), "utf8"));
|
|
38450
39350
|
return manifest.version ?? null;
|
|
38451
39351
|
} catch {
|
|
38452
39352
|
return null;
|
|
@@ -38514,10 +39414,10 @@ function runEventsMode(endpoint, rest, options) {
|
|
|
38514
39414
|
}
|
|
38515
39415
|
function defaultOwedPath(target) {
|
|
38516
39416
|
try {
|
|
38517
|
-
if (statSync27(target).isFile()) return
|
|
39417
|
+
if (statSync27(target).isFile()) return join38(dirname20(target), OWED_FILE_NAME);
|
|
38518
39418
|
} catch {
|
|
38519
39419
|
}
|
|
38520
|
-
return
|
|
39420
|
+
return join38(target, OWED_FILE_NAME);
|
|
38521
39421
|
}
|
|
38522
39422
|
function main() {
|
|
38523
39423
|
const argv = process.argv.slice(2);
|