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
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import * as fs from "node:fs";
|
|
19
19
|
import * as path from "node:path";
|
|
20
|
+
import { createSourceAnalysisService, } from "../plugins/source-analysis-service.js";
|
|
20
21
|
import { createTsMorphSourceAnalysisProvider, enrichSymbolCoordinatesWithTsMorph, } from "./symbols-ts.js";
|
|
21
22
|
const TS_JS_EXTENSIONS = new Set([
|
|
22
23
|
".ts",
|
|
@@ -60,6 +61,7 @@ export function analyzeSourceText(filePathOrEntries, contentOrWorkspaceRoot, opt
|
|
|
60
61
|
if (Array.isArray(filePathOrEntries)) {
|
|
61
62
|
return enrichSymbolCoordinates(filePathOrEntries, contentOrWorkspaceRoot, optionsOrDeps);
|
|
62
63
|
}
|
|
64
|
+
// Sync path: ignore registry (async callers use analyzeSourceTextWithRegistry).
|
|
63
65
|
const providers = optionsOrDeps?.providers ??
|
|
64
66
|
DEFAULT_SOURCE_ANALYSIS_PROVIDERS;
|
|
65
67
|
for (const provider of providers) {
|
|
@@ -74,6 +76,44 @@ export function analyzeSourceText(filePathOrEntries, contentOrWorkspaceRoot, opt
|
|
|
74
76
|
}
|
|
75
77
|
return createFallbackAnalysis(filePathOrEntries, "unsupported_language");
|
|
76
78
|
}
|
|
79
|
+
function toCoordinatorResult(result) {
|
|
80
|
+
return {
|
|
81
|
+
sourceFile: result.sourceFile,
|
|
82
|
+
language: result.language,
|
|
83
|
+
providerId: result.providerId,
|
|
84
|
+
module: {
|
|
85
|
+
title: result.module.title,
|
|
86
|
+
language: result.module.language,
|
|
87
|
+
analysisMode: result.module.analysisMode,
|
|
88
|
+
...(result.module.fallbackReason
|
|
89
|
+
? { fallbackReason: result.module.fallbackReason }
|
|
90
|
+
: {}),
|
|
91
|
+
},
|
|
92
|
+
symbols: result.symbols.map((symbol) => ({
|
|
93
|
+
name: symbol.name,
|
|
94
|
+
kind: symbol.kind,
|
|
95
|
+
startLine: symbol.startLine,
|
|
96
|
+
startColumn: symbol.startColumn,
|
|
97
|
+
endLine: symbol.endLine,
|
|
98
|
+
endColumn: symbol.endColumn,
|
|
99
|
+
...(symbol.directiveText ? { directiveText: symbol.directiveText } : {}),
|
|
100
|
+
})),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Prefer the capability registry / SourceAnalysisService when available.
|
|
105
|
+
* Falls back to the sync builtin ts-morph provider path on registry failure.
|
|
106
|
+
*/
|
|
107
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
108
|
+
export async function analyzeSourceTextWithRegistry(filePath, content, registry) {
|
|
109
|
+
try {
|
|
110
|
+
const service = createSourceAnalysisService({ registry });
|
|
111
|
+
return toCoordinatorResult(await service.analyzeText(filePath, content));
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
return analyzeSourceText(filePath, content);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
77
117
|
export async function enrichSymbolCoordinates(entries, workspaceRoot, deps) {
|
|
78
118
|
// implements REQ-vscode-traceability
|
|
79
119
|
const enrichTsCoordinates = deps?.enrichTsCoordinates ?? enrichSymbolCoordinatesWithTsMorph;
|
|
@@ -1,23 +1,12 @@
|
|
|
1
|
+
import { type ManifestSymbolEntry as BuiltinManifestSymbolEntry, type SymbolCoordinates as BuiltinSymbolCoordinates, isPrivateClassMember as isBuiltinPrivateClassMember } from "kibi-plugin-builtin";
|
|
1
2
|
import type { SourceAnalysisProvider } from "./symbols-coordinator.js";
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export interface ManifestSymbolEntry {
|
|
10
|
-
id: string;
|
|
11
|
-
title: string;
|
|
12
|
-
sourceFile?: string;
|
|
13
|
-
sourceLine?: number;
|
|
14
|
-
sourceColumn?: number;
|
|
15
|
-
sourceEndLine?: number;
|
|
16
|
-
sourceEndColumn?: number;
|
|
17
|
-
coordinatesGeneratedAt?: string;
|
|
18
|
-
links?: string[];
|
|
19
|
-
[key: string]: unknown;
|
|
20
|
-
}
|
|
3
|
+
export type SymbolCoordinates = BuiltinSymbolCoordinates;
|
|
4
|
+
export type ManifestSymbolEntry = BuiltinManifestSymbolEntry;
|
|
5
|
+
export declare const isPrivateClassMember: typeof isBuiltinPrivateClassMember;
|
|
6
|
+
/**
|
|
7
|
+
* Thin host adapter over kibi-plugin-builtin's ts-morph extractor.
|
|
8
|
+
* Preserves the historical `ts-morph` provider id for sync callers and tests.
|
|
9
|
+
*/
|
|
21
10
|
export declare function createTsMorphSourceAnalysisProvider(): SourceAnalysisProvider;
|
|
22
11
|
export declare function enrichSymbolCoordinatesWithTsMorph(entries: ManifestSymbolEntry[], workspaceRoot: string): Promise<ManifestSymbolEntry[]>;
|
|
23
12
|
export declare function onlyCandidate<T>(candidates: readonly T[]): T | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symbols-ts.d.ts","sourceRoot":"","sources":["../../src/extractors/symbols-ts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"symbols-ts.d.ts","sourceRoot":"","sources":["../../src/extractors/symbols-ts.ts"],"names":[],"mappings":"AAiBA,OAAO,EACL,KAAK,mBAAmB,IAAI,0BAA0B,EACtD,KAAK,iBAAiB,IAAI,wBAAwB,EAGlD,oBAAoB,IAAI,2BAA2B,EAEpD,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACV,sBAAsB,EAEvB,MAAM,0BAA0B,CAAC;AAGlC,MAAM,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AAEzD,MAAM,MAAM,mBAAmB,GAAG,0BAA0B,CAAC;AAG7D,eAAO,MAAM,oBAAoB,oCAA8B,CAAC;AAEhE;;;GAGG;AAEH,wBAAgB,mCAAmC,IAAI,sBAAsB,CAmC5E;AAGD,wBAAsB,kCAAkC,CACtD,OAAO,EAAE,mBAAmB,EAAE,EAC9B,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAGhC;AAGD,wBAAgB,aAAa,CAAC,CAAC,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,GAAG,SAAS,CAExE"}
|
|
@@ -15,526 +15,56 @@
|
|
|
15
15
|
You should have received a copy of the GNU Affero General Public License
|
|
16
16
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
".jsx",
|
|
26
|
-
".mts",
|
|
27
|
-
".cts",
|
|
28
|
-
".mjs",
|
|
29
|
-
".cjs",
|
|
30
|
-
]);
|
|
18
|
+
import { createBuiltinTsMorphSourceAnalysisProvider, enrichSymbolCoordinatesWithTsMorph as enrichBuiltinSymbolCoordinates, isPrivateClassMember as isBuiltinPrivateClassMember, onlyCandidate as onlyBuiltinCandidate, } from "kibi-plugin-builtin";
|
|
19
|
+
// implements REQ-capability-plugin-builtin-parity-v1
|
|
20
|
+
export const isPrivateClassMember = isBuiltinPrivateClassMember;
|
|
21
|
+
/**
|
|
22
|
+
* Thin host adapter over kibi-plugin-builtin's ts-morph extractor.
|
|
23
|
+
* Preserves the historical `ts-morph` provider id for sync callers and tests.
|
|
24
|
+
*/
|
|
31
25
|
// implements REQ-001
|
|
32
26
|
export function createTsMorphSourceAnalysisProvider() {
|
|
33
|
-
const
|
|
34
|
-
skipAddingFilesFromTsConfig: true,
|
|
35
|
-
});
|
|
27
|
+
const provider = createBuiltinTsMorphSourceAnalysisProvider();
|
|
36
28
|
return {
|
|
37
29
|
id: "ts-morph",
|
|
38
30
|
supportsFile(filePath) {
|
|
39
|
-
return
|
|
31
|
+
return provider.supportsFile(filePath);
|
|
40
32
|
},
|
|
41
33
|
analyzeText(filePath, content) {
|
|
42
|
-
const
|
|
43
|
-
overwrite: true,
|
|
44
|
-
scriptKind: chooseScriptKind(filePath),
|
|
45
|
-
});
|
|
34
|
+
const result = provider.analyzeText(filePath, content);
|
|
46
35
|
return {
|
|
47
|
-
sourceFile:
|
|
48
|
-
language:
|
|
36
|
+
sourceFile: result.sourceFile,
|
|
37
|
+
language: result.language,
|
|
49
38
|
providerId: "ts-morph",
|
|
50
39
|
module: {
|
|
51
|
-
title:
|
|
52
|
-
language:
|
|
53
|
-
analysisMode:
|
|
40
|
+
title: result.module.title,
|
|
41
|
+
language: result.module.language,
|
|
42
|
+
analysisMode: result.module.analysisMode,
|
|
43
|
+
...(result.module.fallbackReason
|
|
44
|
+
? { fallbackReason: result.module.fallbackReason }
|
|
45
|
+
: {}),
|
|
54
46
|
},
|
|
55
|
-
symbols:
|
|
47
|
+
symbols: result.symbols.map((symbol) => ({
|
|
48
|
+
name: symbol.name,
|
|
49
|
+
kind: symbol.kind,
|
|
50
|
+
startLine: symbol.startLine,
|
|
51
|
+
startColumn: symbol.startColumn,
|
|
52
|
+
endLine: symbol.endLine,
|
|
53
|
+
endColumn: symbol.endColumn,
|
|
54
|
+
...(symbol.directiveText
|
|
55
|
+
? { directiveText: symbol.directiveText }
|
|
56
|
+
: {}),
|
|
57
|
+
})),
|
|
56
58
|
};
|
|
57
59
|
},
|
|
58
60
|
};
|
|
59
61
|
}
|
|
62
|
+
// implements REQ-capability-plugin-builtin-parity-v1
|
|
60
63
|
export async function enrichSymbolCoordinatesWithTsMorph(entries, workspaceRoot) {
|
|
61
64
|
// implements REQ-vscode-traceability
|
|
62
|
-
|
|
63
|
-
skipAddingFilesFromTsConfig: true,
|
|
64
|
-
});
|
|
65
|
-
const sourceFileCache = new Map();
|
|
66
|
-
const enriched = [];
|
|
67
|
-
for (const entry of entries) {
|
|
68
|
-
try {
|
|
69
|
-
const absolutePath = await resolveSourcePath(entry.sourceFile, workspaceRoot);
|
|
70
|
-
if (!absolutePath) {
|
|
71
|
-
enriched.push(entry);
|
|
72
|
-
continue;
|
|
73
|
-
}
|
|
74
|
-
const sourceFile = getOrAddSourceFile(project, sourceFileCache, absolutePath);
|
|
75
|
-
if (!sourceFile) {
|
|
76
|
-
enriched.push(await enrichWithTextFallback(entry, absolutePath));
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
const match = findNamedDeclaration(sourceFile, entry.title);
|
|
80
|
-
if (!match) {
|
|
81
|
-
enriched.push(entry);
|
|
82
|
-
continue;
|
|
83
|
-
}
|
|
84
|
-
const nameStart = match.getNameNode().getStart();
|
|
85
|
-
const end = match.node.getEnd();
|
|
86
|
-
const startLc = sourceFile.getLineAndColumnAtPos(nameStart);
|
|
87
|
-
const endLc = sourceFile.getLineAndColumnAtPos(end);
|
|
88
|
-
const coordinates = {
|
|
89
|
-
sourceLine: startLc.line,
|
|
90
|
-
sourceColumn: Math.max(0, startLc.column - 1),
|
|
91
|
-
sourceEndLine: endLc.line,
|
|
92
|
-
sourceEndColumn: Math.max(0, endLc.column - 1),
|
|
93
|
-
coordinatesGeneratedAt: new Date().toISOString(),
|
|
94
|
-
};
|
|
95
|
-
enriched.push({
|
|
96
|
-
...entry,
|
|
97
|
-
...coordinates,
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
catch (error) {
|
|
101
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
102
|
-
console.warn(`[kibi] Failed to enrich symbol coordinates for ${entry.id}: ${message}`);
|
|
103
|
-
const absolutePath = await resolveSourcePath(entry.sourceFile, workspaceRoot);
|
|
104
|
-
if (!absolutePath) {
|
|
105
|
-
enriched.push(entry);
|
|
106
|
-
continue;
|
|
107
|
-
}
|
|
108
|
-
enriched.push(await enrichWithTextFallback(entry, absolutePath));
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
return enriched;
|
|
112
|
-
}
|
|
113
|
-
async function resolveSourcePath(sourceFile, workspaceRoot) {
|
|
114
|
-
if (!sourceFile)
|
|
115
|
-
return null;
|
|
116
|
-
const absolute = path.isAbsolute(sourceFile)
|
|
117
|
-
? sourceFile
|
|
118
|
-
: path.resolve(workspaceRoot, sourceFile);
|
|
119
|
-
const ext = path.extname(absolute).toLowerCase();
|
|
120
|
-
if (!SUPPORTED_SOURCE_EXTENSIONS.has(ext))
|
|
121
|
-
return null;
|
|
122
|
-
try {
|
|
123
|
-
await access(absolute);
|
|
124
|
-
}
|
|
125
|
-
catch {
|
|
126
|
-
return null;
|
|
127
|
-
}
|
|
128
|
-
return absolute;
|
|
129
|
-
}
|
|
130
|
-
function getOrAddSourceFile(project, cache, absolutePath) {
|
|
131
|
-
const cached = cache.get(absolutePath);
|
|
132
|
-
if (cached)
|
|
133
|
-
return cached;
|
|
134
|
-
try {
|
|
135
|
-
const sourceFile = project.addSourceFileAtPath(absolutePath);
|
|
136
|
-
cache.set(absolutePath, sourceFile);
|
|
137
|
-
return sourceFile;
|
|
138
|
-
}
|
|
139
|
-
catch {
|
|
140
|
-
return null;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
function enrichWithTextFallback(entry, absolutePath) {
|
|
144
|
-
return enrichWithTextFallbackInternal(entry, absolutePath);
|
|
145
|
-
}
|
|
146
|
-
async function enrichWithTextFallbackInternal(entry, absolutePath) {
|
|
147
|
-
try {
|
|
148
|
-
const content = await readFile(absolutePath, "utf8");
|
|
149
|
-
const lines = content.split(/\r?\n/);
|
|
150
|
-
const escapedTitle = entry.title.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
151
|
-
const pattern = new RegExp(`\\b${escapedTitle}\\b`);
|
|
152
|
-
for (let index = 0; index < lines.length; index++) {
|
|
153
|
-
const line = lines[index];
|
|
154
|
-
if (!line)
|
|
155
|
-
continue;
|
|
156
|
-
const match = pattern.exec(line);
|
|
157
|
-
if (!match || match.index < 0)
|
|
158
|
-
continue;
|
|
159
|
-
return {
|
|
160
|
-
...entry,
|
|
161
|
-
sourceLine: index + 1,
|
|
162
|
-
sourceColumn: match.index,
|
|
163
|
-
sourceEndLine: index + 1,
|
|
164
|
-
sourceEndColumn: match.index + entry.title.length,
|
|
165
|
-
coordinatesGeneratedAt: new Date().toISOString(),
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
return entry;
|
|
169
|
-
}
|
|
170
|
-
catch {
|
|
171
|
-
return entry;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
function collectSourceSymbols(sourceFile) {
|
|
175
|
-
const symbols = [];
|
|
176
|
-
for (const decl of sourceFile.getFunctions()) {
|
|
177
|
-
if (!decl.isExported())
|
|
178
|
-
continue;
|
|
179
|
-
symbols.push(toSourceSymbolAnalysis(sourceFile, decl.getName() ?? "<anonymous>", "function", decl.getNameNode() ?? decl, decl, `${decl.getFullText()}\n${decl
|
|
180
|
-
.getJsDocs()
|
|
181
|
-
.map((doc) => doc.getFullText())
|
|
182
|
-
.join("\n")}`));
|
|
183
|
-
}
|
|
184
|
-
for (const decl of sourceFile.getClasses()) {
|
|
185
|
-
if (!decl.isExported())
|
|
186
|
-
continue;
|
|
187
|
-
symbols.push(toSourceSymbolAnalysis(sourceFile, decl.getName() ?? "<anonymous>", "class", decl.getNameNode() ?? decl, decl, decl
|
|
188
|
-
.getJsDocs()
|
|
189
|
-
.map((doc) => doc.getFullText())
|
|
190
|
-
.join("\n")));
|
|
191
|
-
appendClassMembers(sourceFile, decl, decl.getName(), symbols);
|
|
192
|
-
}
|
|
193
|
-
for (const decl of sourceFile.getInterfaces()) {
|
|
194
|
-
if (!decl.isExported())
|
|
195
|
-
continue;
|
|
196
|
-
symbols.push(toSourceSymbolAnalysis(sourceFile, decl.getName() ?? "<anonymous>", "interface", decl.getNameNode() ?? decl, decl, decl.getText()));
|
|
197
|
-
}
|
|
198
|
-
for (const decl of sourceFile.getTypeAliases()) {
|
|
199
|
-
if (!decl.isExported())
|
|
200
|
-
continue;
|
|
201
|
-
symbols.push(toSourceSymbolAnalysis(sourceFile, decl.getName() ?? "<anonymous>", "type", decl.getNameNode() ?? decl, decl, decl.getText()));
|
|
202
|
-
}
|
|
203
|
-
for (const decl of sourceFile.getEnums()) {
|
|
204
|
-
if (!decl.isExported())
|
|
205
|
-
continue;
|
|
206
|
-
symbols.push(toSourceSymbolAnalysis(sourceFile, decl.getName() ?? "<anonymous>", "enum", decl.getNameNode() ?? decl, decl, decl.getText()));
|
|
207
|
-
}
|
|
208
|
-
for (const statement of sourceFile.getVariableStatements()) {
|
|
209
|
-
if (!statement.isExported())
|
|
210
|
-
continue;
|
|
211
|
-
for (const declaration of statement.getDeclarations()) {
|
|
212
|
-
symbols.push(toSourceSymbolAnalysis(sourceFile, declaration.getName(), "variable", declaration.getNameNode() ?? declaration, declaration, declaration.getText()));
|
|
213
|
-
const classExpression = declaration.getInitializerIfKind(SyntaxKind.ClassExpression);
|
|
214
|
-
if (classExpression) {
|
|
215
|
-
appendClassMembers(sourceFile, classExpression, declaration.getName(), symbols);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
return symbols;
|
|
220
|
-
}
|
|
221
|
-
function appendClassMembers(sourceFile, declaration, className, symbols) {
|
|
222
|
-
for (const method of declaration.getMethods()) {
|
|
223
|
-
if (isPrivateClassMember(method))
|
|
224
|
-
continue;
|
|
225
|
-
symbols.push(toSourceSymbolAnalysis(sourceFile, formatMethodSymbolName(className, method.getName()), "method", method.getNameNode() ?? method, method, `${method.getFullText()}\n${method
|
|
226
|
-
.getJsDocs()
|
|
227
|
-
.map((doc) => doc.getFullText())
|
|
228
|
-
.join("\n")}`));
|
|
229
|
-
}
|
|
230
|
-
for (const property of declaration.getProperties()) {
|
|
231
|
-
if (isPrivateClassMember(property))
|
|
232
|
-
continue;
|
|
233
|
-
symbols.push(toSourceSymbolAnalysis(sourceFile, formatMethodSymbolName(className, property.getName()), "property", property.getNameNode() ?? property, property, `${property.getFullText()}\n${property
|
|
234
|
-
.getJsDocs()
|
|
235
|
-
.map((doc) => doc.getFullText())
|
|
236
|
-
.join("\n")}`));
|
|
237
|
-
}
|
|
238
|
-
for (const accessor of [
|
|
239
|
-
...declaration.getGetAccessors(),
|
|
240
|
-
...declaration.getSetAccessors(),
|
|
241
|
-
]) {
|
|
242
|
-
if (isPrivateClassMember(accessor))
|
|
243
|
-
continue;
|
|
244
|
-
symbols.push(toSourceSymbolAnalysis(sourceFile, formatMethodSymbolName(className, accessor.getName()), "accessor", accessor.getNameNode() ?? accessor, accessor, `${accessor.getFullText()}\n${accessor
|
|
245
|
-
.getJsDocs()
|
|
246
|
-
.map((doc) => doc.getFullText())
|
|
247
|
-
.join("\n")}`));
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
function isPrivateClassMember(member) {
|
|
251
|
-
return (member.hasModifier(SyntaxKind.PrivateKeyword) ||
|
|
252
|
-
member.getName().startsWith("#"));
|
|
253
|
-
}
|
|
254
|
-
function toSourceSymbolAnalysis(sourceFile, name, kind, startNode, endNode, directiveText) {
|
|
255
|
-
const start = sourceFile.getLineAndColumnAtPos(startNode.getStart());
|
|
256
|
-
const end = sourceFile.getLineAndColumnAtPos(endNode.getEnd());
|
|
257
|
-
return {
|
|
258
|
-
name,
|
|
259
|
-
kind,
|
|
260
|
-
startLine: start.line,
|
|
261
|
-
startColumn: Math.max(0, start.column - 1),
|
|
262
|
-
endLine: end.line,
|
|
263
|
-
endColumn: Math.max(0, end.column - 1),
|
|
264
|
-
directiveText,
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
function formatMethodSymbolName(className, methodName) {
|
|
268
|
-
return className ? `${className}.${methodName}` : methodName;
|
|
269
|
-
}
|
|
270
|
-
function chooseScriptKind(filePath) {
|
|
271
|
-
const lower = filePath.toLowerCase();
|
|
272
|
-
if (lower.endsWith(".tsx"))
|
|
273
|
-
return ScriptKind.TSX;
|
|
274
|
-
if (lower.endsWith(".ts") ||
|
|
275
|
-
lower.endsWith(".mts") ||
|
|
276
|
-
lower.endsWith(".cts")) {
|
|
277
|
-
return ScriptKind.TS;
|
|
278
|
-
}
|
|
279
|
-
if (lower.endsWith(".jsx"))
|
|
280
|
-
return ScriptKind.JSX;
|
|
281
|
-
return ScriptKind.JS;
|
|
282
|
-
}
|
|
283
|
-
function inferSourceLanguage(filePath) {
|
|
284
|
-
const extension = path.extname(filePath).toLowerCase();
|
|
285
|
-
if ([".ts", ".tsx", ".mts", ".cts"].includes(extension)) {
|
|
286
|
-
return "typescript";
|
|
287
|
-
}
|
|
288
|
-
return "javascript";
|
|
289
|
-
}
|
|
290
|
-
function inferModuleTitle(filePath) {
|
|
291
|
-
const extension = path.extname(filePath);
|
|
292
|
-
const basename = path.basename(filePath, extension);
|
|
293
|
-
return basename.length > 0 ? basename : path.basename(filePath);
|
|
65
|
+
return enrichBuiltinSymbolCoordinates(entries, workspaceRoot);
|
|
294
66
|
}
|
|
67
|
+
// implements REQ-capability-plugin-builtin-parity-v1
|
|
295
68
|
export function onlyCandidate(candidates) {
|
|
296
|
-
|
|
297
|
-
return undefined;
|
|
298
|
-
return candidates[0];
|
|
299
|
-
}
|
|
300
|
-
function findNamedDeclaration(sourceFile, title) {
|
|
301
|
-
const qualifiedMethod = parseQualifiedMethodTitle(title);
|
|
302
|
-
if (qualifiedMethod) {
|
|
303
|
-
for (const cls of sourceFile.getClasses()) {
|
|
304
|
-
if (cls.getName() !== qualifiedMethod.className)
|
|
305
|
-
continue;
|
|
306
|
-
const match = findClassMember(cls, qualifiedMethod.methodName);
|
|
307
|
-
if (match)
|
|
308
|
-
return match;
|
|
309
|
-
}
|
|
310
|
-
for (const statement of sourceFile.getVariableStatements()) {
|
|
311
|
-
if (!statement.isExported())
|
|
312
|
-
continue;
|
|
313
|
-
for (const declaration of statement.getDeclarations()) {
|
|
314
|
-
if (declaration.getName() !== qualifiedMethod.className)
|
|
315
|
-
continue;
|
|
316
|
-
const classExpression = declaration.getInitializerIfKind(SyntaxKind.ClassExpression);
|
|
317
|
-
const match = classExpression
|
|
318
|
-
? findClassMember(classExpression, qualifiedMethod.methodName)
|
|
319
|
-
: null;
|
|
320
|
-
if (match)
|
|
321
|
-
return match;
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
return null;
|
|
325
|
-
}
|
|
326
|
-
const candidates = [];
|
|
327
|
-
for (const decl of sourceFile.getFunctions()) {
|
|
328
|
-
if (!decl.isExported())
|
|
329
|
-
continue;
|
|
330
|
-
if (decl.getName() !== title)
|
|
331
|
-
continue;
|
|
332
|
-
const nameNode = decl.getNameNode();
|
|
333
|
-
if (!nameNode)
|
|
334
|
-
continue;
|
|
335
|
-
candidates.push({ node: decl, getNameNode: () => nameNode });
|
|
336
|
-
}
|
|
337
|
-
for (const decl of sourceFile.getClasses()) {
|
|
338
|
-
if (!decl.isExported())
|
|
339
|
-
continue;
|
|
340
|
-
if (decl.getName() !== title)
|
|
341
|
-
continue;
|
|
342
|
-
const nameNode = decl.getNameNode();
|
|
343
|
-
if (!nameNode)
|
|
344
|
-
continue;
|
|
345
|
-
candidates.push({ node: decl, getNameNode: () => nameNode });
|
|
346
|
-
}
|
|
347
|
-
for (const decl of sourceFile.getInterfaces()) {
|
|
348
|
-
if (!decl.isExported())
|
|
349
|
-
continue;
|
|
350
|
-
if (decl.getName() !== title)
|
|
351
|
-
continue;
|
|
352
|
-
const nameNode = decl.getNameNode();
|
|
353
|
-
if (!nameNode)
|
|
354
|
-
continue;
|
|
355
|
-
candidates.push({ node: decl, getNameNode: () => nameNode });
|
|
356
|
-
}
|
|
357
|
-
for (const decl of sourceFile.getTypeAliases()) {
|
|
358
|
-
if (!decl.isExported())
|
|
359
|
-
continue;
|
|
360
|
-
if (decl.getName() !== title)
|
|
361
|
-
continue;
|
|
362
|
-
const nameNode = decl.getNameNode();
|
|
363
|
-
if (!nameNode)
|
|
364
|
-
continue;
|
|
365
|
-
candidates.push({ node: decl, getNameNode: () => nameNode });
|
|
366
|
-
}
|
|
367
|
-
for (const decl of sourceFile.getEnums()) {
|
|
368
|
-
if (!decl.isExported())
|
|
369
|
-
continue;
|
|
370
|
-
if (decl.getName() !== title)
|
|
371
|
-
continue;
|
|
372
|
-
const nameNode = decl.getNameNode();
|
|
373
|
-
if (!nameNode)
|
|
374
|
-
continue;
|
|
375
|
-
candidates.push({ node: decl, getNameNode: () => nameNode });
|
|
376
|
-
}
|
|
377
|
-
for (const statement of sourceFile.getVariableStatements()) {
|
|
378
|
-
if (!statement.isExported())
|
|
379
|
-
continue;
|
|
380
|
-
for (const declaration of statement.getDeclarations()) {
|
|
381
|
-
if (declaration.getName() !== title)
|
|
382
|
-
continue;
|
|
383
|
-
const nameNode = declaration.getNameNode();
|
|
384
|
-
candidates.push({ node: declaration, getNameNode: () => nameNode });
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
if (candidates.length === 0) {
|
|
388
|
-
// Second pass: unique non-exported top-level functions only
|
|
389
|
-
const internalCandidates = [];
|
|
390
|
-
for (const decl of sourceFile.getFunctions()) {
|
|
391
|
-
if (decl.isExported())
|
|
392
|
-
continue; // Already scanned in first pass
|
|
393
|
-
if (decl.getName() !== title)
|
|
394
|
-
continue;
|
|
395
|
-
const nameNode = decl.getNameNode();
|
|
396
|
-
if (!nameNode)
|
|
397
|
-
continue;
|
|
398
|
-
internalCandidates.push({ node: decl, getNameNode: () => nameNode });
|
|
399
|
-
}
|
|
400
|
-
const uniqueInternal = onlyCandidate(internalCandidates);
|
|
401
|
-
if (uniqueInternal) {
|
|
402
|
-
return uniqueInternal;
|
|
403
|
-
}
|
|
404
|
-
// Third pass: unique class methods
|
|
405
|
-
const methodCandidates = [];
|
|
406
|
-
for (const cls of sourceFile.getClasses()) {
|
|
407
|
-
for (const method of cls.getMethods()) {
|
|
408
|
-
if (method.getName() !== title)
|
|
409
|
-
continue;
|
|
410
|
-
const nameNode = method.getNameNode();
|
|
411
|
-
if (!nameNode)
|
|
412
|
-
continue;
|
|
413
|
-
methodCandidates.push({ node: method, getNameNode: () => nameNode });
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
for (const statement of sourceFile.getVariableStatements()) {
|
|
417
|
-
if (!statement.isExported())
|
|
418
|
-
continue;
|
|
419
|
-
for (const declaration of statement.getDeclarations()) {
|
|
420
|
-
const classExpression = declaration.getInitializerIfKind(SyntaxKind.ClassExpression);
|
|
421
|
-
if (!classExpression)
|
|
422
|
-
continue;
|
|
423
|
-
for (const method of classExpression.getMethods()) {
|
|
424
|
-
if (method.getName() !== title)
|
|
425
|
-
continue;
|
|
426
|
-
const nameNode = method.getNameNode();
|
|
427
|
-
if (!nameNode)
|
|
428
|
-
continue;
|
|
429
|
-
methodCandidates.push({
|
|
430
|
-
node: method,
|
|
431
|
-
getNameNode: () => nameNode,
|
|
432
|
-
});
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
const uniqueMethod = onlyCandidate(methodCandidates);
|
|
437
|
-
if (uniqueMethod) {
|
|
438
|
-
return uniqueMethod;
|
|
439
|
-
}
|
|
440
|
-
const memberCandidates = [];
|
|
441
|
-
for (const cls of sourceFile.getClasses()) {
|
|
442
|
-
for (const property of cls.getProperties()) {
|
|
443
|
-
if (property.getName() !== title)
|
|
444
|
-
continue;
|
|
445
|
-
const nameNode = property.getNameNode();
|
|
446
|
-
if (!nameNode)
|
|
447
|
-
continue;
|
|
448
|
-
memberCandidates.push({ node: property, getNameNode: () => nameNode });
|
|
449
|
-
}
|
|
450
|
-
for (const accessor of [
|
|
451
|
-
...cls.getGetAccessors(),
|
|
452
|
-
...cls.getSetAccessors(),
|
|
453
|
-
]) {
|
|
454
|
-
if (accessor.getName() !== title)
|
|
455
|
-
continue;
|
|
456
|
-
const nameNode = accessor.getNameNode();
|
|
457
|
-
if (!nameNode)
|
|
458
|
-
continue;
|
|
459
|
-
memberCandidates.push({ node: accessor, getNameNode: () => nameNode });
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
for (const statement of sourceFile.getVariableStatements()) {
|
|
463
|
-
if (!statement.isExported())
|
|
464
|
-
continue;
|
|
465
|
-
for (const declaration of statement.getDeclarations()) {
|
|
466
|
-
const classExpression = declaration.getInitializerIfKind(SyntaxKind.ClassExpression);
|
|
467
|
-
if (!classExpression)
|
|
468
|
-
continue;
|
|
469
|
-
for (const property of classExpression.getProperties()) {
|
|
470
|
-
if (property.getName() !== title)
|
|
471
|
-
continue;
|
|
472
|
-
const nameNode = property.getNameNode();
|
|
473
|
-
if (!nameNode)
|
|
474
|
-
continue;
|
|
475
|
-
memberCandidates.push({
|
|
476
|
-
node: property,
|
|
477
|
-
getNameNode: () => nameNode,
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
for (const accessor of [
|
|
481
|
-
...classExpression.getGetAccessors(),
|
|
482
|
-
...classExpression.getSetAccessors(),
|
|
483
|
-
]) {
|
|
484
|
-
if (accessor.getName() !== title)
|
|
485
|
-
continue;
|
|
486
|
-
const nameNode = accessor.getNameNode();
|
|
487
|
-
if (!nameNode)
|
|
488
|
-
continue;
|
|
489
|
-
memberCandidates.push({
|
|
490
|
-
node: accessor,
|
|
491
|
-
getNameNode: () => nameNode,
|
|
492
|
-
});
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
const uniqueMember = onlyCandidate(memberCandidates);
|
|
497
|
-
if (uniqueMember) {
|
|
498
|
-
return uniqueMember;
|
|
499
|
-
}
|
|
500
|
-
return null;
|
|
501
|
-
}
|
|
502
|
-
candidates.sort((a, b) => a.getNameNode().getStart() - b.getNameNode().getStart());
|
|
503
|
-
return candidates[0] ?? null;
|
|
504
|
-
}
|
|
505
|
-
function findClassMember(declaration, name) {
|
|
506
|
-
for (const method of declaration.getMethods()) {
|
|
507
|
-
if (method.getName() !== name)
|
|
508
|
-
continue;
|
|
509
|
-
const nameNode = method.getNameNode();
|
|
510
|
-
if (nameNode)
|
|
511
|
-
return { node: method, getNameNode: () => nameNode };
|
|
512
|
-
}
|
|
513
|
-
for (const property of declaration.getProperties()) {
|
|
514
|
-
if (property.getName() !== name)
|
|
515
|
-
continue;
|
|
516
|
-
const nameNode = property.getNameNode();
|
|
517
|
-
if (nameNode)
|
|
518
|
-
return { node: property, getNameNode: () => nameNode };
|
|
519
|
-
}
|
|
520
|
-
for (const accessor of [
|
|
521
|
-
...declaration.getGetAccessors(),
|
|
522
|
-
...declaration.getSetAccessors(),
|
|
523
|
-
]) {
|
|
524
|
-
if (accessor.getName() !== name)
|
|
525
|
-
continue;
|
|
526
|
-
const nameNode = accessor.getNameNode();
|
|
527
|
-
if (nameNode)
|
|
528
|
-
return { node: accessor, getNameNode: () => nameNode };
|
|
529
|
-
}
|
|
530
|
-
return null;
|
|
531
|
-
}
|
|
532
|
-
function parseQualifiedMethodTitle(title) {
|
|
533
|
-
const separatorIndex = title.lastIndexOf(".");
|
|
534
|
-
if (separatorIndex <= 0 || separatorIndex === title.length - 1)
|
|
535
|
-
return null;
|
|
536
|
-
return {
|
|
537
|
-
className: title.slice(0, separatorIndex),
|
|
538
|
-
methodName: title.slice(separatorIndex + 1),
|
|
539
|
-
};
|
|
69
|
+
return onlyBuiltinCandidate(candidates);
|
|
540
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intent-search.d.ts","sourceRoot":"","sources":["../src/intent-search.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"intent-search.d.ts","sourceRoot":"","sources":["../src/intent-search.ts"],"names":[],"mappings":"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"}
|