@agent-surface/cli 0.12.1 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -6
- package/dist/bin.js +22 -13
- package/dist/bin.js.map +1 -1
- package/dist/check-O7ENP4XP.js +259 -0
- package/dist/check-O7ENP4XP.js.map +1 -0
- package/dist/chunk-G7Z6PP6C.js +532 -0
- package/dist/chunk-G7Z6PP6C.js.map +1 -0
- package/dist/chunk-JR4GESLI.js +61 -0
- package/dist/chunk-JR4GESLI.js.map +1 -0
- package/dist/chunk-LQUL4OIA.js +1441 -0
- package/dist/chunk-LQUL4OIA.js.map +1 -0
- package/dist/chunk-YUT4FVQQ.js +220 -0
- package/dist/chunk-YUT4FVQQ.js.map +1 -0
- package/dist/{init-LFQ5R3G7.js → init-64GIHMKV.js} +64 -41
- package/dist/init-64GIHMKV.js.map +1 -0
- package/dist/{ink-P23VKP4H.js → ink-ICJWXGZC.js} +153 -25
- package/dist/ink-ICJWXGZC.js.map +1 -0
- package/dist/inspect-6OZ6ZBKZ.js +226 -0
- package/dist/inspect-6OZ6ZBKZ.js.map +1 -0
- package/dist/snapshot-GTDFQTN2.js +130 -0
- package/dist/snapshot-GTDFQTN2.js.map +1 -0
- package/package.json +4 -4
- package/dist/check-POE5VRSE.js +0 -183
- package/dist/check-POE5VRSE.js.map +0 -1
- package/dist/chunk-DYDSJM7R.js +0 -170
- package/dist/chunk-DYDSJM7R.js.map +0 -1
- package/dist/chunk-J2NN3J5N.js +0 -541
- package/dist/chunk-J2NN3J5N.js.map +0 -1
- package/dist/chunk-Q5WOLWEW.js +0 -984
- package/dist/chunk-Q5WOLWEW.js.map +0 -1
- package/dist/chunk-QIVOZAWX.js +0 -169
- package/dist/chunk-QIVOZAWX.js.map +0 -1
- package/dist/init-LFQ5R3G7.js.map +0 -1
- package/dist/ink-P23VKP4H.js.map +0 -1
- package/dist/inspect-XMDZBSK2.js +0 -119
- package/dist/inspect-XMDZBSK2.js.map +0 -1
- package/dist/snapshot-FLXE5UC6.js +0 -61
- package/dist/snapshot-FLXE5UC6.js.map +0 -1
package/dist/inspect-XMDZBSK2.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
coverageReport,
|
|
3
|
-
inventoryReport,
|
|
4
|
-
renderCatalogPlain,
|
|
5
|
-
renderCoveragePlain,
|
|
6
|
-
renderFailuresPlain,
|
|
7
|
-
renderNoVerdictPlain,
|
|
8
|
-
renderSurfacePlain,
|
|
9
|
-
scenarioReport
|
|
10
|
-
} from "./chunk-J2NN3J5N.js";
|
|
11
|
-
import {
|
|
12
|
-
buildView
|
|
13
|
-
} from "./chunk-DYDSJM7R.js";
|
|
14
|
-
import {
|
|
15
|
-
authoredIds,
|
|
16
|
-
joinCoverage,
|
|
17
|
-
mountScenarios,
|
|
18
|
-
readInventory,
|
|
19
|
-
scopeCapabilityIds,
|
|
20
|
-
scopeInventory,
|
|
21
|
-
staticConfigScope
|
|
22
|
-
} from "./chunk-Q5WOLWEW.js";
|
|
23
|
-
import {
|
|
24
|
-
isPlain,
|
|
25
|
-
loadInk,
|
|
26
|
-
paint,
|
|
27
|
-
write,
|
|
28
|
-
writeError
|
|
29
|
-
} from "./chunk-QIVOZAWX.js";
|
|
30
|
-
|
|
31
|
-
// src/commands/inspect.tsx
|
|
32
|
-
import { jsx } from "react/jsx-runtime";
|
|
33
|
-
async function runInspect(options) {
|
|
34
|
-
const analysis = {
|
|
35
|
-
configPath: options.configPath,
|
|
36
|
-
depth: options.depth,
|
|
37
|
-
...options.scenario ? { scenario: options.scenario } : {},
|
|
38
|
-
...options.scope ? { scope: options.scope } : {},
|
|
39
|
-
...options.tsconfig ? { tsconfig: options.tsconfig } : {},
|
|
40
|
-
...options.baselineDir ? { baselineDir: options.baselineDir } : {}
|
|
41
|
-
};
|
|
42
|
-
const detail = options.detail === true || options.explain === true || options.schemas === true;
|
|
43
|
-
const inventory = readInventory(analysis);
|
|
44
|
-
const initialInventory = scopeInventory(inventory, staticConfigScope(analysis));
|
|
45
|
-
if (initialInventory && !options.json && options.depth === "static") {
|
|
46
|
-
write(renderCatalogPlain(initialInventory, { standalone: true, detail }));
|
|
47
|
-
}
|
|
48
|
-
const ink = isPlain(options) ? null : await loadInk();
|
|
49
|
-
const scenarios = [];
|
|
50
|
-
let printed = 0;
|
|
51
|
-
const runtime = await mountScenarios(analysis, async (result) => {
|
|
52
|
-
if (options.json) {
|
|
53
|
-
scenarios.push(
|
|
54
|
-
scenarioReport(result, {
|
|
55
|
-
...options.explain ? { attribution: true } : {},
|
|
56
|
-
...options.schemas ? { schemas: true } : {}
|
|
57
|
-
})
|
|
58
|
-
);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
const view = buildView(result, {
|
|
62
|
-
...options.explain ? { explain: true } : {},
|
|
63
|
-
...options.schemas ? { schemas: true } : {}
|
|
64
|
-
});
|
|
65
|
-
if (ink) await paint(/* @__PURE__ */ jsx(ink.Surface, { view, detail }));
|
|
66
|
-
else {
|
|
67
|
-
const rendered = renderSurfacePlain(view, { detail });
|
|
68
|
-
write(printed === 0 && !inventory ? rendered : `
|
|
69
|
-
${rendered}`);
|
|
70
|
-
}
|
|
71
|
-
printed += 1;
|
|
72
|
-
});
|
|
73
|
-
const effectiveScope = options.scope ?? runtime?.scope ?? staticConfigScope(analysis);
|
|
74
|
-
const reportInventory = scopeInventory(inventory, effectiveScope);
|
|
75
|
-
const reportDomain = runtime?.domainManifestConfigured ? scopeCapabilityIds(runtime.domainCapabilities, effectiveScope) : void 0;
|
|
76
|
-
const coverage = joinCoverage(inventory, runtime, analysis);
|
|
77
|
-
if (reportInventory && !options.json && options.depth === "full") {
|
|
78
|
-
write(
|
|
79
|
-
`${printed > 0 ? "\n" : ""}${renderCatalogPlain(reportInventory, {
|
|
80
|
-
...coverage && runtime?.domainManifestConfigured ? { domainCapabilities: coverage.authored - authoredIds(reportInventory).size } : {}
|
|
81
|
-
})}`
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
if (options.json) {
|
|
85
|
-
write(
|
|
86
|
-
JSON.stringify(
|
|
87
|
-
{
|
|
88
|
-
// One shape whatever the depth, so a consumer never branches on how
|
|
89
|
-
// the command was invoked. A half the depth did not compute is
|
|
90
|
-
// `null`, which is a different statement from `[]` or `{}`.
|
|
91
|
-
depth: options.depth,
|
|
92
|
-
catalog: inventoryReport(reportInventory, reportDomain),
|
|
93
|
-
scenarios,
|
|
94
|
-
failures: runtime?.failures ?? [],
|
|
95
|
-
coverage: coverageReport(coverage)
|
|
96
|
-
},
|
|
97
|
-
null,
|
|
98
|
-
2
|
|
99
|
-
)
|
|
100
|
-
);
|
|
101
|
-
return runtime && runtime.failures.length > 0 ? 2 : 0;
|
|
102
|
-
}
|
|
103
|
-
if (runtime && runtime.failures.length > 0) {
|
|
104
|
-
writeError(`
|
|
105
|
-
${renderFailuresPlain(runtime.failures)}`);
|
|
106
|
-
}
|
|
107
|
-
if (coverage) {
|
|
108
|
-
write("");
|
|
109
|
-
write(renderCoveragePlain(coverage));
|
|
110
|
-
} else if (inventory && runtime && runtime.failures.length > 0) {
|
|
111
|
-
writeError(`
|
|
112
|
-
${renderNoVerdictPlain(runtime.failures)}`);
|
|
113
|
-
}
|
|
114
|
-
return runtime && runtime.failures.length > 0 ? 2 : 0;
|
|
115
|
-
}
|
|
116
|
-
export {
|
|
117
|
-
runInspect
|
|
118
|
-
};
|
|
119
|
-
//# sourceMappingURL=inspect-XMDZBSK2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/inspect.tsx"],"sourcesContent":["import {\n joinCoverage,\n mountScenarios,\n readInventory,\n scopeCapabilityIds,\n scopeInventory,\n staticConfigScope,\n type AnalysisOptions,\n type Depth,\n} from \"../analysis.js\";\nimport { buildView } from \"../render/model.js\";\nimport { authoredIds } from \"../extract.js\";\nimport {\n renderCatalogPlain,\n renderCoveragePlain,\n renderFailuresPlain,\n renderNoVerdictPlain,\n renderSurfacePlain,\n} from \"../render/plain.js\";\nimport { isPlain, loadInk, paint, write, writeError } from \"../output.js\";\nimport {\n coverageReport,\n inventoryReport,\n scenarioReport,\n type ScenarioReport,\n} from \"../report.js\";\n\nexport interface InspectOptions {\n configPath: string;\n depth: Depth;\n scenario?: string;\n scope?: string[];\n tsconfig?: string;\n baselineDir?: string;\n detail?: boolean;\n explain?: boolean;\n schemas?: boolean;\n json?: boolean;\n plain?: boolean;\n}\n\n/**\n * The whole surface: what this codebase authors, what a mount surfaces, and the\n * difference between them.\n *\n * It answers findings, it does not gate on them — exit `0` whatever it reports,\n * because `check` is the gate and a viewer that sometimes fails is a viewer\n * nobody puts in a pipeline. The exception is `2`, which is not a finding: the\n * command could not run at all.\n *\n * Each scenario prints as it finishes, so a config with ten of them is not ten\n * mounts of blank terminal. The normalized catalog summary and verdict follow\n * once effective config scope and the domain manifest are known.\n */\nexport async function runInspect(options: InspectOptions): Promise<number> {\n const analysis: AnalysisOptions = {\n configPath: options.configPath,\n depth: options.depth,\n ...(options.scenario ? { scenario: options.scenario } : {}),\n ...(options.scope ? { scope: options.scope } : {}),\n ...(options.tsconfig ? { tsconfig: options.tsconfig } : {}),\n ...(options.baselineDir ? { baselineDir: options.baselineDir } : {}),\n };\n\n // Policy chains and JSON Schemas are multi-line by nature, so asking for\n // either is asking for the view that can hold them.\n const detail = options.detail === true || options.explain === true || options.schemas === true;\n\n const inventory = readInventory(analysis);\n const initialInventory = scopeInventory(inventory, staticConfigScope(analysis));\n if (initialInventory && !options.json && options.depth === \"static\") {\n // At `--depth static` this listing is the output. At `--depth full` the\n // scenario tables below carry the same capabilities and the verdict names\n // the ones they miss, so only the summary line prints here.\n write(renderCatalogPlain(initialInventory, { standalone: true, detail }));\n }\n\n // `null` when Ink cannot run here (React 18 host), which is a fallback to\n // plain text rather than a failed command — see loadInk().\n const ink = isPlain(options) ? null : await loadInk();\n const scenarios: ScenarioReport[] = [];\n let printed = 0;\n\n const runtime = await mountScenarios(analysis, async (result) => {\n if (options.json) {\n scenarios.push(\n scenarioReport(result, {\n ...(options.explain ? { attribution: true } : {}),\n ...(options.schemas ? { schemas: true } : {}),\n }),\n );\n return;\n }\n const view = buildView(result, {\n ...(options.explain ? { explain: true } : {}),\n ...(options.schemas ? { schemas: true } : {}),\n });\n if (ink) await paint(<ink.Surface view={view} detail={detail} />);\n else {\n const rendered = renderSurfacePlain(view, { detail });\n write(printed === 0 && !inventory ? rendered : `\\n${rendered}`);\n }\n printed += 1;\n });\n\n const effectiveScope = options.scope ?? runtime?.scope ?? staticConfigScope(analysis);\n const reportInventory = scopeInventory(inventory, effectiveScope);\n const reportDomain = runtime?.domainManifestConfigured\n ? scopeCapabilityIds(runtime.domainCapabilities, effectiveScope)\n : undefined;\n const coverage = joinCoverage(inventory, runtime, analysis);\n if (reportInventory && !options.json && options.depth === \"full\") {\n write(\n `${printed > 0 ? \"\\n\" : \"\"}${renderCatalogPlain(reportInventory, {\n ...(coverage && runtime?.domainManifestConfigured\n ? { domainCapabilities: coverage.authored - authoredIds(reportInventory).size }\n : {}),\n })}`,\n );\n }\n\n if (options.json) {\n write(\n JSON.stringify(\n {\n // One shape whatever the depth, so a consumer never branches on how\n // the command was invoked. A half the depth did not compute is\n // `null`, which is a different statement from `[]` or `{}`.\n depth: options.depth,\n catalog: inventoryReport(reportInventory, reportDomain),\n scenarios,\n failures: runtime?.failures ?? [],\n coverage: coverageReport(coverage),\n },\n null,\n 2,\n ),\n );\n return runtime && runtime.failures.length > 0 ? 2 : 0;\n }\n\n if (runtime && runtime.failures.length > 0) {\n writeError(`\\n${renderFailuresPlain(runtime.failures)}`);\n }\n if (coverage) {\n write(\"\");\n write(renderCoveragePlain(coverage));\n } else if (inventory && runtime && runtime.failures.length > 0) {\n writeError(`\\n${renderNoVerdictPlain(runtime.failures)}`);\n }\n\n // A scenario that would not mount is not a finding about the surface, it is\n // the command failing to observe one. `2` — the same code a usage error gets,\n // because CI has to tell both apart from \"the surface changed\".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AA,EAAK,oBAAoB,QAAQ,QAAQ,CAAC,EAAE;AAAA,EACzD;AACA,MAAI,UAAU;AACZ,UAAM,EAAE;AACR,UAAM,oBAAoB,QAAQ,CAAC;AAAA,EACrC,WAAW,aAAa,WAAW,QAAQ,SAAS,SAAS,GAAG;AAC9D,eAAW;AAAA,EAAK,qBAAqB,QAAQ,QAAQ,CAAC,EAAE;AAAA,EAC1D;AAKA,SAAO,WAAW,QAAQ,SAAS,SAAS,IAAI,IAAI;AACtD;","names":[]}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
renderCoveragePlain,
|
|
3
|
-
renderFailuresPlain,
|
|
4
|
-
scenarioBaseline
|
|
5
|
-
} from "./chunk-J2NN3J5N.js";
|
|
6
|
-
import "./chunk-DYDSJM7R.js";
|
|
7
|
-
import {
|
|
8
|
-
baselinePath,
|
|
9
|
-
joinCoverage,
|
|
10
|
-
mountScenarios,
|
|
11
|
-
readInventory,
|
|
12
|
-
writeBaseline,
|
|
13
|
-
writeScenarioManifest
|
|
14
|
-
} from "./chunk-Q5WOLWEW.js";
|
|
15
|
-
import {
|
|
16
|
-
UsageError,
|
|
17
|
-
write,
|
|
18
|
-
writeError
|
|
19
|
-
} from "./chunk-QIVOZAWX.js";
|
|
20
|
-
|
|
21
|
-
// src/commands/snapshot.ts
|
|
22
|
-
import { relative } from "path";
|
|
23
|
-
async function runSnapshot(options) {
|
|
24
|
-
if (options.depth === "static") {
|
|
25
|
-
throw new UsageError(
|
|
26
|
-
"snapshot --depth static has nothing to write \u2014 a baseline is a projection, and at this depth nothing is mounted."
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
const analysis = {
|
|
30
|
-
configPath: options.configPath,
|
|
31
|
-
depth: options.depth,
|
|
32
|
-
...options.scenario ? { scenario: options.scenario } : {},
|
|
33
|
-
...options.scope ? { scope: options.scope } : {},
|
|
34
|
-
...options.tsconfig ? { tsconfig: options.tsconfig } : {},
|
|
35
|
-
...options.baselineDir ? { baselineDir: options.baselineDir } : {}
|
|
36
|
-
};
|
|
37
|
-
const inventory = readInventory(analysis);
|
|
38
|
-
const runtime = await mountScenarios(analysis);
|
|
39
|
-
if (!runtime) throw new UsageError("snapshot needs a mount, and this depth performs none");
|
|
40
|
-
for (const result of runtime.results) {
|
|
41
|
-
const path = baselinePath(runtime.baselineDir, result.scenario);
|
|
42
|
-
writeBaseline(path, scenarioBaseline(result));
|
|
43
|
-
write(`wrote ${relative(process.cwd(), path)}`);
|
|
44
|
-
}
|
|
45
|
-
writeScenarioManifest(runtime.baselineDir, runtime.declaredScenarios);
|
|
46
|
-
const coverage = joinCoverage(inventory, runtime, analysis);
|
|
47
|
-
if (coverage) {
|
|
48
|
-
write("");
|
|
49
|
-
write(renderCoveragePlain(coverage));
|
|
50
|
-
}
|
|
51
|
-
if (runtime.failures.length > 0) {
|
|
52
|
-
writeError(`
|
|
53
|
-
${renderFailuresPlain(runtime.failures)}`);
|
|
54
|
-
return 2;
|
|
55
|
-
}
|
|
56
|
-
return 0;
|
|
57
|
-
}
|
|
58
|
-
export {
|
|
59
|
-
runSnapshot
|
|
60
|
-
};
|
|
61
|
-
//# sourceMappingURL=snapshot-FLXE5UC6.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/snapshot.ts"],"sourcesContent":["import { relative } from \"node:path\";\nimport {\n joinCoverage,\n mountScenarios,\n readInventory,\n UsageError,\n type AnalysisOptions,\n type Depth,\n} from \"../analysis.js\";\nimport { baselinePath, writeBaseline, writeScenarioManifest } from \"../baseline.js\";\nimport { scenarioBaseline } from \"../report.js\";\nimport { renderCoveragePlain, renderFailuresPlain } from \"../render/plain.js\";\nimport { write, writeError } from \"../output.js\";\n\nexport interface SnapshotOptions {\n configPath: string;\n depth: Depth;\n scenario?: string;\n scope?: string[];\n tsconfig?: string;\n baselineDir?: string;\n}\n\n/**\n * Writes (or refreshes) the committed baseline `check` compares against.\n *\n * It prints the coverage verdict too. This is the command you run to *accept* a\n * change to the surface, which makes it the last moment before a reviewer sees\n * the diff — and accepting a projection while a capability sits behind a route\n * no scenario visits is exactly the state worth hearing about. It reports;\n * `check` is still the only thing that fails.\n */\nexport async function runSnapshot(options: SnapshotOptions): Promise<number> {\n if (options.depth === \"static\") {\n throw new UsageError(\n \"snapshot --depth static has nothing to write — a baseline is a projection, and \" +\n \"at this depth nothing is mounted.\",\n );\n }\n\n const analysis: AnalysisOptions = {\n configPath: options.configPath,\n depth: options.depth,\n ...(options.scenario ? { scenario: options.scenario } : {}),\n ...(options.scope ? { scope: options.scope } : {}),\n ...(options.tsconfig ? { tsconfig: options.tsconfig } : {}),\n ...(options.baselineDir ? { baselineDir: options.baselineDir } : {}),\n };\n\n const inventory = readInventory(analysis);\n const runtime = await mountScenarios(analysis);\n if (!runtime) throw new UsageError(\"snapshot needs a mount, and this depth performs none\");\n\n for (const result of runtime.results) {\n const path = baselinePath(runtime.baselineDir, result.scenario);\n writeBaseline(path, scenarioBaseline(result));\n write(`wrote ${relative(process.cwd(), path)}`);\n }\n writeScenarioManifest(runtime.baselineDir, runtime.declaredScenarios);\n\n const coverage = joinCoverage(inventory, runtime, analysis);\n if (coverage) {\n write(\"\");\n write(renderCoveragePlain(coverage));\n }\n\n if (runtime.failures.length > 0) {\n // A baseline written for some scenarios and not others is a baseline that\n // will fail `check` for a reason that has nothing to do with the surface.\n writeError(`\\n${renderFailuresPlain(runtime.failures)}`);\n return 2;\n }\n return 0;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,gBAAgB;AAgCzB,eAAsB,YAAY,SAA2C;AAC3E,MAAI,QAAQ,UAAU,UAAU;AAC9B,UAAM,IAAI;AAAA,MACR;AAAA,IAEF;AAAA,EACF;AAEA,QAAM,WAA4B;AAAA,IAChC,YAAY,QAAQ;AAAA,IACpB,OAAO,QAAQ;AAAA,IACf,GAAI,QAAQ,WAAW,EAAE,UAAU,QAAQ,SAAS,IAAI,CAAC;AAAA,IACz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