nulladrift 0.8.0 → 0.9.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/README.md +11 -3
- package/dist/index.js +118 -18
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -176,6 +176,12 @@ could not be audited and is not on that list, or is reached differently than whe
|
|
|
176
176
|
is reported as new drift even with the flag, so a pull request cannot add a server that
|
|
177
177
|
refuses the auditor and pass.
|
|
178
178
|
|
|
179
|
+
A server whose tool list could not be read in full is a failure too, for the same reason: a
|
|
180
|
+
listing that did not end within 64 pages, or a server that said its tools changed while they were
|
|
181
|
+
being read, on every pass. What was read is pinned and marked partial in the lock, and `check`
|
|
182
|
+
exits `2`. `--allow-partial`, or `policy.allowPartial` in the lock, makes it a warning. Only what
|
|
183
|
+
the protocol states counts; a server is never called partial from the name of one of its tools.
|
|
184
|
+
|
|
179
185
|
A server name defined differently in two config files (`.mcp.json` and `.vscode/mcp.json`,
|
|
180
186
|
say) fails the audit. Each client reads its own file, so checking one definition would vouch
|
|
181
187
|
for the others. Rename one, or make them the same.
|
|
@@ -364,9 +370,11 @@ captures every server's capability surface, and diffs it against the previous re
|
|
|
364
370
|
`crawl-state` branch. It needs no consent from anyone, has no self-selection, and reports in
|
|
365
371
|
changes per server-year, withholding the figure entirely until enough observation has
|
|
366
372
|
accumulated to support it. `--include-stdio` additionally runs registry packages inside a
|
|
367
|
-
container with no host mounts, no host environment, no privileges
|
|
368
|
-
|
|
369
|
-
|
|
373
|
+
container with no host mounts, no host environment, no privileges, a read-only root and no
|
|
374
|
+
network. Each package is fetched first, in a separate container that has the network and runs
|
|
375
|
+
none of the package's code (install scripts off); a package that needs an install script to work
|
|
376
|
+
is counted as unreachable. Without that flag those entries are skipped, and the report states
|
|
377
|
+
which population it actually measured.
|
|
370
378
|
|
|
371
379
|
## Environment variables
|
|
372
380
|
|
package/dist/index.js
CHANGED
|
@@ -1113,7 +1113,7 @@ function compareProvenance(name, before, after) {
|
|
|
1113
1113
|
return [change("server.artifact.changed", name, `${what}${unexplained}`, { before: was, after: now })];
|
|
1114
1114
|
}
|
|
1115
1115
|
function orderless(entry) {
|
|
1116
|
-
const { kind: _kind, source: _source, digest: _digest, provenance: _provenance, tools, resources, resourceTemplates, prompts, ...rest } = entry;
|
|
1116
|
+
const { kind: _kind, source: _source, digest: _digest, provenance: _provenance, coverage: _coverage, tools, resources, resourceTemplates, prompts, ...rest } = entry;
|
|
1117
1117
|
const digests = (members) => (members ?? []).map((member) => member.digest).sort();
|
|
1118
1118
|
return stableKey({
|
|
1119
1119
|
...rest,
|
|
@@ -1996,7 +1996,7 @@ function buildLockedServer(server2, surface, policy) {
|
|
|
1996
1996
|
resourceTemplates: resourceTemplates.map((template) => template.digest),
|
|
1997
1997
|
prompts: prompts.map((prompt2) => prompt2.digest)
|
|
1998
1998
|
};
|
|
1999
|
-
return { kind: "mcp-server", ...entry, digest: digest(toJson(covered)) };
|
|
1999
|
+
return { kind: "mcp-server", ...entry, ...surface.coverage ? { coverage: surface.coverage } : {}, digest: digest(toJson(covered)) };
|
|
2000
2000
|
}
|
|
2001
2001
|
|
|
2002
2002
|
// src/lock/provenance.ts
|
|
@@ -2005,7 +2005,7 @@ import { readFile as readFile3 } from "fs/promises";
|
|
|
2005
2005
|
import { isAbsolute as isAbsolute2, resolve as resolve3 } from "path";
|
|
2006
2006
|
|
|
2007
2007
|
// src/lib/version.ts
|
|
2008
|
-
var VERSION = "0.
|
|
2008
|
+
var VERSION = "0.9.0";
|
|
2009
2009
|
var USER_AGENT = `nulladrift/${VERSION} (+https://github.com/Nulladrift/nulladrift)`;
|
|
2010
2010
|
|
|
2011
2011
|
// src/lock/provenance.ts
|
|
@@ -3023,6 +3023,16 @@ async function connect(server2, timeoutMs = DEFAULT_TIMEOUT_MS2, options = {}) {
|
|
|
3023
3023
|
}
|
|
3024
3024
|
);
|
|
3025
3025
|
refuseUnsendable(server2);
|
|
3026
|
+
const changes = /* @__PURE__ */ new Set();
|
|
3027
|
+
for (const [list, method] of [
|
|
3028
|
+
["tools", "notifications/tools/list_changed"],
|
|
3029
|
+
["resources", "notifications/resources/list_changed"],
|
|
3030
|
+
["prompts", "notifications/prompts/list_changed"]
|
|
3031
|
+
]) {
|
|
3032
|
+
client.setNotificationHandler(method, () => {
|
|
3033
|
+
changes.add(list);
|
|
3034
|
+
});
|
|
3035
|
+
}
|
|
3026
3036
|
let transport2;
|
|
3027
3037
|
const guard = new SurfaceGuard(() => {
|
|
3028
3038
|
void transport2?.close().catch(() => {
|
|
@@ -3052,6 +3062,8 @@ async function connect(server2, timeoutMs = DEFAULT_TIMEOUT_MS2, options = {}) {
|
|
|
3052
3062
|
client,
|
|
3053
3063
|
stderr: () => stderrBuffer,
|
|
3054
3064
|
refused: () => guard.refusal,
|
|
3065
|
+
watchChanges: () => changes.clear(),
|
|
3066
|
+
changed: () => [...changes].sort(),
|
|
3055
3067
|
close: async () => {
|
|
3056
3068
|
await client.close().catch(() => {
|
|
3057
3069
|
});
|
|
@@ -3104,11 +3116,11 @@ async function listAllTools(client, timeoutMs) {
|
|
|
3104
3116
|
const result = await client.request({ method: "tools/list", params: cursor === void 0 ? {} : { cursor } }, { timeout: timeoutMs });
|
|
3105
3117
|
for (const tool2 of result.tools) tools.push(tool2);
|
|
3106
3118
|
cursor = result.nextCursor;
|
|
3107
|
-
if (cursor === void 0) return tools;
|
|
3108
|
-
if (cursors.has(cursor))
|
|
3119
|
+
if (cursor === void 0) return { tools };
|
|
3120
|
+
if (cursors.has(cursor)) return { tools, partial: `tools/list repeated a page cursor after ${page + 1} page(s), so its listing never ends; the pages before the repeat were read` };
|
|
3109
3121
|
cursors.add(cursor);
|
|
3110
3122
|
}
|
|
3111
|
-
|
|
3123
|
+
return { tools, partial: `tools/list did not end within ${MAX_LIST_PAGES} pages; the first ${MAX_LIST_PAGES} were read` };
|
|
3112
3124
|
}
|
|
3113
3125
|
async function listOrEmpty(label, serverName, fetchList) {
|
|
3114
3126
|
try {
|
|
@@ -3160,7 +3172,7 @@ async function captureSurface(server2, timeoutMs = DEFAULT_TIMEOUT_MS2) {
|
|
|
3160
3172
|
}
|
|
3161
3173
|
connection = opened;
|
|
3162
3174
|
try {
|
|
3163
|
-
return await readSurface(opened
|
|
3175
|
+
return await readSurface(opened, server2, timeoutMs);
|
|
3164
3176
|
} catch (error) {
|
|
3165
3177
|
const refused = opened.refused();
|
|
3166
3178
|
if (refused !== void 0) throw new UnreachableServerError(server2.name, refused, error);
|
|
@@ -3176,10 +3188,31 @@ async function captureSurface(server2, timeoutMs = DEFAULT_TIMEOUT_MS2) {
|
|
|
3176
3188
|
clearTimeout(timer);
|
|
3177
3189
|
}
|
|
3178
3190
|
}
|
|
3179
|
-
|
|
3191
|
+
var LIST_PASSES = 2;
|
|
3192
|
+
async function readSurface(connection, server2, timeoutMs) {
|
|
3193
|
+
for (let pass = 1; ; pass += 1) {
|
|
3194
|
+
connection.watchChanges();
|
|
3195
|
+
const surface = await readLists(connection.client, server2, timeoutMs);
|
|
3196
|
+
const moved = connection.changed();
|
|
3197
|
+
if (moved.length === 0) return surface;
|
|
3198
|
+
if (pass >= LIST_PASSES) {
|
|
3199
|
+
const reasons = [
|
|
3200
|
+
...surface.coverage?.reasons ?? [],
|
|
3201
|
+
`the server said its ${moved.join(" and ")} changed while being read, on ${LIST_PASSES} passes running, so no read is known to be current`
|
|
3202
|
+
];
|
|
3203
|
+
return { ...surface, coverage: { complete: false, reasons } };
|
|
3204
|
+
}
|
|
3205
|
+
}
|
|
3206
|
+
}
|
|
3207
|
+
async function readLists(client, server2, timeoutMs) {
|
|
3180
3208
|
const capabilities = client.getServerCapabilities();
|
|
3209
|
+
let toolsPartial;
|
|
3181
3210
|
const [tools, resources, resourceTemplates, prompts] = await Promise.all([
|
|
3182
|
-
capabilities?.tools ? listOrEmpty("tools/list", server2.name, async () =>
|
|
3211
|
+
capabilities?.tools ? listOrEmpty("tools/list", server2.name, async () => {
|
|
3212
|
+
const listed = await listAllTools(client, timeoutMs);
|
|
3213
|
+
toolsPartial = listed.partial;
|
|
3214
|
+
return listed.tools;
|
|
3215
|
+
}) : [],
|
|
3183
3216
|
// Each list call is bounded by the server's timeout too. With none, the SDK's default
|
|
3184
3217
|
// applied per page (60s, up to 64 pages), so one slow server could hold a run for an hour.
|
|
3185
3218
|
capabilities?.resources ? listOrEmpty("resources/list", server2.name, async () => (await client.listResources(void 0, { ...FRESH, timeout: timeoutMs })).resources) : [],
|
|
@@ -3195,7 +3228,8 @@ async function readSurface(client, server2, timeoutMs) {
|
|
|
3195
3228
|
tools,
|
|
3196
3229
|
resources,
|
|
3197
3230
|
resourceTemplates,
|
|
3198
|
-
prompts
|
|
3231
|
+
prompts,
|
|
3232
|
+
...toolsPartial ? { coverage: { complete: false, reasons: [toolsPartial] } } : {}
|
|
3199
3233
|
};
|
|
3200
3234
|
}
|
|
3201
3235
|
|
|
@@ -3290,7 +3324,8 @@ async function captureAll(options) {
|
|
|
3290
3324
|
unverified: unverified.sort(),
|
|
3291
3325
|
displaced,
|
|
3292
3326
|
unaudited,
|
|
3293
|
-
conflicted: discovery.conflicts.map((conflict) => conflict.name)
|
|
3327
|
+
conflicted: discovery.conflicts.map((conflict) => conflict.name),
|
|
3328
|
+
partial: Object.entries(subjects).filter(([, entry]) => entry.coverage !== void 0).map(([server2, entry]) => ({ server: server2, reasons: entry.coverage.reasons })).sort((a, b) => a.server.localeCompare(b.server))
|
|
3294
3329
|
};
|
|
3295
3330
|
}
|
|
3296
3331
|
function acknowledged(committed, name, now) {
|
|
@@ -3465,6 +3500,7 @@ var server = z2.object({
|
|
|
3465
3500
|
}),
|
|
3466
3501
|
transport,
|
|
3467
3502
|
provenance: provenance.optional(),
|
|
3503
|
+
coverage: z2.object({ complete: z2.literal(false), reasons: z2.array(z2.string()) }).optional(),
|
|
3468
3504
|
protocol: z2.object({
|
|
3469
3505
|
era: z2.enum(["modern", "legacy"]),
|
|
3470
3506
|
version: z2.string(),
|
|
@@ -3496,6 +3532,7 @@ var lockfileSchema = z2.object({
|
|
|
3496
3532
|
policy: z2.object({
|
|
3497
3533
|
ignoreMetaPrefixes: z2.array(z2.string()).optional(),
|
|
3498
3534
|
allowUnreachable: z2.boolean().optional(),
|
|
3535
|
+
allowPartial: z2.boolean().optional(),
|
|
3499
3536
|
/*
|
|
3500
3537
|
* Validated against the real list rather than accepted as free strings: a policy with
|
|
3501
3538
|
* `process_exec` in it would otherwise parse, forbid nothing, and read in the diff of
|
|
@@ -3517,7 +3554,7 @@ var lockfileSchema = z2.object({
|
|
|
3517
3554
|
var DEFAULT_LOCK_FILENAME = "mcp.lock";
|
|
3518
3555
|
var KEY_ORDER = {
|
|
3519
3556
|
root: ["lockfileVersion", "generatedBy", "policy", "subjects", "unaudited"],
|
|
3520
|
-
policy: ["ignoreMetaPrefixes", "allowUnreachable", "deniedCapabilities"],
|
|
3557
|
+
policy: ["ignoreMetaPrefixes", "allowUnreachable", "allowPartial", "deniedCapabilities"],
|
|
3521
3558
|
server: ["kind", "source", "transport", "protocol", "serverInfo", "capabilities", "instructions", "tools", "resources", "resourceTemplates", "prompts", "digest"],
|
|
3522
3559
|
source: ["client", "file", "scope"],
|
|
3523
3560
|
transport: ["type", "command", "args", "envKeys", "cwd", "url", "headerKeys"],
|
|
@@ -3789,8 +3826,17 @@ function renderHumanReport(report) {
|
|
|
3789
3826
|
""
|
|
3790
3827
|
);
|
|
3791
3828
|
}
|
|
3829
|
+
const partial = report.partial ?? [];
|
|
3830
|
+
if (partial.length > 0) {
|
|
3831
|
+
lines.push(yellow(`Could not read ${partial.length} server(s) in full:`));
|
|
3832
|
+
for (const entry of partial) {
|
|
3833
|
+
lines.push(` ${bold(visibleControls(entry.server))}`);
|
|
3834
|
+
for (const reason of entry.reasons) lines.push(` ${visibleLines(reason, " ")}`);
|
|
3835
|
+
}
|
|
3836
|
+
lines.push(dim(" Compared as far as they were read. This fails the audit; --allow-partial makes it a warning."), "");
|
|
3837
|
+
}
|
|
3792
3838
|
lines.push(...renderSteering(report));
|
|
3793
|
-
if (report.changes.length === 0 && report.unreachable.length === 0 && (report.violations ?? []).length === 0) {
|
|
3839
|
+
if (report.changes.length === 0 && report.unreachable.length === 0 && (report.violations ?? []).length === 0 && partial.length === 0) {
|
|
3794
3840
|
lines.push(green(`\u2713 ${report.serversChecked} server(s) match ${report.lockPath}`));
|
|
3795
3841
|
return `${lines.join("\n")}
|
|
3796
3842
|
`;
|
|
@@ -3856,7 +3902,9 @@ function renderJsonReport(report, exitCode) {
|
|
|
3856
3902
|
/** Unlike steering, these DO decide the exit code. */
|
|
3857
3903
|
violations: (report.violations ?? []).length,
|
|
3858
3904
|
/** Answered, but what they run could not be established. Never part of the verdict. */
|
|
3859
|
-
unverified: (report.unverified ?? []).length
|
|
3905
|
+
unverified: (report.unverified ?? []).length,
|
|
3906
|
+
/** Read, but not in full. Part of the verdict (exit 2) unless --allow-partial. */
|
|
3907
|
+
partial: (report.partial ?? []).length
|
|
3860
3908
|
},
|
|
3861
3909
|
changes: report.changes.map((change2) => ({
|
|
3862
3910
|
kind: change2.kind,
|
|
@@ -3871,7 +3919,8 @@ function renderJsonReport(report, exitCode) {
|
|
|
3871
3919
|
/** Text that began addressing the model since the lock was approved. Reported, never gated. */
|
|
3872
3920
|
steering: report.steering ?? [],
|
|
3873
3921
|
violations: report.violations ?? [],
|
|
3874
|
-
unverified: report.unverified ?? []
|
|
3922
|
+
unverified: report.unverified ?? [],
|
|
3923
|
+
partial: report.partial ?? []
|
|
3875
3924
|
},
|
|
3876
3925
|
null,
|
|
3877
3926
|
2
|
|
@@ -3908,6 +3957,7 @@ var LEVEL = {
|
|
|
3908
3957
|
var DENIED_RULE = "policy.capability.denied";
|
|
3909
3958
|
var STEERING_RULE = "steering.passage.arrived";
|
|
3910
3959
|
var UNVERIFIED_RULE = "server.artifact.unverified";
|
|
3960
|
+
var PARTIAL_RULE = "server.surface.partial";
|
|
3911
3961
|
var RULE_HELP = {
|
|
3912
3962
|
"tool.capability.gained": "A tool gained a capability it did not declare before, derived from its name, its argument names and the shape of its schema. The severity is the capability's, not the schema change's: gaining a `command` argument is not the same finding as gaining an optional string.",
|
|
3913
3963
|
"tool.description.changed": "A tool description is injected into the model's context. A change here can carry instructions to the agent and should be read in full, not skimmed.",
|
|
@@ -3934,6 +3984,7 @@ function renderSarifReport(report, options = {}) {
|
|
|
3934
3984
|
const violations = report.violations ?? [];
|
|
3935
3985
|
const steering = options.steering ? report.steering ?? [] : [];
|
|
3936
3986
|
const unverified = report.unverified ?? [];
|
|
3987
|
+
const partial = report.partial ?? [];
|
|
3937
3988
|
const at = (name, qualified) => [
|
|
3938
3989
|
{
|
|
3939
3990
|
physicalLocation: { artifactLocation: { uri: sarifUri(report), uriBaseId: "%SRCROOT%" } },
|
|
@@ -3955,6 +4006,13 @@ function renderSarifReport(report, options = {}) {
|
|
|
3955
4006
|
fullDescription: { text: "A passage a model is shown started reading as an instruction since this lock was approved. A signal to read, not a verdict: legitimate servers trip the same shape. It does not affect the exit code." },
|
|
3956
4007
|
defaultConfiguration: { level: "note" }
|
|
3957
4008
|
}] : [],
|
|
4009
|
+
...partial.length > 0 ? [{
|
|
4010
|
+
id: PARTIAL_RULE,
|
|
4011
|
+
name: "ServerSurfacePartial",
|
|
4012
|
+
shortDescription: { text: "A server's surface could not be read in full" },
|
|
4013
|
+
fullDescription: { text: "The listing did not end within the page limit, or the server said it changed while being read on every pass. Compared as far as it was read; the audit did not finish." },
|
|
4014
|
+
defaultConfiguration: { level: "warning" }
|
|
4015
|
+
}] : [],
|
|
3958
4016
|
...unverified.length > 0 ? [{
|
|
3959
4017
|
id: UNVERIFIED_RULE,
|
|
3960
4018
|
name: "ServerArtifactUnverified",
|
|
@@ -4010,6 +4068,13 @@ function renderSarifReport(report, options = {}) {
|
|
|
4010
4068
|
partialFingerprints: { "mcpAuditChange/v1": `${server2}/${signal.field}/${signal.kind}` }
|
|
4011
4069
|
}))
|
|
4012
4070
|
),
|
|
4071
|
+
...partial.map((entry) => ({
|
|
4072
|
+
ruleId: PARTIAL_RULE,
|
|
4073
|
+
level: "warning",
|
|
4074
|
+
message: { text: `${entry.server}: could not be read in full. ${entry.reasons.join("; ")}` },
|
|
4075
|
+
locations: at(entry.server, entry.server),
|
|
4076
|
+
partialFingerprints: { "mcpAuditChange/v1": `${entry.server}/partial` }
|
|
4077
|
+
})),
|
|
4013
4078
|
...unverified.map((server2) => ({
|
|
4014
4079
|
ruleId: UNVERIFIED_RULE,
|
|
4015
4080
|
level: "note",
|
|
@@ -4048,7 +4113,8 @@ function row(change2) {
|
|
|
4048
4113
|
}
|
|
4049
4114
|
function renderMarkdownReport(report, options = {}) {
|
|
4050
4115
|
const violations = report.violations ?? [];
|
|
4051
|
-
|
|
4116
|
+
const partial = report.partial ?? [];
|
|
4117
|
+
if (report.changes.length === 0 && report.unreachable.length === 0 && violations.length === 0 && partial.length === 0) return null;
|
|
4052
4118
|
const lines = [];
|
|
4053
4119
|
const high = report.changes.filter((change2) => change2.severity === "high").length;
|
|
4054
4120
|
if (report.changes.length === 0 && violations.length > 0) {
|
|
@@ -4116,6 +4182,18 @@ function renderMarkdownReport(report, options = {}) {
|
|
|
4116
4182
|
""
|
|
4117
4183
|
);
|
|
4118
4184
|
}
|
|
4185
|
+
if (partial.length > 0) {
|
|
4186
|
+
lines.push(
|
|
4187
|
+
`<details><summary>${partial.length} server${partial.length === 1 ? "" : "s"} could not be read in full</summary>`,
|
|
4188
|
+
"",
|
|
4189
|
+
"Compared as far as they were read. A clean comparison against part of a surface says nothing about the rest, so this fails the audit unless `--allow-partial` is set.",
|
|
4190
|
+
"",
|
|
4191
|
+
...partial.map((entry) => `- ${code(entry.server)}: ${plain(entry.reasons.join("; "))}`),
|
|
4192
|
+
"",
|
|
4193
|
+
"</details>",
|
|
4194
|
+
""
|
|
4195
|
+
);
|
|
4196
|
+
}
|
|
4119
4197
|
const unverified = report.unverified ?? [];
|
|
4120
4198
|
if (unverified.length > 0) {
|
|
4121
4199
|
lines.push(
|
|
@@ -4308,6 +4386,7 @@ async function buildReport(options) {
|
|
|
4308
4386
|
`);
|
|
4309
4387
|
const changes = compareWithLock(committed, result);
|
|
4310
4388
|
const allowUnreachable = options.allowUnreachable || committed.policy?.allowUnreachable === true;
|
|
4389
|
+
const allowPartial = options.allowPartial === true || committed.policy?.allowPartial === true;
|
|
4311
4390
|
const report = {
|
|
4312
4391
|
changes,
|
|
4313
4392
|
/*
|
|
@@ -4324,6 +4403,7 @@ async function buildReport(options) {
|
|
|
4324
4403
|
unreachable: result.unreachable,
|
|
4325
4404
|
// Reported beside the verdict and never part of it; see `AuditReport.unverified`.
|
|
4326
4405
|
unverified: result.unverified,
|
|
4406
|
+
partial: result.partial,
|
|
4327
4407
|
serversChecked: Object.keys(result.lock.subjects).length,
|
|
4328
4408
|
lockPath: options.lockPath,
|
|
4329
4409
|
projectRoot: options.projectRoot
|
|
@@ -4337,7 +4417,11 @@ async function buildReport(options) {
|
|
|
4337
4417
|
* able to make it pass: policy is the thing acceptance cannot overrule.
|
|
4338
4418
|
*/
|
|
4339
4419
|
driftCount: changes.length + (report.violations?.length ?? 0),
|
|
4340
|
-
|
|
4420
|
+
/*
|
|
4421
|
+
* A surface only partly read is neither drift nor clean: the audit did not finish, which is
|
|
4422
|
+
* what an unreachable server already means, for the same reason.
|
|
4423
|
+
*/
|
|
4424
|
+
incompleteCount: (allowUnreachable ? 0 : result.unreachable.length) + (allowPartial ? 0 : result.partial.length)
|
|
4341
4425
|
})
|
|
4342
4426
|
};
|
|
4343
4427
|
}
|
|
@@ -4559,6 +4643,10 @@ async function runInit(options) {
|
|
|
4559
4643
|
lines.push(` ${dim("A signal to read, not a verdict. It never fails a build.")}`);
|
|
4560
4644
|
}
|
|
4561
4645
|
}
|
|
4646
|
+
for (const partial of result.partial) {
|
|
4647
|
+
lines.push(` ${yellow("\u25D0")} ${bold(visibleControls(partial.server))} ${dim("pinned as far as it could be read")}`);
|
|
4648
|
+
for (const reason of partial.reasons) lines.push(` ${visibleLines(reason, " ")}`);
|
|
4649
|
+
}
|
|
4562
4650
|
for (const failure of result.unreachable) {
|
|
4563
4651
|
lines.push(` ${red("\u2717")} ${bold(visibleControls(failure.server))} ${dim("not pinned")}`, ` ${visibleLines(failure.reason, " ")}`);
|
|
4564
4652
|
}
|
|
@@ -4579,6 +4667,7 @@ async function runInit(options) {
|
|
|
4579
4667
|
process.stdout.write(lines.join("\n"));
|
|
4580
4668
|
await maybeOfferTelemetry();
|
|
4581
4669
|
if (result.unreachable.length > 0 && !options.allowUnreachable) return EXIT_INCOMPLETE;
|
|
4670
|
+
if (result.partial.length > 0 && !options.allowPartial) return EXIT_INCOMPLETE;
|
|
4582
4671
|
return EXIT_CLEAN;
|
|
4583
4672
|
}
|
|
4584
4673
|
|
|
@@ -4985,6 +5074,13 @@ ${dim(`Looked in: ${looked}`)}
|
|
|
4985
5074
|
if (verdict.verdict !== "clean") lines.push("", dim(`Review it at ${shown(verdict.url)}`));
|
|
4986
5075
|
lines.push("");
|
|
4987
5076
|
process.stdout.write(lines.join("\n"));
|
|
5077
|
+
if (result.partial.length > 0 && options.allowPartial !== true) {
|
|
5078
|
+
process.stderr.write(
|
|
5079
|
+
`${yellow("incomplete:")} ${result.partial.map((entry) => visibleControls(entry.server)).join(", ")} could not be read in full. Pass --allow-partial to accept that.
|
|
5080
|
+
`
|
|
5081
|
+
);
|
|
5082
|
+
return EXIT_INCOMPLETE;
|
|
5083
|
+
}
|
|
4988
5084
|
return verdict.exitCode === 0 ? EXIT_CLEAN : verdict.exitCode === 1 ? EXIT_DRIFT : EXIT_INCOMPLETE;
|
|
4989
5085
|
}
|
|
4990
5086
|
|
|
@@ -5043,7 +5139,7 @@ async function runReview(options) {
|
|
|
5043
5139
|
if (changes.length === 0) {
|
|
5044
5140
|
process.stdout.write(`${green(`\u2713 nothing to review; ${options.lockPath} is up to date`)}
|
|
5045
5141
|
`);
|
|
5046
|
-
return result.unreachable.length > 0 && !options.allowUnreachable ? EXIT_INCOMPLETE : EXIT_CLEAN;
|
|
5142
|
+
return result.unreachable.length > 0 && !options.allowUnreachable || result.partial.length > 0 && !options.allowPartial ? EXIT_INCOMPLETE : EXIT_CLEAN;
|
|
5047
5143
|
}
|
|
5048
5144
|
const grouped = /* @__PURE__ */ new Map();
|
|
5049
5145
|
for (const change2 of changes) {
|
|
@@ -5112,6 +5208,7 @@ ${green(`\u2713 accepted ${accepted} server(s) into ${options.lockPath}`)}
|
|
|
5112
5208
|
if (declined > 0) process.stdout.write(`${yellow(`${declined} server(s) left unaccepted; \`check\` will still fail on them.`)}
|
|
5113
5209
|
`);
|
|
5114
5210
|
if (result.unreachable.length > 0 && !options.allowUnreachable) return EXIT_INCOMPLETE;
|
|
5211
|
+
if (result.partial.length > 0 && !options.allowPartial) return EXIT_INCOMPLETE;
|
|
5115
5212
|
return declined > 0 ? EXIT_DRIFT : EXIT_CLEAN;
|
|
5116
5213
|
}
|
|
5117
5214
|
|
|
@@ -5133,6 +5230,7 @@ ${bold("Options")}
|
|
|
5133
5230
|
--config <path> audit this config file too; repeatable
|
|
5134
5231
|
--timeout <ms> per-server timeout (default: ${DEFAULT_TIMEOUT_MS2})
|
|
5135
5232
|
--allow-unreachable a server that cannot be reached warns instead of failing
|
|
5233
|
+
--allow-partial a server whose tool list could not be read in full warns instead of failing
|
|
5136
5234
|
--no-provenance do not look up what each stdio server runs (air-gapped runs)
|
|
5137
5235
|
--user-configs also pin servers from your own configs (~/.claude.json, Claude Desktop, ...)
|
|
5138
5236
|
--json machine-readable output (check)
|
|
@@ -5164,6 +5262,7 @@ async function main() {
|
|
|
5164
5262
|
config: { type: "string", multiple: true },
|
|
5165
5263
|
timeout: { type: "string" },
|
|
5166
5264
|
"allow-unreachable": { type: "boolean", default: false },
|
|
5265
|
+
"allow-partial": { type: "boolean", default: false },
|
|
5167
5266
|
"no-provenance": { type: "boolean", default: false },
|
|
5168
5267
|
"user-configs": { type: "boolean", default: false },
|
|
5169
5268
|
json: { type: "boolean", default: false },
|
|
@@ -5209,6 +5308,7 @@ async function main() {
|
|
|
5209
5308
|
configFiles: values.config ?? [],
|
|
5210
5309
|
timeoutMs,
|
|
5211
5310
|
allowUnreachable: values["allow-unreachable"],
|
|
5311
|
+
allowPartial: values["allow-partial"],
|
|
5212
5312
|
format: values.sarif ? "sarif" : values.json ? "json" : "human",
|
|
5213
5313
|
sarifSteering: values["sarif-steering"] === true,
|
|
5214
5314
|
comment: values.comment,
|