kibi-cli 2.0.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/cli-register-proof.d.ts.map +1 -1
- package/dist/cli-register-proof.js +25 -1
- package/dist/cli-register-reporting.d.ts.map +1 -1
- package/dist/cli-register-reporting.js +6 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +2 -0
- 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-generated.d.ts +7 -0
- package/dist/commands/check-generated.d.ts.map +1 -0
- package/dist/commands/check-generated.js +192 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +24 -15
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +227 -25
- package/dist/commands/engine.d.ts.map +1 -1
- package/dist/commands/engine.js +3 -1
- 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 +136 -30
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +110 -15
- package/dist/commands/proof-explain.d.ts +10 -0
- package/dist/commands/proof-explain.d.ts.map +1 -0
- package/dist/commands/proof-explain.js +45 -0
- package/dist/commands/proof-impact.d.ts +7 -0
- package/dist/commands/proof-impact.d.ts.map +1 -0
- package/dist/commands/proof-impact.js +39 -0
- package/dist/commands/proof-migrate-legacy.js +1 -1
- package/dist/commands/proof-prune.js +1 -1
- package/dist/commands/prove.d.ts.map +1 -1
- package/dist/commands/prove.js +14 -22
- package/dist/commands/report.d.ts.map +1 -1
- package/dist/commands/report.js +17 -2
- 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/manifest.d.ts +1 -0
- package/dist/commands/sync/manifest.d.ts.map +1 -1
- package/dist/commands/sync/manifest.js +18 -16
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +14 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +11 -3
- package/dist/engine.d.ts +29 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +259 -89
- package/dist/env/bootstrap.d.ts +84 -0
- package/dist/env/bootstrap.d.ts.map +1 -0
- package/dist/env/bootstrap.js +310 -0
- package/dist/extractors/manifest.d.ts.map +1 -1
- package/dist/extractors/manifest.js +67 -29
- package/dist/extractors/markdown.d.ts +4 -0
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +33 -3
- package/dist/extractors/relationships.d.ts.map +1 -1
- package/dist/extractors/relationships.js +1 -0
- package/dist/extractors/symbols-coordinator.d.ts +8 -0
- package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
- package/dist/extractors/symbols-coordinator.js +40 -0
- package/dist/extractors/symbols-ts.d.ts +8 -19
- package/dist/extractors/symbols-ts.d.ts.map +1 -1
- package/dist/extractors/symbols-ts.js +33 -503
- package/dist/intent-search.d.ts.map +1 -1
- package/dist/intent-search.js +68 -30
- 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 +179 -9
- 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/suggest-predicates.d.ts +1 -1
- package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -1
- package/dist/operations/modeling/suggest-predicates.js +30 -3
- 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/symbol-granularity.d.ts.map +1 -1
- package/dist/operations/mutation/symbol-granularity.js +9 -87
- 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 +49 -0
- package/dist/operations/planning/compile-intent.d.ts.map +1 -1
- package/dist/operations/planning/compile-intent.js +66 -4
- package/dist/operations/proof/baseline-diff.d.ts +41 -0
- package/dist/operations/proof/baseline-diff.d.ts.map +1 -0
- package/dist/operations/proof/baseline-diff.js +153 -0
- 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/explain.d.ts +75 -0
- package/dist/operations/proof/explain.d.ts.map +1 -0
- package/dist/operations/proof/explain.js +294 -0
- package/dist/operations/proof/impact.d.ts +45 -0
- package/dist/operations/proof/impact.d.ts.map +1 -0
- package/dist/operations/proof/impact.js +118 -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 +251 -77
- package/dist/operations/proof/migrate-legacy-receipts.d.ts.map +1 -1
- package/dist/operations/proof/migrate-legacy-receipts.js +28 -22
- package/dist/operations/proof/prune-receipts.d.ts.map +1 -1
- package/dist/operations/proof/prune-receipts.js +8 -6
- package/dist/operations/proof/receipt-document.js +2 -2
- package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analysis-receipt.js +3 -9
- package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analyze-prose.js +18 -67
- package/dist/operations/semantic-advisor/plugin-orchestration.d.ts +63 -0
- package/dist/operations/semantic-advisor/plugin-orchestration.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/plugin-orchestration.js +489 -0
- package/dist/operations/semantic-advisor/predicate-rules-core.d.ts +15 -2
- package/dist/operations/semantic-advisor/predicate-rules-core.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/predicate-rules-core.js +7 -140
- package/dist/operations/semantic-advisor/predicate-rules-launcher.d.ts +11 -12
- package/dist/operations/semantic-advisor/predicate-rules-launcher.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/predicate-rules-launcher.js +6 -94
- package/dist/operations/semantic-advisor/predicate-rules-policy.d.ts +16 -0
- package/dist/operations/semantic-advisor/predicate-rules-policy.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/predicate-rules-policy.js +7 -150
- package/dist/operations/semantic-advisor/predicate-rules-product-tail.d.ts +9 -0
- package/dist/operations/semantic-advisor/predicate-rules-product-tail.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/predicate-rules-product-tail.js +7 -102
- package/dist/operations/semantic-advisor/predicate-rules-product.d.ts +13 -0
- package/dist/operations/semantic-advisor/predicate-rules-product.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/predicate-rules-product.js +7 -133
- package/dist/operations/semantic-advisor/types.d.ts +1 -0
- package/dist/operations/semantic-advisor/types.d.ts.map +1 -1
- package/dist/plugins/compose-ontology-packs.d.ts +51 -0
- package/dist/plugins/compose-ontology-packs.d.ts.map +1 -0
- package/dist/plugins/compose-ontology-packs.js +257 -0
- package/dist/plugins/compose-semantic-classifier.d.ts +47 -0
- package/dist/plugins/compose-semantic-classifier.d.ts.map +1 -0
- package/dist/plugins/compose-semantic-classifier.js +216 -0
- 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 +17 -0
- package/dist/plugins/external-allowlist.d.ts.map +1 -0
- package/dist/plugins/external-allowlist.js +29 -0
- package/dist/plugins/index.d.ts +11 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +37 -0
- package/dist/plugins/load-plugin.d.ts +19 -0
- package/dist/plugins/load-plugin.d.ts.map +1 -0
- package/dist/plugins/load-plugin.js +59 -0
- package/dist/plugins/project-config.d.ts +28 -0
- package/dist/plugins/project-config.d.ts.map +1 -0
- package/dist/plugins/project-config.js +90 -0
- package/dist/plugins/registry.d.ts +94 -0
- package/dist/plugins/registry.d.ts.map +1 -0
- package/dist/plugins/registry.js +359 -0
- package/dist/plugins/resolve-package.d.ts +47 -0
- package/dist/plugins/resolve-package.d.ts.map +1 -0
- package/dist/plugins/resolve-package.js +262 -0
- package/dist/plugins/source-analysis-service.d.ts +44 -0
- package/dist/plugins/source-analysis-service.d.ts.map +1 -0
- package/dist/plugins/source-analysis-service.js +232 -0
- package/dist/prolog/codec.d.ts.map +1 -1
- package/dist/prolog/codec.js +2 -0
- package/dist/prolog/janitor.d.ts.map +1 -1
- package/dist/prolog/janitor.js +1 -1
- package/dist/prolog/store-lock.d.ts +1 -1
- package/dist/prolog/store-lock.d.ts.map +1 -1
- package/dist/prolog.d.ts +36 -0
- package/dist/prolog.d.ts.map +1 -1
- package/dist/prolog.js +78 -9
- package/dist/proof/inspect.js +1 -1
- package/dist/proof/producers/playwright-case-id.js +2 -2
- package/dist/proof/producers/playwright-reporter.js +4 -4
- package/dist/public/diagnostic-usage.d.ts.map +1 -1
- package/dist/public/diagnostic-usage.js +7 -25
- package/dist/public/extractors/symbols-coordinator.d.ts +1 -1
- package/dist/public/extractors/symbols-coordinator.d.ts.map +1 -1
- package/dist/public/extractors/symbols-coordinator.js +1 -1
- package/dist/public/impact/analyzer.d.ts +1 -1
- package/dist/public/impact/analyzer.d.ts.map +1 -1
- package/dist/public/impact/analyzer.js +6 -4
- 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 +39 -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 +11 -3
- package/dist/public/operations/check-helpers.d.ts +7 -1
- package/dist/public/operations/check-helpers.d.ts.map +1 -1
- package/dist/public/operations/check-helpers.js +22 -2
- package/dist/public/operations/contracts.d.ts.map +1 -1
- package/dist/public/operations/contracts.js +51 -12
- package/dist/public/operations/discovery-entities.d.ts +53 -1
- package/dist/public/operations/discovery-entities.d.ts.map +1 -1
- package/dist/public/operations/discovery-entities.js +219 -12
- 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 +93 -59
- 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 +1 -1
- package/dist/public/operations/prolog-json.d.ts.map +1 -1
- package/dist/public/operations/prolog-json.js +16 -10
- 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 +17 -2
- 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 +9 -1
- package/dist/public/operations/specs/check.d.ts +1 -1
- package/dist/public/operations/specs/discovery.d.ts +10 -1
- package/dist/public/operations/specs/discovery.d.ts.map +1 -1
- package/dist/public/operations/specs/discovery.js +10 -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/proof.js +1 -1
- package/dist/public/operations/specs/reporting.d.ts +9 -0
- package/dist/public/operations/specs/reporting.d.ts.map +1 -1
- package/dist/public/operations/specs/reporting.js +48 -17
- package/dist/public/operations/specs/semantic.d.ts +1 -1
- package/dist/public/operations/specs/semantic.d.ts.map +1 -1
- package/dist/public/operations/specs/semantic.js +54 -4
- 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 +11 -4
- package/dist/public/operations/types.d.ts +5 -0
- package/dist/public/operations/types.d.ts.map +1 -1
- package/dist/public/proof-protocol.js +4 -4
- 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 +10 -3
- package/dist/public/skills/kibi-usage/resources/fact-lanes.md +4 -0
- package/dist/public/skills/kibi-usage/resources/proof.md +45 -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/symbol-granularity.d.ts +1 -1
- package/dist/public/symbol-granularity.d.ts.map +1 -1
- package/dist/public/symbol-granularity.generated.d.ts.map +1 -1
- package/dist/public/symbol-granularity.generated.js +38 -5
- 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/report/html-report.css +1239 -281
- package/dist/runtime/cli-runtime.d.ts.map +1 -1
- package/dist/runtime/cli-runtime.js +18 -0
- 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/symbol-extract.d.ts +24 -7
- package/dist/traceability/symbol-extract.d.ts.map +1 -1
- package/dist/traceability/symbol-extract.js +64 -208
- 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 +42 -0
- package/dist/utils/rule-registry.generated.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.js +50 -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 +14 -11
- 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/extractors/symbols-coordinator.ts +1 -0
- package/src/public/impact/analyzer.ts +15 -12
- package/src/public/impact/full-kb-quality.ts +4 -16
- package/src/public/operations/check-executor.ts +13 -2
- package/src/public/operations/check-helpers.ts +29 -3
- package/src/public/operations/contracts.ts +59 -12
- package/src/public/operations/discovery-entities.ts +327 -12
- package/src/public/operations/discovery-executors.ts +110 -61
- 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 +22 -8
- package/src/public/operations/result-envelope.ts +114 -2
- package/src/public/operations/runtime-types.ts +22 -3
- package/src/public/operations/specs/check-rules.generated.ts +9 -1
- package/src/public/operations/specs/discovery.ts +11 -1
- package/src/public/operations/specs/mutation-schemas.ts +23 -3
- package/src/public/operations/specs/proof.ts +1 -1
- package/src/public/operations/specs/reporting.ts +71 -24
- package/src/public/operations/specs/semantic.ts +79 -17
- package/src/public/operations/specs/upsert.ts +1 -1
- package/src/public/operations/symbol-repair-plan.ts +16 -7
- package/src/public/operations/types.ts +5 -0
- package/src/public/proof-fingerprint.ts +1 -1
- package/src/public/proof-protocol-types.d.ts +1 -1
- package/src/public/proof-protocol.ts +4 -4
- package/src/public/schemas/entity.ts +22 -0
- package/src/public/schemas/relationship.ts +1 -0
- package/src/public/skills/kibi-usage/SKILL.md +10 -3
- package/src/public/skills/kibi-usage/resources/fact-lanes.md +4 -0
- package/src/public/skills/kibi-usage/resources/proof.md +45 -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/symbol-granularity.generated.ts +45 -12
- package/src/public/symbol-granularity.ts +3 -3
- 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,3 +1,4 @@
|
|
|
1
|
+
import { compilerFingerprintReason } from "../../commands/sync/cache.js";
|
|
1
2
|
import { EngineClient } from "../../engine.js";
|
|
2
3
|
import {
|
|
3
4
|
type IntentSearchAnalysis,
|
|
@@ -14,12 +15,15 @@ import { resolveBranchAttachment } from "../../utils/branch-resolver.js";
|
|
|
14
15
|
import {
|
|
15
16
|
type BranchStoreInspection,
|
|
16
17
|
branchStoreReason,
|
|
17
|
-
storeLockJournalReason,
|
|
18
18
|
inspectBranchStore,
|
|
19
|
+
storeLockJournalReason,
|
|
19
20
|
} from "../../utils/branch-store.js";
|
|
20
21
|
import {
|
|
21
22
|
loadEntities,
|
|
23
|
+
loadSearchCandidates,
|
|
22
24
|
paginateResults,
|
|
25
|
+
queryEntitiesViaQuery,
|
|
26
|
+
reloadFullEntities,
|
|
23
27
|
validateEntityType,
|
|
24
28
|
} from "./discovery-entities.js";
|
|
25
29
|
import {
|
|
@@ -59,6 +63,7 @@ export type SearchInput = {
|
|
|
59
63
|
readonly semanticFacets?: IntentSearchFacets;
|
|
60
64
|
readonly sourceLocations?: readonly SourceLocation[];
|
|
61
65
|
readonly minScore?: number;
|
|
66
|
+
readonly fields?: "summary" | "full";
|
|
62
67
|
};
|
|
63
68
|
|
|
64
69
|
export type SearchPayload = {
|
|
@@ -139,47 +144,29 @@ export async function executeQuery(
|
|
|
139
144
|
// implements REQ-kibi-operation-interface-parity
|
|
140
145
|
const { type, id, tags, sourceFile, limit = 100, offset = 0 } = input;
|
|
141
146
|
try {
|
|
147
|
+
validateEntityType(type);
|
|
142
148
|
const prolog = requireProlog(context);
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
...(type !== undefined ? { type } : {}),
|
|
146
|
-
...(id !== undefined ? { id } : {}),
|
|
147
|
-
...(tags !== undefined ? { tags } : {}),
|
|
148
|
-
...(sourceFile !== undefined ? { sourceFile } : {}),
|
|
149
|
-
limit,
|
|
150
|
-
offset,
|
|
151
|
-
})
|
|
152
|
-
: null;
|
|
153
|
-
if (indexedPage !== null) {
|
|
154
|
-
const paginated = indexedPage.entities;
|
|
155
|
-
const text =
|
|
156
|
-
indexedPage.count === 0
|
|
157
|
-
? `No entities found${type ? ` of type '${type}'` : ""}.`
|
|
158
|
-
: `Found ${indexedPage.count} entities${type ? ` of type '${type}'` : ""}. Showing ${paginated.length} (offset ${offset}, limit ${limit}): ${paginated
|
|
159
|
-
.map((entity) => {
|
|
160
|
-
const entityId = String(entity.id ?? "").replace(
|
|
161
|
-
/^file:\/\/.*\//,
|
|
162
|
-
"",
|
|
163
|
-
);
|
|
164
|
-
return `${entityId} (${String(entity.title ?? "")}, status=${String(entity.status ?? "")})`;
|
|
165
|
-
})
|
|
166
|
-
.join(", ")}`;
|
|
167
|
-
return {
|
|
168
|
-
content: [{ type: "text", text }],
|
|
169
|
-
structuredContent: { entities: paginated, count: indexedPage.count },
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
const entities = await loadEntities(requireProlog(context), {
|
|
149
|
+
const signal = context.signal;
|
|
150
|
+
const pageInput = {
|
|
173
151
|
...(type !== undefined ? { type } : {}),
|
|
174
152
|
...(id !== undefined ? { id } : {}),
|
|
175
153
|
...(tags !== undefined ? { tags } : {}),
|
|
176
154
|
...(sourceFile !== undefined ? { sourceFile } : {}),
|
|
177
|
-
|
|
178
|
-
|
|
155
|
+
limit,
|
|
156
|
+
offset,
|
|
157
|
+
};
|
|
158
|
+
// Both paths return one bounded page plus the total count. Ports without
|
|
159
|
+
// the engine method page kb_query_entities through `query` instead of
|
|
160
|
+
// materializing every matching entity (receipt histories make an
|
|
161
|
+
// all-tests answer exceed the bounded engine output).
|
|
162
|
+
const indexedPage = prolog.queryEntities
|
|
163
|
+
? await prolog.queryEntities(pageInput, signal)
|
|
164
|
+
: await queryEntitiesViaQuery(prolog, pageInput, signal);
|
|
165
|
+
const paginated = indexedPage.entities;
|
|
179
166
|
const text =
|
|
180
|
-
|
|
167
|
+
indexedPage.count === 0
|
|
181
168
|
? `No entities found${type ? ` of type '${type}'` : ""}.`
|
|
182
|
-
: `Found ${
|
|
169
|
+
: `Found ${indexedPage.count} entities${type ? ` of type '${type}'` : ""}. Showing ${paginated.length} (offset ${offset}, limit ${limit}): ${paginated
|
|
183
170
|
.map((entity) => {
|
|
184
171
|
const entityId = String(entity.id ?? "").replace(
|
|
185
172
|
/^file:\/\/.*\//,
|
|
@@ -190,7 +177,7 @@ export async function executeQuery(
|
|
|
190
177
|
.join(", ")}`;
|
|
191
178
|
return {
|
|
192
179
|
content: [{ type: "text", text }],
|
|
193
|
-
structuredContent: { entities: paginated, count:
|
|
180
|
+
structuredContent: { entities: paginated, count: indexedPage.count },
|
|
194
181
|
};
|
|
195
182
|
} catch (error) {
|
|
196
183
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -198,6 +185,55 @@ export async function executeQuery(
|
|
|
198
185
|
}
|
|
199
186
|
}
|
|
200
187
|
|
|
188
|
+
/**
|
|
189
|
+
* Identifying metadata a caller needs to decide which hits to open.
|
|
190
|
+
*
|
|
191
|
+
* Search is a discovery step, so returning complete entity bodies for every
|
|
192
|
+
* hit spends a large share of an agent's context before it has chosen
|
|
193
|
+
* anything. Full bodies stay available through `fields: "full"` or a follow-up
|
|
194
|
+
* kb_query for the exact ids.
|
|
195
|
+
*/
|
|
196
|
+
const SUMMARY_ENTITY_FIELDS = [
|
|
197
|
+
"id",
|
|
198
|
+
"type",
|
|
199
|
+
"title",
|
|
200
|
+
"status",
|
|
201
|
+
"priority",
|
|
202
|
+
"tags",
|
|
203
|
+
"source",
|
|
204
|
+
"sourceFile",
|
|
205
|
+
"updated_at",
|
|
206
|
+
] as const;
|
|
207
|
+
|
|
208
|
+
function summarizeMatch<TMatch extends { readonly entity: unknown }>(
|
|
209
|
+
match: TMatch,
|
|
210
|
+
): TMatch {
|
|
211
|
+
const entity = match.entity;
|
|
212
|
+
if (entity === null || typeof entity !== "object" || Array.isArray(entity)) {
|
|
213
|
+
return match;
|
|
214
|
+
}
|
|
215
|
+
const row = entity as Record<string, unknown>;
|
|
216
|
+
const summary: Record<string, unknown> = {};
|
|
217
|
+
for (const field of SUMMARY_ENTITY_FIELDS) {
|
|
218
|
+
if (row[field] !== undefined) summary[field] = row[field];
|
|
219
|
+
}
|
|
220
|
+
return { ...match, entity: summary };
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// Candidates are projected rows, so `fields: "full"` reloads the final page's
|
|
224
|
+
// complete entities by id (one bounded query each).
|
|
225
|
+
async function projectMatches<
|
|
226
|
+
TMatch extends { readonly entity: Record<string, unknown> },
|
|
227
|
+
>(
|
|
228
|
+
prolog: Pick<PrologPort, "query">,
|
|
229
|
+
matches: readonly TMatch[],
|
|
230
|
+
fields: SearchInput["fields"],
|
|
231
|
+
): Promise<readonly TMatch[]> {
|
|
232
|
+
return fields === "full"
|
|
233
|
+
? reloadFullEntities(prolog, matches)
|
|
234
|
+
: matches.map(summarizeMatch);
|
|
235
|
+
}
|
|
236
|
+
|
|
201
237
|
export async function executeSearch(
|
|
202
238
|
input: SearchInput,
|
|
203
239
|
context: OperationContext,
|
|
@@ -212,6 +248,7 @@ export async function executeSearch(
|
|
|
212
248
|
semanticFacets,
|
|
213
249
|
sourceLocations,
|
|
214
250
|
minScore,
|
|
251
|
+
fields = "summary",
|
|
215
252
|
} = input;
|
|
216
253
|
const trimmedQuery = query.trim();
|
|
217
254
|
if (!trimmedQuery) {
|
|
@@ -253,25 +290,23 @@ export async function executeSearch(
|
|
|
253
290
|
return {
|
|
254
291
|
content: [{ type: "text", text }],
|
|
255
292
|
structuredContent: {
|
|
256
|
-
results: paginated,
|
|
293
|
+
results: await projectMatches(prolog, paginated, fields),
|
|
257
294
|
count: intentResult.matches.length,
|
|
258
295
|
queryAnalysis: intentResult.analysis,
|
|
259
296
|
},
|
|
260
297
|
};
|
|
261
298
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
...(type !== undefined ? { type } : {}),
|
|
274
|
-
});
|
|
299
|
+
// Candidates are projected rows (no receipt histories or other large
|
|
300
|
+
// structured properties); ports without the engine method run the same
|
|
301
|
+
// bounded Prolog search through `query`.
|
|
302
|
+
const entities = await loadSearchCandidates(
|
|
303
|
+
prolog,
|
|
304
|
+
{
|
|
305
|
+
query: trimmedQuery,
|
|
306
|
+
...(type !== undefined ? { type } : {}),
|
|
307
|
+
},
|
|
308
|
+
context.signal,
|
|
309
|
+
);
|
|
275
310
|
const matches = await rankEntities(
|
|
276
311
|
entities,
|
|
277
312
|
trimmedQuery,
|
|
@@ -289,7 +324,10 @@ export async function executeSearch(
|
|
|
289
324
|
.join(", ")}`;
|
|
290
325
|
return {
|
|
291
326
|
content: [{ type: "text", text }],
|
|
292
|
-
structuredContent: {
|
|
327
|
+
structuredContent: {
|
|
328
|
+
results: await projectMatches(prolog, paginated, fields),
|
|
329
|
+
count: matches.length,
|
|
330
|
+
},
|
|
293
331
|
};
|
|
294
332
|
} catch (error) {
|
|
295
333
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -335,21 +373,27 @@ export async function executeStatus(
|
|
|
335
373
|
};
|
|
336
374
|
} else
|
|
337
375
|
try {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
376
|
+
// Prefer an injected or session-backed engine so MCP status shares the
|
|
377
|
+
// same client as discovery tools. Only spawn an owned fallback when no
|
|
378
|
+
// host session is available (CLI status without a live runtime port).
|
|
379
|
+
let prolog = context.prolog;
|
|
380
|
+
if (!prolog && context.ensureProlog) {
|
|
381
|
+
prolog = await context.ensureProlog();
|
|
382
|
+
}
|
|
383
|
+
if (!prolog) {
|
|
384
|
+
ownedEngine = new EngineClient({
|
|
385
|
+
workspaceRoot: context.workspaceRoot,
|
|
386
|
+
branch: attachment.kbBranch,
|
|
387
|
+
timeout: 15_000,
|
|
388
|
+
});
|
|
389
|
+
prolog = ownedEngine;
|
|
390
|
+
}
|
|
348
391
|
payload = await runOperationJsonQuery<StatusPayload>(
|
|
349
392
|
prolog,
|
|
350
393
|
"status.pl",
|
|
351
394
|
"status:kb_status_json(JsonString)",
|
|
352
395
|
"Status execution",
|
|
396
|
+
context.signal,
|
|
353
397
|
);
|
|
354
398
|
if (!isStatusPayload(payload)) {
|
|
355
399
|
throw new Error("Status execution query returned an invalid payload");
|
|
@@ -387,6 +431,7 @@ export async function executeStatus(
|
|
|
387
431
|
const existingReasons = payload.staleReasons ?? [];
|
|
388
432
|
const storeReason = branchStoreReason(store);
|
|
389
433
|
const lockReason = storeLockJournalReason(store.path);
|
|
434
|
+
const compilerReason = compilerFingerprintReason(store.path);
|
|
390
435
|
const engineReason = engineStatus
|
|
391
436
|
? {
|
|
392
437
|
code: engineStatus.errorCode ?? "engine_status_unavailable",
|
|
@@ -405,12 +450,16 @@ export async function executeStatus(
|
|
|
405
450
|
...existingReasons,
|
|
406
451
|
...(storeReason ? [storeReason] : []),
|
|
407
452
|
...(lockReason ? [lockReason] : []),
|
|
453
|
+
...(compilerReason ? [compilerReason] : []),
|
|
408
454
|
...(engineReason ? [engineReason] : []),
|
|
409
455
|
].sort((left, right) =>
|
|
410
456
|
String(left.path ?? "").localeCompare(String(right.path ?? "")),
|
|
411
457
|
);
|
|
412
458
|
const enrichedPayload: StatusPayload = {
|
|
413
459
|
...payload,
|
|
460
|
+
// Source hashes can all match while the compilation itself is lossy, so
|
|
461
|
+
// a compiler contract change alone makes the store stale.
|
|
462
|
+
...(compilerReason ? { syncState: "stale", dirty: true } : {}),
|
|
414
463
|
branchAttachment: attachment,
|
|
415
464
|
branchStore: store,
|
|
416
465
|
...(engineStatus ? { engineStatus } : {}),
|
|
@@ -319,6 +319,58 @@ export function migrationAction(
|
|
|
319
319
|
return actionDefaults(input);
|
|
320
320
|
}
|
|
321
321
|
|
|
322
|
+
/**
|
|
323
|
+
* A predicate-schema-conformance finding whose repair is mechanical (move to
|
|
324
|
+
* the only matching schema namespace, rewrite declared aliases) becomes an
|
|
325
|
+
* automatic action carrying the exact kb_upsert input, so it is reviewable in
|
|
326
|
+
* the plan and replayable through either surface.
|
|
327
|
+
*/
|
|
328
|
+
// implements REQ-kibi-predicate-vocabulary-migration
|
|
329
|
+
function predicateSchemaAlignmentAction(
|
|
330
|
+
diagnostic: Readonly<Record<string, unknown>>,
|
|
331
|
+
): MigrationAction | null {
|
|
332
|
+
if (diagnostic.id !== "rule.predicate-schema-conformance") return null;
|
|
333
|
+
const evidence = isRecord(diagnostic.evidence) ? diagnostic.evidence : null;
|
|
334
|
+
const repair =
|
|
335
|
+
evidence !== null && isRecord(evidence.repair) ? evidence.repair : null;
|
|
336
|
+
if (
|
|
337
|
+
repair === null ||
|
|
338
|
+
repair.type !== "fact" ||
|
|
339
|
+
typeof repair.id !== "string" ||
|
|
340
|
+
!isRecord(repair.properties)
|
|
341
|
+
) {
|
|
342
|
+
return null;
|
|
343
|
+
}
|
|
344
|
+
return migrationAction({
|
|
345
|
+
id: `predicate-schema-alignment-${repair.id}`,
|
|
346
|
+
code: PREDICATE_SCHEMA_ALIGNMENT_CODE,
|
|
347
|
+
category: "semantic",
|
|
348
|
+
safety: "automatic",
|
|
349
|
+
autoApplicable: true,
|
|
350
|
+
invocation: { kind: "operation", name: "kb_upsert", input: repair },
|
|
351
|
+
affectedEntityIds: [repair.id],
|
|
352
|
+
affectedFiles:
|
|
353
|
+
typeof diagnostic.source === "string" ? [diagnostic.source] : [],
|
|
354
|
+
postconditions: [
|
|
355
|
+
{
|
|
356
|
+
rule: "predicate-schema-conformance",
|
|
357
|
+
entityId: repair.id,
|
|
358
|
+
findings: 0,
|
|
359
|
+
},
|
|
360
|
+
],
|
|
361
|
+
evidence: {
|
|
362
|
+
issue: evidence?.issue,
|
|
363
|
+
namespace: evidence?.namespace,
|
|
364
|
+
alignment: evidence?.alignment,
|
|
365
|
+
rewrites: evidence?.rewrites,
|
|
366
|
+
},
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/** Migration code for mechanical predicate namespace/alias repairs. */
|
|
371
|
+
export const PREDICATE_SCHEMA_ALIGNMENT_CODE = "predicate_schema_alignment";
|
|
372
|
+
|
|
373
|
+
// implements REQ-agent-guided-migration-orchestration, REQ-kibi-predicate-vocabulary-migration
|
|
322
374
|
export function buildActionsFromCheck(input: {
|
|
323
375
|
violations?: readonly Readonly<Record<string, unknown>>[];
|
|
324
376
|
qualityDiagnostics?: readonly Readonly<Record<string, unknown>>[];
|
|
@@ -358,6 +410,11 @@ export function buildActionsFromCheck(input: {
|
|
|
358
410
|
? diagnostic.suggestion
|
|
359
411
|
: "Review this quality diagnostic.";
|
|
360
412
|
const blocking = diagnostic.blocking === true;
|
|
413
|
+
const predicateRepair = predicateSchemaAlignmentAction(diagnostic);
|
|
414
|
+
if (predicateRepair !== null) {
|
|
415
|
+
actions.push(predicateRepair);
|
|
416
|
+
continue;
|
|
417
|
+
}
|
|
361
418
|
actions.push(
|
|
362
419
|
migrationAction({
|
|
363
420
|
id: `diagnostic-${id}-${entityId || "workspace"}-${index + 1}`,
|