kibi-cli 2.3.0 → 2.5.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-json-command.d.ts +6 -0
- package/dist/cli-json-command.d.ts.map +1 -1
- package/dist/cli-json-command.js +39 -11
- package/dist/cli-operation-loader.d.ts.map +1 -1
- package/dist/cli-operation-loader.js +7 -0
- package/dist/cli-operation-metadata.d.ts +13 -5
- package/dist/cli-operation-metadata.d.ts.map +1 -1
- package/dist/cli-operation-metadata.js +15 -5
- package/dist/cli-protocol.d.ts +14 -0
- package/dist/cli-protocol.d.ts.map +1 -1
- package/dist/cli-protocol.js +31 -2
- package/dist/cli-register-maintenance.d.ts.map +1 -1
- package/dist/cli-register-maintenance.js +7 -0
- package/dist/cli-register-proof.d.ts.map +1 -1
- package/dist/cli-register-proof.js +13 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +11 -2
- package/dist/commands/discovery-shared.d.ts.map +1 -1
- package/dist/commands/discovery-shared.js +8 -2
- package/dist/commands/engine.d.ts.map +1 -1
- package/dist/commands/engine.js +4 -2
- package/dist/commands/gc.d.ts.map +1 -1
- package/dist/commands/gc.js +7 -0
- package/dist/commands/init-helpers.d.ts.map +1 -1
- package/dist/commands/init-helpers.js +0 -1
- package/dist/commands/merge-driver.d.ts +31 -0
- package/dist/commands/merge-driver.d.ts.map +1 -0
- package/dist/commands/merge-driver.js +268 -0
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +281 -14
- package/dist/commands/proof-compact.d.ts +9 -0
- package/dist/commands/proof-compact.d.ts.map +1 -0
- package/dist/commands/proof-compact.js +58 -0
- package/dist/commands/prove.d.ts +38 -0
- package/dist/commands/prove.d.ts.map +1 -1
- package/dist/commands/prove.js +222 -47
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +61 -16
- package/dist/commands/sync.d.ts +8 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +42 -16
- package/dist/diagnostics.js +1 -1
- package/dist/engine-limits.d.ts +74 -0
- package/dist/engine-limits.d.ts.map +1 -0
- package/dist/engine-limits.js +201 -0
- package/dist/engine.d.ts +10 -0
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +57 -9
- package/dist/extractors/manifest.d.ts +8 -0
- package/dist/extractors/manifest.d.ts.map +1 -1
- package/dist/extractors/manifest.js +34 -5
- package/dist/extractors/markdown.d.ts +8 -0
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +57 -0
- package/dist/extractors/relationships.d.ts.map +1 -1
- package/dist/extractors/relationships.js +2 -0
- package/dist/intent-search.d.ts +4 -1
- package/dist/intent-search.d.ts.map +1 -1
- package/dist/intent-search.js +186 -33
- package/dist/operations/bootstrap/candidate-helpers.d.ts.map +1 -1
- package/dist/operations/bootstrap/candidate-helpers.js +8 -1
- package/dist/operations/bootstrap/candidates.d.ts.map +1 -1
- package/dist/operations/bootstrap/candidates.js +55 -39
- package/dist/operations/bootstrap/discovery.js +1 -1
- package/dist/operations/bootstrap/generate.d.ts +2 -0
- package/dist/operations/bootstrap/generate.d.ts.map +1 -1
- package/dist/operations/bootstrap/generate.js +107 -37
- package/dist/operations/bootstrap/guidance-actions.d.ts.map +1 -1
- package/dist/operations/bootstrap/guidance-actions.js +3 -0
- package/dist/operations/bootstrap/guidance.d.ts.map +1 -1
- package/dist/operations/bootstrap/guidance.js +7 -1
- package/dist/operations/bootstrap/intent-claims.d.ts +17 -0
- package/dist/operations/bootstrap/intent-claims.d.ts.map +1 -0
- package/dist/operations/bootstrap/intent-claims.js +103 -0
- package/dist/operations/bootstrap/markdown-candidates.d.ts +2 -0
- package/dist/operations/bootstrap/markdown-candidates.d.ts.map +1 -1
- package/dist/operations/bootstrap/markdown-candidates.js +32 -10
- package/dist/operations/bootstrap/presentation.d.ts +2 -0
- package/dist/operations/bootstrap/presentation.d.ts.map +1 -1
- package/dist/operations/bootstrap/presentation.js +66 -3
- package/dist/operations/bootstrap/requirement-claims.d.ts +1 -0
- package/dist/operations/bootstrap/requirement-claims.d.ts.map +1 -1
- package/dist/operations/bootstrap/requirement-claims.js +13 -1
- package/dist/operations/bootstrap/types.d.ts +28 -0
- package/dist/operations/bootstrap/types.d.ts.map +1 -1
- package/dist/operations/bootstrap/types.js +16 -0
- package/dist/operations/bootstrap/validation.d.ts +4 -0
- package/dist/operations/bootstrap/validation.d.ts.map +1 -0
- package/dist/operations/bootstrap/validation.js +20 -0
- package/dist/operations/migration/inventory-rederive.d.ts +81 -0
- package/dist/operations/migration/inventory-rederive.d.ts.map +1 -0
- package/dist/operations/migration/inventory-rederive.js +484 -0
- package/dist/operations/migration/kb-sources.d.ts +53 -0
- package/dist/operations/migration/kb-sources.d.ts.map +1 -0
- package/dist/operations/migration/kb-sources.js +233 -0
- package/dist/operations/migration/origin-backfill.d.ts +39 -0
- package/dist/operations/migration/origin-backfill.d.ts.map +1 -0
- package/dist/operations/migration/origin-backfill.js +164 -0
- package/dist/operations/migration/polarity-values.d.ts +10 -0
- package/dist/operations/migration/polarity-values.d.ts.map +1 -0
- package/dist/operations/migration/polarity-values.js +60 -0
- package/dist/operations/migration/schema6.d.ts +59 -0
- package/dist/operations/migration/schema6.d.ts.map +1 -0
- package/dist/operations/migration/schema6.js +379 -0
- package/dist/operations/migration/source-paths.d.ts +131 -0
- package/dist/operations/migration/source-paths.d.ts.map +1 -0
- package/dist/operations/migration/source-paths.js +308 -0
- package/dist/operations/migration/superseded-closure.d.ts +54 -0
- package/dist/operations/migration/superseded-closure.d.ts.map +1 -0
- package/dist/operations/migration/superseded-closure.js +187 -0
- package/dist/operations/modeling/logic-modeling.d.ts.map +1 -1
- package/dist/operations/modeling/logic-modeling.js +3 -5
- package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
- package/dist/operations/modeling/model-requirement.js +225 -67
- package/dist/operations/mutation/contradictions.d.ts +16 -0
- package/dist/operations/mutation/contradictions.d.ts.map +1 -1
- package/dist/operations/mutation/contradictions.js +32 -0
- package/dist/operations/mutation/delete.d.ts.map +1 -1
- package/dist/operations/mutation/delete.js +15 -7
- package/dist/operations/mutation/origin.d.ts +21 -0
- package/dist/operations/mutation/origin.d.ts.map +1 -0
- package/dist/operations/mutation/origin.js +78 -0
- package/dist/operations/mutation/plan-apply-journal.d.ts +182 -0
- package/dist/operations/mutation/plan-apply-journal.d.ts.map +1 -0
- package/dist/operations/mutation/plan-apply-journal.js +613 -0
- package/dist/operations/mutation/predicate-vocabulary-guard.d.ts +3 -1
- package/dist/operations/mutation/predicate-vocabulary-guard.d.ts.map +1 -1
- package/dist/operations/mutation/predicate-vocabulary-guard.js +13 -2
- package/dist/operations/mutation/relationships.d.ts +5 -5
- package/dist/operations/mutation/relationships.d.ts.map +1 -1
- package/dist/operations/mutation/relationships.js +31 -11
- package/dist/operations/mutation/serialization.d.ts.map +1 -1
- package/dist/operations/mutation/serialization.js +3 -1
- 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 +7 -1
- package/dist/operations/mutation/symbol-refresh.d.ts.map +1 -1
- package/dist/operations/mutation/symbol-refresh.js +4 -1
- package/dist/operations/mutation/types.d.ts +14 -0
- package/dist/operations/mutation/types.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.d.ts +30 -3
- package/dist/operations/mutation/upsert.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.js +105 -35
- package/dist/operations/mutation/validate-upsert.d.ts +6 -0
- package/dist/operations/mutation/validate-upsert.d.ts.map +1 -1
- package/dist/operations/mutation/validate-upsert.js +34 -30
- package/dist/operations/planning/apply-plan.d.ts.map +1 -1
- package/dist/operations/planning/apply-plan.js +751 -144
- package/dist/operations/planning/compile-intent.d.ts +34 -1
- package/dist/operations/planning/compile-intent.d.ts.map +1 -1
- package/dist/operations/planning/compile-intent.js +314 -98
- package/dist/operations/proof/code-scope.d.ts +28 -0
- package/dist/operations/proof/code-scope.d.ts.map +1 -1
- package/dist/operations/proof/code-scope.js +72 -0
- package/dist/operations/proof/compact-receipts.d.ts +49 -0
- package/dist/operations/proof/compact-receipts.d.ts.map +1 -0
- package/dist/operations/proof/compact-receipts.js +160 -0
- package/dist/operations/proof/ingest-proof.d.ts +2 -0
- package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
- package/dist/operations/proof/ingest-proof.js +44 -23
- package/dist/operations/proof/prune-receipts.d.ts.map +1 -1
- package/dist/operations/proof/prune-receipts.js +5 -9
- package/dist/operations/proof/receipt-compaction.d.ts +48 -0
- package/dist/operations/proof/receipt-compaction.d.ts.map +1 -0
- package/dist/operations/proof/receipt-compaction.js +121 -0
- package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analysis-receipt.js +12 -1
- package/dist/operations/semantic-advisor/analyze-prose.d.ts +2 -1
- package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analyze-prose.js +51 -5
- package/dist/operations/semantic-advisor/clauses.d.ts +1 -0
- package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/clauses.js +11 -1
- package/dist/operations/semantic-advisor/conditional-rules.d.ts +33 -0
- package/dist/operations/semantic-advisor/conditional-rules.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/conditional-rules.js +262 -0
- package/dist/operations/semantic-advisor/ingestion-boundary.d.ts +3 -1
- package/dist/operations/semantic-advisor/ingestion-boundary.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/ingestion-boundary.js +14 -6
- package/dist/operations/semantic-advisor/plugin-orchestration.js +1 -1
- package/dist/prolog/codec.d.ts.map +1 -1
- package/dist/prolog/codec.js +2 -1
- package/dist/prolog.d.ts +9 -0
- package/dist/prolog.d.ts.map +1 -1
- package/dist/prolog.js +56 -10
- package/dist/proof/command-test-report.d.ts +74 -0
- package/dist/proof/command-test-report.d.ts.map +1 -0
- package/dist/proof/command-test-report.js +206 -0
- package/dist/public/branch-resolver.d.ts +1 -0
- package/dist/public/branch-resolver.d.ts.map +1 -1
- package/dist/public/branch-resolver.js +1 -0
- package/dist/public/diagnostic-usage.d.ts +14 -0
- package/dist/public/diagnostic-usage.d.ts.map +1 -1
- package/dist/public/diagnostic-usage.js +55 -1
- package/dist/public/entity-origin.d.ts +69 -0
- package/dist/public/entity-origin.d.ts.map +1 -0
- package/dist/public/entity-origin.js +142 -0
- package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
- package/dist/public/impact/full-kb-quality.js +1 -0
- package/dist/public/impact/requirement-quality.js +1 -1
- package/dist/public/operations/catalog.d.ts +203 -20
- package/dist/public/operations/catalog.d.ts.map +1 -1
- package/dist/public/operations/catalog.js +3 -0
- package/dist/public/operations/check-executor.d.ts.map +1 -1
- package/dist/public/operations/check-executor.js +8 -0
- package/dist/public/operations/contracts.d.ts +0 -5
- package/dist/public/operations/contracts.d.ts.map +1 -1
- package/dist/public/operations/contracts.js +63 -14
- package/dist/public/operations/discovery-entities.d.ts +15 -0
- package/dist/public/operations/discovery-entities.d.ts.map +1 -1
- package/dist/public/operations/discovery-entities.js +59 -0
- package/dist/public/operations/discovery-executors.d.ts +6 -1
- package/dist/public/operations/discovery-executors.d.ts.map +1 -1
- package/dist/public/operations/discovery-executors.js +65 -6
- package/dist/public/operations/index.d.ts +1 -0
- package/dist/public/operations/index.d.ts.map +1 -1
- package/dist/public/operations/index.js +1 -0
- package/dist/public/operations/migration-plan.d.ts +5 -0
- package/dist/public/operations/migration-plan.d.ts.map +1 -1
- package/dist/public/operations/migration-plan.js +26 -1
- package/dist/public/operations/node-ports.d.ts.map +1 -1
- package/dist/public/operations/node-ports.js +24 -3
- package/dist/public/operations/origin-review.d.ts +51 -0
- package/dist/public/operations/origin-review.d.ts.map +1 -0
- package/dist/public/operations/origin-review.js +307 -0
- package/dist/public/operations/predicate-schema-conformance.js +1 -1
- package/dist/public/operations/repair-plan.d.ts.map +1 -1
- package/dist/public/operations/repair-plan.js +4 -0
- package/dist/public/operations/result-envelope.d.ts.map +1 -1
- package/dist/public/operations/result-envelope.js +17 -5
- package/dist/public/operations/runtime-types.d.ts +9 -0
- package/dist/public/operations/runtime-types.d.ts.map +1 -1
- package/dist/public/operations/schema6-check-actions.d.ts +127 -0
- package/dist/public/operations/schema6-check-actions.d.ts.map +1 -0
- package/dist/public/operations/schema6-check-actions.js +575 -0
- package/dist/public/operations/source-path-dangling.d.ts +17 -0
- package/dist/public/operations/source-path-dangling.d.ts.map +1 -0
- package/dist/public/operations/source-path-dangling.js +66 -0
- package/dist/public/operations/specs/bootstrap.d.ts +73 -1
- package/dist/public/operations/specs/bootstrap.d.ts.map +1 -1
- package/dist/public/operations/specs/bootstrap.js +66 -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 +15 -1
- package/dist/public/operations/specs/check.d.ts +2 -2
- package/dist/public/operations/specs/check.js +1 -1
- package/dist/public/operations/specs/composite.d.ts +351 -0
- package/dist/public/operations/specs/composite.d.ts.map +1 -0
- package/dist/public/operations/specs/composite.js +96 -0
- package/dist/public/operations/specs/discovery.d.ts +8 -3
- package/dist/public/operations/specs/discovery.d.ts.map +1 -1
- package/dist/public/operations/specs/discovery.js +8 -3
- package/dist/public/operations/specs/modeling.d.ts +2 -2
- package/dist/public/operations/specs/modeling.js +2 -2
- package/dist/public/operations/specs/mutation-schemas.d.ts +73 -8
- package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
- package/dist/public/operations/specs/mutation-schemas.js +43 -7
- package/dist/public/operations/specs/mutation.d.ts +1 -1
- package/dist/public/operations/specs/mutation.js +1 -1
- package/dist/public/operations/specs/planning.d.ts +2 -2
- package/dist/public/operations/specs/planning.js +4 -4
- package/dist/public/operations/specs/reporting.d.ts.map +1 -1
- package/dist/public/operations/specs/reporting.js +13 -26
- package/dist/public/operations/specs/upsert.d.ts +79 -9
- package/dist/public/operations/specs/upsert.d.ts.map +1 -1
- package/dist/public/operations/specs/upsert.js +6 -1
- package/dist/public/operations/symbol-repair-plan.d.ts.map +1 -1
- package/dist/public/operations/symbol-repair-plan.js +3 -1
- package/dist/public/operations/types.d.ts +1 -1
- package/dist/public/operations/types.d.ts.map +1 -1
- package/dist/public/proof-receipt.d.ts +1 -0
- package/dist/public/proof-receipt.d.ts.map +1 -1
- package/dist/public/schemas/entity.d.ts.map +1 -1
- package/dist/public/schemas/entity.js +52 -0
- package/dist/public/schemas/relationship.d.ts.map +1 -1
- package/dist/public/schemas/relationship.js +2 -0
- package/dist/public/skills/kibi-bootstrap/SKILL.md +52 -11
- package/dist/public/skills/kibi-bootstrap/resources/bootstrap.md +12 -1
- package/dist/public/skills/kibi-usage/SKILL.md +82 -18
- package/dist/public/skills/kibi-usage/resources/fact-lanes.md +5 -5
- package/dist/public/skills/kibi-usage/resources/kb-improvement.md +1 -1
- package/dist/public/skills/kibi-usage/resources/logic-ir.md +2 -2
- package/dist/public/skills/kibi-usage/resources/operation-access.md +29 -1
- package/dist/public/skills/kibi-usage/resources/ui-requirements.md +4 -4
- package/dist/public/skills/kibi-usage/resources/workflows.md +42 -25
- package/dist/public/telemetry-acceptance.d.ts +64 -0
- package/dist/public/telemetry-acceptance.d.ts.map +1 -1
- package/dist/public/telemetry-acceptance.js +143 -7
- package/dist/public/telemetry-remediation.d.ts.map +1 -1
- package/dist/public/telemetry-remediation.js +26 -10
- package/dist/relationships/shards.d.ts +13 -0
- package/dist/relationships/shards.d.ts.map +1 -1
- package/dist/relationships/shards.js +54 -28
- package/dist/runtime/cli-runtime.d.ts.map +1 -1
- package/dist/runtime/cli-runtime.js +44 -3
- package/dist/runtime/detached-snapshot.d.ts +38 -0
- package/dist/runtime/detached-snapshot.d.ts.map +1 -0
- package/dist/runtime/detached-snapshot.js +92 -0
- package/dist/schemas/entity.schema.json +122 -0
- package/dist/search-answer.d.ts +157 -0
- package/dist/search-answer.d.ts.map +1 -0
- package/dist/search-answer.js +846 -0
- package/dist/traceability/impact-knowledge.d.ts.map +1 -1
- package/dist/traceability/impact-knowledge.js +7 -0
- package/dist/traceability/symbol-extract.js +3 -3
- package/dist/traceability/temp-kb.d.ts.map +1 -1
- package/dist/traceability/temp-kb.js +12 -0
- package/dist/types/entities.d.ts +13 -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/branch-resolver.d.ts +37 -1
- package/dist/utils/branch-resolver.d.ts.map +1 -1
- package/dist/utils/branch-resolver.js +130 -3
- package/dist/utils/repo-relative-path.d.ts +18 -0
- package/dist/utils/repo-relative-path.d.ts.map +1 -0
- package/dist/utils/repo-relative-path.js +58 -0
- package/dist/utils/rule-registry.generated.d.ts +75 -3
- package/dist/utils/rule-registry.generated.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.js +89 -3
- package/dist/utils/schema-version.d.ts +1 -1
- package/dist/utils/schema-version.d.ts.map +1 -1
- package/dist/utils/schema-version.js +4 -3
- package/dist/utils/strict-modeling.d.ts +1 -1
- package/dist/utils/strict-modeling.d.ts.map +1 -1
- package/dist/utils/strict-modeling.js +23 -3
- package/package.json +3 -3
- package/schema/entities.pl +22 -0
- package/schema/relationships.pl +14 -0
- package/schema/validation.pl +45 -1
- package/src/public/branch-resolver.ts +1 -0
- package/src/public/diagnostic-usage.ts +59 -1
- package/src/public/entity-origin.ts +175 -0
- package/src/public/impact/full-kb-quality.ts +1 -0
- package/src/public/impact/requirement-quality.ts +1 -1
- package/src/public/operations/catalog.ts +3 -0
- package/src/public/operations/check-executor.ts +15 -0
- package/src/public/operations/contracts.ts +75 -15
- package/src/public/operations/discovery-entities.ts +74 -0
- package/src/public/operations/discovery-executors.ts +88 -10
- package/src/public/operations/index.ts +1 -0
- package/src/public/operations/migration-plan.ts +30 -1
- package/src/public/operations/node-ports.ts +24 -3
- package/src/public/operations/origin-review.ts +375 -0
- package/src/public/operations/predicate-schema-conformance.ts +1 -1
- package/src/public/operations/repair-plan.ts +4 -0
- package/src/public/operations/result-envelope.ts +18 -6
- package/src/public/operations/runtime-types.ts +9 -0
- package/src/public/operations/schema6-check-actions.ts +699 -0
- package/src/public/operations/source-path-dangling.ts +81 -0
- package/src/public/operations/specs/bootstrap.ts +78 -4
- package/src/public/operations/specs/check-rules.generated.ts +15 -1
- package/src/public/operations/specs/check.ts +1 -1
- package/src/public/operations/specs/composite.ts +141 -0
- package/src/public/operations/specs/discovery.ts +9 -3
- package/src/public/operations/specs/modeling.ts +2 -2
- package/src/public/operations/specs/mutation-schemas.ts +49 -7
- package/src/public/operations/specs/mutation.ts +1 -1
- package/src/public/operations/specs/planning.ts +4 -4
- package/src/public/operations/specs/reporting.ts +13 -38
- package/src/public/operations/specs/upsert.ts +7 -1
- package/src/public/operations/symbol-repair-plan.ts +3 -1
- package/src/public/operations/types.ts +2 -0
- package/src/public/proof-receipt.ts +1 -0
- package/src/public/schemas/entity.ts +57 -0
- package/src/public/schemas/relationship.ts +2 -0
- package/src/public/skills/kibi-bootstrap/SKILL.md +52 -11
- package/src/public/skills/kibi-bootstrap/resources/bootstrap.md +12 -1
- package/src/public/skills/kibi-usage/SKILL.md +82 -18
- package/src/public/skills/kibi-usage/resources/fact-lanes.md +5 -5
- package/src/public/skills/kibi-usage/resources/kb-improvement.md +1 -1
- package/src/public/skills/kibi-usage/resources/logic-ir.md +2 -2
- package/src/public/skills/kibi-usage/resources/operation-access.md +29 -1
- package/src/public/skills/kibi-usage/resources/ui-requirements.md +4 -4
- package/src/public/skills/kibi-usage/resources/workflows.md +42 -25
- package/src/public/telemetry-acceptance-types.d.ts +4 -1
- package/src/public/telemetry-acceptance.ts +210 -7
- package/src/public/telemetry-remediation.ts +39 -10
- package/src/schemas/entity.schema.json +122 -0
- package/src/schemas/relationship.schema.json +2 -0
|
@@ -38,6 +38,12 @@ export const GENERATED_RULES = [
|
|
|
38
38
|
enforcementClass: "canonical",
|
|
39
39
|
category: "integrity",
|
|
40
40
|
},
|
|
41
|
+
{
|
|
42
|
+
name: "source-path-dangling",
|
|
43
|
+
description: "An authored entity's source field must name an existing workspace path (a #anchor suffix is ignored), an existing entity id, or an http(s) URL; a missing source is allowed",
|
|
44
|
+
enforcementClass: "canonical",
|
|
45
|
+
category: "integrity",
|
|
46
|
+
},
|
|
41
47
|
{
|
|
42
48
|
name: "no-cycles",
|
|
43
49
|
description: "No circular dependency chains in requirements",
|
|
@@ -56,6 +62,42 @@ export const GENERATED_RULES = [
|
|
|
56
62
|
enforcementClass: "canonical",
|
|
57
63
|
category: "lifecycle",
|
|
58
64
|
},
|
|
65
|
+
{
|
|
66
|
+
name: "superseded-requirement-open",
|
|
67
|
+
description: "A requirement that another requirement supersedes must have status closed, and supersedes links between requirements must not form a cycle",
|
|
68
|
+
enforcementClass: "canonical",
|
|
69
|
+
category: "lifecycle",
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "scenario-feasibility",
|
|
73
|
+
description: "A scenario that expects success must not assume property values that cannot hold, alone or together, with what current requirements require through typed property values or rules, unless an approved exception requirement waives that requirement or the listed clauses",
|
|
74
|
+
enforcementClass: "canonical",
|
|
75
|
+
category: "integrity",
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: "scenario-feasibility-unknown",
|
|
79
|
+
description: "Advisory: a scenario that expects success assumes nothing, assumes values that contradict each other, assumes a property value no governing requirement constrains comparably (type, unit or operator mismatch, or conflicting requirements), leaves a governing rule's conditions undecided, or conflicts only with constraints whose validity window may not cover it, so its feasibility cannot be decided",
|
|
80
|
+
enforcementClass: "advisory",
|
|
81
|
+
category: "integrity",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: "exception-claim-keys",
|
|
85
|
+
description: "An exception requirement's exempts_claims must name claim keys of a requirement it exempts, and requires an exempts link",
|
|
86
|
+
enforcementClass: "canonical",
|
|
87
|
+
category: "integrity",
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: "numeric-string-value",
|
|
91
|
+
description: "Advisory: a property value stores a numeric-looking string where the comparison is numeric (ordering operator, or an int/number fact on the same property); the finding names the fact and the typed value, without converting it",
|
|
92
|
+
enforcementClass: "advisory",
|
|
93
|
+
category: "integrity",
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: "rule-key-arguments-missing",
|
|
97
|
+
description: "Advisory: an opposing rule pair stays unresolved only because a body predicate declares no key_arguments; the finding names the predicate and the key positions that would decide the pair",
|
|
98
|
+
enforcementClass: "advisory",
|
|
99
|
+
category: "integrity",
|
|
100
|
+
},
|
|
59
101
|
{
|
|
60
102
|
name: "domain-contradictions",
|
|
61
103
|
description: "Detect contradictions between requirements constraining the same fact",
|
|
@@ -95,7 +137,7 @@ export const GENERATED_RULES = [
|
|
|
95
137
|
{
|
|
96
138
|
name: "strict-fact-shape",
|
|
97
139
|
description: "Detect malformed strict facts (facts with fact_kind that are missing required fields)",
|
|
98
|
-
enforcementClass: "
|
|
140
|
+
enforcementClass: "canonical",
|
|
99
141
|
category: "integrity",
|
|
100
142
|
},
|
|
101
143
|
{
|
|
@@ -149,13 +191,13 @@ export const GENERATED_RULES = [
|
|
|
149
191
|
},
|
|
150
192
|
{
|
|
151
193
|
name: "subject-key-identity",
|
|
152
|
-
description: "Subject keys must name a shared component, not be derived from a requirement ID",
|
|
194
|
+
description: "Subject keys must name a shared component, not be derived from a requirement ID, and one subject or claim must not be minted as several active subject facts or identical property_value facts",
|
|
153
195
|
enforcementClass: "advisory",
|
|
154
196
|
category: "integrity",
|
|
155
197
|
},
|
|
156
198
|
{
|
|
157
199
|
name: "subject-key-shape",
|
|
158
|
-
description: "Subject keys follow dotted component.aspect[.sub] with lowercase snake segments",
|
|
200
|
+
description: "Subject keys follow dotted component.aspect[.sub] with lowercase snake segments, and property keys name a property rather than a numbered clause (clause_NN)",
|
|
159
201
|
enforcementClass: "advisory",
|
|
160
202
|
category: "integrity",
|
|
161
203
|
},
|
|
@@ -166,6 +208,50 @@ export const GENERATED_RULES = [
|
|
|
166
208
|
category: "integrity",
|
|
167
209
|
diagnosticSeverity: "info",
|
|
168
210
|
},
|
|
211
|
+
{
|
|
212
|
+
name: "exception-unapproved",
|
|
213
|
+
description: "Advisory: a current exception requirement exempts another requirement but has no approved_by, so it exempts nothing until a human approves it",
|
|
214
|
+
enforcementClass: "advisory",
|
|
215
|
+
category: "integrity",
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
name: "exception-approval-self-attested",
|
|
219
|
+
description: "Advisory: an agent-authored exception records approved_by but no human corroborated it (origin.approved_by or approval_ref is missing), so a human should confirm the approval",
|
|
220
|
+
enforcementClass: "advisory",
|
|
221
|
+
category: "integrity",
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
name: "agent-requirement-unapproved",
|
|
225
|
+
description: "Informational: current requirements authored by an agent (origin.kind agent) that no human has approved (origin.approved_by), listed up to 25 per check",
|
|
226
|
+
enforcementClass: "advisory",
|
|
227
|
+
category: "lifecycle",
|
|
228
|
+
diagnosticSeverity: "info",
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
name: "requirement-rationale-missing",
|
|
232
|
+
description: "Advisory: a current requirement authored by a human or an agent (origin.kind human or agent) states no rationale: no rationale field, no Rationale or Why section in its body, and no link to an ADR; listed up to 25 per check plus one summary finding",
|
|
233
|
+
enforcementClass: "advisory",
|
|
234
|
+
category: "lifecycle",
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
name: "symbol-owner-superseded",
|
|
238
|
+
description: "Advisory: a symbol whose every implements target is superseded or deprecated has no current owning requirement; listed up to 25 per check plus one summary finding",
|
|
239
|
+
enforcementClass: "advisory",
|
|
240
|
+
category: "traceability",
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
name: "adr-unlinked",
|
|
244
|
+
description: "Advisory: an accepted ADR that no requirement or other ADR is linked with (relates_to, supersedes or any typed edge, in either direction)",
|
|
245
|
+
enforcementClass: "advisory",
|
|
246
|
+
category: "lifecycle",
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
name: "adr-proposed",
|
|
250
|
+
description: "Informational: an ADR that is still proposed and not superseded, so nobody accepted or withdrew the decision",
|
|
251
|
+
enforcementClass: "advisory",
|
|
252
|
+
category: "lifecycle",
|
|
253
|
+
diagnosticSeverity: "info",
|
|
254
|
+
},
|
|
169
255
|
{
|
|
170
256
|
name: "predicate-schema-conformance",
|
|
171
257
|
description: "Predicate facts match a predicate_schema (project-local, or the built-in catalog in the default namespace) and use its declared argument constants",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-version.d.ts","sourceRoot":"","sources":["../../src/utils/schema-version.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema-version.d.ts","sourceRoot":"","sources":["../../src/utils/schema-version.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;IAC9D,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,MAAM,mBAAmB,GAC3B;IAAE,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CAAE,GACrD,IAAI,GACJ,SAAS,CAAC;AAGd,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAChD,MAAM,GAAG,IAAI,CAgBf;AAGD,wBAAgB,sBAAsB,CACpC,MAAM,CAAC,EAAE,mBAAmB,GAC3B,mBAAmB,CAgDrB"}
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
// implements REQ-003
|
|
19
|
-
|
|
19
|
+
// Schema 7 requires strict fact shapes and encodes legacy polarity values.
|
|
20
|
+
export const LATEST_KB_SCHEMA_VERSION = 7;
|
|
20
21
|
// implements REQ-003
|
|
21
22
|
export function normalizeSchemaVersion(schemaVersion) {
|
|
22
23
|
if (schemaVersion === undefined || schemaVersion === null) {
|
|
@@ -47,7 +48,7 @@ export function getSchemaVersionStatus(config) {
|
|
|
47
48
|
latestVersion,
|
|
48
49
|
needsMigration: true,
|
|
49
50
|
warning: hasSchemaVersion
|
|
50
|
-
? "KB schemaVersion is invalid
|
|
51
|
+
? "KB schemaVersion is invalid; run 'kibi migrate' to plan the repair."
|
|
51
52
|
: "KB schemaVersion is missing; the repository should be initialized or migrated.",
|
|
52
53
|
};
|
|
53
54
|
}
|
|
@@ -66,7 +67,7 @@ export function getSchemaVersionStatus(config) {
|
|
|
66
67
|
currentVersion,
|
|
67
68
|
latestVersion,
|
|
68
69
|
needsMigration: true,
|
|
69
|
-
warning: `KB schemaVersion ${currentVersion} is older than the latest version ${latestVersion}
|
|
70
|
+
warning: `KB schemaVersion ${currentVersion} is older than the latest version ${latestVersion}; run 'kibi migrate' to plan the upgrade.`,
|
|
70
71
|
};
|
|
71
72
|
}
|
|
72
73
|
return {
|
|
@@ -4,7 +4,7 @@ export interface SemanticClaim {
|
|
|
4
4
|
source: string;
|
|
5
5
|
subjectKey: string;
|
|
6
6
|
propertyKey: string;
|
|
7
|
-
operator: "eq" | "gte" | "lte" | "neq" | "bool" | "polarity";
|
|
7
|
+
operator: "eq" | "gt" | "gte" | "lt" | "lte" | "neq" | "bool" | "polarity";
|
|
8
8
|
value: string | number | boolean;
|
|
9
9
|
confidence: number;
|
|
10
10
|
provenance?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strict-modeling.d.ts","sourceRoot":"","sources":["../../src/utils/strict-modeling.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAKlE,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"strict-modeling.d.ts","sourceRoot":"","sources":["../../src/utils/strict-modeling.ts"],"names":[],"mappings":"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"}
|
|
@@ -277,7 +277,7 @@ function buildUniqueTags(tags) {
|
|
|
277
277
|
function buildPropertyFactTitle(normalizedPropertyKey, claim) {
|
|
278
278
|
const label = humanizeKey(normalizedPropertyKey);
|
|
279
279
|
if (claim.operator === "polarity") {
|
|
280
|
-
return `${label} ${normalizePolarityValue(claim.value)}`;
|
|
280
|
+
return `${label} ${normalizePolarityValue(claim.value) === "forbid" ? "forbidden" : "required"}`;
|
|
281
281
|
}
|
|
282
282
|
const operatorLabel = claim.operator === "bool"
|
|
283
283
|
? "="
|
|
@@ -287,12 +287,19 @@ function buildPropertyFactTitle(normalizedPropertyKey, claim) {
|
|
|
287
287
|
? "!="
|
|
288
288
|
: claim.operator === "gte"
|
|
289
289
|
? ">="
|
|
290
|
-
: "
|
|
290
|
+
: claim.operator === "gt"
|
|
291
|
+
? ">"
|
|
292
|
+
: claim.operator === "lt"
|
|
293
|
+
? "<"
|
|
294
|
+
: "<=";
|
|
291
295
|
return `${label} ${operatorLabel} ${String(claim.value)}`;
|
|
292
296
|
}
|
|
293
297
|
function buildPropertyFactFields(claim) {
|
|
294
298
|
if (claim.operator === "polarity") {
|
|
295
299
|
return {
|
|
300
|
+
operator: "eq",
|
|
301
|
+
value_type: "bool",
|
|
302
|
+
value_bool: true,
|
|
296
303
|
polarity: normalizePolarityValue(claim.value),
|
|
297
304
|
};
|
|
298
305
|
}
|
|
@@ -305,9 +312,22 @@ function buildPropertyFactFields(claim) {
|
|
|
305
312
|
}
|
|
306
313
|
return {
|
|
307
314
|
operator: claim.operator,
|
|
308
|
-
...buildTypedValueFields(claim
|
|
315
|
+
...buildTypedValueFields(numericClaimValue(claim)),
|
|
309
316
|
};
|
|
310
317
|
}
|
|
318
|
+
const ORDERING_OPERATORS = new Set(["gt", "gte", "lt", "lte"]);
|
|
319
|
+
// implements REQ-kibi-truthful-consistency
|
|
320
|
+
// An ordering comparison is numeric by definition, so a numeric string value
|
|
321
|
+
// ("0", "2.5") is stored as int/number. Stored as a string it would be
|
|
322
|
+
// invisible to numeric contradiction checks.
|
|
323
|
+
function numericClaimValue(claim) {
|
|
324
|
+
if (typeof claim.value === "string" &&
|
|
325
|
+
ORDERING_OPERATORS.has(claim.operator) &&
|
|
326
|
+
/^\s*-?\d+(?:\.\d+)?\s*$/.test(claim.value)) {
|
|
327
|
+
return Number(claim.value);
|
|
328
|
+
}
|
|
329
|
+
return claim.value;
|
|
330
|
+
}
|
|
311
331
|
function buildTypedValueFields(value) {
|
|
312
332
|
if (typeof value === "boolean") {
|
|
313
333
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kibi-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Kibi CLI for knowledge base management",
|
|
6
6
|
"engines": {
|
|
@@ -235,8 +235,8 @@
|
|
|
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.
|
|
239
|
-
"kibi-plugin-builtin": "^0.4.
|
|
238
|
+
"kibi-core": "^0.15.0",
|
|
239
|
+
"kibi-plugin-builtin": "^0.4.1",
|
|
240
240
|
"kibi-plugin-sdk": "^0.4.0",
|
|
241
241
|
"kibi-swipl": "^1.0.0",
|
|
242
242
|
"saxes": "^6.0.0",
|
package/schema/entities.pl
CHANGED
|
@@ -30,6 +30,9 @@ entity_property(_, severity, atom).
|
|
|
30
30
|
entity_property(_, links, list).
|
|
31
31
|
entity_property(_, text_ref, uri).
|
|
32
32
|
entity_property(_, sourceFile, uri).
|
|
33
|
+
% Provenance of any authored entity: a JSON object (kind, ref, approved_by,
|
|
34
|
+
% recorded_at) naming who authored it and on what authority.
|
|
35
|
+
entity_property(_, origin, list_or_json).
|
|
33
36
|
entity_property(req, semantic_text, string).
|
|
34
37
|
entity_property(req, logic_claims, list).
|
|
35
38
|
entity_property(req, semantic_clauses, list).
|
|
@@ -39,6 +42,17 @@ entity_property(req, semantic_source_hash, string).
|
|
|
39
42
|
entity_property(req, semantic_inventory, list_or_json).
|
|
40
43
|
entity_property(req, proof_exempt, boolean).
|
|
41
44
|
entity_property(req, proof_exempt_reason, string).
|
|
45
|
+
% Human approval of an exception requirement (one that `exempts` another).
|
|
46
|
+
% Only an approved exception makes a success scenario feasible.
|
|
47
|
+
entity_property(req, approved_by, string).
|
|
48
|
+
entity_property(req, approval_ref, string).
|
|
49
|
+
% Why the requirement exists, in the words of whoever stated the intent.
|
|
50
|
+
% Explanation only: it is never part of the checked meaning.
|
|
51
|
+
entity_property(req, rationale, string).
|
|
52
|
+
% Claim keys of the exempted requirement an exception waives (all when absent).
|
|
53
|
+
entity_property(req, exempts_claims, list).
|
|
54
|
+
% Intended outcome of a scenario: success, rejection or error.
|
|
55
|
+
entity_property(scenario, expects, atom).
|
|
42
56
|
|
|
43
57
|
% Typed fact fields - only valid for fact entities
|
|
44
58
|
entity_property(fact, fact_kind, atom).
|
|
@@ -65,6 +79,9 @@ entity_property(fact, predicate_arity, integer).
|
|
|
65
79
|
entity_property(fact, argument_names, list).
|
|
66
80
|
entity_property(fact, argument_types, list).
|
|
67
81
|
entity_property(fact, argument_descriptions, list).
|
|
82
|
+
% Predicate-schema functional dependency: the named arguments determine the
|
|
83
|
+
% remaining ones, so two atoms with equal keys describe the same fact.
|
|
84
|
+
entity_property(fact, key_arguments, list).
|
|
68
85
|
% Predicate-schema vocabularies are JSON objects serialized as strings.
|
|
69
86
|
entity_property(fact, argument_constants, string).
|
|
70
87
|
entity_property(fact, argument_aliases, string).
|
|
@@ -112,6 +129,7 @@ optional_property(Type, priority) :- entity_type(Type).
|
|
|
112
129
|
optional_property(Type, severity) :- entity_type(Type).
|
|
113
130
|
optional_property(Type, links) :- entity_type(Type).
|
|
114
131
|
optional_property(Type, text_ref) :- entity_type(Type).
|
|
132
|
+
optional_property(Type, origin) :- entity_type(Type).
|
|
115
133
|
optional_property(req, semantic_text).
|
|
116
134
|
optional_property(req, logic_claims).
|
|
117
135
|
optional_property(req, semantic_clauses).
|
|
@@ -121,6 +139,10 @@ optional_property(req, semantic_source_hash).
|
|
|
121
139
|
optional_property(req, semantic_inventory).
|
|
122
140
|
optional_property(req, proof_exempt).
|
|
123
141
|
optional_property(req, proof_exempt_reason).
|
|
142
|
+
optional_property(req, approved_by).
|
|
143
|
+
optional_property(req, approval_ref).
|
|
144
|
+
optional_property(req, rationale).
|
|
145
|
+
optional_property(req, exempts_claims).
|
|
124
146
|
optional_property(test, verification_scope).
|
|
125
147
|
optional_property(test, verification_perspective).
|
|
126
148
|
optional_property(test, proof_contract).
|
package/schema/relationships.pl
CHANGED
|
@@ -22,6 +22,8 @@ relationship_type(constrains).
|
|
|
22
22
|
relationship_type(requires_property).
|
|
23
23
|
relationship_type(requires_predicate).
|
|
24
24
|
relationship_type(requires_rule).
|
|
25
|
+
relationship_type(assumes).
|
|
26
|
+
relationship_type(exempts).
|
|
25
27
|
|
|
26
28
|
% valid_relationship(RelType, FromType, ToType).
|
|
27
29
|
valid_relationship(depends_on, req, req).
|
|
@@ -45,6 +47,18 @@ valid_relationship(requires_property, req, fact).
|
|
|
45
47
|
valid_relationship(requires_predicate, req, fact).
|
|
46
48
|
valid_relationship(requires_rule, req, fact).
|
|
47
49
|
|
|
50
|
+
%% assumes(+ScenarioId, +FactId)
|
|
51
|
+
%% The scenario's outcome depends on the property_value fact holding (for
|
|
52
|
+
%% example "the order total is 0"). Checked against current requirements by
|
|
53
|
+
%% the scenario-feasibility rule.
|
|
54
|
+
% implements REQ-kibi-scenario-feasibility-v2
|
|
55
|
+
valid_relationship(assumes, scenario, fact).
|
|
56
|
+
|
|
57
|
+
%% exempts(+ExceptionReqId, +BaseReqId)
|
|
58
|
+
%% An approved exception requirement exempts the scenarios it specifies from
|
|
59
|
+
%% BaseReqId's property constraints. BaseReqId stays current and unchanged.
|
|
60
|
+
valid_relationship(exempts, req, req).
|
|
61
|
+
|
|
48
62
|
%% supersedes(+NewAdrId, +OldAdrId)
|
|
49
63
|
%% NewAdrId is the decision that replaces OldAdrId.
|
|
50
64
|
%% OldAdrId's status should be archived or deprecated as a consequence.
|
package/schema/validation.pl
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
:- use_module('entities.pl').
|
|
10
10
|
:- use_module('relationships.pl').
|
|
11
|
+
:- use_module(library(http/json)).
|
|
11
12
|
|
|
12
13
|
% validate_entity(+Type, +Props:list)
|
|
13
14
|
% Props is a list of Property=Value pairs (e.g. id=ID, title=Title)
|
|
@@ -19,7 +20,9 @@ validate_entity(Type, Props) :-
|
|
|
19
20
|
% all properties have correct types
|
|
20
21
|
forall(member(Key=Val, Props), validate_property_type(Type, Key, Val)),
|
|
21
22
|
% validate entity-specific shape constraints
|
|
22
|
-
validate_entity_shape(Type, Props)
|
|
23
|
+
validate_entity_shape(Type, Props),
|
|
24
|
+
% provenance, when present, names a known origin kind
|
|
25
|
+
valid_origin_in_props(Props).
|
|
23
26
|
|
|
24
27
|
% validate_relationship(+RelType, +From, +To)
|
|
25
28
|
% From and To are pairs Type=Id or structures type(Type) - allow Type or Type=Id
|
|
@@ -105,6 +108,7 @@ is_fact_only_field(predicate_arity).
|
|
|
105
108
|
is_fact_only_field(argument_names).
|
|
106
109
|
is_fact_only_field(argument_types).
|
|
107
110
|
is_fact_only_field(argument_descriptions).
|
|
111
|
+
is_fact_only_field(key_arguments).
|
|
108
112
|
is_fact_only_field(argument_constants).
|
|
109
113
|
is_fact_only_field(argument_aliases).
|
|
110
114
|
is_fact_only_field(aliases).
|
|
@@ -156,6 +160,7 @@ validate_fact_shape(predicate_schema, Props) :-
|
|
|
156
160
|
memberchk(argument_types=ArgumentTypes, Props),
|
|
157
161
|
same_length(ArgumentNames, ArgumentTypes),
|
|
158
162
|
length(ArgumentNames, Arity),
|
|
163
|
+
valid_key_arguments(Props, ArgumentNames),
|
|
159
164
|
valid_optional_fact_enums(Props),
|
|
160
165
|
valid_polarity_in_props(Props), !.
|
|
161
166
|
validate_fact_shape(predicate, Props) :-
|
|
@@ -185,6 +190,24 @@ validate_fact_shape(Kind, _Props) :-
|
|
|
185
190
|
\+ memberchk(Kind, [subject, property_value, observation, meta, predicate_schema, predicate, rule_schema, rule]),
|
|
186
191
|
fail.
|
|
187
192
|
|
|
193
|
+
% valid_key_arguments(+Props, +ArgumentNames)
|
|
194
|
+
% Optional key_arguments must be a non-empty list of distinct declared
|
|
195
|
+
% argument names.
|
|
196
|
+
valid_key_arguments(Props, ArgumentNames) :-
|
|
197
|
+
( memberchk(key_arguments=Keys, Props)
|
|
198
|
+
-> is_list(Keys),
|
|
199
|
+
Keys \= [],
|
|
200
|
+
maplist(text_atom, ArgumentNames, NameAtoms),
|
|
201
|
+
maplist(text_atom, Keys, KeyAtoms),
|
|
202
|
+
sort(KeyAtoms, UniqueKeys),
|
|
203
|
+
same_length(KeyAtoms, UniqueKeys),
|
|
204
|
+
forall(member(Key, KeyAtoms), memberchk(Key, NameAtoms))
|
|
205
|
+
; true
|
|
206
|
+
).
|
|
207
|
+
|
|
208
|
+
text_atom(Value, Atom) :- atom(Value), !, Atom = Value.
|
|
209
|
+
text_atom(Value, Atom) :- string(Value), atom_string(Atom, Value).
|
|
210
|
+
|
|
188
211
|
% valid_operator(+Op)
|
|
189
212
|
valid_operator(Op) :- memberchk(Op, [eq, neq, lt, lte, gt, gte]), !.
|
|
190
213
|
|
|
@@ -256,3 +279,24 @@ value_type_matches_field(string, Props) :- memberchk(value_string=_, Props), !.
|
|
|
256
279
|
value_type_matches_field(int, Props) :- memberchk(value_int=_, Props), !.
|
|
257
280
|
value_type_matches_field(number, Props) :- memberchk(value_number=_, Props), !.
|
|
258
281
|
value_type_matches_field(bool, Props) :- memberchk(value_bool=_, Props), !.
|
|
282
|
+
|
|
283
|
+
% valid_origin_in_props(+Props)
|
|
284
|
+
% Entity provenance travels as a JSON object string (or a dict). When present
|
|
285
|
+
% its kind must be human, agent, migration or import.
|
|
286
|
+
valid_origin_in_props(Props) :-
|
|
287
|
+
( memberchk(origin=Raw, Props)
|
|
288
|
+
-> origin_kind(Raw, Kind),
|
|
289
|
+
memberchk(Kind, [human, agent, migration, import])
|
|
290
|
+
; true
|
|
291
|
+
).
|
|
292
|
+
|
|
293
|
+
origin_kind(Raw, Kind) :-
|
|
294
|
+
( is_dict(Raw)
|
|
295
|
+
-> Dict = Raw
|
|
296
|
+
; (atom(Raw) ; string(Raw)),
|
|
297
|
+
catch(atom_json_dict(Raw, Dict, []), _, fail),
|
|
298
|
+
is_dict(Dict)
|
|
299
|
+
),
|
|
300
|
+
get_dict(kind, Dict, RawKind),
|
|
301
|
+
(atom(RawKind) ; string(RawKind)),
|
|
302
|
+
atom_string(Kind, RawKind).
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createHash, randomUUID } from "node:crypto";
|
|
2
|
-
import { appendFileSync, mkdirSync } from "node:fs";
|
|
2
|
+
import { appendFileSync, existsSync, mkdirSync, readFileSync } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
4
5
|
|
|
5
6
|
import {
|
|
6
7
|
appendPayloadCountField,
|
|
@@ -241,6 +242,60 @@ export function deriveDiagnosticUsageFields(
|
|
|
241
242
|
return fields;
|
|
242
243
|
}
|
|
243
244
|
|
|
245
|
+
/**
|
|
246
|
+
* Whether the operator opted into usage telemetry through the environment.
|
|
247
|
+
*
|
|
248
|
+
* `KIBI_DIAGNOSTIC_MODE` is the one opt-in shared with the MCP server, so a
|
|
249
|
+
* single setting covers both peer surfaces. `KIBI_CLI_DIAGNOSTIC_MODE` is the
|
|
250
|
+
* older CLI-only spelling and keeps working.
|
|
251
|
+
*/
|
|
252
|
+
export function diagnosticEnvOptIn(
|
|
253
|
+
env: NodeJS.ProcessEnv = process.env,
|
|
254
|
+
): boolean {
|
|
255
|
+
return ["KIBI_DIAGNOSTIC_MODE", "KIBI_CLI_DIAGNOSTIC_MODE"].some((key) => {
|
|
256
|
+
const value = env[key]?.trim().toLowerCase();
|
|
257
|
+
return value === "1" || value === "true";
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* The host that ran this CLI call. Hosts that launch Kibi set `KIBI_HOST`;
|
|
263
|
+
* Claude Code marks every shell it runs with `CLAUDECODE=1`, which is the
|
|
264
|
+
* only ambient signal trusted here. Anything else stays `unknown`.
|
|
265
|
+
*/
|
|
266
|
+
export function diagnosticCliHost(
|
|
267
|
+
env: NodeJS.ProcessEnv = process.env,
|
|
268
|
+
): string {
|
|
269
|
+
const explicit = env.KIBI_HOST?.trim() || env.KIBI_MCP_HOST?.trim();
|
|
270
|
+
if (explicit) return explicit;
|
|
271
|
+
return env.CLAUDECODE === "1" ? "claude-code" : "unknown";
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
let cachedCliPackageVersion: string | null | undefined;
|
|
275
|
+
|
|
276
|
+
function cliPackageVersion(): string | null {
|
|
277
|
+
if (cachedCliPackageVersion !== undefined) return cachedCliPackageVersion;
|
|
278
|
+
cachedCliPackageVersion = null;
|
|
279
|
+
let current = path.dirname(fileURLToPath(import.meta.url));
|
|
280
|
+
while (true) {
|
|
281
|
+
const candidate = path.join(current, "package.json");
|
|
282
|
+
if (existsSync(candidate)) {
|
|
283
|
+
try {
|
|
284
|
+
const parsed: unknown = JSON.parse(readFileSync(candidate, "utf8"));
|
|
285
|
+
if (isRecord(parsed) && typeof parsed.version === "string") {
|
|
286
|
+
cachedCliPackageVersion = parsed.version;
|
|
287
|
+
}
|
|
288
|
+
} catch {
|
|
289
|
+
// An unreadable manifest leaves the version unknown.
|
|
290
|
+
}
|
|
291
|
+
return cachedCliPackageVersion;
|
|
292
|
+
}
|
|
293
|
+
const parent = path.dirname(current);
|
|
294
|
+
if (parent === current) return null;
|
|
295
|
+
current = parent;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
244
299
|
export function appendCliDiagnosticUsage(input: DiagnosticUsageInput): void {
|
|
245
300
|
const finishedAt = input.finishedAt ?? new Date();
|
|
246
301
|
const requestId = input.requestId ?? `cli-${randomUUID()}`;
|
|
@@ -256,6 +311,9 @@ export function appendCliDiagnosticUsage(input: DiagnosticUsageInput): void {
|
|
|
256
311
|
request_id: requestId,
|
|
257
312
|
tool: input.tool,
|
|
258
313
|
interface: "cli_json",
|
|
314
|
+
host: diagnosticCliHost(),
|
|
315
|
+
package_version: cliPackageVersion(),
|
|
316
|
+
workspace_root: input.workspaceRoot,
|
|
259
317
|
telemetry: input.telemetry,
|
|
260
318
|
business_args: input.businessArgs,
|
|
261
319
|
status: input.status,
|