kibi-cli 2.6.0 → 2.7.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 (131) 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/check.d.ts.map +1 -1
  4. package/dist/commands/check.js +15 -0
  5. package/dist/commands/init-helpers.js +1 -1
  6. package/dist/commands/migrate.d.ts.map +1 -1
  7. package/dist/commands/migrate.js +43 -0
  8. package/dist/entity-body-context.d.ts +132 -0
  9. package/dist/entity-body-context.d.ts.map +1 -0
  10. package/dist/entity-body-context.js +382 -0
  11. package/dist/extractors/markdown.d.ts +13 -0
  12. package/dist/extractors/markdown.d.ts.map +1 -1
  13. package/dist/extractors/markdown.js +19 -2
  14. package/dist/intent-search.d.ts.map +1 -1
  15. package/dist/intent-search.js +4 -4
  16. package/dist/operations/bootstrap/candidate-helpers.d.ts +18 -0
  17. package/dist/operations/bootstrap/candidate-helpers.d.ts.map +1 -1
  18. package/dist/operations/bootstrap/candidate-helpers.js +35 -0
  19. package/dist/operations/bootstrap/candidates.d.ts.map +1 -1
  20. package/dist/operations/bootstrap/candidates.js +4 -2
  21. package/dist/operations/bootstrap/intent-claims.d.ts.map +1 -1
  22. package/dist/operations/bootstrap/intent-claims.js +59 -4
  23. package/dist/operations/bootstrap/markdown-candidates.d.ts.map +1 -1
  24. package/dist/operations/bootstrap/markdown-candidates.js +7 -3
  25. package/dist/operations/bootstrap/presentation.js +1 -1
  26. package/dist/operations/migration/entity-body-context.d.ts +57 -0
  27. package/dist/operations/migration/entity-body-context.d.ts.map +1 -0
  28. package/dist/operations/migration/entity-body-context.js +261 -0
  29. package/dist/operations/migration/polarity-values.d.ts.map +1 -1
  30. package/dist/operations/migration/polarity-values.js +5 -2
  31. package/dist/operations/migration/schema6.d.ts +2 -0
  32. package/dist/operations/migration/schema6.d.ts.map +1 -1
  33. package/dist/operations/migration/schema6.js +69 -0
  34. package/dist/operations/modeling/logic-modeling.d.ts.map +1 -1
  35. package/dist/operations/modeling/logic-modeling.js +3 -1
  36. package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
  37. package/dist/operations/modeling/model-requirement.js +7 -9
  38. package/dist/operations/mutation/context-warning.d.ts +13 -0
  39. package/dist/operations/mutation/context-warning.d.ts.map +1 -0
  40. package/dist/operations/mutation/context-warning.js +59 -0
  41. package/dist/operations/mutation/origin.d.ts +2 -1
  42. package/dist/operations/mutation/origin.d.ts.map +1 -1
  43. package/dist/operations/mutation/origin.js +7 -18
  44. package/dist/operations/mutation/requirement-semantics.d.ts +16 -0
  45. package/dist/operations/mutation/requirement-semantics.d.ts.map +1 -0
  46. package/dist/operations/mutation/requirement-semantics.js +64 -0
  47. package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
  48. package/dist/operations/mutation/source-authoring.js +10 -0
  49. package/dist/operations/mutation/stored-entity.d.ts +20 -0
  50. package/dist/operations/mutation/stored-entity.d.ts.map +1 -0
  51. package/dist/operations/mutation/stored-entity.js +51 -0
  52. package/dist/operations/mutation/upsert.d.ts +3 -2
  53. package/dist/operations/mutation/upsert.d.ts.map +1 -1
  54. package/dist/operations/mutation/upsert.js +19 -10
  55. package/dist/operations/mutation/validate-upsert.d.ts.map +1 -1
  56. package/dist/operations/mutation/validate-upsert.js +6 -1
  57. package/dist/operations/planning/compile-intent.d.ts +9 -0
  58. package/dist/operations/planning/compile-intent.d.ts.map +1 -1
  59. package/dist/operations/planning/compile-intent.js +49 -2
  60. package/dist/operations/semantic-advisor/analyze-prose.d.ts +3 -2
  61. package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
  62. package/dist/operations/semantic-advisor/analyze-prose.js +3 -41
  63. package/dist/operations/semantic-advisor/ingestion-boundary.d.ts.map +1 -1
  64. package/dist/operations/semantic-advisor/ingestion-boundary.js +10 -1
  65. package/dist/operations/semantic-advisor/proposition-role.d.ts +6 -0
  66. package/dist/operations/semantic-advisor/proposition-role.d.ts.map +1 -0
  67. package/dist/operations/semantic-advisor/proposition-role.js +76 -0
  68. package/dist/public/operations/catalog.d.ts +33 -6
  69. package/dist/public/operations/catalog.d.ts.map +1 -1
  70. package/dist/public/operations/check-executor.d.ts.map +1 -1
  71. package/dist/public/operations/check-executor.js +3 -0
  72. package/dist/public/operations/entity-context.d.ts +51 -0
  73. package/dist/public/operations/entity-context.d.ts.map +1 -0
  74. package/dist/public/operations/entity-context.js +235 -0
  75. package/dist/public/operations/origin-review.d.ts +1 -1
  76. package/dist/public/operations/origin-review.js +2 -2
  77. package/dist/public/operations/specs/bootstrap.d.ts +14 -2
  78. package/dist/public/operations/specs/bootstrap.d.ts.map +1 -1
  79. package/dist/public/operations/specs/bootstrap.js +8 -2
  80. package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
  81. package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
  82. package/dist/public/operations/specs/check-rules.generated.js +3 -1
  83. package/dist/public/operations/specs/check.d.ts +1 -1
  84. package/dist/public/operations/specs/mutation-schemas.d.ts +1 -1
  85. package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
  86. package/dist/public/operations/specs/mutation-schemas.js +10 -2
  87. package/dist/public/operations/specs/planning.d.ts +15 -0
  88. package/dist/public/operations/specs/planning.d.ts.map +1 -1
  89. package/dist/public/operations/specs/planning.js +15 -0
  90. package/dist/public/operations/specs/upsert.d.ts +3 -3
  91. package/dist/public/operations/specs/upsert.js +2 -2
  92. package/dist/public/schemas/entity.d.ts.map +1 -1
  93. package/dist/public/schemas/entity.js +7 -1
  94. package/dist/public/skills/kibi-bootstrap/SKILL.md +3 -3
  95. package/dist/public/skills/kibi-bootstrap/resources/bootstrap.md +5 -1
  96. package/dist/public/skills/kibi-usage/SKILL.md +56 -3
  97. package/dist/public/skills/kibi-usage/resources/source-authoring.md +5 -1
  98. package/dist/schemas/entity.schema.json +14 -1
  99. package/dist/search-ranking.d.ts.map +1 -1
  100. package/dist/search-ranking.js +7 -4
  101. package/dist/traceability/staged-consistency.d.ts +25 -0
  102. package/dist/traceability/staged-consistency.d.ts.map +1 -0
  103. package/dist/traceability/staged-consistency.js +92 -0
  104. package/dist/traceability/temp-kb.d.ts.map +1 -1
  105. package/dist/traceability/temp-kb.js +5 -0
  106. package/dist/utils/kb-manifest.d.ts +5 -0
  107. package/dist/utils/kb-manifest.d.ts.map +1 -1
  108. package/dist/utils/kb-manifest.js +6 -0
  109. package/dist/utils/rule-registry.generated.d.ts +11 -0
  110. package/dist/utils/rule-registry.generated.d.ts.map +1 -1
  111. package/dist/utils/rule-registry.generated.js +13 -0
  112. package/dist/utils/schema-version.d.ts +1 -1
  113. package/dist/utils/schema-version.d.ts.map +1 -1
  114. package/dist/utils/schema-version.js +3 -2
  115. package/package.json +2 -2
  116. package/schema/manifest.json +5 -0
  117. package/schema/validation.pl +14 -2
  118. package/src/public/operations/check-executor.ts +6 -0
  119. package/src/public/operations/entity-context.ts +304 -0
  120. package/src/public/operations/origin-review.ts +2 -2
  121. package/src/public/operations/specs/bootstrap.ts +9 -2
  122. package/src/public/operations/specs/check-rules.generated.ts +3 -1
  123. package/src/public/operations/specs/mutation-schemas.ts +10 -2
  124. package/src/public/operations/specs/planning.ts +18 -0
  125. package/src/public/operations/specs/upsert.ts +2 -2
  126. package/src/public/schemas/entity.ts +7 -1
  127. package/src/public/skills/kibi-bootstrap/SKILL.md +3 -3
  128. package/src/public/skills/kibi-bootstrap/resources/bootstrap.md +5 -1
  129. package/src/public/skills/kibi-usage/SKILL.md +56 -3
  130. package/src/public/skills/kibi-usage/resources/source-authoring.md +5 -1
  131. package/src/schemas/entity.schema.json +14 -1
