kibi-cli 2.13.0 → 2.15.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 (114) hide show
  1. package/dist/engine.d.ts.map +1 -1
  2. package/dist/engine.js +5 -2
  3. package/dist/intent-search.d.ts.map +1 -1
  4. package/dist/intent-search.js +16 -4
  5. package/dist/operations/bootstrap/candidate-helpers.d.ts +5 -0
  6. package/dist/operations/bootstrap/candidate-helpers.d.ts.map +1 -1
  7. package/dist/operations/bootstrap/candidate-helpers.js +8 -0
  8. package/dist/operations/bootstrap/candidates.d.ts +12 -1
  9. package/dist/operations/bootstrap/candidates.d.ts.map +1 -1
  10. package/dist/operations/bootstrap/candidates.js +41 -7
  11. package/dist/operations/bootstrap/discovery-evidence.d.ts.map +1 -1
  12. package/dist/operations/bootstrap/discovery-evidence.js +8 -0
  13. package/dist/operations/bootstrap/discovery.d.ts.map +1 -1
  14. package/dist/operations/bootstrap/discovery.js +6 -1
  15. package/dist/operations/bootstrap/generate.d.ts.map +1 -1
  16. package/dist/operations/bootstrap/generate.js +18 -5
  17. package/dist/operations/bootstrap/guidance-actions.d.ts +2 -1
  18. package/dist/operations/bootstrap/guidance-actions.d.ts.map +1 -1
  19. package/dist/operations/bootstrap/guidance-actions.js +10 -1
  20. package/dist/operations/bootstrap/guidance.d.ts +2 -0
  21. package/dist/operations/bootstrap/guidance.d.ts.map +1 -1
  22. package/dist/operations/bootstrap/guidance.js +1 -1
  23. package/dist/operations/bootstrap/plugin-offers.d.ts +16 -0
  24. package/dist/operations/bootstrap/plugin-offers.d.ts.map +1 -0
  25. package/dist/operations/bootstrap/plugin-offers.js +66 -0
  26. package/dist/operations/bootstrap/presentation.d.ts +2 -0
  27. package/dist/operations/bootstrap/presentation.d.ts.map +1 -1
  28. package/dist/operations/bootstrap/presentation.js +19 -5
  29. package/dist/operations/bootstrap/types.d.ts +8 -0
  30. package/dist/operations/bootstrap/types.d.ts.map +1 -1
  31. package/dist/operations/modeling/predicate-applicability.d.ts.map +1 -1
  32. package/dist/operations/modeling/predicate-applicability.js +27 -1
  33. package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -1
  34. package/dist/operations/modeling/predicate-applyplan.js +9 -5
  35. package/dist/operations/modeling/predicate-binding-hints.d.ts +10 -0
  36. package/dist/operations/modeling/predicate-binding-hints.d.ts.map +1 -1
  37. package/dist/operations/modeling/predicate-binding-hints.js +112 -16
  38. package/dist/operations/modeling/predicate-bindings.d.ts +16 -0
  39. package/dist/operations/modeling/predicate-bindings.d.ts.map +1 -1
  40. package/dist/operations/modeling/predicate-bindings.js +40 -1
  41. package/dist/operations/modeling/predicate-catalog-5.d.ts +2 -2
  42. package/dist/operations/modeling/predicate-catalog-5.js +2 -2
  43. package/dist/operations/modeling/predicate-catalog-6.d.ts +9 -0
  44. package/dist/operations/modeling/predicate-catalog-6.d.ts.map +1 -0
  45. package/dist/operations/modeling/predicate-catalog-6.js +106 -0
  46. package/dist/operations/modeling/predicate-catalog.d.ts.map +1 -1
  47. package/dist/operations/modeling/predicate-catalog.js +2 -0
  48. package/dist/operations/modeling/predicate-usage-hints-4.d.ts.map +1 -1
  49. package/dist/operations/modeling/predicate-usage-hints-4.js +32 -0
  50. package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -1
  51. package/dist/operations/modeling/suggest-predicates.js +48 -17
  52. package/dist/operations/mutation/contradictions.d.ts +8 -0
  53. package/dist/operations/mutation/contradictions.d.ts.map +1 -1
  54. package/dist/operations/mutation/contradictions.js +13 -0
  55. package/dist/operations/mutation/source-authoring.d.ts +13 -0
  56. package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
  57. package/dist/operations/mutation/source-authoring.js +70 -2
  58. package/dist/operations/mutation/upsert.d.ts.map +1 -1
  59. package/dist/operations/mutation/upsert.js +9 -3
  60. package/dist/operations/mutation/validate-upsert.d.ts.map +1 -1
  61. package/dist/operations/mutation/validate-upsert.js +30 -4
  62. package/dist/operations/semantic-advisor/ingestion-boundary.d.ts.map +1 -1
  63. package/dist/operations/semantic-advisor/ingestion-boundary.js +20 -1
  64. package/dist/plugins/approved-source-analyzers.generated.d.ts +5 -5
  65. package/dist/plugins/approved-source-analyzers.generated.js +5 -5
  66. package/dist/plugins/check-policies.d.ts +24 -0
  67. package/dist/plugins/check-policies.d.ts.map +1 -0
  68. package/dist/plugins/check-policies.js +73 -0
  69. package/dist/plugins/registry.d.ts.map +1 -1
  70. package/dist/plugins/registry.js +10 -1
  71. package/dist/prolog.d.ts.map +1 -1
  72. package/dist/prolog.js +8 -1
  73. package/dist/provenance-stub.d.ts +15 -0
  74. package/dist/provenance-stub.d.ts.map +1 -0
  75. package/dist/provenance-stub.js +30 -0
  76. package/dist/public/operations/catalog.d.ts +1 -1
  77. package/dist/public/operations/check-executor.d.ts.map +1 -1
  78. package/dist/public/operations/check-executor.js +3 -0
  79. package/dist/public/operations/check-policy-rules.d.ts +49 -0
  80. package/dist/public/operations/check-policy-rules.d.ts.map +1 -0
  81. package/dist/public/operations/check-policy-rules.js +305 -0
  82. package/dist/public/operations/contracts.d.ts.map +1 -1
  83. package/dist/public/operations/contracts.js +5 -0
  84. package/dist/public/operations/source-relationship-parity.d.ts.map +1 -1
  85. package/dist/public/operations/source-relationship-parity.js +16 -1
  86. package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
  87. package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
  88. package/dist/public/operations/specs/check-rules.generated.js +3 -1
  89. package/dist/public/operations/specs/check.d.ts +1 -1
  90. package/dist/public/operations/specs/reporting.d.ts +9 -0
  91. package/dist/public/operations/specs/reporting.d.ts.map +1 -1
  92. package/dist/public/operations/specs/reporting.js +6 -2
  93. package/dist/public/skills/kibi-bootstrap/SKILL.md +3 -3
  94. package/dist/public/skills/kibi-usage/SKILL.md +81 -5
  95. package/dist/public/skills/kibi-usage/resources/ui-requirements.md +42 -3
  96. package/dist/report/html-report.d.ts.map +1 -1
  97. package/dist/report/html-report.js +13 -2
  98. package/dist/search-answer.d.ts.map +1 -1
  99. package/dist/search-answer.js +7 -0
  100. package/dist/search-ranking.d.ts.map +1 -1
  101. package/dist/search-ranking.js +9 -1
  102. package/dist/utils/rule-registry.generated.d.ts +10 -0
  103. package/dist/utils/rule-registry.generated.d.ts.map +1 -1
  104. package/dist/utils/rule-registry.generated.js +12 -0
  105. package/package.json +4 -4
  106. package/src/public/operations/check-executor.ts +7 -0
  107. package/src/public/operations/check-policy-rules.ts +462 -0
  108. package/src/public/operations/contracts.ts +6 -0
  109. package/src/public/operations/source-relationship-parity.ts +17 -2
  110. package/src/public/operations/specs/check-rules.generated.ts +3 -1
  111. package/src/public/operations/specs/reporting.ts +13 -2
  112. package/src/public/skills/kibi-bootstrap/SKILL.md +3 -3
  113. package/src/public/skills/kibi-usage/SKILL.md +81 -5
  114. package/src/public/skills/kibi-usage/resources/ui-requirements.md +42 -3
