@agent-surface/cli 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/dist/bin.js +2 -2
- package/dist/{chunk-SBN4KLS2.js → chunk-7LYED3O4.js} +6 -6
- package/dist/chunk-7LYED3O4.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/{ink-7PDZ7AIC.js → ink-ZRLKCO3E.js} +2 -2
- package/package.json +3 -3
- package/dist/chunk-SBN4KLS2.js.map +0 -1
- /package/dist/{ink-7PDZ7AIC.js.map → ink-ZRLKCO3E.js.map} +0 -0
package/dist/bin.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
diffContracts,
|
|
10
10
|
renderReport,
|
|
11
11
|
supportsColor
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-7LYED3O4.js";
|
|
13
13
|
|
|
14
14
|
// src/bin.ts
|
|
15
15
|
import { realpathSync } from "fs";
|
|
@@ -75,7 +75,7 @@ async function present(report, options) {
|
|
|
75
75
|
const verbosity = options.verbosity ?? (options.detail ? "detail" : "normal");
|
|
76
76
|
const render = { root: options.root, verbosity };
|
|
77
77
|
if (interactive) {
|
|
78
|
-
const { renderInk } = await import("./ink-
|
|
78
|
+
const { renderInk } = await import("./ink-ZRLKCO3E.js");
|
|
79
79
|
await renderInk(report, render);
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
@@ -253,7 +253,7 @@ function headline(manifest) {
|
|
|
253
253
|
groupByDeclaration(capabilities).length,
|
|
254
254
|
"declaration"
|
|
255
255
|
)}${count > 0 ? ` \xB7 ${tally(capabilities.map((entry) => entry.kind))}` : ""}`,
|
|
256
|
-
`reach ${reach || NONE} \xB7 declared gates: ${gated} confirmation \xB7 ${policed} policy`
|
|
256
|
+
`reach ${reach || NONE} \xB7 declared gates: ${gated} confirmation \xB7 ${policed} policy-scoped ${policed === 1 ? "capability" : "capabilities"}`
|
|
257
257
|
];
|
|
258
258
|
}
|
|
259
259
|
function integrityWord(report) {
|
|
@@ -262,13 +262,13 @@ function integrityWord(report) {
|
|
|
262
262
|
}
|
|
263
263
|
var CONTRACT_CAVEAT_SHORT = [
|
|
264
264
|
"Declared contract, compiled from the production graph \u2014 what this code can expose,",
|
|
265
|
-
"not what a mount exposed at runtime
|
|
265
|
+
"not what a mount exposed at runtime. A listed policy's verdict needs a real invocation."
|
|
266
266
|
];
|
|
267
267
|
var CONTRACT_CAVEAT = [
|
|
268
268
|
"Declarations, compiled from the production graph \u2014 what this code can expose,",
|
|
269
|
-
"not what a mount exposed at runtime.
|
|
270
|
-
"
|
|
271
|
-
"
|
|
269
|
+
"not what a mount exposed at runtime. A policy listed for a capability is in its",
|
|
270
|
+
"declared chain; whether it admits, denies or hides depends on the actor, input",
|
|
271
|
+
"and context of a real invocation, which this command never performs."
|
|
272
272
|
];
|
|
273
273
|
function contractColumns(capabilities) {
|
|
274
274
|
const rows = capabilities.map((entry) => contractCells(contractRow(entry)));
|
|
@@ -456,4 +456,4 @@ export {
|
|
|
456
456
|
summaryFields,
|
|
457
457
|
renderReport
|
|
458
458
|
};
|
|
459
|
-
//# sourceMappingURL=chunk-
|
|
459
|
+
//# sourceMappingURL=chunk-7LYED3O4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/diff.ts","../src/report.ts"],"sourcesContent":["import type { CapabilityContractEntry, CapabilityContractManifest } from \"@agent-surface/core\";\n\nexport type ChangeClassification = \"widening\" | \"narrowing\" | \"neutral\";\nexport type ChangeKind = \"added\" | \"removed\" | \"changed\";\n\nexport interface ContractChange {\n declarationId: string;\n capabilityId: string;\n kind: ChangeKind;\n field: string;\n classification: ChangeClassification;\n before?: unknown;\n after?: unknown;\n}\n\nconst RISK: Record<string, number> = {\n read: 0,\n \"local-state\": 1,\n navigation: 2,\n \"server-query\": 3,\n \"server-mutation\": 4,\n \"external-side-effect\": 5,\n destructive: 6,\n};\n\nconst CONFIRMATION: Record<string, number> = { never: 0, optional: 1, required: 2 };\n\nfunction key(entry: CapabilityContractEntry): string {\n return `${entry.declarationId}\\0${entry.capabilityId}`;\n}\n\nfunction equal(a: unknown, b: unknown): boolean {\n return JSON.stringify(a) === JSON.stringify(b);\n}\n\nfunction stringSet(value: unknown): Set<string> {\n return new Set(Array.isArray(value) ? value.map((item) => JSON.stringify(item)) : []);\n}\n\nfunction setDirection(before: unknown, after: unknown): \"added\" | \"removed\" | \"mixed\" | \"same\" {\n const a = stringSet(before);\n const b = stringSet(after);\n const added = [...b].some((item) => !a.has(item));\n const removed = [...a].some((item) => !b.has(item));\n if (added && removed) return \"mixed\";\n if (added) return \"added\";\n if (removed) return \"removed\";\n return \"same\";\n}\n\nfunction classify(field: string, before: unknown, after: unknown): ChangeClassification {\n if (field === \"targets\") {\n const direction = setDirection(before, after);\n return direction === \"added\" ? \"widening\" : direction === \"removed\" ? \"narrowing\" : \"neutral\";\n }\n if (field === \"policies\") {\n const direction = setDirection(before, after);\n return direction === \"removed\" || direction === \"mixed\"\n ? \"widening\"\n : direction === \"added\"\n ? \"narrowing\"\n : \"neutral\";\n }\n if (field === \"confirmation\") {\n const a = CONFIRMATION[String(before ?? \"never\")] ?? 0;\n const b = CONFIRMATION[String(after ?? \"never\")] ?? 0;\n return b < a ? \"widening\" : b > a ? \"narrowing\" : \"neutral\";\n }\n if (field === \"effect\") {\n const a = RISK[String(before)] ?? 0;\n const b = RISK[String(after)] ?? 0;\n // Lowering declared risk weakens review/approval posture.\n return b < a ? \"widening\" : b > a ? \"narrowing\" : \"neutral\";\n }\n return \"neutral\";\n}\n\nexport function diffContracts(\n before: CapabilityContractManifest | undefined,\n after: CapabilityContractManifest,\n): ContractChange[] {\n if (!before) {\n return after.capabilities.map((entry) => ({\n declarationId: entry.declarationId,\n capabilityId: entry.capabilityId,\n kind: \"added\",\n field: \"capability\",\n classification: \"widening\",\n after: entry,\n }));\n }\n const left = new Map(before.capabilities.map((entry) => [key(entry), entry]));\n const right = new Map(after.capabilities.map((entry) => [key(entry), entry]));\n const changes: ContractChange[] = [];\n for (const entryKey of [...new Set([...left.keys(), ...right.keys()])].sort()) {\n const a = left.get(entryKey);\n const b = right.get(entryKey);\n if (!a && b) {\n changes.push({\n declarationId: b.declarationId,\n capabilityId: b.capabilityId,\n kind: \"added\",\n field: \"capability\",\n classification: \"widening\",\n after: b,\n });\n continue;\n }\n if (a && !b) {\n changes.push({\n declarationId: a.declarationId,\n capabilityId: a.capabilityId,\n kind: \"removed\",\n field: \"capability\",\n classification: \"narrowing\",\n before: a,\n });\n continue;\n }\n if (!a || !b) continue;\n const fields = new Set([...Object.keys(a), ...Object.keys(b)]);\n fields.delete(\"declarationId\");\n fields.delete(\"capabilityId\");\n fields.delete(\"contractHash\");\n for (const field of [...fields].sort()) {\n const beforeValue = (a as unknown as Record<string, unknown>)[field];\n const afterValue = (b as unknown as Record<string, unknown>)[field];\n if (equal(beforeValue, afterValue)) continue;\n changes.push({\n declarationId: b.declarationId,\n capabilityId: b.capabilityId,\n kind: \"changed\",\n field,\n classification: classify(field, beforeValue, afterValue),\n before: beforeValue,\n after: afterValue,\n });\n }\n }\n return changes;\n}\n\nexport function changeCounts(changes: readonly ContractChange[]): Record<ChangeClassification, number> {\n return {\n widening: changes.filter((change) => change.classification === \"widening\").length,\n narrowing: changes.filter((change) => change.classification === \"narrowing\").length,\n neutral: changes.filter((change) => change.classification === \"neutral\").length,\n };\n}\n","import { relative } from \"node:path\";\nimport type { CapabilityContractEntry, CapabilityContractManifest } from \"@agent-surface/core\";\nimport { canonicalJson } from \"@agent-surface/compiler\";\nimport type { ContractChange } from \"./diff.js\";\nimport { changeCounts } from \"./diff.js\";\n\nexport type OutputFormat = \"human\" | \"json\" | \"github\" | \"markdown\";\n\n/**\n * How much of the report the human renderers show. `normal` is the compact\n * inventory; `min` stops at the headline and counts; `detail` adds provenance,\n * descriptions and the grouped view. Machine formats ignore the knob: `--json`\n * always carries every field.\n */\nexport type Verbosity = \"min\" | \"normal\" | \"detail\";\n\n/**\n * Presentation-only inputs. They never reach the report model, because `--json`\n * is canonical machine output and a checkout path would make it differ between\n * two machines that compiled the same source.\n */\nexport interface RenderOptions {\n /** Application root, used to show the snapshot path as the user typed it. */\n root?: string;\n /** Deprecated alias for `verbosity: \"detail\"`, kept for the exported API. */\n detail?: boolean;\n /** Human renderings only; `min` and `detail` widen or narrow the same blocks. */\n verbosity?: Verbosity;\n /** Paint with ANSI. Off by default so piped output stays byte-stable. */\n color?: boolean;\n}\n\nexport function verbosityOf(options: RenderOptions): Verbosity {\n return options.verbosity ?? (options.detail ? \"detail\" : \"normal\");\n}\n\nexport interface ContractReport {\n command: \"inspect\" | \"check\" | \"snapshot\";\n status: \"pass\" | \"fail\" | \"written\" | \"view\";\n manifest: CapabilityContractManifest;\n snapshotPath: string;\n integrity?: {\n status: \"current\" | \"missing\" | \"stale\";\n changes: ContractChange[];\n };\n pullRequest?: {\n base: string;\n changes: ContractChange[];\n };\n}\n\n/**\n * The same eight ANSI styles the sibling `orpc-agent` CLI paints with, so the\n * two inventories read alike. Colour is applied after padding and only when\n * the caller asked for it: the tested contract stays the uncoloured bytes.\n */\nconst ANSI: Record<string, string> = {\n reset: \"\\u001b[0m\",\n bold: \"\\u001b[1m\",\n dim: \"\\u001b[2m\",\n red: \"\\u001b[31m\",\n green: \"\\u001b[32m\",\n yellow: \"\\u001b[33m\",\n blue: \"\\u001b[34m\",\n magenta: \"\\u001b[35m\",\n cyan: \"\\u001b[36m\",\n gray: \"\\u001b[90m\",\n};\n\nexport function supportsColor(stream: { isTTY?: boolean }): boolean {\n return (\n stream.isTTY === true &&\n !process.env[\"CI\"] &&\n !process.env[\"NO_COLOR\"] &&\n process.env[\"TERM\"] !== \"dumb\"\n );\n}\n\nfunction painter(options: RenderOptions): (text: string, style?: string) => string {\n if (!options.color) return (text) => text;\n return (text, style) => (style ? `${ANSI[style] ?? \"\"}${text}${ANSI.reset}` : text);\n}\n\nfunction value(value: unknown): string {\n if (value === undefined) return \"—\";\n const text = typeof value === \"string\" ? value : JSON.stringify(value);\n return text.length > 100 ? `${text.slice(0, 97)}…` : text;\n}\n\n/** The classification colour, shared by the plain and drawn change rows. */\nexport function changeStyle(change: ContractChange): string {\n if (change.classification === \"widening\") return \"yellow\";\n if (change.classification === \"narrowing\") return \"cyan\";\n return \"gray\";\n}\n\nfunction changeLine(change: ContractChange): string {\n const mark = change.kind === \"added\" ? \"+\" : change.kind === \"removed\" ? \"-\" : \"~\";\n return `${mark} ${change.classification.padEnd(9)} ${change.capabilityId} · ${change.declarationId} · ${change.field}${\n change.kind === \"changed\" ? `: ${value(change.before)} → ${value(change.after)}` : \"\"\n }`;\n}\n\nexport function sectionTitle(title: string, changes: readonly ContractChange[]): string {\n const counts = changeCounts(changes);\n return `${title} (${changes.length}) · widening ${counts.widening} · narrowing ${counts.narrowing} · neutral ${counts.neutral}`;\n}\n\nfunction section(\n title: string,\n changes: readonly ContractChange[],\n options: RenderOptions,\n rows: boolean,\n): string[] {\n const paint = painter(options);\n const lines = [paint(sectionTitle(title, changes), \"bold\")];\n if (!rows) return lines;\n if (changes.length === 0) return [...lines, paint(\"no changes\", \"dim\")];\n return [...lines, ...changes.map((change) => paint(changeLine(change), changeStyle(change)))];\n}\n\n/**\n * Effects in escalating order of reach, so a renderer can grade one without\n * restating the vocabulary. Anything unknown sorts last: a capability whose\n * effect this CLI does not recognize is the one worth looking at.\n */\nconst EFFECT_ORDER = [\n \"read\",\n \"local-state\",\n \"navigation\",\n \"server-query\",\n \"server-mutation\",\n \"external-side-effect\",\n \"destructive\",\n] as const;\n\nexport function effectRank(effect: string): number {\n const index = EFFECT_ORDER.indexOf(effect as (typeof EFFECT_ORDER)[number]);\n return index === -1 ? EFFECT_ORDER.length : index;\n}\n\nexport interface ContractGroup {\n declarationId: string;\n entries: CapabilityContractEntry[];\n}\n\n/** Capabilities grouped by the declaration that owns them, input order kept. */\nexport function groupByDeclaration(capabilities: readonly CapabilityContractEntry[]): ContractGroup[] {\n const groups = new Map<string, CapabilityContractEntry[]>();\n for (const entry of capabilities) {\n const existing = groups.get(entry.declarationId);\n if (existing) existing.push(entry);\n else groups.set(entry.declarationId, [entry]);\n }\n return [...groups].map(([declarationId, entries]) => ({ declarationId, entries }));\n}\n\nexport type Reach = \"low\" | \"medium\" | \"high\";\n\n/**\n * The effect ladder, graded. The effect is the fact; the grade is how it reads\n * to someone who has not memorised the ladder. It is printed as a word rather\n * than left to colour alone, because the streams that matter most — a pipe, a\n * CI log, `--plain` — have no colour to read.\n */\nexport function reachOf(effect: string): Reach {\n const rank = effectRank(effect);\n if (rank <= 1) return \"low\";\n if (rank <= 3) return \"medium\";\n return \"high\";\n}\n\n/**\n * Colour vocabulary shared with the drawn view, one hue per fact. The scale\n * matches the sibling `orpc-agent` CLI: reads cool, writes warm, destructive\n * red, external magenta — so a reader who knows one CLI can skim the other.\n */\nexport const REACH_COLOR: Record<Reach, string> = { low: \"green\", medium: \"yellow\", high: \"red\" };\n\nexport const EFFECT_COLOR: Record<string, string> = {\n read: \"cyan\",\n \"local-state\": \"gray\",\n navigation: \"blue\",\n \"server-query\": \"cyan\",\n \"server-mutation\": \"yellow\",\n \"external-side-effect\": \"magenta\",\n destructive: \"red\",\n};\n\nexport function confirmStyle(confirm: string): string | undefined {\n if (confirm === \"required\") return \"green\";\n if (confirm === \"optional\") return \"cyan\";\n return \"dim\";\n}\n\n/** Nothing declared. A column still has to read as a column. */\nconst NONE = \"—\";\n\nexport const CONTRACT_HEADERS = [\"CAPABILITY\", \"KIND\", \"EFFECT\", \"REACH\", \"CONFIRM\", \"POLICIES\"] as const;\n\nexport interface ContractRow {\n capabilityId: string;\n kind: string;\n effect: string;\n reach: Reach;\n confirm: string;\n policies: string;\n /** Description and tags, shown under detail verbosity. */\n note: string;\n}\n\nexport function contractRow(entry: CapabilityContractEntry): ContractRow {\n const policies = (entry.policies ?? []).map((policy) => `${policy.name}${policy.phase ? `@${policy.phase}` : \"\"}`);\n const tags = (entry.tags ?? []).map((tag) => `#${tag}`).join(\" \");\n return {\n capabilityId: entry.capabilityId,\n kind: entry.kind,\n effect: entry.effect,\n reach: reachOf(entry.effect),\n confirm: entry.confirmation ?? NONE,\n policies: policies.length > 0 ? policies.join(\", \") : NONE,\n note: [entry.description, tags].filter(Boolean).join(\" \"),\n };\n}\n\nexport function contractCells(row: ContractRow): string[] {\n return [row.capabilityId, row.kind, row.effect, row.reach, row.confirm, row.policies];\n}\n\nfunction tally(values: readonly string[]): string {\n const counts = new Map<string, number>();\n for (const value of values) counts.set(value, (counts.get(value) ?? 0) + 1);\n return [...counts]\n .sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))\n .map(([name, count]) => `${count} ${name}`)\n .join(\" · \");\n}\n\nfunction plural(count: number, noun: string, suffix = \"s\"): string {\n return `${count} ${noun}${count === 1 ? \"\" : suffix}`;\n}\n\nexport function contractHeading(manifest: CapabilityContractManifest): string {\n const count = manifest.capabilities.length;\n const groups = groupByDeclaration(manifest.capabilities).length;\n return `REPOSITORY CONTRACT · ${count} ${count === 1 ? \"capability\" : \"capabilities\"} · ${plural(groups, \"declaration\")}`;\n}\n\n/**\n * The answer, before the evidence for it. A reader who stops after this line\n * should still know how large the surface is and how much of it is gated.\n */\nexport function headline(manifest: CapabilityContractManifest): string[] {\n const capabilities = manifest.capabilities;\n const count = capabilities.length;\n const gated = capabilities.filter((entry) => entry.confirmation && entry.confirmation !== \"never\").length;\n const policed = capabilities.filter((entry) => (entry.policies ?? []).length > 0).length;\n // Along the ladder, not by frequency: \"34 low · 1 high · 1 medium\" reads as\n // a miscount rather than a distribution.\n const reach = ([\"low\", \"medium\", \"high\"] as const)\n .map((grade) => [grade, capabilities.filter((entry) => reachOf(entry.effect) === grade).length] as const)\n .filter(([, count]) => count > 0)\n .map(([grade, count]) => `${count} ${grade}`)\n .join(\" · \");\n return [\n `${count} ${count === 1 ? \"capability\" : \"capabilities\"} · ${plural(\n groupByDeclaration(capabilities).length,\n \"declaration\",\n )}${count > 0 ? ` · ${tally(capabilities.map((entry) => entry.kind))}` : \"\"}`,\n `reach ${reach || NONE} · declared gates: ${gated} confirmation · ${policed} policy-scoped ` +\n `${policed === 1 ? \"capability\" : \"capabilities\"}`,\n ];\n}\n\n/** The integrity word for the headline, so `min` still answers \"am I current\". */\nexport function integrityWord(report: ContractReport): string | undefined {\n if (!report.integrity) return undefined;\n return `snapshot ${report.integrity.status}`;\n}\n\n/**\n * What a compiled contract cannot tell you, in two lines the compact view can\n * afford. The columns are declarations the graph proves reachable — not a\n * transcript of a run.\n */\nexport const CONTRACT_CAVEAT_SHORT = [\n \"Declared contract, compiled from the production graph — what this code can expose,\",\n \"not what a mount exposed at runtime. A listed policy's verdict needs a real invocation.\",\n];\n\n/** The full statement, kept for detail verbosity where prose has room. */\nexport const CONTRACT_CAVEAT = [\n \"Declarations, compiled from the production graph — what this code can expose,\",\n \"not what a mount exposed at runtime. A policy listed for a capability is in its\",\n \"declared chain; whether it admits, denies or hides depends on the actor, input\",\n \"and context of a real invocation, which this command never performs.\",\n];\n\n/** Column widths shared by the plain and drawn renderers, so both align alike. */\nexport function contractColumns(capabilities: readonly CapabilityContractEntry[]): number[] {\n const rows = capabilities.map((entry) => contractCells(contractRow(entry)));\n return CONTRACT_HEADERS.map((header, index) =>\n Math.max(header.length, ...rows.map((cells) => cells[index]?.length ?? 0)),\n );\n}\n\n/** One table line, padded to the shared widths. The last cell is never padded. */\nexport function contractLine(cells: readonly string[], widths: readonly number[]): string {\n return cells\n .map((cell, index) => (index === cells.length - 1 ? cell : cell.padEnd(widths[index] ?? 0)))\n .join(\" \")\n .trimEnd();\n}\n\n/** A table row, each cell padded then painted so the grid survives the colour. */\nfunction paintedRow(row: ContractRow, widths: readonly number[], options: RenderOptions): string {\n const paint = painter(options);\n const cells = contractCells(row).map((cell, index) => (index === 5 ? cell : cell.padEnd(widths[index] ?? 0)));\n return [\n cells[0],\n paint(cells[1] ?? \"\", \"dim\"),\n paint(cells[2] ?? \"\", EFFECT_COLOR[row.effect]),\n paint(cells[3] ?? \"\", REACH_COLOR[row.reach]),\n paint(cells[4] ?? \"\", confirmStyle(row.confirm)),\n row.policies === NONE ? paint(cells[5] ?? \"\", \"dim\") : cells[5],\n ]\n .join(\" \")\n .trimEnd();\n}\n\n/** Show the snapshot where the user would type it, not as an absolute path. */\nexport function displayPath(path: string, root?: string): string {\n if (!root) return path;\n const relativePath = relative(root, path);\n return !relativePath || relativePath.startsWith(\"..\") ? path : relativePath;\n}\n\n/** How the inventory table is drawn, per command and verbosity. */\nexport type ContractView = \"none\" | \"flat\" | \"grouped\";\n\n/**\n * `inspect` exists to show the inventory: compact and flat by default, grouped\n * by declaration under detail. The other commands lead with a verdict and keep\n * the inventory out of the way — until detail is asked for, because the reason\n * to ask a gate for detail is to read what it gated.\n */\nexport function contractView(report: ContractReport, options: RenderOptions = {}): ContractView {\n const verbosity = verbosityOf(options);\n if (verbosity === \"detail\") return \"grouped\";\n if (report.command !== \"inspect\" || verbosity === \"min\") return \"none\";\n return \"flat\";\n}\n\n/** Kept for the exported API; true whenever any inventory is rendered. */\nexport function showsContract(report: ContractReport, options: RenderOptions = {}): boolean {\n return contractView(report, options) !== \"none\";\n}\n\n/** Provenance. True, needed, and not what the reader came for — so it sits below. */\nexport function summaryFields(report: ContractReport, options: RenderOptions = {}): [string, string][] {\n const { manifest } = report;\n const fields: [string, string][] = [\n [\"Contract\", manifest.hash],\n [\"Compiler\", manifest.compilerVersion],\n [\"Completeness\", manifest.completeness.status],\n [\"Targets\", manifest.targets.join(\", \") || NONE],\n [\"Snapshot\", displayPath(report.snapshotPath, options.root)],\n ];\n if (report.integrity) fields.push([\"Integrity\", report.integrity.status]);\n return fields;\n}\n\nfunction bannerLine(report: ContractReport, options: RenderOptions): string {\n const paint = painter(options);\n const ok = report.status !== \"fail\";\n return paint(\n `AGENT SURFACE ${report.command.toUpperCase()} · ${report.status.toUpperCase()}`,\n ok ? \"green\" : \"red\",\n );\n}\n\nfunction headlineLines(report: ContractReport, options: RenderOptions): string[] {\n const paint = painter(options);\n const [size, gates] = headline(report.manifest);\n const integrity = integrityWord(report);\n const stale = report.integrity && report.integrity.status !== \"current\";\n return [\n paint(size ?? \"\", \"bold\"),\n `${gates}${integrity ? ` · ${stale ? paint(integrity, \"yellow\") : integrity}` : \"\"}`,\n ];\n}\n\nfunction flatContract(manifest: CapabilityContractManifest, options: RenderOptions): string[] {\n const paint = painter(options);\n const widths = contractColumns(manifest.capabilities);\n return [\n paint(contractLine(CONTRACT_HEADERS, widths), \"dim\"),\n ...manifest.capabilities.map((entry) => paintedRow(contractRow(entry), widths, options)),\n ];\n}\n\nfunction groupedContract(manifest: CapabilityContractManifest, options: RenderOptions): string[] {\n const paint = painter(options);\n const widths = contractColumns(manifest.capabilities);\n const lines = [\n paint(contractHeading(manifest), \"bold\"),\n \"\",\n ` ${paint(contractLine(CONTRACT_HEADERS, widths), \"dim\")}`,\n ];\n for (const group of groupByDeclaration(manifest.capabilities)) {\n lines.push(\"\", `${paint(group.declarationId, \"blue\")} (${group.entries.length})`);\n for (const entry of group.entries) {\n const row = contractRow(entry);\n lines.push(` ${paintedRow(row, widths, options)}`);\n if (row.note) lines.push(paint(` ${row.note}`, \"dim\"));\n }\n }\n return lines;\n}\n\n/**\n * One human report for every command; verbosity widens or narrows blocks\n * rather than swapping layouts. `min` stops after the headline and change\n * counts; `detail` adds provenance fields, the grouped inventory with notes,\n * and the full caveat.\n */\nexport function humanReport(report: ContractReport, options: RenderOptions = {}): string {\n const paint = painter(options);\n const verbosity = verbosityOf(options);\n const view = contractView(report, options);\n const lines: string[] = [];\n\n // `inspect` leads with the inventory itself; a verdict banner would restate\n // the exit code. The writing and gating commands lead with theirs.\n if (report.command !== \"inspect\" || verbosity === \"detail\") {\n lines.push(bannerLine(report, options), \"\");\n }\n lines.push(...headlineLines(report, options));\n\n if (report.command === \"snapshot\") {\n lines.push(\"\", `wrote ${displayPath(report.snapshotPath, options.root)}`);\n }\n\n if (verbosity === \"detail\") {\n const fields = summaryFields(report, options);\n const label = Math.max(...fields.map(([name]) => name.length));\n lines.push(\"\", ...fields.map(([name, value]) => `${paint(name.padEnd(label), \"dim\")} ${value}`));\n }\n\n // `min` keeps section titles — the counts are the point — and drops rows.\n // Under `normal`, inspect shows integrity rows only when there is drift;\n // an explicit --base always gets its answer, even when that answer is none.\n const rows = verbosity !== \"min\";\n if (report.integrity && (report.command === \"check\" || verbosity === \"detail\" || report.integrity.changes.length > 0)) {\n lines.push(\"\", ...section(\"SOURCE ↔ SNAPSHOT\", report.integrity.changes, options, rows));\n }\n if (report.pullRequest) {\n lines.push(\"\", ...section(`PR DRIFT vs ${report.pullRequest.base}`, report.pullRequest.changes, options, rows));\n }\n\n if (view === \"flat\") {\n lines.push(\"\", ...flatContract(report.manifest, options));\n lines.push(\"\", ...CONTRACT_CAVEAT_SHORT.map((line) => paint(line, \"dim\")));\n } else if (view === \"grouped\") {\n lines.push(\"\", ...groupedContract(report.manifest, options));\n lines.push(\"\", ...CONTRACT_CAVEAT.map((line) => paint(line, \"dim\")));\n }\n return `${lines.join(\"\\n\")}\\n`;\n}\n\nfunction markdownChanges(changes: readonly ContractChange[]): string {\n if (changes.length === 0) return \"No changes.\\n\";\n return [\n \"| Class | Change | Capability | Declaration | Field |\",\n \"|---|---|---|---|---|\",\n ...changes.map(\n (change) =>\n `| ${change.classification} | ${change.kind} | \\`${change.capabilityId}\\` | \\`${change.declarationId}\\` | \\`${change.field}\\` |`,\n ),\n ].join(\"\\n\");\n}\n\nexport function markdownReport(report: ContractReport, github = false): string {\n const lines = [\n `## Agent Surface ${report.command} — ${report.status}`,\n \"\",\n `- Contract: \\`${report.manifest.hash}\\``,\n `- Completeness: **${report.manifest.completeness.status}**`,\n `- Capabilities: **${report.manifest.capabilities.length}**`,\n `- Targets: ${report.manifest.targets.map((target) => `\\`${target}\\``).join(\", \") || \"—\"}`,\n ];\n if (report.integrity) {\n lines.push(\"\", `### Source ↔ snapshot — ${report.integrity.status}`, \"\", markdownChanges(report.integrity.changes));\n }\n if (report.pullRequest) {\n lines.push(\"\", `### PR drift vs \\`${report.pullRequest.base}\\``, \"\", markdownChanges(report.pullRequest.changes));\n }\n if (github && report.status === \"fail\") {\n lines.unshift(`::error title=Agent Surface contract drift::${report.integrity?.changes.length ?? 0} integrity change(s)`);\n }\n return `${lines.join(\"\\n\")}\\n`;\n}\n\nexport function renderReport(report: ContractReport, format: OutputFormat, options: RenderOptions = {}): string {\n if (format === \"json\") return canonicalJson(report, true);\n if (format === \"markdown\") return markdownReport(report);\n if (format === \"github\") return markdownReport(report, true);\n return humanReport(report, options);\n}\n"],"mappings":";AAeA,IAAM,OAA+B;AAAA,EACnC,MAAM;AAAA,EACN,eAAe;AAAA,EACf,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAChB,mBAAmB;AAAA,EACnB,wBAAwB;AAAA,EACxB,aAAa;AACf;AAEA,IAAM,eAAuC,EAAE,OAAO,GAAG,UAAU,GAAG,UAAU,EAAE;AAElF,SAAS,IAAI,OAAwC;AACnD,SAAO,GAAG,MAAM,aAAa,KAAK,MAAM,YAAY;AACtD;AAEA,SAAS,MAAM,GAAY,GAAqB;AAC9C,SAAO,KAAK,UAAU,CAAC,MAAM,KAAK,UAAU,CAAC;AAC/C;AAEA,SAAS,UAAUA,QAA6B;AAC9C,SAAO,IAAI,IAAI,MAAM,QAAQA,MAAK,IAAIA,OAAM,IAAI,CAAC,SAAS,KAAK,UAAU,IAAI,CAAC,IAAI,CAAC,CAAC;AACtF;AAEA,SAAS,aAAa,QAAiB,OAAwD;AAC7F,QAAM,IAAI,UAAU,MAAM;AAC1B,QAAM,IAAI,UAAU,KAAK;AACzB,QAAM,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,IAAI,IAAI,CAAC;AAChD,QAAM,UAAU,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,IAAI,IAAI,CAAC;AAClD,MAAI,SAAS,QAAS,QAAO;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AAM,IAAI,EAAE,KAAK,IAAI,KAAK,QAAG;AAAA,EAC1F;AACA,MAAI,OAAO,WAAW;AACpB,UAAM,KAAK,IAAI,qCAA2B,OAAO,UAAU,MAAM,IAAI,IAAI,gBAAgB,OAAO,UAAU,OAAO,CAAC;AAAA,EACpH;AACA,MAAI,OAAO,aAAa;AACtB,UAAM,KAAK,IAAI,qBAAqB,OAAO,YAAY,IAAI,MAAM,IAAI,gBAAgB,OAAO,YAAY,OAAO,CAAC;AAAA,EAClH;AACA,MAAI,UAAU,OAAO,WAAW,QAAQ;AACtC,UAAM,QAAQ,+CAA+C,OAAO,WAAW,QAAQ,UAAU,CAAC,sBAAsB;AAAA,EAC1H;AACA,SAAO,GAAG,MAAM,KAAK,IAAI,CAAC;AAAA;AAC5B;AAEO,SAAS,aAAa,QAAwB,QAAsB,UAAyB,CAAC,GAAW;AAC9G,MAAI,WAAW,OAAQ,QAAO,cAAc,QAAQ,IAAI;AACxD,MAAI,WAAW,WAAY,QAAO,eAAe,MAAM;AACvD,MAAI,WAAW,SAAU,QAAO,eAAe,QAAQ,IAAI;AAC3D,SAAO,YAAY,QAAQ,OAAO;AACpC;","names":["value","value","count","value"]}
|
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
sectionTitle,
|
|
20
20
|
summaryFields,
|
|
21
21
|
verbosityOf
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-7LYED3O4.js";
|
|
23
23
|
|
|
24
24
|
// src/ink.tsx
|
|
25
25
|
import { Box, Text, render } from "ink";
|
|
@@ -166,4 +166,4 @@ async function renderInk(report, options = {}) {
|
|
|
166
166
|
export {
|
|
167
167
|
renderInk
|
|
168
168
|
};
|
|
169
|
-
//# sourceMappingURL=ink-
|
|
169
|
+
//# sourceMappingURL=ink-ZRLKCO3E.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-surface/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "Inspect and check the agent surface your app exposes — in the terminal and in CI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"ink": "^6.3.1",
|
|
24
24
|
"react": "^19.1.1",
|
|
25
25
|
"vite": "^7.1.3",
|
|
26
|
-
"@agent-surface/compiler": "^0.
|
|
27
|
-
"@agent-surface/core": "^0.
|
|
26
|
+
"@agent-surface/compiler": "^0.23.0",
|
|
27
|
+
"@agent-surface/core": "^0.23.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/node": "^20.19.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/diff.ts","../src/report.ts"],"sourcesContent":["import type { CapabilityContractEntry, CapabilityContractManifest } from \"@agent-surface/core\";\n\nexport type ChangeClassification = \"widening\" | \"narrowing\" | \"neutral\";\nexport type ChangeKind = \"added\" | \"removed\" | \"changed\";\n\nexport interface ContractChange {\n declarationId: string;\n capabilityId: string;\n kind: ChangeKind;\n field: string;\n classification: ChangeClassification;\n before?: unknown;\n after?: unknown;\n}\n\nconst RISK: Record<string, number> = {\n read: 0,\n \"local-state\": 1,\n navigation: 2,\n \"server-query\": 3,\n \"server-mutation\": 4,\n \"external-side-effect\": 5,\n destructive: 6,\n};\n\nconst CONFIRMATION: Record<string, number> = { never: 0, optional: 1, required: 2 };\n\nfunction key(entry: CapabilityContractEntry): string {\n return `${entry.declarationId}\\0${entry.capabilityId}`;\n}\n\nfunction equal(a: unknown, b: unknown): boolean {\n return JSON.stringify(a) === JSON.stringify(b);\n}\n\nfunction stringSet(value: unknown): Set<string> {\n return new Set(Array.isArray(value) ? value.map((item) => JSON.stringify(item)) : []);\n}\n\nfunction setDirection(before: unknown, after: unknown): \"added\" | \"removed\" | \"mixed\" | \"same\" {\n const a = stringSet(before);\n const b = stringSet(after);\n const added = [...b].some((item) => !a.has(item));\n const removed = [...a].some((item) => !b.has(item));\n if (added && removed) return \"mixed\";\n if (added) return \"added\";\n if (removed) return \"removed\";\n return \"same\";\n}\n\nfunction classify(field: string, before: unknown, after: unknown): ChangeClassification {\n if (field === \"targets\") {\n const direction = setDirection(before, after);\n return direction === \"added\" ? \"widening\" : direction === \"removed\" ? \"narrowing\" : \"neutral\";\n }\n if (field === \"policies\") {\n const direction = setDirection(before, after);\n return direction === \"removed\" || direction === \"mixed\"\n ? \"widening\"\n : direction === \"added\"\n ? \"narrowing\"\n : \"neutral\";\n }\n if (field === \"confirmation\") {\n const a = CONFIRMATION[String(before ?? \"never\")] ?? 0;\n const b = CONFIRMATION[String(after ?? \"never\")] ?? 0;\n return b < a ? \"widening\" : b > a ? \"narrowing\" : \"neutral\";\n }\n if (field === \"effect\") {\n const a = RISK[String(before)] ?? 0;\n const b = RISK[String(after)] ?? 0;\n // Lowering declared risk weakens review/approval posture.\n return b < a ? \"widening\" : b > a ? \"narrowing\" : \"neutral\";\n }\n return \"neutral\";\n}\n\nexport function diffContracts(\n before: CapabilityContractManifest | undefined,\n after: CapabilityContractManifest,\n): ContractChange[] {\n if (!before) {\n return after.capabilities.map((entry) => ({\n declarationId: entry.declarationId,\n capabilityId: entry.capabilityId,\n kind: \"added\",\n field: \"capability\",\n classification: \"widening\",\n after: entry,\n }));\n }\n const left = new Map(before.capabilities.map((entry) => [key(entry), entry]));\n const right = new Map(after.capabilities.map((entry) => [key(entry), entry]));\n const changes: ContractChange[] = [];\n for (const entryKey of [...new Set([...left.keys(), ...right.keys()])].sort()) {\n const a = left.get(entryKey);\n const b = right.get(entryKey);\n if (!a && b) {\n changes.push({\n declarationId: b.declarationId,\n capabilityId: b.capabilityId,\n kind: \"added\",\n field: \"capability\",\n classification: \"widening\",\n after: b,\n });\n continue;\n }\n if (a && !b) {\n changes.push({\n declarationId: a.declarationId,\n capabilityId: a.capabilityId,\n kind: \"removed\",\n field: \"capability\",\n classification: \"narrowing\",\n before: a,\n });\n continue;\n }\n if (!a || !b) continue;\n const fields = new Set([...Object.keys(a), ...Object.keys(b)]);\n fields.delete(\"declarationId\");\n fields.delete(\"capabilityId\");\n fields.delete(\"contractHash\");\n for (const field of [...fields].sort()) {\n const beforeValue = (a as unknown as Record<string, unknown>)[field];\n const afterValue = (b as unknown as Record<string, unknown>)[field];\n if (equal(beforeValue, afterValue)) continue;\n changes.push({\n declarationId: b.declarationId,\n capabilityId: b.capabilityId,\n kind: \"changed\",\n field,\n classification: classify(field, beforeValue, afterValue),\n before: beforeValue,\n after: afterValue,\n });\n }\n }\n return changes;\n}\n\nexport function changeCounts(changes: readonly ContractChange[]): Record<ChangeClassification, number> {\n return {\n widening: changes.filter((change) => change.classification === \"widening\").length,\n narrowing: changes.filter((change) => change.classification === \"narrowing\").length,\n neutral: changes.filter((change) => change.classification === \"neutral\").length,\n };\n}\n","import { relative } from \"node:path\";\nimport type { CapabilityContractEntry, CapabilityContractManifest } from \"@agent-surface/core\";\nimport { canonicalJson } from \"@agent-surface/compiler\";\nimport type { ContractChange } from \"./diff.js\";\nimport { changeCounts } from \"./diff.js\";\n\nexport type OutputFormat = \"human\" | \"json\" | \"github\" | \"markdown\";\n\n/**\n * How much of the report the human renderers show. `normal` is the compact\n * inventory; `min` stops at the headline and counts; `detail` adds provenance,\n * descriptions and the grouped view. Machine formats ignore the knob: `--json`\n * always carries every field.\n */\nexport type Verbosity = \"min\" | \"normal\" | \"detail\";\n\n/**\n * Presentation-only inputs. They never reach the report model, because `--json`\n * is canonical machine output and a checkout path would make it differ between\n * two machines that compiled the same source.\n */\nexport interface RenderOptions {\n /** Application root, used to show the snapshot path as the user typed it. */\n root?: string;\n /** Deprecated alias for `verbosity: \"detail\"`, kept for the exported API. */\n detail?: boolean;\n /** Human renderings only; `min` and `detail` widen or narrow the same blocks. */\n verbosity?: Verbosity;\n /** Paint with ANSI. Off by default so piped output stays byte-stable. */\n color?: boolean;\n}\n\nexport function verbosityOf(options: RenderOptions): Verbosity {\n return options.verbosity ?? (options.detail ? \"detail\" : \"normal\");\n}\n\nexport interface ContractReport {\n command: \"inspect\" | \"check\" | \"snapshot\";\n status: \"pass\" | \"fail\" | \"written\" | \"view\";\n manifest: CapabilityContractManifest;\n snapshotPath: string;\n integrity?: {\n status: \"current\" | \"missing\" | \"stale\";\n changes: ContractChange[];\n };\n pullRequest?: {\n base: string;\n changes: ContractChange[];\n };\n}\n\n/**\n * The same eight ANSI styles the sibling `orpc-agent` CLI paints with, so the\n * two inventories read alike. Colour is applied after padding and only when\n * the caller asked for it: the tested contract stays the uncoloured bytes.\n */\nconst ANSI: Record<string, string> = {\n reset: \"\\u001b[0m\",\n bold: \"\\u001b[1m\",\n dim: \"\\u001b[2m\",\n red: \"\\u001b[31m\",\n green: \"\\u001b[32m\",\n yellow: \"\\u001b[33m\",\n blue: \"\\u001b[34m\",\n magenta: \"\\u001b[35m\",\n cyan: \"\\u001b[36m\",\n gray: \"\\u001b[90m\",\n};\n\nexport function supportsColor(stream: { isTTY?: boolean }): boolean {\n return (\n stream.isTTY === true &&\n !process.env[\"CI\"] &&\n !process.env[\"NO_COLOR\"] &&\n process.env[\"TERM\"] !== \"dumb\"\n );\n}\n\nfunction painter(options: RenderOptions): (text: string, style?: string) => string {\n if (!options.color) return (text) => text;\n return (text, style) => (style ? `${ANSI[style] ?? \"\"}${text}${ANSI.reset}` : text);\n}\n\nfunction value(value: unknown): string {\n if (value === undefined) return \"—\";\n const text = typeof value === \"string\" ? value : JSON.stringify(value);\n return text.length > 100 ? `${text.slice(0, 97)}…` : text;\n}\n\n/** The classification colour, shared by the plain and drawn change rows. */\nexport function changeStyle(change: ContractChange): string {\n if (change.classification === \"widening\") return \"yellow\";\n if (change.classification === \"narrowing\") return \"cyan\";\n return \"gray\";\n}\n\nfunction changeLine(change: ContractChange): string {\n const mark = change.kind === \"added\" ? \"+\" : change.kind === \"removed\" ? \"-\" : \"~\";\n return `${mark} ${change.classification.padEnd(9)} ${change.capabilityId} · ${change.declarationId} · ${change.field}${\n change.kind === \"changed\" ? `: ${value(change.before)} → ${value(change.after)}` : \"\"\n }`;\n}\n\nexport function sectionTitle(title: string, changes: readonly ContractChange[]): string {\n const counts = changeCounts(changes);\n return `${title} (${changes.length}) · widening ${counts.widening} · narrowing ${counts.narrowing} · neutral ${counts.neutral}`;\n}\n\nfunction section(\n title: string,\n changes: readonly ContractChange[],\n options: RenderOptions,\n rows: boolean,\n): string[] {\n const paint = painter(options);\n const lines = [paint(sectionTitle(title, changes), \"bold\")];\n if (!rows) return lines;\n if (changes.length === 0) return [...lines, paint(\"no changes\", \"dim\")];\n return [...lines, ...changes.map((change) => paint(changeLine(change), changeStyle(change)))];\n}\n\n/**\n * Effects in escalating order of reach, so a renderer can grade one without\n * restating the vocabulary. Anything unknown sorts last: a capability whose\n * effect this CLI does not recognize is the one worth looking at.\n */\nconst EFFECT_ORDER = [\n \"read\",\n \"local-state\",\n \"navigation\",\n \"server-query\",\n \"server-mutation\",\n \"external-side-effect\",\n \"destructive\",\n] as const;\n\nexport function effectRank(effect: string): number {\n const index = EFFECT_ORDER.indexOf(effect as (typeof EFFECT_ORDER)[number]);\n return index === -1 ? EFFECT_ORDER.length : index;\n}\n\nexport interface ContractGroup {\n declarationId: string;\n entries: CapabilityContractEntry[];\n}\n\n/** Capabilities grouped by the declaration that owns them, input order kept. */\nexport function groupByDeclaration(capabilities: readonly CapabilityContractEntry[]): ContractGroup[] {\n const groups = new Map<string, CapabilityContractEntry[]>();\n for (const entry of capabilities) {\n const existing = groups.get(entry.declarationId);\n if (existing) existing.push(entry);\n else groups.set(entry.declarationId, [entry]);\n }\n return [...groups].map(([declarationId, entries]) => ({ declarationId, entries }));\n}\n\nexport type Reach = \"low\" | \"medium\" | \"high\";\n\n/**\n * The effect ladder, graded. The effect is the fact; the grade is how it reads\n * to someone who has not memorised the ladder. It is printed as a word rather\n * than left to colour alone, because the streams that matter most — a pipe, a\n * CI log, `--plain` — have no colour to read.\n */\nexport function reachOf(effect: string): Reach {\n const rank = effectRank(effect);\n if (rank <= 1) return \"low\";\n if (rank <= 3) return \"medium\";\n return \"high\";\n}\n\n/**\n * Colour vocabulary shared with the drawn view, one hue per fact. The scale\n * matches the sibling `orpc-agent` CLI: reads cool, writes warm, destructive\n * red, external magenta — so a reader who knows one CLI can skim the other.\n */\nexport const REACH_COLOR: Record<Reach, string> = { low: \"green\", medium: \"yellow\", high: \"red\" };\n\nexport const EFFECT_COLOR: Record<string, string> = {\n read: \"cyan\",\n \"local-state\": \"gray\",\n navigation: \"blue\",\n \"server-query\": \"cyan\",\n \"server-mutation\": \"yellow\",\n \"external-side-effect\": \"magenta\",\n destructive: \"red\",\n};\n\nexport function confirmStyle(confirm: string): string | undefined {\n if (confirm === \"required\") return \"green\";\n if (confirm === \"optional\") return \"cyan\";\n return \"dim\";\n}\n\n/** Nothing declared. A column still has to read as a column. */\nconst NONE = \"—\";\n\nexport const CONTRACT_HEADERS = [\"CAPABILITY\", \"KIND\", \"EFFECT\", \"REACH\", \"CONFIRM\", \"POLICIES\"] as const;\n\nexport interface ContractRow {\n capabilityId: string;\n kind: string;\n effect: string;\n reach: Reach;\n confirm: string;\n policies: string;\n /** Description and tags, shown under detail verbosity. */\n note: string;\n}\n\nexport function contractRow(entry: CapabilityContractEntry): ContractRow {\n const policies = (entry.policies ?? []).map((policy) => `${policy.name}${policy.phase ? `@${policy.phase}` : \"\"}`);\n const tags = (entry.tags ?? []).map((tag) => `#${tag}`).join(\" \");\n return {\n capabilityId: entry.capabilityId,\n kind: entry.kind,\n effect: entry.effect,\n reach: reachOf(entry.effect),\n confirm: entry.confirmation ?? NONE,\n policies: policies.length > 0 ? policies.join(\", \") : NONE,\n note: [entry.description, tags].filter(Boolean).join(\" \"),\n };\n}\n\nexport function contractCells(row: ContractRow): string[] {\n return [row.capabilityId, row.kind, row.effect, row.reach, row.confirm, row.policies];\n}\n\nfunction tally(values: readonly string[]): string {\n const counts = new Map<string, number>();\n for (const value of values) counts.set(value, (counts.get(value) ?? 0) + 1);\n return [...counts]\n .sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))\n .map(([name, count]) => `${count} ${name}`)\n .join(\" · \");\n}\n\nfunction plural(count: number, noun: string, suffix = \"s\"): string {\n return `${count} ${noun}${count === 1 ? \"\" : suffix}`;\n}\n\nexport function contractHeading(manifest: CapabilityContractManifest): string {\n const count = manifest.capabilities.length;\n const groups = groupByDeclaration(manifest.capabilities).length;\n return `REPOSITORY CONTRACT · ${count} ${count === 1 ? \"capability\" : \"capabilities\"} · ${plural(groups, \"declaration\")}`;\n}\n\n/**\n * The answer, before the evidence for it. A reader who stops after this line\n * should still know how large the surface is and how much of it is gated.\n */\nexport function headline(manifest: CapabilityContractManifest): string[] {\n const capabilities = manifest.capabilities;\n const count = capabilities.length;\n const gated = capabilities.filter((entry) => entry.confirmation && entry.confirmation !== \"never\").length;\n const policed = capabilities.filter((entry) => (entry.policies ?? []).length > 0).length;\n // Along the ladder, not by frequency: \"34 low · 1 high · 1 medium\" reads as\n // a miscount rather than a distribution.\n const reach = ([\"low\", \"medium\", \"high\"] as const)\n .map((grade) => [grade, capabilities.filter((entry) => reachOf(entry.effect) === grade).length] as const)\n .filter(([, count]) => count > 0)\n .map(([grade, count]) => `${count} ${grade}`)\n .join(\" · \");\n return [\n `${count} ${count === 1 ? \"capability\" : \"capabilities\"} · ${plural(\n groupByDeclaration(capabilities).length,\n \"declaration\",\n )}${count > 0 ? ` · ${tally(capabilities.map((entry) => entry.kind))}` : \"\"}`,\n `reach ${reach || NONE} · declared gates: ${gated} confirmation · ${policed} policy`,\n ];\n}\n\n/** The integrity word for the headline, so `min` still answers \"am I current\". */\nexport function integrityWord(report: ContractReport): string | undefined {\n if (!report.integrity) return undefined;\n return `snapshot ${report.integrity.status}`;\n}\n\n/**\n * What a compiled contract cannot tell you, in two lines the compact view can\n * afford. The columns are declarations the graph proves reachable — not a\n * transcript of a run.\n */\nexport const CONTRACT_CAVEAT_SHORT = [\n \"Declared contract, compiled from the production graph — what this code can expose,\",\n \"not what a mount exposed at runtime; a policy's verdict needs a real invocation.\",\n];\n\n/** The full statement, kept for detail verbosity where prose has room. */\nexport const CONTRACT_CAVEAT = [\n \"Declarations, compiled from the production graph — what this code can expose,\",\n \"not what a mount exposed at runtime. CONFIRM and POLICIES are declared per\",\n \"capability; whether a policy admits, denies or hides one depends on the actor,\",\n \"input and context of a real invocation, which this command never performs.\",\n];\n\n/** Column widths shared by the plain and drawn renderers, so both align alike. */\nexport function contractColumns(capabilities: readonly CapabilityContractEntry[]): number[] {\n const rows = capabilities.map((entry) => contractCells(contractRow(entry)));\n return CONTRACT_HEADERS.map((header, index) =>\n Math.max(header.length, ...rows.map((cells) => cells[index]?.length ?? 0)),\n );\n}\n\n/** One table line, padded to the shared widths. The last cell is never padded. */\nexport function contractLine(cells: readonly string[], widths: readonly number[]): string {\n return cells\n .map((cell, index) => (index === cells.length - 1 ? cell : cell.padEnd(widths[index] ?? 0)))\n .join(\" \")\n .trimEnd();\n}\n\n/** A table row, each cell padded then painted so the grid survives the colour. */\nfunction paintedRow(row: ContractRow, widths: readonly number[], options: RenderOptions): string {\n const paint = painter(options);\n const cells = contractCells(row).map((cell, index) => (index === 5 ? cell : cell.padEnd(widths[index] ?? 0)));\n return [\n cells[0],\n paint(cells[1] ?? \"\", \"dim\"),\n paint(cells[2] ?? \"\", EFFECT_COLOR[row.effect]),\n paint(cells[3] ?? \"\", REACH_COLOR[row.reach]),\n paint(cells[4] ?? \"\", confirmStyle(row.confirm)),\n row.policies === NONE ? paint(cells[5] ?? \"\", \"dim\") : cells[5],\n ]\n .join(\" \")\n .trimEnd();\n}\n\n/** Show the snapshot where the user would type it, not as an absolute path. */\nexport function displayPath(path: string, root?: string): string {\n if (!root) return path;\n const relativePath = relative(root, path);\n return !relativePath || relativePath.startsWith(\"..\") ? path : relativePath;\n}\n\n/** How the inventory table is drawn, per command and verbosity. */\nexport type ContractView = \"none\" | \"flat\" | \"grouped\";\n\n/**\n * `inspect` exists to show the inventory: compact and flat by default, grouped\n * by declaration under detail. The other commands lead with a verdict and keep\n * the inventory out of the way — until detail is asked for, because the reason\n * to ask a gate for detail is to read what it gated.\n */\nexport function contractView(report: ContractReport, options: RenderOptions = {}): ContractView {\n const verbosity = verbosityOf(options);\n if (verbosity === \"detail\") return \"grouped\";\n if (report.command !== \"inspect\" || verbosity === \"min\") return \"none\";\n return \"flat\";\n}\n\n/** Kept for the exported API; true whenever any inventory is rendered. */\nexport function showsContract(report: ContractReport, options: RenderOptions = {}): boolean {\n return contractView(report, options) !== \"none\";\n}\n\n/** Provenance. True, needed, and not what the reader came for — so it sits below. */\nexport function summaryFields(report: ContractReport, options: RenderOptions = {}): [string, string][] {\n const { manifest } = report;\n const fields: [string, string][] = [\n [\"Contract\", manifest.hash],\n [\"Compiler\", manifest.compilerVersion],\n [\"Completeness\", manifest.completeness.status],\n [\"Targets\", manifest.targets.join(\", \") || NONE],\n [\"Snapshot\", displayPath(report.snapshotPath, options.root)],\n ];\n if (report.integrity) fields.push([\"Integrity\", report.integrity.status]);\n return fields;\n}\n\nfunction bannerLine(report: ContractReport, options: RenderOptions): string {\n const paint = painter(options);\n const ok = report.status !== \"fail\";\n return paint(\n `AGENT SURFACE ${report.command.toUpperCase()} · ${report.status.toUpperCase()}`,\n ok ? \"green\" : \"red\",\n );\n}\n\nfunction headlineLines(report: ContractReport, options: RenderOptions): string[] {\n const paint = painter(options);\n const [size, gates] = headline(report.manifest);\n const integrity = integrityWord(report);\n const stale = report.integrity && report.integrity.status !== \"current\";\n return [\n paint(size ?? \"\", \"bold\"),\n `${gates}${integrity ? ` · ${stale ? paint(integrity, \"yellow\") : integrity}` : \"\"}`,\n ];\n}\n\nfunction flatContract(manifest: CapabilityContractManifest, options: RenderOptions): string[] {\n const paint = painter(options);\n const widths = contractColumns(manifest.capabilities);\n return [\n paint(contractLine(CONTRACT_HEADERS, widths), \"dim\"),\n ...manifest.capabilities.map((entry) => paintedRow(contractRow(entry), widths, options)),\n ];\n}\n\nfunction groupedContract(manifest: CapabilityContractManifest, options: RenderOptions): string[] {\n const paint = painter(options);\n const widths = contractColumns(manifest.capabilities);\n const lines = [\n paint(contractHeading(manifest), \"bold\"),\n \"\",\n ` ${paint(contractLine(CONTRACT_HEADERS, widths), \"dim\")}`,\n ];\n for (const group of groupByDeclaration(manifest.capabilities)) {\n lines.push(\"\", `${paint(group.declarationId, \"blue\")} (${group.entries.length})`);\n for (const entry of group.entries) {\n const row = contractRow(entry);\n lines.push(` ${paintedRow(row, widths, options)}`);\n if (row.note) lines.push(paint(` ${row.note}`, \"dim\"));\n }\n }\n return lines;\n}\n\n/**\n * One human report for every command; verbosity widens or narrows blocks\n * rather than swapping layouts. `min` stops after the headline and change\n * counts; `detail` adds provenance fields, the grouped inventory with notes,\n * and the full caveat.\n */\nexport function humanReport(report: ContractReport, options: RenderOptions = {}): string {\n const paint = painter(options);\n const verbosity = verbosityOf(options);\n const view = contractView(report, options);\n const lines: string[] = [];\n\n // `inspect` leads with the inventory itself; a verdict banner would restate\n // the exit code. The writing and gating commands lead with theirs.\n if (report.command !== \"inspect\" || verbosity === \"detail\") {\n lines.push(bannerLine(report, options), \"\");\n }\n lines.push(...headlineLines(report, options));\n\n if (report.command === \"snapshot\") {\n lines.push(\"\", `wrote ${displayPath(report.snapshotPath, options.root)}`);\n }\n\n if (verbosity === \"detail\") {\n const fields = summaryFields(report, options);\n const label = Math.max(...fields.map(([name]) => name.length));\n lines.push(\"\", ...fields.map(([name, value]) => `${paint(name.padEnd(label), \"dim\")} ${value}`));\n }\n\n // `min` keeps section titles — the counts are the point — and drops rows.\n // Under `normal`, inspect shows integrity rows only when there is drift;\n // an explicit --base always gets its answer, even when that answer is none.\n const rows = verbosity !== \"min\";\n if (report.integrity && (report.command === \"check\" || verbosity === \"detail\" || report.integrity.changes.length > 0)) {\n lines.push(\"\", ...section(\"SOURCE ↔ SNAPSHOT\", report.integrity.changes, options, rows));\n }\n if (report.pullRequest) {\n lines.push(\"\", ...section(`PR DRIFT vs ${report.pullRequest.base}`, report.pullRequest.changes, options, rows));\n }\n\n if (view === \"flat\") {\n lines.push(\"\", ...flatContract(report.manifest, options));\n lines.push(\"\", ...CONTRACT_CAVEAT_SHORT.map((line) => paint(line, \"dim\")));\n } else if (view === \"grouped\") {\n lines.push(\"\", ...groupedContract(report.manifest, options));\n lines.push(\"\", ...CONTRACT_CAVEAT.map((line) => paint(line, \"dim\")));\n }\n return `${lines.join(\"\\n\")}\\n`;\n}\n\nfunction markdownChanges(changes: readonly ContractChange[]): string {\n if (changes.length === 0) return \"No changes.\\n\";\n return [\n \"| Class | Change | Capability | Declaration | Field |\",\n \"|---|---|---|---|---|\",\n ...changes.map(\n (change) =>\n `| ${change.classification} | ${change.kind} | \\`${change.capabilityId}\\` | \\`${change.declarationId}\\` | \\`${change.field}\\` |`,\n ),\n ].join(\"\\n\");\n}\n\nexport function markdownReport(report: ContractReport, github = false): string {\n const lines = [\n `## Agent Surface ${report.command} — ${report.status}`,\n \"\",\n `- Contract: \\`${report.manifest.hash}\\``,\n `- Completeness: **${report.manifest.completeness.status}**`,\n `- Capabilities: **${report.manifest.capabilities.length}**`,\n `- Targets: ${report.manifest.targets.map((target) => `\\`${target}\\``).join(\", \") || \"—\"}`,\n ];\n if (report.integrity) {\n lines.push(\"\", `### Source ↔ snapshot — ${report.integrity.status}`, \"\", markdownChanges(report.integrity.changes));\n }\n if (report.pullRequest) {\n lines.push(\"\", `### PR drift vs \\`${report.pullRequest.base}\\``, \"\", markdownChanges(report.pullRequest.changes));\n }\n if (github && report.status === \"fail\") {\n lines.unshift(`::error title=Agent Surface contract drift::${report.integrity?.changes.length ?? 0} integrity change(s)`);\n }\n return `${lines.join(\"\\n\")}\\n`;\n}\n\nexport function renderReport(report: ContractReport, format: OutputFormat, options: RenderOptions = {}): string {\n if (format === \"json\") return canonicalJson(report, true);\n if (format === \"markdown\") return markdownReport(report);\n if (format === \"github\") return markdownReport(report, true);\n return humanReport(report, options);\n}\n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