@@ -1 +1 @@
1
- {"version":3,"file":"compile-intent.d.ts","sourceRoot":"","sources":["../../../src/operations/planning/compile-intent.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAEpB,MAAM,wBAAwB,CAAC;AAKhC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S,oBAAoB,EAAE,CAAC;IACzC,SAAS,EAAE,SAAS,oBAAoB,EAAE,CAAC;CAC5C,CAAC,CAAC;AAqBH;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAoBvE;AAGD,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAExE;AAqQD,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC;IACT,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,iBAAiB,EAAE,aAAa,CAAC;CAClC,CAAC,CA2aD"}
@@ -1,10 +1,12 @@
1
1
  import { createHash } from "node:crypto";
2
2
  import path from "node:path";
3
+ import { renderRequirementBody, reviseRequirementBody, } from "../../entity-body-context.js";
3
4
  import { executeIntentSearch, } from "../../intent-search.js";
4
5
  import { publicCapabilityStamp } from "../../plugins/compose-semantic-classifier.js";
5
6
  import { normalizeEntityId } from "../../prolog/codec.js";
6
7
  import { loadEntities } from "../../public/operations/discovery-entities.js";
7
8
  import { executeStatus } from "../../public/operations/discovery-executors.js";
9
+ import { readAuthoredEntity } from "../../public/operations/entity-context.js";
8
10
  import { buildWhatIfAnalysisGoal } from "../mutation/contradictions.js";
9
11
  import { canonicalSourcePath } from "../mutation/source-authoring.js";
10
12
  import { validateUpsertInput } from "../mutation/validation.js";
@@ -48,6 +50,13 @@ function requiredIntent(args) {
48
50
  !text(args.requirementId)) {
49
51
  throw new Error("Compile intent failed: requirementId must be non-empty when supplied");
50
52
  }
53
+ if (args.mode === "create" && !text(args.context)) {
54
+ throw new Error("Compile intent failed: context must be non-empty when mode is create; state why the requirement exists, who asked and the source, or write 'Reason not stated' when the requester gave no reason");
55
+ }
56
+ if (!text(args.context) &&
57
+ (text(args.sourceExcerpt) !== "" || text(args.sourceReference) !== "")) {
58
+ throw new Error("Compile intent failed: sourceExcerpt and sourceReference need context; supply context or drop them");
59
+ }
51
60
  return intent;
52
61
  }