@@ -1,7 +1,10 @@
1
1
  # UI / Visual Requirement Modeling
2
2
 
3
3
  Optional, per-project lane for recording what the screen should look like so UI edits cannot
4
- silently drift from the spec. Non-UI projects skip it entirely; no check rule requires it.
4
+ silently drift from the spec. Non-UI projects skip it entirely. Without the experimental
5
+ `kibi-plugin-ui` no check rule requires it; with that plugin active, `kb_check` blocks
6
+ components that lack a design requirement (`policy-ownership`) and implementations that
7
+ lose their pattern markers (`policy-markers`).
5
8
 
6
9
  ## Three layers
7
10
 
@@ -13,12 +16,48 @@ silently drift from the spec. Non-UI projects skip it entirely; no check rule re
13
16
  from two current requirements are rejected on write unless `supersedes`.
14
17
  3. **Relational predicates** — ground `fact_kind: predicate` linked with `requires_predicate`.
15
18
  The built-in `visual_layout_rule(subject, relation, target)` covers "X must remain visually
16
- aligned with Y" (relation `aligned_with`). Other relational layout claims need a
17
- project-local `predicate_schema` when the task authorizes ontology extension.
19
+ aligned with Y" (relation `aligned_with`); `ui_pattern`, `same_pattern` and
20
+ `pattern_marker` cover patterns (below); `ui_container(subject, size, overflow)` covers
21
+ "a half-page panel that scrolls". Other relational layout claims need a project-local
22
+ `predicate_schema` when the task authorizes ontology extension.
18
23
 
