kibi-cli 2.1.0 → 2.2.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.
- package/dist/cli-protocol.d.ts.map +1 -1
- package/dist/cli-protocol.js +3 -2
- package/dist/commands/aggregated-checks.d.ts +7 -0
- package/dist/commands/aggregated-checks.d.ts.map +1 -1
- package/dist/commands/aggregated-checks.js +25 -1
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +21 -13
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +105 -24
- package/dist/commands/github-init.d.ts +1 -1
- package/dist/commands/github-init.d.ts.map +1 -1
- package/dist/commands/github-init.js +1 -1
- package/dist/commands/init-helpers.d.ts +17 -2
- package/dist/commands/init-helpers.d.ts.map +1 -1
- package/dist/commands/init-helpers.js +123 -23
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +110 -15
- package/dist/commands/prove.d.ts.map +1 -1
- package/dist/commands/prove.js +10 -18
- package/dist/commands/sync/cache.d.ts +20 -1
- package/dist/commands/sync/cache.d.ts.map +1 -1
- package/dist/commands/sync/cache.js +51 -2
- package/dist/commands/sync/discovery.d.ts.map +1 -1
- package/dist/commands/sync/discovery.js +1 -1
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +8 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +11 -3
- package/dist/engine.d.ts +26 -0
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +126 -29
- package/dist/extractors/manifest.d.ts.map +1 -1
- package/dist/extractors/manifest.js +66 -28
- package/dist/extractors/markdown.d.ts +2 -0
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +14 -3
- package/dist/extractors/relationships.d.ts.map +1 -1
- package/dist/extractors/relationships.js +1 -0
- package/dist/intent-search.d.ts.map +1 -1
- package/dist/intent-search.js +68 -29
- package/dist/operations/bootstrap/generate.d.ts.map +1 -1
- package/dist/operations/bootstrap/generate.js +4 -3
- package/dist/operations/modeling/model-requirement.d.ts +1 -1
- package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
- package/dist/operations/modeling/model-requirement.js +176 -10
- package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-applyplan.js +14 -2
- package/dist/operations/modeling/predicate-loader.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-loader.js +24 -0
- package/dist/operations/modeling/predicate-types.d.ts +4 -0
- package/dist/operations/modeling/predicate-types.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-vocabulary.d.ts +54 -0
- package/dist/operations/modeling/predicate-vocabulary.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-vocabulary.js +169 -0
- package/dist/operations/modeling/requirement-types.d.ts +5 -0
- package/dist/operations/modeling/requirement-types.d.ts.map +1 -1
- package/dist/operations/modeling/vocabulary-alignment.d.ts +60 -0
- package/dist/operations/modeling/vocabulary-alignment.d.ts.map +1 -0
- package/dist/operations/modeling/vocabulary-alignment.js +178 -0
- package/dist/operations/mutation/contradictions.d.ts +3 -0
- package/dist/operations/mutation/contradictions.d.ts.map +1 -1
- package/dist/operations/mutation/contradictions.js +29 -0
- package/dist/operations/mutation/delete.d.ts.map +1 -1
- package/dist/operations/mutation/delete.js +33 -1
- package/dist/operations/mutation/predicate-vocabulary-guard.d.ts +8 -0
- package/dist/operations/mutation/predicate-vocabulary-guard.d.ts.map +1 -0
- package/dist/operations/mutation/predicate-vocabulary-guard.js +64 -0
- package/dist/operations/mutation/relationships.d.ts +1 -1
- package/dist/operations/mutation/relationships.d.ts.map +1 -1
- package/dist/operations/mutation/relationships.js +1 -0
- package/dist/operations/mutation/saga.d.ts +5 -0
- package/dist/operations/mutation/saga.d.ts.map +1 -1
- package/dist/operations/mutation/saga.js +10 -0
- package/dist/operations/mutation/serialization.d.ts.map +1 -1
- package/dist/operations/mutation/serialization.js +2 -0
- package/dist/operations/mutation/source-authoring.d.ts +6 -0
- package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
- package/dist/operations/mutation/source-authoring.js +65 -26
- package/dist/operations/mutation/strict-fact.d.ts.map +1 -1
- package/dist/operations/mutation/strict-fact.js +5 -0
- package/dist/operations/mutation/types.d.ts +17 -0
- package/dist/operations/mutation/types.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.d.ts +6 -0
- package/dist/operations/mutation/upsert.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.js +72 -4
- package/dist/operations/mutation/validate-upsert.d.ts.map +1 -1
- package/dist/operations/mutation/validate-upsert.js +24 -1
- package/dist/operations/mutation/validation.d.ts.map +1 -1
- package/dist/operations/mutation/validation.js +16 -3
- package/dist/operations/planning/apply-plan.d.ts.map +1 -1
- package/dist/operations/planning/apply-plan.js +61 -17
- package/dist/operations/planning/compile-intent.d.ts.map +1 -1
- package/dist/operations/planning/compile-intent.js +3 -1
- package/dist/operations/proof/code-scope.d.ts +17 -0
- package/dist/operations/proof/code-scope.d.ts.map +1 -0
- package/dist/operations/proof/code-scope.js +60 -0
- package/dist/operations/proof/ingest-proof.d.ts +4 -2
- package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
- package/dist/operations/proof/ingest-proof.js +207 -74
- package/dist/operations/proof/migrate-legacy-receipts.d.ts.map +1 -1
- package/dist/operations/proof/migrate-legacy-receipts.js +7 -5
- package/dist/operations/proof/prune-receipts.d.ts.map +1 -1
- package/dist/operations/proof/prune-receipts.js +7 -5
- package/dist/plugins/compose-semantic-classifier.d.ts +6 -1
- package/dist/plugins/compose-semantic-classifier.d.ts.map +1 -1
- package/dist/plugins/compose-semantic-classifier.js +8 -3
- package/dist/plugins/compose-vocabulary-alignment.d.ts +23 -0
- package/dist/plugins/compose-vocabulary-alignment.d.ts.map +1 -0
- package/dist/plugins/compose-vocabulary-alignment.js +141 -0
- package/dist/plugins/external-allowlist.d.ts +7 -0
- package/dist/plugins/external-allowlist.d.ts.map +1 -1
- package/dist/plugins/external-allowlist.js +13 -0
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +4 -0
- package/dist/plugins/registry.d.ts +2 -1
- package/dist/plugins/registry.d.ts.map +1 -1
- package/dist/plugins/registry.js +22 -1
- package/dist/prolog/codec.d.ts.map +1 -1
- package/dist/prolog/codec.js +2 -0
- package/dist/prolog.d.ts +36 -0
- package/dist/prolog.d.ts.map +1 -1
- package/dist/prolog.js +78 -9
- package/dist/public/diagnostic-usage.d.ts.map +1 -1
- package/dist/public/diagnostic-usage.js +7 -25
- package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
- package/dist/public/impact/full-kb-quality.js +4 -12
- package/dist/public/operations/catalog.d.ts +36 -7
- package/dist/public/operations/catalog.d.ts.map +1 -1
- package/dist/public/operations/check-executor.d.ts.map +1 -1
- package/dist/public/operations/check-executor.js +10 -2
- package/dist/public/operations/check-helpers.d.ts +6 -0
- package/dist/public/operations/check-helpers.d.ts.map +1 -1
- package/dist/public/operations/check-helpers.js +21 -1
- package/dist/public/operations/contracts.d.ts.map +1 -1
- package/dist/public/operations/contracts.js +16 -0
- package/dist/public/operations/discovery-entities.d.ts +42 -2
- package/dist/public/operations/discovery-entities.d.ts.map +1 -1
- package/dist/public/operations/discovery-entities.js +195 -22
- package/dist/public/operations/discovery-executors.d.ts +1 -0
- package/dist/public/operations/discovery-executors.d.ts.map +1 -1
- package/dist/public/operations/discovery-executors.js +75 -46
- package/dist/public/operations/migration-plan.d.ts +2 -0
- package/dist/public/operations/migration-plan.d.ts.map +1 -1
- package/dist/public/operations/migration-plan.js +50 -0
- package/dist/public/operations/predicate-schema-conformance.d.ts +41 -0
- package/dist/public/operations/predicate-schema-conformance.d.ts.map +1 -0
- package/dist/public/operations/predicate-schema-conformance.js +242 -0
- package/dist/public/operations/prolog-json.d.ts.map +1 -1
- package/dist/public/operations/prolog-json.js +9 -3
- package/dist/public/operations/result-envelope.d.ts +34 -1
- package/dist/public/operations/result-envelope.d.ts.map +1 -1
- package/dist/public/operations/result-envelope.js +78 -2
- package/dist/public/operations/runtime-types.d.ts +1 -1
- package/dist/public/operations/runtime-types.d.ts.map +1 -1
- package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
- package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
- package/dist/public/operations/specs/check-rules.generated.js +8 -1
- package/dist/public/operations/specs/check.d.ts +1 -1
- package/dist/public/operations/specs/discovery.d.ts +7 -1
- package/dist/public/operations/specs/discovery.d.ts.map +1 -1
- package/dist/public/operations/specs/discovery.js +7 -1
- package/dist/public/operations/specs/mutation-schemas.d.ts +27 -4
- package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
- package/dist/public/operations/specs/mutation-schemas.js +21 -3
- package/dist/public/operations/specs/reporting.d.ts +8 -0
- package/dist/public/operations/specs/reporting.d.ts.map +1 -1
- package/dist/public/operations/specs/reporting.js +46 -15
- package/dist/public/operations/specs/upsert.d.ts +28 -5
- package/dist/public/operations/specs/upsert.d.ts.map +1 -1
- package/dist/public/operations/specs/upsert.js +1 -1
- package/dist/public/operations/symbol-repair-plan.d.ts.map +1 -1
- package/dist/public/operations/symbol-repair-plan.js +8 -3
- package/dist/public/schemas/entity.d.ts.map +1 -1
- package/dist/public/schemas/entity.js +22 -0
- package/dist/public/schemas/relationship.d.ts.map +1 -1
- package/dist/public/schemas/relationship.js +1 -0
- package/dist/public/skills/kibi-usage/SKILL.md +7 -3
- package/dist/public/skills/kibi-usage/resources/fact-lanes.md +4 -0
- package/dist/public/skills/kibi-usage/resources/relationship-directions.md +35 -17
- package/dist/public/skills/kibi-usage/resources/source-authoring.md +36 -0
- package/dist/public/skills/kibi-usage/resources/workflows.md +52 -1
- package/dist/public/telemetry-acceptance.d.ts.map +1 -1
- package/dist/public/telemetry-acceptance.js +21 -5
- package/dist/relationships/shards.d.ts +6 -0
- package/dist/relationships/shards.d.ts.map +1 -1
- package/dist/relationships/shards.js +26 -19
- package/dist/schemas/entity.schema.json +32 -0
- package/dist/traceability/staged-diagnostics.d.ts +1 -1
- package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
- package/dist/traceability/staged-entity-id-style.d.ts +12 -0
- package/dist/traceability/staged-entity-id-style.d.ts.map +1 -0
- package/dist/traceability/staged-entity-id-style.js +68 -0
- package/dist/traceability/temp-kb.d.ts.map +1 -1
- package/dist/traceability/temp-kb.js +8 -0
- package/dist/traceability/validate.js +1 -1
- package/dist/types/entities.d.ts +2 -0
- package/dist/types/entities.d.ts.map +1 -1
- package/dist/types/relationships.d.ts +1 -1
- package/dist/types/relationships.d.ts.map +1 -1
- package/dist/utils/entity-id-style.d.ts +27 -0
- package/dist/utils/entity-id-style.d.ts.map +1 -0
- package/dist/utils/entity-id-style.js +81 -0
- package/dist/utils/git-repository-context.d.ts +50 -0
- package/dist/utils/git-repository-context.d.ts.map +1 -0
- package/dist/utils/git-repository-context.js +259 -0
- package/dist/utils/rule-registry.d.ts +5 -0
- package/dist/utils/rule-registry.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.d.ts +37 -0
- package/dist/utils/rule-registry.generated.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.js +44 -0
- package/dist/utils/strict-modeling.d.ts +7 -0
- package/dist/utils/strict-modeling.d.ts.map +1 -1
- package/dist/utils/strict-modeling.js +11 -0
- package/package.json +4 -4
- package/schema/entities.pl +60 -1
- package/schema/relationships.pl +17 -4
- package/schema/validation.pl +118 -20
- package/src/public/diagnostic-usage.ts +16 -24
- package/src/public/impact/full-kb-quality.ts +4 -16
- package/src/public/operations/check-executor.ts +12 -1
- package/src/public/operations/check-helpers.ts +27 -1
- package/src/public/operations/contracts.ts +19 -0
- package/src/public/operations/discovery-entities.ts +292 -23
- package/src/public/operations/discovery-executors.ts +91 -55
- package/src/public/operations/migration-plan.ts +57 -0
- package/src/public/operations/predicate-schema-conformance.ts +362 -0
- package/src/public/operations/prolog-json.ts +9 -3
- package/src/public/operations/result-envelope.ts +114 -2
- package/src/public/operations/runtime-types.ts +1 -1
- package/src/public/operations/specs/check-rules.generated.ts +8 -1
- package/src/public/operations/specs/discovery.ts +8 -1
- package/src/public/operations/specs/mutation-schemas.ts +23 -3
- package/src/public/operations/specs/reporting.ts +69 -22
- package/src/public/operations/specs/upsert.ts +1 -1
- package/src/public/operations/symbol-repair-plan.ts +13 -3
- package/src/public/schemas/entity.ts +22 -0
- package/src/public/schemas/relationship.ts +1 -0
- package/src/public/skills/kibi-usage/SKILL.md +7 -3
- package/src/public/skills/kibi-usage/resources/fact-lanes.md +4 -0
- package/src/public/skills/kibi-usage/resources/relationship-directions.md +35 -17
- package/src/public/skills/kibi-usage/resources/source-authoring.md +36 -0
- package/src/public/skills/kibi-usage/resources/workflows.md +52 -1
- package/src/public/telemetry-acceptance.ts +37 -6
- package/src/schemas/entity.schema.json +32 -0
- package/src/schemas/relationship.schema.json +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutation-schemas.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/mutation-schemas.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,YAAY,gFASf,CAAC;AAYX,eAAO,MAAM,wBAAwB
|
|
1
|
+
{"version":3,"file":"mutation-schemas.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/mutation-schemas.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,YAAY,gFASf,CAAC;AAYX,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6U3B,CAAC;AAEX,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;CA4CvB,CAAC"}
|
|
@@ -33,7 +33,7 @@ export const ENTITY_PROPERTIES_SCHEMA = {
|
|
|
33
33
|
},
|
|
34
34
|
source: {
|
|
35
35
|
type: "string",
|
|
36
|
-
description: "Optional provenance string. Example: '
|
|
36
|
+
description: "Optional provenance string. Example: '.kb/requirements/REQ-cli-gc.md'. Defaults to 'mcp://kibi/upsert'.",
|
|
37
37
|
},
|
|
38
38
|
tags: {
|
|
39
39
|
type: "array",
|
|
@@ -55,7 +55,7 @@ export const ENTITY_PROPERTIES_SCHEMA = {
|
|
|
55
55
|
links: {
|
|
56
56
|
type: "array",
|
|
57
57
|
items: { type: "string" },
|
|
58
|
-
description: "Optional references. Example: ['REQ-
|
|
58
|
+
description: "Optional references. Example: ['REQ-cli-gc','https://example.com/spec'].",
|
|
59
59
|
},
|
|
60
60
|
text_ref: {
|
|
61
61
|
type: "string",
|
|
@@ -255,6 +255,23 @@ export const ENTITY_PROPERTIES_SCHEMA = {
|
|
|
255
255
|
items: { type: "string" },
|
|
256
256
|
description: "Optional ordered argument explanations.",
|
|
257
257
|
},
|
|
258
|
+
argument_constants: {
|
|
259
|
+
type: "object",
|
|
260
|
+
additionalProperties: {
|
|
261
|
+
type: "array",
|
|
262
|
+
items: { type: "string", minLength: 1 },
|
|
263
|
+
minItems: 1,
|
|
264
|
+
},
|
|
265
|
+
description: 'predicate_schema only: allowed constants keyed by argument name, e.g. {"severity": ["warning", "info"]}. Predicate facts must use a listed constant for those arguments; unlisted arguments stay open.',
|
|
266
|
+
},
|
|
267
|
+
argument_aliases: {
|
|
268
|
+
type: "object",
|
|
269
|
+
additionalProperties: {
|
|
270
|
+
type: "object",
|
|
271
|
+
additionalProperties: { type: "string", minLength: 1 },
|
|
272
|
+
},
|
|
273
|
+
description: 'predicate_schema only: legacy spellings keyed by argument name, each mapped to a declared constant, e.g. {"severity": {"warn": "warning"}}. kibi migrate rewrites facts that still use an alias.',
|
|
274
|
+
},
|
|
258
275
|
aliases: {
|
|
259
276
|
type: "array",
|
|
260
277
|
items: { type: "string" },
|
|
@@ -326,6 +343,7 @@ export const RELATIONSHIPS_SCHEMA = {
|
|
|
326
343
|
"publishes",
|
|
327
344
|
"consumes",
|
|
328
345
|
"supersedes",
|
|
346
|
+
"restates",
|
|
329
347
|
"relates_to",
|
|
330
348
|
],
|
|
331
349
|
description: "Relationship type enum. Use only supported values. Direction semantics follow KB model (e.g., implements symbol->req, verified_by req/scenario->test, executable_for symbol->test).",
|
|
@@ -336,7 +354,7 @@ export const RELATIONSHIPS_SCHEMA = {
|
|
|
336
354
|
},
|
|
337
355
|
to: {
|
|
338
356
|
type: "string",
|
|
339
|
-
description: "Target entity ID (must exist). Example: 'REQ-
|
|
357
|
+
description: "Target entity ID (must exist). Example: 'REQ-cli-gc'.",
|
|
340
358
|
},
|
|
341
359
|
},
|
|
342
360
|
},
|
|
@@ -113,6 +113,14 @@ export declare const findGapsSpec: {
|
|
|
113
113
|
*/
|
|
114
114
|
export declare function currentProofBindingMode(): "per_contract" | "strict_snapshot";
|
|
115
115
|
export declare function perContractTestBindings(context: OperationContext): Promise<string | null>;
|
|
116
|
+
/**
|
|
117
|
+
* Coverage rows can be large (full proof stages per requirement), so a
|
|
118
|
+
* whole-KB report in one answer approaches the engine's bounded output cap.
|
|
119
|
+
* Fetch it in small row pages instead; the engine memoizes the computed
|
|
120
|
+
* report per store generation, so later pages only paginate and encode.
|
|
121
|
+
*/
|
|
122
|
+
export declare const COVERAGE_ROW_PAGE_SIZE = 10;
|
|
123
|
+
export declare function readCoveragePages(prolog: NonNullable<OperationContext["prolog"]>, goalFor: (limit: number, offset: number) => string, limit: number, offset: number): Promise<CoveragePayload>;
|
|
116
124
|
export declare function executeCoverage(input: CoverageInput, context: OperationContext): Promise<OperationResult<CoveragePayload>>;
|
|
117
125
|
export declare const coverageSpec: {
|
|
118
126
|
readonly name: "kb_coverage";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reporting.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/reporting.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,KAAK,aAAa,EAInB,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EAAE,KAAK,UAAU,EAAmB,MAAM,mBAAmB,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAK5D,OAAO,KAAK,EAAE,eAAe,EAAiB,MAAM,aAAa,CAAC;AAelE,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,oBAAoB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClD,QAAQ,CAAC,oBAAoB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClD,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MA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CAAC,eAAe,CAAC,eAAe,CAAC,CAAC,CA0B3C;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuByC,CAAC;AAEnE;;;;;;;GAOG;AAEH,wBAAgB,uBAAuB,IAAI,cAAc,GAAG,iBAAiB,CAI5E;AAED,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAiExB;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAGzC,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,WAAW,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,EAC/C,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,EAClD,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,eAAe,CAAC,CAoB1B;AAED,wBAAsB,eAAe,CACnC,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC,CA2H3C;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgEyC,CAAC;AAEnE,wBAAsB,YAAY,CAChC,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CA8BxC;AAED,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyBsC,CAAC"}
|
|
@@ -107,13 +107,26 @@ export async function perContractTestBindings(context) {
|
|
|
107
107
|
const { loadEntities } = await import("../discovery-entities.js");
|
|
108
108
|
const { receiptBindingHash } = await import("../../proof-fingerprint.js");
|
|
109
109
|
const { removeFrontmatterBlock } = await import("../../../operations/proof/receipt-document.js");
|
|
110
|
+
const { loadCoveredBySymbolsByTest, receiptCodeScopeSymbolIds } = await import("../../../operations/proof/code-scope.js");
|
|
111
|
+
// Only the contract, scoped code, and authored source feed the binding
|
|
112
|
+
// hash. The paged projection never materializes receipt histories, which
|
|
113
|
+
// grow without bound and previously overflowed the bounded Prolog output
|
|
114
|
+
// on real stores. Engine failures must surface: silently dropping to strict
|
|
115
|
+
// snapshot semantics would hide an unhealthy engine behind stale receipts.
|
|
110
116
|
let tests;
|
|
111
117
|
try {
|
|
112
|
-
tests = await loadEntities(context
|
|
118
|
+
tests = await loadEntities(requireProlog(context), {
|
|
119
|
+
type: "test",
|
|
120
|
+
projection: "proof_contract",
|
|
121
|
+
});
|
|
113
122
|
}
|
|
114
|
-
catch {
|
|
115
|
-
|
|
123
|
+
catch (error) {
|
|
124
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
125
|
+
throw new Error(`Per-contract receipt binding query failed: ${message}`);
|
|
116
126
|
}
|
|
127
|
+
const coveredBy = tests.length
|
|
128
|
+
? await loadCoveredBySymbolsByTest(requireProlog(context))
|
|
129
|
+
: new Map();
|
|
117
130
|
const entries = [];
|
|
118
131
|
const manifestPath = join(context.workspaceRoot, ".kb", "symbols.yaml");
|
|
119
132
|
for (const test of tests) {
|
|
@@ -134,13 +147,7 @@ export async function perContractTestBindings(context) {
|
|
|
134
147
|
const absolute = join(context.workspaceRoot, source);
|
|
135
148
|
const authored = await context.fs.readFile(absolute);
|
|
136
149
|
const stripped = removeFrontmatterBlock(authored, "proof_receipts");
|
|
137
|
-
const
|
|
138
|
-
? test.proof_bindings
|
|
139
|
-
: [];
|
|
140
|
-
const boundIds = rawBindings
|
|
141
|
-
.map((binding) => typeof binding.symbol_id === "string" ? binding.symbol_id : "")
|
|
142
|
-
.filter((id) => id !== "");
|
|
143
|
-
const codeScope = resolveBoundSymbolScope(manifestPath, boundIds);
|
|
150
|
+
const codeScope = resolveBoundSymbolScope(manifestPath, receiptCodeScopeSymbolIds(contract, test.proof_bindings, coveredBy.get(testId) ?? []));
|
|
144
151
|
const binding = receiptBindingHash(contract, stripped ?? authored, codeScope);
|
|
145
152
|
entries.push(`${toPrologAtom(testId)}: ${toPrologAtom(binding)}`);
|
|
146
153
|
}
|
|
@@ -152,6 +159,30 @@ export async function perContractTestBindings(context) {
|
|
|
152
159
|
return null;
|
|
153
160
|
return `_{${entries.join(", ")}}`;
|
|
154
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* Coverage rows can be large (full proof stages per requirement), so a
|
|
164
|
+
* whole-KB report in one answer approaches the engine's bounded output cap.
|
|
165
|
+
* Fetch it in small row pages instead; the engine memoizes the computed
|
|
166
|
+
* report per store generation, so later pages only paginate and encode.
|
|
167
|
+
*/
|
|
168
|
+
export const COVERAGE_ROW_PAGE_SIZE = 10;
|
|
169
|
+
// implements REQ-kibi-verification-evidence-contract
|
|
170
|
+
export async function readCoveragePages(prolog, goalFor, limit, offset) {
|
|
171
|
+
const read = (pageLimit, pageOffset) => runOperationJsonQuery(prolog, "discovery.pl", goalFor(pageLimit, pageOffset), "Coverage execution");
|
|
172
|
+
if (limit <= COVERAGE_ROW_PAGE_SIZE)
|
|
173
|
+
return read(limit, offset);
|
|
174
|
+
const first = await read(COVERAGE_ROW_PAGE_SIZE, offset);
|
|
175
|
+
const rows = [...first.rows];
|
|
176
|
+
let lastPageSize = first.rows.length;
|
|
177
|
+
let lastPageLimit = COVERAGE_ROW_PAGE_SIZE;
|
|
178
|
+
while (lastPageSize === lastPageLimit && rows.length < limit) {
|
|
179
|
+
lastPageLimit = Math.min(COVERAGE_ROW_PAGE_SIZE, limit - rows.length);
|
|
180
|
+
const page = await read(lastPageLimit, offset + rows.length);
|
|
181
|
+
rows.push(...page.rows);
|
|
182
|
+
lastPageSize = page.rows.length;
|
|
183
|
+
}
|
|
184
|
+
return { ...first, rows };
|
|
185
|
+
}
|
|
155
186
|
export async function executeCoverage(input, context) {
|
|
156
187
|
try {
|
|
157
188
|
const snapshotEvidence = await readWorkspaceSnapshot(context);
|
|
@@ -163,12 +194,12 @@ export async function executeCoverage(input, context) {
|
|
|
163
194
|
const bindingsDict = statuses.length === 0 && (input.by ?? "req") === "req"
|
|
164
195
|
? await perContractTestBindings(context)
|
|
165
196
|
: null;
|
|
166
|
-
const
|
|
167
|
-
? `discovery:coverage_report_json('${input.by ?? "req"}', ${toPrologList(input.tags)}, ${input.includePassing ?? false}, per_contract, ${bindingsDict}, ${input.includeTransitive ?? true}, ${
|
|
197
|
+
const goalFor = (limit, offset) => bindingsDict !== null
|
|
198
|
+
? `discovery:coverage_report_json('${input.by ?? "req"}', ${toPrologList(input.tags)}, ${input.includePassing ?? false}, per_contract, ${bindingsDict}, ${input.includeTransitive ?? true}, ${limit}, ${offset}, ${toPrologAtom(codeSnapshot)}, ${toPrologAtom(checkedAt)}, ${PROOF_RECEIPT_MAX_AGE_SECONDS}, JsonString)`
|
|
168
199
|
: statuses.length > 0
|
|
169
|
-
? `discovery:coverage_report_json('${input.by ?? "req"}', ${toPrologList(input.tags)}, ${input.includePassing ?? false}, ${toPrologList(statuses)}, ${input.includeTransitive ?? true}, ${
|
|
170
|
-
: `discovery:coverage_report_json('${input.by ?? "req"}', ${toPrologList(input.tags)}, ${input.includePassing ?? false}, ${input.includeTransitive ?? true}, ${
|
|
171
|
-
const payload = await
|
|
200
|
+
? `discovery:coverage_report_json('${input.by ?? "req"}', ${toPrologList(input.tags)}, ${input.includePassing ?? false}, ${toPrologList(statuses)}, ${input.includeTransitive ?? true}, ${limit}, ${offset}, ${toPrologAtom(codeSnapshot)}, ${toPrologAtom(checkedAt)}, ${PROOF_RECEIPT_MAX_AGE_SECONDS}, JsonString)`
|
|
201
|
+
: `discovery:coverage_report_json('${input.by ?? "req"}', ${toPrologList(input.tags)}, ${input.includePassing ?? false}, ${input.includeTransitive ?? true}, ${limit}, ${offset}, ${toPrologAtom(codeSnapshot)}, ${toPrologAtom(checkedAt)}, ${PROOF_RECEIPT_MAX_AGE_SECONDS}, JsonString)`;
|
|
202
|
+
const payload = await readCoveragePages(requireProlog(context), goalFor, input.limit ?? 100, input.offset ?? 0);
|
|
172
203
|
const rows = (input.by ?? "req") === "req"
|
|
173
204
|
? await addCoordinateRepairEvidence(payload.rows, context)
|
|
174
205
|
: payload.rows;
|
|
@@ -14,7 +14,7 @@ export declare const upsertSpec: {
|
|
|
14
14
|
};
|
|
15
15
|
readonly id: {
|
|
16
16
|
readonly type: "string";
|
|
17
|
-
readonly description: "Unique entity ID (string). Example: 'REQ-
|
|
17
|
+
readonly description: "Unique entity ID (string). Example: 'REQ-cli-gc'. Name entities by the behavior they govern (<TYPE>-<area>-<behavior>), never by the next free number. Existing ID updates the entity; new ID creates it.";
|
|
18
18
|
};
|
|
19
19
|
readonly properties: {
|
|
20
20
|
readonly type: "object";
|
|
@@ -30,7 +30,7 @@ export declare const upsertSpec: {
|
|
|
30
30
|
};
|
|
31
31
|
readonly source: {
|
|
32
32
|
readonly type: "string";
|
|
33
|
-
readonly description: "Optional provenance string. Example: '
|
|
33
|
+
readonly description: "Optional provenance string. Example: '.kb/requirements/REQ-cli-gc.md'. Defaults to 'mcp://kibi/upsert'.";
|
|
34
34
|
};
|
|
35
35
|
readonly tags: {
|
|
36
36
|
readonly type: "array";
|
|
@@ -56,7 +56,7 @@ export declare const upsertSpec: {
|
|
|
56
56
|
readonly items: {
|
|
57
57
|
readonly type: "string";
|
|
58
58
|
};
|
|
59
|
-
readonly description: "Optional references. Example: ['REQ-
|
|
59
|
+
readonly description: "Optional references. Example: ['REQ-cli-gc','https://example.com/spec'].";
|
|
60
60
|
};
|
|
61
61
|
readonly text_ref: {
|
|
62
62
|
readonly type: "string";
|
|
@@ -531,6 +531,29 @@ export declare const upsertSpec: {
|
|
|
531
531
|
};
|
|
532
532
|
readonly description: "Optional ordered argument explanations.";
|
|
533
533
|
};
|
|
534
|
+
readonly argument_constants: {
|
|
535
|
+
readonly type: "object";
|
|
536
|
+
readonly additionalProperties: {
|
|
537
|
+
readonly type: "array";
|
|
538
|
+
readonly items: {
|
|
539
|
+
readonly type: "string";
|
|
540
|
+
readonly minLength: 1;
|
|
541
|
+
};
|
|
542
|
+
readonly minItems: 1;
|
|
543
|
+
};
|
|
544
|
+
readonly description: "predicate_schema only: allowed constants keyed by argument name, e.g. {\"severity\": [\"warning\", \"info\"]}. Predicate facts must use a listed constant for those arguments; unlisted arguments stay open.";
|
|
545
|
+
};
|
|
546
|
+
readonly argument_aliases: {
|
|
547
|
+
readonly type: "object";
|
|
548
|
+
readonly additionalProperties: {
|
|
549
|
+
readonly type: "object";
|
|
550
|
+
readonly additionalProperties: {
|
|
551
|
+
readonly type: "string";
|
|
552
|
+
readonly minLength: 1;
|
|
553
|
+
};
|
|
554
|
+
};
|
|
555
|
+
readonly description: "predicate_schema only: legacy spellings keyed by argument name, each mapped to a declared constant, e.g. {\"severity\": {\"warn\": \"warning\"}}. kibi migrate rewrites facts that still use an alias.";
|
|
556
|
+
};
|
|
534
557
|
readonly aliases: {
|
|
535
558
|
readonly type: "array";
|
|
536
559
|
readonly items: {
|
|
@@ -600,7 +623,7 @@ export declare const upsertSpec: {
|
|
|
600
623
|
readonly properties: {
|
|
601
624
|
readonly type: {
|
|
602
625
|
readonly type: "string";
|
|
603
|
-
readonly enum: readonly ["depends_on", "specified_by", "verified_by", "validates", "implements", "covered_by", "executable_for", "constrained_by", "constrains", "requires_property", "requires_predicate", "requires_rule", "guards", "publishes", "consumes", "supersedes", "relates_to"];
|
|
626
|
+
readonly enum: readonly ["depends_on", "specified_by", "verified_by", "validates", "implements", "covered_by", "executable_for", "constrained_by", "constrains", "requires_property", "requires_predicate", "requires_rule", "guards", "publishes", "consumes", "supersedes", "restates", "relates_to"];
|
|
604
627
|
readonly description: "Relationship type enum. Use only supported values. Direction semantics follow KB model (e.g., implements symbol->req, verified_by req/scenario->test, executable_for symbol->test).";
|
|
605
628
|
};
|
|
606
629
|
readonly from: {
|
|
@@ -609,7 +632,7 @@ export declare const upsertSpec: {
|
|
|
609
632
|
};
|
|
610
633
|
readonly to: {
|
|
611
634
|
readonly type: "string";
|
|
612
|
-
readonly description: "Target entity ID (must exist). Example: 'REQ-
|
|
635
|
+
readonly description: "Target entity ID (must exist). Example: 'REQ-cli-gc'.";
|
|
613
636
|
};
|
|
614
637
|
};
|
|
615
638
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upsert.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/upsert.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAQvE,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"upsert.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/upsert.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAQvE,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCuC,CAAC"}
|
|
@@ -15,7 +15,7 @@ export const upsertSpec = {
|
|
|
15
15
|
},
|
|
16
16
|
id: {
|
|
17
17
|
type: "string",
|
|
18
|
-
description: "Unique entity ID (string). Example: 'REQ-
|
|
18
|
+
description: "Unique entity ID (string). Example: 'REQ-cli-gc'. Name entities by the behavior they govern (<TYPE>-<area>-<behavior>), never by the next free number. Existing ID updates the entity; new ID creates it.",
|
|
19
19
|
},
|
|
20
20
|
properties: ENTITY_PROPERTIES_SCHEMA,
|
|
21
21
|
relationships: RELATIONSHIPS_SCHEMA,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symbol-repair-plan.d.ts","sourceRoot":"","sources":["../../../src/public/operations/symbol-repair-plan.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"symbol-repair-plan.d.ts","sourceRoot":"","sources":["../../../src/public/operations/symbol-repair-plan.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,eAAO,MAAM,0BAA0B,EAAG,4BAAqC,CAAC;AAEhF,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACtC,OAAO,EAAE,OAAO,0BAA0B,CAAC;IAC3C,QAAQ,EAAE,IAAI,CAAC;IACf,cAAc,EAAE,KAAK,CAAC;IACtB,OAAO,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;CACvD,CAAC,CAAC;AAoBH,MAAM,MAAM,wBAAwB,GAAG,QAAQ,CAAC;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EACF,aAAa,GACb,eAAe,GACf,gBAAgB,GAChB,oBAAoB,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC,CAAC;AAEH,gFAAgF;AAChF,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,EACrD,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC,CA2DhD;AAED,kFAAkF;AAClF,wBAAsB,2BAA2B,CAC/C,IAAI,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,EAClD,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,CA+DvD;AAwCD,sEAAsE;AACtE,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,EAClD,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAmGvC"}
|
|
@@ -3,7 +3,12 @@ import path from "node:path";
|
|
|
3
3
|
import { coarseCoordinateSpan } from "../../extractors/symbol-coordinates.js";
|
|
4
4
|
import { analyzeSourceText, enrichSymbolCoordinates, } from "../../extractors/symbols-coordinator.js";
|
|
5
5
|
import { isCoarseGranularityReason } from "../symbol-granularity.js";
|
|
6
|
-
import {
|
|
6
|
+
import { loadEntitiesPaged } from "./discovery-entities.js";
|
|
7
|
+
/**
|
|
8
|
+
* Symbol pages for repair planning. The full symbol inventory is already half
|
|
9
|
+
* of the bounded engine output on large workspaces, so it is read in pages.
|
|
10
|
+
*/
|
|
11
|
+
const SYMBOL_PAGE_SIZE = 250;
|
|
7
12
|
export const SYMBOL_REPAIR_PLAN_VERSION = "kibi.symbol-repair-plan.v1";
|
|
8
13
|
function sourceFileOf(entity) {
|
|
9
14
|
const value = entity.sourceFile ?? entity.source;
|
|
@@ -83,7 +88,7 @@ export async function addCoordinateRepairEvidence(rows, context) {
|
|
|
83
88
|
const ids = new Set(missingByRow.flat());
|
|
84
89
|
if (ids.size === 0 || !context.prolog)
|
|
85
90
|
return rows;
|
|
86
|
-
const symbols = (await
|
|
91
|
+
const symbols = (await loadEntitiesPaged(context.prolog, "symbol", SYMBOL_PAGE_SIZE)).filter((symbol) => ids.has(String(symbol.id)));
|
|
87
92
|
const evidence = await inspectCoordinateRepairs(symbols, context.workspaceRoot);
|
|
88
93
|
return rows.map((row, index) => {
|
|
89
94
|
const missing = missingByRow[index] ?? [];
|
|
@@ -152,7 +157,7 @@ function currentCandidates(entity, symbols, extractedByPath) {
|
|
|
152
157
|
export async function buildSymbolRepairPlan(rows, context) {
|
|
153
158
|
if (!context.prolog || rows.length === 0)
|
|
154
159
|
return undefined;
|
|
155
|
-
const symbols = await
|
|
160
|
+
const symbols = await loadEntitiesPaged(context.prolog, "symbol", SYMBOL_PAGE_SIZE);
|
|
156
161
|
const extractedByPath = new Map();
|
|
157
162
|
for (const symbol of symbols) {
|
|
158
163
|
const source = sourceFileOf(symbol);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/public/schemas/entity.ts"],"names":[],"mappings":"AA4TA,QAAA,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/public/schemas/entity.ts"],"names":[],"mappings":"AA4TA,QAAA,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAoWzC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -503,6 +503,26 @@ const entitySchema = {
|
|
|
503
503
|
aliases: { type: "array", items: { type: "string" } },
|
|
504
504
|
examples: { type: "array", items: { type: "string" } },
|
|
505
505
|
predicate_args: { type: "array", items: { type: "string" } },
|
|
506
|
+
// predicate_schema only: allowed constants per argument name. Arguments
|
|
507
|
+
// without an entry stay open; predicate facts must use a listed constant.
|
|
508
|
+
argument_constants: {
|
|
509
|
+
type: "object",
|
|
510
|
+
additionalProperties: {
|
|
511
|
+
type: "array",
|
|
512
|
+
minItems: 1,
|
|
513
|
+
uniqueItems: true,
|
|
514
|
+
items: { type: "string", minLength: 1 },
|
|
515
|
+
},
|
|
516
|
+
},
|
|
517
|
+
// predicate_schema only: legacy spellings per argument name, each mapped
|
|
518
|
+
// to one declared constant. kibi migrate rewrites facts that use them.
|
|
519
|
+
argument_aliases: {
|
|
520
|
+
type: "object",
|
|
521
|
+
additionalProperties: {
|
|
522
|
+
type: "object",
|
|
523
|
+
additionalProperties: { type: "string", minLength: 1 },
|
|
524
|
+
},
|
|
525
|
+
},
|
|
506
526
|
rule_ir: { $ref: "#/$defs/logicRule" },
|
|
507
527
|
rule_hash: { type: "string", pattern: "^[a-f0-9]{64}$" },
|
|
508
528
|
rule_schema_id: { type: "string", minLength: 1 },
|
|
@@ -566,6 +586,8 @@ const entitySchema = {
|
|
|
566
586
|
{ required: ["aliases"] },
|
|
567
587
|
{ required: ["examples"] },
|
|
568
588
|
{ required: ["predicate_args"] },
|
|
589
|
+
{ required: ["argument_constants"] },
|
|
590
|
+
{ required: ["argument_aliases"] },
|
|
569
591
|
{ required: ["rule_ir"] },
|
|
570
592
|
{ required: ["rule_hash"] },
|
|
571
593
|
{ required: ["rule_schema_id"] },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relationship.d.ts","sourceRoot":"","sources":["../../../src/public/schemas/relationship.ts"],"names":[],"mappings":"AAkBA,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"relationship.d.ts","sourceRoot":"","sources":["../../../src/public/schemas/relationship.ts"],"names":[],"mappings":"AAkBA,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCvB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
id: kibi-usage
|
|
3
3
|
name: Kibi Usage
|
|
4
4
|
description: Use Kibi's source-first, exact-Git, migration-aware, proof-aware operations safely across MCP or the trusted local CLI, including partial completion repair.
|
|
5
|
-
version: 2.
|
|
5
|
+
version: 2.2.0
|
|
6
6
|
kibiCompatibility: ">=1.0.0"
|
|
7
7
|
tags:
|
|
8
8
|
- kibi
|
|
@@ -59,7 +59,11 @@ mutability, and Prolog requirements of each operation.
|
|
|
59
59
|
## Safe workflow
|
|
60
60
|
|
|
61
61
|
1. Always discover before you mutate: start with `kb_search`, then exact-filter with `kb_query`. Use
|
|
62
|
-
`kb_status` when branch or freshness confidence matters.
|
|
62
|
+
`kb_status` when branch or freshness confidence matters. `kb_search` ranks
|
|
63
|
+
lexically unless you pass `rankingMode: "intent-v1"`, `semanticFacets`, or
|
|
64
|
+
`sourceLocations`; use intent mode with grounded facets for conceptual
|
|
65
|
+
questions and before changing a source file, and keep lexical search for
|
|
66
|
+
literal identifiers. See `resources/workflows.md` for the mode recipe.
|
|
63
67
|
2. Resolve genuine ambiguity with the human; use semantic advisor/modeling
|
|
64
68
|
operations for deterministic interpretation and typed facts.
|
|
65
69
|
3. Create endpoints before relationships and upsert small batches sequentially.
|
|
@@ -160,7 +164,7 @@ Represent implementation ownership with a `symbol` entity that has
|
|
|
160
164
|
`sourceFile`, `implements` to the requirement, and `covered_by` to the test.
|
|
161
165
|
Prolog `symbol-coverage` also requires the test to `validates` the requirement
|
|
162
166
|
(or the requirement `verified_by` the test). `covered_by` alone is not
|
|
163
|
-
enough. Do not rely on legacy `// implements REQ
|
|
167
|
+
enough. Do not rely on legacy `// implements REQ-<area>-<behavior>` comments as the
|
|
164
168
|
traceability record.
|
|
165
169
|
|
|
166
170
|
## Complete Logical Coverage
|
|
@@ -55,6 +55,10 @@ relationship: { type: requires_predicate, from: REQ-EDITOR-DRAFT-AUTOSAVE, to: F
|
|
|
55
55
|
|
|
56
56
|
The project-local schema endpoint must exist before this fact is linked. When ontology extension is explicitly authorized, define it first with `fact_kind: predicate_schema`, `predicate_name`, `predicate_arity`, and equally sized `argument_names` and `argument_types`. Without an authorized stable signature, record `review:ontology-gap` instead of inventing a schema.
|
|
57
57
|
|
|
58
|
+
### Closed argument vocabularies
|
|
59
|
+
|
|
60
|
+
A schema can close an argument with `argument_constants` (allowed values keyed by argument name) and map older spellings with `argument_aliases`. Reuse a declared constant; `kb_upsert` rejects any other value and names the constant to use for an alias. When a genuinely new value is needed, extend `argument_constants` on the schema first. To converge existing facts, declare aliases for their spellings and let `kibi migrate` rewrite them (`predicate_schema_alignment` actions). Close only arguments with a natural shared vocabulary, such as the governed component or a severity; forcing distinct obligations into a few constants makes different requirements share one ground term.
|
|
61
|
+
|
|
58
62
|
### Deny predicate
|
|
59
63
|
|
|
60
64
|
Claim: “Suspended users must not publish articles.” When `permission_rule` fits, preserve its positive schema name and encode prohibition as polarity:
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
| `constrains` | req -> fact(subject) | Requirement constrains a strict-lane domain fact |
|
|
13
13
|
| `requires_property` | req -> fact(property_value) | Requirement requires a specific property value fact |
|
|
14
14
|
| `supersedes` | new-req -> old-req | New requirement formally replaces an old requirement |
|
|
15
|
+
| `restates` | req -> req | Requirement intentionally restates another current requirement (for example a product requirement echoed in a platform requirement); suppresses `domain-redundancy` for that pair without retiring either side |
|
|
15
16
|
| `covered_by` | symbol -> test | Production symbol has test coverage evidence |
|
|
16
17
|
|
|
17
18
|
## Valid Payload Examples
|
|
@@ -20,32 +21,32 @@
|
|
|
20
21
|
```yaml
|
|
21
22
|
relationships:
|
|
22
23
|
- type: implements
|
|
23
|
-
from: SYM-
|
|
24
|
-
to: REQ-
|
|
24
|
+
from: SYM-operation-execute-check
|
|
25
|
+
to: REQ-cli-check
|
|
25
26
|
```
|
|
26
27
|
|
|
27
28
|
### specified_by
|
|
28
29
|
```yaml
|
|
29
30
|
relationships:
|
|
30
31
|
- type: specified_by
|
|
31
|
-
from: REQ-
|
|
32
|
-
to: SCEN-
|
|
32
|
+
from: REQ-mcp-search-discovery
|
|
33
|
+
to: SCEN-mcp-search-discovery
|
|
33
34
|
```
|
|
34
35
|
|
|
35
36
|
### verified_by
|
|
36
37
|
```yaml
|
|
37
38
|
relationships:
|
|
38
39
|
- type: verified_by
|
|
39
|
-
from: REQ-
|
|
40
|
-
to: TEST-
|
|
40
|
+
from: REQ-mcp-search-discovery
|
|
41
|
+
to: TEST-mcp-search-discovery
|
|
41
42
|
```
|
|
42
43
|
|
|
43
44
|
### validates
|
|
44
45
|
```yaml
|
|
45
46
|
relationships:
|
|
46
47
|
- type: validates
|
|
47
|
-
from: TEST-
|
|
48
|
-
to: SCEN-
|
|
48
|
+
from: TEST-mcp-search-discovery
|
|
49
|
+
to: SCEN-mcp-search-discovery
|
|
49
50
|
```
|
|
50
51
|
|
|
51
52
|
### executable_for
|
|
@@ -53,39 +54,56 @@ relationships:
|
|
|
53
54
|
relationships:
|
|
54
55
|
- type: executable_for
|
|
55
56
|
from: SYM-test-login
|
|
56
|
-
to: TEST-
|
|
57
|
+
to: TEST-mcp-search-discovery
|
|
57
58
|
```
|
|
58
59
|
|
|
59
60
|
### constrains
|
|
60
61
|
```yaml
|
|
61
62
|
relationships:
|
|
62
63
|
- type: constrains
|
|
63
|
-
from: REQ-
|
|
64
|
-
to: FACT-
|
|
64
|
+
from: REQ-cli-check
|
|
65
|
+
to: FACT-SUBJECT-KIBI-CHECK
|
|
65
66
|
```
|
|
66
67
|
|
|
67
68
|
### requires_property
|
|
68
69
|
```yaml
|
|
69
70
|
relationships:
|
|
70
71
|
- type: requires_property
|
|
71
|
-
from: REQ-
|
|
72
|
-
to: FACT-
|
|
72
|
+
from: REQ-cli-check
|
|
73
|
+
to: FACT-PROP-CHECK-FAILURE-EXIT-CODE
|
|
73
74
|
```
|
|
74
75
|
|
|
75
76
|
### supersedes
|
|
76
77
|
```yaml
|
|
77
78
|
relationships:
|
|
78
79
|
- type: supersedes
|
|
79
|
-
from: REQ-
|
|
80
|
-
to: REQ-
|
|
80
|
+
from: REQ-opencode-kibi-briefing-v2
|
|
81
|
+
to: REQ-opencode-kibi-briefing-v1
|
|
81
82
|
```
|
|
82
83
|
|
|
84
|
+
A `-v2` suffix is acceptable only for a direct superseding replacement like
|
|
85
|
+
this one; otherwise name the new requirement by the behavior it governs.
|
|
86
|
+
|
|
87
|
+
### restates
|
|
88
|
+
```yaml
|
|
89
|
+
# Illustrative: a product requirement echoes a platform requirement verbatim.
|
|
90
|
+
relationships:
|
|
91
|
+
- type: restates
|
|
92
|
+
from: REQ-billing-invoice-retention
|
|
93
|
+
to: REQ-platform-record-retention
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Use `restates` only when two current requirements deliberately ground the same
|
|
97
|
+
logical term (same predicate, property tuple, or rule semantic key). It keeps
|
|
98
|
+
both requirements current and tells `domain-redundancy` the duplication is
|
|
99
|
+
intentional. If one requirement replaces the other, use `supersedes` instead.
|
|
100
|
+
|
|
83
101
|
### covered_by
|
|
84
102
|
```yaml
|
|
85
103
|
relationships:
|
|
86
104
|
- type: covered_by
|
|
87
|
-
from: SYM-
|
|
88
|
-
to: TEST-
|
|
105
|
+
from: SYM-operation-execute-check
|
|
106
|
+
to: TEST-mcp-search-discovery
|
|
89
107
|
```
|
|
90
108
|
|
|
91
109
|
## Invalid Test-Fact Shortcuts
|
|
@@ -29,3 +29,39 @@ Cancellation follows the same rule: wait for the terminal journal state. A
|
|
|
29
29
|
pre-commit rollback is retryable, a committed source with a failed derivative
|
|
30
30
|
is repairable, and an indeterminate outcome is non-retryable until its recovery
|
|
31
31
|
action resolves the journal.
|
|
32
|
+
|
|
33
|
+
## Naming entities
|
|
34
|
+
|
|
35
|
+
Name every entity by what it governs, the way you would name a source file.
|
|
36
|
+
Never choose "the next number": parallel branches pick the same next number and
|
|
37
|
+
collide even when they touch unrelated behavior.
|
|
38
|
+
|
|
39
|
+
- Use `<TYPE>-<area>-<behavior>` in kebab-case, with the type prefix kept
|
|
40
|
+
uppercase: `REQ-cli-gc`, `SCEN-mcp-search-discovery`,
|
|
41
|
+
`TEST-mcp-search-discovery`, `ADR-capability-plugins-v1`,
|
|
42
|
+
`EVT-exact-branch-store-ensure`, and a flag named after its gate such as
|
|
43
|
+
`FLAG-scip-symbol-extraction`.
|
|
44
|
+
- The filename stem equals the frontmatter `id`
|
|
45
|
+
(`.kb/requirements/REQ-cli-gc.md` has `id: REQ-cli-gc`). Always set `id`
|
|
46
|
+
explicitly; a missing `id` falls back to a path-and-title hash that changes
|
|
47
|
+
when the file is renamed.
|
|
48
|
+
- Before creating an entity, `kb_search` the area. If an existing entity already
|
|
49
|
+
covers the behavior, update it, or create a replacement and link it with
|
|
50
|
+
`supersedes`. A `-v2` suffix is acceptable only for that direct superseding
|
|
51
|
+
replacement.
|
|
52
|
+
- A name collision with another branch usually means the same work was done
|
|
53
|
+
twice. Reconcile the two entities; do not rename one of them to dodge the
|
|
54
|
+
collision.
|
|
55
|
+
- The area prefix is for humans. Whether two requirements are about the same
|
|
56
|
+
thing is decided by their facts: a shared `subject_key` and identical
|
|
57
|
+
predicate or property signatures, which `domain-redundancy` and
|
|
58
|
+
`domain-contradictions` compare deterministically. Reuse existing subject keys
|
|
59
|
+
(dotted `component.aspect[.sub]`, lowercase snake segments such as
|
|
60
|
+
`kibi.cli.check.staged`) instead of deriving a subject from the requirement
|
|
61
|
+
ID.
|
|
62
|
+
|
|
63
|
+
`entity-id-style` reports new purely numeric IDs (`REQ-123`) and IDs whose
|
|
64
|
+
filename stem differs from `id` as non-blocking quality diagnostics. Legacy
|
|
65
|
+
numbered entities created before the naming standard are grandfathered and are
|
|
66
|
+
not renamed, because code comments such as `// implements REQ-003` still
|
|
67
|
+
reference them.
|