kibi-cli 2.29.0 → 2.30.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.
Files changed (81) hide show
  1. package/dist/cli-operation-metadata.d.ts +8 -8
  2. package/dist/cli-operation-metadata.js +8 -8
  3. package/dist/cli-register-reporting.d.ts.map +1 -1
  4. package/dist/cli-register-reporting.js +12 -0
  5. package/dist/commands/check.d.ts.map +1 -1
  6. package/dist/commands/check.js +4 -0
  7. package/dist/commands/signoff.d.ts +37 -0
  8. package/dist/commands/signoff.d.ts.map +1 -0
  9. package/dist/commands/signoff.js +152 -0
  10. package/dist/operations/modeling/predicate-applicability.d.ts +5 -1
  11. package/dist/operations/modeling/predicate-applicability.d.ts.map +1 -1
  12. package/dist/operations/modeling/predicate-applicability.js +35 -2
  13. package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -1
  14. package/dist/operations/modeling/suggest-predicates.js +3 -1
  15. package/dist/operations/mutation/contradictions.d.ts +7 -5
  16. package/dist/operations/mutation/contradictions.d.ts.map +1 -1
  17. package/dist/operations/mutation/contradictions.js +8 -6
  18. package/dist/operations/mutation/source-authoring.d.ts +15 -0
  19. package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
  20. package/dist/operations/mutation/source-authoring.js +19 -7
  21. package/dist/operations/mutation/types.d.ts +5 -0
  22. package/dist/operations/mutation/types.d.ts.map +1 -1
  23. package/dist/operations/mutation/upsert.d.ts +14 -0
  24. package/dist/operations/mutation/upsert.d.ts.map +1 -1
  25. package/dist/operations/mutation/upsert.js +42 -36
  26. package/dist/operations/mutation/validate-upsert.d.ts.map +1 -1
  27. package/dist/operations/mutation/validate-upsert.js +61 -37
  28. package/dist/public/operations/catalog.d.ts +29 -8
  29. package/dist/public/operations/catalog.d.ts.map +1 -1
  30. package/dist/public/operations/contracts.d.ts.map +1 -1
  31. package/dist/public/operations/contracts.js +2 -0
  32. package/dist/public/operations/specs/bootstrap.d.ts +1 -1
  33. package/dist/public/operations/specs/bootstrap.js +1 -1
  34. package/dist/public/operations/specs/composite.d.ts +1 -1
  35. package/dist/public/operations/specs/composite.js +1 -1
  36. package/dist/public/operations/specs/discovery.d.ts +1 -1
  37. package/dist/public/operations/specs/discovery.js +1 -1
  38. package/dist/public/operations/specs/impact-review-preparation.d.ts +2 -1
  39. package/dist/public/operations/specs/impact-review-preparation.d.ts.map +1 -1
  40. package/dist/public/operations/specs/impact-review-preparation.js +2 -1
  41. package/dist/public/operations/specs/planning.d.ts +1 -1
  42. package/dist/public/operations/specs/planning.js +1 -1
  43. package/dist/public/operations/specs/reporting.d.ts +23 -3
  44. package/dist/public/operations/specs/reporting.d.ts.map +1 -1
  45. package/dist/public/operations/specs/reporting.js +97 -21
  46. package/dist/public/skills/kibi-commit-review/SKILL.md +125 -0
  47. package/dist/public/skills/kibi-commit-review/resources/staged-gate.md +98 -0
  48. package/dist/public/skills/kibi-decisions/SKILL.md +130 -0
  49. package/dist/public/skills/kibi-decisions/resources/decision-records.md +142 -0
  50. package/dist/public/skills/kibi-decisions/resources/signoff-views.md +66 -0
  51. package/dist/public/skills/kibi-freshness/SKILL.md +2 -0
  52. package/dist/public/skills/kibi-traceability/SKILL.md +4 -0
  53. package/dist/public/skills/kibi-usage/SKILL.md +20 -15
  54. package/dist/signoff/collect.d.ts +39 -0
  55. package/dist/signoff/collect.d.ts.map +1 -0
  56. package/dist/signoff/collect.js +398 -0
  57. package/dist/signoff/html.d.ts +4 -0
  58. package/dist/signoff/html.d.ts.map +1 -0
  59. package/dist/signoff/html.js +210 -0
  60. package/dist/signoff/markdown.d.ts +20 -0
  61. package/dist/signoff/markdown.d.ts.map +1 -0
  62. package/dist/signoff/markdown.js +203 -0
  63. package/dist/signoff/model.d.ts +134 -0
  64. package/dist/signoff/model.d.ts.map +1 -0
  65. package/dist/signoff/model.js +138 -0
  66. package/package.json +2 -2
  67. package/src/public/operations/contracts.ts +2 -0
  68. package/src/public/operations/specs/bootstrap.ts +1 -1
  69. package/src/public/operations/specs/composite.ts +1 -1
  70. package/src/public/operations/specs/discovery.ts +1 -1
  71. package/src/public/operations/specs/impact-review-preparation.ts +3 -1
  72. package/src/public/operations/specs/planning.ts +1 -1
  73. package/src/public/operations/specs/reporting.ts +109 -21
  74. package/src/public/skills/kibi-commit-review/SKILL.md +125 -0
  75. package/src/public/skills/kibi-commit-review/resources/staged-gate.md +98 -0
  76. package/src/public/skills/kibi-decisions/SKILL.md +130 -0
  77. package/src/public/skills/kibi-decisions/resources/decision-records.md +142 -0
  78. package/src/public/skills/kibi-decisions/resources/signoff-views.md +66 -0
  79. package/src/public/skills/kibi-freshness/SKILL.md +2 -0
  80. package/src/public/skills/kibi-traceability/SKILL.md +4 -0
  81. package/src/public/skills/kibi-usage/SKILL.md +20 -15
