@agent-teams/docs-protocol 0.0.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/CHANGELOG.md +7 -0
- package/LICENSE +201 -0
- package/README.md +92 -0
- package/dist/adapters/adoption-input.d.ts +9 -0
- package/dist/adapters/adoption-input.d.ts.map +1 -0
- package/dist/adapters/adoption-input.js +72 -0
- package/dist/adapters/adoption-input.js.map +1 -0
- package/dist/adapters/adoption-package-identity.d.ts +7 -0
- package/dist/adapters/adoption-package-identity.d.ts.map +1 -0
- package/dist/adapters/adoption-package-identity.js +69 -0
- package/dist/adapters/adoption-package-identity.js.map +1 -0
- package/dist/adapters/docs-command-envelope-schema-validator.d.ts +2 -0
- package/dist/adapters/docs-command-envelope-schema-validator.d.ts.map +1 -0
- package/dist/adapters/docs-command-envelope-schema-validator.js +24 -0
- package/dist/adapters/docs-command-envelope-schema-validator.js.map +1 -0
- package/dist/adapters/docs-profile-schema-validator.d.ts +2 -0
- package/dist/adapters/docs-profile-schema-validator.d.ts.map +1 -0
- package/dist/adapters/docs-profile-schema-validator.js +28 -0
- package/dist/adapters/docs-profile-schema-validator.js.map +1 -0
- package/dist/adapters/foundation-docs-port.d.ts +12 -0
- package/dist/adapters/foundation-docs-port.d.ts.map +1 -0
- package/dist/adapters/foundation-docs-port.js +108 -0
- package/dist/adapters/foundation-docs-port.js.map +1 -0
- package/dist/adapters/node-adoption-inspector.d.ts +5 -0
- package/dist/adapters/node-adoption-inspector.d.ts.map +1 -0
- package/dist/adapters/node-adoption-inspector.js +102 -0
- package/dist/adapters/node-adoption-inspector.js.map +1 -0
- package/dist/adapters/node-code-anchor-matcher.d.ts +5 -0
- package/dist/adapters/node-code-anchor-matcher.d.ts.map +1 -0
- package/dist/adapters/node-code-anchor-matcher.js +65 -0
- package/dist/adapters/node-code-anchor-matcher.js.map +1 -0
- package/dist/adapters/node-profile-reader.d.ts +9 -0
- package/dist/adapters/node-profile-reader.d.ts.map +1 -0
- package/dist/adapters/node-profile-reader.js +118 -0
- package/dist/adapters/node-profile-reader.js.map +1 -0
- package/dist/application/authority-handshake.d.ts +14 -0
- package/dist/application/authority-handshake.d.ts.map +1 -0
- package/dist/application/authority-handshake.js +15 -0
- package/dist/application/authority-handshake.js.map +1 -0
- package/dist/application/docs-new-completion.d.ts +33 -0
- package/dist/application/docs-new-completion.d.ts.map +1 -0
- package/dist/application/docs-new-completion.js +226 -0
- package/dist/application/docs-new-completion.js.map +1 -0
- package/dist/application/docs-protocol.d.ts +168 -0
- package/dist/application/docs-protocol.d.ts.map +1 -0
- package/dist/application/docs-protocol.js +450 -0
- package/dist/application/docs-protocol.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +4 -0
- package/dist/cli.js.map +1 -0
- package/dist/composition/cli.d.ts +4 -0
- package/dist/composition/cli.d.ts.map +1 -0
- package/dist/composition/cli.js +436 -0
- package/dist/composition/cli.js.map +1 -0
- package/dist/composition/node-docs-api.d.ts +148 -0
- package/dist/composition/node-docs-api.d.ts.map +1 -0
- package/dist/composition/node-docs-api.js +38 -0
- package/dist/composition/node-docs-api.js.map +1 -0
- package/dist/domain/document-semantics.d.ts +7 -0
- package/dist/domain/document-semantics.d.ts.map +1 -0
- package/dist/domain/document-semantics.js +146 -0
- package/dist/domain/document-semantics.js.map +1 -0
- package/dist/domain/model.d.ts +285 -0
- package/dist/domain/model.d.ts.map +1 -0
- package/dist/domain/model.js +3 -0
- package/dist/domain/model.js.map +1 -0
- package/dist/domain/profile-policy.d.ts +7 -0
- package/dist/domain/profile-policy.d.ts.map +1 -0
- package/dist/domain/profile-policy.js +109 -0
- package/dist/domain/profile-policy.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/qualification/index.d.ts +23 -0
- package/dist/qualification/index.d.ts.map +1 -0
- package/dist/qualification/index.js +462 -0
- package/dist/qualification/index.js.map +1 -0
- package/package.json +64 -0
- package/schemas/docs-protocol/v1.schema.json +12 -0
- package/schemas/docs-protocol-command-envelope/v1.schema.json +239 -0
- package/schemas/docs-protocol-profile/v1.schema.json +46 -0
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
import { DocsProtocol } from "../application/docs-protocol.js";
|
|
2
|
+
import { NodeFoundationDocsPort } from "../adapters/foundation-docs-port.js";
|
|
3
|
+
import { NodeDocsProfileReader } from "../adapters/node-profile-reader.js";
|
|
4
|
+
import { NodeCodeAnchorMatcher } from "../adapters/node-code-anchor-matcher.js";
|
|
5
|
+
import { NodeDocsAdoptionInspector } from "../adapters/node-adoption-inspector.js";
|
|
6
|
+
import { assertDocsCommandEnvelopeSchema } from "../adapters/docs-command-envelope-schema-validator.js";
|
|
7
|
+
import { DOCS_PROTOCOL_ID, DOCS_PROTOCOL_VERSION } from "../domain/model.js";
|
|
8
|
+
import { DocsProfileError } from "../domain/profile-policy.js";
|
|
9
|
+
class CliInputError extends Error {
|
|
10
|
+
constructor(message) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = "CliInputError";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
class Arguments {
|
|
16
|
+
#values;
|
|
17
|
+
#used = new Set();
|
|
18
|
+
constructor(values) {
|
|
19
|
+
const separator = values.indexOf("--");
|
|
20
|
+
this.#values = separator === -1
|
|
21
|
+
? [...values]
|
|
22
|
+
: [...values.slice(0, separator), ...values.slice(separator + 1)];
|
|
23
|
+
}
|
|
24
|
+
flag(name) {
|
|
25
|
+
const indexes = this.#values.flatMap((value, index) => value === name ? [index] : []);
|
|
26
|
+
if (indexes.length > 1) {
|
|
27
|
+
throw new CliInputError(`${name} may be supplied only once.`);
|
|
28
|
+
}
|
|
29
|
+
if (indexes[0] !== undefined) {
|
|
30
|
+
this.#used.add(indexes[0]);
|
|
31
|
+
}
|
|
32
|
+
return indexes.length === 1;
|
|
33
|
+
}
|
|
34
|
+
one(name, required = false) {
|
|
35
|
+
const indexes = this.#values.flatMap((value, index) => value === name ? [index] : []);
|
|
36
|
+
if (indexes.length > 1) {
|
|
37
|
+
throw new CliInputError(`${name} may be supplied only once.`);
|
|
38
|
+
}
|
|
39
|
+
const index = indexes[0];
|
|
40
|
+
if (index === undefined) {
|
|
41
|
+
if (required) {
|
|
42
|
+
throw new CliInputError(`${name} is required.`);
|
|
43
|
+
}
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
const value = this.#values[index + 1];
|
|
47
|
+
if (value === undefined || value.startsWith("--")) {
|
|
48
|
+
throw new CliInputError(`${name} requires a value.`);
|
|
49
|
+
}
|
|
50
|
+
this.#used.add(index);
|
|
51
|
+
this.#used.add(index + 1);
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
54
|
+
many(name) {
|
|
55
|
+
const results = [];
|
|
56
|
+
for (let index = 0; index < this.#values.length; index += 1) {
|
|
57
|
+
if (this.#values[index] !== name) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
const value = this.#values[index + 1];
|
|
61
|
+
if (value === undefined || value.startsWith("--")) {
|
|
62
|
+
throw new CliInputError(`${name} requires a value.`);
|
|
63
|
+
}
|
|
64
|
+
this.#used.add(index);
|
|
65
|
+
this.#used.add(index + 1);
|
|
66
|
+
results.push(value);
|
|
67
|
+
}
|
|
68
|
+
return Object.freeze(results);
|
|
69
|
+
}
|
|
70
|
+
positionals() {
|
|
71
|
+
return Object.freeze(this.#values.filter((_value, index) => !this.#used.has(index)));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function common(args, signal) {
|
|
75
|
+
return {
|
|
76
|
+
consumerRoot: args.one("--consumer") ?? ".",
|
|
77
|
+
profilePath: args.one("--profile") ?? "architecture/foundation/docs-protocol.yaml",
|
|
78
|
+
json: args.flag("--json"),
|
|
79
|
+
signal
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function parseJson(value, subject) {
|
|
83
|
+
let parsed;
|
|
84
|
+
try {
|
|
85
|
+
parsed = JSON.parse(value);
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
throw new CliInputError(`${subject} must contain strict JSON.`);
|
|
89
|
+
}
|
|
90
|
+
validateJson(parsed, subject, 0);
|
|
91
|
+
return parsed;
|
|
92
|
+
}
|
|
93
|
+
function validateJson(value, subject, depth) {
|
|
94
|
+
if (depth > 16) {
|
|
95
|
+
throw new CliInputError(`${subject} exceeds the JSON nesting limit.`);
|
|
96
|
+
}
|
|
97
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (typeof value === "number") {
|
|
101
|
+
if (!Number.isSafeInteger(value)) {
|
|
102
|
+
throw new CliInputError(`${subject} numbers must be safe integers.`);
|
|
103
|
+
}
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (Array.isArray(value)) {
|
|
107
|
+
if (value.length > 256) {
|
|
108
|
+
throw new CliInputError(`${subject} array is too large.`);
|
|
109
|
+
}
|
|
110
|
+
value.forEach((entry, index) => { validateJson(entry, `${subject}[${index}]`, depth + 1); });
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (typeof value !== "object") {
|
|
114
|
+
throw new CliInputError(`${subject} is outside the JSON data model.`);
|
|
115
|
+
}
|
|
116
|
+
const entries = Object.entries(value);
|
|
117
|
+
if (entries.length > 256) {
|
|
118
|
+
throw new CliInputError(`${subject} object is too large.`);
|
|
119
|
+
}
|
|
120
|
+
for (const [key, entry] of entries) {
|
|
121
|
+
if (key === "__proto__" || key === "prototype" || key === "constructor") {
|
|
122
|
+
throw new CliInputError(`${subject} contains a forbidden key.`);
|
|
123
|
+
}
|
|
124
|
+
validateJson(entry, `${subject}.${key}`, depth + 1);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function parseMetadata(values) {
|
|
128
|
+
if (values.length === 0) {
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
const metadata = Object.create(null);
|
|
132
|
+
for (const value of values) {
|
|
133
|
+
const separator = value.indexOf("=");
|
|
134
|
+
if (separator <= 0) {
|
|
135
|
+
throw new CliInputError("--metadata uses key=<strict JSON>.");
|
|
136
|
+
}
|
|
137
|
+
const key = value.slice(0, separator);
|
|
138
|
+
if (!/^[a-z][a-z0-9_]*$/u.test(key) || Object.hasOwn(metadata, key)) {
|
|
139
|
+
throw new CliInputError(`Metadata key ${key} is invalid or duplicate.`);
|
|
140
|
+
}
|
|
141
|
+
metadata[key] = parseJson(value.slice(separator + 1), `metadata.${key}`);
|
|
142
|
+
}
|
|
143
|
+
return Object.freeze(metadata);
|
|
144
|
+
}
|
|
145
|
+
function parseCodeAnchor(value, index) {
|
|
146
|
+
const legacy = /^(advisory|required):(.+)$/u.exec(value);
|
|
147
|
+
if (legacy !== null) {
|
|
148
|
+
return Object.freeze({ enforcement: legacy[1], pattern: legacy[2] });
|
|
149
|
+
}
|
|
150
|
+
return parseJson(value, `code-anchor[${index}]`);
|
|
151
|
+
}
|
|
152
|
+
function errorCode(error) {
|
|
153
|
+
return typeof error === "object" && error !== null && "code" in error && typeof error.code === "string"
|
|
154
|
+
? error.code
|
|
155
|
+
: undefined;
|
|
156
|
+
}
|
|
157
|
+
function isInputError(error, code) {
|
|
158
|
+
return error instanceof CliInputError || error instanceof DocsProfileError ||
|
|
159
|
+
(code !== undefined && /^DOCUMENT_[A-Z_]+_INPUT_INVALID$/u.test(code)) ||
|
|
160
|
+
(error instanceof Error && error.name === "InvalidDocumentAuthoringProfileError");
|
|
161
|
+
}
|
|
162
|
+
function isAuthorityInputError(error, code) {
|
|
163
|
+
return code?.startsWith("DOCUMENT_") === true ||
|
|
164
|
+
(error instanceof Error && (error.name === "InvalidDocumentAuthoringProfileError" ||
|
|
165
|
+
/document authoring profile|Foundation authoring profile/u.test(error.message)));
|
|
166
|
+
}
|
|
167
|
+
function errorExecution(command, error) {
|
|
168
|
+
const code = errorCode(error);
|
|
169
|
+
const cancelled = error instanceof Error && error.name === "AbortError";
|
|
170
|
+
const inputInvalid = isInputError(error, code);
|
|
171
|
+
const outcome = cancelled ? "cancelled" : inputInvalid ? "invalid-input" : "execution-failure";
|
|
172
|
+
const phase = cancelled ? "apply" : inputInvalid && isAuthorityInputError(error, code) ? "authority" : inputInvalid ? "input" : "apply";
|
|
173
|
+
const ruleId = cancelled ? "docs.cli.cancelled" : inputInvalid ? "docs.cli.invalid-input" : "docs.cli.execution-failure";
|
|
174
|
+
return {
|
|
175
|
+
exitCode: cancelled ? 130 : inputInvalid ? 2 : 3,
|
|
176
|
+
envelope: {
|
|
177
|
+
schemaVersion: 1,
|
|
178
|
+
protocol: { id: DOCS_PROTOCOL_ID, version: DOCS_PROTOCOL_VERSION },
|
|
179
|
+
command,
|
|
180
|
+
outcome,
|
|
181
|
+
diagnostics: [{
|
|
182
|
+
ruleId,
|
|
183
|
+
severity: "error",
|
|
184
|
+
phase,
|
|
185
|
+
subject: command,
|
|
186
|
+
message: error instanceof Error ? error.message : "Unknown command failure."
|
|
187
|
+
}],
|
|
188
|
+
result: Object.freeze({})
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
function commandId(value) {
|
|
193
|
+
switch (value) {
|
|
194
|
+
case "check": return "docs.check";
|
|
195
|
+
case "doctor": return "docs.doctor";
|
|
196
|
+
case "find": return "docs.find";
|
|
197
|
+
case "info": return "docs.info";
|
|
198
|
+
case "new": return "docs.new";
|
|
199
|
+
case "recover": return "docs.recover";
|
|
200
|
+
case undefined:
|
|
201
|
+
default: return "docs.info";
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
async function dispatchFind(protocol, args, options) {
|
|
205
|
+
const explicitText = args.one("--text");
|
|
206
|
+
const id = args.one("--id");
|
|
207
|
+
const type = args.one("--type");
|
|
208
|
+
const status = args.one("--status");
|
|
209
|
+
const owner = args.one("--owner");
|
|
210
|
+
const related = args.one("--related");
|
|
211
|
+
const blockedBy = args.one("--blocked-by");
|
|
212
|
+
const positionals = args.positionals();
|
|
213
|
+
if (positionals.length > 1 || (positionals.length === 1 && explicitText !== undefined)) {
|
|
214
|
+
throw new CliInputError("Supply search text once, positionally or with --text.");
|
|
215
|
+
}
|
|
216
|
+
const text = explicitText ?? positionals[0];
|
|
217
|
+
const query = {
|
|
218
|
+
...(text === undefined ? {} : { text }),
|
|
219
|
+
...(id === undefined ? {} : { id }),
|
|
220
|
+
...(type === undefined ? {} : { type }),
|
|
221
|
+
...(status === undefined ? {} : { status }),
|
|
222
|
+
...(owner === undefined ? {} : { owner }),
|
|
223
|
+
...(related === undefined ? {} : { related }),
|
|
224
|
+
...(blockedBy === undefined ? {} : { blockedBy })
|
|
225
|
+
};
|
|
226
|
+
return { execution: await protocol.find({ ...options, query }), json: options.json };
|
|
227
|
+
}
|
|
228
|
+
async function dispatchNew(protocol, args, options) {
|
|
229
|
+
const dryRun = args.flag("--dry-run");
|
|
230
|
+
const apply = args.flag("--apply");
|
|
231
|
+
if (dryRun === apply) {
|
|
232
|
+
throw new CliInputError("Exactly one of --dry-run or --apply is required.");
|
|
233
|
+
}
|
|
234
|
+
const related = args.many("--related");
|
|
235
|
+
const blockedBy = args.many("--blocked-by");
|
|
236
|
+
const codeAnchors = args.many("--code-anchor").map(parseCodeAnchor);
|
|
237
|
+
const metadata = parseMetadata(args.many("--metadata"));
|
|
238
|
+
const type = args.one("--type", true);
|
|
239
|
+
const id = args.one("--id", true);
|
|
240
|
+
const title = args.one("--title", true);
|
|
241
|
+
const owner = args.one("--owner", true);
|
|
242
|
+
const summary = args.one("--summary", true);
|
|
243
|
+
const slug = args.one("--slug");
|
|
244
|
+
const destination = args.one("--destination");
|
|
245
|
+
if (args.positionals().length !== 0) {
|
|
246
|
+
throw new CliInputError("Unknown docs:new arguments.");
|
|
247
|
+
}
|
|
248
|
+
return {
|
|
249
|
+
execution: await protocol.newDocument({
|
|
250
|
+
...options,
|
|
251
|
+
apply,
|
|
252
|
+
intent: { type, id, title, owner, summary, ...(slug === undefined ? {} : { slug }), ...(destination === undefined ? {} : { destination }) },
|
|
253
|
+
...(related.length === 0 ? {} : { related }),
|
|
254
|
+
...(blockedBy.length === 0 ? {} : { blockedBy }),
|
|
255
|
+
...(codeAnchors.length === 0 ? {} : { codeAnchors }),
|
|
256
|
+
...(metadata === undefined ? {} : { additionalMetadata: metadata })
|
|
257
|
+
}),
|
|
258
|
+
json: options.json
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
async function dispatch(protocol, command, values, signal) {
|
|
262
|
+
const args = new Arguments(values);
|
|
263
|
+
const options = common(args, signal);
|
|
264
|
+
if (command === "info") {
|
|
265
|
+
if (args.positionals().length !== 0) {
|
|
266
|
+
throw new CliInputError("docs:info accepts no positional arguments.");
|
|
267
|
+
}
|
|
268
|
+
return { execution: await protocol.info(options), json: options.json };
|
|
269
|
+
}
|
|
270
|
+
if (command === "find") {
|
|
271
|
+
return dispatchFind(protocol, args, options);
|
|
272
|
+
}
|
|
273
|
+
if (command === "new") {
|
|
274
|
+
return dispatchNew(protocol, args, options);
|
|
275
|
+
}
|
|
276
|
+
if (command === "doctor") {
|
|
277
|
+
if (args.positionals().length !== 0) {
|
|
278
|
+
throw new CliInputError("docs:doctor accepts no positional arguments.");
|
|
279
|
+
}
|
|
280
|
+
return { execution: await protocol.doctor(options), json: options.json };
|
|
281
|
+
}
|
|
282
|
+
if (command === "recover") {
|
|
283
|
+
if (args.positionals().length !== 0) {
|
|
284
|
+
throw new CliInputError("docs:recover accepts no positional arguments.");
|
|
285
|
+
}
|
|
286
|
+
return { execution: await protocol.recover(options), json: options.json };
|
|
287
|
+
}
|
|
288
|
+
if (command === "check") {
|
|
289
|
+
if (args.positionals().length !== 0) {
|
|
290
|
+
throw new CliInputError("docs:check accepts no positional arguments.");
|
|
291
|
+
}
|
|
292
|
+
return { execution: await protocol.check(options), json: options.json };
|
|
293
|
+
}
|
|
294
|
+
throw new CliInputError("Expected one command: info, find, new, doctor, recover, or check.");
|
|
295
|
+
}
|
|
296
|
+
function reachabilitySummary(value) {
|
|
297
|
+
const reachability = value;
|
|
298
|
+
return [reachability["kind"], reachability["indexPath"], reachability["reason"]]
|
|
299
|
+
.filter((entry) => typeof entry === "string")
|
|
300
|
+
.join(" ");
|
|
301
|
+
}
|
|
302
|
+
function display(value, fallback = "unknown") {
|
|
303
|
+
return typeof value === "string" || typeof value === "number"
|
|
304
|
+
? String(value)
|
|
305
|
+
: fallback;
|
|
306
|
+
}
|
|
307
|
+
function renderInfo(result) {
|
|
308
|
+
const lines = [`Project: ${display(result["projectId"])}`];
|
|
309
|
+
for (const value of Array.isArray(result["types"]) ? result["types"] : []) {
|
|
310
|
+
const type = value;
|
|
311
|
+
const identity = type["identity"];
|
|
312
|
+
const placement = type["placement"];
|
|
313
|
+
lines.push(`Type ${String(type["type"])} | initial ${String(type["initialStatus"])} | owners ${type["allowedOwnerIds"].join(",")} | identity ${String(identity["format"])} | placement ${String(placement["kind"])} | required ${type["requiredMetadata"].join(",")} | reachability ${reachabilitySummary(type["reachability"])}`);
|
|
314
|
+
}
|
|
315
|
+
lines.push(`Semantic validators: ${result["semanticValidatorIds"].join(",") || "none"}`);
|
|
316
|
+
return lines;
|
|
317
|
+
}
|
|
318
|
+
function renderFind(result) {
|
|
319
|
+
const lines = [`Matches: ${display(result["matches"], "0")}`];
|
|
320
|
+
for (const value of Array.isArray(result["documents"]) ? result["documents"] : []) {
|
|
321
|
+
const document = value;
|
|
322
|
+
lines.push(`${String(document["id"])} | ${String(document["type"])} | ${String(document["status"])} | ${String(document["owner"])} | ${String(document["repositoryPath"])} | ${String(document["title"])}`);
|
|
323
|
+
}
|
|
324
|
+
return lines;
|
|
325
|
+
}
|
|
326
|
+
export function renderDocsHuman(envelope) {
|
|
327
|
+
const result = envelope.result;
|
|
328
|
+
const lines = [`${envelope.command}: ${envelope.outcome}`];
|
|
329
|
+
if (envelope.command === "docs.info") {
|
|
330
|
+
lines.push(...renderInfo(result));
|
|
331
|
+
}
|
|
332
|
+
if (envelope.command === "docs.find") {
|
|
333
|
+
lines.push(...renderFind(result));
|
|
334
|
+
}
|
|
335
|
+
if (envelope.command === "docs.new" && typeof result["documentPath"] === "string") {
|
|
336
|
+
lines.push(`Document: ${result["documentPath"]}`);
|
|
337
|
+
const reachability = result["reachability"];
|
|
338
|
+
const indexable = ["preview", "applied", "already-applied"].includes(display(result["writeState"]));
|
|
339
|
+
if (indexable && reachability?.["state"] === "manual-required") {
|
|
340
|
+
lines.push(`Next: add ${String(reachability["markdownLink"])} to ${String(reachability["indexPath"])}`);
|
|
341
|
+
}
|
|
342
|
+
if (result["writeState"] === "published-recovery-required") {
|
|
343
|
+
lines.push("Next: recover the published transaction before editing reachability indexes.");
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
if (envelope.command === "docs.doctor") {
|
|
347
|
+
lines.push(`Project: ${display(result["projectId"])}`);
|
|
348
|
+
lines.push(`Environment: ${JSON.stringify(result["environment"] ?? {})}`);
|
|
349
|
+
lines.push(`Transaction: ${JSON.stringify(result["transaction"] ?? {})}`);
|
|
350
|
+
}
|
|
351
|
+
if (envelope.command === "docs.check") {
|
|
352
|
+
lines.push(`Project: ${display(result["projectId"])}`);
|
|
353
|
+
lines.push(`Catalog: ${String(result["catalogStatus"])} (${String(result["documents"])} documents)`);
|
|
354
|
+
lines.push(`Adoption: ${result["valid"] === true ? "valid" : "invalid"}`);
|
|
355
|
+
}
|
|
356
|
+
if (envelope.command === "docs.recover") {
|
|
357
|
+
lines.push(`Recovery: ${display(result["transactionState"])} (${display(result["writeState"])})`);
|
|
358
|
+
}
|
|
359
|
+
for (const diagnostic of envelope.diagnostics) {
|
|
360
|
+
lines.push(`${diagnostic.severity.toUpperCase()} ${diagnostic.ruleId}: ${diagnostic.message}`);
|
|
361
|
+
}
|
|
362
|
+
return `${lines.join("\n")}\n`;
|
|
363
|
+
}
|
|
364
|
+
function helpText(command) {
|
|
365
|
+
if (command === "new") {
|
|
366
|
+
return "Usage: agent-teams-docs new --type TYPE --id ID --title TITLE --owner OWNER --summary SUMMARY (--dry-run|--apply) [--related ID] [--blocked-by ID] [--code-anchor required:PATTERN] [--metadata key=JSON]\n";
|
|
367
|
+
}
|
|
368
|
+
if (command === "find") {
|
|
369
|
+
return "Usage: agent-teams-docs find [TEXT|--text TEXT] [--id ID] [--type TYPE] [--status STATUS] [--owner OWNER] [--related ID] [--blocked-by ID]\n";
|
|
370
|
+
}
|
|
371
|
+
if (["info", "doctor", "recover", "check"].includes(command ?? "")) {
|
|
372
|
+
return `Usage: agent-teams-docs ${command} [--consumer PATH] [--profile PATH] [--json]\n`;
|
|
373
|
+
}
|
|
374
|
+
return "Usage: agent-teams-docs <info|find|new|doctor|recover|check> [options]\n";
|
|
375
|
+
}
|
|
376
|
+
async function validatedMachineExecution(id, execution) {
|
|
377
|
+
try {
|
|
378
|
+
await assertDocsCommandEnvelopeSchema(execution.envelope);
|
|
379
|
+
return execution;
|
|
380
|
+
}
|
|
381
|
+
catch (error) {
|
|
382
|
+
const fallback = {
|
|
383
|
+
exitCode: 3,
|
|
384
|
+
envelope: {
|
|
385
|
+
schemaVersion: 1,
|
|
386
|
+
protocol: { id: DOCS_PROTOCOL_ID, version: DOCS_PROTOCOL_VERSION },
|
|
387
|
+
command: id,
|
|
388
|
+
outcome: "execution-failure",
|
|
389
|
+
diagnostics: [{
|
|
390
|
+
ruleId: "docs.cli.invalid-output",
|
|
391
|
+
severity: "error",
|
|
392
|
+
phase: "apply",
|
|
393
|
+
subject: id,
|
|
394
|
+
message: error instanceof Error ? error.message : "Command output violates its published schema."
|
|
395
|
+
}],
|
|
396
|
+
result: Object.freeze({})
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
await assertDocsCommandEnvelopeSchema(fallback.envelope);
|
|
400
|
+
return fallback;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
export async function runDocsCli(argv) {
|
|
404
|
+
const normalizedArgv = argv[0] === "--" ? argv.slice(1) : argv;
|
|
405
|
+
if ((normalizedArgv.length === 1 && (normalizedArgv[0] === "--help" || normalizedArgv[0] === "help")) ||
|
|
406
|
+
(normalizedArgv.length === 2 && normalizedArgv[1] === "--help")) {
|
|
407
|
+
process.stdout.write(helpText(normalizedArgv.length === 2 ? normalizedArgv[0] : undefined));
|
|
408
|
+
return 0;
|
|
409
|
+
}
|
|
410
|
+
const command = normalizedArgv[0];
|
|
411
|
+
const id = commandId(command);
|
|
412
|
+
const controller = new AbortController();
|
|
413
|
+
const cancel = () => { controller.abort(new DOMException("Documentation command was cancelled.", "AbortError")); };
|
|
414
|
+
process.once("SIGINT", cancel);
|
|
415
|
+
process.once("SIGTERM", cancel);
|
|
416
|
+
let json = normalizedArgv.includes("--json");
|
|
417
|
+
let execution;
|
|
418
|
+
try {
|
|
419
|
+
const dispatched = await dispatch(new DocsProtocol({ adoption: new NodeDocsAdoptionInspector(), anchors: new NodeCodeAnchorMatcher(), foundation: new NodeFoundationDocsPort(), profiles: new NodeDocsProfileReader() }), command ?? "", normalizedArgv.slice(1), controller.signal);
|
|
420
|
+
execution = dispatched.execution;
|
|
421
|
+
json = dispatched.json;
|
|
422
|
+
}
|
|
423
|
+
catch (error) {
|
|
424
|
+
execution = errorExecution(id, error);
|
|
425
|
+
}
|
|
426
|
+
finally {
|
|
427
|
+
process.off("SIGINT", cancel);
|
|
428
|
+
process.off("SIGTERM", cancel);
|
|
429
|
+
}
|
|
430
|
+
if (json) {
|
|
431
|
+
execution = await validatedMachineExecution(id, execution);
|
|
432
|
+
}
|
|
433
|
+
process.stdout.write(json ? `${JSON.stringify(execution.envelope)}\n` : renderDocsHuman(execution.envelope));
|
|
434
|
+
return execution.exitCode;
|
|
435
|
+
}
|
|
436
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/composition/cli.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iCA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AS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC7G,OAAO,SAAS,CAAC,QAAQ,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import type { DocsExecution, DocsFindQuery, DocsNewRequest, DocsNewResult } from "../domain/model.js";
|
|
2
|
+
export interface DocsConsumerRequest {
|
|
3
|
+
readonly consumerRoot: string;
|
|
4
|
+
readonly profilePath: string;
|
|
5
|
+
readonly signal?: AbortSignal;
|
|
6
|
+
}
|
|
7
|
+
export declare function docsInfo(input: DocsConsumerRequest): Promise<DocsExecution<Readonly<{
|
|
8
|
+
kind: "info";
|
|
9
|
+
projectId: string;
|
|
10
|
+
protocol: {
|
|
11
|
+
readonly id: typeof import("../domain/model.js").DOCS_PROTOCOL_ID;
|
|
12
|
+
readonly version: typeof import("../domain/model.js").DOCS_PROTOCOL_VERSION;
|
|
13
|
+
};
|
|
14
|
+
foundationProfile: {
|
|
15
|
+
readonly metadataSidecarPolicy: "foundation-profile-v2-strict-merge";
|
|
16
|
+
readonly path: string;
|
|
17
|
+
readonly schemaVersion: 2;
|
|
18
|
+
};
|
|
19
|
+
agentWorkflow: {
|
|
20
|
+
readonly skillPath: string;
|
|
21
|
+
};
|
|
22
|
+
metadataSchemaPath: string;
|
|
23
|
+
metadataSidecar: {
|
|
24
|
+
readonly kind: "none";
|
|
25
|
+
} | {
|
|
26
|
+
readonly kind: "path-metadata-map";
|
|
27
|
+
readonly path: string;
|
|
28
|
+
};
|
|
29
|
+
ownerIds: readonly string[];
|
|
30
|
+
types: readonly import("../domain/model.js").DocsTypeProfile[];
|
|
31
|
+
semanticValidatorIds: readonly string[];
|
|
32
|
+
}>>>;
|
|
33
|
+
export declare function docsFind(input: DocsConsumerRequest & {
|
|
34
|
+
readonly query: DocsFindQuery;
|
|
35
|
+
readonly signal?: AbortSignal;
|
|
36
|
+
}): Promise<DocsExecution<Readonly<{
|
|
37
|
+
kind: "find";
|
|
38
|
+
matches: number;
|
|
39
|
+
documents: readonly import("../domain/model.js").DocsFindDocument[];
|
|
40
|
+
}>>>;
|
|
41
|
+
export declare function docsNew(input: DocsNewRequest): Promise<DocsExecution<DocsNewResult>>;
|
|
42
|
+
export declare function docsDoctor(input: DocsConsumerRequest): Promise<DocsExecution<Readonly<{
|
|
43
|
+
kind: "doctor";
|
|
44
|
+
protocol: Readonly<{
|
|
45
|
+
id: "agent-teams.docs-protocol";
|
|
46
|
+
version: 1;
|
|
47
|
+
}>;
|
|
48
|
+
projectId?: string;
|
|
49
|
+
environment: {
|
|
50
|
+
readonly installedFoundationVersion: string;
|
|
51
|
+
readonly installedFoundationBuildIdentity: string;
|
|
52
|
+
readonly filesystem: {
|
|
53
|
+
readonly basis: "platform-contract";
|
|
54
|
+
readonly strictDirectoryDurability: "platform-supported" | "platform-unsupported";
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
transaction: Readonly<{
|
|
58
|
+
state: "idle";
|
|
59
|
+
}> | Readonly<{
|
|
60
|
+
state: "recoverable";
|
|
61
|
+
transactionKind: "document";
|
|
62
|
+
recovery: Readonly<{
|
|
63
|
+
commandId: "docs.recover";
|
|
64
|
+
args: Readonly<{
|
|
65
|
+
exactFoundationBuildIdentity: string;
|
|
66
|
+
exactFoundationVersion: string;
|
|
67
|
+
}>;
|
|
68
|
+
}>;
|
|
69
|
+
}> | Readonly<{
|
|
70
|
+
state: "manual-recovery-required";
|
|
71
|
+
transactionKind?: "corrupt" | "document" | "local-mode" | "scaffold" | "transition-residue" | "unknown" | "version-mismatch";
|
|
72
|
+
reason: string;
|
|
73
|
+
recovery?: {
|
|
74
|
+
readonly commandId: "detach" | "docs-recover" | "scaffold-recover";
|
|
75
|
+
readonly args: Readonly<Record<string, string>>;
|
|
76
|
+
};
|
|
77
|
+
}>;
|
|
78
|
+
}>>>;
|
|
79
|
+
export declare function docsRecover(input: DocsConsumerRequest & {
|
|
80
|
+
readonly signal?: AbortSignal;
|
|
81
|
+
}): Promise<DocsExecution<Readonly<{
|
|
82
|
+
kind: "recover";
|
|
83
|
+
transactionState: "no-pending-transaction";
|
|
84
|
+
writeState: "unchanged";
|
|
85
|
+
}>> | DocsExecution<Readonly<{
|
|
86
|
+
kind: "recover";
|
|
87
|
+
transactionState: "manual-required";
|
|
88
|
+
writeState: "unknown";
|
|
89
|
+
transaction: Readonly<{
|
|
90
|
+
state: "idle";
|
|
91
|
+
}> | Readonly<{
|
|
92
|
+
state: "recoverable";
|
|
93
|
+
transactionKind: "document";
|
|
94
|
+
recovery: Readonly<{
|
|
95
|
+
commandId: "docs.recover";
|
|
96
|
+
args: Readonly<{
|
|
97
|
+
exactFoundationBuildIdentity: string;
|
|
98
|
+
exactFoundationVersion: string;
|
|
99
|
+
}>;
|
|
100
|
+
}>;
|
|
101
|
+
}> | Readonly<{
|
|
102
|
+
state: "manual-recovery-required";
|
|
103
|
+
transactionKind?: "corrupt" | "document" | "local-mode" | "scaffold" | "transition-residue" | "unknown" | "version-mismatch";
|
|
104
|
+
reason: string;
|
|
105
|
+
recovery?: {
|
|
106
|
+
readonly commandId: "detach" | "docs-recover" | "scaffold-recover";
|
|
107
|
+
readonly args: Readonly<Record<string, string>>;
|
|
108
|
+
};
|
|
109
|
+
}>;
|
|
110
|
+
}>> | DocsExecution<Readonly<{
|
|
111
|
+
kind: "recover";
|
|
112
|
+
transactionState: "recovered" | "recovery-required";
|
|
113
|
+
writeState: "committed" | "published-recovery-required" | "unchanged" | "unknown";
|
|
114
|
+
receiptDigest: `sha256:${string}`;
|
|
115
|
+
receipt: Readonly<{
|
|
116
|
+
outcome: import("@agent-teams/engineering-foundation/document-authoring").DocumentReceiptOutcome;
|
|
117
|
+
commit: Readonly<{
|
|
118
|
+
state: "committed" | "manual-recovery-required" | "not-published" | "recovery-required";
|
|
119
|
+
publication: "none" | "preexisting-exact" | "published" | "unknown";
|
|
120
|
+
recoverability: "not-required" | "preserved-for-recovery";
|
|
121
|
+
}>;
|
|
122
|
+
directoryMaterialization?: {
|
|
123
|
+
readonly state: "none-created" | "created-and-retained" | "preserved-unknown";
|
|
124
|
+
readonly plannedDirectories: readonly string[];
|
|
125
|
+
readonly observedCreatedDirectories: readonly string[];
|
|
126
|
+
};
|
|
127
|
+
}>;
|
|
128
|
+
}>>>;
|
|
129
|
+
export declare function docsCheck(input: DocsConsumerRequest): Promise<DocsExecution<Readonly<{
|
|
130
|
+
kind: "check";
|
|
131
|
+
projectId: string;
|
|
132
|
+
catalogStatus: "complete" | "partial";
|
|
133
|
+
documents: number;
|
|
134
|
+
foundationProfile: {
|
|
135
|
+
readonly metadataSidecarPolicy: "foundation-profile-v2-strict-merge";
|
|
136
|
+
readonly path: string;
|
|
137
|
+
readonly schemaVersion: 2;
|
|
138
|
+
};
|
|
139
|
+
metadataSidecar: {
|
|
140
|
+
readonly kind: "none";
|
|
141
|
+
} | {
|
|
142
|
+
readonly kind: "path-metadata-map";
|
|
143
|
+
readonly path: string;
|
|
144
|
+
};
|
|
145
|
+
semanticValidatorIds: readonly string[];
|
|
146
|
+
valid: boolean;
|
|
147
|
+
}>>>;
|
|
148
|
+
//# sourceMappingURL=node-docs-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-docs-api.d.ts","sourceRoot":"","sources":["../../src/composition/node-docs-api.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAiBtG,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;KAElD;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,mBAAmB,GAAG;IACpD,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;;;;KAEA;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAEpF;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEpD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,mBAAmB,GAAG;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEzF;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,mBAAmB;;;;;;;;;;;;;;;;;;KAEnD"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { DocsProtocol } from "../application/docs-protocol.js";
|
|
2
|
+
import { NodeDocsAdoptionInspector } from "../adapters/node-adoption-inspector.js";
|
|
3
|
+
import { NodeCodeAnchorMatcher } from "../adapters/node-code-anchor-matcher.js";
|
|
4
|
+
import { NodeFoundationDocsPort } from "../adapters/foundation-docs-port.js";
|
|
5
|
+
import { NodeDocsProfileReader } from "../adapters/node-profile-reader.js";
|
|
6
|
+
import { assertDocsCommandEnvelopeSchema } from "../adapters/docs-command-envelope-schema-validator.js";
|
|
7
|
+
function nodeProtocol() {
|
|
8
|
+
return new DocsProtocol({
|
|
9
|
+
adoption: new NodeDocsAdoptionInspector(),
|
|
10
|
+
anchors: new NodeCodeAnchorMatcher(),
|
|
11
|
+
foundation: new NodeFoundationDocsPort(),
|
|
12
|
+
profiles: new NodeDocsProfileReader()
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
async function verified(execution) {
|
|
16
|
+
const resolved = await execution;
|
|
17
|
+
await assertDocsCommandEnvelopeSchema(resolved.envelope);
|
|
18
|
+
return resolved;
|
|
19
|
+
}
|
|
20
|
+
export function docsInfo(input) {
|
|
21
|
+
return verified(nodeProtocol().info(input));
|
|
22
|
+
}
|
|
23
|
+
export function docsFind(input) {
|
|
24
|
+
return verified(nodeProtocol().find(input));
|
|
25
|
+
}
|
|
26
|
+
export function docsNew(input) {
|
|
27
|
+
return verified(nodeProtocol().newDocument(input));
|
|
28
|
+
}
|
|
29
|
+
export function docsDoctor(input) {
|
|
30
|
+
return verified(nodeProtocol().doctor(input));
|
|
31
|
+
}
|
|
32
|
+
export function docsRecover(input) {
|
|
33
|
+
return verified(nodeProtocol().recover(input));
|
|
34
|
+
}
|
|
35
|
+
export function docsCheck(input) {
|
|
36
|
+
return verified(nodeProtocol().check(input));
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=node-docs-api.js.map
|