@intentset/cli 0.1.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/commands/architecture.d.ts +6 -0
- package/dist/commands/architecture.d.ts.map +1 -0
- package/dist/commands/architecture.js +65 -0
- package/dist/commands/architecture.js.map +1 -0
- package/dist/commands/context.d.ts +4 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +124 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/evidence.d.ts +29 -0
- package/dist/commands/evidence.d.ts.map +1 -0
- package/dist/commands/evidence.js +157 -0
- package/dist/commands/evidence.js.map +1 -0
- package/dist/commands/graph.d.ts +18 -0
- package/dist/commands/graph.d.ts.map +1 -0
- package/dist/commands/graph.js +77 -0
- package/dist/commands/graph.js.map +1 -0
- package/dist/commands/impact.d.ts +20 -0
- package/dist/commands/impact.d.ts.map +1 -0
- package/dist/commands/impact.js +92 -0
- package/dist/commands/impact.js.map +1 -0
- package/dist/commands/init.d.ts +18 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +122 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/mcp.d.ts +24 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +122 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/publish.d.ts +19 -0
- package/dist/commands/publish.d.ts.map +1 -0
- package/dist/commands/publish.js +98 -0
- package/dist/commands/publish.js.map +1 -0
- package/dist/commands/review.d.ts +29 -0
- package/dist/commands/review.d.ts.map +1 -0
- package/dist/commands/review.js +147 -0
- package/dist/commands/review.js.map +1 -0
- package/dist/commands/serve.d.ts +14 -0
- package/dist/commands/serve.d.ts.map +1 -0
- package/dist/commands/serve.js +246 -0
- package/dist/commands/serve.js.map +1 -0
- package/dist/commands/shared.d.ts +19 -0
- package/dist/commands/shared.d.ts.map +1 -0
- package/dist/commands/shared.js +43 -0
- package/dist/commands/shared.js.map +1 -0
- package/dist/commands/validate.d.ts +11 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +38 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/git.d.ts +25 -0
- package/dist/git.d.ts.map +1 -0
- package/dist/git.js +63 -0
- package/dist/git.js.map +1 -0
- package/dist/glob.d.ts +16 -0
- package/dist/glob.d.ts.map +1 -0
- package/dist/glob.js +60 -0
- package/dist/glob.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/intentset.d.ts +3 -0
- package/dist/intentset.d.ts.map +1 -0
- package/dist/intentset.js +15 -0
- package/dist/intentset.js.map +1 -0
- package/dist/main.d.ts +5 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +406 -0
- package/dist/main.js.map +1 -0
- package/dist/output.d.ts +38 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +53 -0
- package/dist/output.js.map +1 -0
- package/dist/outputs.d.ts +17 -0
- package/dist/outputs.d.ts.map +1 -0
- package/dist/outputs.js +70 -0
- package/dist/outputs.js.map +1 -0
- package/dist/reports.d.ts +16 -0
- package/dist/reports.d.ts.map +1 -0
- package/dist/reports.js +89 -0
- package/dist/reports.js.map +1 -0
- package/dist/repository.d.ts +56 -0
- package/dist/repository.d.ts.map +1 -0
- package/dist/repository.js +191 -0
- package/dist/repository.js.map +1 -0
- package/dist/session.d.ts +61 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +202 -0
- package/dist/session.js.map +1 -0
- package/dist/tree.d.ts +15 -0
- package/dist/tree.d.ts.map +1 -0
- package/dist/tree.js +56 -0
- package/dist/tree.js.map +1 -0
- package/package.json +46 -0
- package/src/commands/architecture.ts +77 -0
- package/src/commands/context.ts +142 -0
- package/src/commands/evidence.ts +180 -0
- package/src/commands/graph.ts +89 -0
- package/src/commands/impact.ts +97 -0
- package/src/commands/init.ts +138 -0
- package/src/commands/mcp.ts +143 -0
- package/src/commands/publish.ts +119 -0
- package/src/commands/review.ts +155 -0
- package/src/commands/serve.ts +261 -0
- package/src/commands/shared.ts +46 -0
- package/src/commands/validate.ts +39 -0
- package/src/git.ts +81 -0
- package/src/glob.ts +58 -0
- package/src/index.ts +8 -0
- package/src/intentset.ts +15 -0
- package/src/main.ts +408 -0
- package/src/output.ts +78 -0
- package/src/outputs.ts +65 -0
- package/src/reports.ts +103 -0
- package/src/repository.ts +220 -0
- package/src/session.ts +276 -0
- package/src/tree.ts +64 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `intentset impact <ID>` (Core §10): what depends on an artifact. Direct
|
|
3
|
+
* dependents apart from candidates further downstream, each with the path
|
|
4
|
+
* that reached it and a reason per step; the start's own rules, contracts and
|
|
5
|
+
* decisions as review context; navigation ancestors. Every report names its
|
|
6
|
+
* snapshot and says that reachability is not proof. Never writes.
|
|
7
|
+
*/
|
|
8
|
+
import { impact } from "@intentset/core";
|
|
9
|
+
import { formatDiagnostic, json, snapshotLine, TOOL } from "../output.js";
|
|
10
|
+
import { unresolved, validationLine, validationSummary } from "./shared.js";
|
|
11
|
+
export const REACHABILITY_NOTE = "Reachability through authored links marks an artifact for review; it is not proof that runtime behavior changed (Core §10).";
|
|
12
|
+
export function impactCommand(session, id, asJson, io) {
|
|
13
|
+
const { graph } = session.result;
|
|
14
|
+
const level = session.level;
|
|
15
|
+
const start = graph.artifacts.get(id);
|
|
16
|
+
if (start === undefined) {
|
|
17
|
+
const diagnostic = unresolved(id, session);
|
|
18
|
+
if (asJson) {
|
|
19
|
+
io.stdout(json({
|
|
20
|
+
tool: TOOL,
|
|
21
|
+
snapshot: session.snapshot,
|
|
22
|
+
validation: validationSummary(session, level),
|
|
23
|
+
start: null,
|
|
24
|
+
diagnostics: [diagnostic],
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
io.stderr(formatDiagnostic(diagnostic));
|
|
29
|
+
}
|
|
30
|
+
return 1;
|
|
31
|
+
}
|
|
32
|
+
const report = impact(graph, id);
|
|
33
|
+
if (asJson) {
|
|
34
|
+
io.stdout(json({
|
|
35
|
+
tool: TOOL,
|
|
36
|
+
snapshot: session.snapshot,
|
|
37
|
+
validation: validationSummary(session, level),
|
|
38
|
+
note: REACHABILITY_NOTE,
|
|
39
|
+
start: { id, type: start.meta.type, title: start.meta.title, path: start.path },
|
|
40
|
+
direct: report.direct,
|
|
41
|
+
candidates: report.candidates,
|
|
42
|
+
context: report.context,
|
|
43
|
+
ancestors: report.ancestors,
|
|
44
|
+
diagnostics: [],
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
io.stdout(renderImpact(report, session, level, `${start.meta.type} "${start.meta.title}"`));
|
|
49
|
+
}
|
|
50
|
+
return session.result.ok ? 0 : 1;
|
|
51
|
+
}
|
|
52
|
+
function renderImpact(report, session, level, described) {
|
|
53
|
+
const lines = [
|
|
54
|
+
`Impact of ${report.start}, ${described}`,
|
|
55
|
+
snapshotLine(session.snapshot),
|
|
56
|
+
validationLine(session, level),
|
|
57
|
+
REACHABILITY_NOTE,
|
|
58
|
+
"",
|
|
59
|
+
];
|
|
60
|
+
const section = (title, gloss, hits) => {
|
|
61
|
+
lines.push(`${title} (${hits.length}): ${gloss}`);
|
|
62
|
+
if (hits.length === 0)
|
|
63
|
+
lines.push(" none");
|
|
64
|
+
for (const hit of hits) {
|
|
65
|
+
lines.push(` ${hit.id} ${hit.type} ${hit.title}`);
|
|
66
|
+
lines.push(` path: ${pathText(report.start, hit)}`);
|
|
67
|
+
lines.push(` reason: ${hit.path.map((step) => step.reason).join(" ")}`);
|
|
68
|
+
}
|
|
69
|
+
lines.push("");
|
|
70
|
+
};
|
|
71
|
+
section("Direct", "one link from the start", report.direct);
|
|
72
|
+
section("Candidates", "reachable beyond the direct set, for review", report.candidates);
|
|
73
|
+
section("Review context", "the start's own rules, contracts and decisions", report.context);
|
|
74
|
+
lines.push(`Ancestors: ${report.ancestors.length === 0 ? "none" : report.ancestors.join(" > ")}`);
|
|
75
|
+
return `${lines.join("\n")}\n`;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A hit's path as authored edges, written in the direction they were authored.
|
|
79
|
+
* A reverse step (`kind←`) is an edge from the step to the node before it, so
|
|
80
|
+
* a chain reads from the hit back to the start: `C --dependsOn--> B --implements--> A`.
|
|
81
|
+
* A context step (`kind→`) is an edge from the start to the hit.
|
|
82
|
+
*/
|
|
83
|
+
export function pathText(start, hit) {
|
|
84
|
+
const forward = hit.path.length === 1 && hit.path[0].via.endsWith("→");
|
|
85
|
+
if (forward)
|
|
86
|
+
return `${start} --${hit.path[0].via.slice(0, -1)}--> ${hit.id}`;
|
|
87
|
+
let text = start;
|
|
88
|
+
for (const step of hit.path)
|
|
89
|
+
text = `${step.id} --${step.via.slice(0, -1)}--> ${text}`;
|
|
90
|
+
return text;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=impact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impact.js","sourceRoot":"","sources":["../../src/commands/impact.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAqC,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAW,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEnF,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE5E,MAAM,CAAC,MAAM,iBAAiB,GAC5B,6HAA6H,CAAC;AAEhI,MAAM,UAAU,aAAa,CAAC,OAAgB,EAAE,EAAU,EAAE,MAAe,EAAE,EAAM;IACjF,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IACjC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC5B,MAAM,KAAK,GAA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,IAAI,EAAE,CAAC;IACvF,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Io } from "../output.ts";
|
|
2
|
+
export declare const REGISTRIES_PATH = ".intentset/registries.yaml";
|
|
3
|
+
export declare const DEFAULT_INIT_SCOPE = "product/**/*.md";
|
|
4
|
+
export interface InitOptions {
|
|
5
|
+
root?: string;
|
|
6
|
+
repository?: string;
|
|
7
|
+
example: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function configText(repository: string): string;
|
|
10
|
+
export declare const EMPTY_REGISTRIES_TEXT: string;
|
|
11
|
+
/**
|
|
12
|
+
* The scheduling example: this repository's own copy when running from a
|
|
13
|
+
* checkout, otherwise the one @intentset/conformance-suite ships. Null when
|
|
14
|
+
* neither is present.
|
|
15
|
+
*/
|
|
16
|
+
export declare function exampleDir(): Promise<string | null>;
|
|
17
|
+
export declare function initCommand(options: InitOptions, io: Io): Promise<number>;
|
|
18
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAGvC,eAAO,MAAM,eAAe,+BAA+B,CAAC;AAC5D,eAAO,MAAM,kBAAkB,oBAAoB,CAAC;AAGpD,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;CAClB;AAOD,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAarD;AAED,eAAO,MAAM,qBAAqB,QAYtB,CAAC;AAEb;;;;GAIG;AACH,wBAAsB,UAAU,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CASzD;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA6D/E"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `intentset init`: the one command that writes, and it only creates. It
|
|
3
|
+
* writes `.intentset/config.yaml` and an empty-but-valid
|
|
4
|
+
* `.intentset/registries.yaml`, and with `--example` the scheduling example's
|
|
5
|
+
* records under `product/scheduling/` and its registries in place of the
|
|
6
|
+
* empty ones. Every target is checked before anything is written, and each
|
|
7
|
+
* file is opened with exclusive create, so an existing file is never
|
|
8
|
+
* overwritten, not even by a race.
|
|
9
|
+
*/
|
|
10
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
11
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
12
|
+
import { fileURLToPath } from "node:url";
|
|
13
|
+
import { compareStrings, DEFAULT_IGNORE, readConfig, readRegistries } from "@intentset/core";
|
|
14
|
+
import { CONFIG_PATH } from "../repository.js";
|
|
15
|
+
export const REGISTRIES_PATH = ".intentset/registries.yaml";
|
|
16
|
+
export const DEFAULT_INIT_SCOPE = "product/**/*.md";
|
|
17
|
+
const EXAMPLE_TARGET = "product/scheduling";
|
|
18
|
+
/** YAML double-quoted scalar; the strict reader takes JSON's escapes. */
|
|
19
|
+
function quote(value) {
|
|
20
|
+
return JSON.stringify(value);
|
|
21
|
+
}
|
|
22
|
+
export function configText(repository) {
|
|
23
|
+
return [
|
|
24
|
+
"# Intentset configuration (Core §11): the repository scope a conformance claim is about.",
|
|
25
|
+
"# Written by `intentset init`. Patterns are repository-relative: literal segments, * within",
|
|
26
|
+
"# one segment, ** across segments.",
|
|
27
|
+
`repository: ${quote(repository)}`,
|
|
28
|
+
"scope:",
|
|
29
|
+
` - ${quote(DEFAULT_INIT_SCOPE)}`,
|
|
30
|
+
`registries: ${quote(REGISTRIES_PATH)}`,
|
|
31
|
+
"ignore:",
|
|
32
|
+
...DEFAULT_IGNORE.map((pattern) => ` - ${quote(pattern)}`),
|
|
33
|
+
"",
|
|
34
|
+
].join("\n");
|
|
35
|
+
}
|
|
36
|
+
export const EMPTY_REGISTRIES_TEXT = [
|
|
37
|
+
"# Intentset registries (Core §4, §7; VSA §3): the owners, audiences, release dimensions",
|
|
38
|
+
"# and shared resources records may name. An empty registry reads as not declared, and",
|
|
39
|
+
"# validate warns (CORE005) when a record names a value it could not check.",
|
|
40
|
+
"owners: []",
|
|
41
|
+
"audiences: []",
|
|
42
|
+
"releases: []",
|
|
43
|
+
"roles: []",
|
|
44
|
+
"editions: []",
|
|
45
|
+
"flags: []",
|
|
46
|
+
"resources: []",
|
|
47
|
+
"",
|
|
48
|
+
].join("\n");
|
|
49
|
+
/**
|
|
50
|
+
* The scheduling example: this repository's own copy when running from a
|
|
51
|
+
* checkout, otherwise the one @intentset/conformance-suite ships. Null when
|
|
52
|
+
* neither is present.
|
|
53
|
+
*/
|
|
54
|
+
export async function exampleDir() {
|
|
55
|
+
const candidates = [fileURLToPath(new URL("../../../../examples/scheduling/", import.meta.url))];
|
|
56
|
+
try {
|
|
57
|
+
const suite = (await import("@intentset/conformance-suite"));
|
|
58
|
+
if (typeof suite.examplesPath === "string")
|
|
59
|
+
candidates.push(join(suite.examplesPath, "scheduling"));
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
// Not installed: the checkout's copy is the only candidate.
|
|
63
|
+
}
|
|
64
|
+
return candidates.find((dir) => existsSync(join(dir, "registries.yaml"))) ?? null;
|
|
65
|
+
}
|
|
66
|
+
export async function initCommand(options, io) {
|
|
67
|
+
const root = resolve(io.cwd, options.root ?? ".");
|
|
68
|
+
const repository = options.repository ?? basename(root);
|
|
69
|
+
if (repository.trim() === "" || /[\r\n]/.test(repository)) {
|
|
70
|
+
io.stderr("intentset init: --repository must be a non-empty name on one line, such as org/name.\n");
|
|
71
|
+
return 2;
|
|
72
|
+
}
|
|
73
|
+
// Everything to write, decided before anything is written.
|
|
74
|
+
const files = new Map([[CONFIG_PATH, configText(repository)]]);
|
|
75
|
+
let registries = EMPTY_REGISTRIES_TEXT;
|
|
76
|
+
if (options.example) {
|
|
77
|
+
const dir = await exampleDir();
|
|
78
|
+
if (dir === null) {
|
|
79
|
+
io.stderr("intentset init: --example needs the scheduling example, which is in an Intentset checkout under\n" +
|
|
80
|
+
"examples/scheduling and in the @intentset/conformance-suite package. Neither was found; install\n" +
|
|
81
|
+
"@intentset/conformance-suite beside @intentset/cli, or run init without --example.\n");
|
|
82
|
+
return 2;
|
|
83
|
+
}
|
|
84
|
+
registries = readFileSync(join(dir, "registries.yaml"), "utf8");
|
|
85
|
+
for (const name of readdirSync(dir)
|
|
86
|
+
.filter((n) => n.endsWith(".md"))
|
|
87
|
+
.sort(compareStrings)) {
|
|
88
|
+
files.set(`${EXAMPLE_TARGET}/${name}`, readFileSync(join(dir, name), "utf8"));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
files.set(REGISTRIES_PATH, registries);
|
|
92
|
+
// What init writes must read back clean, or it has handed the user a broken repository.
|
|
93
|
+
const config = readConfig(files.get(CONFIG_PATH), CONFIG_PATH);
|
|
94
|
+
const registry = readRegistries(registries, REGISTRIES_PATH);
|
|
95
|
+
if (config.diagnostics.length > 0 || registry.diagnostics.length > 0) {
|
|
96
|
+
io.stderr("intentset init: the files it would write do not read back clean; nothing was written.\n");
|
|
97
|
+
return 2;
|
|
98
|
+
}
|
|
99
|
+
const ordered = [...files.keys()].sort(compareStrings);
|
|
100
|
+
const existing = ordered.filter((path) => existsSync(join(root, path)));
|
|
101
|
+
if (existing.length > 0) {
|
|
102
|
+
io.stderr(`intentset init: refusing to overwrite ${existing.join(", ")}; init only creates files.\n` +
|
|
103
|
+
"Remove them first if a fresh start is what you want.\n");
|
|
104
|
+
return 2;
|
|
105
|
+
}
|
|
106
|
+
for (const path of ordered) {
|
|
107
|
+
const target = join(root, path);
|
|
108
|
+
try {
|
|
109
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
110
|
+
writeFileSync(target, files.get(path), { flag: "wx" });
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
io.stderr(`intentset init: could not create ${path}: ${error.message}\n`);
|
|
114
|
+
return 2;
|
|
115
|
+
}
|
|
116
|
+
io.stdout(`created ${path}\n`);
|
|
117
|
+
}
|
|
118
|
+
const scope = options.example ? `${files.size - 2} example records in scope` : "an empty scope";
|
|
119
|
+
io.stdout(`Initialized ${quote(repository)} with ${scope}. Next: intentset validate\n`);
|
|
120
|
+
return 0;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE7F,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,CAAC,MAAM,eAAe,GAAG,4BAA4B,CAAC;AAC5D,MAAM,CAAC,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AACpD,MAAM,cAAc,GAAG,oBAAoB,CAAC;AAQ5C,yEAAyE;AACzE,SAAS,KAAK,CAAC,KAAa;IAC1B,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,UAAkB;IAC3C,OAAO;QACL,0FAA0F;QAC1F,6FAA6F;QAC7F,oCAAoC;QACpC,eAAe,KAAK,C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AAC;YACf,EAAE,CAAC,MAAM,CAAC,oCAAoC,IAAI,KAAM,KAAe,CAAC,OAAO,IAAI,CAAC,CAAC;YACrF,OAAO,CAAC,CAAC;QACX,CAAC;QACD,EAAE,CAAC,MAAM,CAAC,WAAW,IAAI,IAAI,CAAC,CAAC;IACjC,CAAC;IACD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,GAAG,CAAC,2BAA2B,CAAC,CAAC,CAAC,gBAAgB,CAAC;IAChG,EAAE,CAAC,MAAM,CAAC,eAAe,KAAK,CAAC,UAAU,CAAC,SAAS,KAAK,8BAA8B,CAAC,CAAC;IACxF,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createIntentsetServer } from "@intentset/mcp";
|
|
2
|
+
import { type Io } from "../output.ts";
|
|
3
|
+
import { type SessionOptions } from "../session.ts";
|
|
4
|
+
export type McpServer = ReturnType<typeof createIntentsetServer>;
|
|
5
|
+
export interface McpOptions {
|
|
6
|
+
mode?: string;
|
|
7
|
+
includeRestricted: boolean;
|
|
8
|
+
visibility?: string;
|
|
9
|
+
audience?: string;
|
|
10
|
+
product?: string;
|
|
11
|
+
release?: string;
|
|
12
|
+
role?: string;
|
|
13
|
+
edition?: string;
|
|
14
|
+
flags: string[];
|
|
15
|
+
authorizedInternal: boolean;
|
|
16
|
+
authorizedRestricted: boolean;
|
|
17
|
+
publishedAt?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const MCP_MODES: readonly ["engineering", "customer"];
|
|
20
|
+
export declare function mcpUsageProblem(options: McpOptions): string | null;
|
|
21
|
+
/** The server the command would run, or the exit code after saying why there is none. Writes only to stderr. */
|
|
22
|
+
export declare function buildMcpServer(options: McpOptions, sessionOptions: SessionOptions, io: Io): McpServer | number;
|
|
23
|
+
export declare function mcpCommand(options: McpOptions, sessionOptions: SessionOptions, io: Io): Promise<number>;
|
|
24
|
+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|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `intentset mcp` (Core §10): the read-only MCP server over stdio, in the
|
|
3
|
+
* mode the operator chooses here and no client can change.
|
|
4
|
+
*
|
|
5
|
+
* engineering the validated graph: lookup, context, impact and search,
|
|
6
|
+
* every result naming the snapshot and its source paths
|
|
7
|
+
* customer a publication made in memory exactly as `publish` makes
|
|
8
|
+
* one, and its retrieval chunks; the server is never given
|
|
9
|
+
* the graph, so it has no engineering record to leak
|
|
10
|
+
*
|
|
11
|
+
* stdout carries the protocol and nothing else: the startup line and every
|
|
12
|
+
* diagnostic go to stderr. A customer request that the publisher refuses,
|
|
13
|
+
* or a graph that does not validate, stops before any server starts.
|
|
14
|
+
*/
|
|
15
|
+
import { sortDiagnostics } from "@intentset/core";
|
|
16
|
+
import { createIntentsetServer, runStdio } from "@intentset/mcp";
|
|
17
|
+
import { publish, toChunks } from "@intentset/publisher";
|
|
18
|
+
import { count, formatDiagnostic, snapshotLine } from "../output.js";
|
|
19
|
+
import { openSession } from "../session.js";
|
|
20
|
+
export const MCP_MODES = ["engineering", "customer"];
|
|
21
|
+
export function mcpUsageProblem(options) {
|
|
22
|
+
if (options.mode === undefined || !MCP_MODES.includes(options.mode)) {
|
|
23
|
+
return `--mode ${options.mode ?? "(missing)"}: the modes are engineering and customer, and one must be chosen`;
|
|
24
|
+
}
|
|
25
|
+
const request = [
|
|
26
|
+
options.visibility,
|
|
27
|
+
options.audience,
|
|
28
|
+
options.product,
|
|
29
|
+
options.release,
|
|
30
|
+
options.role,
|
|
31
|
+
options.edition,
|
|
32
|
+
].some((value) => value !== undefined);
|
|
33
|
+
if (options.mode === "engineering" && (request || options.flags.length > 0)) {
|
|
34
|
+
return "publication request options belong to --mode customer";
|
|
35
|
+
}
|
|
36
|
+
if (options.mode === "customer") {
|
|
37
|
+
if (options.includeRestricted)
|
|
38
|
+
return "--include-restricted belongs to --mode engineering";
|
|
39
|
+
if (options.visibility !== undefined && options.visibility !== "public" && options.visibility !== "customer") {
|
|
40
|
+
return `--visibility ${options.visibility}: customer mode serves a public or customer projection only`;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
/** The server the command would run, or the exit code after saying why there is none. Writes only to stderr. */
|
|
46
|
+
export function buildMcpServer(options, sessionOptions, io) {
|
|
47
|
+
const session = openSession("mcp", sessionOptions, io);
|
|
48
|
+
if (typeof session === "number")
|
|
49
|
+
return session;
|
|
50
|
+
const { result, snapshot, repo } = session;
|
|
51
|
+
const summary = `${count(result.graph.artifacts.size, "artifact")}, ${count(session.errors, "error")}, ${count(session.warnings, "warning")} at ${session.level}`;
|
|
52
|
+
if (options.mode === "engineering") {
|
|
53
|
+
if (!result.ok) {
|
|
54
|
+
io.stderr(`intentset mcp: validation has ${count(session.errors, "error")}; results may be incomplete.\n`);
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
const server = createIntentsetServer({
|
|
58
|
+
mode: "engineering",
|
|
59
|
+
graph: result.graph,
|
|
60
|
+
snapshot: { commit: snapshot.commit, graphHash: snapshot.graphHash },
|
|
61
|
+
includeRestricted: options.includeRestricted,
|
|
62
|
+
});
|
|
63
|
+
io.stderr(`intentset mcp: engineering context for ${repo.config.repository} over stdio (${summary}${options.includeRestricted ? ", restricted records included" : ", restricted records withheld"}). ${snapshotLine(snapshot)}\n`);
|
|
64
|
+
return server;
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
io.stderr(`intentset mcp: ${error.message}\n`);
|
|
68
|
+
return 2;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (!result.ok) {
|
|
72
|
+
for (const d of session.diagnostics)
|
|
73
|
+
io.stderr(formatDiagnostic(d));
|
|
74
|
+
io.stderr(`intentset mcp: refused: validation has ${count(session.errors, "error")}, so nothing is published.\n`);
|
|
75
|
+
return 1;
|
|
76
|
+
}
|
|
77
|
+
const request = {
|
|
78
|
+
visibility: options.visibility,
|
|
79
|
+
audience: options.audience,
|
|
80
|
+
product: options.product,
|
|
81
|
+
release: options.release,
|
|
82
|
+
role: options.role,
|
|
83
|
+
edition: options.edition,
|
|
84
|
+
flags: options.flags,
|
|
85
|
+
authorizedInternal: options.authorizedInternal,
|
|
86
|
+
authorizedRestricted: options.authorizedRestricted,
|
|
87
|
+
};
|
|
88
|
+
const published = publish(result.graph, repo.registries, request, {
|
|
89
|
+
snapshot: { commit: snapshot.commit, graphHash: snapshot.graphHash },
|
|
90
|
+
publishedAt: options.publishedAt ?? new Date().toISOString(),
|
|
91
|
+
});
|
|
92
|
+
for (const d of sortDiagnostics(published.diagnostics))
|
|
93
|
+
io.stderr(formatDiagnostic(d));
|
|
94
|
+
if (published.index.request === null) {
|
|
95
|
+
io.stderr("intentset mcp: refused: the publisher refused the request, so there is nothing to serve.\n");
|
|
96
|
+
return 1;
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
const documents = published.documents;
|
|
100
|
+
const server = createIntentsetServer({
|
|
101
|
+
mode: "customer",
|
|
102
|
+
publication: { documents, index: published.index },
|
|
103
|
+
chunks: toChunks(documents),
|
|
104
|
+
});
|
|
105
|
+
const r = published.index.request;
|
|
106
|
+
io.stderr(`intentset mcp: customer knowledge over stdio: ${count(documents.length, "published document")} for a ${r.visibility} projection, audience ${r.audience}, ${r.product} ${r.release}. ${snapshotLine(snapshot)}\n`);
|
|
107
|
+
return server;
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
io.stderr(`intentset mcp: ${error.message}\n`);
|
|
111
|
+
return 2;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
export async function mcpCommand(options, sessionOptions, io) {
|
|
115
|
+
const server = buildMcpServer(options, sessionOptions, io);
|
|
116
|
+
if (typeof server === "number")
|
|
117
|
+
return server;
|
|
118
|
+
io.signal?.addEventListener("abort", () => void server.close(), { once: true });
|
|
119
|
+
await runStdio(server);
|
|
120
|
+
return 0;
|
|
121
|
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CAAC;QAC1D,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAAmB,EAAE,cAA8B,EAAE,EAAM;IAC1F,MAAM,MAAM,GAAG,cAAc,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,CAAC,CAAC;IAC3D,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC;IAC9C,EAAE,CAAC,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,MAAM,CAAC,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAChF,MAAM,QAAQ,CAAC,MAAM,CAAC,CAAC;IACvB,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type Io } from "../output.ts";
|
|
2
|
+
import type { Session } from "../session.ts";
|
|
3
|
+
export interface PublishCliOptions {
|
|
4
|
+
visibility?: string;
|
|
5
|
+
audience?: string;
|
|
6
|
+
product?: string;
|
|
7
|
+
release?: string;
|
|
8
|
+
role?: string;
|
|
9
|
+
edition?: string;
|
|
10
|
+
flags: string[];
|
|
11
|
+
authorizedInternal: boolean;
|
|
12
|
+
authorizedRestricted: boolean;
|
|
13
|
+
out?: string;
|
|
14
|
+
html: boolean;
|
|
15
|
+
publishedAt?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function publishUsageProblem(options: PublishCliOptions): string | null;
|
|
18
|
+
export declare function publishCommand(session: Session, options: PublishCliOptions, io: Io): number;
|
|
19
|
+
//# sourceMappingURL=publish.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../src/commands/publish.ts"],"names":[],"mappings":"AAcA,OAAO,EAA2B,KAAK,EAAE,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAM7E;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,EAAE,EAAE,EAAE,GAAG,MAAM,CA2E3F"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `intentset publish` (Core §9): the deny-by-default projection of reviewed
|
|
3
|
+
* knowledge for one audience, release and entitlement, as generated Markset
|
|
4
|
+
* with provenance, optional HTML, the index a customer tool may read, and
|
|
5
|
+
* retrieval chunks that carry the same filters. Refuses outright when the
|
|
6
|
+
* graph does not validate. Review pins are read as written: a real pin is a
|
|
7
|
+
* literal hash, and the fixtures' `@current` is never bound here, so an
|
|
8
|
+
* unbound one reads as changed. Writes only into the --out directory, which
|
|
9
|
+
* must be new or empty and outside the documents' scope.
|
|
10
|
+
*/
|
|
11
|
+
import { existsSync, mkdirSync, readdirSync, writeFileSync } from "node:fs";
|
|
12
|
+
import { join, resolve } from "node:path";
|
|
13
|
+
import { sortDiagnostics } from "@intentset/core";
|
|
14
|
+
import { publish, toChunks } from "@intentset/publisher";
|
|
15
|
+
import { count, formatDiagnostic } from "../output.js";
|
|
16
|
+
import { outputDirProblem, outputProblem } from "../outputs.js";
|
|
17
|
+
const ISO_8601 = /^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(?:\.[0-9]+)?(?:Z|[+-][0-9]{2}:[0-9]{2})$/;
|
|
18
|
+
export function publishUsageProblem(options) {
|
|
19
|
+
if (options.out === undefined || options.out === "")
|
|
20
|
+
return "--out <dir> is required";
|
|
21
|
+
if (options.publishedAt !== undefined && !ISO_8601.test(options.publishedAt)) {
|
|
22
|
+
return `--published-at ${options.publishedAt}: give an ISO 8601 time such as 2026-10-02T12:00:00Z`;
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
export function publishCommand(session, options, io) {
|
|
27
|
+
const fail = (message) => {
|
|
28
|
+
io.stderr(`intentset publish: ${message}\n`);
|
|
29
|
+
return 2;
|
|
30
|
+
};
|
|
31
|
+
const { repo, result, snapshot } = session;
|
|
32
|
+
if (!result.ok) {
|
|
33
|
+
for (const d of session.diagnostics)
|
|
34
|
+
io.stdout(formatDiagnostic(d));
|
|
35
|
+
io.stderr(`intentset publish: refused: validation at ${session.level} has ${count(session.errors, "error")}, and nothing is published from a graph that does not validate.\n`);
|
|
36
|
+
return 1;
|
|
37
|
+
}
|
|
38
|
+
const dir = resolve(io.cwd, options.out);
|
|
39
|
+
if (existsSync(dir) && readdirSync(dir).length > 0) {
|
|
40
|
+
return fail(`--out ${options.out} is not empty; publish into a new or empty directory so nothing stale survives.`);
|
|
41
|
+
}
|
|
42
|
+
const where = outputDirProblem(repo, dir);
|
|
43
|
+
if (where !== null)
|
|
44
|
+
return fail(`--out ${options.out} ${where}.`);
|
|
45
|
+
// The request exactly as given: a dimension left out stays out, and the publisher refuses it (no implicit wildcard).
|
|
46
|
+
const request = {
|
|
47
|
+
visibility: options.visibility,
|
|
48
|
+
audience: options.audience,
|
|
49
|
+
product: options.product,
|
|
50
|
+
release: options.release,
|
|
51
|
+
role: options.role,
|
|
52
|
+
edition: options.edition,
|
|
53
|
+
flags: options.flags,
|
|
54
|
+
authorizedInternal: options.authorizedInternal,
|
|
55
|
+
authorizedRestricted: options.authorizedRestricted,
|
|
56
|
+
};
|
|
57
|
+
const published = publish(result.graph, repo.registries, request, {
|
|
58
|
+
snapshot: { commit: snapshot.commit, graphHash: snapshot.graphHash },
|
|
59
|
+
publishedAt: options.publishedAt ?? new Date().toISOString(),
|
|
60
|
+
renderHtml: options.html,
|
|
61
|
+
});
|
|
62
|
+
const outputs = new Map();
|
|
63
|
+
if (published.index.request !== null) {
|
|
64
|
+
for (const document of published.documents) {
|
|
65
|
+
outputs.set(`${document.id}.md`, document.markset);
|
|
66
|
+
if (document.html !== undefined)
|
|
67
|
+
outputs.set(`${document.id}.html`, document.html);
|
|
68
|
+
}
|
|
69
|
+
outputs.set("index.json", `${JSON.stringify(published.index, null, 2)}\n`);
|
|
70
|
+
const chunks = toChunks(published.documents);
|
|
71
|
+
outputs.set("chunks.jsonl", chunks.map((chunk) => `${JSON.stringify(chunk)}\n`).join(""));
|
|
72
|
+
}
|
|
73
|
+
for (const name of outputs.keys()) {
|
|
74
|
+
const problem = outputProblem(repo, join(dir, name));
|
|
75
|
+
if (problem !== null)
|
|
76
|
+
return fail(`--out ${options.out}: ${name} ${problem}; nothing was written.`);
|
|
77
|
+
}
|
|
78
|
+
if (outputs.size > 0)
|
|
79
|
+
mkdirSync(dir, { recursive: true });
|
|
80
|
+
for (const [name, text] of outputs)
|
|
81
|
+
writeFileSync(join(dir, name), text, { flag: "wx" });
|
|
82
|
+
for (const d of sortDiagnostics(published.diagnostics))
|
|
83
|
+
io.stdout(formatDiagnostic(d));
|
|
84
|
+
const index = published.index;
|
|
85
|
+
const lines = [];
|
|
86
|
+
if (index.request === null) {
|
|
87
|
+
lines.push("The request was refused, so nothing was projected and nothing was written.");
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
const r = index.request;
|
|
91
|
+
lines.push(`Published ${count(index.published.length, "document")} for a ${r.visibility} projection: audience ${r.audience}, ${r.product} ${r.release}, role ${r.role}, edition ${r.edition}, flags ${r.flags.length === 0 ? "none" : r.flags.join(", ")}`, ...index.published.map((id) => ` ${id}`));
|
|
92
|
+
const reasons = Object.keys(index.excludedCounts);
|
|
93
|
+
lines.push(`Excluded, among what this projection may see (${reasons.length === 0 ? "none" : reasons.map((reason) => `${reason} ${index.excludedCounts[reason]}`).join(", ")})`, `Snapshot: ${snapshot.commit === null ? `no commit (${snapshot.commitUnavailable})` : `commit ${snapshot.commit}`}, graph ${snapshot.graphHash}`, `Wrote ${[...outputs.keys()].map((name) => join(options.out, name)).join(", ")}`);
|
|
94
|
+
}
|
|
95
|
+
io.stdout(`${lines.join("\n")}\n`);
|
|
96
|
+
return published.ok ? 0 : 1;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=publish.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../../src/commands/publish.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAmB,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAA2B,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAW,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAkBhE,MAAM,QAAQ,GAAG,iGAAiG,CAAC;AAEnH,MAAM,UAAU,mBAAmB,CAAC,OAA0B;IAC5D,IAAI,OAAO,CAAC,GAAG,KAAK,SAAS,IAAI,OAAO,CAAC,GAAG,KAAK,EAAE;QA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E,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAa,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC3F,CAAC;IACJ,CAAC;IACD,EAAE,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnC,OAAO,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `intentset review` (Core §10): the local review report. Validation at the
|
|
3
|
+
* highest level the inputs allow (L2 always; L4 when run records are given
|
|
4
|
+
* or found, since L3's evidence is the only input L4 needs beyond it), the
|
|
5
|
+
* architecture summary, coverage, and the impact of the change: every file
|
|
6
|
+
* changed since the base, committed or not, mapped to the artifacts it
|
|
7
|
+
* touches, a changed record to its own artifact and a changed source file
|
|
8
|
+
* through the claiming slice to that slice's behaviors, each start's direct
|
|
9
|
+
* dependents shown apart from its candidates. Markdown by default. Read-only.
|
|
10
|
+
*/
|
|
11
|
+
import { type Graph } from "@intentset/core";
|
|
12
|
+
import { type Io } from "../output.ts";
|
|
13
|
+
import type { Session } from "../session.ts";
|
|
14
|
+
export interface Attribution {
|
|
15
|
+
/** The artifact impact starts from. */
|
|
16
|
+
start: string;
|
|
17
|
+
/** The changed files that led to it, and how. */
|
|
18
|
+
because: string[];
|
|
19
|
+
}
|
|
20
|
+
/** Map changed files to impact starts. A path that is a record names its artifact; a claimed source file names the claiming slices' behaviors. */
|
|
21
|
+
export declare function attribute(graph: Graph, changed: readonly string[]): {
|
|
22
|
+
starts: Attribution[];
|
|
23
|
+
unattributed: string[];
|
|
24
|
+
};
|
|
25
|
+
export declare function reviewCommand(session: Session, options: {
|
|
26
|
+
base?: string;
|
|
27
|
+
levelReason: string;
|
|
28
|
+
}, asJson: boolean, io: Io): number;
|
|
29
|
+
//# sourceMappingURL=review.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../../src/commands/review.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,KAAK,KAAK,EAA0B,MAAM,iBAAiB,CAAC;AAGrE,OAAO,EAA2B,KAAK,EAAE,EAA4B,MAAM,cAAc,CAAC;AAE1F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG7C,MAAM,WAAW,WAAW;IAC1B,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,kJAAkJ;AAClJ,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG;IAAE,MAAM,EAAE,WAAW,EAAE,CAAC;IAAC,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,CAoCrH;AAED,wBAAgB,aAAa,CAC3B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,EAC/C,MAAM,EAAE,OAAO,EACf,EAAE,EAAE,EAAE,GACL,MAAM,CAqFR"}
|