@ybotok/loam 0.1.0-beta.1 → 0.1.0-beta.2
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 +49 -0
- package/README.md +6 -1
- package/dist/cli.js +4 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/adopt.js +17 -3
- package/dist/commands/adopt.js.map +1 -1
- package/dist/commands/archive.js +24 -8
- package/dist/commands/archive.js.map +1 -1
- package/dist/commands/delta.js +74 -47
- package/dist/commands/delta.js.map +1 -1
- package/dist/commands/dependencies.js +7 -2
- package/dist/commands/dependencies.js.map +1 -1
- package/dist/commands/docs-repo-gate.js +104 -0
- package/dist/commands/docs-repo-gate.js.map +1 -0
- package/dist/commands/explore.js +195 -0
- package/dist/commands/explore.js.map +1 -0
- package/dist/commands/format.js +17 -0
- package/dist/commands/format.js.map +1 -0
- package/dist/commands/gherkin.js +87 -48
- package/dist/commands/gherkin.js.map +1 -1
- package/dist/commands/init.js +3 -3
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/instructions.js +70 -0
- package/dist/commands/instructions.js.map +1 -0
- package/dist/commands/list.js +6 -76
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/migrate-openspec.js +45 -28
- package/dist/commands/migrate-openspec.js.map +1 -1
- package/dist/commands/new.js +35 -34
- package/dist/commands/new.js.map +1 -1
- package/dist/commands/rebase.js +2 -4
- package/dist/commands/rebase.js.map +1 -1
- package/dist/commands/show.js +26 -31
- package/dist/commands/show.js.map +1 -1
- package/dist/commands/status.js +8 -24
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/unarchive.js +12 -5
- package/dist/commands/unarchive.js.map +1 -1
- package/dist/commands/validate.js +115 -133
- package/dist/commands/validate.js.map +1 -1
- package/dist/commands/verify.js +33 -17
- package/dist/commands/verify.js.map +1 -1
- package/dist/commands/vouch.js +77 -59
- package/dist/commands/vouch.js.map +1 -1
- package/dist/core/agent.js +273 -31
- package/dist/core/agent.js.map +1 -1
- package/dist/core/arch.js +28 -2
- package/dist/core/arch.js.map +1 -1
- package/dist/core/brief.js +3 -3
- package/dist/core/brief.js.map +1 -1
- package/dist/core/coherence.js +37 -13
- package/dist/core/coherence.js.map +1 -1
- package/dist/core/concurrency.js +51 -0
- package/dist/core/concurrency.js.map +1 -0
- package/dist/core/config.js +10 -2
- package/dist/core/config.js.map +1 -1
- package/dist/core/delta.js +21 -2
- package/dist/core/delta.js.map +1 -1
- package/dist/core/dependencies.js +46 -42
- package/dist/core/dependencies.js.map +1 -1
- package/dist/core/docs.js +2 -1
- package/dist/core/docs.js.map +1 -1
- package/dist/core/doctor.js +41 -26
- package/dist/core/doctor.js.map +1 -1
- package/dist/core/document-bytes.js +59 -0
- package/dist/core/document-bytes.js.map +1 -0
- package/dist/core/explore.js +225 -0
- package/dist/core/explore.js.map +1 -0
- package/dist/core/fleet-context.js +16 -63
- package/dist/core/fleet-context.js.map +1 -1
- package/dist/core/frontmatter.js +1 -5
- package/dist/core/frontmatter.js.map +1 -1
- package/dist/core/gherkin.js +3 -61
- package/dist/core/gherkin.js.map +1 -1
- package/dist/core/health.js +1 -5
- package/dist/core/health.js.map +1 -1
- package/dist/core/ids.js +34 -5
- package/dist/core/ids.js.map +1 -1
- package/dist/core/json.js +8 -1
- package/dist/core/json.js.map +1 -1
- package/dist/core/likec4.js +6 -1
- package/dist/core/likec4.js.map +1 -1
- package/dist/core/maturity.js +66 -0
- package/dist/core/maturity.js.map +1 -0
- package/dist/core/openapi-merge.js +39 -6
- package/dist/core/openapi-merge.js.map +1 -1
- package/dist/core/openapi.js +17 -5
- package/dist/core/openapi.js.map +1 -1
- package/dist/core/openspec-inventory.js +64 -27
- package/dist/core/openspec-inventory.js.map +1 -1
- package/dist/core/path-safety.js +59 -0
- package/dist/core/path-safety.js.map +1 -1
- package/dist/core/provenance.js +35 -10
- package/dist/core/provenance.js.map +1 -1
- package/dist/core/records.js +33 -0
- package/dist/core/records.js.map +1 -0
- package/dist/core/repo.js +75 -1
- package/dist/core/repo.js.map +1 -1
- package/dist/core/report.js +9 -0
- package/dist/core/report.js.map +1 -1
- package/dist/core/results.js +1 -3
- package/dist/core/results.js.map +1 -1
- package/dist/core/spec.js +3 -3
- package/dist/core/spec.js.map +1 -1
- package/dist/core/staging.js +124 -17
- package/dist/core/staging.js.map +1 -1
- package/dist/core/status.js +122 -33
- package/dist/core/status.js.map +1 -1
- package/dist/core/steps.js +72 -0
- package/dist/core/steps.js.map +1 -0
- package/dist/core/verify.js +18 -4
- package/dist/core/verify.js.map +1 -1
- package/dist/core/version.js +17 -1
- package/dist/core/version.js.map +1 -1
- package/package.json +1 -1
package/dist/commands/delta.js
CHANGED
|
@@ -5,8 +5,13 @@ import { loadConfig } from "../core/config.js";
|
|
|
5
5
|
import { InvalidIdError, assertServiceId } from "../core/ids.js";
|
|
6
6
|
import { emitJson, emitJsonError, fail, repoPath, reportNoConfig } from "../core/json.js";
|
|
7
7
|
import { elementService, loadFile, serviceOf } from "../core/likec4.js";
|
|
8
|
-
import {
|
|
9
|
-
|
|
8
|
+
import { readOpenapi } from "../core/openapi.js";
|
|
9
|
+
// The summary walk below descends four levels into a document nobody has
|
|
10
|
+
// validated, and `isRecord` is what it asks at each step: a cast there would
|
|
11
|
+
// assert a shape the parser never promised, and a sequence or a scalar in any of
|
|
12
|
+
// those slots would be indexed as a mapping.
|
|
13
|
+
import { isRecord } from "../core/records.js";
|
|
14
|
+
import { DocsRepoUnavailableError, compareIds, featurePaths, featureSpecPaths, listServices, missingFeatureMessage, nearestIds, resolveFeature, } from "../core/repo.js";
|
|
10
15
|
import { parseRequirements } from "../core/spec.js";
|
|
11
16
|
export function registerDelta(program) {
|
|
12
17
|
program
|
|
@@ -114,7 +119,13 @@ export function registerDelta(program) {
|
|
|
114
119
|
// `ok` stays true under --json: the command ran); the exit code is what
|
|
115
120
|
// stops a pipeline from building on it, so it is set BEFORE the format
|
|
116
121
|
// fork — the guard is about the delta, not about how it is rendered.
|
|
117
|
-
|
|
122
|
+
//
|
|
123
|
+
// The contract axis fails the same way and now earns the same guard: an
|
|
124
|
+
// openapi.yaml that does not parse projected as an empty operation list,
|
|
125
|
+
// and nothing upstream catches it either — `loam validate` grades
|
|
126
|
+
// `openapi.invalid` on LIVING service contracts only, never on a
|
|
127
|
+
// feature's delta.
|
|
128
|
+
if (arch.errors.length > 0 || api.unreadable)
|
|
118
129
|
process.exitCode = 1;
|
|
119
130
|
if (json) {
|
|
120
131
|
const reqJson = (r) => ({
|
|
@@ -139,7 +150,16 @@ export function registerDelta(program) {
|
|
|
139
150
|
// integration/ops tests, and a consumer must not have to parse prose
|
|
140
151
|
// to tell the two apart.
|
|
141
152
|
archRequirements: archReqs.map(reqJson),
|
|
142
|
-
api,
|
|
153
|
+
api: api.changes,
|
|
154
|
+
// `api` stays exactly the operations array it has always been — a
|
|
155
|
+
// consumer indexing it must not have to learn a new shape — so the
|
|
156
|
+
// readability of the document rides alongside as its own key,
|
|
157
|
+
// spelled the way `loam show` already spells it for a living
|
|
158
|
+
// contract. Additive, which the envelope permits (core/json.ts).
|
|
159
|
+
openapi: {
|
|
160
|
+
unreadable: api.unreadable,
|
|
161
|
+
...(api.error === undefined ? {} : { error: api.error }),
|
|
162
|
+
},
|
|
143
163
|
architecture: arch,
|
|
144
164
|
});
|
|
145
165
|
return;
|
|
@@ -181,29 +201,6 @@ function introducedServices(doc, featureId) {
|
|
|
181
201
|
return [];
|
|
182
202
|
return doc.elements.filter((e) => e.tags.includes(featureId)).map(elementService);
|
|
183
203
|
}
|
|
184
|
-
/** Known ids within a small edit distance of `id`, closest first, at most three. */
|
|
185
|
-
function nearestIds(id, known) {
|
|
186
|
-
const budget = Math.max(1, Math.floor(id.length / 4));
|
|
187
|
-
return known
|
|
188
|
-
.map((candidate) => ({ candidate, distance: editDistance(id.toLowerCase(), candidate.toLowerCase()) }))
|
|
189
|
-
.filter((scored) => scored.distance <= budget)
|
|
190
|
-
.sort((a, b) => a.distance - b.distance || compareIds(a.candidate, b.candidate))
|
|
191
|
-
.slice(0, 3)
|
|
192
|
-
.map((scored) => scored.candidate);
|
|
193
|
-
}
|
|
194
|
-
/** Plain Levenshtein — ids are short, and the row-at-a-time form keeps it obvious. */
|
|
195
|
-
function editDistance(a, b) {
|
|
196
|
-
let previous = Array.from({ length: b.length + 1 }, (_, i) => i);
|
|
197
|
-
for (let i = 1; i <= a.length; i += 1) {
|
|
198
|
-
const current = [i];
|
|
199
|
-
for (let j = 1; j <= b.length; j += 1) {
|
|
200
|
-
const substitution = previous[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1);
|
|
201
|
-
current.push(Math.min(previous[j] + 1, current[j - 1] + 1, substitution));
|
|
202
|
-
}
|
|
203
|
-
previous = current;
|
|
204
|
-
}
|
|
205
|
-
return previous[b.length];
|
|
206
|
-
}
|
|
207
204
|
/**
|
|
208
205
|
* The feature's OpenAPI delta for one service, as slots rather than names.
|
|
209
206
|
*
|
|
@@ -216,35 +213,54 @@ function editDistance(a, b) {
|
|
|
216
213
|
*/
|
|
217
214
|
async function apiChanges(openapiPath) {
|
|
218
215
|
if (!existsSync(openapiPath))
|
|
219
|
-
return [];
|
|
220
|
-
|
|
216
|
+
return { changes: [], unreadable: false };
|
|
217
|
+
// `readOpenapi`, not `operations`: the operation list alone cannot tell a
|
|
218
|
+
// contract that defines nothing from one that could not be read, and this is
|
|
219
|
+
// the command whose output IS the implementation task.
|
|
220
|
+
const api = await readOpenapi(openapiPath);
|
|
221
|
+
if (api.unreadable) {
|
|
222
|
+
return { changes: [], unreadable: true, ...(api.error === undefined ? {} : { error: api.error }) };
|
|
223
|
+
}
|
|
224
|
+
const ops = api.ops;
|
|
221
225
|
if (ops.length === 0)
|
|
222
|
-
return [];
|
|
226
|
+
return { changes: [], unreadable: false };
|
|
223
227
|
let doc;
|
|
224
228
|
try {
|
|
225
229
|
doc = parseYaml(await readFile(openapiPath, "utf8"));
|
|
226
230
|
}
|
|
227
231
|
catch {
|
|
228
|
-
// Unreadable is impossible here (
|
|
229
|
-
// decoration and must never be the reason a task brief fails to
|
|
232
|
+
// Unreadable is impossible here (the reader above said otherwise), but a
|
|
233
|
+
// summary is decoration and must never be the reason a task brief fails to
|
|
234
|
+
// print.
|
|
230
235
|
doc = null;
|
|
231
236
|
}
|
|
232
237
|
const summaryOf = (op) => {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
const
|
|
236
|
-
|
|
238
|
+
if (!isRecord(doc))
|
|
239
|
+
return null;
|
|
240
|
+
const paths = doc["paths"];
|
|
241
|
+
if (!isRecord(paths))
|
|
242
|
+
return null;
|
|
243
|
+
const item = paths[op.path];
|
|
244
|
+
if (!isRecord(item))
|
|
245
|
+
return null;
|
|
246
|
+
const entry = item[op.method];
|
|
247
|
+
if (!isRecord(entry))
|
|
248
|
+
return null;
|
|
249
|
+
const summary = entry["summary"];
|
|
237
250
|
return typeof summary === "string" && summary.length > 0 ? summary : null;
|
|
238
251
|
};
|
|
239
|
-
return
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
252
|
+
return {
|
|
253
|
+
changes: ops
|
|
254
|
+
.map((op) => ({
|
|
255
|
+
path: op.path,
|
|
256
|
+
method: op.method.toUpperCase(),
|
|
257
|
+
operationId: op.id,
|
|
258
|
+
summary: summaryOf(op),
|
|
259
|
+
remove: op.remove,
|
|
260
|
+
}))
|
|
261
|
+
.sort((a, b) => compareIds(a.path, b.path) || compareIds(a.method, b.method)),
|
|
262
|
+
unreadable: false,
|
|
263
|
+
};
|
|
248
264
|
}
|
|
249
265
|
/** The feature's tagged edges around one service, plus whether the service is new. */
|
|
250
266
|
function archSlice(doc, service, featureId) {
|
|
@@ -318,12 +334,23 @@ function printRequirements(reqs, label) {
|
|
|
318
334
|
}
|
|
319
335
|
}
|
|
320
336
|
function printApi(api) {
|
|
321
|
-
if (api.
|
|
337
|
+
if (api.unreadable) {
|
|
338
|
+
// Worded like `loam show`'s answer for the same failure on a living
|
|
339
|
+
// contract, and deliberately WITHOUT a "run `loam validate`" hint: validate
|
|
340
|
+
// grades `openapi.invalid` on living service contracts only, so it has
|
|
341
|
+
// nothing to say about this file and sending the reader there is a dead end.
|
|
342
|
+
console.log("API: openapi.yaml does not parse");
|
|
343
|
+
if (api.error !== undefined)
|
|
344
|
+
console.log(` ${api.error}`);
|
|
345
|
+
console.log();
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
if (api.changes.length === 0) {
|
|
322
349
|
console.log("API: (the openapi delta defines no operations)\n");
|
|
323
350
|
return;
|
|
324
351
|
}
|
|
325
352
|
console.log("API (this feature's openapi.yaml for the service):");
|
|
326
|
-
for (const op of api) {
|
|
353
|
+
for (const op of api.changes) {
|
|
327
354
|
const marker = op.remove ? "REMOVE " : "";
|
|
328
355
|
console.log(` ${marker}${op.method} ${op.path} ${op.operationId}${op.summary === null ? "" : ` — ${op.summary}`}`);
|
|
329
356
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delta.js","sourceRoot":"","sources":["../../src/commands/delta.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC1F,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAuC,MAAM,mBAAmB,CAAC;AAC7G,OAAO,EAAE,UAAU,EAAkB,MAAM,oBAAoB,CAAC;AAChE,OAAO,EACL,w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AC;AAChB,CAAC;AAED,SAAS,MAAM,CAAC,IAAY,EAAE,GAAW;IACvC,OAAO,IAAI;SACR,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACxC,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC","sourcesContent":["import type { Command } from \"commander\";\nimport { existsSync } from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\nimport { parse as parseYaml } from \"yaml\";\nimport { loadConfig } from \"../core/config.js\";\nimport { InvalidIdError, assertServiceId } from \"../core/ids.js\";\nimport { emitJson, emitJsonError, fail, repoPath, reportNoConfig } from \"../core/json.js\";\nimport { elementService, loadFile, serviceOf, type Elem, type LoadedDoc, type Rel } from \"../core/likec4.js\";\nimport { operations, type Operation } from \"../core/openapi.js\";\nimport {\n DocsRepoUnavailableError,\n compareIds,\n featurePaths,\n featureSpecPaths,\n listServices,\n missingFeatureMessage,\n resolveFeature,\n} from \"../core/repo.js\";\nimport { parseRequirements, type Requirement } from \"../core/spec.js\";\n\ninterface DeltaOptions {\n service?: string;\n json?: boolean;\n}\n\n/** One end of a feature edge, as seen from the projected service. */\ninterface Edge {\n service: string;\n op: string | null;\n title: string | null;\n}\n\ninterface ArchSlice {\n isNew: boolean;\n inbound: Edge[];\n outbound: Edge[];\n errors: string[];\n}\n\n/**\n * One operation the feature's OpenAPI delta defines for this service. The\n * projection is a task brief, and \"implement createSplit\" without the path and\n * the method is not a task — it is a name to go look up in a file the reader\n * was not told about.\n */\ninterface ApiChange {\n path: string;\n method: string;\n operationId: string;\n summary: string | null;\n /** `x-loam-remove: true` — this operation is being retired, not added. */\n remove: boolean;\n}\n\nexport function registerDelta(program: Command): void {\n program\n .command(\"delta\")\n .argument(\"<featureId>\", \"feature id, e.g. FEAT-101\")\n .description(\"Project a feature onto a service: why + requirement delta + C4 changes\")\n .option(\"--service <id>\", \"service to project onto (defaults to the configured service)\")\n .option(\"--json\", \"emit the machine contract instead of the human view\")\n .action(async (featureId: string, opts: DeltaOptions) => {\n const json = opts.json === true;\n const config = await loadConfig();\n if (!config) {\n reportNoConfig(json);\n return;\n }\n\n // The id grammar first, and on the RAW argument: `--service ../../etc`\n // reaches `featureSpecPaths` and reads from outside the feature directory.\n // One grammar for the whole tool (core/ids.ts).\n if (opts.service !== undefined) {\n try {\n assertServiceId(opts.service, \"--service\");\n } catch (err) {\n if (!(err instanceof InvalidIdError)) throw err;\n fail(json, \"invalid-option\", err.message);\n return;\n }\n }\n\n // The feature is resolved BEFORE the service is chosen, because every\n // sentence about the service (\"which ones does this feature touch?\") is\n // only answerable once the feature is known.\n const feature = await resolveFeature(config.docsDir, featureId, \"exclude\");\n if (!feature) {\n fail(json, \"unknown-target\", await missingFeatureMessage(config.docsDir, featureId));\n return;\n }\n // Canonical id from here on — the delta's tags carry `#FEAT-5`, so a raw\n // `FEAT-5-slug` argument used to empty the architecture slice silently.\n const { id } = feature;\n const paths = featurePaths(feature.dir);\n\n const deltaDoc = existsSync(paths.delta) ? await loadFile(paths.delta) : null;\n // Services the feature speaks about at all: one with a requirement delta,\n // or one its C4 delta introduces. This is the list a refusal quotes.\n const featureServices = [\n ...new Set([...feature.services, ...introducedServices(deltaDoc, id)]),\n ].sort(compareIds);\n\n const service = opts.service ?? config.service;\n if (!service) {\n // The refusal NAMES the choices. \"No service. Pass --service <id>\" told\n // the reader the shape of the flag and nothing about the answer, so the\n // next step was always to go list the feature's specs/ by hand — and an\n // agent had no way to recover at all. The list rides the JSON envelope\n // for the same reason.\n const message =\n `No service to project ${id} onto. Pass --service <id> or set 'service' in loam.json.` +\n (featureServices.length === 0\n ? ` ${id} carries no per-service delta yet.`\n : ` ${id} touches: ${featureServices.join(\", \")}.`);\n if (json) emitJsonError(\"invalid-option\", message, { feature: id, services: featureServices });\n else {\n console.error(message);\n process.exitCode = 1;\n }\n return;\n }\n\n // A service nobody has heard of produces a perfectly plausible EMPTY\n // report — no requirements, no edges, \"no architecture change\" — which an\n // agent consuming this as a task brief reads as \"nothing to do here\".\n // A typo must never be indistinguishable from a finished service.\n const living = await livingServices(config.docsDir);\n if (!featureServices.includes(service) && !living.includes(service)) {\n const near = nearestIds(service, [...new Set([...featureServices, ...living])]);\n fail(\n json,\n \"unknown-target\",\n `No service '${service}': it is neither a services/${service}/ in the docs repo nor a service ${id} touches` +\n (featureServices.length === 0 ? \"\" : ` (${featureServices.join(\", \")})`) +\n (near.length === 0 ? \".\" : ` — did you mean ${near.map((n) => `'${n}'`).join(\" or \")}?`),\n );\n return;\n }\n\n // Why — business intent\n const intent = existsSync(paths.intent)\n ? stripFrontmatter(await readFile(paths.intent, \"utf8\")).trim()\n : null;\n\n // Requirement delta for this service (OpenSpec style), business and arch:\n // the same projection covers both axes, in the same shape, so the payload\n // stays one task — the arch requirements are the integration/ops half the\n // business ones never mention.\n const specPaths = featureSpecPaths(feature.dir, service);\n const reqs = existsSync(specPaths.spec)\n ? parseRequirements(await readFile(specPaths.spec, \"utf8\"))\n : [];\n const archReqs = existsSync(specPaths.archSpec)\n ? parseRequirements(await readFile(specPaths.archSpec, \"utf8\"))\n : [];\n\n // The contract axis. Until now no command surfaced it at all: the feature's\n // openapi.yaml was read by validate and by archive, and the one command\n // whose output IS the implementation task never mentioned it — so \"add the\n // endpoint\" was the half of the work the brief left out.\n const api = await apiChanges(specPaths.openapi);\n\n // C4 architecture slice\n const arch = archSlice(deltaDoc, service, id);\n\n // An unparseable delta.likec4 empties the C4 slice, and a consumer\n // reading this projection as a task brief — the JSON payload and the\n // printed view alike — would take that as \"no architecture change\": the\n // vacuously-green pattern. The output stays as informative as ever (and\n // `ok` stays true under --json: the command ran); the exit code is what\n // stops a pipeline from building on it, so it is set BEFORE the format\n // fork — the guard is about the delta, not about how it is rendered.\n if (arch.errors.length > 0) process.exitCode = 1;\n\n if (json) {\n const reqJson = (r: Requirement): Record<string, unknown> => ({\n kind: r.kind,\n id: r.id,\n name: r.name,\n text: r.text.join(\"\\n\").trim(),\n operations: r.operations,\n covers: r.covers,\n // Scenarios go out verbatim: they are the acceptance criteria and the\n // source for the tests whoever picks this up is expected to write.\n scenarios: r.scenarios.map((s) => ({ name: s.name, lines: s.lines })),\n });\n emitJson({\n feature: id,\n service,\n services: featureServices,\n path: repoPath(config.docsDir, feature.dir),\n intent,\n requirements: reqs.map(reqJson),\n // Same shape, separate section: an arch requirement's scenarios are\n // integration/ops tests, and a consumer must not have to parse prose\n // to tell the two apart.\n archRequirements: archReqs.map(reqJson),\n api,\n architecture: arch,\n });\n return;\n }\n\n console.log(`${id} · ${service}\\n`);\n if (intent) {\n console.log(indent(intent, \" \"));\n console.log();\n }\n if (existsSync(specPaths.spec)) printRequirements(reqs, \"Requirements\");\n else console.log(\"Requirements: (none for this service)\\n\");\n if (existsSync(specPaths.archSpec)) printRequirements(archReqs, \"Arch requirements\");\n if (existsSync(specPaths.openapi)) printApi(api);\n if (existsSync(paths.delta)) printArchSlice(arch, service);\n });\n}\n\n/** Every service in the docs repo, or none when there is no docs repo to ask. */\nasync function livingServices(docsDir: string): Promise<string[]> {\n try {\n return (await listServices(docsDir)).map((s) => s.id);\n } catch (err) {\n // \"There is no docs repo at all\" is a different diagnosis with its own\n // command (`loam doctor`); turning it into \"unknown service\" here would\n // send the reader after a typo that is not there.\n if (!(err instanceof DocsRepoUnavailableError)) throw err;\n return [];\n }\n}\n\n/** Services the feature's C4 delta introduces — its own tagged top-level elements. */\nfunction introducedServices(doc: LoadedDoc | null, featureId: string): string[] {\n if (doc === null || doc.errors.length > 0) return [];\n return doc.elements.filter((e: Elem) => e.tags.includes(featureId)).map(elementService);\n}\n\n/** Known ids within a small edit distance of `id`, closest first, at most three. */\nfunction nearestIds(id: string, known: string[]): string[] {\n const budget = Math.max(1, Math.floor(id.length / 4));\n return known\n .map((candidate) => ({ candidate, distance: editDistance(id.toLowerCase(), candidate.toLowerCase()) }))\n .filter((scored) => scored.distance <= budget)\n .sort((a, b) => a.distance - b.distance || compareIds(a.candidate, b.candidate))\n .slice(0, 3)\n .map((scored) => scored.candidate);\n}\n\n/** Plain Levenshtein — ids are short, and the row-at-a-time form keeps it obvious. */\nfunction editDistance(a: string, b: string): number {\n let previous = Array.from({ length: b.length + 1 }, (_, i) => i);\n for (let i = 1; i <= a.length; i += 1) {\n const current = [i];\n for (let j = 1; j <= b.length; j += 1) {\n const substitution = previous[j - 1]! + (a[i - 1] === b[j - 1] ? 0 : 1);\n current.push(Math.min(previous[j]! + 1, current[j - 1]! + 1, substitution));\n }\n previous = current;\n }\n return previous[b.length]!;\n}\n\n/**\n * The feature's OpenAPI delta for one service, as slots rather than names.\n *\n * The operation set comes from core/openapi.ts — the same structure-aware reader\n * every other check uses, so this view cannot see an operation validate does not.\n * `summary` is the one field that reader does not carry, and it is the sentence\n * an implementer most wants, so it is looked up by the path+method the reader\n * already resolved: a second read of the same document, never a second opinion\n * about what an operation IS.\n */\nasync function apiChanges(openapiPath: string): Promise<ApiChange[]> {\n if (!existsSync(openapiPath)) return [];\n const ops = await operations(openapiPath);\n if (ops.length === 0) return [];\n let doc: unknown;\n try {\n doc = parseYaml(await readFile(openapiPath, \"utf8\"));\n } catch {\n // Unreadable is impossible here (ops came back non-empty), but a summary is\n // decoration and must never be the reason a task brief fails to print.\n doc = null;\n }\n const summaryOf = (op: Operation): string | null => {\n const paths = (doc as { paths?: Record<string, unknown> } | null)?.paths;\n const item = paths?.[op.path] as Record<string, unknown> | undefined;\n const entry = item?.[op.method] as Record<string, unknown> | undefined;\n const summary = entry?.[\"summary\"];\n return typeof summary === \"string\" && summary.length > 0 ? summary : null;\n };\n return ops\n .map((op): ApiChange => ({\n path: op.path,\n method: op.method.toUpperCase(),\n operationId: op.id,\n summary: summaryOf(op),\n remove: op.remove,\n }))\n .sort((a, b) => compareIds(a.path, b.path) || compareIds(a.method, b.method));\n}\n\n/** The feature's tagged edges around one service, plus whether the service is new. */\nfunction archSlice(doc: LoadedDoc | null, service: string, featureId: string): ArchSlice {\n const empty: ArchSlice = { isNew: false, inbound: [], outbound: [], errors: [] };\n if (doc === null) return empty;\n\n const { errors, elements, relationships } = doc;\n if (errors.length > 0) {\n return { ...empty, errors: errors.map((e) => (typeof e.line === \"number\" ? `L${e.line}: ${e.message}` : e.message)) };\n }\n\n // Which service an element stands for is the binding's call, not the title's.\n const svcOf = (id: string): string => serviceOf(elements, id);\n const edge = (r: Rel, other: string): Edge => ({\n service: other,\n op: r.op ?? null,\n title: r.title ?? null,\n });\n const featRels = relationships.filter((r) => r.tags.includes(featureId));\n\n return {\n isNew: elements.some((e) => elementService(e) === service && e.tags.includes(featureId)),\n inbound: featRels.filter((r) => svcOf(r.target) === service).map((r) => edge(r, svcOf(r.source))),\n outbound: featRels.filter((r) => svcOf(r.source) === service).map((r) => edge(r, svcOf(r.target))),\n errors: [],\n };\n}\n\nfunction stripFrontmatter(md: string): string {\n if (!md.startsWith(\"---\")) return md;\n const close = md.indexOf(\"\\n---\", 3);\n if (close === -1) return md;\n const nl = md.indexOf(\"\\n\", close + 1);\n return nl === -1 ? \"\" : md.slice(nl + 1).trimStart();\n}\n\n/**\n * The requirement delta, in full.\n *\n * The text view used to print headings and scenario NAMES only, which made it a\n * table of contents for a file the reader then had to open — while `--json`\n * carried the requirement body and the Given/When/Then lines verbatim. The two\n * are the same briefing, so they carry the same content: a person reading this\n * in a terminal is being asked to implement it, exactly like the agent reading\n * the payload.\n */\nfunction printRequirements(reqs: Requirement[], label: string): void {\n if (reqs.length === 0) {\n console.log(`${label}: (none)\\n`);\n return;\n }\n console.log(`${label}:`);\n for (const r of reqs) {\n const tag = r.kind === \"BASE\" ? \"\" : `[${r.kind}] `;\n const n = r.scenarios.length;\n console.log(` ${tag}${r.name} (${n} scenario${n === 1 ? \"\" : \"s\"})`);\n const body = r.text.join(\"\\n\").trim();\n if (body.length > 0) console.log(indent(body, \" \"));\n if (r.operations.length > 0) console.log(` Operations: ${r.operations.join(\", \")}`);\n if (r.covers.length > 0) console.log(` Covers: ${r.covers.join(\", \")}`);\n for (const s of r.scenarios) {\n console.log(`\\n Scenario: ${s.name}`);\n // Verbatim, bullets and markdown emphasis included: these lines are the\n // acceptance criteria, and paraphrasing them here would put a second\n // wording of the contract in front of whoever implements it.\n for (const line of s.lines) console.log(` ${line}`);\n }\n console.log();\n }\n}\n\nfunction printApi(api: ApiChange[]): void {\n if (api.length === 0) {\n console.log(\"API: (the openapi delta defines no operations)\\n\");\n return;\n }\n console.log(\"API (this feature's openapi.yaml for the service):\");\n for (const op of api) {\n const marker = op.remove ? \"REMOVE \" : \"\";\n console.log(\n ` ${marker}${op.method} ${op.path} ${op.operationId}${op.summary === null ? \"\" : ` — ${op.summary}`}`,\n );\n }\n console.log();\n}\n\nfunction printArchSlice(arch: ArchSlice, service: string): void {\n if (arch.errors.length > 0) {\n console.log(\"Architecture: delta.likec4 has errors — run `loam validate`.\");\n return;\n }\n console.log(\"Architecture:\");\n if (arch.isNew) console.log(` NEW service — create ${service}`);\n if (arch.outbound.length > 0) {\n console.log(\" Outbound (new calls from this service):\");\n for (const e of arch.outbound) console.log(` → ${e.service} \"${e.title ?? \"\"}\"`);\n }\n if (arch.inbound.length > 0) {\n console.log(\" Inbound (this service is newly called):\");\n for (const e of arch.inbound) console.log(` ← ${e.service} \"${e.title ?? \"\"}\"`);\n }\n if (!arch.isNew && arch.outbound.length === 0 && arch.inbound.length === 0) {\n console.log(\" (no architecture change for this service)\");\n }\n console.log();\n}\n\nfunction indent(text: string, pad: string): string {\n return text\n .split(\"\\n\")\n .map((l) => (l.length > 0 ? pad + l : l))\n .join(\"\\n\");\n}\n"]}
|
|
1
|
+
{"version":3,"file":"delta.js","sourceRoot":"","sources":["../../src/commands/delta.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,C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C,OAAO,MAAM,CAAC,CAAC,KAAK,IAAI,EAAE,GAAG,CAAC,CAAC;IACtF,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3E,OAAO,CAAC,GAAG,CAAC,6CAA6C,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,CAAC,GAAG,EAAE,CAAC;AAChB,CAAC;AAED,SAAS,MAAM,CAAC,IAAY,EAAE,GAAW;IACvC,OAAO,IAAI;SACR,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACxC,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC","sourcesContent":["import type { Command } from \"commander\";\nimport { existsSync } from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\nimport { parse as parseYaml } from \"yaml\";\nimport { loadConfig } from \"../core/config.js\";\nimport { InvalidIdError, assertServiceId } from \"../core/ids.js\";\nimport { emitJson, emitJsonError, fail, repoPath, reportNoConfig } from \"../core/json.js\";\nimport { elementService, loadFile, serviceOf, type Elem, type LoadedDoc, type Rel } from \"../core/likec4.js\";\nimport { readOpenapi, type Operation } from \"../core/openapi.js\";\n// The summary walk below descends four levels into a document nobody has\n// validated, and `isRecord` is what it asks at each step: a cast there would\n// assert a shape the parser never promised, and a sequence or a scalar in any of\n// those slots would be indexed as a mapping.\nimport { isRecord } from \"../core/records.js\";\nimport {\n DocsRepoUnavailableError,\n compareIds,\n featurePaths,\n featureSpecPaths,\n listServices,\n missingFeatureMessage,\n nearestIds,\n resolveFeature,\n} from \"../core/repo.js\";\nimport { parseRequirements, type Requirement } from \"../core/spec.js\";\n\ninterface DeltaOptions {\n service?: string;\n json?: boolean;\n}\n\n/** One end of a feature edge, as seen from the projected service. */\ninterface Edge {\n service: string;\n op: string | null;\n title: string | null;\n}\n\ninterface ArchSlice {\n isNew: boolean;\n inbound: Edge[];\n outbound: Edge[];\n errors: string[];\n}\n\n/**\n * One operation the feature's OpenAPI delta defines for this service. The\n * projection is a task brief, and \"implement createSplit\" without the path and\n * the method is not a task — it is a name to go look up in a file the reader\n * was not told about.\n */\ninterface ApiChange {\n path: string;\n method: string;\n operationId: string;\n summary: string | null;\n /** `x-loam-remove: true` — this operation is being retired, not added. */\n remove: boolean;\n}\n\n/**\n * The contract axis of the brief: the operations, and whether the document they\n * came from could be read at all.\n *\n * The two have to travel together. A feature `openapi.yaml` that does not parse\n * yields zero operations, which is the same answer as a delta that genuinely\n * changes no endpoints — and this projection is a task brief, so \"no contract\n * work here\" over a YAML error is the vacuously-green trap the architecture\n * axis already guards against.\n */\ninterface ApiSlice {\n changes: ApiChange[];\n unreadable: boolean;\n /** The parser's own message, when there is one to quote back. */\n error?: string;\n}\n\nexport function registerDelta(program: Command): void {\n program\n .command(\"delta\")\n .argument(\"<featureId>\", \"feature id, e.g. FEAT-101\")\n .description(\"Project a feature onto a service: why + requirement delta + C4 changes\")\n .option(\"--service <id>\", \"service to project onto (defaults to the configured service)\")\n .option(\"--json\", \"emit the machine contract instead of the human view\")\n .action(async (featureId: string, opts: DeltaOptions) => {\n const json = opts.json === true;\n const config = await loadConfig();\n if (!config) {\n reportNoConfig(json);\n return;\n }\n\n // The id grammar first, and on the RAW argument: `--service ../../etc`\n // reaches `featureSpecPaths` and reads from outside the feature directory.\n // One grammar for the whole tool (core/ids.ts).\n if (opts.service !== undefined) {\n try {\n assertServiceId(opts.service, \"--service\");\n } catch (err) {\n if (!(err instanceof InvalidIdError)) throw err;\n fail(json, \"invalid-option\", err.message);\n return;\n }\n }\n\n // The feature is resolved BEFORE the service is chosen, because every\n // sentence about the service (\"which ones does this feature touch?\") is\n // only answerable once the feature is known.\n const feature = await resolveFeature(config.docsDir, featureId, \"exclude\");\n if (!feature) {\n fail(json, \"unknown-target\", await missingFeatureMessage(config.docsDir, featureId));\n return;\n }\n // Canonical id from here on — the delta's tags carry `#FEAT-5`, so a raw\n // `FEAT-5-slug` argument used to empty the architecture slice silently.\n const { id } = feature;\n const paths = featurePaths(feature.dir);\n\n const deltaDoc = existsSync(paths.delta) ? await loadFile(paths.delta) : null;\n // Services the feature speaks about at all: one with a requirement delta,\n // or one its C4 delta introduces. This is the list a refusal quotes.\n const featureServices = [\n ...new Set([...feature.services, ...introducedServices(deltaDoc, id)]),\n ].sort(compareIds);\n\n const service = opts.service ?? config.service;\n if (!service) {\n // The refusal NAMES the choices. \"No service. Pass --service <id>\" told\n // the reader the shape of the flag and nothing about the answer, so the\n // next step was always to go list the feature's specs/ by hand — and an\n // agent had no way to recover at all. The list rides the JSON envelope\n // for the same reason.\n const message =\n `No service to project ${id} onto. Pass --service <id> or set 'service' in loam.json.` +\n (featureServices.length === 0\n ? ` ${id} carries no per-service delta yet.`\n : ` ${id} touches: ${featureServices.join(\", \")}.`);\n if (json) emitJsonError(\"invalid-option\", message, { feature: id, services: featureServices });\n else {\n console.error(message);\n process.exitCode = 1;\n }\n return;\n }\n\n // A service nobody has heard of produces a perfectly plausible EMPTY\n // report — no requirements, no edges, \"no architecture change\" — which an\n // agent consuming this as a task brief reads as \"nothing to do here\".\n // A typo must never be indistinguishable from a finished service.\n const living = await livingServices(config.docsDir);\n if (!featureServices.includes(service) && !living.includes(service)) {\n const near = nearestIds(service, [...new Set([...featureServices, ...living])]);\n fail(\n json,\n \"unknown-target\",\n `No service '${service}': it is neither a services/${service}/ in the docs repo nor a service ${id} touches` +\n (featureServices.length === 0 ? \"\" : ` (${featureServices.join(\", \")})`) +\n (near.length === 0 ? \".\" : ` — did you mean ${near.map((n) => `'${n}'`).join(\" or \")}?`),\n );\n return;\n }\n\n // Why — business intent\n const intent = existsSync(paths.intent)\n ? stripFrontmatter(await readFile(paths.intent, \"utf8\")).trim()\n : null;\n\n // Requirement delta for this service (OpenSpec style), business and arch:\n // the same projection covers both axes, in the same shape, so the payload\n // stays one task — the arch requirements are the integration/ops half the\n // business ones never mention.\n const specPaths = featureSpecPaths(feature.dir, service);\n const reqs = existsSync(specPaths.spec)\n ? parseRequirements(await readFile(specPaths.spec, \"utf8\"))\n : [];\n const archReqs = existsSync(specPaths.archSpec)\n ? parseRequirements(await readFile(specPaths.archSpec, \"utf8\"))\n : [];\n\n // The contract axis. Until now no command surfaced it at all: the feature's\n // openapi.yaml was read by validate and by archive, and the one command\n // whose output IS the implementation task never mentioned it — so \"add the\n // endpoint\" was the half of the work the brief left out.\n const api = await apiChanges(specPaths.openapi);\n\n // C4 architecture slice\n const arch = archSlice(deltaDoc, service, id);\n\n // An unparseable delta.likec4 empties the C4 slice, and a consumer\n // reading this projection as a task brief — the JSON payload and the\n // printed view alike — would take that as \"no architecture change\": the\n // vacuously-green pattern. The output stays as informative as ever (and\n // `ok` stays true under --json: the command ran); the exit code is what\n // stops a pipeline from building on it, so it is set BEFORE the format\n // fork — the guard is about the delta, not about how it is rendered.\n //\n // The contract axis fails the same way and now earns the same guard: an\n // openapi.yaml that does not parse projected as an empty operation list,\n // and nothing upstream catches it either — `loam validate` grades\n // `openapi.invalid` on LIVING service contracts only, never on a\n // feature's delta.\n if (arch.errors.length > 0 || api.unreadable) process.exitCode = 1;\n\n if (json) {\n const reqJson = (r: Requirement): Record<string, unknown> => ({\n kind: r.kind,\n id: r.id,\n name: r.name,\n text: r.text.join(\"\\n\").trim(),\n operations: r.operations,\n covers: r.covers,\n // Scenarios go out verbatim: they are the acceptance criteria and the\n // source for the tests whoever picks this up is expected to write.\n scenarios: r.scenarios.map((s) => ({ name: s.name, lines: s.lines })),\n });\n emitJson({\n feature: id,\n service,\n services: featureServices,\n path: repoPath(config.docsDir, feature.dir),\n intent,\n requirements: reqs.map(reqJson),\n // Same shape, separate section: an arch requirement's scenarios are\n // integration/ops tests, and a consumer must not have to parse prose\n // to tell the two apart.\n archRequirements: archReqs.map(reqJson),\n api: api.changes,\n // `api` stays exactly the operations array it has always been — a\n // consumer indexing it must not have to learn a new shape — so the\n // readability of the document rides alongside as its own key,\n // spelled the way `loam show` already spells it for a living\n // contract. Additive, which the envelope permits (core/json.ts).\n openapi: {\n unreadable: api.unreadable,\n ...(api.error === undefined ? {} : { error: api.error }),\n },\n architecture: arch,\n });\n return;\n }\n\n console.log(`${id} · ${service}\\n`);\n if (intent) {\n console.log(indent(intent, \" \"));\n console.log();\n }\n if (existsSync(specPaths.spec)) printRequirements(reqs, \"Requirements\");\n else console.log(\"Requirements: (none for this service)\\n\");\n if (existsSync(specPaths.archSpec)) printRequirements(archReqs, \"Arch requirements\");\n if (existsSync(specPaths.openapi)) printApi(api);\n if (existsSync(paths.delta)) printArchSlice(arch, service);\n });\n}\n\n/** Every service in the docs repo, or none when there is no docs repo to ask. */\nasync function livingServices(docsDir: string): Promise<string[]> {\n try {\n return (await listServices(docsDir)).map((s) => s.id);\n } catch (err) {\n // \"There is no docs repo at all\" is a different diagnosis with its own\n // command (`loam doctor`); turning it into \"unknown service\" here would\n // send the reader after a typo that is not there.\n if (!(err instanceof DocsRepoUnavailableError)) throw err;\n return [];\n }\n}\n\n/** Services the feature's C4 delta introduces — its own tagged top-level elements. */\nfunction introducedServices(doc: LoadedDoc | null, featureId: string): string[] {\n if (doc === null || doc.errors.length > 0) return [];\n return doc.elements.filter((e: Elem) => e.tags.includes(featureId)).map(elementService);\n}\n\n/**\n * The feature's OpenAPI delta for one service, as slots rather than names.\n *\n * The operation set comes from core/openapi.ts — the same structure-aware reader\n * every other check uses, so this view cannot see an operation validate does not.\n * `summary` is the one field that reader does not carry, and it is the sentence\n * an implementer most wants, so it is looked up by the path+method the reader\n * already resolved: a second read of the same document, never a second opinion\n * about what an operation IS.\n */\nasync function apiChanges(openapiPath: string): Promise<ApiSlice> {\n if (!existsSync(openapiPath)) return { changes: [], unreadable: false };\n // `readOpenapi`, not `operations`: the operation list alone cannot tell a\n // contract that defines nothing from one that could not be read, and this is\n // the command whose output IS the implementation task.\n const api = await readOpenapi(openapiPath);\n if (api.unreadable) {\n return { changes: [], unreadable: true, ...(api.error === undefined ? {} : { error: api.error }) };\n }\n const ops = api.ops;\n if (ops.length === 0) return { changes: [], unreadable: false };\n let doc: unknown;\n try {\n doc = parseYaml(await readFile(openapiPath, \"utf8\"));\n } catch {\n // Unreadable is impossible here (the reader above said otherwise), but a\n // summary is decoration and must never be the reason a task brief fails to\n // print.\n doc = null;\n }\n const summaryOf = (op: Operation): string | null => {\n if (!isRecord(doc)) return null;\n const paths = doc[\"paths\"];\n if (!isRecord(paths)) return null;\n const item = paths[op.path];\n if (!isRecord(item)) return null;\n const entry = item[op.method];\n if (!isRecord(entry)) return null;\n const summary = entry[\"summary\"];\n return typeof summary === \"string\" && summary.length > 0 ? summary : null;\n };\n return {\n changes: ops\n .map((op): ApiChange => ({\n path: op.path,\n method: op.method.toUpperCase(),\n operationId: op.id,\n summary: summaryOf(op),\n remove: op.remove,\n }))\n .sort((a, b) => compareIds(a.path, b.path) || compareIds(a.method, b.method)),\n unreadable: false,\n };\n}\n\n/** The feature's tagged edges around one service, plus whether the service is new. */\nfunction archSlice(doc: LoadedDoc | null, service: string, featureId: string): ArchSlice {\n const empty: ArchSlice = { isNew: false, inbound: [], outbound: [], errors: [] };\n if (doc === null) return empty;\n\n const { errors, elements, relationships } = doc;\n if (errors.length > 0) {\n return { ...empty, errors: errors.map((e) => (typeof e.line === \"number\" ? `L${e.line}: ${e.message}` : e.message)) };\n }\n\n // Which service an element stands for is the binding's call, not the title's.\n const svcOf = (id: string): string => serviceOf(elements, id);\n const edge = (r: Rel, other: string): Edge => ({\n service: other,\n op: r.op ?? null,\n title: r.title ?? null,\n });\n const featRels = relationships.filter((r) => r.tags.includes(featureId));\n\n return {\n isNew: elements.some((e) => elementService(e) === service && e.tags.includes(featureId)),\n inbound: featRels.filter((r) => svcOf(r.target) === service).map((r) => edge(r, svcOf(r.source))),\n outbound: featRels.filter((r) => svcOf(r.source) === service).map((r) => edge(r, svcOf(r.target))),\n errors: [],\n };\n}\n\nfunction stripFrontmatter(md: string): string {\n if (!md.startsWith(\"---\")) return md;\n const close = md.indexOf(\"\\n---\", 3);\n if (close === -1) return md;\n const nl = md.indexOf(\"\\n\", close + 1);\n return nl === -1 ? \"\" : md.slice(nl + 1).trimStart();\n}\n\n/**\n * The requirement delta, in full.\n *\n * The text view used to print headings and scenario NAMES only, which made it a\n * table of contents for a file the reader then had to open — while `--json`\n * carried the requirement body and the Given/When/Then lines verbatim. The two\n * are the same briefing, so they carry the same content: a person reading this\n * in a terminal is being asked to implement it, exactly like the agent reading\n * the payload.\n */\nfunction printRequirements(reqs: Requirement[], label: string): void {\n if (reqs.length === 0) {\n console.log(`${label}: (none)\\n`);\n return;\n }\n console.log(`${label}:`);\n for (const r of reqs) {\n const tag = r.kind === \"BASE\" ? \"\" : `[${r.kind}] `;\n const n = r.scenarios.length;\n console.log(` ${tag}${r.name} (${n} scenario${n === 1 ? \"\" : \"s\"})`);\n const body = r.text.join(\"\\n\").trim();\n if (body.length > 0) console.log(indent(body, \" \"));\n if (r.operations.length > 0) console.log(` Operations: ${r.operations.join(\", \")}`);\n if (r.covers.length > 0) console.log(` Covers: ${r.covers.join(\", \")}`);\n for (const s of r.scenarios) {\n console.log(`\\n Scenario: ${s.name}`);\n // Verbatim, bullets and markdown emphasis included: these lines are the\n // acceptance criteria, and paraphrasing them here would put a second\n // wording of the contract in front of whoever implements it.\n for (const line of s.lines) console.log(` ${line}`);\n }\n console.log();\n }\n}\n\nfunction printApi(api: ApiSlice): void {\n if (api.unreadable) {\n // Worded like `loam show`'s answer for the same failure on a living\n // contract, and deliberately WITHOUT a \"run `loam validate`\" hint: validate\n // grades `openapi.invalid` on living service contracts only, so it has\n // nothing to say about this file and sending the reader there is a dead end.\n console.log(\"API: openapi.yaml does not parse\");\n if (api.error !== undefined) console.log(` ${api.error}`);\n console.log();\n return;\n }\n if (api.changes.length === 0) {\n console.log(\"API: (the openapi delta defines no operations)\\n\");\n return;\n }\n console.log(\"API (this feature's openapi.yaml for the service):\");\n for (const op of api.changes) {\n const marker = op.remove ? \"REMOVE \" : \"\";\n console.log(\n ` ${marker}${op.method} ${op.path} ${op.operationId}${op.summary === null ? \"\" : ` — ${op.summary}`}`,\n );\n }\n console.log();\n}\n\nfunction printArchSlice(arch: ArchSlice, service: string): void {\n if (arch.errors.length > 0) {\n console.log(\"Architecture: delta.likec4 has errors — run `loam validate`.\");\n return;\n }\n console.log(\"Architecture:\");\n if (arch.isNew) console.log(` NEW service — create ${service}`);\n if (arch.outbound.length > 0) {\n console.log(\" Outbound (new calls from this service):\");\n for (const e of arch.outbound) console.log(` → ${e.service} \"${e.title ?? \"\"}\"`);\n }\n if (arch.inbound.length > 0) {\n console.log(\" Inbound (this service is newly called):\");\n for (const e of arch.inbound) console.log(` ← ${e.service} \"${e.title ?? \"\"}\"`);\n }\n if (!arch.isNew && arch.outbound.length === 0 && arch.inbound.length === 0) {\n console.log(\" (no architecture change for this service)\");\n }\n console.log();\n}\n\nfunction indent(text: string, pad: string): string {\n return text\n .split(\"\\n\")\n .map((l) => (l.length > 0 ? pad + l : l))\n .join(\"\\n\");\n}\n"]}
|
|
@@ -2,7 +2,7 @@ import { loadConfig } from "../core/config.js";
|
|
|
2
2
|
import { analyzeDependencies, } from "../core/dependencies.js";
|
|
3
3
|
import { FleetContext } from "../core/fleet-context.js";
|
|
4
4
|
import { emitJson, fail, reportNoConfig } from "../core/json.js";
|
|
5
|
-
import { resolveFeature } from "../core/repo.js";
|
|
5
|
+
import { missingFeatureMessage, resolveFeature } from "../core/repo.js";
|
|
6
6
|
export function registerDependencies(program) {
|
|
7
7
|
program
|
|
8
8
|
.command("dependencies")
|
|
@@ -21,7 +21,12 @@ export function registerDependencies(program) {
|
|
|
21
21
|
? null
|
|
22
22
|
: await resolveFeature(config.docsDir, featureArg, "exclude", context);
|
|
23
23
|
if (featureArg !== undefined && feature === null) {
|
|
24
|
-
|
|
24
|
+
// The shared miss message rather than a local one: this command resolves
|
|
25
|
+
// in `exclude` mode, so the commonest miss is an id that HAS shipped, and
|
|
26
|
+
// "no active feature" leaves the reader to discover that themselves. The
|
|
27
|
+
// helper reuses the context already built above, so saying so costs one
|
|
28
|
+
// enumeration this invocation has already paid for.
|
|
29
|
+
fail(json, "unknown-target", await missingFeatureMessage(config.docsDir, featureArg, context));
|
|
25
30
|
return;
|
|
26
31
|
}
|
|
27
32
|
const graph = await analyzeDependencies(config.docsDir, feature?.id, context);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../src/commands/dependencies.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EACL,mBAAmB,GAGpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../src/commands/dependencies.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EACL,mBAAmB,GAGpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAMxE,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IACnD,OAAO;SACJ,OAAO,CAAC,cAAc,CAAC;SACvB,QAAQ,CAAC,aAAa,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YACzC,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO;gBAAE,OAAO,CAAC,GAAG,CAAC,WAAW,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAClF,CAAC;IACH,CAAC;IAED,IAAI,KAAK,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/B,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;QAC7B,KAAK,MAAM,QAAQ,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;YACvC,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,KAAK,aAAa;gBAC3C,CAAC,CAAC,GAAG,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE;gBACxC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC;YACrB,uEAAuE;YACvE,wEAAwE;YACxE,yEAAyE;YACzE,0EAA0E;YAC1E,4DAA4D;YAC5D,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC;YACpE,OAAO,CAAC,GAAG,CAAC,SAAS,KAAK,IAAI,QAAQ,CAAC,QAAQ,MAAM,GAAG,IAAI,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC9F,CAAC;IACH,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5B,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC1B,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,MAAM;YAAE,OAAO,CAAC,GAAG,CAAC,SAAS,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC9E,CAAC;AACH,CAAC","sourcesContent":["import type { Command } from \"commander\";\nimport { loadConfig } from \"../core/config.js\";\nimport {\n analyzeDependencies,\n type DependencyGraph,\n type DependencyReason,\n} from \"../core/dependencies.js\";\nimport { FleetContext } from \"../core/fleet-context.js\";\nimport { emitJson, fail, reportNoConfig } from \"../core/json.js\";\nimport { missingFeatureMessage, resolveFeature } from \"../core/repo.js\";\n\ninterface DependenciesOptions {\n json?: boolean;\n}\n\nexport function registerDependencies(program: Command): void {\n program\n .command(\"dependencies\")\n .argument(\"[featureId]\", \"active feature id; omit for the whole in-flight graph\")\n .description(\"Show dependencies and conflicts derived from active feature artifacts\")\n .option(\"--json\", \"emit the machine contract instead of the human view\")\n .action(async (featureArg: string | undefined, opts: DependenciesOptions) => {\n const json = opts.json === true;\n const config = await loadConfig();\n if (!config) {\n reportNoConfig(json);\n return;\n }\n\n const context = new FleetContext();\n const feature = featureArg === undefined\n ? null\n : await resolveFeature(config.docsDir, featureArg, \"exclude\", context);\n if (featureArg !== undefined && feature === null) {\n // The shared miss message rather than a local one: this command resolves\n // in `exclude` mode, so the commonest miss is an id that HAS shipped, and\n // \"no active feature\" leaves the reader to discover that themselves. The\n // helper reuses the context already built above, so saying so costs one\n // enumeration this invocation has already paid for.\n fail(json, \"unknown-target\", await missingFeatureMessage(config.docsDir, featureArg, context));\n return;\n }\n\n const graph = await analyzeDependencies(config.docsDir, feature?.id, context);\n if (json) {\n emitJson({\n command: \"dependencies\",\n docsDir: config.docsDir,\n feature: feature?.id ?? null,\n ...graph,\n });\n return;\n }\n printGraph(graph, feature?.id);\n });\n}\n\nfunction reasonText(reason: DependencyReason): string {\n return reason.kind === \"operation\"\n ? `${reason.service} operation ${reason.operationId}`\n : `${reason.service}/${reason.axis} ${reason.identity}`;\n}\n\nfunction printGraph(graph: DependencyGraph, featureId?: string): void {\n const scope = featureId === undefined ? \"active features\" : `${featureId} and prerequisites`;\n console.log(`dependencies — ${scope} (${graph.nodes.length})`);\n console.log(` order: ${graph.order.length === 0 ? \"(none)\" : graph.order.join(\" → \")}`);\n\n for (const node of graph.nodes) {\n console.log(`\\n ${node.id}${node.dependsOn.length === 0 ? \" (independent)\" : \"\"}`);\n for (const edge of graph.edges.filter((candidate) => candidate.from === node.id)) {\n console.log(` depends on ${edge.to}`);\n for (const reason of edge.reasons) console.log(` - ${reasonText(reason)}`);\n }\n }\n\n if (graph.conflicts.length > 0) {\n console.log(\"\\n conflicts\");\n for (const conflict of graph.conflicts) {\n const where = conflict.kind === \"requirement\"\n ? `${conflict.service}/${conflict.axis}`\n : conflict.service;\n // \"added by\" vs \"changed by\": the two collisions want different fixes.\n // Two features ADDING the same identity is usually duplicated work that\n // should become one feature; two features CHANGING it is usually genuine\n // parallel work whose second archive would silently overwrite the first's\n // full text, so the losers need to be re-based, not merged.\n const how = conflict.change === \"added\" ? \"added by\" : \"changed by\";\n console.log(` ! ${where} ${conflict.identity} — ${how} ${conflict.features.join(\", \")}`);\n }\n }\n\n if (graph.cycles.length > 0) {\n console.log(\"\\n cycles\");\n for (const cycle of graph.cycles) console.log(` ! ${cycle.join(\" ↔ \")}`);\n }\n}\n"]}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The three refusals every command owes a docs repo it cannot read.
|
|
3
|
+
*
|
|
4
|
+
* One doctrine, three ways of reaching it: the gate a command passes before it
|
|
5
|
+
* enumerates anything, the error the enumeration throws when the repo goes away
|
|
6
|
+
* underneath it, and the errno that comes back when the repo is real but one
|
|
7
|
+
* file under it will not open. Six commands reach for one or another of them
|
|
8
|
+
* (`adopt`, `list`, `new`, `show`, `status`, `validate`), and the whole point of
|
|
9
|
+
* collecting them is that all six answer with the same sentences.
|
|
10
|
+
*
|
|
11
|
+
* They live in `commands/` rather than in `core/`: each one calls `fail`, which
|
|
12
|
+
* writes to stdout or stderr and sets the exit code. That is a decision about
|
|
13
|
+
* how this process ends, and core modules compute answers rather than end
|
|
14
|
+
* processes.
|
|
15
|
+
*/
|
|
16
|
+
import { fail } from "../core/json.js";
|
|
17
|
+
import { docsRepoState } from "../core/repo.js";
|
|
18
|
+
/**
|
|
19
|
+
* The refusal every READ command owes a `docsDir` that is not a docs repo.
|
|
20
|
+
*
|
|
21
|
+
* It is not a formality. `validate --all` and `list` used to answer a docsDir
|
|
22
|
+
* that does not exist with a green report over zero services, which is the one
|
|
23
|
+
* output a fleet gate must never produce: "nothing is wrong" and "I could not
|
|
24
|
+
* look" are opposite facts, and in CI the first one merges. The two codes are
|
|
25
|
+
* kept apart because the fixes point in different directions — a wrong path in
|
|
26
|
+
* loam.json versus a docs repo that was never cloned or scaffolded — exactly
|
|
27
|
+
* the way `no-config` and `config-invalid` are kept apart.
|
|
28
|
+
*
|
|
29
|
+
* "Zero services" stays reachable, and only from a REAL docs repo whose
|
|
30
|
+
* `services/` is empty: that is a legitimate state (before the first
|
|
31
|
+
* `loam adopt`) and it must keep exiting 0.
|
|
32
|
+
*
|
|
33
|
+
* `need` says how much of a docs repo this particular run has to have. A run
|
|
34
|
+
* that only reads features genuinely does not need `services/` — repo.ts takes
|
|
35
|
+
* the same position for `listFeatures` — and refusing there would turn one
|
|
36
|
+
* diagnosis into two contradictory ones. A run that enumerates services needs
|
|
37
|
+
* the directory that IS the list of services.
|
|
38
|
+
*
|
|
39
|
+
* It used to live in validate.ts, on the reasoning that validate is the fleet
|
|
40
|
+
* gate this doctrine is about. Six commands import it now (`adopt`, `list`,
|
|
41
|
+
* `new`, `show`, `status`, `validate`), so the doctrine outgrew its host: `loam
|
|
42
|
+
* show` was structurally depending on the whole validate implementation for
|
|
43
|
+
* twenty lines of policy. The rule is the module now, and validate is one of
|
|
44
|
+
* its callers like the rest.
|
|
45
|
+
*/
|
|
46
|
+
export function docsRepoReady(json, docsDir, need) {
|
|
47
|
+
const state = docsRepoState(docsDir);
|
|
48
|
+
if (state.kind === "ok" || (state.kind === "no-services" && need === "docs"))
|
|
49
|
+
return true;
|
|
50
|
+
if (state.kind === "missing") {
|
|
51
|
+
fail(json, "docs-missing", `The configured docs repo does not exist: ${state.path}. ` +
|
|
52
|
+
"Fix `docsDir` in loam.json, clone the docs repo there, " +
|
|
53
|
+
"or run `loam init --docs <dir> --create` to make a new one.");
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
fail(json, "services-missing", `${state.path} is not a docs repo — it has no services/ directory. ` +
|
|
57
|
+
"Point `docsDir` in loam.json at the shared docs repo, " +
|
|
58
|
+
"or run `loam init --docs <dir> --create` to make one.");
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The same refusal, reached the other way: `listServices`/`listFeatures` throw
|
|
63
|
+
* `DocsRepoUnavailableError` when the repo goes away mid-run (or when a caller
|
|
64
|
+
* reaches enumeration without passing the gate above). Mapping it back onto the
|
|
65
|
+
* same two codes keeps one breach spelled one way, instead of surfacing as the
|
|
66
|
+
* `internal` catch-all in cli.ts.
|
|
67
|
+
*/
|
|
68
|
+
export function reportDocsRepoError(json, err) {
|
|
69
|
+
fail(json, err.state.kind === "missing" ? "docs-missing" : "services-missing", err.message);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The third refusal a reading command owes: the docs repo IS a docs repo, but
|
|
73
|
+
* one file under it cannot be read. `list`, `show`, `status` and `validate` all
|
|
74
|
+
* walk a directory tree to answer, so all four owe the same sentence — and all
|
|
75
|
+
* four kept their own copy of it, which is exactly how three of them ended up
|
|
76
|
+
* wrong. Sharing it here, beside `reportDocsRepoError`, is the same trade: one
|
|
77
|
+
* breach spelled one way instead of four that drift.
|
|
78
|
+
*
|
|
79
|
+
* A filesystem failure is recognised by its errno, NOT by carrying a `path`.
|
|
80
|
+
* Node reports EISDIR from `read()` with no path at all — the directory opened,
|
|
81
|
+
* the read failed — so a guard that looked only for `path` was defeated by the
|
|
82
|
+
* commonest way a malformed docs repo breaks: one directory sitting where a
|
|
83
|
+
* file belongs escaped as a bare `internal: EISDIR`, naming neither the file
|
|
84
|
+
* nor the target. Anything carrying no errno at all is a real bug, and still
|
|
85
|
+
* escapes untouched.
|
|
86
|
+
*
|
|
87
|
+
* `consequence` is the clause after "so" — what the caller could not answer
|
|
88
|
+
* because of this. It is the only part that differs between the four.
|
|
89
|
+
*/
|
|
90
|
+
export function reportRepositoryUnavailable(json, err, consequence, docsDir) {
|
|
91
|
+
const e = err;
|
|
92
|
+
if (e.path === undefined && typeof e.errno !== "number")
|
|
93
|
+
throw err;
|
|
94
|
+
const why = err instanceof Error ? err.message : String(err);
|
|
95
|
+
fail(json, "repository-unavailable", e.path !== undefined
|
|
96
|
+
? `${e.path} could not be read, so ${consequence}. ${why}`
|
|
97
|
+
: // Naming the target's own directory here would be a guess, and a guess
|
|
98
|
+
// that is wrong precisely when it matters: one malformed artifact makes
|
|
99
|
+
// every OTHER target's answer fail too, and each would have accused its
|
|
100
|
+
// own files. Say what is known instead.
|
|
101
|
+
`A file under ${docsDir} could not be read, so ${consequence}. ${why}. ` +
|
|
102
|
+
`The failure named no path — that is how Node reports a directory sitting where a file belongs.`);
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=docs-repo-gate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs-repo-gate.js","sourceRoot":"","sources":["../../src/commands/docs-repo-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,aAAa,EAAiC,MAAM,iBAAiB,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,aAAa,CAAC,IAAa,EAAE,OAAe,EAAE,IAAyB;IACrF,MAAM,KAAK,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IACrC,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,aAAa,IAAI,IAAI,KAAK,MAAM,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1F,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC7B,IAAI,CACF,IAAI,EACJ,cAAc,EACd,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*\n * One doctrine, three ways of reaching it: the gate a command passes before it\n * enumerates anything, the error the enumeration throws when the repo goes away\n * underneath it, and the errno that comes back when the repo is real but one\n * file under it will not open. Six commands reach for one or another of them\n * (`adopt`, `list`, `new`, `show`, `status`, `validate`), and the whole point of\n * collecting them is that all six answer with the same sentences.\n *\n * They live in `commands/` rather than in `core/`: each one calls `fail`, which\n * writes to stdout or stderr and sets the exit code. That is a decision about\n * how this process ends, and core modules compute answers rather than end\n * processes.\n */\nimport { fail } from \"../core/json.js\";\nimport { docsRepoState, type DocsRepoUnavailableError } from \"../core/repo.js\";\n\n/**\n * The refusal every READ command owes a `docsDir` that is not a docs repo.\n *\n * It is not a formality. `validate --all` and `list` used to answer a docsDir\n * that does not exist with a green report over zero services, which is the one\n * output a fleet gate must never produce: \"nothing is wrong\" and \"I could not\n * look\" are opposite facts, and in CI the first one merges. The two codes are\n * kept apart because the fixes point in different directions — a wrong path in\n * loam.json versus a docs repo that was never cloned or scaffolded — exactly\n * the way `no-config` and `config-invalid` are kept apart.\n *\n * \"Zero services\" stays reachable, and only from a REAL docs repo whose\n * `services/` is empty: that is a legitimate state (before the first\n * `loam adopt`) and it must keep exiting 0.\n *\n * `need` says how much of a docs repo this particular run has to have. A run\n * that only reads features genuinely does not need `services/` — repo.ts takes\n * the same position for `listFeatures` — and refusing there would turn one\n * diagnosis into two contradictory ones. A run that enumerates services needs\n * the directory that IS the list of services.\n *\n * It used to live in validate.ts, on the reasoning that validate is the fleet\n * gate this doctrine is about. Six commands import it now (`adopt`, `list`,\n * `new`, `show`, `status`, `validate`), so the doctrine outgrew its host: `loam\n * show` was structurally depending on the whole validate implementation for\n * twenty lines of policy. The rule is the module now, and validate is one of\n * its callers like the rest.\n */\nexport function docsRepoReady(json: boolean, docsDir: string, need: \"docs\" | \"services\"): boolean {\n const state = docsRepoState(docsDir);\n if (state.kind === \"ok\" || (state.kind === \"no-services\" && need === \"docs\")) return true;\n if (state.kind === \"missing\") {\n fail(\n json,\n \"docs-missing\",\n `The configured docs repo does not exist: ${state.path}. ` +\n \"Fix `docsDir` in loam.json, clone the docs repo there, \" +\n \"or run `loam init --docs <dir> --create` to make a new one.\",\n );\n return false;\n }\n fail(\n json,\n \"services-missing\",\n `${state.path} is not a docs repo — it has no services/ directory. ` +\n \"Point `docsDir` in loam.json at the shared docs repo, \" +\n \"or run `loam init --docs <dir> --create` to make one.\",\n );\n return false;\n}\n\n/**\n * The same refusal, reached the other way: `listServices`/`listFeatures` throw\n * `DocsRepoUnavailableError` when the repo goes away mid-run (or when a caller\n * reaches enumeration without passing the gate above). Mapping it back onto the\n * same two codes keeps one breach spelled one way, instead of surfacing as the\n * `internal` catch-all in cli.ts.\n */\nexport function reportDocsRepoError(json: boolean, err: DocsRepoUnavailableError): void {\n fail(json, err.state.kind === \"missing\" ? \"docs-missing\" : \"services-missing\", err.message);\n}\n\n/**\n * The third refusal a reading command owes: the docs repo IS a docs repo, but\n * one file under it cannot be read. `list`, `show`, `status` and `validate` all\n * walk a directory tree to answer, so all four owe the same sentence — and all\n * four kept their own copy of it, which is exactly how three of them ended up\n * wrong. Sharing it here, beside `reportDocsRepoError`, is the same trade: one\n * breach spelled one way instead of four that drift.\n *\n * A filesystem failure is recognised by its errno, NOT by carrying a `path`.\n * Node reports EISDIR from `read()` with no path at all — the directory opened,\n * the read failed — so a guard that looked only for `path` was defeated by the\n * commonest way a malformed docs repo breaks: one directory sitting where a\n * file belongs escaped as a bare `internal: EISDIR`, naming neither the file\n * nor the target. Anything carrying no errno at all is a real bug, and still\n * escapes untouched.\n *\n * `consequence` is the clause after \"so\" — what the caller could not answer\n * because of this. It is the only part that differs between the four.\n */\nexport function reportRepositoryUnavailable(\n json: boolean,\n err: unknown,\n consequence: string,\n docsDir: string,\n): void {\n const e = err as NodeJS.ErrnoException;\n if (e.path === undefined && typeof e.errno !== \"number\") throw err;\n const why = err instanceof Error ? err.message : String(err);\n fail(\n json,\n \"repository-unavailable\",\n e.path !== undefined\n ? `${e.path} could not be read, so ${consequence}. ${why}`\n : // Naming the target's own directory here would be a guess, and a guess\n // that is wrong precisely when it matters: one malformed artifact makes\n // every OTHER target's answer fail too, and each would have accused its\n // own files. Say what is known instead.\n `A file under ${docsDir} could not be read, so ${consequence}. ${why}. ` +\n `The failure named no path — that is how Node reports a directory sitting where a file belongs.`,\n );\n}\n"]}
|