19
24
  Kibi enforces stated facts and links, not pixels. Freeform spatial prose is stored and
20
25
  searchable but is not machine-checked.
21
26
 
27
+ ## Patterns and variants
28
+
29
+ Name the visual pattern a concept uses, and which variants must share it, so a rewrite to a
30
+ different pattern (a line-and-dots timeline redone as cards) is a visible contradiction
31
+ instead of a silent drift. All three predicates are built in:
32
+
33
+ - `ui_pattern(subject, pattern)`: `ui_pattern(activity_feed, line_dots_timeline)`.
34
+ - `same_pattern(subject, variant, other_variant)`: `same_pattern(activity_feed, editor_view, read_only_view)`.
35
+ - `pattern_marker(pattern, marker)`: `pattern_marker(line_dots_timeline, timeline_dot)`; the
36
+ marker is a literal class name or test id every implementation of the pattern contains.
37
+
38
+ Link the first two from the requirement with `requires_predicate`. Marker facts belong to
39
+ the pattern, not to one requirement, so link them from the requirement that introduced the
40
+ pattern or leave them standalone. With `kibi-plugin-ui` active, every component that
41
+ implements a requirement naming a `ui_pattern` must contain each marker of that pattern in
42
+ its source or its `.html` template. A component with no design constraint (a
43
+ layout-free wrapper) carries the tag `review:ui-unconstrained` instead of a requirement.
44
+
45
+ A requirement grounded only in `ui_pattern`, `same_pattern` and `pattern_marker` is proved
46
+ by component tests: a test with `verification_scope: unit` or `integration` and a fresh
47
+ passing receipt satisfies its scenarios. Write one component test per variant named in
48
+ `same_pattern`; that is what catches a divergent branch inside one template, which the
49
+ static marker check cannot see. Adding any other fact (`ui_container`, a property) brings
50
+ back the end-to-end requirement.
51
+
52
+ ### Capturing the inventory
53
+
54
+ When the plugin is first enabled on an existing UI, list the patterns the code already
55
+ uses per screen, ask the human which is intended wherever two variants of one concept
56
+ differ, and record each answer as a requirement. Record a divergence the human has not
57
+ decided as an `observation` fact tagged `review:ui-divergence`, citing both files, rather
58
+ than guessing which variant is right. Colours, spacing and component-library choices
59
+ (which scrollbar component to use) belong in a linter, not here.
60
+
22
61
  ## Button position
23
62
 