53
62
  function validateLocation(location) {
@@ -251,7 +260,9 @@ async function withDocumentTargets(context, prolog, steps, requirement, now) {
251
260
  const stepDocument = isRecord(step.document) ? step.document : {};
252
261
  const document = type === "req" && id === requirement.id
253
262
  ? {
254
- body: requirement.body,
263
+ ...(requirement.body !== undefined
264
+ ? { body: requirement.body }
265
+ : {}),
255
266
  ...(requirement.path !== undefined
256
267
  ? { path: requirement.path }
257
268
  : {}),
@@ -283,6 +294,18 @@ async function withDocumentTargets(context, prolog, steps, requirement, now) {
283
294
  }
284
295
  return targeted;
285
296
  }
297
+ /** Body of the requirement's existing authored document, when readable. */
298
+ async function existingRequirementBody(context, source) {
299
+ if (!context.fs || !source.endsWith(".md"))
300
+ return undefined;
301
+ try {
302
+ const raw = await context.fs.readFile(path.join(context.workspaceRoot, source));
303
+ return readAuthoredEntity(String(raw), source)?.body ?? undefined;
304
+ }
305
+ catch {
306
+ return undefined;
307
+ }
308
+ }
286
309
  function generatedRequirementId(intent) {
287
310
  return `REQ-${slug(intent)}-${shortHash(intent).toUpperCase()}`;
288
311
  }
@@ -841,11 +864,35 @@ export async function executeCompileIntent(args, context) {
841
864
  // A step whose entity or document cannot be rendered would fail the apply,
842
865
  // so it makes the plan need resolution instead of reporting it ready.
843
866
  let planSteps = stepsWithAcceptedProposals;
867
+ // A create always carries context. An update replaces the non-context part
868
+ // of the existing body with the new intent and keeps its context sections
869
+ // byte for byte; supplied context or source replaces those sections too.
870
+ const sourceInput = {
871
+ excerpt: args.sourceExcerpt,
872
+ reference: args.sourceReference,
873
+ };
874
+ const existingBody = args.mode === "update"
875
+ ? await existingRequirementBody(context, requirementDocument ?? text(existingEntity.source))
876
+ : undefined;
877
+ const requirementBody = existingBody !== undefined
878
+ ? reviseRequirementBody({
879
+ existingBody,
880
+ statement: intent,
881
+ context: args.context,
882
+ source: sourceInput,
883
+ })
884
+ : text(args.context) !== ""
885
+ ? renderRequirementBody({
886
+ statement: intent,
887
+ context: args.context,
888
+ source: sourceInput,
889
+ })
890
+ : undefined;
844
891
  if (statusValue === "ready") {
845
892
  try {
846
893
  planSteps = await withDocumentTargets(context, prolog, stepsWithAcceptedProposals, {
847
894
  id: requirementId,
848
- body: `${intent.trim()}\n`,
895
+ ...(requirementBody !== undefined ? { body: requirementBody } : {}),
849
896
  ...(requirementDocument !== undefined
850
897
  ? { path: requirementDocument }
851
898
  : {}),
@@ -1,7 +1,8 @@
1
- import type { SemanticAdvisorAnalysisResult, SemanticAdvisorInput, SemanticPropositionRole } from "./types.js";
1
+ import { propositionRole } from "./proposition-role.js";
2
+ import type { SemanticAdvisorAnalysisResult, SemanticAdvisorInput } from "./types.js";
2
3
  export declare const SEMANTIC_ADVISOR_VERSION = "semantic-advisor-v2";
3
4
  export { semanticClaimKey } from "./clauses.js";
4
5
  export declare function stringLogicClaims(value: unknown): string[];
5
- export declare function propositionRole(statement: string, normative: boolean): SemanticPropositionRole;
6
+ export { propositionRole };
6
7
  export declare function analyzeSemanticAdvisorInput(input: SemanticAdvisorInput): SemanticAdvisorAnalysisResult;
7
8
  //# sourceMappingURL=analyze-prose.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"analyze-prose.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/analyze-prose.ts"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EACV,6BAA6B,EAC7B,oBAAoB,EAKpB,uBAAuB,EAMxB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,wBAAwB,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAI1D;AAwgBD,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,OAAO,GACjB,uBAAuB,CAuDzB;AA4VD,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,oBAAoB,GAC1B,6BAA6B,CA+D/B"}
1
+ {"version":3,"file":"analyze-prose.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/analyze-prose.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAiBxD,OAAO,KAAK,EACV,6BAA6B,EAC7B,oBAAoB,EAWrB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,wBAAwB,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAI1D;AAugBD,OAAO,EAAE,eAAe,EAAE,CAAC;AA4V3B,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,oBAAoB,GAC1B,6BAA6B,CA+D/B"}
@@ -2,9 +2,10 @@ import { createBuiltinOntologyPack, detectSignals as detectBuiltinSignals, } fro
2
2
  import { utf8Span, validateLogicIr, } from "../../logic/ir.js";
3
3
  import { logicRuleFactId } from "../modeling/logic-modeling.js";
4
4
  import { buildAdvisorResult } from "./analysis-receipt.js";
5
- import { extractSemanticClauses, hasNormativeAssertion, semanticClaimKey, } from "./clauses.js";
5
+ import { extractSemanticClauses, semanticClaimKey, } from "./clauses.js";
6
6
  import { detectConditionalRule, } from "./conditional-rules.js";
7
7
  import { observationPlan } from "./observation-plan.js";
8
+ import { propositionRole } from "./proposition-role.js";
8
9
  import { predicateSuggestion as buildPredicateSuggestion, isRecord, payloadHash, propertiesOf, relationship, semanticClausesOf, semanticSourceHash, semanticSourceOf, sourceOf, statementOf, stringValue, } from "./shared.js";
9
10
  import { detectStrictSuggestion } from "./strict-rules.js";
10
11
  export const SEMANTIC_ADVISOR_VERSION = "semantic-advisor-v2";
@@ -415,46 +416,7 @@ function unmatchedClauseSuggestion(payload, clause, clauses, expectedClaimKeys)
415
416
  ]),
416
417
  }, clause, clauses, expectedClaimKeys, statementOf(payload), semanticSourceOf(payload).field);
417
418
  }
418
- // implements REQ-kibi-conditional-requirement-authoring
419
- export function propositionRole(statement, normative) {
420
- // Explicit context labels may quote obligations. Incidental explanatory
421
- // words within an asserted obligation must not exempt it from grounding.
422
- const assertedNormative = normative && hasNormativeAssertion(statement);
423
- // A bare desired impression is subjective, even when phrased with should.
424
- // Keep concrete actions, quantitative conditions and any independent
425
- // obligation assertive instead of exempting them through subjective words.
426
- const impression = /\bshould\s+(?:feel\s+(?:welcoming|comfortable|energetic)(?:\s+and\s+(?:welcoming|comfortable|energetic))*|(?:look|seem)\s+complete)\b/i.exec(statement);
427
- const impressionTail = impression
428
- ? statement.slice(impression.index + impression[0].length).trim()
429
- : "";
430
- const subjectiveAspiration = impression !== null &&
431
- (impressionTail.length === 0 ||
432
- /^(?:to|for)\s+[^,;.!?]+$/i.test(impressionTail)) &&
433
- !/\b(?:and|or)\b/i.test(impressionTail) &&
434
- !/\d|\b(?:at least|at most|exactly|within|no more than)\b/i.test(statement) &&
435
- !hasNormativeAssertion(statement.replace(impression[0], ""));
436
- if (/^\s*(?:for example\b|e\.g\.|(?:example|illustrative(?: example)?)\s*:)/i.test(statement) ||
437
- (!assertedNormative &&
438
- /\b(?:for example|e\.g\.|such as|illustrative)\b/i.test(statement)))
439
- return "example";
440
- if (/^\s*rationale\s*:/i.test(statement) ||
441
- (!assertedNormative &&
442
- /\b(?:because|so that|in order to| rationale|therefore)\b/i.test(statement)))
443
- return "rationale";
444
- if (subjectiveAspiration ||
445
- (!assertedNormative &&
446
- /\b(?:feel|comfortable|looks complete|seems complete|subjective|prefer)\b/i.test(statement)))
447
- return "subjective";
448
- if (/\b(?:means|defined as|refers to|is called)\b/i.test(statement))
449
- return "definition";
450
- if (/^\s*(?:if|when|whenever|provided that|only if)\b/i.test(statement))
451
- return "condition";
452
- if (/\b(?:unless|except|exempt|apart from)\b/i.test(statement))
453
- return "exception";
454
- if (normative)
455
- return "normative";
456
- return "descriptive";
457
- }
419
+ export { propositionRole };
458
420
  function shadowAnalysis(text, interpretations) {
459
421
  const valid = interpretations.filter((interpretation) => interpretation.valid);
460
422
  const models = valid.flatMap(({ normalized_ir: ir }) => (ir ? [ir] : []));
@@ -1 +1 @@
1
- {"version":3,"file":"ingestion-boundary.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/ingestion-boundary.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAE3E,OAAO,EACL,KAAK,OAAO,EAOb,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,sBAAsB,EAAuB,MAAM,YAAY,CAAC;AAgB9E,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC;IAC1C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,EAAE,CAAC,EAAE,OAAO,CAAC;CACd,CAAC,CAAC;AAgCH,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,SAAS,oBAAoB,EAAE,EAC9C,OAAO,EAAE,sBAAsB,GAC9B,+BAA+B,CA0IjC;AAED,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,SAAS,oBAAoB,EAAE,EAC9C,OAAO,EAAE,sBAAsB,GAC9B,IAAI,CAWN;AAoDD;;;;GAIG;AAEH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,SAAS,oBAAoB,EAAE,EAC9C,OAAO,EAAE,WAAW,CAAC,MA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AS,oBAAoB,EAAE,EAC9C,OAAO,EAAE,sBAAsB,GAC9B,IAAI,CAWN;AAoDD;;;;GAIG;AAEH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,SAAS,oBAAoB,EAAE,EAC9C,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,GAC9D,MAAM,GAAG,IAAI,CAUf;AAGD,wBAAsB,+BAA+B,CACnD,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,SAAS,oBAAoB,EAAE,EAC9C,MAAM,CAAC,EAAE,QAAQ,CAAC;IAChB,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;CAClE,CAAC,GACD,OAAO,CAAC,IAAI,CAAC,CAwBf"}
@@ -1,5 +1,6 @@
1
1
  import { escapeAtom } from "../../prolog/codec.js";
2
2
  import { semanticClaimKey } from "./clauses.js";
3
+ import { legacyPropositionRoles } from "./proposition-role.js";
3
4
  import { SEMANTIC_INVENTORY_VERSION, isRecord, propertiesOf, semanticSourceHash, semanticSourceOf, stringValue, } from "./shared.js";
4
5
  const CURRENT_REQUIREMENT_STATUSES = new Set([
5
6
  "open",
@@ -14,6 +15,14 @@ const LOGICAL_RELATIONSHIPS = new Set([
14
15
  "requires_predicate",
15
16
  "requires_rule",
16
17
  ]);
18
+ // A stored role matches when it is the advisor's current role or, for an
19
+ // assertive proposition, a role an earlier advisor assigned to the same text.
20
+ function roleMatchesAdvisor(role, expected) {
21
+ if (role === expected.role)
22
+ return true;
23
+ return (!CONTEXT_ROLES.has(expected.role) &&
24
+ legacyPropositionRoles(expected.claim_text).includes(role));
25
+ }
17
26
  function inventoryOf(payload) {
18
27
  const raw = propertiesOf(payload).semantic_inventory;
19
28
  return Array.isArray(raw) ? raw.filter(isRecord) : [];
@@ -96,7 +105,7 @@ export function validateSemanticInventoryBoundary(payload, relationships, receip
96
105
  if (expected &&
97
106
  (claimKey !== expected.claim_key ||
98
107
  claimText !== expected.claim_text ||
99
- role !== expected.role ||
108
+ !roleMatchesAdvisor(role, expected) ||
100
109
  start !== expected.span.start ||
101
110
  end !== expected.span.end)) {
102
111
  errors.push(`semantic_inventory[${index}] does not match advisor proposition '${expected.claim_key}'`);
@@ -0,0 +1,6 @@
1
+ import type { SemanticPropositionRole } from "./types.js";
2
+ export declare function isDefinitionShape(statement: string): boolean;
3
+ export declare function legacyPropositionRoles(statement: string): readonly SemanticPropositionRole[];
4
+ export declare function propositionRole(statement: string, normative: boolean): SemanticPropositionRole;
5
+ export declare function advisorPropositionRole(semanticText: string, claimKey: string, suppliedClauses?: readonly string[]): SemanticPropositionRole | null;
6
+ //# sourceMappingURL=proposition-role.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proposition-role.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/proposition-role.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAU1D,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAQ5D;AAOD,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,GAChB,SAAS,uBAAuB,EAAE,CAEpC;AAGD,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,OAAO,GACjB,uBAAuB,CAqDzB;AAOD,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAChB,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,GAClC,uBAAuB,GAAG,IAAI,CAKhC"}
@@ -0,0 +1,76 @@
1
+ import { extractSemanticClauses, hasNormativeAssertion } from "./clauses.js";
2
+ const DEFINITION_VERB = /\b(?:means|defined as|refers to|is called)\b/i;
3
+ const CONDITION_OPENER = /^\s*(?:if|when|whenever|provided that|only if)\b/i;
4
+ // implements REQ-kibi-conditional-requirement-authoring
5
+ // A definition is "<subject> means|is defined as|refers to|is called <...>" as
6
+ // the main predicate of a sentence that asserts no obligation. A definition
7
+ // verb that opens a relative clause ("every note that refers to the clip") or
8
+ // follows a condition does not make the sentence a definition.
9
+ export function isDefinitionShape(statement) {
10
+ if (hasNormativeAssertion(statement))
11
+ return false;
12
+ const match = DEFINITION_VERB.exec(statement);
13
+ if (match === null)
14
+ return false;
15
+ const subject = statement.slice(0, match.index);
16
+ if (subject.trim().length === 0 || CONDITION_OPENER.test(subject))
17
+ return false;
18
+ return !/\b(?:that|which|who)\s*$/i.test(subject);
19
+ }
20
+ // implements REQ-kibi-proposition-complete-ingestion
21
+ // Inventories persisted before definitions required the main-predicate shape
22
+ // recorded any clause containing a definition verb as a definition. Accept that
23
+ // stored role so existing knowledge keeps validating; new writes use the
24
+ // advisor's current role.
25
+ export function legacyPropositionRoles(statement) {
26
+ return DEFINITION_VERB.test(statement) ? ["definition"] : [];
27
+ }
28
+ // implements REQ-kibi-conditional-requirement-authoring
29
+ export function propositionRole(statement, normative) {
30
+ // Explicit context labels may quote obligations. Incidental explanatory
31
+ // words within an asserted obligation must not exempt it from grounding.
32
+ const assertedNormative = normative && hasNormativeAssertion(statement);
33
+ // A bare desired impression is subjective, even when phrased with should.
34
+ // Keep concrete actions, quantitative conditions and any independent
35
+ // obligation assertive instead of exempting them through subjective words.
36
+ const impression = /\bshould\s+(?:feel\s+(?:welcoming|comfortable|energetic)(?:\s+and\s+(?:welcoming|comfortable|energetic))*|(?:look|seem)\s+complete)\b/i.exec(statement);
37
+ const impressionTail = impression
38
+ ? statement.slice(impression.index + impression[0].length).trim()
39
+ : "";
40
+ const subjectiveAspiration = impression !== null &&
41
+ (impressionTail.length === 0 ||
42
+ /^(?:to|for)\s+[^,;.!?]+$/i.test(impressionTail)) &&
43
+ !/\b(?:and|or)\b/i.test(impressionTail) &&
44
+ !/\d|\b(?:at least|at most|exactly|within|no more than)\b/i.test(statement) &&
45
+ !hasNormativeAssertion(statement.replace(impression[0], ""));
46
+ if (/^\s*(?:for example\b|e\.g\.|(?:example|illustrative(?: example)?)\s*:)/i.test(statement) ||
47
+ (!assertedNormative &&
48
+ /\b(?:for example|e\.g\.|such as|illustrative)\b/i.test(statement)))
49
+ return "example";
50
+ if (/^\s*rationale\s*:/i.test(statement) ||
51
+ (!assertedNormative &&
52
+ /\b(?:because|so that|in order to| rationale|therefore)\b/i.test(statement)))
53
+ return "rationale";
54
+ if (subjectiveAspiration ||
55
+ (!assertedNormative &&
56
+ /\b(?:feel|comfortable|looks complete|seems complete|subjective|prefer)\b/i.test(statement)))
57
+ return "subjective";
58
+ if (isDefinitionShape(statement))
59
+ return "definition";
60
+ if (CONDITION_OPENER.test(statement))
61
+ return "condition";
62
+ if (/\b(?:unless|except|exempt|apart from)\b/i.test(statement))
63
+ return "exception";
64
+ if (normative)
65
+ return "normative";
66
+ return "descriptive";
67
+ }
68
+ // implements REQ-kibi-proposition-complete-ingestion
69
+ // The role the semantic advisor assigns to one claim of a requirement's
70
+ // semantic text. Writers derive persisted inventory roles from it so the
71
+ // write-time proposition-complete check, which compares against the same
72
+ // advisor, never rejects a plan Kibi itself generated.
73
+ export function advisorPropositionRole(semanticText, claimKey, suppliedClauses) {
74
+ const clause = extractSemanticClauses(semanticText, suppliedClauses).find((entry) => entry.claim_key === claimKey);
75
+ return clause ? propositionRole(clause.text, clause.normative) : null;
76
+ }
@@ -798,11 +798,22 @@ export declare const OPERATION_CATALOG: readonly [{
798
798
  readonly intentClaims: {
799
799
  readonly type: "array";
800
800
  readonly maxItems: 200;
801
- readonly description: "Statements the agent harvested from knowledgeSources, each citing its source. Intent claims (the default kind) that the strict modeler can ground become cited req candidates; the rest become explicit authoring follow-ups. Observation and open_question claims never become requirements: they become cited fact candidates with fact_kind observation, open questions tagged review:open-question. Bound into the plan hash.";
801
+ readonly description: "Statements the agent harvested from knowledgeSources, each citing its source. Intent claims (the default kind) that the strict modeler can ground become cited req candidates; the rest become explicit authoring follow-ups. Observation and open_question claims never become requirements: they become cited fact candidates with fact_kind observation, open questions tagged review:open-question. Every intent and observation claim needs an excerpt: the created entity's body keeps the statement, then a '## Source' section with the blockquoted excerpt, the source title and the reference. Bound into the plan hash.";
802
802
  readonly items: {
803
803
  readonly type: "object";
804
804
  readonly required: readonly ["statement", "sourceId", "reference"];
805
805
  readonly additionalProperties: false;
806
+ readonly if: {
807
+ readonly properties: {
808
+ readonly kind: {
809
+ readonly const: "open_question";
810
+ };
811
+ };
812
+ readonly required: readonly ["kind"];
813
+ };
814
+ readonly else: {
815
+ readonly required: readonly ["excerpt"];
816
+ };
806
817
  readonly properties: {
807
818
  readonly statement: {
808
819
  readonly type: "string";
@@ -820,7 +831,8 @@ export declare const OPERATION_CATALOG: readonly [{
820
831
  };
821
832
  readonly excerpt: {
822
833
  readonly type: "string";
823
- readonly description: "Optional short quote supporting the claim.";
834
+ readonly minLength: 1;
835
+ readonly description: "Verbatim passage from the source the claim came from. Required for intent and observation claims (optional for open_question): Kibi persists it with the knowledge source title and reference in the created entity's '## Source' section, because the ticket or page may be gone by the next migration.";
824
836
  };
825
837
  readonly kind: {
826
838
  readonly type: "string";
@@ -908,7 +920,7 @@ export declare const OPERATION_CATALOG: readonly [{
908
920
  }, {
909
921
  readonly name: "kb_upsert";
910
922
  readonly cliName: "upsert";
911
- readonly description: "Create or update one entity and optional relationships. Use for KB mutations after validating intent; prefer a dryRun:true call first because it validates without writing and returns semantic advisor receipts for prose-heavy requirements. Use kb_model (mode requirement) before hand-writing strict property facts from prose, and kb_model (mode predicates) before hand-writing ontology predicate facts. Use the `relationships` array for batch creation of multiple links in a single call (e.g., linking a requirement to multiple tests or facts). Prefer modeling requirements as reusable fact links (`constrains`, `requires_property`, or `requires_predicate`) so consistency and contradiction checks remain queryable. Relationship endpoints must already exist in KB. For requirements, the write will be rejected if it contradicts existing current requirements that constrain the same subject with incompatible properties. To replace a conflicting requirement, include a `supersedes` relationship from the new requirement to the old one in the same request, then upsert the old requirement with status closed (kb_check blocks a superseded requirement that is not closed). Successful writes may return non-blocking semantic advisor warnings; inspect and repair those warnings before treating prose as contradiction-checkable. Do not use for read-only inspection. Side effects: writes KB, may refresh symbol coordinates; dryRun:true writes nothing.";
923
+ readonly description: "Create or update one entity and optional relationships. Use for KB mutations after validating intent; prefer a dryRun:true call first because it validates without writing and returns semantic advisor receipts for prose-heavy requirements. Use kb_model (mode requirement) before hand-writing strict property facts from prose, and kb_model (mode predicates) before hand-writing ontology predicate facts. Use the `relationships` array for batch creation of multiple links in a single call (e.g., linking a requirement to multiple tests or facts). Prefer modeling requirements as reusable fact links (`constrains`, `requires_property`, or `requires_predicate`) so consistency and contradiction checks remain queryable. Relationship endpoints must already exist in KB. For requirements, the write will be rejected if it contradicts existing current requirements that constrain the same subject with incompatible properties. To replace a conflicting requirement, include a `supersedes` relationship from the new requirement to the old one in the same request, then upsert the old requirement with status closed (kb_check blocks a superseded requirement that is not closed). Successful writes may return non-blocking semantic advisor warnings; inspect and repair those warnings before treating prose as contradiction-checkable. Pass a sectioned `document.body` when creating a requirement (the statement, then `## Context` stating why it exists, who asked and the source, then `## Source` with the verbatim excerpt) and a prose body for scenarios, tests, ADRs and observation facts; a result warning reports an entity whose body lacks context, and kb_check blocks it under entity-context-missing. Never invent a reason the requester did not give: write 'Reason not stated'. Do not use for read-only inspection. Side effects: writes KB, may refresh symbol coordinates; dryRun:true writes nothing.";
912
924
  readonly businessInputSchema: {
913
925
  readonly type: "object";
914
926
  readonly required: readonly ["type", "id", "properties"];
@@ -1449,7 +1461,7 @@ export declare const OPERATION_CATALOG: readonly [{
1449
1461
  };
1450
1462
  readonly claim_text: {
1451
1463
  readonly type: "string";
1452
- readonly description: "Exact atomic requirement clause represented by this fact, retained for human audit.";
1464
+ readonly description: "Exact atomic requirement clause represented by this fact, retained for human audit. Requires claim_key, except on an observation or meta fact, which may quote the clause it is about without claim_key.";
1453
1465
  };
1454
1466
  readonly predicate_name: {
1455
1467
  readonly type: "string";
@@ -1616,7 +1628,7 @@ export declare const OPERATION_CATALOG: readonly [{
1616
1628
  readonly document: {
1617
1629
  readonly type: "object";
1618
1630
  readonly additionalProperties: false;
1619
- readonly description: "Optional source-first document write. Paths are workspace-relative; omit body when updating to preserve the existing body bytes.";
1631
+ readonly description: "Optional source-first document write. Paths are workspace-relative; omit body when updating to preserve the existing body bytes. For a new requirement pass a sectioned body: statement, '## Context' (why, who asked, constraints), '## Source' (blockquoted excerpt and reference); context never changes the checked meaning, which stays in semantic_text.";
1620
1632
  readonly properties: {
1621
1633
  readonly path: {
1622
1634
  readonly type: "string";
@@ -1705,7 +1717,7 @@ export declare const OPERATION_CATALOG: readonly [{
1705
1717
  readonly type: "string";
1706
1718
  readonly enum: readonly string[];
1707
1719
  };
1708
- readonly description: "Optional rule subset. Allowed: must-priority-coverage, symbol-coverage, symbol-traceability, no-dangling-refs, source-relationship-parity, source-path-dangling, no-cycles, required-fields, deprecated-adr-no-successor, superseded-requirement-open, scenario-feasibility, scenario-feasibility-unknown, exception-claim-keys, numeric-string-value, rule-key-arguments-missing, domain-contradictions, logic-coverage, rule-safety, rule-verifiability, query-plan-safety, req-status-vocabulary, strict-fact-shape, strict-req-fact-pairing, predicate-verifiability, strict-readiness, semantic-completeness, proof-contract-symbols, entity-id-style, domain-redundancy, domain-implication, subject-key-identity, subject-key-shape, ontology-quality, exception-unapproved, exception-approval-self-attested, agent-requirement-unapproved, requirement-rationale-missing, symbol-owner-superseded, adr-unlinked, adr-proposed, predicate-schema-conformance. If omitted, server runs canonical and advisory rules plus the full-KB qualityDiagnostics audit scan, including usage telemetry acceptance when evidence exists; migration rules run only when explicitly selected. Advisory and migration findings are non-blocking qualityDiagnostics. If supplied, server preserves scoped validation and skips the full-KB advisory scan.";
1720
+ readonly description: "Optional rule subset. Allowed: must-priority-coverage, symbol-coverage, symbol-traceability, no-dangling-refs, source-relationship-parity, source-path-dangling, no-cycles, required-fields, deprecated-adr-no-successor, superseded-requirement-open, scenario-feasibility, scenario-feasibility-unknown, exception-claim-keys, numeric-string-value, rule-key-arguments-missing, domain-contradictions, logic-coverage, rule-safety, rule-verifiability, query-plan-safety, req-status-vocabulary, strict-fact-shape, strict-req-fact-pairing, predicate-verifiability, strict-readiness, semantic-completeness, proof-contract-symbols, entity-id-style, domain-redundancy, domain-implication, subject-key-identity, subject-key-shape, ontology-quality, exception-unapproved, exception-approval-self-attested, agent-requirement-unapproved, requirement-rationale-missing, symbol-owner-superseded, adr-unlinked, adr-proposed, predicate-schema-conformance, entity-context-missing, entity-context-acknowledged. If omitted, server runs canonical and advisory rules plus the full-KB qualityDiagnostics audit scan, including usage telemetry acceptance when evidence exists; migration rules run only when explicitly selected. Advisory and migration findings are non-blocking qualityDiagnostics. If supplied, server preserves scoped validation and skips the full-KB advisory scan.";
1709
1721
  };
1710
1722
  readonly sourceFiles: {
1711
1723
  readonly type: "array";
@@ -1833,6 +1845,21 @@ export declare const OPERATION_CATALOG: readonly [{
1833
1845
  readonly enum: readonly ["create", "update"];
1834
1846
  readonly description: "Create a new requirement or update an existing one. Update auto-selection is allowed only with a high-confidence, well-separated candidate.";
1835
1847
  };
1848
+ readonly context: {
1849
+ readonly type: "string";
1850
+ readonly maxLength: 10000;
1851
+ readonly description: "Why the requirement exists, who asked and anything that does not fit its checked meaning. Required when mode is create (validation error naming this field otherwise); rendered as a '## Context' section of the requirement document, never as part of the checked meaning. Never invent a reason: write 'Reason not stated' when the requester gave none. An update keeps the existing document body unless context is supplied.";
1852
+ };
1853
+ readonly sourceExcerpt: {
1854
+ readonly type: "string";
1855
+ readonly maxLength: 10000;
1856
+ readonly description: "Optional verbatim text the intent came from (a ticket, a message, a document passage). Rendered as a blockquote in the requirement's '## Source' section; requires context.";
1857
+ };
1858
+ readonly sourceReference: {
1859
+ readonly type: "string";
1860
+ readonly maxLength: 2000;
1861
+ readonly description: "Optional locator of the source text (ticket id, URL, path). Rendered in the requirement's '## Source' section; requires context.";
1862
+ };
1836
1863
  readonly requirementId: {
1837
1864
  readonly type: "string";
1838
1865
  readonly description: "Optional exact requirement ID. Required for an update when automatic selection is below the confidence and margin gates.";
@@ -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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C,EAAE,OAAO,CAAC;IAC5C,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,sBAAsB,CAAC;AAClD,YAAY,EAAE,eAAe,EAAE,sBAAsB,EAAE,CAAC;AACxD,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,GAClB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,6CAA6C,CAAC,EAAE,OAAO,CAAC;CAClE,CAAC;AAqDF,wBAAsB,YAAY,CAChC,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,gBAAgB,EACzB,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CA2KxC"}
@@ -3,6 +3,7 @@ import { collectFullKbQualityDiagnostics } from "../impact-diagnostics.js";
3
3
  import { buildStructuredContent, buildSummary, } from "./check-format-shared.js";
4
4
  import { analyzeKbCheckImpact, collectQueryPlanSafetyViolations, getEffectiveRules, partitionCheckFindings, qualityDiagnosticsFromImpact, resolveCheckRules, stagedEntityIdStyleDiagnostics, } from "./check-helpers.js";
5
5
  import { executeStatus } from "./discovery-executors.js";
6
+ import { collectEntityContextViolations } from "./entity-context.js";
6
7
  import { buildActionsFromCheck, buildMigrationPlan, mergeMigrationPlans, } from "./migration-plan.js";
7
8
  import { collectOriginReviewViolations } from "./origin-review.js";
8
9
  import { collectPredicateSchemaConformanceViolations } from "./predicate-schema-conformance.js";
@@ -122,6 +123,7 @@ export async function executeCheck(args, context, options = {}) {
122
123
  ? collectSourcePathDanglingViolations(workspaceRoot)
123
124
  : [];
124
125
  const originReviewFindings = await collectOriginReviewViolations(prolog, rulesAllowlist, workspaceRoot);
126
+ const entityContextFindings = collectEntityContextViolations(rulesAllowlist, workspaceRoot);
125
127
  const partitioned = partitionCheckFindings([
126
128
  ...aggregatedFindings,
127
129
  ...queryPlanViolations,
@@ -129,6 +131,7 @@ export async function executeCheck(args, context, options = {}) {
129
131
  ...sourcePathFindings,
130
132
  ...predicateConformanceFindings,
131
133
  ...originReviewFindings,
134
+ ...entityContextFindings,
132
135
  ]);
133
136
  const violations = partitioned.violations;
134
137
  const diagnostics = violations.map((v) => ({
@@ -0,0 +1,51 @@
1
+ import type { Violation } from "../../utils/rule-registry.js";
2
+ /** A current entity must carry body context (blocking). */
3
+ export declare const ENTITY_CONTEXT_MISSING_RULE = "entity-context-missing";
4
+ /** How many legacy entities carry the review:context-missing tag (advisory). */
5
+ export declare const ENTITY_CONTEXT_ACKNOWLEDGED_RULE = "entity-context-acknowledged";
6
+ export declare const ENTITY_CONTEXT_RULES: readonly ["entity-context-missing", "entity-context-acknowledged"];
7
+ /** One authored entity document, front matter and body kept apart. */
8
+ export type AuthoredEntity = Readonly<{
9
+ id: string;
10
+ type: string;
11
+ path: string;
12
+ data: Readonly<Record<string, unknown>>;
13
+ body: string;
14
+ }>;
15
+ /**
16
+ * Split an authored Markdown document into its front matter record and its
17
+ * body. Returns null when the front matter is absent or does not parse.
18
+ */
19
+ export declare function readAuthoredEntity(content: string, relativePath: string): AuthoredEntity | null;
20
+ /**
21
+ * The checked meaning a requirement's context is compared against. A
22
+ * `semantic_text` that schema 8 pinned from the old derivation (statement plus
23
+ * context sections) is the body's derivation, not a statement of its own, so
24
+ * it is replaced by the statement-only derivation; an authored value stands.
25
+ */
26
+ export declare function contextStatementOf(entity: AuthoredEntity): string | undefined;
27
+ /** The entity fields the context rules read, with the derived meaning. */
28
+ export declare function contextEntityOf(entity: AuthoredEntity): {
29
+ title: unknown;
30
+ semantic_text: unknown;
31
+ fact_kind: unknown;
32
+ tags: unknown;
33
+ };
34
+ /** Whether an authored entity is current: not retired, not superseded. */
35
+ export declare function isCurrentAuthoredEntity(entity: AuthoredEntity, superseded: ReadonlySet<string>): boolean;
36
+ /** Every authored entity of a type the context rules apply to. */
37
+ export declare function listContextAuthoredEntities(workspaceRoot: string): AuthoredEntity[];
38
+ /**
39
+ * Ids some other entity supersedes, read from authored `links` and the
40
+ * relationship shards so the check and the migration agree before a sync.
41
+ */
42
+ export declare function authoredSupersededIds(workspaceRoot: string, entities: readonly AuthoredEntity[]): Set<string>;
43
+ /**
44
+ * Evaluate the context rules over authored entities. Entities tagged
45
+ * review:context-missing are acknowledged legacy: they never violate, and one
46
+ * advisory finding counts them.
47
+ */
48
+ export declare function evaluateEntityContext(entities: readonly AuthoredEntity[], superseded: ReadonlySet<string>, rules?: ReadonlySet<string>, acknowledgedIds?: ReadonlySet<string>): Violation[];
49
+ /** Read the authored entities once and evaluate the selected rules. */
50
+ export declare function collectEntityContextViolations(rules: ReadonlySet<string>, workspaceRoot: string): Violation[];
51
+ //# sourceMappingURL=entity-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-context.d.ts","sourceRoot":"","sources":["../../../src/public/operations/entity-context.ts"],"names":[],"mappings":"AAwCA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAE9D,2DAA2D;AAE3D,eAAO,MAAM,2BAA2B,2BAA2B,CAAC;AACpE,gFAAgF;AAEhF,eAAO,MAAM,gCAAgC,gCAAgC,CAAC;AAG9E,eAAO,MAAM,oBAAoB,oEAGvB,CAAC;AAUX,sEAAsE;AAEtE,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACxC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC,CAAC;AAEH;;;GAGG;AAEH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,GACnB,cAAc,GAAG,IAAI,CA6BvB;AAED;;;;;GAKG;AAEH,wBAAgB,kBAAkB,CAAC,MAAM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