kibi-cli 2.26.2 → 2.27.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 (108) hide show
  1. package/dist/cli-operation-metadata.d.ts +1 -1
  2. package/dist/cli-operation-metadata.js +1 -1
  3. package/dist/commands/doctor.d.ts.map +1 -1
  4. package/dist/commands/doctor.js +2 -1
  5. package/dist/commands/migrate.d.ts.map +1 -1
  6. package/dist/commands/migrate.js +24 -0
  7. package/dist/commands/sync/cache.d.ts +21 -0
  8. package/dist/commands/sync/cache.d.ts.map +1 -1
  9. package/dist/commands/sync/cache.js +40 -15
  10. package/dist/commands/sync/persistence.d.ts +10 -0
  11. package/dist/commands/sync/persistence.d.ts.map +1 -1
  12. package/dist/commands/sync/persistence.js +24 -0
  13. package/dist/commands/sync.d.ts.map +1 -1
  14. package/dist/commands/sync.js +26 -11
  15. package/dist/diagnostics.d.ts +6 -0
  16. package/dist/diagnostics.d.ts.map +1 -1
  17. package/dist/diagnostics.js +25 -9
  18. package/dist/intent-search.d.ts +2 -0
  19. package/dist/intent-search.d.ts.map +1 -1
  20. package/dist/intent-search.js +5 -0
  21. package/dist/operations/bootstrap/activation.d.ts +6 -0
  22. package/dist/operations/bootstrap/activation.d.ts.map +1 -1
  23. package/dist/operations/bootstrap/activation.js +22 -0
  24. package/dist/operations/bootstrap/claim-restatement.d.ts +2 -0
  25. package/dist/operations/bootstrap/claim-restatement.d.ts.map +1 -1
  26. package/dist/operations/bootstrap/conflict-review.d.ts +16 -0
  27. package/dist/operations/bootstrap/conflict-review.d.ts.map +1 -0
  28. package/dist/operations/bootstrap/conflict-review.js +59 -0
  29. package/dist/operations/bootstrap/generate.d.ts.map +1 -1
  30. package/dist/operations/bootstrap/generate.js +17 -4
  31. package/dist/operations/bootstrap/types.d.ts +5 -0
  32. package/dist/operations/bootstrap/types.d.ts.map +1 -1
  33. package/dist/operations/migration/entity-type.d.ts +35 -0
  34. package/dist/operations/migration/entity-type.d.ts.map +1 -0
  35. package/dist/operations/migration/entity-type.js +89 -0
  36. package/dist/operations/migration/schema6.d.ts.map +1 -1
  37. package/dist/operations/migration/schema6.js +32 -0
  38. package/dist/operations/mutation/requirement-semantics.d.ts +5 -0
  39. package/dist/operations/mutation/requirement-semantics.d.ts.map +1 -1
  40. package/dist/operations/mutation/requirement-semantics.js +24 -5
  41. package/dist/operations/mutation/stored-entity.d.ts +7 -0
  42. package/dist/operations/mutation/stored-entity.d.ts.map +1 -1
  43. package/dist/operations/mutation/symbol-granularity.d.ts +1 -1
  44. package/dist/operations/mutation/symbol-granularity.d.ts.map +1 -1
  45. package/dist/operations/mutation/symbol-granularity.js +37 -7
  46. package/dist/operations/mutation/uncompiled-source.d.ts +6 -0
  47. package/dist/operations/mutation/uncompiled-source.d.ts.map +1 -1
  48. package/dist/operations/mutation/uncompiled-source.js +17 -1
  49. package/dist/operations/mutation/upsert.d.ts +9 -1
  50. package/dist/operations/mutation/upsert.d.ts.map +1 -1
  51. package/dist/operations/mutation/upsert.js +43 -7
  52. package/dist/operations/mutation/validation.d.ts.map +1 -1
  53. package/dist/operations/mutation/validation.js +21 -0
  54. package/dist/operations/planning/compile-intent.d.ts +16 -0
  55. package/dist/operations/planning/compile-intent.d.ts.map +1 -1
  56. package/dist/operations/planning/compile-intent.js +118 -5
  57. package/dist/operations/planning/conflict-review.d.ts +69 -0
  58. package/dist/operations/planning/conflict-review.d.ts.map +1 -0
  59. package/dist/operations/planning/conflict-review.js +133 -0
  60. package/dist/operations/semantic-advisor/ingestion-boundary.d.ts +8 -0
  61. package/dist/operations/semantic-advisor/ingestion-boundary.d.ts.map +1 -1
  62. package/dist/operations/semantic-advisor/ingestion-boundary.js +43 -2
  63. package/dist/prolog/utf8-transport.d.ts +21 -0
  64. package/dist/prolog/utf8-transport.d.ts.map +1 -0
  65. package/dist/prolog/utf8-transport.js +49 -0
  66. package/dist/prolog.d.ts +2 -0
  67. package/dist/prolog.d.ts.map +1 -1
  68. package/dist/prolog.js +19 -10
  69. package/dist/public/impact/analyzer.d.ts.map +1 -1
  70. package/dist/public/impact/analyzer.js +26 -2
  71. package/dist/public/impact/requirement-statements.d.ts +29 -0
  72. package/dist/public/impact/requirement-statements.d.ts.map +1 -0
  73. package/dist/public/impact/requirement-statements.js +127 -0
  74. package/dist/public/operations/catalog.d.ts +26 -2
  75. package/dist/public/operations/catalog.d.ts.map +1 -1
  76. package/dist/public/operations/check-format-shared.d.ts +1 -1
  77. package/dist/public/operations/check-format-shared.d.ts.map +1 -1
  78. package/dist/public/operations/check-format-shared.js +19 -4
  79. package/dist/public/operations/discovery-executors.d.ts.map +1 -1
  80. package/dist/public/operations/discovery-executors.js +20 -13
  81. package/dist/public/operations/migration-plan.d.ts.map +1 -1
  82. package/dist/public/operations/migration-plan.js +7 -2
  83. package/dist/public/operations/result-envelope.d.ts +2 -0
  84. package/dist/public/operations/result-envelope.d.ts.map +1 -1
  85. package/dist/public/operations/result-envelope.js +21 -9
  86. package/dist/public/operations/specs/check.d.ts +1 -1
  87. package/dist/public/operations/specs/check.js +1 -1
  88. package/dist/public/operations/specs/planning.d.ts +25 -1
  89. package/dist/public/operations/specs/planning.d.ts.map +1 -1
  90. package/dist/public/operations/specs/planning.js +16 -1
  91. package/dist/public/skills/kibi-bootstrap/SKILL.md +2 -2
  92. package/dist/public/skills/kibi-usage/SKILL.md +11 -1
  93. package/dist/traceability/staged-diagnostics.d.ts +1 -1
  94. package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
  95. package/dist/utils/config.d.ts +8 -0
  96. package/dist/utils/config.d.ts.map +1 -1
  97. package/dist/utils/config.js +10 -0
  98. package/package.json +2 -2
  99. package/src/public/impact/analyzer.ts +38 -2
  100. package/src/public/impact/requirement-statements.ts +171 -0
  101. package/src/public/operations/check-format-shared.ts +27 -4
  102. package/src/public/operations/discovery-executors.ts +20 -13
  103. package/src/public/operations/migration-plan.ts +12 -4
  104. package/src/public/operations/result-envelope.ts +18 -4
  105. package/src/public/operations/specs/check.ts +1 -1
  106. package/src/public/operations/specs/planning.ts +17 -1
  107. package/src/public/skills/kibi-bootstrap/SKILL.md +2 -2
  108. package/src/public/skills/kibi-usage/SKILL.md +11 -1