@@ -873,9 +873,15 @@ export function isUntrackedByGit(workspaceRoot, relative) {
873
873
  return error.status === 1;
874
874
  }
875
875
  }
876
- export async function writeSourceForUpsert(input, entity, existing, context, sourceDocumentOverride) {
877
- if (!context?.fs)
878
- return null;
876
+ // implements REQ-kibi-operation-interface-parity
877
+ /**
878
+ * The authored document an upsert publishes, resolved and rendered without
879
+ * writing: the target path (with its containment checks), the current bytes
880
+ * and the bytes the write would publish. writeSourceForUpsert publishes
881
+ * exactly this, and a kb_upsert dry run renders it so a path or format the
882
+ * write would refuse is refused by the dry run too.
883
+ */
884
+ export async function renderSourceWrite(input, entity, existing, context, sourceDocumentOverride) {
879
885
  const absolute = sourcePath(context, input, entity, existing);
880
886
  const relative = path
881
887
  .relative(context.workspaceRoot, absolute)
@@ -887,10 +893,6 @@ export async function writeSourceForUpsert(input, entity, existing, context, sou
887
893
  catch {
888
894
  before = undefined;
889
895
  }
890
- // Freshness compares file times with the compiled snapshot, so restoring
891
- // the bytes alone would still make an untouched entity read as stale after
892
- // a rolled-back write. Snapshot the times before the publication below.
893
- const priorTimes = before === undefined ? null : readFileTimes(absolute);
894
896
  // Proof-receipt ingest supplies pre-patched bytes so unrelated frontmatter
895
897
  // keeps its authored formatting (and the workspace snapshot stays stable).
896
898
  // Only valid when the document already exists; a new document still needs
@@ -898,6 +900,16 @@ export async function writeSourceForUpsert(input, entity, existing, context, sou
898
900
  const after = before !== undefined && sourceDocumentOverride !== undefined
899
901
  ? sourceDocumentOverride
900
902
  : renderSourceDocument(input, entity, before, relative);
903
+ return { absolute, relative, before, after };
904
+ }
905
+ export async function writeSourceForUpsert(input, entity, existing, context, sourceDocumentOverride) {
906
+ if (!context?.fs)
907
+ return null;
908
+ const { absolute, relative, before, after } = await renderSourceWrite(input, entity, existing, { ...context, fs: context.fs }, sourceDocumentOverride);
909
+ // Freshness compares file times with the compiled snapshot, so restoring
910
+ // the bytes alone would still make an untouched entity read as stale after
911
+ // a rolled-back write. Snapshot the times before the publication below.
912
+ const priorTimes = before === undefined ? null : readFileTimes(absolute);
901
913
  await context.fs.mkdir(path.dirname(absolute));
902
914
  const temporary = `${absolute}.kibi-source-${process.pid}-${randomUUID()}`;
903
915
  try {
@@ -105,6 +105,11 @@ export type ValidateUpsertPayload = {
105
105
  readonly warnings: readonly string[];
106
106
  readonly semanticAdvisor: SemanticAdvisorReceipt | null;
107
107
  readonly normalizedPreview: Readonly<Record<string, unknown>> | null;
108
+ /**
109
+ * When the payload is invalid and the write would refuse it with a coded
110
+ * error (for example DOCUMENT_PATH_REQUIRED): that code.
111
+ */
112
+ readonly errorCode?: string;
108
113
  /** Planned fact ids staged ahead of the payload, in order. */
109
114
  readonly stagedFacts?: readonly string[];
110
115
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGrD,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAG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,QAAQ,CAAC,oBAAoB,EAAE,OAAO,CAAC;KACxC,CAAC;CACH,CAAC"}
@@ -82,5 +82,19 @@ export type UpsertExecutionOptions = Readonly<{
82
82
  */
83
83
  readonly deferCompiledCommit?: boolean;
84
84
  }>;
85
+ /**
86
+ * Whether a source-first upsert publishes an authored document, and the
87
+ * stored entity it updates (undefined for a create). Null when the write
88
+ * touches no document: no filesystem, a compiled-only runtime, or an
89
+ * existing entity whose runtime source (mcp://, test://, etc.) has no
90
+ * tracked document and the caller names none. A new entity always gets a
91
+ * document in a filesystem-capable runtime: writeSourceForUpsert emits the
92
+ * typed DOCUMENT_PATH_REQUIRED request when configuration has zero or
93
+ * multiple writable targets, rather than silently creating compiled-only
94
+ * state. The write and its dry run share this decision.
95
+ */
96
+ export declare function sourceWriteScope(input: UpsertInput, context: OperationContext): Promise<{
97
+ readonly existing: Readonly<Record<string, unknown>> | undefined;
98
+ } | null>;
85
99
  export declare function executeUpsert(input: UpsertInput, context: OperationContext, options?: UpsertExecutionOptions): Promise<OperationResult<UpsertPayload>>;
86
100
  //# sourceMappingURL=upsert.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"upsert.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/upsert.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAexE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AA6B3E,OAAO,EACL,KAAK,kBAAkB,EAExB,MAAM,oBAAoB,CAAC;AAQ5B,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,eAAe,EAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,KAAK,wBAAwB,EAI9B,MAAM,wBAAwB,CAAC;AAsEhC,wBAAgB,gCAAgC,CAC9C,aAAa,EAAE,MAAM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lookup) {
356
356
  };
357
357
  }
358
358
  // implements REQ-kibi-operation-interface-parity
359
+ /**
360
+ * Whether a source-first upsert publishes an authored document, and the
361
+ * stored entity it updates (undefined for a create). Null when the write
362
+ * touches no document: no filesystem, a compiled-only runtime, or an
363
+ * existing entity whose runtime source (mcp://, test://, etc.) has no
364
+ * tracked document and the caller names none. A new entity always gets a
365
+ * document in a filesystem-capable runtime: writeSourceForUpsert emits the
366
+ * typed DOCUMENT_PATH_REQUIRED request when configuration has zero or
367
+ * multiple writable targets, rather than silently creating compiled-only
368
+ * state. The write and its dry run share this decision.
369
+ */
370
+ export async function sourceWriteScope(input, context) {
371
+ if (context.fs === undefined ||
372
+ context.sourceFirst === false ||
373
+ context.prolog === undefined)
374
+ return null;
375
+ const existing = (await loadEntities(context.prolog, { id: input.id, type: input.type }))[0];
376
+ const existingSource = typeof existing?.source === "string" ? existing.source : undefined;
377
+ if (input.document !== undefined ||
378
+ existingSource?.match(/\.(?:md|mdx|ya?ml|json)$/i) ||
379
+ existing === undefined)
380
+ return { existing };
381
+ return null;
382
+ }
383
+ // implements REQ-kibi-operation-interface-parity
359
384
  /**
360
385
  * A dry run is the former kb_validate_upsert preflight on the kb_upsert
361
386
  * surface: the same validation and semantic advisor receipt, no KB or
@@ -432,42 +457,23 @@ export async function executeUpsert(input, context, options = {}) {
432
457
  });
433
458
  relationshipCount = validated.relationships.length;
434
459
  semanticAdvisor = semantic.receipt;
435
- if (context.fs !== undefined && context.sourceFirst !== false) {
436
- const existingRows = await loadEntities(prolog, {
437
- id: input.id,
438
- type: input.type,
439
- });
440
- const existing = existingRows[0];
441
- const existingSource = existing !== undefined && typeof existing.source === "string"
442
- ? existing.source
443
- : undefined;
444
- // Existing non-authored runtime sources (mcp://, test://, etc.) have no
445
- // tracked document to update unless the caller explicitly supplies one;
446
- // new entities are required to choose a source target in this
447
- // filesystem-capable context.
448
- if (input.document !== undefined ||
449
- existingSource?.match(/\.(?:md|mdx|ya?ml|json)$/i) ||
450
- // A filesystem-capable runtime is source-first for every new entity.
451
- // writeSourceForUpsert emits the typed DOCUMENT_PATH_REQUIRED request
452
- // when configuration has zero or multiple writable targets, rather
453
- // than silently creating compiled-only state.
454
- existing === undefined) {
455
- sourceWrite = await writeSourceForUpsert(input, validated.entity, existing, context, options.sourceDocumentOverride);
456
- if (sourceWrite !== null) {
457
- const sourceStep = sourceWrite;
458
- saga.add({
459
- name: "authored-source",
460
- rollback: () => sourceStep.rollback(),
461
- onError: "capture",
462
- });
463
- // The authored path is the entity's canonical identity. Runtime
464
- // transport provenance (mcp://...) must never survive a source-first
465
- // write or a later delete/sync cycle.
466
- commitEntity = {
467
- ...validated.entity,
468
- source: sourceWrite.receipt.path,
469
- };
470
- }
460
+ const sourceScope = await sourceWriteScope(input, context);
461
+ if (sourceScope !== null) {
462
+ sourceWrite = await writeSourceForUpsert(input, validated.entity, sourceScope.existing, context, options.sourceDocumentOverride);
463
+ if (sourceWrite !== null) {
464
+ const sourceStep = sourceWrite;
465
+ saga.add({
466
+ name: "authored-source",
467
+ rollback: () => sourceStep.rollback(),
468
+ onError: "capture",
469
+ });
470
+ // The authored path is the entity's canonical identity. Runtime
471
+ // transport provenance (mcp://...) must never survive a source-first
472
+ // write or a later delete/sync cycle.
473
+ commitEntity = {
474
+ ...validated.entity,
475
+ source: sourceWrite.receipt.path,
476
+ };
471
477
  }
472
478
  }
473
479
  // Relationship shards are canonical source artifacts. Patch them before
@@ -1 +1 @@
1
- {"version":3,"file":"validate-upsert.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/validate-upsert.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,gBAAgB,EAEjB,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAWxE,OAAO,KAAK,EAIV,WAAW,EACX,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAiPpB;;;;;GAKG;AACH,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,qBAAqB,CAAC,CAAC,CAkHjD"}
1
+ {"version":3,"file":"validate-upsert.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/validate-upsert.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,gBAAgB,EAEjB,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAWxE,OAAO,KAAK,EAIV,WAAW,EACX,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAqPpB;;;;;GAKG;AACH,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,qBAAqB,CAAC,CAAC,CAmIjD"}
@@ -1,13 +1,13 @@
1
1
  // implements REQ-kibi-operation-interface-parity
2
+ import { codedErrorOf } from "../../cli-errors.js";
2
3
  import { escapeAtom } from "../../prolog/codec.js";
3
- import { loadEntities } from "../../public/operations/discovery-entities.js";
4
4
  import { entityIdStyleWarnings } from "../../utils/entity-id-style.js";
5
5
  import { entityContextWarnings } from "./context-warning.js";
6
6
  import { buildUpsertContradictionPreviewGoal, buildWhatIfAnalysisGoal, formatUpsertError, } from "./contradictions.js";
7
7
  import { validateRelationshipSources } from "./relationships.js";
8
- import { canonicalSourcePath } from "./source-authoring.js";
8
+ import { canonicalSourcePath, renderSourceWrite } from "./source-authoring.js";
9
9
  import { validateSymbolGranularity } from "./symbol-granularity.js";
10
- import { analyzeUpsertSemantics, validateAppendOnlyProofReceipts, validateUpsertForCommit, } from "./upsert.js";
10
+ import { analyzeUpsertSemantics, sourceWriteScope, validateAppendOnlyProofReceipts, validateUpsertForCommit, } from "./upsert.js";
11
11
  import { validateUpsertInput } from "./validation.js";
12
12
  import { symbolCoverageWarnings } from "./warnings.js";
13
13
  import { isBlockingWitness, parseWhatIfAnalysis } from "./what-if.js";
@@ -18,49 +18,53 @@ async function entityExists(prolog, id) {
18
18
  }
19
19
  // implements REQ-kibi-operation-interface-parity, REQ-kb-entity-body-context
20
20
  /**
21
- * The authored document a real kb_upsert would update, resolved with the
22
- * write's own rules (stored authored source, else the canonical lane path).
23
- * The preview entity's `source` is the runtime marker, so without this the
24
- * context warning would judge the statement instead of the existing body the
25
- * write preserves. Undefined when the write would not touch a document.
21
+ * The authored document a real kb_upsert would update, resolved and rendered
22
+ * with the write's own rules (sourceWriteScope and renderSourceWrite) but
23
+ * never written. A path or format the write would refuse
24
+ * (DOCUMENT_PATH_REQUIRED, SOURCE_PATH_INVALID, SOURCE_FORMAT_UNSUPPORTED)
25
+ * throws the write's own error. The preview entity's `source` is the runtime
26
+ * marker, so the returned path lets the context warning judge the existing
27
+ * body the write preserves. Undefined when the write would not touch a
28
+ * document.
26
29
  */
27
- async function previewDocumentPath(input, entity, context) {
28
- if (context.fs === undefined || context.sourceFirst === false) {
30
+ async function previewSourceWrite(input, entity, context) {
31
+ const fs = context.fs;
32
+ if (fs === undefined || context.sourceFirst === false)
29
33
  return undefined;
30
- }
31
- try {
32
- const existing = context.prolog === undefined
33
- ? undefined
34
- : (await loadEntities(context.prolog, {
35
- id: input.id,
36
- type: input.type,
37
- }))[0];
38
- const existingSource = typeof existing?.source === "string" ? existing.source : undefined;
39
- if (input.document === undefined &&
40
- existing !== undefined &&
41
- !existingSource?.match(/\.(?:md|mdx|ya?ml|json)$/i)) {
34
+ if (context.prolog === undefined) {
35
+ // No store, so no write either: only locate the document for the
36
+ // context warning.
37
+ try {
38
+ return canonicalSourcePath(context, input, entity);
39
+ }
40
+ catch {
42
41
  return undefined;
43
42
  }
44
- return canonicalSourcePath(context, input, entity, existing);
45
43
  }
46
- catch {
44
+ const scope = await sourceWriteScope(input, context);
45
+ if (scope === null)
47
46
  return undefined;
48
- }
47
+ const { relative } = await renderSourceWrite(input, entity, scope.existing, {
48
+ ...context,
49
+ fs,
50
+ });
51
+ return relative;
49
52
  }
50
53
  // implements REQ-kibi-operation-interface-parity, REQ-kibi-truthful-consistency
51
54
  /**
52
- * The commit-time contradiction check, run against a staged and rolled-back
53
- * copy of the store. Only a `req` commit runs it (facts and scenarios never
54
- * do), and `_skipContradictionCheck` skips it at commit, so the preview skips
55
- * it too. A refusal carries the same message the commit would raise.
55
+ * The commit goal's own refusal rules, run against a staged and rolled-back
56
+ * copy of the store for every entity type: a relationship whose endpoint
57
+ * does not exist, an invalid relationship direction, a symbol mixing
58
+ * executable_for with implements/covered_by, and the requirement
59
+ * contradiction check (only a `req` commit runs it, and
60
+ * `_skipContradictionCheck` skips it at commit and here alike). A refusal
61
+ * carries the same message the commit would raise.
56
62
  */
57
- async function previewContradictions(prolog, input, entity, relationships) {
58
- if (input.type !== "req" || input._skipContradictionCheck === true)
59
- return;
63
+ async function previewCommit(prolog, input, entity, relationships) {
60
64
  const preview = await prolog.query(buildUpsertContradictionPreviewGoal({
61
65
  entity,
62
66
  relationships,
63
- skipContradictionCheck: false,
67
+ skipContradictionCheck: input._skipContradictionCheck === true,
64
68
  }));
65
69
  if (!preview.success) {
66
70
  throw new Error(formatUpsertError(input.id, preview.error, preview.errorRecord));
@@ -167,6 +171,12 @@ async function validateWithoutStore(input, context) {
167
171
  });
168
172
  return { entity: validated.entity, semantic };
169
173
  }
174
+ function isModuleLoadFailure(error) {
175
+ if (!(error instanceof Error))
176
+ return false;
177
+ const code = error.code;
178
+ return code === "MODULE_NOT_FOUND" || code === "ERR_MODULE_NOT_FOUND";
179
+ }
170
180
  // implements REQ-kibi-operation-interface-parity, REQ-kibi-truthful-consistency
171
181
  /**
172
182
  * kb_upsert dryRun:true (and the former kb_validate_upsert preflight). With a
@@ -181,14 +191,20 @@ export async function executeValidateUpsert(input, context) {
181
191
  let whatIf;
182
192
  let stagedFacts;
183
193
  let relationships = input.relationships ?? [];
194
+ let targetPath;
184
195
  const { entity, semantic } = context.prolog !== undefined
185
196
  ? await stagePlannedFacts(input, context).then(async (facts) => {
186
197
  const result = await validateUpsertForCommit(input, context, facts === null ? {} : { staged: facts.staged });
187
- // The commit goal checks requirement contradictions after the
188
- // validations above; a dry run previews that stage as well, so
198
+ // The write publishes the authored document before its commit
199
+ // goal; render it (without writing) in the same order, so a
200
+ // source refusal surfaces here exactly as the write raises it.
201
+ targetPath = await previewSourceWrite(input, result.validated.entity, context);
202
+ // The commit goal refuses missing relationship endpoints, mixed
203
+ // symbol roles and requirement contradictions after the
204
+ // validations above; a dry run previews that goal as well, so
189
205
  // "valid" means the commit would not refuse the write.
190
206
  if (facts === null) {
191
- await previewContradictions(context.prolog, input, result.validated.entity, result.validated.relationships);
207
+ await previewCommit(context.prolog, input, result.validated.entity, result.validated.relationships);
192
208
  }
193
209
  else {
194
210
  stagedFacts = [...facts.staged.entities.keys()];
@@ -201,6 +217,8 @@ export async function executeValidateUpsert(input, context) {
201
217
  };
202
218
  })
203
219
  : await validateWithoutStore(input, context);
220
+ if (context.prolog === undefined)
221
+ targetPath = await previewSourceWrite(input, entity, context);
204
222
  // Style warnings apply only to entities this upsert would create, so the
205
223
  // existence read happens only when the ID actually has a style issue.
206
224
  const candidateIdStyleWarnings = entityIdStyleWarnings({
@@ -225,7 +243,7 @@ export async function executeValidateUpsert(input, context) {
225
243
  ...coverageWarnings,
226
244
  ...idStyleWarnings,
227
245
  ...entityContextWarnings(input, entity, context.workspaceRoot, {
228
- targetPath: await previewDocumentPath(input, entity, context),
246
+ targetPath,
229
247
  }),
230
248
  ],
231
249
  semanticAdvisor: semantic.receipt,
@@ -247,13 +265,19 @@ export async function executeValidateUpsert(input, context) {
247
265
  };
248
266
  }
249
267
  catch (error) {
268
+ // A module that fails to load is a broken installation, not a property of
269
+ // the payload: report it as a tool failure instead of an invalid payload.
270
+ if (isModuleLoadFailure(error))
271
+ throw error;
250
272
  const message = error instanceof Error ? error.message : String(error);
273
+ const errorCode = codedErrorOf(error)?.code;
251
274
  const payload = {
252
275
  valid: false,
253
276
  errors: [message],
254
277
  warnings: [],
255
278
  semanticAdvisor: null,
256
279
  normalizedPreview: null,
280
+ ...(errorCode !== undefined ? { errorCode } : {}),
257
281
  };
258
282
  return {
259
283
  content: [
@@ -308,7 +308,7 @@ export declare const OPERATION_CATALOG: readonly [{
308
308
  }, {
309
309
  readonly name: "kb_status";
310
310
  readonly cliName: "status";
311
- readonly description: "Report current branch, KB snapshot, freshness metadata, schema status, and a typed kibi.migration-plan.v2 action graph. Read-only status inspection with no mutation side effects; damaged stores are diagnosed without starting the engine.";
311
+ readonly description: "Report current branch, KB snapshot, freshness metadata, schema status, and a typed kibi.migration-plan.v2 action graph. Call it first to orient on a branch or after a failed call; use kb_check for validation findings and kb_coverage for proof status. Read-only status inspection with no mutation side effects; damaged stores are diagnosed without starting the engine.";
312
312
  readonly businessInputSchema: {
313
313
  readonly type: "object";
314
314
  readonly properties: {};
@@ -320,42 +320,49 @@ export declare const OPERATION_CATALOG: readonly [{
320
320
  }, {
321
321
  readonly name: "kb_find_gaps";
322
322
  readonly cliName: "find-gaps";
323
- readonly description: "Run bulk missing/present relationship analysis over KB entities. Use for questions like which requirements lack scenarios or tests. No mutation side effects.";
323
+ readonly description: "List KB entities by the relationships they lack or have. Use for questions like which requirements lack scenarios or tests; all filters must match, and a relationship counts in either direction. Use kb_coverage instead for proof status and repair plans, and kb_check for rule violations. No mutation side effects.";
324
324
  readonly businessInputSchema: {
325
325
  readonly type: "object";
326
326
  readonly properties: {
327
327
  readonly type: {
328
328
  readonly type: "string";
329
329
  readonly enum: readonly ["req", "scenario", "test", "adr", "flag", "event", "symbol", "fact"];
330
+ readonly description: "Only report entities of this type. Omit for all types.";
330
331
  };
331
332
  readonly missingRelationships: {
332
333
  readonly type: "array";
333
334
  readonly items: {
334
335
  readonly type: "string";
335
336
  };
337
+ readonly description: "Relationship types the entity must have none of, in either direction, for example specified_by or verified_by. verified_by and validates satisfy each other.";
336
338
  };
337
339
  readonly presentRelationships: {
338
340
  readonly type: "array";
339
341
  readonly items: {
340
342
  readonly type: "string";
341
343
  };
344
+ readonly description: "Relationship types the entity must have at least one of each, in either direction.";
342
345
  };
343
346
  readonly tags: {
344
347
  readonly type: "array";
345
348
  readonly items: {
346
349
  readonly type: "string";
347
350
  };
351
+ readonly description: "Keep entities carrying any of these metadata tags. Bootstrap provenance stubs appear in rows only when this names bootstrap:provenance-stub.";
348
352
  };
349
353
  readonly sourceFile: {
350
354
  readonly type: "string";
355
+ readonly description: "Keep entities whose source path contains this substring.";
351
356
  };
352
357
  readonly limit: {
353
358
  readonly type: "integer";
354
359
  readonly default: 100;
360
+ readonly description: "Maximum rows to return; count reports the full total.";
355
361
  };
356
362
  readonly offset: {
357
363
  readonly type: "integer";
358
364
  readonly default: 0;
365
+ readonly description: "Zero-based row offset for pagination.";
359
366
  };
360
367
  };
361
368
  };
@@ -365,7 +372,7 @@ export declare const OPERATION_CATALOG: readonly [{
365
372
  }, {
366
373
  readonly name: "kb_coverage";
367
374
  readonly cliName: "coverage";
368
- readonly description: "Generate curated structural coverage and conservative end-to-end requirement proof reports for requirements, symbols, or grouped types. Reports include the compatible repair plan plus typed kibi.migration-plan.v2 actions; semantic and E2E actions remain review/execution work. Paginated plans identify incomplete scope and no mutation occurs.";
375
+ readonly description: "Generate curated structural coverage and conservative end-to-end requirement proof reports for requirements, symbols, or grouped types. Use it to ask which requirements are proven and what blocks the rest; use kb_find_gaps for a plain list of missing links and kb_check for rule violations. Reports include the compatible repair plan plus typed kibi.migration-plan.v2 actions; semantic and E2E actions remain review/execution work. Paginated plans identify incomplete scope and no mutation occurs.";
369
376
  readonly businessInputSchema: {
370
377
  readonly type: "object";
371
378
  readonly properties: {
@@ -373,16 +380,19 @@ export declare const OPERATION_CATALOG: readonly [{
373
380
  readonly type: "string";
374
381
  readonly enum: readonly ["req", "symbol", "type"];
375
382
  readonly default: "req";
383
+ readonly description: "Report shape: req gives per-requirement proof status and a repair plan, symbol gives per-symbol ownership coverage, type gives counts per entity type.";
376
384
  };
377
385
  readonly tags: {
378
386
  readonly type: "array";
379
387
  readonly items: {
380
388
  readonly type: "string";
381
389
  };
390
+ readonly description: "Keep rows for entities carrying any of these metadata tags.";
382
391
  };
383
392
  readonly includePassing: {
384
393
  readonly type: "boolean";
385
394
  readonly default: false;
395
+ readonly description: "Also return rows that are already proven or not applicable. By default only rows that still need repair are returned.";
386
396
  };
387
397
  readonly statuses: {
388
398
  readonly type: "array";
@@ -395,14 +405,17 @@ export declare const OPERATION_CATALOG: readonly [{
395
405
  readonly includeTransitive: {
396
406
  readonly type: "boolean";
397
407
  readonly default: true;
408
+ readonly description: "Count symbol coverage reached transitively through linked entities, not only direct links.";
398
409
  };
399
410
  readonly limit: {
400
411
  readonly type: "integer";
401
412
  readonly default: 100;
413
+ readonly description: "Maximum rows to return. When the repair plan reports scope.complete false, rerun with offset 0 and a larger limit.";
402
414
  };
403
415
  readonly offset: {
404
416
  readonly type: "integer";
405
417
  readonly default: 0;
418
+ readonly description: "Zero-based row offset for pagination.";
406
419
  };
407
420
  readonly includeMigrationPreview: {
408
421
  readonly type: "boolean";
@@ -444,7 +457,7 @@ export declare const OPERATION_CATALOG: readonly [{
444
457
  }, {
445
458
  readonly name: "kb_graph";
446
459
  readonly cliName: "graph";
447
- readonly description: "Run bounded graph traversal from one or more seed IDs across curated relationship types. No mutation side effects.";
460
+ readonly description: "Run bounded graph traversal from one or more seed IDs across curated relationship types and return the nodes and edges reached. Use it to follow links from IDs you already have, such as a requirement to its scenarios and tests or a symbol to the requirements it implements; use kb_query to find entities by filter and kb_search to ask a question. Traversal stops at depth, maxNodes or maxEdges and then sets truncated. No mutation side effects.";
448
461
  readonly businessInputSchema: {
449
462
  readonly type: "object";
450
463
  readonly required: readonly ["seedIds"];
@@ -454,37 +467,44 @@ export declare const OPERATION_CATALOG: readonly [{
454
467
  readonly items: {
455
468
  readonly type: "string";
456
469
  };
470
+ readonly description: "Entity IDs to start from, for example REQ-... or SCEN-.... Seeds are always returned as nodes.";
457
471
  };
458
472
  readonly relationships: {
459
473
  readonly type: "array";
460
474
  readonly items: {
461
475
  readonly type: "string";
462
476
  };
477
+ readonly description: "Relationship types to follow, for example specified_by, verified_by or implements. Omit to follow every relationship type.";
463
478
  };
464
479
  readonly direction: {
465
480
  readonly type: "string";
466
481
  readonly enum: readonly ["outgoing", "incoming", "both"];
467
482
  readonly default: "outgoing";
483
+ readonly description: "outgoing follows links from each node, incoming follows links pointing at it, both does either.";
468
484
  };
469
485
  readonly depth: {
470
486
  readonly type: "integer";
471
487
  readonly default: 1;
472
488
  readonly minimum: 1;
473
489
  readonly maximum: 5;
490
+ readonly description: "Number of hops from the seeds.";
474
491
  };
475
492
  readonly entityTypes: {
476
493
  readonly type: "array";
477
494
  readonly items: {
478
495
  readonly type: "string";
479
496
  };
497
+ readonly description: "Keep only nodes of these types (req, scenario, test, adr, flag, event, symbol, fact) in the result, and the edges between them. Traversal still passes through other types.";
480
498
  };
481
499
  readonly maxNodes: {
482
500
  readonly type: "integer";
483
501
  readonly default: 200;
502
+ readonly description: "Stop and set truncated once this many nodes are reached.";
484
503
  };
485
504
  readonly maxEdges: {
486
505
  readonly type: "integer";
487
506
  readonly default: 500;
507
+ readonly description: "Stop and set truncated once this many edges are reached.";
488
508
  };
489
509
  };
490
510
  };
@@ -723,7 +743,7 @@ export declare const OPERATION_CATALOG: readonly [{
723
743
  }, {
724
744
  readonly name: "kb_model";
725
745
  readonly cliName: "model";
726
- readonly description: "Turn requirement prose into checkable structure without writing the KB. mode:analyze returns the semantic advisor receipt: the clause ledger, what is grounded, what is ambiguous and suggested modeling (pass clauses for compound prose and optional typed kibi.logic.v1 interpretations). mode:requirement converts one claim (subjectKey, propertyKey, operator, value, or typed logic) into a strict-lane write set and applyPlan. mode:predicates ranks ontology predicate schemas and returns an applicable predicate-fact plan only for reviewed bindings, otherwise an ontology-gap observation. With requirementId, mode:predicates also returns a hash-bound plan (fact write plus requires_predicate link) for kb_apply_plan, whose contradictionAnalysis is the what-if over the current KB; other returned plans apply with kb_upsert, and kb_upsert dryRun with plannedFacts previews a requirement before its facts exist.";
746
+ readonly description: "Turn requirement prose into checkable structure without writing the KB. Use it for one requirement's prose; to plan a whole change request use kb_compile_intent. mode:analyze returns the semantic advisor receipt: the clause ledger, what is grounded, what is ambiguous and suggested modeling (pass clauses for compound prose and optional typed kibi.logic.v1 interpretations). mode:requirement converts one claim (subjectKey, propertyKey, operator, value, or typed logic) into a strict-lane write set and applyPlan. mode:predicates ranks ontology predicate schemas and returns an applicable predicate-fact plan only for reviewed bindings, otherwise an ontology-gap observation. With requirementId, mode:predicates also returns a hash-bound plan (fact write plus requires_predicate link) for kb_apply_plan, whose contradictionAnalysis is the what-if over the current KB; other returned plans apply with kb_upsert, and kb_upsert dryRun with plannedFacts previews a requirement before its facts exist.";
727
747
  readonly businessInputSchema: {
728
748
  readonly type: "object";
729
749
  readonly required: readonly ["mode", "text"];
@@ -741,7 +761,7 @@ export declare const OPERATION_CATALOG: readonly [{
741
761
  }, {
742
762
  readonly name: "kb_plan_bootstrap";
743
763
  readonly cliName: "plan-bootstrap";
744
- readonly description: "Generate a deterministic, snapshot-bound kibi.bootstrap-plan.v1 for repository onboarding. Read-only analysis of the repository plus any declared knowledge sources and cited intent claims returns evidence, bounded context questions, exact dependency-ordered actions, a canonical plan hash, and no mutation side effects.";
764
+ readonly description: "Generate a deterministic, snapshot-bound kibi.bootstrap-plan.v1 for repository onboarding. Use it only to onboard a repository whose KB is empty or incomplete (the kibi-bootstrap skill drives it); for a change in an onboarded project use kb_compile_intent. Read-only analysis of the repository plus any declared knowledge sources and cited intent claims returns evidence, bounded context questions, exact dependency-ordered actions, a canonical plan hash, and no mutation side effects.";
745
765
  readonly businessInputSchema: {
746
766
  readonly type: "object";
747
767
  readonly properties: {
@@ -1882,13 +1902,14 @@ export declare const OPERATION_CATALOG: readonly [{
1882
1902
  }, {
1883
1903
  readonly name: "kb_prepare_impact_review";
1884
1904
  readonly cliName: "prepare-impact-review";
1885
- readonly description: "Prepare complete content-bound impact-review authoring inputs from the current staged snapshot or explicitly selected immutable Git commits. Returns strict reviewer schemas and an unauthored template; it does not decide, approve, sign, stage, or prove the review.";
1905
+ readonly description: "Prepare complete content-bound impact-review authoring inputs from the current staged snapshot or explicitly selected immutable Git commits. Use it when kb_check reports that changed files need an impact review; it does not plan KB changes. Returns strict reviewer schemas and an unauthored template; it does not decide, approve, sign, stage, or prove the review.";
1886
1906
  readonly businessInputSchema: {
1887
1907
  readonly type: "object";
1888
1908
  readonly additionalProperties: false;
1889
1909
  readonly required: readonly ["scope"];
1890
1910
  readonly properties: {
1891
1911
  readonly scope: {
1912
+ readonly description: "What to review: {\"kind\":\"staged\"} for the staged snapshot, or {\"kind\":\"diff\",\"baseCommit\":\"<sha>\",\"headCommit\":\"<sha>\"} with full commit hashes.";
1892
1913
  readonly oneOf: readonly [{
1893
1914
  readonly type: "object";
1894
1915
  readonly additionalProperties: false;
@@ -1951,7 +1972,7 @@ export declare const OPERATION_CATALOG: readonly [{
1951
1972
  }, {
1952
1973
  readonly name: "kb_compile_intent";
1953
1974
  readonly cliName: "compile-intent";
1954
- readonly description: "Compile complete change intent into a deterministic, snapshot-bound read-only plan. Reuses intent-aware discovery and semantic modeling, accounts for every proposition, reports contradiction witnesses, proposes traceability links, and emits dependency-ordered kb_upsert-style steps only for resolved typed claims. contradictionAnalysis.outcome is no_conflict only when the check could decide: an unmodeled proposition or a related current requirement without logic leaves it unresolved with reasons and reviewCandidates to compare and judge through conflictReviews. No mutation side effects.";
1975
+ readonly description: "Compile complete change intent into a deterministic, snapshot-bound read-only plan. Use it before editing code for a change request that may touch several requirements; use kb_model for one requirement's prose and kb_plan_bootstrap for first-time onboarding. Reuses intent-aware discovery and semantic modeling, accounts for every proposition, reports contradiction witnesses, proposes traceability links, and emits dependency-ordered kb_upsert-style steps only for resolved typed claims. contradictionAnalysis.outcome is no_conflict only when the check could decide: an unmodeled proposition or a related current requirement without logic leaves it unresolved with reasons and reviewCandidates to compare and judge through conflictReviews. No mutation side effects.";
1955
1976
  readonly businessInputSchema: {
1956
1977
  readonly type: "object";
1957
1978
  readonly required: readonly ["intent", "mode"];
@@ -1 +1 @@
1
- {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/public/operations/catalog.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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