kibi-cli 1.0.1 → 2.1.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-errors.d.ts +3 -1
- package/dist/cli-errors.d.ts.map +1 -1
- package/dist/cli-errors.js +4 -1
- package/dist/cli-json-command.d.ts +1 -0
- package/dist/cli-json-command.d.ts.map +1 -1
- package/dist/cli-json-command.js +13 -4
- package/dist/cli-operation-loader.js +3 -3
- package/dist/cli-operation-metadata.d.ts +4 -3
- package/dist/cli-operation-metadata.d.ts.map +1 -1
- package/dist/cli-operation-metadata.js +7 -5
- package/dist/cli-protocol.js +1 -1
- 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 +3 -0
- package/dist/cli-register-proof.d.ts.map +1 -0
- package/dist/cli-register-proof.js +127 -0
- package/dist/cli-register-reporting.d.ts.map +1 -1
- package/dist/cli-register-reporting.js +7 -0
- package/dist/cli.d.ts +4 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +19 -10
- package/dist/commands/branch.d.ts +1 -0
- package/dist/commands/branch.d.ts.map +1 -1
- package/dist/commands/branch.js +8 -4
- 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 +14 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +193 -46
- package/dist/commands/coverage.d.ts +1 -0
- package/dist/commands/coverage.d.ts.map +1 -1
- package/dist/commands/coverage.js +6 -0
- package/dist/commands/doctor.d.ts +22 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +170 -23
- package/dist/commands/engine.d.ts +12 -0
- package/dist/commands/engine.d.ts.map +1 -1
- package/dist/commands/engine.js +42 -0
- package/dist/commands/github-init.d.ts +1 -0
- package/dist/commands/github-init.d.ts.map +1 -1
- package/dist/commands/github-init.js +9 -5
- package/dist/commands/init-helpers.d.ts.map +1 -1
- package/dist/commands/init-helpers.js +49 -10
- package/dist/commands/migrate.d.ts +4 -0
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +7 -7
- 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.d.ts +7 -0
- package/dist/commands/proof-migrate-legacy.d.ts.map +1 -0
- package/dist/commands/proof-migrate-legacy.js +45 -0
- package/dist/commands/proof-prune.d.ts +8 -0
- package/dist/commands/proof-prune.d.ts.map +1 -0
- package/dist/commands/proof-prune.js +53 -0
- package/dist/commands/prove.d.ts +37 -0
- package/dist/commands/prove.d.ts.map +1 -0
- package/dist/commands/prove.js +470 -0
- package/dist/commands/report.d.ts.map +1 -1
- package/dist/commands/report.js +18 -3
- package/dist/commands/sync/discovery.d.ts +3 -0
- package/dist/commands/sync/discovery.d.ts.map +1 -1
- package/dist/commands/sync/discovery.js +36 -28
- package/dist/commands/sync/manifest.d.ts +2 -1
- package/dist/commands/sync/manifest.d.ts.map +1 -1
- package/dist/commands/sync/manifest.js +55 -21
- package/dist/commands/sync/persistence.d.ts +4 -1
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +31 -14
- package/dist/commands/sync/staging.d.ts +1 -0
- package/dist/commands/sync/staging.d.ts.map +1 -1
- package/dist/commands/sync/staging.js +5 -2
- package/dist/commands/sync/untracked-targets.d.ts +24 -0
- package/dist/commands/sync/untracked-targets.d.ts.map +1 -0
- package/dist/commands/sync/untracked-targets.js +108 -0
- package/dist/commands/sync.d.ts +11 -1
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +74 -30
- package/dist/engine-daemon.d.ts +3 -1
- package/dist/engine-daemon.d.ts.map +1 -1
- package/dist/engine-daemon.js +49 -20
- package/dist/engine.d.ts +17 -77
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +331 -91
- 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 +5 -0
- package/dist/extractors/manifest.d.ts.map +1 -1
- package/dist/extractors/manifest.js +46 -1
- package/dist/extractors/markdown.d.ts +7 -3
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +60 -24
- package/dist/extractors/playwright-cases.js +1 -1
- package/dist/extractors/relationships.d.ts +6 -0
- package/dist/extractors/relationships.d.ts.map +1 -1
- package/dist/extractors/relationships.js +1 -1
- package/dist/extractors/symbol-coordinates.d.ts.map +1 -1
- 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 +9 -19
- package/dist/extractors/symbols-ts.d.ts.map +1 -1
- package/dist/extractors/symbols-ts.js +34 -429
- package/dist/intent-search.d.ts +1 -0
- package/dist/intent-search.d.ts.map +1 -1
- package/dist/intent-search.js +11 -8
- package/dist/logic/ir.d.ts +1 -0
- package/dist/logic/ir.d.ts.map +1 -1
- package/dist/logic/ir.js +1 -1
- package/dist/operations/bootstrap/activation.d.ts +2 -1
- package/dist/operations/bootstrap/activation.d.ts.map +1 -1
- package/dist/operations/bootstrap/activation.js +11 -3
- package/dist/operations/bootstrap/generate.d.ts +2 -1
- package/dist/operations/bootstrap/generate.d.ts.map +1 -1
- package/dist/operations/bootstrap/generate.js +6 -3
- package/dist/operations/bootstrap/guidance.d.ts +1 -0
- package/dist/operations/bootstrap/guidance.d.ts.map +1 -1
- package/dist/operations/bootstrap/guidance.js +1 -1
- package/dist/operations/modeling/model-requirement.d.ts +5 -0
- package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
- package/dist/operations/modeling/model-requirement.js +57 -46
- package/dist/operations/modeling/predicate-applicability.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-applicability.js +103 -4
- package/dist/operations/modeling/predicate-catalog-2.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-catalog-2.js +18 -2
- package/dist/operations/modeling/predicate-catalog-3.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-catalog-3.js +17 -1
- package/dist/operations/modeling/predicate-catalog-5.d.ts +10 -0
- package/dist/operations/modeling/predicate-catalog-5.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-catalog-5.js +291 -0
- package/dist/operations/modeling/predicate-catalog.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-catalog.js +4 -0
- package/dist/operations/modeling/predicate-loader.d.ts +1 -0
- package/dist/operations/modeling/predicate-loader.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-loader.js +4 -3
- package/dist/operations/modeling/predicate-ranker.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-ranker.js +4 -1
- package/dist/operations/modeling/predicate-types.d.ts +1 -1
- package/dist/operations/modeling/predicate-types.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-usage-hints-4.d.ts +3 -0
- package/dist/operations/modeling/predicate-usage-hints-4.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-usage-hints-4.js +84 -0
- package/dist/operations/modeling/suggest-predicates.d.ts +4 -2
- package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -1
- package/dist/operations/modeling/suggest-predicates.js +82 -22
- package/dist/operations/mutation/contradictions.d.ts +2 -1
- package/dist/operations/mutation/contradictions.d.ts.map +1 -1
- package/dist/operations/mutation/contradictions.js +26 -5
- package/dist/operations/mutation/delete.d.ts +3 -0
- package/dist/operations/mutation/delete.d.ts.map +1 -1
- package/dist/operations/mutation/delete.js +100 -32
- package/dist/operations/mutation/relationships.d.ts +1 -0
- package/dist/operations/mutation/relationships.d.ts.map +1 -1
- package/dist/operations/mutation/relationships.js +6 -4
- package/dist/operations/mutation/saga.d.ts +51 -0
- package/dist/operations/mutation/saga.d.ts.map +1 -0
- package/dist/operations/mutation/saga.js +67 -0
- package/dist/operations/mutation/serialization.d.ts.map +1 -1
- package/dist/operations/mutation/serialization.js +3 -2
- package/dist/operations/mutation/source-authoring.d.ts +5 -1
- package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
- package/dist/operations/mutation/source-authoring.js +79 -46
- package/dist/operations/mutation/strict-fact.d.ts +1 -0
- package/dist/operations/mutation/strict-fact.d.ts.map +1 -1
- package/dist/operations/mutation/strict-fact.js +8 -5
- package/dist/operations/mutation/symbol-compiler-lock.d.ts +5 -2
- package/dist/operations/mutation/symbol-compiler-lock.d.ts.map +1 -1
- package/dist/operations/mutation/symbol-compiler-lock.js +65 -2
- package/dist/operations/mutation/symbol-granularity.d.ts.map +1 -1
- package/dist/operations/mutation/symbol-granularity.js +11 -89
- package/dist/operations/mutation/symbol-refresh.d.ts +1 -0
- package/dist/operations/mutation/symbol-refresh.d.ts.map +1 -1
- package/dist/operations/mutation/symbol-refresh.js +10 -8
- package/dist/operations/mutation/upsert.d.ts +18 -2
- package/dist/operations/mutation/upsert.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.js +86 -54
- package/dist/operations/mutation/validate-upsert.js +2 -2
- package/dist/operations/mutation/validation.d.ts.map +1 -1
- package/dist/operations/mutation/validation.js +46 -4
- package/dist/operations/mutation/warnings.d.ts +1 -0
- package/dist/operations/mutation/warnings.d.ts.map +1 -1
- package/dist/operations/mutation/warnings.js +7 -5
- package/dist/operations/mutation/workspace-mutation-lock.d.ts +60 -0
- package/dist/operations/mutation/workspace-mutation-lock.d.ts.map +1 -0
- package/dist/operations/mutation/workspace-mutation-lock.js +362 -0
- package/dist/operations/planning/apply-plan.d.ts +8 -106
- package/dist/operations/planning/apply-plan.d.ts.map +1 -1
- package/dist/operations/planning/apply-plan.js +113 -36
- package/dist/operations/planning/compile-intent.d.ts +51 -0
- package/dist/operations/planning/compile-intent.d.ts.map +1 -1
- package/dist/operations/planning/compile-intent.js +133 -17
- 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/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 +34 -0
- package/dist/operations/proof/ingest-proof.d.ts.map +1 -0
- package/dist/operations/proof/ingest-proof.js +348 -0
- package/dist/operations/proof/migrate-legacy-receipts.d.ts +30 -0
- package/dist/operations/proof/migrate-legacy-receipts.d.ts.map +1 -0
- package/dist/operations/proof/migrate-legacy-receipts.js +92 -0
- package/dist/operations/proof/prune-receipts.d.ts +35 -0
- package/dist/operations/proof/prune-receipts.d.ts.map +1 -0
- package/dist/operations/proof/prune-receipts.js +91 -0
- package/dist/operations/proof/receipt-document.d.ts +29 -0
- package/dist/operations/proof/receipt-document.d.ts.map +1 -0
- package/dist/operations/proof/receipt-document.js +117 -0
- 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 +1 -0
- package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analyze-prose.js +64 -93
- package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/clauses.js +20 -7
- 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/strict-count-rules.d.ts +2 -0
- package/dist/operations/semantic-advisor/strict-count-rules.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/strict-count-rules.js +40 -25
- 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 +42 -0
- package/dist/plugins/compose-semantic-classifier.d.ts.map +1 -0
- package/dist/plugins/compose-semantic-classifier.js +211 -0
- package/dist/plugins/external-allowlist.d.ts +10 -0
- package/dist/plugins/external-allowlist.d.ts.map +1 -0
- package/dist/plugins/external-allowlist.js +16 -0
- package/dist/plugins/index.d.ts +9 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +33 -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 +93 -0
- package/dist/plugins/registry.d.ts.map +1 -0
- package/dist/plugins/registry.js +338 -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 +13 -1
- package/dist/prolog/codec.d.ts.map +1 -1
- package/dist/prolog/codec.js +269 -154
- package/dist/prolog/error-terms.d.ts +47 -0
- package/dist/prolog/error-terms.d.ts.map +1 -0
- package/dist/prolog/error-terms.js +334 -0
- package/dist/prolog/janitor.d.ts +50 -0
- package/dist/prolog/janitor.d.ts.map +1 -0
- package/dist/prolog/janitor.js +154 -0
- package/dist/prolog/store-lock.d.ts +45 -0
- package/dist/prolog/store-lock.d.ts.map +1 -0
- package/dist/prolog/store-lock.js +195 -0
- package/dist/prolog.d.ts +7 -0
- package/dist/prolog.d.ts.map +1 -1
- package/dist/prolog.js +55 -17
- package/dist/proof/evaluate.d.ts +27 -0
- package/dist/proof/evaluate.d.ts.map +1 -0
- package/dist/proof/evaluate.js +151 -0
- package/dist/proof/inspect.d.ts +12 -0
- package/dist/proof/inspect.d.ts.map +1 -0
- package/dist/proof/inspect.js +236 -0
- package/dist/proof/integrations.d.ts +35 -0
- package/dist/proof/integrations.d.ts.map +1 -0
- package/dist/proof/integrations.js +123 -0
- package/dist/proof/producers/junit-adapter.d.ts +26 -0
- package/dist/proof/producers/junit-adapter.d.ts.map +1 -0
- package/dist/proof/producers/junit-adapter.js +186 -0
- package/dist/{public → proof/producers}/playwright-case-id.d.ts +1 -1
- package/dist/proof/producers/playwright-case-id.d.ts.map +1 -0
- package/dist/{public → proof/producers}/playwright-case-id.js +1 -1
- package/dist/proof/producers/playwright-reporter.d.ts +27 -0
- package/dist/proof/producers/playwright-reporter.d.ts.map +1 -0
- package/dist/proof/producers/playwright-reporter.js +138 -0
- package/dist/proof/producers/tap-adapter.d.ts +10 -0
- package/dist/proof/producers/tap-adapter.d.ts.map +1 -0
- package/dist/proof/producers/tap-adapter.js +200 -0
- package/dist/proof/receipt-outcome.d.ts +2 -0
- package/dist/proof/receipt-outcome.d.ts.map +1 -0
- package/dist/proof/receipt-outcome.js +1 -0
- package/dist/public/diagnostic-usage.js +6 -6
- package/dist/public/distribution-parity.d.ts +7 -1
- package/dist/public/distribution-parity.d.ts.map +1 -1
- package/dist/public/distribution-parity.js +15 -10
- 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/coverage-depth-quality.d.ts +1 -0
- package/dist/public/impact/coverage-depth-quality.d.ts.map +1 -1
- package/dist/public/impact/coverage-depth-quality.js +1 -1
- package/dist/public/impact/diagnostics.d.ts.map +1 -1
- package/dist/public/impact/diagnostics.js +2 -2
- package/dist/public/impact/diff-meaning.d.ts +1 -0
- package/dist/public/impact/diff-meaning.d.ts.map +1 -1
- package/dist/public/impact/diff-meaning.js +5 -2
- package/dist/public/impact/full-kb-quality.d.ts +5 -2
- package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
- package/dist/public/impact/full-kb-quality.js +329 -64
- package/dist/public/operations/catalog.d.ts +450 -196
- package/dist/public/operations/catalog.d.ts.map +1 -1
- package/dist/public/operations/catalog.js +6 -4
- package/dist/public/operations/check-executor.d.ts.map +1 -1
- package/dist/public/operations/check-executor.js +4 -8
- package/dist/public/operations/check-helpers.d.ts +1 -1
- package/dist/public/operations/check-helpers.d.ts.map +1 -1
- package/dist/public/operations/check-helpers.js +1 -1
- package/dist/public/operations/contracts.d.ts +7 -0
- package/dist/public/operations/contracts.d.ts.map +1 -1
- package/dist/public/operations/contracts.js +66 -34
- 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 +38 -0
- package/dist/public/operations/discovery-executors.d.ts +9 -9
- package/dist/public/operations/discovery-executors.d.ts.map +1 -1
- package/dist/public/operations/discovery-executors.js +39 -31
- package/dist/public/operations/index.d.ts +1 -1
- package/dist/public/operations/index.d.ts.map +1 -1
- package/dist/public/operations/index.js +1 -1
- package/dist/public/operations/migration-plan.d.ts +4 -3
- package/dist/public/operations/migration-plan.d.ts.map +1 -1
- package/dist/public/operations/migration-plan.js +23 -21
- package/dist/public/operations/node-ports.js +6 -6
- 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 +7 -7
- package/dist/public/operations/repair-plan.d.ts +3 -3
- package/dist/public/operations/repair-plan.d.ts.map +1 -1
- package/dist/public/operations/repair-plan.js +49 -19
- package/dist/public/operations/result-envelope.d.ts +1 -0
- package/dist/public/operations/result-envelope.d.ts.map +1 -1
- package/dist/public/operations/result-envelope.js +12 -10
- package/dist/public/operations/runtime-types.d.ts +21 -1
- package/dist/public/operations/runtime-types.d.ts.map +1 -1
- package/dist/public/operations/specs/check-rules.generated.d.ts +5 -0
- package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -0
- package/dist/public/operations/specs/check-rules.generated.js +35 -0
- package/dist/public/operations/specs/check.d.ts +7 -2
- package/dist/public/operations/specs/check.d.ts.map +1 -1
- package/dist/public/operations/specs/check.js +8 -20
- package/dist/public/operations/specs/discovery.d.ts +3 -0
- package/dist/public/operations/specs/discovery.d.ts.map +1 -1
- package/dist/public/operations/specs/discovery.js +3 -0
- package/dist/public/operations/specs/mutation-schemas.d.ts +257 -163
- package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
- package/dist/public/operations/specs/mutation-schemas.js +15 -7
- package/dist/public/operations/specs/planning.d.ts +9 -0
- package/dist/public/operations/specs/planning.d.ts.map +1 -1
- package/dist/public/operations/specs/planning.js +6 -0
- package/dist/public/operations/specs/proof.d.ts +212 -0
- package/dist/public/operations/specs/proof.d.ts.map +1 -0
- package/dist/public/operations/specs/proof.js +30 -0
- package/dist/public/operations/specs/reporting.d.ts +20 -0
- package/dist/public/operations/specs/reporting.d.ts.map +1 -1
- package/dist/public/operations/specs/reporting.js +112 -12
- 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 +257 -163
- package/dist/public/operations/specs/upsert.d.ts.map +1 -1
- package/dist/public/operations/symbol-repair-plan.d.ts +11 -0
- package/dist/public/operations/symbol-repair-plan.d.ts.map +1 -1
- package/dist/public/operations/symbol-repair-plan.js +121 -4
- package/dist/public/operations/types.d.ts +6 -1
- package/dist/public/operations/types.d.ts.map +1 -1
- package/dist/public/proof-fingerprint.d.ts +54 -0
- package/dist/public/proof-fingerprint.d.ts.map +1 -0
- package/dist/public/proof-fingerprint.js +141 -0
- package/dist/public/proof-protocol.d.ts +354 -0
- package/dist/public/proof-protocol.d.ts.map +1 -0
- package/dist/public/proof-protocol.js +454 -0
- package/dist/public/proof-receipt.d.ts +279 -0
- package/dist/public/proof-receipt.d.ts.map +1 -0
- package/dist/public/proof-receipt.js +377 -0
- package/dist/public/schemas/entity.d.ts.map +1 -1
- package/dist/public/schemas/entity.js +21 -7
- package/dist/public/skills/kibi-freshness/SKILL.md +1 -1
- package/dist/public/skills/kibi-usage/SKILL.md +44 -12
- package/dist/public/skills/kibi-usage/resources/operation-access.md +1 -1
- package/dist/public/skills/kibi-usage/resources/proof.md +150 -0
- package/dist/public/skills/kibi-usage/resources/workflows.md +6 -6
- package/dist/public/symbol-granularity.d.ts +3 -14
- package/dist/public/symbol-granularity.d.ts.map +1 -1
- package/dist/public/symbol-granularity.generated.d.ts +16 -0
- package/dist/public/symbol-granularity.generated.d.ts.map +1 -0
- package/dist/public/symbol-granularity.generated.js +53 -0
- package/dist/public/symbol-granularity.js +6 -47
- package/dist/public/telemetry-acceptance.d.ts +3 -77
- package/dist/public/telemetry-acceptance.d.ts.map +1 -1
- package/dist/public/telemetry-acceptance.js +4 -2
- package/dist/public/telemetry-remediation.js +1 -1
- package/dist/report/html-report.css +1240 -0
- package/dist/report/html-report.d.ts +4 -2
- package/dist/report/html-report.d.ts.map +1 -1
- package/dist/report/html-report.js +37 -300
- package/dist/runtime/cli-runtime.d.ts +2 -0
- package/dist/runtime/cli-runtime.d.ts.map +1 -1
- package/dist/runtime/cli-runtime.js +32 -7
- package/dist/schemas/entity.schema.json +355 -215
- package/dist/search-ranking.d.ts +1 -0
- package/dist/search-ranking.d.ts.map +1 -1
- package/dist/search-ranking.js +3 -0
- package/dist/traceability/evidence-model.d.ts +28 -0
- package/dist/traceability/evidence-model.d.ts.map +1 -1
- package/dist/traceability/git-staged.d.ts +20 -0
- package/dist/traceability/git-staged.d.ts.map +1 -1
- package/dist/traceability/git-staged.js +145 -1
- package/dist/traceability/staged-diagnostics.d.ts +7 -0
- package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
- package/dist/traceability/staged-diagnostics.js +78 -7
- package/dist/traceability/staged-file-coverage.d.ts +33 -0
- package/dist/traceability/staged-file-coverage.d.ts.map +1 -0
- package/dist/traceability/staged-file-coverage.js +284 -0
- package/dist/traceability/staged-impact-contract.js +4 -4
- package/dist/traceability/staged-symbols-manifest.d.ts +13 -0
- package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
- package/dist/traceability/staged-symbols-manifest.js +138 -27
- package/dist/traceability/symbol-extract.d.ts +24 -2
- 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 +2 -0
- package/dist/traceability/temp-kb.d.ts.map +1 -1
- package/dist/traceability/temp-kb.js +13 -4
- package/dist/types/entities.d.ts +5 -3
- package/dist/types/entities.d.ts.map +1 -1
- package/dist/utils/branch-resolver.d.ts +1 -0
- package/dist/utils/branch-resolver.d.ts.map +1 -1
- package/dist/utils/branch-resolver.js +7 -4
- package/dist/utils/branch-store.d.ts +6 -0
- package/dist/utils/branch-store.d.ts.map +1 -1
- package/dist/utils/branch-store.js +27 -0
- package/dist/utils/kb-paths.d.ts +1 -1
- package/dist/utils/kb-paths.d.ts.map +1 -1
- package/dist/utils/kb-paths.js +1 -1
- package/dist/utils/rule-registry.d.ts +1 -11
- package/dist/utils/rule-registry.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.d.ts +102 -0
- package/dist/utils/rule-registry.generated.d.ts.map +1 -0
- package/dist/utils/rule-registry.generated.js +131 -0
- package/dist/utils/rule-registry.js +12 -113
- package/dist/utils/strict-modeling.d.ts +1 -0
- package/dist/utils/strict-modeling.d.ts.map +1 -1
- package/dist/utils/strict-modeling.js +1 -1
- package/package.json +20 -20
- package/src/public/diagnostic-usage.ts +6 -6
- package/src/public/distribution-parity.ts +17 -10
- package/src/public/extractors/symbols-coordinator.ts +1 -0
- package/src/public/impact/analyzer.ts +15 -12
- package/src/public/impact/coverage-depth-quality.ts +1 -1
- package/src/public/impact/diagnostics.ts +2 -1
- package/src/public/impact/diff-meaning.ts +11 -4
- package/src/public/impact/full-kb-quality.ts +463 -72
- package/src/public/operations/catalog.ts +10 -4
- package/src/public/operations/check-executor.ts +4 -8
- package/src/public/operations/check-helpers.ts +2 -2
- package/src/public/operations/contracts.ts +78 -34
- package/src/public/operations/discovery-entities.ts +53 -0
- package/src/public/operations/discovery-executors.ts +64 -48
- package/src/public/operations/index.ts +1 -1
- package/src/public/operations/migration-plan.ts +32 -25
- package/src/public/operations/node-ports.ts +6 -6
- package/src/public/operations/prolog-json.ts +13 -5
- package/src/public/operations/repair-plan.ts +60 -23
- package/src/public/operations/result-envelope.ts +15 -10
- package/src/public/operations/runtime-types.ts +26 -2
- package/src/public/operations/specs/check-rules.generated.ts +38 -0
- package/src/public/operations/specs/check.ts +12 -21
- package/src/public/operations/specs/discovery.ts +3 -0
- package/src/public/operations/specs/mutation-schemas.ts +22 -9
- package/src/public/operations/specs/planning.ts +7 -0
- package/src/public/operations/specs/proof.ts +43 -0
- package/src/public/operations/specs/reporting.ts +140 -13
- package/src/public/operations/specs/semantic.ts +79 -17
- package/src/public/operations/symbol-repair-plan.ts +166 -7
- package/src/public/operations/types.ts +6 -1
- package/src/public/proof-fingerprint.ts +216 -0
- package/src/public/proof-protocol-types.d.ts +96 -0
- package/src/public/proof-protocol.ts +589 -0
- package/src/public/proof-receipt.ts +499 -0
- package/src/public/schemas/entity.ts +26 -10
- package/src/public/skills/kibi-freshness/SKILL.md +1 -1
- package/src/public/skills/kibi-usage/SKILL.md +44 -12
- package/src/public/skills/kibi-usage/resources/operation-access.md +1 -1
- package/src/public/skills/kibi-usage/resources/proof.md +150 -0
- package/src/public/skills/kibi-usage/resources/workflows.md +6 -6
- package/src/public/symbol-granularity.generated.ts +74 -0
- package/src/public/symbol-granularity.ts +34 -59
- package/src/public/telemetry-acceptance-types.d.ts +98 -0
- package/src/public/telemetry-acceptance.ts +22 -100
- package/src/public/telemetry-remediation.ts +1 -1
- package/src/schemas/entity.schema.json +355 -215
- package/dist/cli-register-verification.d.ts +0 -3
- package/dist/cli-register-verification.d.ts.map +0 -1
- package/dist/cli-register-verification.js +0 -16
- package/dist/commands/verify.d.ts +0 -10
- package/dist/commands/verify.d.ts.map +0 -1
- package/dist/commands/verify.js +0 -126
- package/dist/operations/verification/ingest-verification.d.ts +0 -29
- package/dist/operations/verification/ingest-verification.d.ts.map +0 -1
- package/dist/operations/verification/ingest-verification.js +0 -192
- package/dist/public/operations/specs/verification.d.ts +0 -78
- package/dist/public/operations/specs/verification.d.ts.map +0 -1
- package/dist/public/operations/specs/verification.js +0 -62
- package/dist/public/playwright-case-id.d.ts.map +0 -1
- package/dist/public/verification-receipt.d.ts +0 -242
- package/dist/public/verification-receipt.d.ts.map +0 -1
- package/dist/public/verification-receipt.js +0 -296
- package/dist/verification/playwright-reporter.d.ts +0 -21
- package/dist/verification/playwright-reporter.d.ts.map +0 -1
- package/dist/verification/playwright-reporter.js +0 -114
- package/src/public/operations/specs/verification.ts +0 -78
- package/src/public/playwright-case-id.ts +0 -35
- package/src/public/verification-receipt.ts +0 -412
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Kibi — repo-local, per-branch, queryable long-term memory for software projects
|
|
3
|
+
Copyright (C) 2026 Piotr Franczyk
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify
|
|
6
|
+
it under the terms of the GNU Affero General Public License as published by
|
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
(at your option) any later version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU Affero General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { PluginValidationError, validateKibiPlugin, } from "kibi-plugin-sdk";
|
|
19
|
+
import { PluginResolutionError, resolveProjectLocalPackage, } from "./resolve-package.js";
|
|
20
|
+
function isRecord(value) {
|
|
21
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Dynamically import a project-local plugin package and validate the named
|
|
25
|
+
* `kibiPlugin` export against kibi.plugin.v1.
|
|
26
|
+
*/
|
|
27
|
+
// implements REQ-capability-plugin-activation-disclosure-v1, REQ-capability-plugin-observable-behavior-v1
|
|
28
|
+
export async function loadPluginPackage(workspaceRoot, packageName, options = {}) {
|
|
29
|
+
const resolvePackage = options.resolvePackage ?? resolveProjectLocalPackage;
|
|
30
|
+
const importModule = options.importModule ?? ((url) => import(url));
|
|
31
|
+
const resolved = resolvePackage(workspaceRoot, packageName);
|
|
32
|
+
let moduleExports;
|
|
33
|
+
try {
|
|
34
|
+
moduleExports = await importModule(resolved.entryUrl);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
38
|
+
throw new PluginResolutionError("PLUGIN_IMPORT_FAILED", `Failed to import plugin package '${packageName}': ${message}`);
|
|
39
|
+
}
|
|
40
|
+
if (!isRecord(moduleExports) || !("kibiPlugin" in moduleExports)) {
|
|
41
|
+
throw new PluginValidationError("MISSING_KIBI_PLUGIN_EXPORT", `Package '${packageName}' must export a named 'kibiPlugin' binding`);
|
|
42
|
+
}
|
|
43
|
+
const plugin = validateKibiPlugin(moduleExports.kibiPlugin);
|
|
44
|
+
const packageVersion = typeof resolved.packageJson.version === "string"
|
|
45
|
+
? resolved.packageJson.version.trim()
|
|
46
|
+
: "";
|
|
47
|
+
if (!packageVersion) {
|
|
48
|
+
throw new PluginValidationError("MISSING_PACKAGE_VERSION", `Package '${packageName}' package.json must declare a version for provider provenance`);
|
|
49
|
+
}
|
|
50
|
+
if (plugin.version !== packageVersion) {
|
|
51
|
+
throw new PluginValidationError("PLUGIN_VERSION_MISMATCH", `Plugin '${plugin.id}' export version '${plugin.version}' does not match resolved package.json version '${packageVersion}'`);
|
|
52
|
+
}
|
|
53
|
+
// Host provenance always uses the resolved package manifest version.
|
|
54
|
+
const stamped = {
|
|
55
|
+
...plugin,
|
|
56
|
+
version: packageVersion,
|
|
57
|
+
};
|
|
58
|
+
return { packageName, resolved, plugin: stamped };
|
|
59
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ProjectKibiConfig } from "kibi-plugin-sdk";
|
|
2
|
+
export type ProjectPackageManifest = Readonly<{
|
|
3
|
+
name?: string;
|
|
4
|
+
dependencies?: Readonly<Record<string, string>>;
|
|
5
|
+
devDependencies?: Readonly<Record<string, string>>;
|
|
6
|
+
optionalDependencies?: Readonly<Record<string, string>>;
|
|
7
|
+
peerDependencies?: Readonly<Record<string, string>>;
|
|
8
|
+
kibi?: unknown;
|
|
9
|
+
}>;
|
|
10
|
+
export declare function readProjectPackageJson(workspaceRoot: string): ProjectPackageManifest;
|
|
11
|
+
/**
|
|
12
|
+
* Read and validate `package.json#kibi` for capability-plugin activation.
|
|
13
|
+
* Missing package.json, `kibi`, or `kibi.plugins` yields empty config
|
|
14
|
+
* (builtin-only), matching historical workspaces without a package manifest.
|
|
15
|
+
*/
|
|
16
|
+
export declare function readProjectKibiConfig(workspaceRoot: string): ProjectKibiConfig;
|
|
17
|
+
export type ConfiguredCapabilityPluginDiagnostic = Readonly<{
|
|
18
|
+
package: string;
|
|
19
|
+
capability: string;
|
|
20
|
+
mode: string;
|
|
21
|
+
/** True when the package is listed in dependencies, devDependencies, or optionalDependencies. */
|
|
22
|
+
declared: boolean;
|
|
23
|
+
}>;
|
|
24
|
+
/**
|
|
25
|
+
* Parsed `package.json#kibi.plugins` rows. Does not import plugin modules.
|
|
26
|
+
*/
|
|
27
|
+
export declare function describeConfiguredCapabilityPlugins(workspaceRoot: string): readonly ConfiguredCapabilityPluginDiagnostic[];
|
|
28
|
+
//# sourceMappingURL=project-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-config.d.ts","sourceRoot":"","sources":["../../src/plugins/project-config.ts"],"names":[],"mappings":"AAoBA,OAAO,EAGL,KAAK,iBAAiB,EAEvB,MAAM,iBAAiB,CAAC;AAGzB,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAChD,eAAe,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD,oBAAoB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACxD,gBAAgB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACpD,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC,CAAC;AAGH,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,MAAM,GACpB,sBAAsB,CAyBxB;AAED;;;;GAIG;AAEH,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,MAAM,GACpB,iBAAiB,CAOnB;AAED,MAAM,MAAM,oCAAoC,GAAG,QAAQ,CAAC;IAC1D,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,iGAAiG;IACjG,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC,CAAC;AAkBH;;GAEG;AAGH,wBAAgB,mCAAmC,CACjD,aAAa,EAAE,MAAM,GACpB,SAAS,oCAAoC,EAAE,CAsBjD"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Kibi — repo-local, per-branch, queryable long-term memory for software projects
|
|
3
|
+
Copyright (C) 2026 Piotr Franczyk
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify
|
|
6
|
+
it under the terms of the GNU Affero General Public License as published by
|
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
(at your option) any later version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU Affero General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import * as fs from "node:fs";
|
|
19
|
+
import { join } from "node:path";
|
|
20
|
+
import { PluginValidationError, validateProjectKibiConfig, } from "kibi-plugin-sdk";
|
|
21
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
22
|
+
export function readProjectPackageJson(workspaceRoot) {
|
|
23
|
+
const packageJsonPath = join(workspaceRoot, "package.json");
|
|
24
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
25
|
+
throw new PluginValidationError("MISSING_PACKAGE_JSON", `No package.json found at ${packageJsonPath}`);
|
|
26
|
+
}
|
|
27
|
+
let parsed;
|
|
28
|
+
try {
|
|
29
|
+
parsed = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
33
|
+
throw new PluginValidationError("INVALID_PACKAGE_JSON", `Failed to parse package.json: ${message}`);
|
|
34
|
+
}
|
|
35
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
36
|
+
throw new PluginValidationError("INVALID_PACKAGE_JSON", "package.json must be a JSON object");
|
|
37
|
+
}
|
|
38
|
+
return parsed;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Read and validate `package.json#kibi` for capability-plugin activation.
|
|
42
|
+
* Missing package.json, `kibi`, or `kibi.plugins` yields empty config
|
|
43
|
+
* (builtin-only), matching historical workspaces without a package manifest.
|
|
44
|
+
*/
|
|
45
|
+
// implements REQ-capability-plugin-activation-disclosure-v1, REQ-capability-plugin-observable-behavior-v1
|
|
46
|
+
export function readProjectKibiConfig(workspaceRoot) {
|
|
47
|
+
const packageJsonPath = join(workspaceRoot, "package.json");
|
|
48
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
49
|
+
return {};
|
|
50
|
+
}
|
|
51
|
+
const manifest = readProjectPackageJson(workspaceRoot);
|
|
52
|
+
return validateProjectKibiConfig(manifest.kibi);
|
|
53
|
+
}
|
|
54
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
55
|
+
function dependencyDeclared(manifest, packageName) {
|
|
56
|
+
return [
|
|
57
|
+
manifest.dependencies,
|
|
58
|
+
manifest.devDependencies,
|
|
59
|
+
manifest.optionalDependencies,
|
|
60
|
+
].some((dependencies) => Boolean(dependencies) &&
|
|
61
|
+
Object.prototype.hasOwnProperty.call(dependencies, packageName));
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Parsed `package.json#kibi.plugins` rows. Does not import plugin modules.
|
|
65
|
+
*/
|
|
66
|
+
// implements REQ-capability-plugin-activation-disclosure-v1, REQ-capability-plugin-observable-behavior-v1
|
|
67
|
+
// covered_by TEST-e2e-capability-plugins
|
|
68
|
+
export function describeConfiguredCapabilityPlugins(workspaceRoot) {
|
|
69
|
+
const config = readProjectKibiConfig(workspaceRoot);
|
|
70
|
+
const plugins = config.plugins ?? [];
|
|
71
|
+
if (plugins.length === 0)
|
|
72
|
+
return [];
|
|
73
|
+
const manifest = readProjectPackageJson(workspaceRoot);
|
|
74
|
+
const rows = [];
|
|
75
|
+
for (const plugin of plugins) {
|
|
76
|
+
const declared = dependencyDeclared(manifest, plugin.package);
|
|
77
|
+
for (const capability of Object.keys(plugin.capabilities)) {
|
|
78
|
+
const entry = plugin.capabilities[capability];
|
|
79
|
+
if (!entry)
|
|
80
|
+
continue;
|
|
81
|
+
rows.push({
|
|
82
|
+
package: plugin.package,
|
|
83
|
+
capability,
|
|
84
|
+
mode: entry.mode,
|
|
85
|
+
declared,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return rows;
|
|
90
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { type CapabilityId, type KibiPluginV1, type OntologyPackV1, type PluginMode, type PluginPermissions, type PluginProviderStamp, type ProjectKibiConfig, type SemanticClassifierV1, type SymbolExtractorV1 } from "kibi-plugin-sdk";
|
|
2
|
+
import { type LoadPluginOptions, loadPluginPackage } from "./load-plugin.js";
|
|
3
|
+
export type BuiltinPluginFactory = () => KibiPluginV1 | Promise<KibiPluginV1>;
|
|
4
|
+
export type CapabilityProviderBinding<T> = Readonly<{
|
|
5
|
+
pluginId: string;
|
|
6
|
+
pluginVersion: string;
|
|
7
|
+
packageName: string | null;
|
|
8
|
+
mode: PluginMode | "builtin";
|
|
9
|
+
permissions: PluginPermissions;
|
|
10
|
+
external: boolean;
|
|
11
|
+
capability: T;
|
|
12
|
+
stamp: PluginProviderStamp;
|
|
13
|
+
}>;
|
|
14
|
+
export type CapabilityModeResolution<T> = Readonly<{
|
|
15
|
+
builtin: CapabilityProviderBinding<T>;
|
|
16
|
+
/** At most one replace provider for this capability. */
|
|
17
|
+
replace: CapabilityProviderBinding<T> | null;
|
|
18
|
+
/** Augment providers in package.json activation order. */
|
|
19
|
+
augment: readonly CapabilityProviderBinding<T>[];
|
|
20
|
+
/** Shadow providers never participate in canonical results. */
|
|
21
|
+
shadow: readonly CapabilityProviderBinding<T>[];
|
|
22
|
+
}>;
|
|
23
|
+
export type CapabilityRegistryOptions = Readonly<{
|
|
24
|
+
workspaceRoot: string;
|
|
25
|
+
/** Injected builtin plugin; defaults to a local stub. */
|
|
26
|
+
builtinFactory?: BuiltinPluginFactory;
|
|
27
|
+
/** Pre-validated project config; skips package.json when provided. */
|
|
28
|
+
projectConfig?: ProjectKibiConfig;
|
|
29
|
+
/** Injectable project-config reader for tests. */
|
|
30
|
+
readConfig?: (workspaceRoot: string) => ProjectKibiConfig;
|
|
31
|
+
/** Injectable plugin loader for tests. */
|
|
32
|
+
loadPlugin?: (workspaceRoot: string, packageName: string, options?: LoadPluginOptions) => Promise<Awaited<ReturnType<typeof loadPluginPackage>>>;
|
|
33
|
+
loadPluginOptions?: LoadPluginOptions;
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* Minimal builtin used when no factory is injected and the builtin package is
|
|
37
|
+
* not yet wired. Satisfies kibi.plugin.v1 validation.
|
|
38
|
+
*/
|
|
39
|
+
export declare function createStubBuiltinPlugin(): KibiPluginV1;
|
|
40
|
+
/**
|
|
41
|
+
* Per-workspace capability registry. Builtin providers are always present;
|
|
42
|
+
* configured packages load lazily the first time a capability is resolved.
|
|
43
|
+
* Not a process-wide singleton — inject or construct per test/runtime.
|
|
44
|
+
*/
|
|
45
|
+
export declare class CapabilityRegistry {
|
|
46
|
+
readonly workspaceRoot: string;
|
|
47
|
+
private readonly builtinFactory;
|
|
48
|
+
private readonly readConfig;
|
|
49
|
+
private readonly loadPlugin;
|
|
50
|
+
private readonly loadPluginOptions;
|
|
51
|
+
private readonly injectedConfig;
|
|
52
|
+
private builtinPluginPromise;
|
|
53
|
+
private configPromise;
|
|
54
|
+
private readonly loadedPackages;
|
|
55
|
+
private readonly capabilityCache;
|
|
56
|
+
constructor(options: CapabilityRegistryOptions);
|
|
57
|
+
getBuiltinPlugin(): Promise<KibiPluginV1>;
|
|
58
|
+
getProjectConfig(): Promise<ProjectKibiConfig>;
|
|
59
|
+
resolveSemanticClassifiers(): Promise<CapabilityModeResolution<SemanticClassifierV1>>;
|
|
60
|
+
resolveOntologyPacks(): Promise<CapabilityModeResolution<OntologyPackV1>>;
|
|
61
|
+
resolveSymbolExtractors(): Promise<CapabilityModeResolution<SymbolExtractorV1>>;
|
|
62
|
+
resolveCapability(capabilityId: CapabilityId): Promise<CapabilityModeResolution<unknown>>;
|
|
63
|
+
/**
|
|
64
|
+
* Canonical providers only (builtin + optional replace + augment).
|
|
65
|
+
* Shadow bindings are excluded.
|
|
66
|
+
*/
|
|
67
|
+
canonicalProviders<T>(resolution: CapabilityModeResolution<T>): readonly CapabilityProviderBinding<T>[];
|
|
68
|
+
private buildCapabilityResolution;
|
|
69
|
+
private ensurePackageLoaded;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Explicit cache keyed by workspace root. Injectable — not a hidden global.
|
|
73
|
+
*/
|
|
74
|
+
export declare class CapabilityRegistryCache {
|
|
75
|
+
private readonly registries;
|
|
76
|
+
get(workspaceRoot: string): CapabilityRegistry | undefined;
|
|
77
|
+
getOrCreate(workspaceRoot: string, options?: Omit<CapabilityRegistryOptions, "workspaceRoot">): CapabilityRegistry;
|
|
78
|
+
set(workspaceRoot: string, registry: CapabilityRegistry): void;
|
|
79
|
+
clear(): void;
|
|
80
|
+
}
|
|
81
|
+
export declare function createCapabilityRegistry(options: CapabilityRegistryOptions): CapabilityRegistry;
|
|
82
|
+
export declare function createCapabilityRegistryCache(): CapabilityRegistryCache;
|
|
83
|
+
export type EnsureCapabilityRegistryOptions = CapabilityRegistryOptions & {
|
|
84
|
+
readonly cache?: CapabilityRegistryCache;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Lazily construct and cache a registry per workspace root.
|
|
88
|
+
* Callers should supply a cache instance — there is no process-global store.
|
|
89
|
+
*/
|
|
90
|
+
export declare function ensureCapabilityRegistry(workspaceRootOrOptions: string | EnsureCapabilityRegistryOptions, options?: Omit<CapabilityRegistryOptions, "workspaceRoot"> & {
|
|
91
|
+
readonly cache?: CapabilityRegistryCache;
|
|
92
|
+
}): CapabilityRegistry;
|
|
93
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/plugins/registry.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Kibi — repo-local, per-branch, queryable long-term memory for software projects
|
|
3
|
+
Copyright (C) 2026 Piotr Franczyk
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify
|
|
6
|
+
it under the terms of the GNU Affero General Public License as published by
|
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
(at your option) any later version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU Affero General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { KIBI_PLUGIN_API_VERSION, ONTOLOGY_PACK_CAPABILITY_ID, SEMANTIC_CLASSIFIER_CAPABILITY_ID, SYMBOL_EXTRACTOR_CAPABILITY_ID, defineKibiPlugin, validateKibiPlugin, } from "kibi-plugin-sdk";
|
|
19
|
+
import { loadPluginPackage } from "./load-plugin.js";
|
|
20
|
+
import { readProjectKibiConfig } from "./project-config.js";
|
|
21
|
+
import { PluginResolutionError } from "./resolve-package.js";
|
|
22
|
+
const CAPABILITY_SLOT = {
|
|
23
|
+
[SEMANTIC_CLASSIFIER_CAPABILITY_ID]: "semanticClassifier",
|
|
24
|
+
[ONTOLOGY_PACK_CAPABILITY_ID]: "ontologyPack",
|
|
25
|
+
[SYMBOL_EXTRACTOR_CAPABILITY_ID]: "symbolExtractor",
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Minimal builtin used when no factory is injected and the builtin package is
|
|
29
|
+
* not yet wired. Satisfies kibi.plugin.v1 validation.
|
|
30
|
+
*/
|
|
31
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
32
|
+
export function createStubBuiltinPlugin() {
|
|
33
|
+
return validateKibiPlugin(defineKibiPlugin({
|
|
34
|
+
apiVersion: KIBI_PLUGIN_API_VERSION,
|
|
35
|
+
id: "kibi-plugin-builtin-stub",
|
|
36
|
+
version: "0.0.0-stub",
|
|
37
|
+
permissions: {
|
|
38
|
+
network: false,
|
|
39
|
+
metered: false,
|
|
40
|
+
secrets: [],
|
|
41
|
+
},
|
|
42
|
+
capabilities: {
|
|
43
|
+
semanticClassifier: {
|
|
44
|
+
id: "kibi-plugin-builtin-stub.classifier",
|
|
45
|
+
classify: () => ({ decisions: [] }),
|
|
46
|
+
},
|
|
47
|
+
ontologyPack: {
|
|
48
|
+
id: "kibi-plugin-builtin-stub.ontology",
|
|
49
|
+
schemas: () => [],
|
|
50
|
+
match: () => [],
|
|
51
|
+
},
|
|
52
|
+
symbolExtractor: {
|
|
53
|
+
id: "kibi-plugin-builtin-stub.symbols",
|
|
54
|
+
supports: () => false,
|
|
55
|
+
analyze: (input) => ({
|
|
56
|
+
sourceFile: input.path,
|
|
57
|
+
language: "unknown",
|
|
58
|
+
module: {
|
|
59
|
+
title: "stub",
|
|
60
|
+
language: "unknown",
|
|
61
|
+
analysisMode: "fallback",
|
|
62
|
+
fallbackReason: "builtin_stub",
|
|
63
|
+
},
|
|
64
|
+
symbols: [],
|
|
65
|
+
}),
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
/** Default host builtin from the published kibi-plugin-builtin package. */
|
|
71
|
+
async function defaultBuiltinFactory() {
|
|
72
|
+
const mod = (await import("kibi-plugin-builtin"));
|
|
73
|
+
const plugin = mod.kibiPlugin;
|
|
74
|
+
if (!plugin) {
|
|
75
|
+
throw new Error("kibi-plugin-builtin did not export kibiPlugin");
|
|
76
|
+
}
|
|
77
|
+
const validated = validateKibiPlugin(plugin);
|
|
78
|
+
let packageVersion = validated.version;
|
|
79
|
+
try {
|
|
80
|
+
const { createRequire } = await import("node:module");
|
|
81
|
+
const require = createRequire(import.meta.url);
|
|
82
|
+
const builtinPackageJson = require("kibi-plugin-builtin/package.json");
|
|
83
|
+
if (typeof builtinPackageJson.version === "string" &&
|
|
84
|
+
builtinPackageJson.version.trim()) {
|
|
85
|
+
packageVersion = builtinPackageJson.version.trim();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
// Fall back to the export version when package.json is not resolvable.
|
|
90
|
+
}
|
|
91
|
+
if (validated.version !== packageVersion) {
|
|
92
|
+
throw new Error(`kibi-plugin-builtin export version '${validated.version}' does not match package.json version '${packageVersion}'`);
|
|
93
|
+
}
|
|
94
|
+
return { ...validated, version: packageVersion };
|
|
95
|
+
}
|
|
96
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
97
|
+
function stampFor(plugin, capability, mode, external, model) {
|
|
98
|
+
return {
|
|
99
|
+
pluginId: plugin.id,
|
|
100
|
+
pluginVersion: plugin.version,
|
|
101
|
+
capability,
|
|
102
|
+
mode: mode === "builtin" ? "augment" : mode,
|
|
103
|
+
external,
|
|
104
|
+
network: plugin.permissions.network,
|
|
105
|
+
metered: plugin.permissions.metered,
|
|
106
|
+
...(model !== undefined ? { model } : {}),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
110
|
+
function disclosedModel(capability) {
|
|
111
|
+
if (typeof capability !== "object" || capability === null)
|
|
112
|
+
return undefined;
|
|
113
|
+
if (!("model" in capability))
|
|
114
|
+
return undefined;
|
|
115
|
+
const model = capability.model;
|
|
116
|
+
return typeof model === "string" && model.trim() !== ""
|
|
117
|
+
? model.trim()
|
|
118
|
+
: undefined;
|
|
119
|
+
}
|
|
120
|
+
function bindingFor(plugin, packageName, mode, capabilityId, capability) {
|
|
121
|
+
const external = packageName !== null;
|
|
122
|
+
return {
|
|
123
|
+
pluginId: plugin.id,
|
|
124
|
+
pluginVersion: plugin.version,
|
|
125
|
+
packageName,
|
|
126
|
+
mode,
|
|
127
|
+
permissions: plugin.permissions,
|
|
128
|
+
external,
|
|
129
|
+
capability,
|
|
130
|
+
stamp: stampFor(plugin, capabilityId, mode, external, disclosedModel(capability)),
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function capabilityFromPlugin(plugin, capabilityId) {
|
|
134
|
+
const slot = CAPABILITY_SLOT[capabilityId];
|
|
135
|
+
return plugin.capabilities[slot];
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Per-workspace capability registry. Builtin providers are always present;
|
|
139
|
+
* configured packages load lazily the first time a capability is resolved.
|
|
140
|
+
* Not a process-wide singleton — inject or construct per test/runtime.
|
|
141
|
+
*/
|
|
142
|
+
// implements REQ-capability-plugin-activation-disclosure-v1, REQ-capability-plugin-observable-behavior-v1
|
|
143
|
+
export class CapabilityRegistry {
|
|
144
|
+
workspaceRoot;
|
|
145
|
+
builtinFactory;
|
|
146
|
+
readConfig;
|
|
147
|
+
loadPlugin;
|
|
148
|
+
loadPluginOptions;
|
|
149
|
+
injectedConfig;
|
|
150
|
+
builtinPluginPromise;
|
|
151
|
+
configPromise;
|
|
152
|
+
loadedPackages = new Map();
|
|
153
|
+
capabilityCache = new Map();
|
|
154
|
+
constructor(options) {
|
|
155
|
+
this.workspaceRoot = options.workspaceRoot;
|
|
156
|
+
this.builtinFactory = options.builtinFactory ?? defaultBuiltinFactory;
|
|
157
|
+
this.readConfig = options.readConfig ?? readProjectKibiConfig;
|
|
158
|
+
this.loadPlugin = options.loadPlugin ?? loadPluginPackage;
|
|
159
|
+
this.loadPluginOptions = options.loadPluginOptions;
|
|
160
|
+
this.injectedConfig = options.projectConfig;
|
|
161
|
+
}
|
|
162
|
+
async getBuiltinPlugin() {
|
|
163
|
+
this.builtinPluginPromise ??= Promise.resolve(this.builtinFactory()).then((plugin) => validateKibiPlugin(plugin));
|
|
164
|
+
return this.builtinPluginPromise;
|
|
165
|
+
}
|
|
166
|
+
async getProjectConfig() {
|
|
167
|
+
if (this.injectedConfig !== undefined) {
|
|
168
|
+
return this.injectedConfig;
|
|
169
|
+
}
|
|
170
|
+
this.configPromise ??= Promise.resolve(this.readConfig(this.workspaceRoot));
|
|
171
|
+
return this.configPromise;
|
|
172
|
+
}
|
|
173
|
+
async resolveSemanticClassifiers() {
|
|
174
|
+
return this.resolveCapability(SEMANTIC_CLASSIFIER_CAPABILITY_ID);
|
|
175
|
+
}
|
|
176
|
+
async resolveOntologyPacks() {
|
|
177
|
+
return this.resolveCapability(ONTOLOGY_PACK_CAPABILITY_ID);
|
|
178
|
+
}
|
|
179
|
+
async resolveSymbolExtractors() {
|
|
180
|
+
return this.resolveCapability(SYMBOL_EXTRACTOR_CAPABILITY_ID);
|
|
181
|
+
}
|
|
182
|
+
async resolveCapability(capabilityId) {
|
|
183
|
+
const cached = this.capabilityCache.get(capabilityId);
|
|
184
|
+
if (cached)
|
|
185
|
+
return cached;
|
|
186
|
+
const promise = this.buildCapabilityResolution(capabilityId);
|
|
187
|
+
this.capabilityCache.set(capabilityId, promise);
|
|
188
|
+
try {
|
|
189
|
+
return await promise;
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
this.capabilityCache.delete(capabilityId);
|
|
193
|
+
throw error;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Canonical providers only (builtin + optional replace + augment).
|
|
198
|
+
* Shadow bindings are excluded.
|
|
199
|
+
*/
|
|
200
|
+
canonicalProviders(resolution) {
|
|
201
|
+
if (resolution.replace) {
|
|
202
|
+
return [resolution.replace, ...resolution.augment];
|
|
203
|
+
}
|
|
204
|
+
return [resolution.builtin, ...resolution.augment];
|
|
205
|
+
}
|
|
206
|
+
async buildCapabilityResolution(capabilityId) {
|
|
207
|
+
const builtinPlugin = await this.getBuiltinPlugin();
|
|
208
|
+
const builtinCapability = capabilityFromPlugin(builtinPlugin, capabilityId);
|
|
209
|
+
if (!builtinCapability) {
|
|
210
|
+
throw new PluginResolutionError("BUILTIN_MISSING_CAPABILITY", `Builtin plugin '${builtinPlugin.id}' does not provide ${capabilityId}`);
|
|
211
|
+
}
|
|
212
|
+
const builtin = bindingFor(builtinPlugin, null, "builtin", capabilityId, builtinCapability);
|
|
213
|
+
const config = await this.getProjectConfig();
|
|
214
|
+
const entries = config.plugins ?? [];
|
|
215
|
+
const relevant = entries.filter((entry) => entry.capabilities[capabilityId] !== undefined);
|
|
216
|
+
let replace = null;
|
|
217
|
+
const augment = [];
|
|
218
|
+
const shadow = [];
|
|
219
|
+
const pluginIds = new Map([
|
|
220
|
+
[builtinPlugin.id, "kibi-plugin-builtin"],
|
|
221
|
+
]);
|
|
222
|
+
const providerIds = new Set([
|
|
223
|
+
capabilityFromPlugin(builtinPlugin, capabilityId)?.id ?? builtinPlugin.id,
|
|
224
|
+
]);
|
|
225
|
+
for (const entry of relevant) {
|
|
226
|
+
const modeConfig = entry.capabilities[capabilityId];
|
|
227
|
+
if (!modeConfig)
|
|
228
|
+
continue;
|
|
229
|
+
const loaded = await this.ensurePackageLoaded(entry);
|
|
230
|
+
const owner = pluginIds.get(loaded.plugin.id);
|
|
231
|
+
if (owner !== undefined && owner !== entry.package) {
|
|
232
|
+
throw new PluginResolutionError("DUPLICATE_PLUGIN_ID", `Plugin id '${loaded.plugin.id}' is claimed by both '${owner}' and '${entry.package}'`);
|
|
233
|
+
}
|
|
234
|
+
pluginIds.set(loaded.plugin.id, entry.package);
|
|
235
|
+
const capability = capabilityFromPlugin(loaded.plugin, capabilityId);
|
|
236
|
+
if (!capability) {
|
|
237
|
+
throw new PluginResolutionError("PLUGIN_MISSING_CAPABILITY", `Plugin package '${entry.package}' is activated for ${capabilityId} but does not export that capability`);
|
|
238
|
+
}
|
|
239
|
+
if ("id" in capability && typeof capability.id === "string") {
|
|
240
|
+
if (providerIds.has(capability.id)) {
|
|
241
|
+
throw new PluginResolutionError("DUPLICATE_PROVIDER_ID", `Provider id '${capability.id}' for ${capabilityId} is not unique`);
|
|
242
|
+
}
|
|
243
|
+
providerIds.add(capability.id);
|
|
244
|
+
}
|
|
245
|
+
const binding = bindingFor(loaded.plugin, entry.package, modeConfig.mode, capabilityId, capability);
|
|
246
|
+
if (modeConfig.mode === "replace") {
|
|
247
|
+
if (replace !== null) {
|
|
248
|
+
throw new PluginResolutionError("MULTIPLE_REPLACE_PROVIDERS", `At most one replace provider is allowed for ${capabilityId}; both '${replace.packageName}' and '${entry.package}' requested replace`);
|
|
249
|
+
}
|
|
250
|
+
replace = binding;
|
|
251
|
+
}
|
|
252
|
+
else if (modeConfig.mode === "augment") {
|
|
253
|
+
augment.push(binding);
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
shadow.push(binding);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return { builtin, replace, augment, shadow };
|
|
260
|
+
}
|
|
261
|
+
async ensurePackageLoaded(entry) {
|
|
262
|
+
const existing = this.loadedPackages.get(entry.package);
|
|
263
|
+
if (existing)
|
|
264
|
+
return existing;
|
|
265
|
+
const loadOptions = this.loadPluginOptions;
|
|
266
|
+
const promise = this.loadPlugin(this.workspaceRoot, entry.package, loadOptions);
|
|
267
|
+
this.loadedPackages.set(entry.package, promise);
|
|
268
|
+
try {
|
|
269
|
+
return await promise;
|
|
270
|
+
}
|
|
271
|
+
catch (error) {
|
|
272
|
+
if (this.loadedPackages.get(entry.package) === promise) {
|
|
273
|
+
this.loadedPackages.delete(entry.package);
|
|
274
|
+
}
|
|
275
|
+
throw error;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Explicit cache keyed by workspace root. Injectable — not a hidden global.
|
|
281
|
+
*/
|
|
282
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
283
|
+
export class CapabilityRegistryCache {
|
|
284
|
+
registries = new Map();
|
|
285
|
+
get(workspaceRoot) {
|
|
286
|
+
return this.registries.get(workspaceRoot);
|
|
287
|
+
}
|
|
288
|
+
getOrCreate(workspaceRoot, options) {
|
|
289
|
+
const existing = this.registries.get(workspaceRoot);
|
|
290
|
+
if (existing)
|
|
291
|
+
return existing;
|
|
292
|
+
const registry = new CapabilityRegistry({
|
|
293
|
+
workspaceRoot,
|
|
294
|
+
...options,
|
|
295
|
+
});
|
|
296
|
+
this.registries.set(workspaceRoot, registry);
|
|
297
|
+
return registry;
|
|
298
|
+
}
|
|
299
|
+
set(workspaceRoot, registry) {
|
|
300
|
+
this.registries.set(workspaceRoot, registry);
|
|
301
|
+
}
|
|
302
|
+
clear() {
|
|
303
|
+
this.registries.clear();
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
307
|
+
export function createCapabilityRegistry(options) {
|
|
308
|
+
return new CapabilityRegistry(options);
|
|
309
|
+
}
|
|
310
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
311
|
+
export function createCapabilityRegistryCache() {
|
|
312
|
+
return new CapabilityRegistryCache();
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Lazily construct and cache a registry per workspace root.
|
|
316
|
+
* Callers should supply a cache instance — there is no process-global store.
|
|
317
|
+
*/
|
|
318
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
319
|
+
export function ensureCapabilityRegistry(workspaceRootOrOptions, options) {
|
|
320
|
+
if (typeof workspaceRootOrOptions === "string") {
|
|
321
|
+
const { cache, ...registryOptions } = options ?? {};
|
|
322
|
+
if (cache) {
|
|
323
|
+
return cache.getOrCreate(workspaceRootOrOptions, registryOptions);
|
|
324
|
+
}
|
|
325
|
+
return new CapabilityRegistry({
|
|
326
|
+
workspaceRoot: workspaceRootOrOptions,
|
|
327
|
+
...registryOptions,
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
const { workspaceRoot, cache, ...registryOptions } = workspaceRootOrOptions;
|
|
331
|
+
if (cache) {
|
|
332
|
+
return cache.getOrCreate(workspaceRoot, registryOptions);
|
|
333
|
+
}
|
|
334
|
+
return new CapabilityRegistry({
|
|
335
|
+
workspaceRoot,
|
|
336
|
+
...registryOptions,
|
|
337
|
+
});
|
|
338
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { PluginValidationError } from "kibi-plugin-sdk";
|
|
2
|
+
import { type ProjectPackageManifest } from "./project-config.js";
|
|
3
|
+
export declare class PluginResolutionError extends Error {
|
|
4
|
+
readonly code: string;
|
|
5
|
+
constructor(code: string, message: string);
|
|
6
|
+
}
|
|
7
|
+
export type ResolvedProjectPackage = Readonly<{
|
|
8
|
+
packageName: string;
|
|
9
|
+
packageRoot: string;
|
|
10
|
+
packageJsonPath: string;
|
|
11
|
+
packageJson: ProjectPackageManifest & Readonly<Record<string, unknown>>;
|
|
12
|
+
/** Absolute filesystem path of the package entry used for dynamic import. */
|
|
13
|
+
entryPath: string;
|
|
14
|
+
/** file:// URL for dynamic import. */
|
|
15
|
+
entryUrl: string;
|
|
16
|
+
}>;
|
|
17
|
+
/**
|
|
18
|
+
* Bare npm package names only. Paths, URLs, subpaths, and aliases are rejected.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isBarePackageName(packageName: string): boolean;
|
|
21
|
+
export declare function assertBarePackageName(packageName: string): void;
|
|
22
|
+
export declare function hasDeclaredProjectDependency(workspaceRoot: string, packageName: string, manifest?: ProjectPackageManifest): boolean;
|
|
23
|
+
export declare function hasConsumerNodeModulesLink(workspaceRoot: string, packageName: string, packageRoot: string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Same project-scope policy as packages/cursor/bin/launch-kibi-mcp.mjs:
|
|
26
|
+
* within workspace OR node_modules symlink OR Yarn PnP active resolver.
|
|
27
|
+
* Rejects NODE_PATH / global / ambient packages.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isProjectScopedPackage(workspaceRoot: string, packageName: string, packageRoot: string): boolean;
|
|
30
|
+
export declare function packageJsonForResolvedFile(startPath: string, expectedPackageName: string): {
|
|
31
|
+
packageJsonPath: string;
|
|
32
|
+
packageRoot: string;
|
|
33
|
+
packageJson: ProjectPackageManifest & Readonly<Record<string, unknown>>;
|
|
34
|
+
} | null;
|
|
35
|
+
/**
|
|
36
|
+
* Confine a resolved entry to the realpath'd package root. Rejects
|
|
37
|
+
* `exports`/`main` traversal and symlink escapes.
|
|
38
|
+
*/
|
|
39
|
+
export declare function assertResolvedEntryInsidePackageRoot(packageRoot: string, entryPath: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Resolve a declared project-local plugin package through the workspace
|
|
42
|
+
* package.json require graph. NODE_PATH / global / path / URL references fail.
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolveProjectLocalPackage(workspaceRoot: string, packageName: string): ResolvedProjectPackage;
|
|
45
|
+
/** Re-export for callers that catch SDK validation failures as resolution errors. */
|
|
46
|
+
export { PluginValidationError };
|
|
47
|
+
//# sourceMappingURL=resolve-package.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-package.d.ts","sourceRoot":"","sources":["../../src/plugins/resolve-package.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,EACL,KAAK,sBAAsB,EAE5B,MAAM,qBAAqB,CAAC;AAG7B,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK1C;AAGD,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,sBAAsB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACxE,6EAA6E;IAC7E,SAAS,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC,CAAC;AAmBH;;GAEG;AAEH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAoB9D;AAGD,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAO/D;AAGD,wBAAgB,4BAA4B,CAC1C,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,sBAAsB,GAChC,OAAO,CAaT;AAGD,wBAAgB,0BAA0B,CACxC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,OAAO,CAeT;AAED;;;;GAIG;AAEH,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,OAAO,CAMT;AAGD,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,MAAM,EACjB,mBAAmB,EAAE,MAAM,GAC1B;IACD,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,sBAAsB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACzE,GAAG,IAAI,CA0BP;AAED;;;GAGG;AAEH,wBAAgB,oCAAoC,CAClD,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAChB,MAAM,CAoCR;AA0DD;;;GAGG;AAEH,wBAAgB,0BAA0B,CACxC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,GAClB,sBAAsB,CAgExB;AAED,qFAAqF;AACrF,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|