@@ -0,0 +1,16 @@
1
+ import type { ExistingRequirement } from "./claim-restatement.js";
2
+ import type { Candidate } from "./types.js";
3
+ /**
4
+ * A planned intent claim is checked for contradictions only against current
5
+ * requirements that have a logical representation. For each planned claim,
6
+ * name the current requirements on the same topic that have none, so the
7
+ * reviewer compares them before approval instead of reading the plan as
8
+ * consistent: the diagnostic names both, and the candidate's evidence gains
9
+ * `review_against:<id>` for each. Ranking is the intent search kb_search uses,
10
+ * over the unmodeled requirements only.
11
+ */
12
+ export declare function withConflictReviewSignals(candidates: readonly Candidate[], requirements: readonly ExistingRequirement[], workspaceRoot: string): Promise<{
13
+ candidates: Candidate[];
14
+ diagnostics: string[];
15
+ }>;
16
+ //# sourceMappingURL=conflict-review.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conflict-review.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/conflict-review.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;;GAQG;AAEH,wBAAsB,yBAAyB,CAC7C,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,YAAY,EAAE,SAAS,mBAAmB,EAAE,EAC5C,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC;IAAE,UAAU,EAAE,SAAS,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAyD7D"}
@@ -0,0 +1,59 @@
1
+ import { rankIntentEntities } from "../../intent-search.js";
2
+ import { MAX_REVIEW_CANDIDATES, REVIEW_CANDIDATE_MIN_SCORE, } from "../planning/conflict-review.js";
3
+ /**
4
+ * A planned intent claim is checked for contradictions only against current
5
+ * requirements that have a logical representation. For each planned claim,
6
+ * name the current requirements on the same topic that have none, so the
7
+ * reviewer compares them before approval instead of reading the plan as
8
+ * consistent: the diagnostic names both, and the candidate's evidence gains
9
+ * `review_against:<id>` for each. Ranking is the intent search kb_search uses,
10
+ * over the unmodeled requirements only.
11
+ */
12
+ // implements REQ-kibi-contradiction-review-candidates
13
+ export async function withConflictReviewSignals(candidates, requirements, workspaceRoot) {
14
+ const unmodeled = requirements
15
+ .filter((requirement) => requirement.modeled === false)
16
+ .map((requirement) => ({
17
+ id: requirement.id,
18
+ type: "req",
19
+ title: requirement.title,
20
+ semantic_text: requirement.semanticText,
21
+ }));
22
+ if (unmodeled.length === 0)
23
+ return { candidates: [...candidates], diagnostics: [] };
24
+ const titles = new Map(requirements.map((requirement) => [requirement.id, requirement.title]));
25
+ const diagnostics = [];
26
+ const reviewed = [];
27
+ for (const candidate of candidates) {
28
+ if (candidate.sourceKind !== "intent_claim" ||
29
+ candidate.entityType !== "req") {
30
+ reviewed.push(candidate);
31
+ continue;
32
+ }
33
+ const ranked = await rankIntentEntities(unmodeled, {
34
+ query: candidate.title,
35
+ type: "req",
36
+ minScore: REVIEW_CANDIDATE_MIN_SCORE,
37
+ }, workspaceRoot);
38
+ const related = ranked.matches
39
+ .slice(0, MAX_REVIEW_CANDIDATES)
40
+ .map((match) => String(match.entity.id ?? ""))
41
+ .filter(Boolean);
42
+ if (related.length === 0) {
43
+ reviewed.push(candidate);
44
+ continue;
45
+ }
46
+ const citation = candidate.evidence
47
+ .find((entry) => entry.startsWith("intent_claim:"))
48
+ ?.slice("intent_claim:".length) ?? candidate.sourcePath;
49
+ diagnostics.push(`conflict-review: Intent claim at ${citation} ("${candidate.title}") was not checked for contradictions against current requirement ${related.map((id) => `${id} ("${titles.get(id) ?? ""}")`).join(", ")}, which has no logical representation. Compare them before approval: on a contradiction show both to the human, then drop the claim or keep it and supersede the requirement after apply; record a conflict the human has not decided as a review:conflict observation fact.`);
50
+ reviewed.push({
51
+ ...candidate,
52
+ evidence: [
53
+ ...candidate.evidence,
54
+ ...related.map((id) => `review_against:${id}`),
55
+ ],
56
+ });
57
+ }
58
+ return { candidates: reviewed, diagnostics };
59
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/generate.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAgBjF,OAAO,KAAK,EAGV,SAAS,EACT,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAGpB,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,SAAS,gBAAgB,EAAE,EACpC,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GACzC,SAAS,gBAAgB,EAAE,CAI7B;AA+BD,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,EAChC,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EAC1C,OAAO,EAAE,MAAM,GACd;IACD,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,UAAU,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;IAClE,QAAQ,CAAC,iBAAiB,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACxD,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC,CAwJA;AAmND,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,mBAAmB,CAAC,CAwI9B"}
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/generate.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAkBjF,OAAO,KAAK,EAGV,SAAS,EACT,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAGpB,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,SAAS,gBAAgB,EAAE,EACpC,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GACzC,SAAS,gBAAgB,EAAE,CAI7B;AA+BD,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,EAChC,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EAC1C,OAAO,EAAE,MAAM,GACd;IACD,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,UAAU,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;IAClE,QAAQ,CAAC,iBAAiB,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACxD,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC,CAwJA;AA6ND,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,mBAAmB,CAAC,CAgJ9B"}
@@ -3,9 +3,11 @@ import path from "node:path";
3
3
  import { loadCurrentRequirementTexts, loadEntityIds, } from "../../public/operations/discovery-entities.js";
4
4
  import { executeStatus } from "../../public/operations/discovery-executors.js";
5
5
  import { readWorkspaceSnapshot } from "../../public/operations/workspace-snapshot.js";
6
+ import { loadReviewRequirements } from "../planning/conflict-review.js";
6
7
  import { stagedLogicalGroundingError, } from "../semantic-advisor/ingestion-boundary.js";
7
8
  import { claimPlanActivation } from "./activation.js";
8
9
  import { buildBootstrapCandidates, isProvenanceStubCandidate, } from "./candidates.js";
10
+ import { withConflictReviewSignals } from "./conflict-review.js";
9
11
  import { discoverBootstrap } from "./discovery.js";
10
12
  import { buildIntentClaimCandidates } from "./intent-claims.js";
11
13
  import { normalizeBootstrapContext, presentBootstrap } from "./presentation.js";
@@ -250,7 +252,7 @@ const NO_EXISTING_KNOWLEDGE = {
250
252
  * none (the CLI does so for status anyway); an unattached root never starts
251
253
  * one.
252
254
  */
253
- // implements REQ-bootstrap-intent-claim-accounting, REQ-bootstrap-claim-restatement
255
+ // implements REQ-bootstrap-intent-claim-accounting, REQ-bootstrap-claim-restatement, REQ-kibi-contradiction-review-candidates
254
256
  async function existingKnowledge(context, attached, withRequirements) {
255
257
  try {
256
258
  const prolog = context.prolog ?? (attached ? await context.ensureProlog?.() : undefined);
@@ -259,9 +261,16 @@ async function existingKnowledge(context, attached, withRequirements) {
259
261
  // Ids only: materializing every entity (receipt histories included)
260
262
  // just to build this set exceeds the bounded engine output.
261
263
  const ids = new Set((await loadEntityIds(prolog)).filter(Boolean));
262
- const requirements = withRequirements
264
+ const texts = withRequirements
263
265
  ? await loadCurrentRequirementTexts(prolog)
264
266
  : [];
267
+ const logic = await loadReviewRequirements(prolog, texts.map((requirement) => requirement.id));
268
+ const requirements = texts.map((requirement) => ({
269
+ ...requirement,
270
+ ...(logic.has(requirement.id)
271
+ ? { modeled: logic.get(requirement.id)?.modeled === true }
272
+ : {}),
273
+ }));
265
274
  return { ids, requirements };
266
275
  }
267
276
  catch (error) {
@@ -343,7 +352,7 @@ async function expectedSnapshots(context, evidencePaths) {
343
352
  };
344
353
  }
345
354
  }
346
- // implements REQ-KIBI-BOOTSTRAP-PLAN, REQ-kibi-operation-interface-parity, REQ-bootstrap-discovered-candidate-budget
355
+ // implements REQ-KIBI-BOOTSTRAP-PLAN, REQ-kibi-operation-interface-parity, REQ-bootstrap-discovered-candidate-budget, REQ-kibi-contradiction-review-candidates
347
356
  // implements REQ-KIBI-BOOTSTRAP-PLAN
348
357
  export async function executePlanBootstrap(args, context) {
349
358
  const declared = normalizeBootstrapContext(args.bootstrapContext);
@@ -392,8 +401,11 @@ export async function executePlanBootstrap(args, context) {
392
401
  suppressed: activationSuppressedClaims(declared, discovery.activation),
393
402
  diagnostics: [],
394
403
  };
404
+ // Planned claims next to prose-only current requirements name them for
405
+ // review: the plan cannot show they are consistent.
406
+ const reviewSignals = await withConflictReviewSignals(claimed.candidates, existing.requirements, context.workspaceRoot);
395
407
  const filteredSignals = filterSourceOnlySignals([...built.sourceOnlySignals, ...claimed.sourceOnlySignals], args.entityTypes);
396
- const selected = selectBootstrapCandidates([...built.candidates, ...claimed.candidates].filter((candidate) => candidate.confidence >= minConfidence), existingIds, args.entityTypes, maxCandidates);
408
+ const selected = selectBootstrapCandidates([...built.candidates, ...reviewSignals.candidates].filter((candidate) => candidate.confidence >= minConfidence), existingIds, args.entityTypes, maxCandidates);
397
409
  // Claims about the same subject share one subject fact.
398
410
  const shared = shareSubjectFacts(selected.candidates);
399
411
  const ignored = discovery.ignoredSources.map((sourcePath) => ({
@@ -441,6 +453,7 @@ export async function executePlanBootstrap(args, context) {
441
453
  ]
442
454
  : []),
443
455
  ...claimed.diagnostics,
456
+ ...reviewSignals.diagnostics,
444
457
  ...built.diagnostics,
445
458
  ...selected.diagnostics,
446
459
  ...shared.diagnostics,
@@ -113,6 +113,11 @@ export type ActivationPolicy = {
113
113
  readonly allowDeclaredClaims?: boolean;
114
114
  readonly reason: string;
115
115
  readonly handoffMessage?: string;
116
+ /**
117
+ * The command to run first when it is not the activation state's usual
118
+ * next step (a legacy KB is migrated, not initialized or repaired).
119
+ */
120
+ readonly nextOperation?: string;
116
121
  };
117
122
  export type BootstrapEvidence = {
118
123
  readonly provider: EvidenceProviderName;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAExE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;A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,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG;IAC3E,sEAAsE;IACtE,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,wBAAwB,CAAC;IAC3C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;IAClE,QAAQ,CAAC,OAAO,EAAE,SAAS,eAAe,EAAE,CAAC;IAC7C,QAAQ,CAAC,oBAAoB,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;IAC5E,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAC7B,eAAe,CAAC,0BAA0B,CAAC,GAAG;IAC5C,QAAQ,CAAC,iBAAiB,EAAE,0BAA0B,CAAC;CACxD,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Entity files written before Kibi stated `type` in front matter take their
3
+ * type from the folder. Every Kibi write states it, so the first kb_upsert
4
+ * on such a file would add a `type:` line nobody asked for. `kibi migrate`
5
+ * states the folder-implied type instead, at any schema version, so that
6
+ * line lands in the migration commit.
7
+ */
8
+ export declare const ENTITY_TYPE_BACKFILL_CODE = "entity_type_backfill";
9
+ export declare const ENTITY_TYPE_BACKFILL_ACTION_ID = "entity-type-backfill";
10
+ /** One authored entity file without `type` in its front matter. */
11
+ export type EntityTypeBackfillTarget = Readonly<{
12
+ id: string;
13
+ /** The folder-implied type, as kibi sync reads it. */
14
+ type: string;
15
+ path: string;
16
+ after: string;
17
+ }>;
18
+ export type EntityTypeBackfillSkip = Readonly<{
19
+ path: string;
20
+ reason: string;
21
+ }>;
22
+ export type EntityTypeBackfillPlan = Readonly<{
23
+ targets: readonly EntityTypeBackfillTarget[];
24
+ skipped: readonly EntityTypeBackfillSkip[];
25
+ }>;
26
+ /**
27
+ * Authored entity files whose front matter has no `type`, each with the
28
+ * document that states the folder-implied type as the last front matter key
29
+ * and changes no other byte. Files that do not parse are left to the checks
30
+ * that report them. Read-only.
31
+ */
32
+ export declare function planEntityTypeBackfill(workspaceRoot: string): EntityTypeBackfillPlan;
33
+ /** State the folder-implied type on every authored entity file without one. */
34
+ export declare function applyEntityTypeBackfill(workspaceRoot: string): EntityTypeBackfillPlan;
35
+ //# sourceMappingURL=entity-type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-type.d.ts","sourceRoot":"","sources":["../../../src/operations/migration/entity-type.ts"],"names":[],"mappings":"AA6BA;;;;;;GAMG;AAEH,eAAO,MAAM,yBAAyB,yBAAyB,CAAC;AAEhE,eAAO,MAAM,8BAA8B,yBAAyB,CAAC;AAErE,mEAAmE;AAEnE,MAAM,MAAM,wBAAwB,GAAG,QAAQ,CAAC;IAC9C,EAAE,EAAE,MAAM,CAAC;IACX,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AAGH,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAGhF,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC;IAC5C,OAAO,EAAE,SAAS,wBAAwB,EAAE,CAAC;IAC7C,OAAO,EAAE,SAAS,sBAAsB,EAAE,CAAC;CAC5C,CAAC,CAAC;AAEH;;;;;GAKG;AAEH,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,MAAM,GACpB,sBAAsB,CAsCxB;AAED,+EAA+E;AAE/E,wBAAgB,uBAAuB,CACrC,aAAa,EAAE,MAAM,GACpB,sBAAsB,CAKxB"}
@@ -0,0 +1,89 @@
1
+ /*
2
+ Kibi — repo-local, per-branch, queryable long-term memory for software projects
3
+ Copyright (C) 2026 Piotr Franczyk
4
+
5
+ This program is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU Affero General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU Affero General Public License for more details.
14
+
15
+ You should have received a copy of the GNU Affero General Public License
16
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
17
+ */
18
+ import path from "node:path";
19
+ import { load as loadYaml } from "js-yaml";
20
+ import { inferTypeFromPath } from "../../extractors/markdown.js";
21
+ import { listLaneMarkdownFiles, readText, sliceFrontmatter, withTopLevelField, writeFileAtomically, } from "./kb-sources.js";
22
+ /**
23
+ * Entity files written before Kibi stated `type` in front matter take their
24
+ * type from the folder. Every Kibi write states it, so the first kb_upsert
25
+ * on such a file would add a `type:` line nobody asked for. `kibi migrate`
26
+ * states the folder-implied type instead, at any schema version, so that
27
+ * line lands in the migration commit.
28
+ */
29
+ // implements REQ-cli-migrate-entity-type-backfill
30
+ export const ENTITY_TYPE_BACKFILL_CODE = "entity_type_backfill";
31
+ // implements REQ-cli-migrate-entity-type-backfill
32
+ export const ENTITY_TYPE_BACKFILL_ACTION_ID = "entity-type-backfill";
33
+ /**
34
+ * Authored entity files whose front matter has no `type`, each with the
35
+ * document that states the folder-implied type as the last front matter key
36
+ * and changes no other byte. Files that do not parse are left to the checks
37
+ * that report them. Read-only.
38
+ */
39
+ // implements REQ-cli-migrate-entity-type-backfill
40
+ export function planEntityTypeBackfill(workspaceRoot) {
41
+ const targets = [];
42
+ const skipped = [];
43
+ for (const file of listLaneMarkdownFiles(workspaceRoot)) {
44
+ const content = readText(file.absolutePath);
45
+ const slice = content === null ? null : sliceFrontmatter(content);
46
+ if (content === null || slice === null)
47
+ continue;
48
+ let data;
49
+ try {
50
+ data = loadYaml(slice.text);
51
+ }
52
+ catch {
53
+ continue;
54
+ }
55
+ if (data === null || typeof data !== "object" || Array.isArray(data))
56
+ continue;
57
+ const record = data;
58
+ if (Object.hasOwn(record, "type"))
59
+ continue;
60
+ const type = inferTypeFromPath(file.absolutePath);
61
+ if (type === null)
62
+ continue;
63
+ const after = withTopLevelField(content, "type", type);
64
+ if (after === null) {
65
+ skipped.push({
66
+ path: file.relativePath,
67
+ reason: "type could not be added without changing other fields",
68
+ });
69
+ continue;
70
+ }
71
+ targets.push({
72
+ id: typeof record.id === "string" && record.id.trim() !== ""
73
+ ? record.id.trim()
74
+ : path.basename(file.relativePath, ".md"),
75
+ type,
76
+ path: file.relativePath,
77
+ after,
78
+ });
79
+ }
80
+ return { targets, skipped };
81
+ }
82
+ /** State the folder-implied type on every authored entity file without one. */
83
+ // implements REQ-cli-migrate-entity-type-backfill
84
+ export function applyEntityTypeBackfill(workspaceRoot) {
85
+ const plan = planEntityTypeBackfill(workspaceRoot);
86
+ for (const target of plan.targets)
87
+ writeFileAtomically(path.join(workspaceRoot, target.path), target.after);
88
+ return plan;
89
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"schema6.d.ts","sourceRoot":"","sources":["../../../src/operations/migration/schema6.ts"],"names":[],"mappings":"AAwBA,OAAO,EACL,KAAK,eAAe,EAErB,MAAM,2CAA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,MAAM,GAAG,IAAI,CAAC;CACrC,GAAG,wBAAwB,CA0R3B;AAED;;;;;;GAMG;AAEH,wBAAgB,2BAA2B,CAAC,aAAa,EAAE,MAAM,GAAG;IAClE,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,sBAAsB,EAAE,MAAM,EAAE,CAAC;CAClC,CAuCA;AAED;;;GAGG;AAEH,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,MAAM,GACpB,eAAe,GAAG,IAAI,CAuBxB;AAED,qEAAqE;AAErE,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,SAAS,MAAM,EAAE,GAC3B,eAAe,CAEjB;AAgDD,KAAK,YAAY,GAAG,QAAQ,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC,CAAC;AAEH,4DAA4D;AAE5D,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,IAAI,CAAC,CAkJf;AAED;;;GAGG;AAEH,eAAO,MAAM,+BAA+B,EAAE,WAAW,CAAC,MAAM,CAK9D,CAAC;AAGH,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,MAAM,CActD,CAAC"}
@@ -23,6 +23,7 @@ import { CLOSE_SUPERSEDED_REQUIREMENTS_ACTION_ID, CLOSE_SUPERSEDED_REQUIREMENTS_
23
23
  import { readAllShards } from "../../relationships/shards.js";
24
24
  import { KB_PATHS } from "../../utils/kb-paths.js";
25
25
  import { CONTEXT_MISSING_TAG_CODE, SEMANTIC_TEXT_PIN_CODE, applyContextMissingTags, applySemanticTextPins, countByType, planContextMissingTags, planSemanticTextPins, } from "./entity-body-context.js";
26
+ import { ENTITY_TYPE_BACKFILL_ACTION_ID, ENTITY_TYPE_BACKFILL_CODE, applyEntityTypeBackfill, planEntityTypeBackfill, } from "./entity-type.js";
26
27
  import { FIRM_SUPERSEDE_ACKNOWLEDGE_CODE, applyFirmSupersedeAcknowledgement, planFirmSupersedeAcknowledgement, } from "./firm-supersede.js";
27
28
  import { applyInventoryRederivation, applyInventoryRederivationDroppingGrounding, planInventoryRederivation, } from "./inventory-rederive.js";
28
29
  import { listLaneMarkdownFiles } from "./kb-sources.js";
@@ -435,6 +436,30 @@ export function buildSchema6MigrationFragment(input) {
435
436
  },
436
437
  }));
437
438
  }
439
+ // Entity files that take their type from the folder get it stated at any
440
+ // schema version, so the first kb_upsert on one adds no type line.
441
+ const typeBackfill = planEntityTypeBackfill(input.workspaceRoot);
442
+ if (typeBackfill.targets.length > 0) {
443
+ sourceRewriteActionIds.push(ENTITY_TYPE_BACKFILL_ACTION_ID);
444
+ actions.push(migrationAction({
445
+ id: ENTITY_TYPE_BACKFILL_ACTION_ID,
446
+ code: ENTITY_TYPE_BACKFILL_CODE,
447
+ category: "schema",
448
+ safety: "automatic",
449
+ autoApplicable: true,
450
+ invocation: { kind: "cli", command_argv: ["kibi", "migrate", "--yes"] },
451
+ affectedEntityIds: typeBackfill.targets.map((row) => row.id),
452
+ affectedFiles: typeBackfill.targets.map((row) => row.path),
453
+ postconditions: [{ entitiesWithoutType: 0 }],
454
+ evidence: {
455
+ reason: "These entity files take their type from the folder. Every Kibi write states type in front matter, so the first kb_upsert on one would add a type line the change did not ask for. Each gets the folder-implied type as its last front matter key, the type kibi sync already reads.",
456
+ count: typeBackfill.targets.length,
457
+ byType: countByType(typeBackfill.targets),
458
+ skipped: typeBackfill.skipped,
459
+ preserves: "every other front matter key and the body bytes",
460
+ },
461
+ }));
462
+ }
438
463
  // Schema 8: pin the checked meaning, then acknowledge missing context. A
439
464
  // missing or invalid version upgrades through every step, so it is planned.
440
465
  if (input.currentSchemaVersion === null ||
@@ -750,6 +775,12 @@ export async function applySchema6MigrationAction(action, context) {
750
775
  applyPolarityValueBackfill(context.workspaceRoot);
751
776
  return;
752
777
  }
778
+ case ENTITY_TYPE_BACKFILL_CODE: {
779
+ const result = applyEntityTypeBackfill(context.workspaceRoot);
780
+ if (result.skipped.length > 0)
781
+ throw new Error(`Could not state the type of ${result.skipped.map((skip) => `${skip.path} (${skip.reason})`).join(", ")}; add the type line by hand.`);
782
+ return;
783
+ }
753
784
  case SEMANTIC_TEXT_PIN_CODE: {
754
785
  applySemanticTextPins(context.workspaceRoot);
755
786
  return;
@@ -854,6 +885,7 @@ export const SCHEMA6_APPROVABLE_REVIEW_CODES = new Set([
854
885
  // implements REQ-kibi-schema6-migration, REQ-cli-schema-migration
855
886
  export const SCHEMA6_AUTOMATIC_CODES = new Set([
856
887
  POLARITY_VALUE_BACKFILL_CODE,
888
+ ENTITY_TYPE_BACKFILL_CODE,
857
889
  SEMANTIC_TEXT_PIN_CODE,
858
890
  CONTEXT_MISSING_TAG_CODE,
859
891
  SUPERSEDES_REASON_ACKNOWLEDGE_CODE,
@@ -29,6 +29,11 @@ export declare function withStoredRequirementSemantics(input: UpsertInput, prolo
29
29
  * inventory is legacy content sync keeps accepting, so a write that changes
30
30
  * neither keeps working. A write that makes the requirement current, or
31
31
  * changes the prose sync checks, must carry the complete inventory.
32
+ *
33
+ * A requirement the store does not hold (its file failed the last sync, or
34
+ * was written since) is judged by the rule sync applies to that file: it
35
+ * keeps the legacy treatment only when the last sync recorded the file as
36
+ * legacy content or as having compiled with the same prose.
32
37
  */
33
38
  export declare function assertStoredRequirementBoundary(input: UpsertInput, relationships: readonly SemanticRelationship[], prolog: Pick<PrologPort, "query">, staged?: StagedUpsertState, lookup?: StoredEntityLookup): Promise<void>;
34
39
  //# sourceMappingURL=requirement-semantics.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"requirement-semantics.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/requirement-semantics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAE3E,OAAO,EAEL,KAAK,oBAAoB,EAE1B,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EACL,KAAK,kBAAkB,EAExB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAwCjE;;;;;;;;;;;;GAYG;AACH,wBAAsB,8BAA8B,CAClD,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,EACjC,MAAM,CAAC,EAAE,iBAAiB,EAC1B,MAAM,GAAE,kBAAqE,GAC5E,OAAO,CAAC,WAAW,CAAC,CAsCtB;AAuBD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,+BAA+B,CACnD,KAAK,EAAE,WAAW,EAClB,aAAa,EAAE,SAAS,oBAAoB,EAAE,EAC9C,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,EACjC,MAAM,CAAC,EAAE,iBAAiB,EAC1B,MAAM,GAAE,kBAAqE,GAC5E,OAAO,CAAC,IAAI,CAAC,CAmBf"}
1
+ {"version":3,"file":"requirement-semantics.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/requirement-semantics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAE3E,OAAO,EAEL,KAAK,oBAAoB,EAE1B,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EACL,KAAK,kBAAkB,EAExB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAwCjE;;;;;;;;;;;;GAYG;AACH,wBAAsB,8BAA8B,CAClD,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,EACjC,MAAM,CAAC,EAAE,iBAAiB,EAC1B,MAAM,GAAE,kBAAqE,GAC5E,OAAO,CAAC,WAAW,CAAC,CAsCtB;AAkCD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,+BAA+B,CACnD,KAAK,EAAE,WAAW,EAClB,aAAa,EAAE,SAAS,oBAAoB,EAAE,EAC9C,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,EACjC,MAAM,CAAC,EAAE,iBAAiB,EAC1B,MAAM,GAAE,kBAAqE,GAC5E,OAAO,CAAC,IAAI,CAAC,CAwBf"}
@@ -82,6 +82,12 @@ const BOUNDARY_FIELDS = [
82
82
  "text_ref",
83
83
  ...SEMANTIC_CONTRACT_FIELDS,
84
84
  ];
85
+ /** Whether a requirement states an inventory contract sync always checks. */
86
+ function advertisesSemanticContract(properties) {
87
+ return (properties.semantic_inventory_version !== undefined ||
88
+ properties.semantic_source_hash !== undefined ||
89
+ properties.semantic_inventory !== undefined);
90
+ }
85
91
  function boundaryOf(input, properties, relationships) {
86
92
  const payload = { type: input.type, id: input.id, properties };
87
93
  const { receipt } = analyzeSemanticAdvisorInput({
@@ -89,7 +95,7 @@ function boundaryOf(input, properties, relationships) {
89
95
  });
90
96
  return validateSemanticInventoryBoundary(payload, relationships, receipt);
91
97
  }
92
- // implements REQ-kibi-upsert-preserves-requirement-semantics, REQ-kibi-proposition-complete-ingestion
98
+ // implements REQ-kibi-upsert-preserves-requirement-semantics, REQ-kibi-proposition-complete-ingestion, REQ-kibi-uncompiled-source-semantic-baseline
93
99
  /**
94
100
  * An update to a stored requirement is judged as its authored file will read
95
101
  * afterwards: the stored status, prose and proposition ledger with the
@@ -103,6 +109,11 @@ function boundaryOf(input, properties, relationships) {
103
109
  * inventory is legacy content sync keeps accepting, so a write that changes
104
110
  * neither keeps working. A write that makes the requirement current, or
105
111
  * changes the prose sync checks, must carry the complete inventory.
112
+ *
113
+ * A requirement the store does not hold (its file failed the last sync, or
114
+ * was written since) is judged by the rule sync applies to that file: it
115
+ * keeps the legacy treatment only when the last sync recorded the file as
116
+ * legacy content or as having compiled with the same prose.
106
117
  */
107
118
  export async function assertStoredRequirementBoundary(input, relationships, prolog, staged, lookup = storedEntityLookup(prolog, input.id, input.type)) {
108
119
  if (input.type !== "req")
@@ -115,11 +126,19 @@ export async function assertStoredRequirementBoundary(input, relationships, prol
115
126
  if (stored[field] !== undefined)
116
127
  before[field] = stored[field];
117
128
  }
118
- const after = boundaryOf(input, { ...before, ...(input.properties ?? {}) }, relationships);
129
+ const written = { ...before, ...(input.properties ?? {}) };
130
+ const after = boundaryOf(input, written, relationships);
119
131
  if (after.errors.length === 0)
120
132
  return;
121
- const previous = boundaryOf(input, before, relationships);
122
- if (previous.applicable && previous.sourceHash === after.sourceHash)
123
- return;
133
+ if (lookup.keepsSemanticBaseline !== undefined) {
134
+ if (!advertisesSemanticContract(written) &&
135
+ lookup.keepsSemanticBaseline(after.sourceHash))
136
+ return;
137
+ }
138
+ else {
139
+ const previous = boundaryOf(input, before, relationships);
140
+ if (previous.applicable && previous.sourceHash === after.sourceHash)
141
+ return;
142
+ }
124
143
  throw new Error(`Proposition-complete ingestion failed: ${input.id} would be written as a current requirement without a complete proposition inventory (${after.errors.join("; ")}). Run kb_model mode analyze (CLI: semantic-advisor) with id '${input.id}' and its complete semantic_text, then send the returned inventory contract (semantic_inventory, semantic_inventory_version, semantic_source_field, semantic_source_hash, logic_claims) in this kb_upsert, or retire the requirement through a superseding one instead.`);
125
144
  }
@@ -14,6 +14,13 @@ export type StoredEntityLookup = {
14
14
  * rather than the store (an entity the store does not hold yet).
15
15
  */
16
16
  readonly relationships?: readonly Readonly<Record<string, unknown>>[];
17
+ /**
18
+ * For an entity the store does not hold: whether kibi sync will accept its
19
+ * requirement prose (hashing to the given semantic source hash) without a
20
+ * complete inventory. Absent for a stored entity, which is judged by its
21
+ * stored prose instead.
22
+ */
23
+ readonly keepsSemanticBaseline?: (sourceHash: string) => boolean;
17
24
  };
18
25
  /**
19
26
  * One read of the entity an upsert replaces, shared by every step of the
@@ -1 +1 @@
1
- {"version":3,"file":"stored-entity.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/stored-entity.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,UAAU,EAAE,M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AC,EAAE,CAAC;IACtE;;;;;OAKG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC;CAClE,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,EACjC,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,GACX,kBAAkB,CAsBpB"}
@@ -1,4 +1,4 @@
1
1
  import type { OperationContext } from "../../public/operations/runtime-types.js";
2
2
  import type { RelationshipInput } from "./types.js";
3
- export declare function validateSymbolGranularity(entity: Readonly<Record<string, unknown>>, relationships: readonly RelationshipInput[], context: OperationContext): Promise<void>;
3
+ export declare function validateSymbolGranularity(payload: Readonly<Record<string, unknown>>, relationships: readonly RelationshipInput[], context: OperationContext, stored?: () => Promise<Readonly<Record<string, unknown>> | null | undefined>): Promise<void>;
4
4
  //# sourceMappingURL=symbol-granularity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"symbol-granularity.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/symbol-granularity.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAWjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AA2BpD,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACzC,aAAa,EAAE,SAAS,iBAAiB,EAAE,EAC3C,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,IAAI,CAAC,CAuCf"}
1
+ {"version":3,"file":"symbol-granularity.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/symbol-granularity.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAYjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAuDpD,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAC1C,aAAa,EAAE,SAAS,iBAAiB,EAAE,EAC3C,OAAO,EAAE,gBAAgB,EACzB,MAAM,CAAC,EAAE,MAAM,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,GAC3E,OAAO,CAAC,IAAI,CAAC,CAgDf"}
@@ -1,6 +1,6 @@
1
1
  import path from "node:path";
2
2
  import { collectGranularityCandidates } from "kibi-plugin-builtin";
3
- import { ALLOWED_GRANULARITY_REASONS_PROSE, getBehavioralSymbolNames, getNonBehavioralSymbolNames, inferSymbolRole, isAllowedGranularityReason, isTraceabilityRelationshipType, } from "../../public/symbol-granularity.js";
3
+ import { ALLOWED_GRANULARITY_REASONS_PROSE, coarseLinkBehavioralNames, getBehavioralSymbolNames, getNonBehavioralSymbolNames, inferSymbolRole, isAllowedGranularityReason, isTraceabilityRelationshipType, } from "../../public/symbol-granularity.js";
4
4
  function candidate(name, kind) {
5
5
  return { name, kind, role: inferSymbolRole(kind) };
6
6
  }
@@ -19,12 +19,38 @@ function summarized(names) {
19
19
  const hidden = names.length - shown.length;
20
20
  return `${shown.join(", ")}${hidden > 0 ? `, and ${hidden} more` : ""}`;
21
21
  }
22
- // implements REQ-kibi-operation-interface-parity
23
- export async function validateSymbolGranularity(entity, relationships, context) {
24
- if (entity.type !== "symbol")
22
+ const STORED_LOCATION_FIELDS = [
23
+ "title",
24
+ "sourceFile",
25
+ "symbol_role",
26
+ "granularity_reason",
27
+ ];
28
+ // implements REQ-kibi-symbol-link-guidance
29
+ /**
30
+ * The symbol a granularity check judges when an upsert updates a stored
31
+ * symbol: a payload that only adds links (title and relationships, no
32
+ * sourceFile) still links the stored symbol's file, so the fields the check
33
+ * reads fall back to the stored entity. Fields the payload sets win.
34
+ */
35
+ function withStoredSymbolLocation(entity, stored) {
36
+ if (entity.type !== "symbol" || stored === null || stored === undefined)
37
+ return entity;
38
+ const merged = { ...entity };
39
+ for (const field of STORED_LOCATION_FIELDS) {
40
+ if (merged[field] === undefined && stored[field] !== undefined)
41
+ merged[field] = stored[field];
42
+ }
43
+ return merged;
44
+ }
45
+ // implements REQ-kibi-operation-interface-parity, REQ-kibi-symbol-link-guidance
46
+ export async function validateSymbolGranularity(payload, relationships, context, stored) {
47
+ if (payload.type !== "symbol")
25
48
  return;
26
49
  if (!relationships.some((relationship) => isTraceabilityRelationshipType(relationship.type)))
27
50
  return;
51
+ const entity = stored === undefined
52
+ ? payload
53
+ : withStoredSymbolLocation(payload, await stored());
28
54
  if (isAllowedGranularityReason(entity.granularity_reason))
29
55
  return;
30
56
  if (typeof entity.sourceFile !== "string" || typeof entity.title !== "string")
@@ -49,9 +75,13 @@ export async function validateSymbolGranularity(entity, relationships, context)
49
75
  }
50
76
  const available = candidates(entity.sourceFile, content);
51
77
  const exact = available.find(({ name }) => name === entity.title);
52
- if (exact && (exact.kind !== "variable" || entity.symbol_role === "config"))
53
- return;
54
- const behavioral = getBehavioralSymbolNames(available);
78
+ // A declaration named like the symbol is coarse only through its own
79
+ // behavioral members (a class and its public methods), the same test the
80
+ // staged gate and `kibi check` apply; any other title is judged against
81
+ // every behavioral declaration in the file.
82
+ const behavioral = exact && (exact.kind !== "variable" || entity.symbol_role === "config")
83
+ ? coarseLinkBehavioralNames(entity.title, available)
84
+ : getBehavioralSymbolNames(available);
55
85
  if (behavioral.length === 0)
56
86
  return;
57
87
  const nonBehavioral = getNonBehavioralSymbolNames(available);
@@ -1,3 +1,4 @@
1
+ import { type SourceExtractionFailure } from "../../commands/sync/cache.js";
1
2
  import type { OperationContext } from "../../public/operations/runtime-types.js";
2
3
  import type { StoredEntityLookup } from "./stored-entity.js";
3
4
  import type { RelationshipInput, UpsertInput } from "./types.js";
@@ -17,6 +18,11 @@ export type UncompiledAuthoredSource = Readonly<{
17
18
  stored: Readonly<Record<string, unknown>>;
18
19
  /** Why kibi sync cannot compile the file as authored; null when it can. */
19
20
  extractionError: string | null;
21
+ /**
22
+ * What the last sync recorded when it could not extract the file; undefined
23
+ * when no sync has failed on it (the file was written since).
24
+ */
25
+ syncFailure: SourceExtractionFailure | undefined;
20
26
  }>;
21
27
  /**
22
28
  * The authored document an upsert of `input` would merge into although the
@@ -1 +1 @@
1
- {"version":3,"file":"uncompiled-source.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/uncompiled-source.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAMjF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEjE;;;GAGG;AAEH,MAAM,MAAM,wBAAwB,GAAG,QAAQ,CAAC;IAC9C,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1C,2EAA2E;IAC3E,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC,CAAC,CAAC;AAMH;;;;;;;GAOG;AAEH,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,gBAAgB,EACzB,KAAK,EAAE,WAAW,GACjB,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC,CA8C1C;AAED;;;;GAIG;AAEH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,wBAAwB,GAC/B,kBAAkB,CAKpB;AAED;;;;;GAKG;AAEH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,wBAAwB,EAChC,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE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