@shrkcrft/inspector 0.1.0-alpha.30 → 0.1.0-alpha.31
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/acceptance-replay.js +1 -1
- package/dist/agent-contract-templates.js +6 -6
- package/dist/agent-contract.d.ts.map +1 -1
- package/dist/agent-contract.js +13 -8
- package/dist/agent-orchestration.js +2 -2
- package/dist/agent-task-prep.d.ts +16 -0
- package/dist/agent-task-prep.d.ts.map +1 -1
- package/dist/agent-task-prep.js +51 -4
- package/dist/ai-readiness.d.ts.map +1 -1
- package/dist/ai-readiness.js +21 -3
- package/dist/architecture-map.d.ts +16 -0
- package/dist/architecture-map.d.ts.map +1 -1
- package/dist/architecture-map.js +42 -26
- package/dist/area-explore.d.ts +2 -2
- package/dist/area-explore.d.ts.map +1 -1
- package/dist/area-explore.js +36 -16
- package/dist/area-map.d.ts +56 -11
- package/dist/area-map.d.ts.map +1 -1
- package/dist/area-map.js +106 -25
- package/dist/asset-doctor-proposed-exit.d.ts +21 -0
- package/dist/asset-doctor-proposed-exit.d.ts.map +1 -0
- package/dist/asset-doctor-proposed-exit.js +22 -0
- package/dist/asset-provenance.js +1 -1
- package/dist/boundaries-changed-only.d.ts +24 -1
- package/dist/boundaries-changed-only.d.ts.map +1 -1
- package/dist/boundaries-changed-only.js +12 -2
- package/dist/boundary-check-options.model.d.ts +40 -0
- package/dist/boundary-check-options.model.d.ts.map +1 -0
- package/dist/boundary-check-options.model.js +1 -0
- package/dist/boundary-check-result.model.d.ts +89 -0
- package/dist/boundary-check-result.model.d.ts.map +1 -0
- package/dist/boundary-check-result.model.js +1 -0
- package/dist/boundary-configuration-status.d.ts +38 -0
- package/dist/boundary-configuration-status.d.ts.map +1 -0
- package/dist/boundary-configuration-status.js +118 -0
- package/dist/boundary-configuration-status.model.d.ts +37 -0
- package/dist/boundary-configuration-status.model.d.ts.map +1 -0
- package/dist/boundary-configuration-status.model.js +1 -0
- package/dist/boundary-load-issue.model.d.ts +30 -0
- package/dist/boundary-load-issue.model.d.ts.map +1 -0
- package/dist/boundary-load-issue.model.js +1 -0
- package/dist/boundary-rule-check.model.d.ts +44 -0
- package/dist/boundary-rule-check.model.d.ts.map +1 -0
- package/dist/boundary-rule-check.model.js +1 -0
- package/dist/boundary-rule-invalidation.model.d.ts +31 -0
- package/dist/boundary-rule-invalidation.model.d.ts.map +1 -0
- package/dist/boundary-rule-invalidation.model.js +1 -0
- package/dist/boundary-rule-set-diff.model.d.ts +75 -0
- package/dist/boundary-rule-set-diff.model.d.ts.map +1 -0
- package/dist/boundary-rule-set-diff.model.js +1 -0
- package/dist/boundary-rule-sources.d.ts +28 -0
- package/dist/boundary-rule-sources.d.ts.map +1 -0
- package/dist/boundary-rule-sources.js +110 -0
- package/dist/boundary-stale-exception-finding.model.d.ts +12 -0
- package/dist/boundary-stale-exception-finding.model.d.ts.map +1 -0
- package/dist/boundary-stale-exception-finding.model.js +1 -0
- package/dist/boundary-unit-liveness.d.ts +35 -0
- package/dist/boundary-unit-liveness.d.ts.map +1 -0
- package/dist/boundary-unit-liveness.js +71 -0
- package/dist/change-intent.d.ts +3 -0
- package/dist/change-intent.d.ts.map +1 -1
- package/dist/change-intent.js +61 -27
- package/dist/changes-summary.d.ts.map +1 -1
- package/dist/changes-summary.js +19 -9
- package/dist/ci-integrity-report.js +1 -1
- package/dist/ci-predict.d.ts.map +1 -1
- package/dist/ci-predict.js +38 -5
- package/dist/code-intelligence-doctor.d.ts +6 -0
- package/dist/code-intelligence-doctor.d.ts.map +1 -1
- package/dist/code-intelligence-doctor.js +22 -7
- package/dist/command-recommender.d.ts +45 -2
- package/dist/command-recommender.d.ts.map +1 -1
- package/dist/command-recommender.js +41 -263
- package/dist/command-resolution-status.d.ts +44 -0
- package/dist/command-resolution-status.d.ts.map +1 -0
- package/dist/command-resolution-status.js +44 -0
- package/dist/command-safety-level.d.ts +15 -0
- package/dist/command-safety-level.d.ts.map +1 -0
- package/dist/command-safety-level.js +43 -0
- package/dist/command-taxonomy.js +1 -1
- package/dist/compliance-evidence.js +1 -1
- package/dist/compliance-profiles.js +1 -1
- package/dist/construct-registry.d.ts +40 -0
- package/dist/construct-registry.d.ts.map +1 -1
- package/dist/construct-registry.js +186 -82
- package/dist/context-tuning.d.ts +4 -0
- package/dist/context-tuning.d.ts.map +1 -1
- package/dist/context-tuning.js +10 -7
- package/dist/contract-template-registry.d.ts +10 -0
- package/dist/contract-template-registry.d.ts.map +1 -1
- package/dist/contract-template-registry.js +59 -33
- package/dist/contribution-kind.d.ts +52 -0
- package/dist/contribution-kind.d.ts.map +1 -0
- package/dist/contribution-kind.js +52 -0
- package/dist/contribution-load-failures.d.ts +106 -0
- package/dist/contribution-load-failures.d.ts.map +1 -0
- package/dist/contribution-load-failures.js +575 -0
- package/dist/contributions-report.d.ts +28 -0
- package/dist/contributions-report.d.ts.map +1 -0
- package/dist/contributions-report.js +242 -0
- package/dist/convention-registry.d.ts +22 -0
- package/dist/convention-registry.d.ts.map +1 -1
- package/dist/convention-registry.js +79 -39
- package/dist/coverage-report.d.ts.map +1 -1
- package/dist/coverage-report.js +6 -6
- package/dist/custom-checks.d.ts +60 -1
- package/dist/custom-checks.d.ts.map +1 -1
- package/dist/custom-checks.js +159 -6
- package/dist/dashboard/dashboard-data.d.ts +6 -0
- package/dist/dashboard/dashboard-data.d.ts.map +1 -1
- package/dist/dashboard/dashboard-data.js +99 -8
- package/dist/dashboard/dashboard-knowledge.d.ts.map +1 -1
- package/dist/dashboard/dashboard-knowledge.js +14 -2
- package/dist/decision-records.d.ts +20 -0
- package/dist/decision-records.d.ts.map +1 -1
- package/dist/decision-records.js +68 -20
- package/dist/declared-cross-references.d.ts +61 -0
- package/dist/declared-cross-references.d.ts.map +1 -0
- package/dist/declared-cross-references.js +550 -0
- package/dist/declared-gate-plane-rules.d.ts +24 -0
- package/dist/declared-gate-plane-rules.d.ts.map +1 -0
- package/dist/declared-gate-plane-rules.js +39 -0
- package/dist/declared-reference-coverage.d.ts +27 -0
- package/dist/declared-reference-coverage.d.ts.map +1 -0
- package/dist/declared-reference-coverage.js +50 -0
- package/dist/declared-xref-status.d.ts +19 -0
- package/dist/declared-xref-status.d.ts.map +1 -0
- package/dist/declared-xref-status.js +19 -0
- package/dist/delegate-pack-recipes.d.ts +13 -2
- package/dist/delegate-pack-recipes.d.ts.map +1 -1
- package/dist/delegate-pack-recipes.js +45 -14
- package/dist/demo-package.js +2 -2
- package/dist/demo-script.js +2 -2
- package/dist/demo-workflow.js +3 -3
- package/dist/dev-cycle.js +1 -1
- package/dist/dev-session.js +1 -1
- package/dist/doc-references.d.ts +23 -2
- package/dist/doc-references.d.ts.map +1 -1
- package/dist/doc-references.js +96 -17
- package/dist/doctor-result.d.ts +8 -0
- package/dist/doctor-result.d.ts.map +1 -1
- package/dist/doctor-verdict-kind.d.ts +19 -0
- package/dist/doctor-verdict-kind.d.ts.map +1 -0
- package/dist/doctor-verdict-kind.js +19 -0
- package/dist/doctor-verdict.d.ts +18 -0
- package/dist/doctor-verdict.d.ts.map +1 -0
- package/dist/doctor-verdict.js +28 -0
- package/dist/drift.d.ts +17 -0
- package/dist/drift.d.ts.map +1 -1
- package/dist/drift.js +40 -10
- package/dist/entrypoint-matrix.d.ts.map +1 -1
- package/dist/entrypoint-matrix.js +4 -1
- package/dist/feedback-ingestion.d.ts +28 -2
- package/dist/feedback-ingestion.d.ts.map +1 -1
- package/dist/feedback-ingestion.js +68 -19
- package/dist/fix-preview.d.ts.map +1 -1
- package/dist/fix-preview.js +9 -5
- package/dist/framework-extractor-outcomes.d.ts +27 -0
- package/dist/framework-extractor-outcomes.d.ts.map +1 -0
- package/dist/framework-extractor-outcomes.js +83 -0
- package/dist/fuzzy-impact.js +1 -1
- package/dist/healing-plan.d.ts.map +1 -1
- package/dist/healing-plan.js +3 -4
- package/dist/helper-catalog.d.ts +25 -0
- package/dist/helper-catalog.d.ts.map +1 -0
- package/dist/helper-catalog.js +91 -0
- package/dist/helper-registry.d.ts.map +1 -1
- package/dist/helper-registry.js +17 -1
- package/dist/helper-view.d.ts +33 -0
- package/dist/helper-view.d.ts.map +1 -0
- package/dist/helper-view.js +1 -0
- package/dist/i-asset-doctor-flags.d.ts +16 -0
- package/dist/i-asset-doctor-flags.d.ts.map +1 -0
- package/dist/i-asset-doctor-flags.js +1 -0
- package/dist/i-command-resolution.d.ts +22 -0
- package/dist/i-command-resolution.d.ts.map +1 -0
- package/dist/i-command-resolution.js +1 -0
- package/dist/i-command-resolve-options.d.ts +24 -0
- package/dist/i-command-resolve-options.d.ts.map +1 -0
- package/dist/i-command-resolve-options.js +1 -0
- package/dist/i-command-safety.d.ts +13 -0
- package/dist/i-command-safety.d.ts.map +1 -0
- package/dist/i-command-safety.js +1 -0
- package/dist/i-contribution-accepted-entry.d.ts +18 -0
- package/dist/i-contribution-accepted-entry.d.ts.map +1 -0
- package/dist/i-contribution-accepted-entry.js +1 -0
- package/dist/i-contribution-entry-rejection.d.ts +21 -0
- package/dist/i-contribution-entry-rejection.d.ts.map +1 -0
- package/dist/i-contribution-entry-rejection.js +1 -0
- package/dist/i-contribution-file-issue.d.ts +18 -0
- package/dist/i-contribution-file-issue.d.ts.map +1 -0
- package/dist/i-contribution-file-issue.js +1 -0
- package/dist/i-contribution-file-report.d.ts +40 -0
- package/dist/i-contribution-file-report.d.ts.map +1 -0
- package/dist/i-contribution-file-report.js +1 -0
- package/dist/i-contribution-file-validation.d.ts +24 -0
- package/dist/i-contribution-file-validation.d.ts.map +1 -0
- package/dist/i-contribution-file-validation.js +1 -0
- package/dist/i-contributions-report.d.ts +31 -0
- package/dist/i-contributions-report.d.ts.map +1 -0
- package/dist/i-contributions-report.js +1 -0
- package/dist/i-declared-xref-field.d.ts +25 -0
- package/dist/i-declared-xref-field.d.ts.map +1 -0
- package/dist/i-declared-xref-field.js +1 -0
- package/dist/i-declared-xref-issue.d.ts +25 -0
- package/dist/i-declared-xref-issue.d.ts.map +1 -0
- package/dist/i-declared-xref-issue.js +1 -0
- package/dist/i-declared-xref-report.d.ts +48 -0
- package/dist/i-declared-xref-report.d.ts.map +1 -0
- package/dist/i-declared-xref-report.js +1 -0
- package/dist/i-declared-xref-row.d.ts +29 -0
- package/dist/i-declared-xref-row.d.ts.map +1 -0
- package/dist/i-declared-xref-row.js +1 -0
- package/dist/i-doctor-verdict.d.ts +10 -0
- package/dist/i-doctor-verdict.d.ts.map +1 -0
- package/dist/i-doctor-verdict.js +1 -0
- package/dist/i-kind-outcomes.d.ts +13 -0
- package/dist/i-kind-outcomes.d.ts.map +1 -0
- package/dist/i-kind-outcomes.js +1 -0
- package/dist/i-pack-doctor-verdict.d.ts +15 -0
- package/dist/i-pack-doctor-verdict.d.ts.map +1 -0
- package/dist/i-pack-doctor-verdict.js +1 -0
- package/dist/i-probed-id-field.d.ts +17 -0
- package/dist/i-probed-id-field.d.ts.map +1 -0
- package/dist/i-probed-id-field.js +1 -0
- package/dist/i-reference-kind-declaration.d.ts +38 -0
- package/dist/i-reference-kind-declaration.d.ts.map +1 -0
- package/dist/i-reference-kind-declaration.js +1 -0
- package/dist/i-reference-warm-options.d.ts +21 -0
- package/dist/i-reference-warm-options.d.ts.map +1 -0
- package/dist/i-reference-warm-options.js +1 -0
- package/dist/i-registry-outcomes.d.ts +16 -0
- package/dist/i-registry-outcomes.d.ts.map +1 -0
- package/dist/i-registry-outcomes.js +1 -0
- package/dist/i-scaffold-pattern-doctor-report.d.ts +35 -0
- package/dist/i-scaffold-pattern-doctor-report.d.ts.map +1 -0
- package/dist/i-scaffold-pattern-doctor-report.js +1 -0
- package/dist/i-search-tuning-key-probe.d.ts +30 -0
- package/dist/i-search-tuning-key-probe.d.ts.map +1 -0
- package/dist/i-search-tuning-key-probe.js +1 -0
- package/dist/i-search-tuning-lint-issue.d.ts +61 -0
- package/dist/i-search-tuning-lint-issue.d.ts.map +1 -0
- package/dist/i-search-tuning-lint-issue.js +1 -0
- package/dist/i-search-tuning-lint-report.d.ts +38 -0
- package/dist/i-search-tuning-lint-report.d.ts.map +1 -0
- package/dist/i-search-tuning-lint-report.js +1 -0
- package/dist/i-unresolvable-reference-scan.d.ts +14 -0
- package/dist/i-unresolvable-reference-scan.d.ts.map +1 -0
- package/dist/i-unresolvable-reference-scan.js +1 -0
- package/dist/i-unresolvable-reference.d.ts +29 -0
- package/dist/i-unresolvable-reference.d.ts.map +1 -0
- package/dist/i-unresolvable-reference.js +1 -0
- package/dist/i-workspace-profile-payload.d.ts +12 -0
- package/dist/i-workspace-profile-payload.d.ts.map +1 -0
- package/dist/i-workspace-profile-payload.js +1 -0
- package/dist/impact-analysis.d.ts +15 -0
- package/dist/impact-analysis.d.ts.map +1 -1
- package/dist/impact-analysis.js +58 -13
- package/dist/impact-render.d.ts.map +1 -1
- package/dist/impact-render.js +22 -0
- package/dist/import-hygiene.d.ts +35 -1
- package/dist/import-hygiene.d.ts.map +1 -1
- package/dist/import-hygiene.js +107 -13
- package/dist/index.d.ts +141 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +172 -0
- package/dist/inspection-discovery.d.ts +45 -0
- package/dist/inspection-discovery.d.ts.map +1 -0
- package/dist/inspection-discovery.js +70 -0
- package/dist/knowledge-advisory-code.d.ts +17 -0
- package/dist/knowledge-advisory-code.d.ts.map +1 -0
- package/dist/knowledge-advisory-code.js +17 -0
- package/dist/knowledge-aged-entry.d.ts +10 -0
- package/dist/knowledge-aged-entry.d.ts.map +1 -0
- package/dist/knowledge-aged-entry.js +1 -0
- package/dist/knowledge-authoring.d.ts +24 -1
- package/dist/knowledge-authoring.d.ts.map +1 -1
- package/dist/knowledge-authoring.js +46 -7
- package/dist/knowledge-entry-verdict-record.d.ts +22 -0
- package/dist/knowledge-entry-verdict-record.d.ts.map +1 -0
- package/dist/knowledge-entry-verdict-record.js +1 -0
- package/dist/knowledge-entry-verdict.d.ts +17 -0
- package/dist/knowledge-entry-verdict.d.ts.map +1 -0
- package/dist/knowledge-entry-verdict.js +17 -0
- package/dist/knowledge-graph.d.ts +6 -0
- package/dist/knowledge-graph.d.ts.map +1 -1
- package/dist/knowledge-graph.js +18 -7
- package/dist/knowledge-kind-bucket.d.ts +19 -0
- package/dist/knowledge-kind-bucket.d.ts.map +1 -0
- package/dist/knowledge-kind-bucket.js +1 -0
- package/dist/knowledge-load-failure.d.ts +23 -0
- package/dist/knowledge-load-failure.d.ts.map +1 -0
- package/dist/knowledge-load-failure.js +1 -0
- package/dist/knowledge-reference-kind-bucket.d.ts +11 -0
- package/dist/knowledge-reference-kind-bucket.d.ts.map +1 -0
- package/dist/knowledge-reference-kind-bucket.js +1 -0
- package/dist/knowledge-stale-advisory.d.ts +14 -0
- package/dist/knowledge-stale-advisory.d.ts.map +1 -0
- package/dist/knowledge-stale-advisory.js +1 -0
- package/dist/knowledge-stale-coverage.d.ts +19 -0
- package/dist/knowledge-stale-coverage.d.ts.map +1 -0
- package/dist/knowledge-stale-coverage.js +1 -0
- package/dist/knowledge-stale-gate-flags.d.ts +33 -0
- package/dist/knowledge-stale-gate-flags.d.ts.map +1 -0
- package/dist/knowledge-stale-gate-flags.js +1 -0
- package/dist/knowledge-stale-gate-input.d.ts +46 -0
- package/dist/knowledge-stale-gate-input.d.ts.map +1 -0
- package/dist/knowledge-stale-gate-input.js +1 -0
- package/dist/knowledge-stale-gate-result.d.ts +33 -0
- package/dist/knowledge-stale-gate-result.d.ts.map +1 -0
- package/dist/knowledge-stale-gate-result.js +1 -0
- package/dist/knowledge-stale-gate-rule.d.ts +33 -0
- package/dist/knowledge-stale-gate-rule.d.ts.map +1 -0
- package/dist/knowledge-stale-gate-rule.js +1 -0
- package/dist/knowledge-stale-gate-violation.d.ts +13 -0
- package/dist/knowledge-stale-gate-violation.d.ts.map +1 -0
- package/dist/knowledge-stale-gate-violation.js +1 -0
- package/dist/knowledge-stale-gate.d.ts +83 -0
- package/dist/knowledge-stale-gate.d.ts.map +1 -0
- package/dist/knowledge-stale-gate.js +429 -0
- package/dist/knowledge-stale-quality-gate.d.ts +26 -0
- package/dist/knowledge-stale-quality-gate.d.ts.map +1 -0
- package/dist/knowledge-stale-quality-gate.js +110 -0
- package/dist/knowledge-stale.d.ts +122 -9
- package/dist/knowledge-stale.d.ts.map +1 -1
- package/dist/knowledge-stale.js +996 -291
- package/dist/knowledge-unverifiable-reason.d.ts +12 -0
- package/dist/knowledge-unverifiable-reason.d.ts.map +1 -0
- package/dist/knowledge-unverifiable-reason.js +12 -0
- package/dist/loader-diagnostics.d.ts +14 -2
- package/dist/loader-diagnostics.d.ts.map +1 -1
- package/dist/match-terms.d.ts +48 -0
- package/dist/match-terms.d.ts.map +1 -0
- package/dist/match-terms.js +155 -0
- package/dist/migration-profile-registry.d.ts +10 -0
- package/dist/migration-profile-registry.d.ts.map +1 -1
- package/dist/migration-profile-registry.js +57 -34
- package/dist/migration-readiness.d.ts.map +1 -1
- package/dist/migration-readiness.js +1 -3
- package/dist/nearest-id.d.ts +10 -26
- package/dist/nearest-id.d.ts.map +1 -1
- package/dist/nearest-id.js +9 -59
- package/dist/pack-asset-freshness.d.ts +65 -0
- package/dist/pack-asset-freshness.d.ts.map +1 -0
- package/dist/pack-asset-freshness.js +340 -0
- package/dist/pack-author-ux.d.ts +24 -3
- package/dist/pack-author-ux.d.ts.map +1 -1
- package/dist/pack-author-ux.js +87 -93
- package/dist/pack-contributions-inventory.d.ts +79 -39
- package/dist/pack-contributions-inventory.d.ts.map +1 -1
- package/dist/pack-contributions-inventory.js +443 -286
- package/dist/pack-doctor-verdict.d.ts +29 -0
- package/dist/pack-doctor-verdict.d.ts.map +1 -0
- package/dist/pack-doctor-verdict.js +45 -0
- package/dist/pack-doctor.d.ts +74 -1
- package/dist/pack-doctor.d.ts.map +1 -1
- package/dist/pack-doctor.js +281 -1
- package/dist/pack-helper-plan.d.ts +24 -0
- package/dist/pack-helper-plan.d.ts.map +1 -0
- package/dist/pack-helper-plan.js +77 -0
- package/dist/pack-helper-registry.d.ts +14 -0
- package/dist/pack-helper-registry.d.ts.map +1 -1
- package/dist/pack-helper-registry.js +76 -37
- package/dist/pack-manifest-reader.d.ts +8 -0
- package/dist/pack-manifest-reader.d.ts.map +1 -0
- package/dist/pack-manifest-reader.js +79 -0
- package/dist/pack-release-check.d.ts +14 -1
- package/dist/pack-release-check.d.ts.map +1 -1
- package/dist/pack-release-check.js +23 -1
- package/dist/pack-signature-status.d.ts +18 -6
- package/dist/pack-signature-status.d.ts.map +1 -1
- package/dist/pack-signature-status.js +59 -105
- package/dist/pack-test-runner.d.ts +27 -5
- package/dist/pack-test-runner.d.ts.map +1 -1
- package/dist/pack-test-runner.js +91 -35
- package/dist/pack-typecheck.d.ts +8 -0
- package/dist/pack-typecheck.d.ts.map +1 -0
- package/dist/pack-typecheck.js +76 -0
- package/dist/plan-review.d.ts +2 -0
- package/dist/plan-review.d.ts.map +1 -1
- package/dist/plan-review.js +17 -5
- package/dist/plan-simulation.d.ts.map +1 -1
- package/dist/plan-simulation.js +16 -5
- package/dist/playbook-load-issue.d.ts +16 -0
- package/dist/playbook-load-issue.d.ts.map +1 -0
- package/dist/playbook-load-issue.js +1 -0
- package/dist/playbook-registry.d.ts +32 -1
- package/dist/playbook-registry.d.ts.map +1 -1
- package/dist/playbook-registry.js +144 -55
- package/dist/policy-declaration.d.ts +18 -0
- package/dist/policy-declaration.d.ts.map +1 -0
- package/dist/policy-declaration.js +1 -0
- package/dist/policy-engine.d.ts +8 -0
- package/dist/policy-engine.d.ts.map +1 -1
- package/dist/policy-engine.js +26 -9
- package/dist/policy-overrides.d.ts.map +1 -1
- package/dist/policy-overrides.js +4 -4
- package/dist/policy-registry.d.ts +27 -0
- package/dist/policy-registry.d.ts.map +1 -1
- package/dist/policy-registry.js +87 -20
- package/dist/probed-id-fields.d.ts +21 -0
- package/dist/probed-id-fields.d.ts.map +1 -0
- package/dist/probed-id-fields.js +25 -0
- package/dist/probed-id-source.d.ts +11 -0
- package/dist/probed-id-source.d.ts.map +1 -0
- package/dist/probed-id-source.js +11 -0
- package/dist/profile-registry.d.ts +25 -2
- package/dist/profile-registry.d.ts.map +1 -1
- package/dist/profile-registry.js +59 -6
- package/dist/quality-gate-examination.d.ts +15 -0
- package/dist/quality-gate-examination.d.ts.map +1 -0
- package/dist/quality-gate-examination.js +15 -0
- package/dist/quality-gate-row-status.d.ts +19 -0
- package/dist/quality-gate-row-status.d.ts.map +1 -0
- package/dist/quality-gate-row-status.js +28 -0
- package/dist/quality-gate-status.d.ts +16 -0
- package/dist/quality-gate-status.d.ts.map +1 -0
- package/dist/quality-gate-status.js +16 -0
- package/dist/quality-html.d.ts.map +1 -1
- package/dist/quality-html.js +14 -3
- package/dist/quality-report-coverage.d.ts +26 -0
- package/dist/quality-report-coverage.d.ts.map +1 -0
- package/dist/quality-report-coverage.js +48 -0
- package/dist/quality-report.d.ts +28 -1
- package/dist/quality-report.d.ts.map +1 -1
- package/dist/quality-report.js +263 -35
- package/dist/query-intent-kind.d.ts +18 -0
- package/dist/query-intent-kind.d.ts.map +1 -0
- package/dist/query-intent-kind.js +18 -0
- package/dist/query-intent-result.d.ts +23 -0
- package/dist/query-intent-result.d.ts.map +1 -0
- package/dist/query-intent-result.js +1 -0
- package/dist/query-intent.d.ts +18 -0
- package/dist/query-intent.d.ts.map +1 -0
- package/dist/query-intent.js +336 -0
- package/dist/query-resolver.d.ts +18 -0
- package/dist/query-resolver.d.ts.map +1 -1
- package/dist/query-resolver.js +7 -4
- package/dist/ranked-recommendations.d.ts +36 -0
- package/dist/ranked-recommendations.d.ts.map +1 -0
- package/dist/ranked-recommendations.js +1 -0
- package/dist/ranker-explainability.d.ts.map +1 -1
- package/dist/ranker-explainability.js +38 -10
- package/dist/recommend-recipe.d.ts +17 -0
- package/dist/recommend-recipe.d.ts.map +1 -0
- package/dist/recommend-recipe.js +1 -0
- package/dist/recommend-recipes.d.ts +9 -0
- package/dist/recommend-recipes.d.ts.map +1 -0
- package/dist/recommend-recipes.js +106 -0
- package/dist/recommendation-candidate.d.ts +30 -0
- package/dist/recommendation-candidate.d.ts.map +1 -0
- package/dist/recommendation-candidate.js +1 -0
- package/dist/recommendation-confidence.d.ts +27 -0
- package/dist/recommendation-confidence.d.ts.map +1 -0
- package/dist/recommendation-confidence.js +1 -0
- package/dist/recommendation-ranking-options.d.ts +24 -0
- package/dist/recommendation-ranking-options.d.ts.map +1 -0
- package/dist/recommendation-ranking-options.js +1 -0
- package/dist/recommendation-ranking.d.ts +50 -0
- package/dist/recommendation-ranking.d.ts.map +1 -0
- package/dist/recommendation-ranking.js +527 -0
- package/dist/recommendation-source.d.ts +23 -0
- package/dist/recommendation-source.d.ts.map +1 -0
- package/dist/recommendation-source.js +23 -0
- package/dist/recommendation-suppression.d.ts +14 -0
- package/dist/recommendation-suppression.d.ts.map +1 -0
- package/dist/recommendation-suppression.js +14 -0
- package/dist/reference-asset-kind.d.ts +14 -0
- package/dist/reference-asset-kind.d.ts.map +1 -0
- package/dist/reference-asset-kind.js +14 -0
- package/dist/reference-content-check.d.ts +32 -0
- package/dist/reference-content-check.d.ts.map +1 -0
- package/dist/reference-content-check.js +143 -0
- package/dist/reference-failure.d.ts +31 -0
- package/dist/reference-failure.d.ts.map +1 -0
- package/dist/reference-failure.js +31 -0
- package/dist/reference-id-status.d.ts +15 -0
- package/dist/reference-id-status.d.ts.map +1 -0
- package/dist/reference-id-status.js +15 -0
- package/dist/reference-kind-declarations.d.ts +42 -0
- package/dist/reference-kind-declarations.d.ts.map +1 -0
- package/dist/reference-kind-declarations.js +142 -0
- package/dist/reference-lookup.d.ts +6 -0
- package/dist/reference-lookup.d.ts.map +1 -1
- package/dist/reference-lookup.js +13 -5
- package/dist/reference-registry.d.ts +109 -11
- package/dist/reference-registry.d.ts.map +1 -1
- package/dist/reference-registry.js +186 -30
- package/dist/reference-subject.d.ts +20 -0
- package/dist/reference-subject.d.ts.map +1 -0
- package/dist/reference-subject.js +1 -0
- package/dist/registration-hint-discovery-status.d.ts +25 -0
- package/dist/registration-hint-discovery-status.d.ts.map +1 -0
- package/dist/registration-hint-discovery-status.js +25 -0
- package/dist/registration-hint-registry.d.ts +80 -0
- package/dist/registration-hint-registry.d.ts.map +1 -1
- package/dist/registration-hint-registry.js +356 -138
- package/dist/registry-lifecycle.d.ts +200 -19
- package/dist/registry-lifecycle.d.ts.map +1 -1
- package/dist/registry-lifecycle.js +526 -136
- package/dist/release-readiness.d.ts.map +1 -1
- package/dist/release-readiness.js +10 -7
- package/dist/release-smoke.d.ts.map +1 -1
- package/dist/release-smoke.js +11 -7
- package/dist/report-site.d.ts.map +1 -1
- package/dist/report-site.js +25 -7
- package/dist/repository-intelligence.d.ts.map +1 -1
- package/dist/repository-intelligence.js +3 -2
- package/dist/repository-knowledge-model.d.ts.map +1 -1
- package/dist/repository-knowledge-model.js +18 -5
- package/dist/resolve-project-config.d.ts +64 -0
- package/dist/resolve-project-config.d.ts.map +1 -1
- package/dist/resolve-project-config.js +240 -32
- package/dist/reuse/compute-reuse-coverage.d.ts +29 -0
- package/dist/reuse/compute-reuse-coverage.d.ts.map +1 -0
- package/dist/reuse/compute-reuse-coverage.js +198 -0
- package/dist/reuse/rank-reuse-candidates.d.ts +38 -0
- package/dist/reuse/rank-reuse-candidates.d.ts.map +1 -0
- package/dist/reuse/rank-reuse-candidates.js +212 -0
- package/dist/reuse/rank-reuse-options.d.ts +20 -0
- package/dist/reuse/rank-reuse-options.d.ts.map +1 -0
- package/dist/reuse/rank-reuse-options.js +1 -0
- package/dist/reuse/rank-reuse-suggestions.d.ts +15 -0
- package/dist/reuse/rank-reuse-suggestions.d.ts.map +1 -0
- package/dist/reuse/rank-reuse-suggestions.js +31 -0
- package/dist/reuse/resolve-curated-reuse.d.ts +43 -0
- package/dist/reuse/resolve-curated-reuse.d.ts.map +1 -0
- package/dist/reuse/resolve-curated-reuse.js +115 -0
- package/dist/reuse/reuse-candidate.d.ts +29 -0
- package/dist/reuse/reuse-candidate.d.ts.map +1 -0
- package/dist/reuse/reuse-candidate.js +1 -0
- package/dist/reuse/reuse-coverage-report.d.ts +74 -0
- package/dist/reuse/reuse-coverage-report.d.ts.map +1 -0
- package/dist/reuse/reuse-coverage-report.js +1 -0
- package/dist/reuse/reuse-curated-coverage.d.ts +36 -0
- package/dist/reuse/reuse-curated-coverage.d.ts.map +1 -0
- package/dist/reuse/reuse-curated-coverage.js +1 -0
- package/dist/reuse/reuse-curated-resolution.d.ts +36 -0
- package/dist/reuse/reuse-curated-resolution.d.ts.map +1 -0
- package/dist/reuse/reuse-curated-resolution.js +1 -0
- package/dist/reuse/reuse-curated-status.d.ts +21 -0
- package/dist/reuse/reuse-curated-status.d.ts.map +1 -0
- package/dist/reuse/reuse-curated-status.js +21 -0
- package/dist/reuse/reuse-match-detail.d.ts +15 -0
- package/dist/reuse/reuse-match-detail.d.ts.map +1 -0
- package/dist/reuse/reuse-match-detail.js +1 -0
- package/dist/reuse/reuse-ranking.d.ts +37 -0
- package/dist/reuse/reuse-ranking.d.ts.map +1 -0
- package/dist/reuse/reuse-ranking.js +1 -0
- package/dist/reuse/reuse-suggestion.d.ts +19 -0
- package/dist/reuse/reuse-suggestion.d.ts.map +1 -0
- package/dist/reuse/reuse-suggestion.js +1 -0
- package/dist/reuse/reuse-symbol-lookup.d.ts +28 -0
- package/dist/reuse/reuse-symbol-lookup.d.ts.map +1 -0
- package/dist/reuse/reuse-symbol-lookup.js +1 -0
- package/dist/reuse/reuse-tokenize.d.ts +11 -0
- package/dist/reuse/reuse-tokenize.d.ts.map +1 -0
- package/dist/reuse/reuse-tokenize.js +26 -0
- package/dist/reuse/score-reuse-name.d.ts +16 -0
- package/dist/reuse/score-reuse-name.d.ts.map +1 -0
- package/dist/reuse/score-reuse-name.js +35 -0
- package/dist/reuse/score-reuse-primitive.d.ts +33 -0
- package/dist/reuse/score-reuse-primitive.d.ts.map +1 -0
- package/dist/reuse/score-reuse-primitive.js +92 -0
- package/dist/review-packet.d.ts +2 -0
- package/dist/review-packet.d.ts.map +1 -1
- package/dist/review-packet.js +13 -6
- package/dist/role-views.d.ts.map +1 -1
- package/dist/role-views.js +16 -16
- package/dist/routing-recommends-channels.d.ts +24 -0
- package/dist/routing-recommends-channels.d.ts.map +1 -0
- package/dist/routing-recommends-channels.js +19 -0
- package/dist/run-boundary-check.d.ts +118 -0
- package/dist/run-boundary-check.d.ts.map +1 -0
- package/dist/run-boundary-check.js +592 -0
- package/dist/safety-audit.js +1 -1
- package/dist/scaffold-coverage.js +1 -1
- package/dist/scaffold-pattern-doctor-report.d.ts +19 -0
- package/dist/scaffold-pattern-doctor-report.d.ts.map +1 -0
- package/dist/scaffold-pattern-doctor-report.js +54 -0
- package/dist/scaffold-patterns.d.ts +75 -1
- package/dist/scaffold-patterns.d.ts.map +1 -1
- package/dist/scaffold-patterns.js +375 -84
- package/dist/schema-inventory.d.ts.map +1 -1
- package/dist/schema-inventory.js +4 -3
- package/dist/search-document-id.d.ts +52 -0
- package/dist/search-document-id.d.ts.map +1 -0
- package/dist/search-document-id.js +72 -0
- package/dist/search-document-prefix.d.ts +7 -0
- package/dist/search-document-prefix.d.ts.map +1 -0
- package/dist/search-document-prefix.js +1 -0
- package/dist/search-index.d.ts.map +1 -1
- package/dist/search-index.js +20 -23
- package/dist/search-tuning-explain.d.ts +6 -0
- package/dist/search-tuning-explain.d.ts.map +1 -1
- package/dist/search-tuning-explain.js +19 -17
- package/dist/search-tuning-key-probes.d.ts +16 -0
- package/dist/search-tuning-key-probes.d.ts.map +1 -0
- package/dist/search-tuning-key-probes.js +65 -0
- package/dist/search-tuning-key-resolution.d.ts +25 -0
- package/dist/search-tuning-key-resolution.d.ts.map +1 -0
- package/dist/search-tuning-key-resolution.js +1 -0
- package/dist/search-tuning-key-resolver.d.ts +4 -0
- package/dist/search-tuning-key-resolver.d.ts.map +1 -0
- package/dist/search-tuning-key-resolver.js +107 -0
- package/dist/search-tuning-key-status.d.ts +24 -0
- package/dist/search-tuning-key-status.d.ts.map +1 -0
- package/dist/search-tuning-key-status.js +24 -0
- package/dist/search-tuning-lint.d.ts +9 -0
- package/dist/search-tuning-lint.d.ts.map +1 -0
- package/dist/search-tuning-lint.js +468 -0
- package/dist/search-tuning-registry.d.ts +43 -0
- package/dist/search-tuning-registry.d.ts.map +1 -1
- package/dist/search-tuning-registry.js +214 -49
- package/dist/self-audit.d.ts +12 -0
- package/dist/self-audit.d.ts.map +1 -1
- package/dist/self-audit.js +36 -10
- package/dist/self-config-doctor-v2.d.ts +145 -3
- package/dist/self-config-doctor-v2.d.ts.map +1 -1
- package/dist/self-config-doctor-v2.js +1304 -181
- package/dist/self-config-doctor.d.ts +20 -1
- package/dist/self-config-doctor.d.ts.map +1 -1
- package/dist/self-config-doctor.js +53 -280
- package/dist/settled-unit-states.d.ts +9 -0
- package/dist/settled-unit-states.d.ts.map +1 -0
- package/dist/settled-unit-states.js +14 -0
- package/dist/sharkcraft-inspector.d.ts +34 -0
- package/dist/sharkcraft-inspector.d.ts.map +1 -1
- package/dist/sharkcraft-inspector.js +273 -26
- package/dist/spec/spec-evidence.d.ts.map +1 -1
- package/dist/spec/spec-evidence.js +14 -20
- package/dist/split-identifier.d.ts +21 -0
- package/dist/split-identifier.d.ts.map +1 -0
- package/dist/split-identifier.js +27 -0
- package/dist/start-here.d.ts.map +1 -1
- package/dist/start-here.js +1 -2
- package/dist/substitute-placeholders.d.ts +8 -0
- package/dist/substitute-placeholders.d.ts.map +1 -0
- package/dist/substitute-placeholders.js +9 -0
- package/dist/symbol-index.d.ts +33 -0
- package/dist/symbol-index.d.ts.map +1 -1
- package/dist/symbol-index.js +241 -3
- package/dist/symbol-member-entry.d.ts +26 -0
- package/dist/symbol-member-entry.d.ts.map +1 -0
- package/dist/symbol-member-entry.js +1 -0
- package/dist/symbol-member-kind.d.ts +14 -0
- package/dist/symbol-member-kind.d.ts.map +1 -0
- package/dist/symbol-member-kind.js +14 -0
- package/dist/task-packet.d.ts.map +1 -1
- package/dist/task-packet.js +52 -9
- package/dist/task-ranker.d.ts +8 -0
- package/dist/task-ranker.d.ts.map +1 -1
- package/dist/task-ranker.js +25 -13
- package/dist/task-risk.js +1 -1
- package/dist/task-routing-hint-registry.d.ts +20 -1
- package/dist/task-routing-hint-registry.d.ts.map +1 -1
- package/dist/task-routing-hint-registry.js +186 -42
- package/dist/template-drift.d.ts.map +1 -1
- package/dist/template-drift.js +30 -9
- package/dist/template-lint.d.ts.map +1 -1
- package/dist/template-lint.js +160 -2
- package/dist/term-query.d.ts +10 -0
- package/dist/term-query.d.ts.map +1 -0
- package/dist/term-query.js +1 -0
- package/dist/test-definitions.d.ts +6 -3
- package/dist/test-definitions.d.ts.map +1 -1
- package/dist/test-runner.d.ts +95 -10
- package/dist/test-runner.d.ts.map +1 -1
- package/dist/test-runner.js +309 -308
- package/dist/tuning-query-tokens.d.ts +29 -0
- package/dist/tuning-query-tokens.d.ts.map +1 -0
- package/dist/tuning-query-tokens.js +51 -0
- package/dist/typecheck-files.d.ts +36 -0
- package/dist/typecheck-files.d.ts.map +1 -0
- package/dist/typecheck-files.js +158 -0
- package/dist/uncertainty.js +1 -1
- package/dist/universal-search.d.ts.map +1 -1
- package/dist/universal-search.js +5 -3
- package/dist/unregistered-exports.d.ts +19 -0
- package/dist/unregistered-exports.d.ts.map +1 -0
- package/dist/unregistered-exports.js +141 -0
- package/dist/unresolvable-reason.d.ts +11 -0
- package/dist/unresolvable-reason.d.ts.map +1 -0
- package/dist/unresolvable-reason.js +11 -0
- package/dist/upgrade-advisor.d.ts.map +1 -1
- package/dist/upgrade-advisor.js +16 -9
- package/dist/validate-contribution-file.d.ts +4 -0
- package/dist/validate-contribution-file.d.ts.map +1 -0
- package/dist/validate-contribution-file.js +228 -0
- package/dist/why-file.d.ts +3 -0
- package/dist/why-file.d.ts.map +1 -1
- package/dist/why-file.js +7 -3
- package/package.json +17 -17
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { MatchConfidenceVerdict, ReuseCandidateSource, ReuseMatchSource, ReuseNameMatch, } from '@shrkcrft/core';
|
|
2
|
+
import { curatedReuseSuggestion, rankReuseSuggestions } from "./rank-reuse-suggestions.js";
|
|
3
|
+
import { isCuratedExport } from "./resolve-curated-reuse.js";
|
|
4
|
+
import { tokenizeReuseIntent } from "./reuse-tokenize.js";
|
|
5
|
+
import { reuseNameExtraTokens, reuseNameHits, scoreReuseName } from "./score-reuse-name.js";
|
|
6
|
+
import { isConfidentReuseMatch, reuseConfidenceFloor, scoreReusePrimitive, } from "./score-reuse-primitive.js";
|
|
7
|
+
/** Declaration kinds that exist only at the type level. */
|
|
8
|
+
const TYPE_KINDS = new Set(['interface', 'type-alias']);
|
|
9
|
+
/** A type-only export (interface / type alias) — excluded from reuse answers unless asked for. */
|
|
10
|
+
export function isReuseTypeKind(declKind) {
|
|
11
|
+
return TYPE_KINDS.has(declKind);
|
|
12
|
+
}
|
|
13
|
+
/** A test file never holds a construct to reuse. */
|
|
14
|
+
export function isReuseTestPath(path) {
|
|
15
|
+
return (/\.(test|spec)\.[cm]?[jt]sx?$/.test(path) || path.includes('/__tests__/') || path.startsWith('__tests__/'));
|
|
16
|
+
}
|
|
17
|
+
/** A NAME that answers the intent: every intent token is one of its name tokens (exact / covers). */
|
|
18
|
+
export function reuseNameAnswers(m) {
|
|
19
|
+
return m === ReuseNameMatch.Exact || m === ReuseNameMatch.Covers;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* THE curation-gap predicate. The lookup's `curationGap` and `shrk reuse
|
|
23
|
+
* coverage`'s `shadowed` both call it, so the two agree by construction: an
|
|
24
|
+
* uncurated export answers the intent by NAME (exact / covers) while the best
|
|
25
|
+
* curated candidate names it only in part, or not at all (it matched through
|
|
26
|
+
* its roles / keywords / description).
|
|
27
|
+
*/
|
|
28
|
+
export function isReuseCurationGap(bestCuratedNameMatch, uncuratedNameAnswers) {
|
|
29
|
+
return uncuratedNameAnswers > 0 && bestCuratedNameMatch !== undefined && !reuseNameAnswers(bestCuratedNameMatch);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Intent → the construct to reuse, ranked over the curated `reusePrimitives[]`
|
|
33
|
+
* AND (when a surface is given) the workspace's public export surface.
|
|
34
|
+
*
|
|
35
|
+
* Pure: the surface is INJECTED (the CLI reads it from the code graph), so the
|
|
36
|
+
* engine stays callable from a read-only MCP tool and the inspector never
|
|
37
|
+
* imports the graph.
|
|
38
|
+
*
|
|
39
|
+
* Tiers (lower wins; see `IReuseCandidate.tier`): curated whose NAME answers
|
|
40
|
+
* the intent (exact / covers) → uncurated exact name → uncurated name covering
|
|
41
|
+
* the intent → curated that names it only in part, or only through metadata.
|
|
42
|
+
* Within a tier: score desc, then the closer name (fewer extra name tokens),
|
|
43
|
+
* then symbol, then declaring file. An uncurated PARTIAL name match never
|
|
44
|
+
* becomes an answer; it is offered as a did-you-mean only when nothing is.
|
|
45
|
+
*
|
|
46
|
+
* The export pool excludes constructs already curated (name AND declaring
|
|
47
|
+
* file, see `curatedDeclaredIn`), names a curated entry `supersedes` (reported
|
|
48
|
+
* in `superseded`), type-level kinds unless `includeTypes`, and test files.
|
|
49
|
+
*/
|
|
50
|
+
export function rankReuseCandidates(primitives, surface, intent, opts = {}) {
|
|
51
|
+
const tokens = tokenizeReuseIntent(intent);
|
|
52
|
+
const count = tokens.length;
|
|
53
|
+
const limit = Math.max(1, Math.floor(opts.limit ?? 3));
|
|
54
|
+
const suggestLimit = Math.max(1, Math.floor(opts.suggestLimit ?? 5));
|
|
55
|
+
const confidenceOf = (hits) => (count === 0 ? 0 : hits / count);
|
|
56
|
+
// ── curated ────────────────────────────────────────────────────────────
|
|
57
|
+
const scored = primitives
|
|
58
|
+
.map((p) => ({ p, d: scoreReusePrimitive(p, tokens) }))
|
|
59
|
+
.filter((x) => x.d.score > 0)
|
|
60
|
+
.sort((a, b) => b.d.score - a.d.score || a.p.symbol.localeCompare(b.p.symbol));
|
|
61
|
+
const confidentCurated = scored.filter((x) => isConfidentReuseMatch(x.d, count));
|
|
62
|
+
const curatedCandidate = (x, tier) => ({
|
|
63
|
+
symbol: x.p.symbol,
|
|
64
|
+
source: ReuseCandidateSource.Curated,
|
|
65
|
+
tier,
|
|
66
|
+
score: x.d.score,
|
|
67
|
+
confidence: confidenceOf(x.d.matched.length),
|
|
68
|
+
matched: x.d.matched,
|
|
69
|
+
matchedVia: x.d.matchedVia,
|
|
70
|
+
nameMatch: x.d.nameMatch,
|
|
71
|
+
primitive: x.p,
|
|
72
|
+
});
|
|
73
|
+
// Tier 1 only when the curated NAME answers the intent. A curated entry that
|
|
74
|
+
// shares one token of a three-token intent (`RangeSlider` for "date range
|
|
75
|
+
// picker") must not outrank the exactly-named export: it ranks with the
|
|
76
|
+
// metadata-only matches, below every uncurated exact / covering name.
|
|
77
|
+
const tier1 = confidentCurated.filter((x) => reuseNameAnswers(x.d.nameMatch)).map((x) => curatedCandidate(x, 1));
|
|
78
|
+
const tier4 = confidentCurated.filter((x) => !reuseNameAnswers(x.d.nameMatch)).map((x) => curatedCandidate(x, 4));
|
|
79
|
+
// ── uncurated export surface ──────────────────────────────────────────
|
|
80
|
+
const surfaceSearched = surface !== undefined && opts.curatedOnly !== true;
|
|
81
|
+
const superseded = [];
|
|
82
|
+
const exact = [];
|
|
83
|
+
const covers = [];
|
|
84
|
+
const partial = [];
|
|
85
|
+
if (surface !== undefined && surfaceSearched) {
|
|
86
|
+
const curatedNames = new Set(primitives.map((p) => p.symbol));
|
|
87
|
+
const supersededBy = new Map();
|
|
88
|
+
for (const p of primitives) {
|
|
89
|
+
for (const name of p.supersedes ?? []) {
|
|
90
|
+
const by = supersededBy.get(name);
|
|
91
|
+
if (by)
|
|
92
|
+
by.push(p.symbol);
|
|
93
|
+
else
|
|
94
|
+
supersededBy.set(name, [p.symbol]);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const packageDir = new Map(surface.roots.map((r) => [r.package, r.dir]));
|
|
98
|
+
const bySymbolId = new Map();
|
|
99
|
+
for (const e of surface.exports) {
|
|
100
|
+
if (isReuseTestPath(e.declaredIn))
|
|
101
|
+
continue;
|
|
102
|
+
if (opts.includeTypes !== true && isReuseTypeKind(e.declKind))
|
|
103
|
+
continue;
|
|
104
|
+
if (isCuratedExport(e, curatedNames, opts.curatedDeclaredIn))
|
|
105
|
+
continue;
|
|
106
|
+
const nameMatch = scoreReuseName(e.name, tokens);
|
|
107
|
+
if (nameMatch === ReuseNameMatch.None)
|
|
108
|
+
continue;
|
|
109
|
+
const by = supersededBy.get(e.name);
|
|
110
|
+
if (by) {
|
|
111
|
+
superseded.push({ symbol: e.name, package: e.package, supersededBy: by });
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
const hits = reuseNameHits(e.name, tokens);
|
|
115
|
+
const candidate = {
|
|
116
|
+
symbol: e.name,
|
|
117
|
+
source: ReuseCandidateSource.ExportSurface,
|
|
118
|
+
tier: nameMatch === ReuseNameMatch.Exact ? 2 : nameMatch === ReuseNameMatch.Covers ? 3 : 0,
|
|
119
|
+
score: hits.length,
|
|
120
|
+
confidence: confidenceOf(hits.length),
|
|
121
|
+
matched: hits,
|
|
122
|
+
matchedVia: [ReuseMatchSource.Symbol],
|
|
123
|
+
nameMatch,
|
|
124
|
+
export: e,
|
|
125
|
+
};
|
|
126
|
+
// One construct exposed by several packages (a sibling re-exports it):
|
|
127
|
+
// keep the package that DECLARES it — that is the import to copy. The
|
|
128
|
+
// surface is sorted by package, so without an owner the first one stays.
|
|
129
|
+
const prev = bySymbolId.get(e.symbolId)?.export;
|
|
130
|
+
const replaces = prev === undefined ||
|
|
131
|
+
(declaresOwnExport(e, packageDir) && !declaresOwnExport(prev, packageDir));
|
|
132
|
+
if (replaces)
|
|
133
|
+
bySymbolId.set(e.symbolId, candidate);
|
|
134
|
+
}
|
|
135
|
+
for (const c of bySymbolId.values()) {
|
|
136
|
+
if (c.nameMatch === ReuseNameMatch.Exact)
|
|
137
|
+
exact.push(c);
|
|
138
|
+
else if (c.nameMatch === ReuseNameMatch.Covers)
|
|
139
|
+
covers.push(c);
|
|
140
|
+
else
|
|
141
|
+
partial.push(c);
|
|
142
|
+
}
|
|
143
|
+
const byUncurated = (a, b) => b.score - a.score ||
|
|
144
|
+
reuseNameExtraTokens(a.symbol, tokens) - reuseNameExtraTokens(b.symbol, tokens) ||
|
|
145
|
+
compare(a.symbol, b.symbol) ||
|
|
146
|
+
compare(a.export?.declaredIn ?? '', b.export?.declaredIn ?? '') ||
|
|
147
|
+
compare(a.export?.package ?? '', b.export?.package ?? '');
|
|
148
|
+
exact.sort(byUncurated);
|
|
149
|
+
covers.sort(byUncurated);
|
|
150
|
+
partial.sort(byUncurated);
|
|
151
|
+
}
|
|
152
|
+
const results = [...tier1, ...exact, ...covers, ...tier4].slice(0, limit);
|
|
153
|
+
const nameAnswered = tier1.length + exact.length + covers.length > 0;
|
|
154
|
+
// The best curated candidate is tier 1's head when any curated NAME answers.
|
|
155
|
+
const curationGap = isReuseCurationGap((tier1[0] ?? tier4[0])?.nameMatch, exact.length + covers.length);
|
|
156
|
+
let verdict;
|
|
157
|
+
let suggestions;
|
|
158
|
+
if (results.length > 0) {
|
|
159
|
+
verdict = MatchConfidenceVerdict.Confident;
|
|
160
|
+
suggestions = [];
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
const weak = [
|
|
164
|
+
...scored.map((x) => curatedReuseSuggestion(x.p, x.d, count)),
|
|
165
|
+
...partial.map(uncuratedSuggestion),
|
|
166
|
+
];
|
|
167
|
+
if (weak.length > 0) {
|
|
168
|
+
verdict = MatchConfidenceVerdict.NoConfidentMatch;
|
|
169
|
+
suggestions = weak.slice(0, suggestLimit);
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
verdict = MatchConfidenceVerdict.NoMatch;
|
|
173
|
+
suggestions = rankReuseSuggestions(primitives, tokens, suggestLimit);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const bestScore = Math.max(0, ...results.map((r) => r.score), ...suggestions.map((s) => s.score));
|
|
177
|
+
return {
|
|
178
|
+
tokens,
|
|
179
|
+
confident: results.length > 0,
|
|
180
|
+
verdict,
|
|
181
|
+
floor: reuseConfidenceFloor(count),
|
|
182
|
+
bestScore,
|
|
183
|
+
results,
|
|
184
|
+
suggestions,
|
|
185
|
+
superseded,
|
|
186
|
+
curationGap,
|
|
187
|
+
nameAnswered,
|
|
188
|
+
surfaceSearched,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function uncuratedSuggestion(c) {
|
|
192
|
+
return {
|
|
193
|
+
symbol: c.symbol,
|
|
194
|
+
score: c.score,
|
|
195
|
+
confidence: c.confidence,
|
|
196
|
+
matched: c.matched,
|
|
197
|
+
roles: [],
|
|
198
|
+
source: c.source,
|
|
199
|
+
nameMatch: c.nameMatch,
|
|
200
|
+
matchedVia: c.matchedVia,
|
|
201
|
+
...(c.export ? { package: c.export.package, declaredIn: c.export.declaredIn } : {}),
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
/** Is `e` exposed by the package whose directory declares it? */
|
|
205
|
+
function declaresOwnExport(e, packageDir) {
|
|
206
|
+
const dir = packageDir.get(e.package);
|
|
207
|
+
return dir !== undefined && dir.length > 0 && (e.declaredIn === dir || e.declaredIn.startsWith(`${dir}/`));
|
|
208
|
+
}
|
|
209
|
+
/** Locale-independent ordering, so a ranking is byte-stable across machines. */
|
|
210
|
+
function compare(a, b) {
|
|
211
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
212
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Options for `rankReuseCandidates`. */
|
|
2
|
+
export interface IRankReuseOptions {
|
|
3
|
+
/** Cap on confident results. Default 3. */
|
|
4
|
+
readonly limit?: number;
|
|
5
|
+
/** Cap on did-you-mean suggestions. Default 5. */
|
|
6
|
+
readonly suggestLimit?: number;
|
|
7
|
+
/** Consider type-level exports (interfaces, type aliases). Default false. */
|
|
8
|
+
readonly includeTypes?: boolean;
|
|
9
|
+
/** Ignore the export surface: curated `reusePrimitives[]` only (the pre-round-11 ranking). */
|
|
10
|
+
readonly curatedOnly?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Curated symbol → the file its RESOLVED declaration lives in (build it with
|
|
13
|
+
* `curatedDeclarationMap` over `resolveCuratedReuse` — the same map `shrk
|
|
14
|
+
* reuse coverage` excludes by). An export with a curated name declared
|
|
15
|
+
* ELSEWHERE is a different construct and stays a candidate. A name absent
|
|
16
|
+
* from the map is excluded by name alone.
|
|
17
|
+
*/
|
|
18
|
+
readonly curatedDeclaredIn?: ReadonlyMap<string, readonly string[]>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=rank-reuse-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rank-reuse-options.d.ts","sourceRoot":"","sources":["../../src/reuse/rank-reuse-options.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,MAAM,WAAW,iBAAiB;IAChC,2CAA2C;IAC3C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,kDAAkD;IAClD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,6EAA6E;IAC7E,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAChC,8FAA8F;IAC9F,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B;;;;;;OAMG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC;CACrE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type IReusePrimitive } from '@shrkcrft/core';
|
|
2
|
+
import type { IReuseMatchDetail } from './reuse-match-detail.js';
|
|
3
|
+
import type { IReuseSuggestion } from './reuse-suggestion.js';
|
|
4
|
+
/**
|
|
5
|
+
* Rank ALL curated primitives by the matcher's own score (descending; ties
|
|
6
|
+
* broken by symbol name so the order is deterministic), then return the top-`k`
|
|
7
|
+
* as scored did-you-mean suggestions. Pure — no graph, no IO. When every
|
|
8
|
+
* candidate scores 0 (a nonsense intent that shares no term) the result is the
|
|
9
|
+
* alphabetically-first `k` primitives, each with `score: 0`; the caller states
|
|
10
|
+
* "no candidate shares any term" in that case rather than dumping the catalog.
|
|
11
|
+
*/
|
|
12
|
+
export declare function rankReuseSuggestions(primitives: readonly IReusePrimitive[], tokens: readonly string[], k: number): IReuseSuggestion[];
|
|
13
|
+
/** One curated primitive as a suggestion row. */
|
|
14
|
+
export declare function curatedReuseSuggestion(p: IReusePrimitive, detail: IReuseMatchDetail, tokenCount: number): IReuseSuggestion;
|
|
15
|
+
//# sourceMappingURL=rank-reuse-suggestions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rank-reuse-suggestions.d.ts","sourceRoot":"","sources":["../../src/reuse/rank-reuse-suggestions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAG9D;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,SAAS,eAAe,EAAE,EACtC,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,CAAC,EAAE,MAAM,GACR,gBAAgB,EAAE,CAOpB;AAED,iDAAiD;AACjD,wBAAgB,sBAAsB,CACpC,CAAC,EAAE,eAAe,EAClB,MAAM,EAAE,iBAAiB,EACzB,UAAU,EAAE,MAAM,GACjB,gBAAgB,CAWlB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ReuseCandidateSource } from '@shrkcrft/core';
|
|
2
|
+
import { scoreReusePrimitive } from "./score-reuse-primitive.js";
|
|
3
|
+
/**
|
|
4
|
+
* Rank ALL curated primitives by the matcher's own score (descending; ties
|
|
5
|
+
* broken by symbol name so the order is deterministic), then return the top-`k`
|
|
6
|
+
* as scored did-you-mean suggestions. Pure — no graph, no IO. When every
|
|
7
|
+
* candidate scores 0 (a nonsense intent that shares no term) the result is the
|
|
8
|
+
* alphabetically-first `k` primitives, each with `score: 0`; the caller states
|
|
9
|
+
* "no candidate shares any term" in that case rather than dumping the catalog.
|
|
10
|
+
*/
|
|
11
|
+
export function rankReuseSuggestions(primitives, tokens, k) {
|
|
12
|
+
const cap = Math.max(1, Math.floor(k));
|
|
13
|
+
return primitives
|
|
14
|
+
.map((p) => ({ p, detail: scoreReusePrimitive(p, tokens) }))
|
|
15
|
+
.sort((a, b) => b.detail.score - a.detail.score || a.p.symbol.localeCompare(b.p.symbol))
|
|
16
|
+
.slice(0, cap)
|
|
17
|
+
.map(({ p, detail }) => curatedReuseSuggestion(p, detail, tokens.length));
|
|
18
|
+
}
|
|
19
|
+
/** One curated primitive as a suggestion row. */
|
|
20
|
+
export function curatedReuseSuggestion(p, detail, tokenCount) {
|
|
21
|
+
return {
|
|
22
|
+
symbol: p.symbol,
|
|
23
|
+
score: detail.score,
|
|
24
|
+
confidence: tokenCount === 0 ? 0 : detail.matched.length / tokenCount,
|
|
25
|
+
matched: detail.matched,
|
|
26
|
+
roles: p.roles,
|
|
27
|
+
source: ReuseCandidateSource.Curated,
|
|
28
|
+
nameMatch: detail.nameMatch,
|
|
29
|
+
matchedVia: detail.matchedVia,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ReuseImportStyle, type IPublicExportSurface, type IReusePrimitive } from '@shrkcrft/core';
|
|
2
|
+
import type { IReuseCuratedResolution } from './reuse-curated-resolution.js';
|
|
3
|
+
import type { IReuseSymbolLookup } from './reuse-symbol-lookup.js';
|
|
4
|
+
/**
|
|
5
|
+
* Resolve ONE curated entry against the code: which declaration it names,
|
|
6
|
+
* whether its `importPath` exposes it, and how the copy-paste import binds it.
|
|
7
|
+
*
|
|
8
|
+
* The one authority for all three: `shrk reuse` prints a curated row from it,
|
|
9
|
+
* and `shrk reuse coverage` judges the entry by it — so the printed import line
|
|
10
|
+
* and "would that import compile?" cannot disagree (a DEFAULT export gets
|
|
11
|
+
* `import X from '…'`, never a named import that does not exist), and the
|
|
12
|
+
* curated construct excluded from the uncurated pool is the same in both.
|
|
13
|
+
*
|
|
14
|
+
* The `importPath` is checked against the module's real export surface: a
|
|
15
|
+
* workspace package root through the public surface, any other specifier
|
|
16
|
+
* through `lookup.specifierExport` (the same ESM walk, from the file consumers'
|
|
17
|
+
* imports of it resolved to).
|
|
18
|
+
*
|
|
19
|
+
* Pure: surface and lookup are injected (the inspector never imports the
|
|
20
|
+
* graph). Without them nothing is checked — the import is printed as
|
|
21
|
+
* configured, named, and `importPathAgrees` is absent.
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveCuratedReuse(p: IReusePrimitive, surface: IPublicExportSurface | undefined, lookup: IReuseSymbolLookup | undefined): IReuseCuratedResolution;
|
|
24
|
+
/** The copy-paste import line for `symbol` from `specifier`, bound the way the module exports it. */
|
|
25
|
+
export declare function reuseImportLine(symbol: string, specifier: string, style: ReuseImportStyle): string;
|
|
26
|
+
/**
|
|
27
|
+
* Curated symbol → the file(s) its resolved declaration lives in — the exact
|
|
28
|
+
* `curatedDeclaredIn` the ranker excludes by, and the one coverage excludes by.
|
|
29
|
+
* A curated name whose declaration did not resolve is absent (so it is excluded
|
|
30
|
+
* by name alone).
|
|
31
|
+
*/
|
|
32
|
+
export declare function curatedDeclarationMap(primitives: readonly IReusePrimitive[], resolutions: readonly IReuseCuratedResolution[]): Map<string, string[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Is export `e` a construct a curated entry already names? Name AND declaring
|
|
35
|
+
* file: an export sharing a curated name but declared ELSEWHERE is a different
|
|
36
|
+
* construct and stays a candidate. A curated name absent from the map (its
|
|
37
|
+
* declaration did not resolve) is matched by name alone.
|
|
38
|
+
*/
|
|
39
|
+
export declare function isCuratedExport(e: {
|
|
40
|
+
readonly name: string;
|
|
41
|
+
readonly declaredIn: string;
|
|
42
|
+
}, curatedNames: ReadonlySet<string>, curatedDeclaredIn: ReadonlyMap<string, readonly string[]> | undefined): boolean;
|
|
43
|
+
//# sourceMappingURL=resolve-curated-reuse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-curated-reuse.d.ts","sourceRoot":"","sources":["../../src/reuse/resolve-curated-reuse.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAEhB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAInE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,mBAAmB,CACjC,CAAC,EAAE,eAAe,EAClB,OAAO,EAAE,oBAAoB,GAAG,SAAS,EACzC,MAAM,EAAE,kBAAkB,GAAG,SAAS,GACrC,uBAAuB,CA0DzB;AAED,qGAAqG;AACrG,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAIlG;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,SAAS,eAAe,EAAE,EACtC,WAAW,EAAE,SAAS,uBAAuB,EAAE,GAC9C,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAUvB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,CAAC,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAE,EACzD,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,EACjC,iBAAiB,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,GAAG,SAAS,GACpE,OAAO,CAIT"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { ReuseImportStyle, } from '@shrkcrft/core';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve ONE curated entry against the code: which declaration it names,
|
|
4
|
+
* whether its `importPath` exposes it, and how the copy-paste import binds it.
|
|
5
|
+
*
|
|
6
|
+
* The one authority for all three: `shrk reuse` prints a curated row from it,
|
|
7
|
+
* and `shrk reuse coverage` judges the entry by it — so the printed import line
|
|
8
|
+
* and "would that import compile?" cannot disagree (a DEFAULT export gets
|
|
9
|
+
* `import X from '…'`, never a named import that does not exist), and the
|
|
10
|
+
* curated construct excluded from the uncurated pool is the same in both.
|
|
11
|
+
*
|
|
12
|
+
* The `importPath` is checked against the module's real export surface: a
|
|
13
|
+
* workspace package root through the public surface, any other specifier
|
|
14
|
+
* through `lookup.specifierExport` (the same ESM walk, from the file consumers'
|
|
15
|
+
* imports of it resolved to).
|
|
16
|
+
*
|
|
17
|
+
* Pure: surface and lookup are injected (the inspector never imports the
|
|
18
|
+
* graph). Without them nothing is checked — the import is printed as
|
|
19
|
+
* configured, named, and `importPathAgrees` is absent.
|
|
20
|
+
*/
|
|
21
|
+
export function resolveCuratedReuse(p, surface, lookup) {
|
|
22
|
+
const decls = lookup?.declarationsOf(p.symbol) ?? [];
|
|
23
|
+
let target;
|
|
24
|
+
let importPathAgrees;
|
|
25
|
+
let importPathNote;
|
|
26
|
+
if (p.importPath !== undefined && surface !== undefined) {
|
|
27
|
+
const spec = p.importPath;
|
|
28
|
+
if (surface.roots.some((r) => r.package === spec)) {
|
|
29
|
+
target = surface.exports.find((e) => e.package === spec && e.name === p.symbol);
|
|
30
|
+
importPathAgrees = target !== undefined;
|
|
31
|
+
}
|
|
32
|
+
else if (surface.packagesWithoutEntry.some((w) => w.package === spec)) {
|
|
33
|
+
importPathNote = `package ${spec} has no resolved entry, so the import line was not checked`;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
const hit = lookup?.specifierExport?.(spec, p.symbol);
|
|
37
|
+
if (hit === undefined) {
|
|
38
|
+
importPathNote = `'${spec}' is not a workspace package root and no indexed import resolves it, so the import line was not checked`;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
importPathAgrees = hit !== null;
|
|
42
|
+
if (hit !== null)
|
|
43
|
+
target = hit;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// The declaration: pinned by the importPath when it resolved; otherwise the
|
|
48
|
+
// same deterministic pick `shrk reuse` always made (exported first, by path),
|
|
49
|
+
// with a public one ahead of both.
|
|
50
|
+
const onSurface = new Set((surface?.exports ?? []).filter((e) => e.name === p.symbol).map((e) => e.symbolId));
|
|
51
|
+
const rank = (d) => onSurface.has(d.symbolId) ? 0 : d.isExported ? 1 : 2;
|
|
52
|
+
const ordered = [...decls].sort((a, b) => rank(a) - rank(b) || a.path.localeCompare(b.path));
|
|
53
|
+
const declaration = target !== undefined
|
|
54
|
+
? {
|
|
55
|
+
path: target.declaredIn,
|
|
56
|
+
symbolId: target.symbolId,
|
|
57
|
+
isExported: true,
|
|
58
|
+
...(target.line !== undefined ? { line: target.line } : {}),
|
|
59
|
+
...(target.declKind !== undefined ? { declKind: target.declKind } : {}),
|
|
60
|
+
}
|
|
61
|
+
: ordered[0];
|
|
62
|
+
const exported = decls.filter((d) => d.isExported);
|
|
63
|
+
const pool = exported.length > 0 ? exported : decls;
|
|
64
|
+
const alternates = [...new Set(pool.map((d) => d.path))]
|
|
65
|
+
.filter((path) => path !== declaration?.path)
|
|
66
|
+
.sort((a, b) => a.localeCompare(b));
|
|
67
|
+
const importStyle = target?.isDefault === true ? ReuseImportStyle.Default : ReuseImportStyle.Named;
|
|
68
|
+
return {
|
|
69
|
+
...(declaration !== undefined ? { declaration } : {}),
|
|
70
|
+
alternates,
|
|
71
|
+
...(p.importPath !== undefined
|
|
72
|
+
? { importStyle, importLine: reuseImportLine(p.symbol, p.importPath, importStyle) }
|
|
73
|
+
: {}),
|
|
74
|
+
...(importPathAgrees !== undefined ? { importPathAgrees } : {}),
|
|
75
|
+
...(importPathNote !== undefined ? { importPathNote } : {}),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/** The copy-paste import line for `symbol` from `specifier`, bound the way the module exports it. */
|
|
79
|
+
export function reuseImportLine(symbol, specifier, style) {
|
|
80
|
+
return style === ReuseImportStyle.Default
|
|
81
|
+
? `import ${symbol} from '${specifier}';`
|
|
82
|
+
: `import { ${symbol} } from '${specifier}';`;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Curated symbol → the file(s) its resolved declaration lives in — the exact
|
|
86
|
+
* `curatedDeclaredIn` the ranker excludes by, and the one coverage excludes by.
|
|
87
|
+
* A curated name whose declaration did not resolve is absent (so it is excluded
|
|
88
|
+
* by name alone).
|
|
89
|
+
*/
|
|
90
|
+
export function curatedDeclarationMap(primitives, resolutions) {
|
|
91
|
+
const out = new Map();
|
|
92
|
+
primitives.forEach((p, i) => {
|
|
93
|
+
const path = resolutions[i]?.declaration?.path;
|
|
94
|
+
if (path === undefined)
|
|
95
|
+
return;
|
|
96
|
+
const list = out.get(p.symbol);
|
|
97
|
+
if (list === undefined)
|
|
98
|
+
out.set(p.symbol, [path]);
|
|
99
|
+
else if (!list.includes(path))
|
|
100
|
+
list.push(path);
|
|
101
|
+
});
|
|
102
|
+
return out;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Is export `e` a construct a curated entry already names? Name AND declaring
|
|
106
|
+
* file: an export sharing a curated name but declared ELSEWHERE is a different
|
|
107
|
+
* construct and stays a candidate. A curated name absent from the map (its
|
|
108
|
+
* declaration did not resolve) is matched by name alone.
|
|
109
|
+
*/
|
|
110
|
+
export function isCuratedExport(e, curatedNames, curatedDeclaredIn) {
|
|
111
|
+
if (!curatedNames.has(e.name))
|
|
112
|
+
return false;
|
|
113
|
+
const known = curatedDeclaredIn?.get(e.name);
|
|
114
|
+
return known === undefined || known.length === 0 || known.includes(e.declaredIn);
|
|
115
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { IPublicExport, IReusePrimitive, ReuseCandidateSource, ReuseMatchSource, ReuseNameMatch } from '@shrkcrft/core';
|
|
2
|
+
/** One confident reuse answer, before the CLI enriches it with graph detail. */
|
|
3
|
+
export interface IReuseCandidate {
|
|
4
|
+
readonly symbol: string;
|
|
5
|
+
readonly source: ReuseCandidateSource;
|
|
6
|
+
/**
|
|
7
|
+
* Ranking tier (lower wins):
|
|
8
|
+
* 1 — curated, its NAME answers the intent (exact / covers);
|
|
9
|
+
* 2 — uncurated, exact name match;
|
|
10
|
+
* 3 — uncurated, the name covers every intent token;
|
|
11
|
+
* 4 — curated, its name matches only PART of the intent, or it matched
|
|
12
|
+
* only through roles / keywords / description.
|
|
13
|
+
* A curated entry that names the construct stays authoritative over an
|
|
14
|
+
* uncurated one; an exactly-named export beats a curated hit that shares
|
|
15
|
+
* one token of its name, or none.
|
|
16
|
+
*/
|
|
17
|
+
readonly tier: number;
|
|
18
|
+
readonly score: number;
|
|
19
|
+
/** Fraction of distinct intent tokens that hit (0..1). */
|
|
20
|
+
readonly confidence: number;
|
|
21
|
+
readonly matched: readonly string[];
|
|
22
|
+
readonly matchedVia: readonly ReuseMatchSource[];
|
|
23
|
+
readonly nameMatch: ReuseNameMatch;
|
|
24
|
+
/** Set for `curated` candidates. */
|
|
25
|
+
readonly primitive?: IReusePrimitive;
|
|
26
|
+
/** Set for `export-surface` candidates. */
|
|
27
|
+
readonly export?: IPublicExport;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=reuse-candidate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reuse-candidate.d.ts","sourceRoot":"","sources":["../../src/reuse/reuse-candidate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACf,MAAM,gBAAgB,CAAC;AAExB,gFAAgF;AAChF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;IACtC;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,0DAA0D;IAC1D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,UAAU,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACjD,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;IACnC,oCAAoC;IACpC,QAAQ,CAAC,SAAS,CAAC,EAAE,eAAe,CAAC;IACrC,2CAA2C;IAC3C,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC;CACjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { IUnfollowedReExport, ReuseMatchSource, ReuseNameMatch } from '@shrkcrft/core';
|
|
2
|
+
import type { IReuseCuratedCoverage } from './reuse-curated-coverage.js';
|
|
3
|
+
/**
|
|
4
|
+
* Curated reuse index vs the real public export surface — the numbers that make
|
|
5
|
+
* curation drift measurable instead of silent (`shrk reuse coverage`).
|
|
6
|
+
*/
|
|
7
|
+
export interface IReuseCoverageReport {
|
|
8
|
+
/** Every in-scope curated entry, in config order. */
|
|
9
|
+
readonly curated: readonly IReuseCuratedCoverage[];
|
|
10
|
+
/** Curated entries a `--package` narrowing excluded (deliberate, not a gap). */
|
|
11
|
+
readonly curatedOutOfScope: number;
|
|
12
|
+
readonly surface: {
|
|
13
|
+
readonly roots: readonly {
|
|
14
|
+
readonly package: string;
|
|
15
|
+
readonly dir: string;
|
|
16
|
+
readonly entryFile: string;
|
|
17
|
+
}[];
|
|
18
|
+
/** In-scope packages whose exports were NOT measured, each with why. */
|
|
19
|
+
readonly packagesWithoutEntry: readonly {
|
|
20
|
+
readonly package: string;
|
|
21
|
+
readonly dir: string;
|
|
22
|
+
readonly reason: string;
|
|
23
|
+
}[];
|
|
24
|
+
/** Public exports in scope (per package × name). */
|
|
25
|
+
readonly all: number;
|
|
26
|
+
/** Public exports that are not type-level (everything but interfaces / type aliases). */
|
|
27
|
+
readonly value: number;
|
|
28
|
+
readonly byKind: Readonly<Record<string, number>>;
|
|
29
|
+
/** In-scope re-exports not followed to a declaration (`unfollowedReExports.length`). */
|
|
30
|
+
readonly unresolvedReExports: number;
|
|
31
|
+
/**
|
|
32
|
+
* Each of them, classified. An `unresolved` one is part of its package's
|
|
33
|
+
* surface that was NOT measured; an `external` one leaves the workspace.
|
|
34
|
+
*/
|
|
35
|
+
readonly unfollowedReExports: readonly IUnfollowedReExport[];
|
|
36
|
+
};
|
|
37
|
+
/** In-scope curated entries on the public surface. */
|
|
38
|
+
readonly curatedPublic: number;
|
|
39
|
+
/** …of which the public construct is not type-level. */
|
|
40
|
+
readonly curatedPublicValue: number;
|
|
41
|
+
/** curatedPublicValue / value — the primary ratio. Absent when value is 0. */
|
|
42
|
+
readonly ratioValue?: number;
|
|
43
|
+
/** curatedPublic / all. Absent when all is 0. */
|
|
44
|
+
readonly ratioAll?: number;
|
|
45
|
+
/** Public exports no curated entry names or supersedes (capped; see uncoveredTotal). */
|
|
46
|
+
readonly uncovered: readonly {
|
|
47
|
+
readonly name: string;
|
|
48
|
+
readonly package: string;
|
|
49
|
+
readonly declaredIn: string;
|
|
50
|
+
readonly declKind: string;
|
|
51
|
+
}[];
|
|
52
|
+
readonly uncoveredTotal: number;
|
|
53
|
+
/**
|
|
54
|
+
* Curation gaps: an uncovered export whose own name, asked as an intent,
|
|
55
|
+
* gets a DIFFERENT curated answer from the reuse lookup — the lookup's own
|
|
56
|
+
* ranker, curated-only, so this list and `shrk reuse --curated-only` cannot
|
|
57
|
+
* disagree.
|
|
58
|
+
*/
|
|
59
|
+
readonly shadowed: readonly {
|
|
60
|
+
readonly export: string;
|
|
61
|
+
readonly package: string;
|
|
62
|
+
readonly declaredIn: string;
|
|
63
|
+
readonly answeredBy: string;
|
|
64
|
+
readonly matchedVia: readonly ReuseMatchSource[];
|
|
65
|
+
readonly nameMatch: ReuseNameMatch;
|
|
66
|
+
}[];
|
|
67
|
+
/** Public exports a curated entry deliberately `supersedes` — covered by intent. */
|
|
68
|
+
readonly superseded: readonly {
|
|
69
|
+
readonly export: string;
|
|
70
|
+
readonly package: string;
|
|
71
|
+
readonly supersededBy: readonly string[];
|
|
72
|
+
}[];
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=reuse-coverage-report.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reuse-coverage-report.d.ts","sourceRoot":"","sources":["../../src/reuse/reuse-coverage-report.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC5F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEzE;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,qDAAqD;IACrD,QAAQ,CAAC,OAAO,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACnD,gFAAgF;IAChF,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,KAAK,EAAE,SAAS;YAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAC1G,wEAAwE;QACxE,QAAQ,CAAC,oBAAoB,EAAE,SAAS;YAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QACtH,oDAAoD;QACpD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QACrB,yFAAyF;QACzF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;QAClD,wFAAwF;QACxF,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;QACrC;;;WAGG;QACH,QAAQ,CAAC,mBAAmB,EAAE,SAAS,mBAAmB,EAAE,CAAC;KAC9D,CAAC;IACF,sDAAsD;IACtD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,wDAAwD;IACxD,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,8EAA8E;IAC9E,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,iDAAiD;IACjD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,wFAAwF;IACxF,QAAQ,CAAC,SAAS,EAAE,SAAS;QAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;QAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;KAC3B,EAAE,CAAC;IACJ,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS;QAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;QAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;QAC5B,QAAQ,CAAC,UAAU,EAAE,SAAS,gBAAgB,EAAE,CAAC;QACjD,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;KACpC,EAAE,CAAC;IACJ,oFAAoF;IACpF,QAAQ,CAAC,UAAU,EAAE,SAAS;QAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;KAC1C,EAAE,CAAC;CACL"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ReuseImportStyle } from '@shrkcrft/core';
|
|
2
|
+
import type { ReuseCuratedStatus } from './reuse-curated-status.js';
|
|
3
|
+
/** One curated `reusePrimitives[]` entry measured against the code graph. */
|
|
4
|
+
export interface IReuseCuratedCoverage {
|
|
5
|
+
readonly symbol: string;
|
|
6
|
+
readonly status: ReuseCuratedStatus;
|
|
7
|
+
/**
|
|
8
|
+
* False when the status could not be measured: the only exported
|
|
9
|
+
* declarations live in a package with no resolved entry, so whether they are
|
|
10
|
+
* public is unknown (the status then reads as the best available, NOT as a
|
|
11
|
+
* finding).
|
|
12
|
+
*/
|
|
13
|
+
readonly statusMeasured: boolean;
|
|
14
|
+
/** Why the status was not measured. */
|
|
15
|
+
readonly statusNote?: string;
|
|
16
|
+
/** Packages whose public surface exposes the symbol. */
|
|
17
|
+
readonly publicIn: readonly string[];
|
|
18
|
+
/** Every indexed declaration of the name. */
|
|
19
|
+
readonly declaredIn: readonly string[];
|
|
20
|
+
readonly declKind?: string;
|
|
21
|
+
/** Real consumer files of the (primary) declaration, when the graph was asked. */
|
|
22
|
+
readonly consumers?: number;
|
|
23
|
+
readonly importPath?: string;
|
|
24
|
+
/**
|
|
25
|
+
* `true` / `false` when the configured `importPath` was checked: does the
|
|
26
|
+
* module it names expose the symbol (would the copy-paste import `shrk reuse`
|
|
27
|
+
* prints compile)? Absent when it could not be checked — see `importPathNote`.
|
|
28
|
+
*/
|
|
29
|
+
readonly importPathAgrees?: boolean;
|
|
30
|
+
readonly importPathNote?: string;
|
|
31
|
+
/** How the printed import binds the symbol — `default` for a default export. */
|
|
32
|
+
readonly importStyle?: ReuseImportStyle;
|
|
33
|
+
/** The exact import line `shrk reuse` prints for this entry (same resolver). */
|
|
34
|
+
readonly importLine?: string;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=reuse-curated-coverage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reuse-curated-coverage.d.ts","sourceRoot":"","sources":["../../src/reuse/reuse-curated-coverage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,6EAA6E;AAC7E,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IACpC;;;;;OAKG;IACH,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,uCAAuC;IACvC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,6CAA6C;IAC7C,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,kFAAkF;IAClF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IACpC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,gFAAgF;IAChF,QAAQ,CAAC,WAAW,CAAC,EAAE,gBAAgB,CAAC;IACxC,gFAAgF;IAChF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|