@agent-surface/cli 0.11.1 → 0.12.1

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.
@@ -0,0 +1,541 @@
1
+ import {
2
+ buildView,
3
+ flatRows
4
+ } from "./chunk-DYDSJM7R.js";
5
+ import {
6
+ authoredIds,
7
+ formatValue,
8
+ normalize,
9
+ unreadKey,
10
+ unresolved
11
+ } from "./chunk-Q5WOLWEW.js";
12
+
13
+ // src/render/plain.ts
14
+ import { relative } from "path";
15
+ var MARK = { expose: "+", disable: "~", hide: "-" };
16
+ var STATE = { expose: "callable", disable: "disabled", hide: "hidden" };
17
+ var NONE = "\u2014";
18
+ var REPORT_WIDTH = 100;
19
+ function wrapText(text, width) {
20
+ const words = text.split(/\s+/).filter(Boolean);
21
+ const lines = [];
22
+ let line = "";
23
+ for (const word of words) {
24
+ if (line && line.length + 1 + word.length > width) {
25
+ lines.push(line);
26
+ line = word;
27
+ } else {
28
+ line = line ? `${line} ${word}` : word;
29
+ }
30
+ }
31
+ if (line) lines.push(line);
32
+ return lines.length > 0 ? lines : [""];
33
+ }
34
+ function renderTable(headers, rows) {
35
+ const widths = headers.map(
36
+ (header, column) => Math.max(header.length, ...rows.map((row) => (row.cells[column] ?? "").length))
37
+ );
38
+ const line = (cells) => cells.map((cell, column) => column === headers.length - 1 ? cell : cell.padEnd(widths[column])).join(" ").trimEnd();
39
+ const lines = [line(headers)];
40
+ for (const row of rows) {
41
+ lines.push(line(row.cells));
42
+ if (row.note) {
43
+ for (const [index, note] of wrapText(row.note, REPORT_WIDTH - 6).entries()) {
44
+ lines.push(` ${index === 0 ? "\u2937 " : " "}${note}`);
45
+ }
46
+ }
47
+ }
48
+ return lines;
49
+ }
50
+ function section(title, gloss, count) {
51
+ return `${title} \u2014 ${gloss} (${count})`;
52
+ }
53
+ function renderDetailRow(row, lines) {
54
+ const tags = row.tags.length > 0 ? ` [${row.tags.join(", ")}]` : "";
55
+ lines.push(` ${MARK[row.outcome]} ${row.name}${tags}`);
56
+ lines.push(` ${row.description}`);
57
+ if (row.reason) lines.push(` reason: ${row.reason}`);
58
+ if (row.policies) {
59
+ if (row.policies.length === 0) {
60
+ lines.push(" policies: none");
61
+ } else {
62
+ for (const policy of row.policies) {
63
+ const vote = policy.discovery ? policy.discovery.decision === "disable" ? `disable \u2014 ${policy.discovery.reason}` : policy.discovery.decision : "no discovery hook";
64
+ const phases = policy.phases.length > 0 ? policy.phases.join("/") : NONE;
65
+ const flags = [
66
+ policy.threw ? "THREW" : "",
67
+ policy.confirmationEscalation ? "escalates-confirmation" : ""
68
+ ].filter(Boolean).join(", ");
69
+ lines.push(
70
+ ` policy ${policy.name} (${policy.scope}, ${phases}): ${vote}${flags ? ` [${flags}]` : ""}`
71
+ );
72
+ }
73
+ }
74
+ if (row.availability && !row.availability.available) {
75
+ lines.push(
76
+ ` availability: unavailable${row.availability.reason ? ` \u2014 ${row.availability.reason}` : ""}`
77
+ );
78
+ }
79
+ }
80
+ if (row.schemas) {
81
+ if (row.schemas.input !== void 0) {
82
+ lines.push(` input: ${JSON.stringify(row.schemas.input)}`);
83
+ }
84
+ if (row.schemas.output !== void 0) {
85
+ lines.push(` output: ${JSON.stringify(row.schemas.output)}`);
86
+ }
87
+ }
88
+ }
89
+ function renderCountsPlain(view) {
90
+ return `${view.counts.callable} callable, ${view.counts.disabled} visible-disabled, ${view.counts.hidden} hidden` + (view.rejections.length > 0 ? `, ${view.rejections.length} registration${view.rejections.length === 1 ? "" : "s"} rejected` : "");
91
+ }
92
+ function renderHeader(view, lines) {
93
+ lines.push(
94
+ `scenario ${view.scenario}${view.route ? ` route ${view.route}` : ""}${view.scope && view.scope.length > 0 ? ` scope ${view.scope.join(" ")}` : ""}`
95
+ );
96
+ lines.push(renderCountsPlain(view));
97
+ }
98
+ function renderRejections(view, lines) {
99
+ if (view.rejections.length === 0) return;
100
+ lines.push("");
101
+ lines.push(
102
+ section("REJECTED", "the registry refused these during the mount", view.rejections.length)
103
+ );
104
+ for (const rejection of view.rejections) {
105
+ const why = rejection.reason === "duplicate" ? "duplicate \u2014 an earlier registration holds this key" : "guard \u2014 onRegister rejected this registration";
106
+ lines.push(` ! ${rejection.componentType} (${rejection.instanceId}) ${why}`);
107
+ }
108
+ }
109
+ function renderEmpty(view, lines) {
110
+ lines.push("");
111
+ if (view.counts.hidden > 0) {
112
+ lines.push(
113
+ `Nothing is callable here \u2014 all ${view.counts.hidden} registered capabilities were hidden by policy.`
114
+ );
115
+ if (!view.explained) lines.push("Re-run with --explain to see which policy hid them.");
116
+ } else {
117
+ lines.push("Nothing is registered for this scenario \u2014 the agent has no surface here.");
118
+ if (!view.explained) lines.push("Re-run with --explain to see whether a policy hid it.");
119
+ }
120
+ }
121
+ function renderSurfacePlain(view, options = {}) {
122
+ const lines = [];
123
+ renderHeader(view, lines);
124
+ renderRejections(view, lines);
125
+ const rows = flatRows(view);
126
+ if (rows.length === 0) {
127
+ renderEmpty(view, lines);
128
+ return lines.join("\n");
129
+ }
130
+ if (options.detail) {
131
+ for (const group of view.groups.filter((group2) => group2.rows.length > 0)) {
132
+ lines.push("");
133
+ lines.push(`${group.heading} (${group.rows.length})`);
134
+ for (const row of group.rows) renderDetailRow(row, lines);
135
+ }
136
+ return lines.join("\n");
137
+ }
138
+ lines.push("");
139
+ lines.push(
140
+ ...renderTable(
141
+ ["CAPABILITY", "KIND", "EFFECT", "STATE", "FLAGS"],
142
+ rows.map((row) => ({
143
+ cells: [
144
+ row.path,
145
+ row.kind,
146
+ row.effect ?? NONE,
147
+ STATE[row.outcome],
148
+ row.flags.length > 0 ? row.flags.join(" \xB7 ") : NONE
149
+ ],
150
+ ...row.reason ? { note: row.reason } : {}
151
+ }))
152
+ )
153
+ );
154
+ return lines.join("\n");
155
+ }
156
+ function componentOf(capabilityId) {
157
+ const path = capabilityId.replace(/^(view|domain):/, "");
158
+ const dot = path.lastIndexOf(".");
159
+ return dot === -1 ? path : path.slice(0, dot);
160
+ }
161
+ function renderCatalogPlain(inventory, options = {}) {
162
+ const lines = [];
163
+ const resolved = inventory.capabilities.filter((c) => c.resolution !== "unresolved");
164
+ const unreadEntries = unresolved(inventory);
165
+ const dynamicMetadata = resolved.filter((c) => c.resolution === "partial").length;
166
+ const ids = authoredIds(inventory);
167
+ const authored = ids.size + (options.domainCapabilities ?? 0);
168
+ lines.push("STATIC CATALOG");
169
+ lines.push(
170
+ `STATUS ${unreadEntries.length > 0 ? "INCOMPLETE" : "COMPLETE"}${unreadEntries.length > 0 ? ` \u2014 ${unreadEntries.length} unread capability identit${unreadEntries.length === 1 ? "y" : "ies"}` : " \u2014 every capability identity resolved"}`
171
+ );
172
+ lines.push(
173
+ `Capabilities ${authored} authored (upper bound) \xB7 ${resolved.length} resolved call site${resolved.length === 1 ? "" : "s"}`
174
+ );
175
+ lines.push(
176
+ `Program ${inventory.filesAnalyzed} file${inventory.filesAnalyzed === 1 ? "" : "s"} analyzed` + (inventory.filesOutsideRoot > 0 ? ` \xB7 ${inventory.filesOutsideRoot} agent-surface implementation file${inventory.filesOutsideRoot === 1 ? "" : "s"} excluded` : "")
177
+ );
178
+ lines.push(
179
+ `Metadata ${dynamicMetadata} call site${dynamicMetadata === 1 ? "" : "s"} partially read` + (dynamicMetadata > 0 ? " \xB7 identity remains resolved" : "")
180
+ );
181
+ lines.push(
182
+ options.domainCapabilities === void 0 ? "Domain not analyzed at static depth; full depth reads the oRPC manifest" : `Domain ${options.domainCapabilities} manifest capabilit${options.domainCapabilities === 1 ? "y" : "ies"}`
183
+ );
184
+ if (!options.standalone) return lines.join("\n");
185
+ const components = /* @__PURE__ */ new Map();
186
+ for (const capability of resolved) {
187
+ const component = componentOf(capability.capabilityId);
188
+ const current = components.get(component) ?? { ids: /* @__PURE__ */ new Set(), sites: 0, partial: 0 };
189
+ current.ids.add(capability.capabilityId);
190
+ current.sites += 1;
191
+ if (capability.resolution === "partial") current.partial += 1;
192
+ components.set(component, current);
193
+ }
194
+ if (components.size > 0) {
195
+ lines.push("");
196
+ lines.push(`COMPONENTS (${components.size})`);
197
+ lines.push(
198
+ ...renderTable(
199
+ ["COMPONENT", "CAPABILITIES", "CALL SITES", "DYNAMIC META"],
200
+ [...components.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([component, data]) => ({
201
+ cells: [
202
+ `view:${component}`,
203
+ String(data.ids.size),
204
+ String(data.sites),
205
+ data.partial > 0 ? String(data.partial) : NONE
206
+ ],
207
+ note: [...data.ids].sort().join(" \xB7 ")
208
+ }))
209
+ )
210
+ );
211
+ }
212
+ if (unreadEntries.length > 0) {
213
+ const groups = /* @__PURE__ */ new Map();
214
+ for (const entry of unreadEntries) {
215
+ const key = `${entry.origin.file}\0${entry.reason ?? "unknown"}`;
216
+ groups.set(key, (groups.get(key) ?? 0) + 1);
217
+ }
218
+ lines.push("");
219
+ lines.push(`UNREAD SITES (${unreadEntries.length})`);
220
+ lines.push("Counts above are a floor until these sites are resolved or explicitly accepted.");
221
+ lines.push(
222
+ ...renderTable(
223
+ ["FILE", "REASON", "SITES"],
224
+ [...groups.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([key, count]) => {
225
+ const [file, reason] = key.split("\0");
226
+ return { cells: [file ?? "?", reason ?? "unknown", String(count)] };
227
+ })
228
+ )
229
+ );
230
+ lines.push("", "ALLOWLIST KEYS");
231
+ for (const entry of unreadEntries) lines.push(` allowlist key: ${unreadKey(entry)}`);
232
+ }
233
+ if (options.detail) {
234
+ const byId = [...resolved].sort((a, b) => a.capabilityId.localeCompare(b.capabilityId));
235
+ if (byId.length > 0) {
236
+ lines.push("");
237
+ lines.push(`CAPABILITY DETAILS (${byId.length} call sites)`);
238
+ lines.push(
239
+ ...renderTable(
240
+ ["CAPABILITY", "KIND", "ORIGIN", "READ"],
241
+ byId.map((capability) => ({
242
+ cells: [
243
+ capability.capabilityId,
244
+ capability.kind,
245
+ `${capability.origin.file}:${capability.origin.line}`,
246
+ capability.resolution
247
+ ],
248
+ ...capability.note ? { note: capability.note } : {}
249
+ }))
250
+ )
251
+ );
252
+ }
253
+ const unread = renderUnread(unreadEntries);
254
+ if (unread.length > 0) lines.push("", ...unread);
255
+ } else if (unreadEntries.length > 0 || resolved.length > 0) {
256
+ lines.push("");
257
+ lines.push(
258
+ "Details: re-run with --detail for origins, metadata diagnostics, and allowlist keys."
259
+ );
260
+ }
261
+ return lines.join("\n");
262
+ }
263
+ function renderUnread(entries) {
264
+ if (entries.length === 0) return [];
265
+ const lines = [];
266
+ lines.push(
267
+ section(
268
+ "UNREAD CALL SITES",
269
+ "the catalog is incomplete, so every count above is a floor",
270
+ entries.length
271
+ )
272
+ );
273
+ for (const capability of entries) {
274
+ lines.push(` ? ${capability.origin.file}:${capability.origin.line}`);
275
+ lines.push(` ${capability.note ?? "the extractor could not read this call site"}`);
276
+ lines.push(` allowlist key: ${unreadKey(capability)}`);
277
+ }
278
+ return lines;
279
+ }
280
+ function renderCoveragePlain(report, options = {}) {
281
+ const lines = [];
282
+ if (report.unreached.length > 0) {
283
+ lines.push(
284
+ section("UNREACHED", "authored, and no scenario mounts it", report.unreached.length)
285
+ );
286
+ lines.push(
287
+ ...renderTable(
288
+ ["CAPABILITY", "ORIGIN"],
289
+ report.unreached.map((entry) => ({
290
+ cells: [entry.capabilityId, `${entry.origin.file}:${entry.origin.line}`]
291
+ }))
292
+ )
293
+ );
294
+ lines.push("");
295
+ }
296
+ if (report.undeclared.length > 0) {
297
+ if (!options.compact || options.detail) {
298
+ lines.push(
299
+ section(
300
+ "UNDECLARED",
301
+ "present at runtime with no static origin \u2014 a dynamic registration, or a gap here",
302
+ report.undeclared.length
303
+ )
304
+ );
305
+ for (const id of report.undeclared) lines.push(` ${id}`);
306
+ } else {
307
+ lines.push(
308
+ `NOTICE \u2014 ${report.undeclared.length} runtime capabilit${report.undeclared.length === 1 ? "y has" : "ies have"} no static origin; re-run check with --detail to list them.`
309
+ );
310
+ }
311
+ lines.push("");
312
+ }
313
+ if (report.unmanifestedDomain.length > 0) {
314
+ lines.push(
315
+ section(
316
+ "UNMANIFESTED DOMAIN",
317
+ "mounted, but absent from the authoritative oRPC manifest",
318
+ report.unmanifestedDomain.length
319
+ )
320
+ );
321
+ for (const id of report.unmanifestedDomain) lines.push(` ${id}`);
322
+ lines.push("");
323
+ }
324
+ if (report.staleAllowlist.length > 0) {
325
+ lines.push(
326
+ section(
327
+ "STALE ALLOWLIST",
328
+ "a scenario reaches these now, so delete them before the list rots",
329
+ report.staleAllowlist.length
330
+ )
331
+ );
332
+ for (const id of report.staleAllowlist) lines.push(` ${id}`);
333
+ lines.push("");
334
+ }
335
+ if (report.staleUnreadAllowlist.length > 0) {
336
+ lines.push(
337
+ section(
338
+ "STALE UNREAD ALLOWLIST",
339
+ "the extractor reads these now, so delete them before the list rots",
340
+ report.staleUnreadAllowlist.length
341
+ )
342
+ );
343
+ for (const key of report.staleUnreadAllowlist) lines.push(` ${key}`);
344
+ lines.push("");
345
+ }
346
+ if (report.unresolved.length > 0) {
347
+ lines.push(...renderUnread(report.unresolved), "");
348
+ }
349
+ if (!options.compact) lines.push(...renderCoverageSummary(report));
350
+ return lines.join("\n");
351
+ }
352
+ function overviewRow(label, status, text) {
353
+ return `${label.padEnd(12)}${status.padEnd(7)}${text}`;
354
+ }
355
+ function wrappedList(items) {
356
+ const prefix = " ";
357
+ return wrapText(items.join(", "), REPORT_WIDTH - prefix.length).map((line) => `${prefix}${line}`);
358
+ }
359
+ function renderCheckOverviewPlain(input) {
360
+ const lines = [`SURFACE CHECK ${input.status}`, ""];
361
+ const coverage = input.coverage;
362
+ if (coverage) {
363
+ const coverageStatus = coverage.unreached.length > 0 || coverage.staleAllowlist.length > 0 ? "FAIL" : coverage.allowed.length > 0 ? "WARN" : "PASS";
364
+ lines.push(
365
+ overviewRow(
366
+ "Coverage",
367
+ coverageStatus,
368
+ `${coverage.reached}/${coverage.authored} authored capabilities reached` + (coverage.unreached.length > 0 ? ` \xB7 ${coverage.unreached.length} unreached` : "") + (coverage.allowed.length > 0 ? ` \xB7 ${coverage.allowed.length} unreached allowlisted` : "") + (coverage.staleAllowlist.length > 0 ? ` \xB7 ${coverage.staleAllowlist.length} stale allowlist entr${coverage.staleAllowlist.length === 1 ? "y" : "ies"}` : "")
369
+ )
370
+ );
371
+ const unread = coverage.unresolved.length;
372
+ const accepted = coverage.allowedUnread.length;
373
+ const catalogStatus = coverage.staleUnreadAllowlist.length > 0 || unread > 0 && !input.unresolvedAllowed ? "FAIL" : unread > 0 || accepted > 0 ? "WARN" : "PASS";
374
+ lines.push(
375
+ overviewRow(
376
+ "Catalog",
377
+ catalogStatus,
378
+ coverage.staleUnreadAllowlist.length > 0 ? `${coverage.staleUnreadAllowlist.length} stale unread allowlist entr${coverage.staleUnreadAllowlist.length === 1 ? "y" : "ies"}` : unread > 0 ? `${unread} unread static site${unread === 1 ? "" : "s"}${input.unresolvedAllowed ? " accepted by --allow-unresolved" : ""}` : accepted > 0 ? `${accepted} unread static site${accepted === 1 ? "" : "s"} allowlisted` : "all static sites resolved"
379
+ )
380
+ );
381
+ lines.push(
382
+ overviewRow(
383
+ "Domain",
384
+ coverage.unmanifestedDomain.length > 0 ? "FAIL" : coverage.domainAuthoritative ? "PASS" : "WARN",
385
+ coverage.unmanifestedDomain.length > 0 ? `${coverage.unmanifestedDomain.length} mounted capabilit${coverage.unmanifestedDomain.length === 1 ? "y" : "ies"} absent from manifest` : coverage.domainAuthoritative ? `${coverage.domainReached.length} manifest capabilit${coverage.domainReached.length === 1 ? "y" : "ies"} reached` : "authoritative manifest not configured"
386
+ )
387
+ );
388
+ } else {
389
+ lines.push(
390
+ overviewRow(
391
+ "Coverage",
392
+ input.status === "ERROR" ? "ERROR" : "WARN",
393
+ input.status === "ERROR" ? "no verdict; runtime analysis incomplete" : "not evaluated \u2014 statement about these scenarios only; re-run with --depth full"
394
+ )
395
+ );
396
+ }
397
+ const baselineOk = input.baselineCurrent === input.baselineTotal && input.scenarioManifestOk;
398
+ lines.push(
399
+ overviewRow(
400
+ "Baselines",
401
+ baselineOk ? "PASS" : "FAIL",
402
+ `${input.baselineCurrent}/${input.baselineTotal} scenario baselines current` + (input.scenarioManifestOk ? "" : " \xB7 scenario manifest differs")
403
+ )
404
+ );
405
+ lines.push(
406
+ overviewRow(
407
+ "Runtime",
408
+ input.mountFailures > 0 ? "ERROR" : input.rejected > 0 ? "FAIL" : "PASS",
409
+ input.mountFailures > 0 ? `${input.mountFailures} scenario${input.mountFailures === 1 ? "" : "s"} did not mount` : input.rejected > 0 ? `${input.rejected} registration${input.rejected === 1 ? "" : "s"} rejected` : `${input.scenarios.length} scenario${input.scenarios.length === 1 ? "" : "s"} mounted`
410
+ )
411
+ );
412
+ lines.push("", `SCENARIOS (${input.scenarios.length})`, ...wrappedList(input.scenarios));
413
+ return lines.join("\n");
414
+ }
415
+ function renderCoverageSummary(report) {
416
+ const qualifiers = [
417
+ `${report.scenarios.length} scenario${report.scenarios.length === 1 ? "" : "s"} (${report.scenarios.join(
418
+ ", "
419
+ )})`
420
+ ];
421
+ if (report.scope && report.scope.length > 0) qualifiers.push(`scope ${report.scope.join(" ")}`);
422
+ const lines = [
423
+ `${report.authored} authored \xB7 ${report.reached} reached \xB7 ${report.unreached.length} unreached \xB7 ${qualifiers.join(" \xB7 ")}`
424
+ ];
425
+ if (report.domainReached.length > 0) {
426
+ lines.push(
427
+ `${report.domainReached.length} domain capabilit${report.domainReached.length === 1 ? "y" : "ies"} reached${report.domainAuthoritative ? " against the authoritative oRPC manifest" : " and held apart \u2014 configure the authoritative oRPC manifest to cover that plane"}`
428
+ );
429
+ }
430
+ if (report.allowed.length > 0) {
431
+ lines.push(
432
+ `${report.allowed.length} unreached capabilit${report.allowed.length === 1 ? "y is" : "ies are"} allowlisted in ${relative(process.cwd(), report.allowlistPath)}`
433
+ );
434
+ }
435
+ if (report.allowedUnread.length > 0) {
436
+ lines.push(
437
+ `${report.allowedUnread.length} unread call site${report.allowedUnread.length === 1 ? " is" : "s are"} allowlisted in ${relative(process.cwd(), report.unreadAllowlistPath)}`
438
+ );
439
+ }
440
+ if (report.allowlistOutOfScope > 0) {
441
+ lines.push(
442
+ `${report.allowlistOutOfScope} allowlist entr${report.allowlistOutOfScope === 1 ? "y" : "ies"} outside this scope were not judged either way`
443
+ );
444
+ }
445
+ if (report.unreached.length === 0 && report.unresolved.length === 0 && report.staleAllowlist.length === 0 && report.staleUnreadAllowlist.length === 0 && report.unmanifestedDomain.length === 0) {
446
+ lines.push(
447
+ report.allowed.length > 0 ? "no new surface coverage gaps \u2014 the allowlist still holds the known ones" : "every authored capability is reached by a scenario"
448
+ );
449
+ }
450
+ return lines;
451
+ }
452
+ function renderNoVerdictPlain(failures) {
453
+ return [
454
+ section("NO COVERAGE VERDICT", "a scenario did not mount, so nothing reached anything", failures.length),
455
+ ...failures.flatMap((failure) => [` ${failure.scenario}`, ` ${failure.message}`]),
456
+ "",
457
+ "Every capability those scenarios would have surfaced would be reported unreached,",
458
+ "so no verdict is printed at all. Fix the mount, or name a scenario that works."
459
+ ].join("\n");
460
+ }
461
+ function renderFailuresPlain(failures) {
462
+ return [
463
+ section("DID NOT MOUNT", "these scenarios threw, and were skipped", failures.length),
464
+ ...failures.flatMap((failure) => [` ${failure.scenario}`, ` ${failure.message}`])
465
+ ].join("\n");
466
+ }
467
+ function renderDriftPlain(scenario, entries) {
468
+ const lines = [` ${scenario}: ${entries.length} change${entries.length === 1 ? "" : "s"}`];
469
+ for (const entry of entries) {
470
+ const where = entry.subject ? `${entry.subject} (${entry.path})` : entry.path;
471
+ if (entry.kind === "added") lines.push(` + ${where} ${formatValue(entry.after)}`);
472
+ else if (entry.kind === "removed") lines.push(` - ${where} ${formatValue(entry.before)}`);
473
+ else {
474
+ lines.push(` ~ ${where}`);
475
+ lines.push(` before: ${formatValue(entry.before)}`);
476
+ lines.push(` after: ${formatValue(entry.after)}`);
477
+ }
478
+ }
479
+ return lines.join("\n");
480
+ }
481
+
482
+ // src/report.ts
483
+ import { basename, relative as relative2 } from "path";
484
+ function scenarioReport(result, options = {}) {
485
+ const view = buildView(result, {
486
+ ...options.attribution ? { explain: true } : {},
487
+ ...options.schemas ? { schemas: true } : {}
488
+ });
489
+ const capabilities = flatRows(view);
490
+ return {
491
+ scenario: result.scenario,
492
+ ...result.scope ? { scope: result.scope } : {},
493
+ snapshot: normalize(result.snapshot),
494
+ // Includes expose, disable and hide. Rows never contain runtime ids.
495
+ capabilities,
496
+ rejections: [...result.rejections].sort(
497
+ (a, b) => a.componentType.localeCompare(b.componentType) || a.instanceId.localeCompare(b.instanceId) || a.reason.localeCompare(b.reason)
498
+ ),
499
+ ...options.attribution ? { explanation: { capabilities } } : {}
500
+ };
501
+ }
502
+ function scenarioBaseline(result) {
503
+ const report = scenarioReport(result);
504
+ return {
505
+ ...report.snapshot,
506
+ capabilities: report.capabilities,
507
+ rejections: report.rejections
508
+ };
509
+ }
510
+ function inventoryReport(inventory, domainCapabilities) {
511
+ if (!inventory) return null;
512
+ return {
513
+ ...inventory,
514
+ root: ".",
515
+ tsconfig: relative2(inventory.root, inventory.tsconfig) || "tsconfig.json",
516
+ ...domainCapabilities ? { domain: { source: "manifest", capabilities: [...domainCapabilities].sort() } } : {}
517
+ };
518
+ }
519
+ function coverageReport(report) {
520
+ if (!report) return null;
521
+ return {
522
+ ...report,
523
+ allowlistPath: basename(report.allowlistPath),
524
+ unreadAllowlistPath: basename(report.unreadAllowlistPath)
525
+ };
526
+ }
527
+
528
+ export {
529
+ renderSurfacePlain,
530
+ renderCatalogPlain,
531
+ renderCoveragePlain,
532
+ renderCheckOverviewPlain,
533
+ renderNoVerdictPlain,
534
+ renderFailuresPlain,
535
+ renderDriftPlain,
536
+ scenarioReport,
537
+ scenarioBaseline,
538
+ inventoryReport,
539
+ coverageReport
540
+ };
541
+ //# sourceMappingURL=chunk-J2NN3J5N.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/render/plain.ts","../src/report.ts"],"sourcesContent":["import { relative } from \"node:path\";\nimport type { CapabilityRow, SurfaceView } from \"./model.js\";\nimport { flatRows } from \"./model.js\";\nimport type { DiffEntry } from \"../baseline.js\";\nimport { formatValue } from \"../baseline.js\";\nimport type { ScenarioFailure } from \"../analysis.js\";\nimport {\n authoredIds,\n unresolved,\n type AuthoredCapability,\n type CapabilityInventory,\n} from \"../extract.js\";\nimport { unreadKey, type CoverageReport } from \"../coverage.js\";\n\n/**\n * The no-colour, no-cursor rendering used when stdout is piped or when\n * `--plain`, `CI` or `NO_COLOR` is set. Same view model as the Ink UI, so the\n * two cannot disagree about what the surface contains.\n */\n\nconst MARK = { expose: \"+\", disable: \"~\", hide: \"-\" } as const;\nconst STATE = { expose: \"callable\", disable: \"disabled\", hide: \"hidden\" } as const;\nconst NONE = \"—\";\nconst REPORT_WIDTH = 100;\n\n/** Deterministic wrapping: readable in logs, independent of terminal width. */\nfunction wrapText(text: string, width: number): string[] {\n const words = text.split(/\\s+/).filter(Boolean);\n const lines: string[] = [];\n let line = \"\";\n for (const word of words) {\n if (line && line.length + 1 + word.length > width) {\n lines.push(line);\n line = word;\n } else {\n line = line ? `${line} ${word}` : word;\n }\n }\n if (line) lines.push(line);\n return lines.length > 0 ? lines : [\"\"];\n}\n\n/**\n * Column widths come from the *content*, never from `process.stdout.columns`.\n *\n * `AS-CLI-003` requires plain output to be byte-stable across runs, and a table\n * laid out against the terminal it happened to run in is stable only until two\n * people diff the same CI log from different windows. Same rows in, same bytes\n * out, everywhere.\n *\n * The last column is not padded, so no line ever carries trailing whitespace —\n * which some diff tools render and others strip, i.e. another way for identical\n * output to look different.\n */\nfunction renderTable(headers: string[], rows: Array<{ cells: string[]; note?: string }>): string[] {\n const widths = headers.map((header, column) =>\n Math.max(header.length, ...rows.map((row) => (row.cells[column] ?? \"\").length)),\n );\n const line = (cells: string[]): string =>\n cells\n .map((cell, column) => (column === headers.length - 1 ? cell : cell.padEnd(widths[column]!)))\n .join(\" \")\n .trimEnd();\n\n const lines = [line(headers)];\n for (const row of rows) {\n lines.push(line(row.cells));\n // The unavailability reason is prose of unbounded length. A column for it\n // would set the table's width by its longest sentence; a continuation line\n // keeps the grid aligned and puts the reason directly under its capability.\n if (row.note) {\n for (const [index, note] of wrapText(row.note, REPORT_WIDTH - 6).entries()) {\n lines.push(` ${index === 0 ? \"⤷ \" : \" \"}${note}`);\n }\n }\n }\n return lines;\n}\n\n/** `UNREACHED — authored, and no scenario mounts it (1)` */\nfunction section(title: string, gloss: string, count: number): string {\n return `${title} — ${gloss} (${count})`;\n}\n\nfunction renderDetailRow(row: CapabilityRow, lines: string[]): void {\n const tags = row.tags.length > 0 ? ` [${row.tags.join(\", \")}]` : \"\";\n lines.push(` ${MARK[row.outcome]} ${row.name}${tags}`);\n lines.push(` ${row.description}`);\n if (row.reason) lines.push(` reason: ${row.reason}`);\n\n if (row.policies) {\n if (row.policies.length === 0) {\n lines.push(\" policies: none\");\n } else {\n for (const policy of row.policies) {\n const vote = policy.discovery\n ? policy.discovery.decision === \"disable\"\n ? `disable — ${policy.discovery.reason}`\n : policy.discovery.decision\n : \"no discovery hook\";\n const phases = policy.phases.length > 0 ? policy.phases.join(\"/\") : NONE;\n const flags = [\n policy.threw ? \"THREW\" : \"\",\n policy.confirmationEscalation ? \"escalates-confirmation\" : \"\",\n ]\n .filter(Boolean)\n .join(\", \");\n lines.push(\n ` policy ${policy.name} (${policy.scope}, ${phases}): ${vote}${\n flags ? ` [${flags}]` : \"\"\n }`,\n );\n }\n }\n if (row.availability && !row.availability.available) {\n lines.push(\n ` availability: unavailable${\n row.availability.reason ? ` — ${row.availability.reason}` : \"\"\n }`,\n );\n }\n }\n\n if (row.schemas) {\n if (row.schemas.input !== undefined) {\n lines.push(` input: ${JSON.stringify(row.schemas.input)}`);\n }\n if (row.schemas.output !== undefined) {\n lines.push(` output: ${JSON.stringify(row.schemas.output)}`);\n }\n }\n}\n\n/**\n * The counts line, and everything it is relative to (`AS-CLI-007`).\n *\n * `hidden` is printed unconditionally. It is computed on every run — the\n * explanation is always collected — and suppressing it outside `--explain`\n * meant a surface with a policy-hidden half rendered as a complete one. The\n * *attribution* still needs `--explain`; the count and the rows do not.\n */\nexport function renderCountsPlain(view: SurfaceView): string {\n return (\n `${view.counts.callable} callable, ${view.counts.disabled} visible-disabled, ` +\n `${view.counts.hidden} hidden` +\n (view.rejections.length > 0\n ? `, ${view.rejections.length} registration${view.rejections.length === 1 ? \"\" : \"s\"} rejected`\n : \"\")\n );\n}\n\nfunction renderHeader(view: SurfaceView, lines: string[]): void {\n lines.push(\n `scenario ${view.scenario}${view.route ? ` route ${view.route}` : \"\"}${\n view.scope && view.scope.length > 0 ? ` scope ${view.scope.join(\" \")}` : \"\"\n }`,\n );\n lines.push(renderCountsPlain(view));\n}\n\nfunction renderRejections(view: SurfaceView, lines: string[]): void {\n if (view.rejections.length === 0) return;\n lines.push(\"\");\n lines.push(\n section(\"REJECTED\", \"the registry refused these during the mount\", view.rejections.length),\n );\n for (const rejection of view.rejections) {\n const why =\n rejection.reason === \"duplicate\"\n ? \"duplicate — an earlier registration holds this key\"\n : \"guard — onRegister rejected this registration\";\n lines.push(` ! ${rejection.componentType} (${rejection.instanceId}) ${why}`);\n }\n}\n\nfunction renderEmpty(view: SurfaceView, lines: string[]): void {\n lines.push(\"\");\n // \"Nothing is registered\" is only true when nothing was hidden. Saying it\n // over a surface a policy emptied sends the reader to the wrong file.\n if (view.counts.hidden > 0) {\n lines.push(\n `Nothing is callable here — all ${view.counts.hidden} registered capabilities were hidden by policy.`,\n );\n if (!view.explained) lines.push(\"Re-run with --explain to see which policy hid them.\");\n } else {\n lines.push(\"Nothing is registered for this scenario — the agent has no surface here.\");\n if (!view.explained) lines.push(\"Re-run with --explain to see whether a policy hid it.\");\n }\n}\n\nexport interface SurfaceRenderOptions {\n /** The grouped, one-capability-per-paragraph view. Implied by --explain/--schemas. */\n detail?: boolean;\n}\n\n/**\n * One capability per line, aligned. The default, because the question `inspect`\n * is usually asked is *what is on this surface* — which is a scanning question,\n * and prose does not scan.\n *\n * Policy chains and JSON Schemas are multi-line by nature and cannot live in a\n * cell, so `--explain` and `--schemas` fall back to the detail view rather than\n * producing a table with most of the answer missing.\n */\nexport function renderSurfacePlain(\n view: SurfaceView,\n options: SurfaceRenderOptions = {},\n): string {\n const lines: string[] = [];\n renderHeader(view, lines);\n renderRejections(view, lines);\n\n const rows = flatRows(view);\n if (rows.length === 0) {\n renderEmpty(view, lines);\n return lines.join(\"\\n\");\n }\n\n if (options.detail) {\n for (const group of view.groups.filter((group) => group.rows.length > 0)) {\n lines.push(\"\");\n lines.push(`${group.heading} (${group.rows.length})`);\n for (const row of group.rows) renderDetailRow(row, lines);\n }\n return lines.join(\"\\n\");\n }\n\n lines.push(\"\");\n lines.push(\n ...renderTable(\n [\"CAPABILITY\", \"KIND\", \"EFFECT\", \"STATE\", \"FLAGS\"],\n rows.map((row) => ({\n cells: [\n row.path,\n row.kind,\n row.effect ?? NONE,\n STATE[row.outcome],\n row.flags.length > 0 ? row.flags.join(\" · \") : NONE,\n ],\n ...(row.reason ? { note: row.reason } : {}),\n })),\n ),\n );\n return lines.join(\"\\n\");\n}\n\n/**\n * The static catalog (`AS-COVER-001…003`). The summary says \"upper bound\" in so\n * many words: a tsconfig's include globs are wider than what a bundle reaches,\n * so a capability in a component no route renders any more is in here. That is\n * dead code — a different finding, not a false positive — and the reader has to\n * be told which number they are holding.\n */\nexport interface CatalogRenderOptions {\n /**\n * This catalog *is* the command's output, rather than its preamble.\n *\n * True at `--depth static`: there are no scenario tables and no verdict, so\n * the listing and the unread call sites have nowhere else to appear.\n *\n * False at `--depth full`, where the scenario tables below name every\n * capability a scenario reached, the `UNREACHED` section names the ones it did\n * not, and the verdict carries the unread call sites — so printing any of it\n * here is the same information a second time, above the answer instead of in\n * it. Only the summary line survives.\n */\n standalone?: boolean;\n /** Authoritative domain manifest entries, when runtime config was loaded. */\n domainCapabilities?: number;\n /** Show origins, notes and per-site allowlist keys. */\n detail?: boolean;\n}\n\nfunction componentOf(capabilityId: string): string {\n const path = capabilityId.replace(/^(view|domain):/, \"\");\n const dot = path.lastIndexOf(\".\");\n return dot === -1 ? path : path.slice(0, dot);\n}\n\nexport function renderCatalogPlain(\n inventory: CapabilityInventory,\n options: CatalogRenderOptions = {},\n): string {\n const lines: string[] = [];\n const resolved = inventory.capabilities.filter((c) => c.resolution !== \"unresolved\");\n const unreadEntries = unresolved(inventory);\n const dynamicMetadata = resolved.filter((c) => c.resolution === \"partial\").length;\n const ids = authoredIds(inventory);\n const authored = ids.size + (options.domainCapabilities ?? 0);\n\n lines.push(\"STATIC CATALOG\");\n lines.push(\n `STATUS ${unreadEntries.length > 0 ? \"INCOMPLETE\" : \"COMPLETE\"}${\n unreadEntries.length > 0\n ? ` — ${unreadEntries.length} unread capability identit${unreadEntries.length === 1 ? \"y\" : \"ies\"}`\n : \" — every capability identity resolved\"\n }`,\n );\n lines.push(\n `Capabilities ${authored} authored (upper bound) · ${resolved.length} resolved call site${\n resolved.length === 1 ? \"\" : \"s\"\n }`,\n );\n lines.push(\n `Program ${inventory.filesAnalyzed} file${inventory.filesAnalyzed === 1 ? \"\" : \"s\"} analyzed` +\n (inventory.filesOutsideRoot > 0\n ? ` · ${inventory.filesOutsideRoot} agent-surface implementation file${\n inventory.filesOutsideRoot === 1 ? \"\" : \"s\"\n } excluded`\n : \"\"),\n );\n lines.push(\n `Metadata ${dynamicMetadata} call site${dynamicMetadata === 1 ? \"\" : \"s\"} partially read` +\n (dynamicMetadata > 0 ? \" · identity remains resolved\" : \"\"),\n );\n lines.push(\n options.domainCapabilities === undefined\n ? \"Domain not analyzed at static depth; full depth reads the oRPC manifest\"\n : `Domain ${options.domainCapabilities} manifest capabilit${\n options.domainCapabilities === 1 ? \"y\" : \"ies\"\n }`,\n );\n\n if (!options.standalone) return lines.join(\"\\n\");\n\n const components = new Map<\n string,\n { ids: Set<string>; sites: number; partial: number }\n >();\n for (const capability of resolved) {\n const component = componentOf(capability.capabilityId);\n const current = components.get(component) ?? { ids: new Set<string>(), sites: 0, partial: 0 };\n current.ids.add(capability.capabilityId);\n current.sites += 1;\n if (capability.resolution === \"partial\") current.partial += 1;\n components.set(component, current);\n }\n\n if (components.size > 0) {\n lines.push(\"\");\n lines.push(`COMPONENTS (${components.size})`);\n lines.push(\n ...renderTable(\n [\"COMPONENT\", \"CAPABILITIES\", \"CALL SITES\", \"DYNAMIC META\"],\n [...components.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([component, data]) => ({\n cells: [\n `view:${component}`,\n String(data.ids.size),\n String(data.sites),\n data.partial > 0 ? String(data.partial) : NONE,\n ],\n note: [...data.ids].sort().join(\" · \"),\n })),\n ),\n );\n }\n\n if (unreadEntries.length > 0) {\n const groups = new Map<string, number>();\n for (const entry of unreadEntries) {\n const key = `${entry.origin.file}\\0${entry.reason ?? \"unknown\"}`;\n groups.set(key, (groups.get(key) ?? 0) + 1);\n }\n lines.push(\"\");\n lines.push(`UNREAD SITES (${unreadEntries.length})`);\n lines.push(\"Counts above are a floor until these sites are resolved or explicitly accepted.\");\n lines.push(\n ...renderTable(\n [\"FILE\", \"REASON\", \"SITES\"],\n [...groups.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([key, count]) => {\n const [file, reason] = key.split(\"\\0\");\n return { cells: [file ?? \"?\", reason ?? \"unknown\", String(count)] };\n }),\n ),\n );\n lines.push(\"\", \"ALLOWLIST KEYS\");\n for (const entry of unreadEntries) lines.push(` allowlist key: ${unreadKey(entry)}`);\n }\n\n if (options.detail) {\n const byId = [...resolved].sort((a, b) => a.capabilityId.localeCompare(b.capabilityId));\n if (byId.length > 0) {\n lines.push(\"\");\n lines.push(`CAPABILITY DETAILS (${byId.length} call sites)`);\n lines.push(\n ...renderTable(\n [\"CAPABILITY\", \"KIND\", \"ORIGIN\", \"READ\"],\n byId.map((capability) => ({\n cells: [\n capability.capabilityId,\n capability.kind,\n `${capability.origin.file}:${capability.origin.line}`,\n capability.resolution,\n ],\n ...(capability.note ? { note: capability.note } : {}),\n })),\n ),\n );\n }\n const unread = renderUnread(unreadEntries);\n if (unread.length > 0) lines.push(\"\", ...unread);\n } else if (unreadEntries.length > 0 || resolved.length > 0) {\n lines.push(\"\");\n lines.push(\n \"Details: re-run with --detail for origins, metadata diagnostics, and allowlist keys.\",\n );\n }\n return lines.join(\"\\n\");\n}\n\n/**\n * Call sites the extractor could not read. Reported with file and line, never\n * dropped: an inventory that silently omitted what it failed to parse would\n * understate the denominator, and every number built on it would claim a\n * completeness it never had.\n */\nfunction renderUnread(entries: AuthoredCapability[]): string[] {\n if (entries.length === 0) return [];\n const lines: string[] = [];\n lines.push(\n section(\n \"UNREAD CALL SITES\",\n \"the catalog is incomplete, so every count above is a floor\",\n entries.length,\n ),\n );\n for (const capability of entries) {\n lines.push(` ? ${capability.origin.file}:${capability.origin.line}`);\n lines.push(` ${capability.note ?? \"the extractor could not read this call site\"}`);\n // The allowlist key, spelled out. It is `file#reason#site`, and the site is\n // a hash — not the line the reader is looking at — so leaving them to infer\n // it guarantees a wrong guess and an entry that never matches.\n lines.push(` allowlist key: ${unreadKey(capability)}`);\n }\n return lines;\n}\n\n/**\n * The verdict: authored minus reached (`AS-COVER-004…005`).\n *\n * This is the finding the command surface used to hide behind a fifth command,\n * so it is the last thing printed and the thing a reader stops on.\n */\nexport interface CoverageRenderOptions {\n /** Check already prints an executive summary; render findings only. */\n compact?: boolean;\n /** Include non-gating inventories such as undeclared runtime ids. */\n detail?: boolean;\n}\n\nexport function renderCoveragePlain(\n report: CoverageReport,\n options: CoverageRenderOptions = {},\n): string {\n const lines: string[] = [];\n\n if (report.unreached.length > 0) {\n lines.push(\n section(\"UNREACHED\", \"authored, and no scenario mounts it\", report.unreached.length),\n );\n lines.push(\n ...renderTable(\n [\"CAPABILITY\", \"ORIGIN\"],\n report.unreached.map((entry) => ({\n cells: [entry.capabilityId, `${entry.origin.file}:${entry.origin.line}`],\n })),\n ),\n );\n lines.push(\"\");\n }\n\n if (report.undeclared.length > 0) {\n if (!options.compact || options.detail) {\n lines.push(\n section(\n \"UNDECLARED\",\n \"present at runtime with no static origin — a dynamic registration, or a gap here\",\n report.undeclared.length,\n ),\n );\n for (const id of report.undeclared) lines.push(` ${id}`);\n } else {\n lines.push(\n `NOTICE — ${report.undeclared.length} runtime capabilit${\n report.undeclared.length === 1 ? \"y has\" : \"ies have\"\n } no static origin; re-run check with --detail to list them.`,\n );\n }\n lines.push(\"\");\n }\n\n if (report.unmanifestedDomain.length > 0) {\n lines.push(\n section(\n \"UNMANIFESTED DOMAIN\",\n \"mounted, but absent from the authoritative oRPC manifest\",\n report.unmanifestedDomain.length,\n ),\n );\n for (const id of report.unmanifestedDomain) lines.push(` ${id}`);\n lines.push(\"\");\n }\n\n if (report.staleAllowlist.length > 0) {\n lines.push(\n section(\n \"STALE ALLOWLIST\",\n \"a scenario reaches these now, so delete them before the list rots\",\n report.staleAllowlist.length,\n ),\n );\n for (const id of report.staleAllowlist) lines.push(` ${id}`);\n lines.push(\"\");\n }\n\n if (report.staleUnreadAllowlist.length > 0) {\n lines.push(\n section(\n \"STALE UNREAD ALLOWLIST\",\n \"the extractor reads these now, so delete them before the list rots\",\n report.staleUnreadAllowlist.length,\n ),\n );\n for (const key of report.staleUnreadAllowlist) lines.push(` ${key}`);\n lines.push(\"\");\n }\n\n if (report.unresolved.length > 0) {\n lines.push(...renderUnread(report.unresolved), \"\");\n }\n\n if (!options.compact) lines.push(...renderCoverageSummary(report));\n return lines.join(\"\\n\");\n}\n\nexport interface CheckOverview {\n status: \"PASS\" | \"FAIL\" | \"ERROR\";\n coverage?: CoverageReport;\n unresolvedAllowed: boolean;\n baselineCurrent: number;\n baselineTotal: number;\n scenarioManifestOk: boolean;\n rejected: number;\n mountFailures: number;\n scenarios: string[];\n}\n\nfunction overviewRow(label: string, status: \"PASS\" | \"WARN\" | \"FAIL\" | \"ERROR\", text: string): string {\n return `${label.padEnd(12)}${status.padEnd(7)}${text}`;\n}\n\nfunction wrappedList(items: string[]): string[] {\n const prefix = \" \";\n return wrapText(items.join(\", \"), REPORT_WIDTH - prefix.length).map((line) => `${prefix}${line}`);\n}\n\n/** First-screen answer for `check`: verdict and health dimensions before detail. */\nexport function renderCheckOverviewPlain(input: CheckOverview): string {\n const lines = [`SURFACE CHECK ${input.status}`, \"\"];\n const coverage = input.coverage;\n if (coverage) {\n const coverageStatus =\n coverage.unreached.length > 0 || coverage.staleAllowlist.length > 0\n ? \"FAIL\"\n : coverage.allowed.length > 0\n ? \"WARN\"\n : \"PASS\";\n lines.push(\n overviewRow(\n \"Coverage\",\n coverageStatus,\n `${coverage.reached}/${coverage.authored} authored capabilities reached` +\n (coverage.unreached.length > 0 ? ` · ${coverage.unreached.length} unreached` : \"\") +\n (coverage.allowed.length > 0\n ? ` · ${coverage.allowed.length} unreached allowlisted`\n : \"\") +\n (coverage.staleAllowlist.length > 0\n ? ` · ${coverage.staleAllowlist.length} stale allowlist entr${\n coverage.staleAllowlist.length === 1 ? \"y\" : \"ies\"\n }`\n : \"\"),\n ),\n );\n const unread = coverage.unresolved.length;\n const accepted = coverage.allowedUnread.length;\n const catalogStatus =\n coverage.staleUnreadAllowlist.length > 0 || (unread > 0 && !input.unresolvedAllowed)\n ? \"FAIL\"\n : unread > 0 || accepted > 0\n ? \"WARN\"\n : \"PASS\";\n lines.push(\n overviewRow(\n \"Catalog\",\n catalogStatus,\n coverage.staleUnreadAllowlist.length > 0\n ? `${coverage.staleUnreadAllowlist.length} stale unread allowlist entr${\n coverage.staleUnreadAllowlist.length === 1 ? \"y\" : \"ies\"\n }`\n : unread > 0\n ? `${unread} unread static site${unread === 1 ? \"\" : \"s\"}${\n input.unresolvedAllowed ? \" accepted by --allow-unresolved\" : \"\"\n }`\n : accepted > 0\n ? `${accepted} unread static site${accepted === 1 ? \"\" : \"s\"} allowlisted`\n : \"all static sites resolved\",\n ),\n );\n lines.push(\n overviewRow(\n \"Domain\",\n coverage.unmanifestedDomain.length > 0 ? \"FAIL\" : coverage.domainAuthoritative ? \"PASS\" : \"WARN\",\n coverage.unmanifestedDomain.length > 0\n ? `${coverage.unmanifestedDomain.length} mounted capabilit${\n coverage.unmanifestedDomain.length === 1 ? \"y\" : \"ies\"\n } absent from manifest`\n : coverage.domainAuthoritative\n ? `${coverage.domainReached.length} manifest capabilit${\n coverage.domainReached.length === 1 ? \"y\" : \"ies\"\n } reached`\n : \"authoritative manifest not configured\",\n ),\n );\n } else {\n lines.push(\n overviewRow(\n \"Coverage\",\n input.status === \"ERROR\" ? \"ERROR\" : \"WARN\",\n input.status === \"ERROR\"\n ? \"no verdict; runtime analysis incomplete\"\n : \"not evaluated — statement about these scenarios only; re-run with --depth full\",\n ),\n );\n }\n\n const baselineOk = input.baselineCurrent === input.baselineTotal && input.scenarioManifestOk;\n lines.push(\n overviewRow(\n \"Baselines\",\n baselineOk ? \"PASS\" : \"FAIL\",\n `${input.baselineCurrent}/${input.baselineTotal} scenario baselines current` +\n (input.scenarioManifestOk ? \"\" : \" · scenario manifest differs\"),\n ),\n );\n lines.push(\n overviewRow(\n \"Runtime\",\n input.mountFailures > 0 ? \"ERROR\" : input.rejected > 0 ? \"FAIL\" : \"PASS\",\n input.mountFailures > 0\n ? `${input.mountFailures} scenario${input.mountFailures === 1 ? \"\" : \"s\"} did not mount`\n : input.rejected > 0\n ? `${input.rejected} registration${input.rejected === 1 ? \"\" : \"s\"} rejected`\n : `${input.scenarios.length} scenario${input.scenarios.length === 1 ? \"\" : \"s\"} mounted`,\n ),\n );\n lines.push(\"\", `SCENARIOS (${input.scenarios.length})`, ...wrappedList(input.scenarios));\n return lines.join(\"\\n\");\n}\n\n/** The one line a reader who stops at the bottom takes away. */\nfunction renderCoverageSummary(report: CoverageReport): string[] {\n const qualifiers = [\n `${report.scenarios.length} scenario${report.scenarios.length === 1 ? \"\" : \"s\"} (${report.scenarios.join(\n \", \",\n )})`,\n ];\n // Every count is relative to the scope, so the scope is printed with them\n // (`AS-CLI-007`) — `10 authored` under a scope is a claim about one prefix of\n // the codebase, not about the codebase.\n if (report.scope && report.scope.length > 0) qualifiers.push(`scope ${report.scope.join(\" \")}`);\n\n const lines = [\n `${report.authored} authored · ${report.reached} reached · ${report.unreached.length} unreached` +\n ` · ${qualifiers.join(\" · \")}`,\n ];\n\n if (report.domainReached.length > 0) {\n lines.push(\n `${report.domainReached.length} domain capabilit${\n report.domainReached.length === 1 ? \"y\" : \"ies\"\n } reached${\n report.domainAuthoritative\n ? \" against the authoritative oRPC manifest\"\n : \" and held apart — configure the authoritative oRPC manifest to cover that plane\"\n }`,\n );\n }\n if (report.allowed.length > 0) {\n lines.push(\n `${report.allowed.length} unreached capabilit${\n report.allowed.length === 1 ? \"y is\" : \"ies are\"\n } allowlisted in ${relative(process.cwd(), report.allowlistPath)}`,\n );\n }\n if (report.allowedUnread.length > 0) {\n lines.push(\n `${report.allowedUnread.length} unread call site${\n report.allowedUnread.length === 1 ? \" is\" : \"s are\"\n } allowlisted in ${relative(process.cwd(), report.unreadAllowlistPath)}`,\n );\n }\n if (report.allowlistOutOfScope > 0) {\n lines.push(\n `${report.allowlistOutOfScope} allowlist entr${\n report.allowlistOutOfScope === 1 ? \"y\" : \"ies\"\n } outside this scope were not judged either way`,\n );\n }\n\n // Each bucket gets its own remedy. \"Add a scenario, or delete the component\"\n // is the right advice for an unreached capability and useless advice for a\n // call site the extractor could not read.\n if (\n report.unreached.length === 0 &&\n report.unresolved.length === 0 &&\n report.staleAllowlist.length === 0 &&\n report.staleUnreadAllowlist.length === 0 &&\n report.unmanifestedDomain.length === 0\n ) {\n lines.push(\n report.allowed.length > 0\n ? \"no new surface coverage gaps — the allowlist still holds the known ones\"\n : \"every authored capability is reached by a scenario\",\n );\n }\n return lines;\n}\n\n/**\n * Why there is no coverage verdict. Never silence: a reader who asked for the\n * complete answer and got a partial one has to be told which part is missing,\n * or the partial one reads as the complete one.\n */\nexport function renderNoVerdictPlain(failures: ScenarioFailure[]): string {\n return [\n section(\"NO COVERAGE VERDICT\", \"a scenario did not mount, so nothing reached anything\", failures.length),\n ...failures.flatMap((failure) => [` ${failure.scenario}`, ` ${failure.message}`]),\n \"\",\n \"Every capability those scenarios would have surfaced would be reported unreached,\",\n \"so no verdict is printed at all. Fix the mount, or name a scenario that works.\",\n ].join(\"\\n\");\n}\n\nexport function renderFailuresPlain(failures: ScenarioFailure[]): string {\n return [\n section(\"DID NOT MOUNT\", \"these scenarios threw, and were skipped\", failures.length),\n ...failures.flatMap((failure) => [` ${failure.scenario}`, ` ${failure.message}`]),\n ].join(\"\\n\");\n}\n\nexport function renderDriftPlain(scenario: string, entries: DiffEntry[]): string {\n const lines = [` ${scenario}: ${entries.length} change${entries.length === 1 ? \"\" : \"s\"}`];\n for (const entry of entries) {\n const where = entry.subject ? `${entry.subject} (${entry.path})` : entry.path;\n if (entry.kind === \"added\") lines.push(` + ${where} ${formatValue(entry.after)}`);\n else if (entry.kind === \"removed\") lines.push(` - ${where} ${formatValue(entry.before)}`);\n else {\n lines.push(` ~ ${where}`);\n lines.push(` before: ${formatValue(entry.before)}`);\n lines.push(` after: ${formatValue(entry.after)}`);\n }\n }\n return lines.join(\"\\n\");\n}\n","import { basename, relative } from \"node:path\";\nimport type { CollectResult } from \"./collect.js\";\nimport type { CoverageReport } from \"./coverage.js\";\nimport type { CapabilityInventory } from \"./extract.js\";\nimport { normalize } from \"./baseline.js\";\nimport { buildView, flatRows, type CapabilityRow } from \"./render/model.js\";\n\n/** Stable, complete per-scenario document shared by JSON, baselines and check. */\nexport interface ScenarioReport {\n scenario: string;\n scope?: string[];\n snapshot: unknown;\n capabilities: CapabilityRow[];\n rejections: CollectResult[\"rejections\"];\n explanation?: { capabilities: CapabilityRow[] };\n}\n\nexport function scenarioReport(\n result: CollectResult,\n options: { attribution?: boolean; schemas?: boolean } = {},\n): ScenarioReport {\n const view = buildView(result, {\n ...(options.attribution ? { explain: true } : {}),\n ...(options.schemas ? { schemas: true } : {}),\n });\n const capabilities = flatRows(view);\n return {\n scenario: result.scenario,\n ...(result.scope ? { scope: result.scope } : {}),\n snapshot: normalize(result.snapshot),\n // Includes expose, disable and hide. Rows never contain runtime ids.\n capabilities,\n rejections: [...result.rejections].sort(\n (a, b) =>\n a.componentType.localeCompare(b.componentType) ||\n a.instanceId.localeCompare(b.instanceId) ||\n a.reason.localeCompare(b.reason),\n ),\n ...(options.attribution ? { explanation: { capabilities } } : {}),\n };\n}\n\n/** Baseline payload: same semantic document, without invocation-only labels. */\nexport function scenarioBaseline(result: CollectResult): Record<string, unknown> {\n const report = scenarioReport(result);\n return {\n ...(report.snapshot as Record<string, unknown>),\n capabilities: report.capabilities,\n rejections: report.rejections,\n };\n}\n\n/** Machine output must not contain checkout-specific absolute paths. */\nexport function inventoryReport(\n inventory: CapabilityInventory | undefined,\n domainCapabilities?: string[],\n): unknown {\n if (!inventory) return null;\n return {\n ...inventory,\n root: \".\",\n tsconfig: relative(inventory.root, inventory.tsconfig) || \"tsconfig.json\",\n ...(domainCapabilities\n ? { domain: { source: \"manifest\", capabilities: [...domainCapabilities].sort() } }\n : {}),\n };\n}\n\nexport function coverageReport(report: CoverageReport | undefined): unknown {\n if (!report) return null;\n return {\n ...report,\n allowlistPath: basename(report.allowlistPath),\n unreadAllowlistPath: basename(report.unreadAllowlistPath),\n };\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,gBAAgB;AAoBzB,IAAM,OAAO,EAAE,QAAQ,KAAK,SAAS,KAAK,MAAM,IAAI;AACpD,IAAM,QAAQ,EAAE,QAAQ,YAAY,SAAS,YAAY,MAAM,SAAS;AACxE,IAAM,OAAO;AACb,IAAM,eAAe;AAGrB,SAAS,SAAS,MAAc,OAAyB;AACvD,QAAM,QAAQ,KAAK,MAAM,KAAK,EAAE,OAAO,OAAO;AAC9C,QAAM,QAAkB,CAAC;AACzB,MAAI,OAAO;AACX,aAAW,QAAQ,OAAO;AACxB,QAAI,QAAQ,KAAK,SAAS,IAAI,KAAK,SAAS,OAAO;AACjD,YAAM,KAAK,IAAI;AACf,aAAO;AAAA,IACT,OAAO;AACL,aAAO,OAAO,GAAG,IAAI,IAAI,IAAI,KAAK;AAAA,IACpC;AAAA,E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