24
63
  ```yaml
@@ -1 +1 @@
1
- {"version":3,"file":"html-report.d.ts","sourceRoot":"","sources":["../../src/report/html-report.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,KAAK,gBAAgB,EAMtB,MAAM,iBAAiB,CAAC;AAGzB,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAuB9D,eAAO,MAAM,UAAU,6FACqE,CAAC;AAG7F,eAAO,MAAM,wBAAwB,gEAC0B,CAAC;AAEhE,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACxC,OAAO,EAAE,aAAa,CAAC;IACvB,IAAI,EAAE,SAAS,aAAa,EAAE,CAAC;IAC/B,IAAI,CAAC,EAAE,aAAa,CAAC;CACtB,CAAC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC;IACrC,YAAY,EAAE,kBAAkB,CAAC;IACjC,OAAO,EAAE,kBAAkB,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,IAAI,CAAC;IAClB,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B,CAAC,CAAC;AAsMH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,SAAS,YAAY,EAAE,EAC9B,MAAM,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,GACtC,YAAY,GAAG,QAAQ,CAKzB;AAID,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,aAAa,GAAG,YAAY,GAAG,QAAQ,CAM7E;AA8YD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAuM/D"}
1
+ {"version":3,"file":"html-report.d.ts","sourceRoot":"","sources":["../../src/report/html-report.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,KAAK,gBAAgB,EAMtB,MAAM,iBAAiB,CAAC;AAGzB,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAuB9D,eAAO,MAAM,UAAU,6FACqE,CAAC;AAG7F,eAAO,MAAM,wBAAwB,gEAC0B,CAAC;AAEhE,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACxC,OAAO,EAAE,aAAa,CAAC;IACvB,IAAI,EAAE,SAAS,aAAa,EAAE,CAAC;IAC/B,IAAI,CAAC,EAAE,aAAa,CAAC;CACtB,CAAC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC;IACrC,YAAY,EAAE,kBAAkB,CAAC;IACjC,OAAO,EAAE,kBAAkB,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,IAAI,CAAC;IAClB,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B,CAAC,CAAC;AAkNH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,SAAS,YAAY,EAAE,EAC9B,MAAM,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,GACtC,YAAY,GAAG,QAAQ,CAKzB;AAID,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,aAAa,GAAG,YAAY,GAAG,QAAQ,CAM7E;AA8YD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAuM/D"}
@@ -117,9 +117,20 @@ function combinedStageState(...statuses) {
117
117
  function stagePassed(stages, name) {
118
118
  return stageStatus(stages[name]) === "passed";
119
119
  }
120
+ /**
121
+ * A test whose scope its scenario accepts: end-to-end everywhere, plus unit and
122
+ * integration tests for component-scope UI pattern scenarios. Other tests carry
123
+ * the `not_end_to_end` state.
124
+ */
125
+ // implements REQ-ui-pattern-component-proof
126
+ function isProofScopeEvidence(item) {
127
+ return item.state !== undefined
128
+ ? item.state !== "not_end_to_end"
129
+ : item.scope === "end_to_end";
130
+ }
120
131
  function hasEndToEndTest(stages) {
121
132
  const evidence = records(record(stages.passingE2e).receiptEvidence);
122
- return evidence.some((item) => item.scope === "end_to_end");
133
+ return evidence.some(isProofScopeEvidence);
123
134
  }
124
135
  function implementationOwned(stages) {
125
136
  const productionSymbols = strings(record(stages.productionSymbols).symbols);
@@ -268,7 +279,7 @@ function requirementStages(row, repository) {
268
279
  const implementationSymbols = strings(productionSymbols.symbols);
269
280
  const missingCoordinates = strings(sourceCoordinatesStage.missingSymbols);
270
281
  const receiptEvidence = records(passingE2e.receiptEvidence);
271
- const hasE2e = receiptEvidence.some((item) => item.scope === "end_to_end");
282
+ const hasE2e = receiptEvidence.some(isProofScopeEvidence);
272
283
  const factSources = sourceCoordinates(record(stages.logicGrounding).sources);
273
284
  const scenarioSources = sourceCoordinates(record(stages.scenarios).sources);
274
285
  const testSources = sourceCoordinates(record(stages.scenarioTests).sources);
@@ -1 +1 @@
1
- {"version":3,"file":"search-answer.d.ts","sourceRoot":"","sources":["../src/search-answer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAU5D,OAAO,KAAK,EACV,UAAU,EAEX,MAAM,sCAAsC,CAAC;AAI9C;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC,CAAC;AAEH;;;GAGG;AAEH,MAAM,MAAM,gBAAgB,GAAG,kBAAkB,GAAG,QAAQ,CAAC;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE9E,sEAAsE;AAEtE,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,GACpD,QAAQ,CAAC;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;C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IAGjE,wEAAwE;;IAExE,yDAAyD;;IAEzD,sDAAsD;;CAE9C,CAAC;AAwKX;;;;GAIG;AAEH,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,QAAQ,GAAE,MAA0C,GACnD,MAAM,GAAG,SAAS,CAqDpB;AA0BD,KAAK,UAAU,GAAG,QAAQ,CAAC;IACzB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC,CAAC;AAkCH,4EAA4E;AAE5E,wBAAgB,cAAc,CAC5B,GAAG,EAAE,UAAU,GAAG,SAAS,EAC3B,cAAc,GAAE,MAA4C,GAC3D;IACD,OAAO,EAAE,mBAAmB,CAAC;IAC7B,QAAQ,EAAE,mBAAmB,EAAE,CAAC;IAChC,SAAS,EAAE,OAAO,CAAC;CACpB,CAyGA;AAkDD,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,EACjC,OAAO,EAAE,SAAS,iBAAiB,EAAE,EACrC,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,YAAY,CAAC,CAiSvB;AA2CD;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,YAAY,EACpB,QAAQ,GAAE,MAAsC,GAC/C,YAAY,CAkGd"}
@@ -1,4 +1,5 @@
1
1
  import { escapeAtom, normalizeEntityId, parseEntityFromList, parseListOfLists, parseTriples, } from "./prolog/codec.js";
2
+ import { isProvenanceStub } from "./provenance-stub.js";
2
3
  import { entityRowsGoal } from "./public/operations/discovery-entities.js";
3
4
  import { runOperationJsonQuery } from "./public/operations/prolog-json.js";
4
5
  import { loadMarkdownBody } from "./search-ranking.js";
@@ -440,6 +441,7 @@ async function fetchVerdicts(prolog, graph, rowIds, reqIds) {
440
441
  return undefined;
441
442
  }
442
443
  }
444
+ // implements REQ-bootstrap-provenance-stubs
443
445
  export async function buildSearchAnswer(prolog, matches, options = {}) {
444
446
  const limits = SEARCH_ANSWER_LIMITS;
445
447
  const graph = new AnswerGraph(prolog, limits.entityLoads);
@@ -483,6 +485,11 @@ export async function buildSearchAnswer(prolog, matches, options = {}) {
483
485
  continue;
484
486
  }
485
487
  if (type === "fact") {
488
+ // A bootstrap provenance stub records only where an entry came from;
489
+ // it is not a note about the topic. The tag sits on the search row
490
+ // (the projected row carries no tags).
491
+ if (isProvenanceStub(match.entity))
492
+ continue;
486
493
  const kind = text(entity.fact_kind);
487
494
  if (kind === "observation" || kind === "meta") {
488
495
  observations.push(brief(entity));
@@ -1 +1 @@
1
- {"version":3,"file":"search-ranking.d.ts","sourceRoot":"","sources":["../src/search-ranking.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAgDD,wBAAsB,YAAY,CAChC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EACnC,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,WAAW,EAAE,CAAC,CA8BxB;AAsGD,wBAAsB,gBAAgB,CAEpC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA6BxB;AA0JD,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,GAAG,SAAS,GAC9B,MAAM,GAAG,SAAS,CAQpB"}
1
+ {"version":3,"file":"search-ranking.d.ts","sourceRoot":"","sources":["../src/search-ranking.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAgDD,wBAAsB,YAAY,CAChC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EACnC,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,WAAW,EAAE,CAAC,CAqCxB;AAsGD,wBAAsB,gBAAgB,CAEpC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA6BxB;AA0JD,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,GAAG,SAAS,GAC9B,MAAM,GAAG,SAAS,CAQpB"}
@@ -1,6 +1,7 @@
1
1
  import fs from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { bodySnippetLine } from "./entity-body-context.js";
4
+ import { isProvenanceStub } from "./provenance-stub.js";
4
5
  const SEARCH_STOP_WORDS = new Set([
5
6
  "to",
6
7
  "in",
@@ -34,7 +35,7 @@ const SEARCH_STOP_WORDS = new Set([
34
35
  "can",
35
36
  "not",
36
37
  ]);
37
- // implements REQ-mcp-search-discovery, REQ-002, REQ-003
38
+ // implements REQ-mcp-search-discovery, REQ-002, REQ-003, REQ-bootstrap-provenance-stubs
38
39
  export async function rankEntities(entities, query, workspaceRoot) {
39
40
  const queryContext = buildSearchQueryContext(query);
40
41
  if (!queryContext.rawTrimmedQuery || queryContext.signalTokens.length === 0) {
@@ -44,10 +45,17 @@ export async function rankEntities(entities, query, workspaceRoot) {
44
45
  for (const entity of entities) {
45
46
  const match = await rankEntity(entity, queryContext, workspaceRoot);
46
47
  if (match) {
48
+ if (isProvenanceStub(entity))
49
+ match.reasons.push("demoted: provenance stub");
47
50
  matches.push(match);
48
51
  }
49
52
  }
50
53
  matches.sort((left, right) => {
54
+ // A provenance stub states no claim and sorts after every other match.
55
+ const stubOrder = Number(isProvenanceStub(left.entity)) -
56
+ Number(isProvenanceStub(right.entity));
57
+ if (stubOrder !== 0)
58
+ return stubOrder;
51
59
  if (right.score !== left.score) {
52
60
  return right.score - left.score;
53
61
  }
@@ -223,5 +223,15 @@ export declare const GENERATED_RULES: readonly [{
223
223
  readonly enforcementClass: "advisory";
224
224
  readonly category: "lifecycle";
225
225
  readonly diagnosticSeverity: "info";
226
+ }, {
227
+ readonly name: "policy-ownership";
228
+ readonly description: "When a plugin activated for kibi.check-policy.v1 declares ownership rules, every production symbol in a rule's file set must implement a current requirement grounded (requires_predicate) in one of the rule's predicates; projects without an activated check policy are unaffected";
229
+ readonly enforcementClass: "canonical";
230
+ readonly category: "traceability";
231
+ }, {
232
+ readonly name: "policy-markers";
233
+ readonly description: "When a plugin activated for kibi.check-policy.v1 declares marker rules, every file implementing a requirement grounded in the rule's pattern predicate (with its declared sibling files) must contain each marker the KB declares for that pattern";
234
+ readonly enforcementClass: "canonical";
235
+ readonly category: "traceability";
226
236
  }];
227
237
  //# sourceMappingURL=rule-registry.generated.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rule-registry.generated.d.ts","sourceRoot":"","sources":["../../src/utils/rule-registry.generated.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuTlB,CAAC"}
1
+ {"version":3,"file":"rule-registry.generated.d.ts","sourceRoot":"","sources":["../../src/utils/rule-registry.generated.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqUlB,CAAC"}
@@ -277,4 +277,16 @@ export const GENERATED_RULES = [
277
277
  category: "lifecycle",
278
278
  diagnosticSeverity: "info",
279
279
  },
280
+ {
281
+ name: "policy-ownership",
282
+ description: "When a plugin activated for kibi.check-policy.v1 declares ownership rules, every production symbol in a rule's file set must implement a current requirement grounded (requires_predicate) in one of the rule's predicates; projects without an activated check policy are unaffected",
283
+ enforcementClass: "canonical",
284
+ category: "traceability",
285
+ },
286
+ {
287
+ name: "policy-markers",
288
+ description: "When a plugin activated for kibi.check-policy.v1 declares marker rules, every file implementing a requirement grounded in the rule's pattern predicate (with its declared sibling files) must contain each marker the KB declares for that pattern",
289
+ enforcementClass: "canonical",
290
+ category: "traceability",
291
+ },
280
292
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kibi-cli",
3
- "version": "2.13.0",
3
+ "version": "2.15.0",
4
4
  "type": "module",
5
5
  "description": "Kibi CLI for knowledge base management",
6
6
  "engines": {
@@ -235,9 +235,9 @@
235
235
  "fast-glob": "^3.2.12",
236
236
  "gray-matter": "^4.0.3",
237
237
  "js-yaml": "^4.1.0",
238
- "kibi-core": "^0.17.2",
239
- "kibi-plugin-builtin": "^0.4.2",
240
- "kibi-plugin-sdk": "^0.4.1",
238
+ "kibi-core": "^0.18.0",
239
+ "kibi-plugin-builtin": "^0.5.0",
240
+ "kibi-plugin-sdk": "^0.5.0",
241
241
  "kibi-swipl": "^1.0.1",
242
242
  "saxes": "^6.0.0",
243
243
  "ignore": "^5.3.0",
@@ -33,6 +33,7 @@ import {
33
33
  resolveCheckRules,
34
34
  stagedEntityIdStyleDiagnostics,
35
35
  } from "./check-helpers.js";
36
+ import { collectCheckPolicyViolations } from "./check-policy-rules.js";
36
37
  import { executeStatus } from "./discovery-executors.js";
37
38
  import { collectEntityContextViolations } from "./entity-context.js";
38
39
  import {
@@ -229,6 +230,11 @@ export async function executeCheck(
229
230
  rulesAllowlist,
230
231
  workspaceRoot,
231
232
  );
233
+ const checkPolicyFindings = await collectCheckPolicyViolations(
234
+ prolog,
235
+ rulesAllowlist,
236
+ workspaceRoot,
237
+ );
232
238
  const partitioned = partitionCheckFindings([
233
239
  ...aggregatedFindings,
234
240
  ...queryPlanViolations,
@@ -237,6 +243,7 @@ export async function executeCheck(
237
243
  ...predicateConformanceFindings,
238
244
  ...originReviewFindings,
239
245
  ...entityContextFindings,
246
+ ...checkPolicyFindings,
240
247
  ]);
241
248
  const violations: Violation[] = partitioned.violations;
242
249