@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,527 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE recommendation ranking — one ranked list, owned by the inspector.
|
|
3
|
+
*
|
|
4
|
+
* The recommend headline used to be assembled by two promotion paths (the
|
|
5
|
+
* inspector's ranker arbitration and the CLI's routing-hint "R1" block) with
|
|
6
|
+
* three threshold pairs, a CLI-only grounding prepend, and a confidence
|
|
7
|
+
* ladder keyed on WHICH code path fired. A routing hint could match at score
|
|
8
|
+
* 7 and still be dropped for every non-create intent while the uncertainty
|
|
9
|
+
* line said "No recipe matched", and MCP / `shrk context` never saw a hint's
|
|
10
|
+
* commands at all.
|
|
11
|
+
*
|
|
12
|
+
* Now every signal source proposes candidates into one list:
|
|
13
|
+
* diagnostic (`--from-error`) · planning (grounding, pinned) · routing hint ·
|
|
14
|
+
* ranker template · ranker pipeline · built-in recipe · intent fallback.
|
|
15
|
+
* Each candidate is normalised by ITS OWN floor (`RECOMMEND_SOURCE_FLOORS`),
|
|
16
|
+
* so 1.0 means "just strong enough" whatever the source; the configured floor
|
|
17
|
+
* is a multiplier on that. Eligibility is gated by THE query-intent classifier
|
|
18
|
+
* (a source-writing scaffold is never recommended for non-create work) and by
|
|
19
|
+
* distinct-term evidence (a ranker match on one incidental word is not a
|
|
20
|
+
* match). Confidence (`deriveRecommendationConfidence`) is a function of the
|
|
21
|
+
* same scores, and `nextCommand` is picked LAST from the final list.
|
|
22
|
+
* Suppressed candidates stay in the list with their reason — never silent.
|
|
23
|
+
*/
|
|
24
|
+
import { MatchConfidenceVerdict } from '@shrkcrft/core';
|
|
25
|
+
import { ChangeIntentKind, classifyChangeIntent } from "./change-intent.js";
|
|
26
|
+
import { commandSafetyLevel } from "./command-safety-level.js";
|
|
27
|
+
import { buildDiagnosticByCode, listDiagnostics } from "./failure-diagnostics.js";
|
|
28
|
+
import { prepareTermQuery } from "./match-terms.js";
|
|
29
|
+
import { classifyQueryIntent, intentAdmitsSourceWrites } from "./query-intent.js";
|
|
30
|
+
import { QueryIntent } from "./query-intent-kind.js";
|
|
31
|
+
import { matchRecommendRecipe, RECOMMEND_RECIPES } from "./recommend-recipes.js";
|
|
32
|
+
import { RecommendationSource } from "./recommendation-source.js";
|
|
33
|
+
import { RecommendationSuppression } from "./recommendation-suppression.js";
|
|
34
|
+
import { rankAll } from "./task-ranker.js";
|
|
35
|
+
import { explainTaskRouting } from "./task-routing-hint-registry.js";
|
|
36
|
+
/**
|
|
37
|
+
* Each source's own floor, in its own raw units — the ONE table that replaced
|
|
38
|
+
* the inspector's 6/8 promote thresholds and the CLI's 3 (hint promote) and
|
|
39
|
+
* 3/3 (engine match) thresholds.
|
|
40
|
+
*/
|
|
41
|
+
export const RECOMMEND_SOURCE_FLOORS = {
|
|
42
|
+
[RecommendationSource.Diagnostic]: 1,
|
|
43
|
+
[RecommendationSource.Planning]: 1,
|
|
44
|
+
// explainTaskRouting: +2 per keyword, +3 per phrase, +2 per regex (+ boost) —
|
|
45
|
+
// at least one phrase, or two keyword/regex hits.
|
|
46
|
+
[RecommendationSource.RoutingHint]: 3,
|
|
47
|
+
[RecommendationSource.RankerTemplate]: 6,
|
|
48
|
+
// Higher than templates: a generic catch-all pipeline scores low on noise.
|
|
49
|
+
[RecommendationSource.RankerPipeline]: 8,
|
|
50
|
+
// 2 × distinct matched recipe terms/phrases.
|
|
51
|
+
[RecommendationSource.Recipe]: 2,
|
|
52
|
+
[RecommendationSource.IntentFallback]: 1,
|
|
53
|
+
};
|
|
54
|
+
/** Tie-break: project data beats the engine's built-ins. */
|
|
55
|
+
const SOURCE_PRECEDENCE = {
|
|
56
|
+
[RecommendationSource.Diagnostic]: 0,
|
|
57
|
+
[RecommendationSource.RoutingHint]: 1,
|
|
58
|
+
[RecommendationSource.RankerTemplate]: 2,
|
|
59
|
+
[RecommendationSource.RankerPipeline]: 3,
|
|
60
|
+
[RecommendationSource.Recipe]: 4,
|
|
61
|
+
[RecommendationSource.Planning]: 5,
|
|
62
|
+
[RecommendationSource.IntentFallback]: 6,
|
|
63
|
+
};
|
|
64
|
+
/** Every intent-fallback row scores this (normalised): always below the default floor. */
|
|
65
|
+
const INTENT_FALLBACK_SCORE = 0.5;
|
|
66
|
+
/** A different-source runner-up at or above this share of the top makes the answer `medium`. */
|
|
67
|
+
const CLOSE_RUNNER_UP_RATIO = 0.75;
|
|
68
|
+
/** A ranker match must share at least this many DISTINCT content terms with the query. */
|
|
69
|
+
const MIN_RANKER_TERMS = 2;
|
|
70
|
+
const DEFAULT_FLOOR = 1;
|
|
71
|
+
function round2(n) {
|
|
72
|
+
return Math.round(n * 100) / 100;
|
|
73
|
+
}
|
|
74
|
+
function fmt(n) {
|
|
75
|
+
return n.toFixed(2);
|
|
76
|
+
}
|
|
77
|
+
/** Planning and the intent fallback never make an answer confident. */
|
|
78
|
+
export function countsTowardConfidence(source) {
|
|
79
|
+
return source !== RecommendationSource.Planning && source !== RecommendationSource.IntentFallback;
|
|
80
|
+
}
|
|
81
|
+
/** The floor multiplier: explicit (CLI `--min-score` / MCP `minScore`) > config `recommend.minScore` > 1. */
|
|
82
|
+
export function resolveRecommendFloor(inspection, explicit) {
|
|
83
|
+
if (explicit !== undefined && Number.isFinite(explicit) && explicit > 0)
|
|
84
|
+
return explicit;
|
|
85
|
+
const configured = inspection.config?.recommend?.minScore;
|
|
86
|
+
if (configured !== undefined && Number.isFinite(configured) && configured > 0)
|
|
87
|
+
return configured;
|
|
88
|
+
return DEFAULT_FLOOR;
|
|
89
|
+
}
|
|
90
|
+
function sourceLabel(source) {
|
|
91
|
+
switch (source) {
|
|
92
|
+
case RecommendationSource.RoutingHint:
|
|
93
|
+
return 'routing hint';
|
|
94
|
+
case RecommendationSource.Recipe:
|
|
95
|
+
return 'recipe';
|
|
96
|
+
case RecommendationSource.RankerTemplate:
|
|
97
|
+
return 'ranker template';
|
|
98
|
+
case RecommendationSource.RankerPipeline:
|
|
99
|
+
return 'ranker pipeline';
|
|
100
|
+
case RecommendationSource.Diagnostic:
|
|
101
|
+
return 'diagnostic';
|
|
102
|
+
case RecommendationSource.Planning:
|
|
103
|
+
return 'planning query';
|
|
104
|
+
default:
|
|
105
|
+
return 'intent fallback';
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/** THE one-line attribution of a candidate, e.g. `routing hint "billing-refactor" (score 7, floor 3)`. */
|
|
109
|
+
export function describeRecommendationSource(c) {
|
|
110
|
+
const id = c.sourceId ?? '?';
|
|
111
|
+
switch (c.source) {
|
|
112
|
+
case RecommendationSource.Diagnostic:
|
|
113
|
+
return `diagnostic "${id}"`;
|
|
114
|
+
case RecommendationSource.Planning:
|
|
115
|
+
return `planning query ("${id}")`;
|
|
116
|
+
case RecommendationSource.IntentFallback:
|
|
117
|
+
return `intent fallback (${id})`;
|
|
118
|
+
default:
|
|
119
|
+
return `${sourceLabel(c.source)} "${id}" (score ${round2(c.rawScore)}, floor ${c.sourceFloor})`;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/** THE wording of why a candidate was kept out of the list. */
|
|
123
|
+
export function describeSuppression(c, intent) {
|
|
124
|
+
switch (c.suppressedReason) {
|
|
125
|
+
case RecommendationSuppression.NonCreateIntent:
|
|
126
|
+
return `writes source, and the query is not create/build work${intent?.vetoedBy ? ` ("${intent.vetoedBy}" makes it a repair/diagnosis)` : ''}`;
|
|
127
|
+
case RecommendationSuppression.SingleIncidentalTerm:
|
|
128
|
+
return `shares ${c.matchedTerms.length} distinct term(s) with the query — one incidental word is not evidence`;
|
|
129
|
+
case RecommendationSuppression.BelowFloor:
|
|
130
|
+
return c.weak ? 'writes source, below its floor' : 'writes source, withheld while nothing is confident';
|
|
131
|
+
default:
|
|
132
|
+
return '';
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/** The evidence sentence reasons are built from. */
|
|
136
|
+
function evidenceSentence(c) {
|
|
137
|
+
const label = sourceLabel(c.source);
|
|
138
|
+
const head = label.charAt(0).toUpperCase() + label.slice(1);
|
|
139
|
+
const terms = c.matchedTerms.length > 0 ? `: ${c.matchedTerms.join(', ')}` : '';
|
|
140
|
+
return `${head} "${c.sourceId ?? '?'}" matched (score ${round2(c.rawScore)}, floor ${c.sourceFloor}${terms}).`;
|
|
141
|
+
}
|
|
142
|
+
function makeCandidate(input, floor, safetyOf) {
|
|
143
|
+
const sourceFloor = RECOMMEND_SOURCE_FLOORS[input.source];
|
|
144
|
+
const normalisedScore = round2(input.normalisedOverride ?? input.rawScore / sourceFloor);
|
|
145
|
+
// The command's DECLARED safety (the CLI's catalog, injected) wins; the regex
|
|
146
|
+
// is only the fallback for a surface with no catalog or an uncatalogued string.
|
|
147
|
+
const declared = safetyOf?.(input.command);
|
|
148
|
+
const safetyLevel = declared?.safetyLevel ?? commandSafetyLevel(input.command);
|
|
149
|
+
return {
|
|
150
|
+
command: input.command,
|
|
151
|
+
why: input.why,
|
|
152
|
+
safetyLevel,
|
|
153
|
+
source: input.source,
|
|
154
|
+
...(input.sourceId !== undefined ? { sourceId: input.sourceId } : {}),
|
|
155
|
+
rawScore: input.rawScore,
|
|
156
|
+
sourceFloor,
|
|
157
|
+
normalisedScore,
|
|
158
|
+
matchedTerms: input.matchedTerms ?? [],
|
|
159
|
+
writesSource: declared?.writesSource ?? safetyLevel === 'writes-source',
|
|
160
|
+
// A pinned planning row is a deterministic read-only first step, never a guess.
|
|
161
|
+
weak: input.source === RecommendationSource.Planning ? false : normalisedScore < floor,
|
|
162
|
+
attribution: describeRecommendationSource({
|
|
163
|
+
source: input.source,
|
|
164
|
+
...(input.sourceId !== undefined ? { sourceId: input.sourceId } : {}),
|
|
165
|
+
rawScore: input.rawScore,
|
|
166
|
+
sourceFloor,
|
|
167
|
+
}),
|
|
168
|
+
...(input.docsLink ? { docsLink: input.docsLink } : {}),
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function withSuppression(c, reason) {
|
|
172
|
+
return reason === undefined ? c : { ...c, suppressedReason: reason };
|
|
173
|
+
}
|
|
174
|
+
/** Planning pinned first; then normalised score desc; then source precedence; then declaration order. */
|
|
175
|
+
function sortCandidates(rows) {
|
|
176
|
+
return rows
|
|
177
|
+
.map((c, i) => ({ c, i }))
|
|
178
|
+
.sort((a, b) => {
|
|
179
|
+
const pa = a.c.source === RecommendationSource.Planning ? 0 : 1;
|
|
180
|
+
const pb = b.c.source === RecommendationSource.Planning ? 0 : 1;
|
|
181
|
+
if (pa !== pb)
|
|
182
|
+
return pa - pb;
|
|
183
|
+
if (b.c.normalisedScore !== a.c.normalisedScore)
|
|
184
|
+
return b.c.normalisedScore - a.c.normalisedScore;
|
|
185
|
+
const sp = SOURCE_PRECEDENCE[a.c.source] - SOURCE_PRECEDENCE[b.c.source];
|
|
186
|
+
if (sp !== 0)
|
|
187
|
+
return sp;
|
|
188
|
+
return a.i - b.i;
|
|
189
|
+
})
|
|
190
|
+
.map((x) => x.c);
|
|
191
|
+
}
|
|
192
|
+
/** Dedup by command, keeping the first (best) row; the kept row names every other source that proposed it. */
|
|
193
|
+
function dedupeByCommand(rows) {
|
|
194
|
+
const out = [];
|
|
195
|
+
const index = new Map();
|
|
196
|
+
for (const c of rows) {
|
|
197
|
+
const at = index.get(c.command);
|
|
198
|
+
if (at === undefined) {
|
|
199
|
+
index.set(c.command, out.length);
|
|
200
|
+
out.push(c);
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
const kept = out[at];
|
|
204
|
+
if (kept.attribution === c.attribution || (kept.alsoProposedBy ?? []).includes(c.attribution))
|
|
205
|
+
continue;
|
|
206
|
+
out[at] = {
|
|
207
|
+
...kept,
|
|
208
|
+
alsoProposedBy: [...(kept.alsoProposedBy ?? []), c.attribution],
|
|
209
|
+
why: `${kept.why} Also proposed by ${c.attribution}.`,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
return out;
|
|
213
|
+
}
|
|
214
|
+
/** THE predicate behind `confident`: an eligible counting candidate at or above the floor. */
|
|
215
|
+
function hasConfidentCandidate(rows, floor) {
|
|
216
|
+
return rows.some((c) => !c.suppressedReason && countsTowardConfidence(c.source) && c.normalisedScore >= floor);
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* THE confidence authority for recommend, MCP `recommend_commands` and
|
|
220
|
+
* `shrk context` — a function of the ranked scores, never of which code path
|
|
221
|
+
* produced a row:
|
|
222
|
+
* - no eligible counting candidate at or above the floor → `confident:
|
|
223
|
+
* false`; verdict `no-confident-match` (or `no-match` when no source
|
|
224
|
+
* produced anything), level `low` / `unknown`;
|
|
225
|
+
* - the top is the shared ranker and a built-in recipe also cleared its
|
|
226
|
+
* floor → `medium`, `conflict-recipe-vs-ranker` and a `review:` warning;
|
|
227
|
+
* - a different-command runner-up from another source within 25% of the
|
|
228
|
+
* top → `medium` with a conflicting signal;
|
|
229
|
+
* - otherwise `high`.
|
|
230
|
+
*/
|
|
231
|
+
export function deriveRecommendationConfidence(candidates, floor) {
|
|
232
|
+
const counting = sortCandidates(candidates.filter((c) => !c.suppressedReason && countsTowardConfidence(c.source)));
|
|
233
|
+
const evidence = candidates.filter((c) => countsTowardConfidence(c.source));
|
|
234
|
+
const suppressed = candidates.filter((c) => c.suppressedReason !== undefined);
|
|
235
|
+
const strong = counting.filter((c) => c.normalisedScore >= floor);
|
|
236
|
+
const best = counting[0];
|
|
237
|
+
const bestFields = best
|
|
238
|
+
? { bestSource: best.source, ...(best.sourceId !== undefined ? { bestSourceId: best.sourceId } : {}) }
|
|
239
|
+
: {};
|
|
240
|
+
const reasons = [];
|
|
241
|
+
const missingSignals = [];
|
|
242
|
+
const conflictingSignals = [];
|
|
243
|
+
const increase = [];
|
|
244
|
+
const warnings = [];
|
|
245
|
+
const suppressedNote = suppressed.length > 0
|
|
246
|
+
? `${suppressed.length} candidate(s) suppressed — ${suppressed[0].command}: ${describeSuppression(suppressed[0])}.`
|
|
247
|
+
: undefined;
|
|
248
|
+
if (strong.length === 0) {
|
|
249
|
+
const verdict = evidence.length === 0 ? MatchConfidenceVerdict.NoMatch : MatchConfidenceVerdict.NoConfidentMatch;
|
|
250
|
+
if (best) {
|
|
251
|
+
reasons.push(`No confident match: best ${fmt(best.normalisedScore)} of floor ${fmt(floor)} — ${best.attribution}.`);
|
|
252
|
+
}
|
|
253
|
+
else if (evidence.length > 0) {
|
|
254
|
+
reasons.push(`No confident match: every matching candidate was suppressed (floor ${fmt(floor)}).`);
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
reasons.push('Nothing matched — no routing hint, recipe or ranker item shares a term with the query.');
|
|
258
|
+
}
|
|
259
|
+
if (suppressedNote)
|
|
260
|
+
reasons.push(suppressedNote);
|
|
261
|
+
missingSignals.push({
|
|
262
|
+
id: 'no-confident-match',
|
|
263
|
+
message: `No routing hint, recipe or ranker match cleared its floor (×${fmt(floor)}).`,
|
|
264
|
+
});
|
|
265
|
+
increase.push('Add a routing hint (sharkcraft/task-routing-hints.ts) whose keywords or phrases name this task class — its commands then headline.');
|
|
266
|
+
if (floor > DEFAULT_FLOOR)
|
|
267
|
+
increase.push(`Lower recommend.minScore / --min-score (currently ${fmt(floor)}).`);
|
|
268
|
+
return {
|
|
269
|
+
confident: false,
|
|
270
|
+
verdict,
|
|
271
|
+
floor,
|
|
272
|
+
bestScore: best?.normalisedScore ?? 0,
|
|
273
|
+
...bestFields,
|
|
274
|
+
level: verdict === MatchConfidenceVerdict.NoMatch ? 'unknown' : 'low',
|
|
275
|
+
reasons,
|
|
276
|
+
missingSignals,
|
|
277
|
+
conflictingSignals,
|
|
278
|
+
whatWouldIncreaseConfidence: increase,
|
|
279
|
+
warnings,
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
const top = strong[0];
|
|
283
|
+
const seen = new Set();
|
|
284
|
+
for (const c of strong) {
|
|
285
|
+
const key = `${c.source}:${c.sourceId ?? ''}`;
|
|
286
|
+
if (seen.has(key))
|
|
287
|
+
continue;
|
|
288
|
+
seen.add(key);
|
|
289
|
+
reasons.push(evidenceSentence(c));
|
|
290
|
+
if (seen.size >= 5)
|
|
291
|
+
break;
|
|
292
|
+
}
|
|
293
|
+
if (suppressedNote)
|
|
294
|
+
reasons.push(suppressedNote);
|
|
295
|
+
let level = 'high';
|
|
296
|
+
const rankerTop = top.source === RecommendationSource.RankerTemplate || top.source === RecommendationSource.RankerPipeline;
|
|
297
|
+
const recipeStrong = strong.find((c) => c.source === RecommendationSource.Recipe);
|
|
298
|
+
const runnerUp = counting.find((c) => c.command !== top.command && c.source !== top.source);
|
|
299
|
+
if (rankerTop && recipeStrong) {
|
|
300
|
+
level = 'medium';
|
|
301
|
+
const kind = top.source === RecommendationSource.RankerTemplate ? 'template' : 'pipeline';
|
|
302
|
+
reasons.push(`Keyword recipe "${recipeStrong.sourceId}" matched, but the shared ranker's ${kind} "${top.sourceId}" scored higher (${fmt(top.normalisedScore)} vs ${fmt(recipeStrong.normalisedScore)}) and headlines — review which fits.`);
|
|
303
|
+
conflictingSignals.push({
|
|
304
|
+
id: 'conflict-recipe-vs-ranker',
|
|
305
|
+
message: `Recipe "${recipeStrong.sourceId}" competes with ranker ${kind} "${top.sourceId}". The headline was routed to the ranker match; confirm the intended target.`,
|
|
306
|
+
});
|
|
307
|
+
increase.push('Add a routing hint so the task routes to your project playbook instead of a keyword recipe.');
|
|
308
|
+
warnings.push(`review: recipe keyword overlap was outranked by ranker ${kind} "${top.sourceId}" — headline routed to the ${kind === 'template' ? 'scaffold' : 'task packet'}; confirm before applying.`);
|
|
309
|
+
}
|
|
310
|
+
else if (runnerUp && runnerUp.normalisedScore >= top.normalisedScore * CLOSE_RUNNER_UP_RATIO) {
|
|
311
|
+
level = 'medium';
|
|
312
|
+
conflictingSignals.push({
|
|
313
|
+
id: `conflict-${top.source}-vs-${runnerUp.source}`,
|
|
314
|
+
message: `${top.attribution} (${fmt(top.normalisedScore)}) and ${runnerUp.attribution} (${fmt(runnerUp.normalisedScore)}) are within 25% — confirm the intended target.`,
|
|
315
|
+
});
|
|
316
|
+
increase.push('Tighten the weaker signal (or strengthen the right one) so one route clearly leads.');
|
|
317
|
+
}
|
|
318
|
+
return {
|
|
319
|
+
confident: true,
|
|
320
|
+
verdict: MatchConfidenceVerdict.Confident,
|
|
321
|
+
floor,
|
|
322
|
+
bestScore: top.normalisedScore,
|
|
323
|
+
...bestFields,
|
|
324
|
+
level,
|
|
325
|
+
reasons,
|
|
326
|
+
missingSignals,
|
|
327
|
+
conflictingSignals,
|
|
328
|
+
whatWouldIncreaseConfidence: increase,
|
|
329
|
+
warnings,
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* THE "what do I run first?" pick, over the FINAL rendered rows (the CLI calls
|
|
334
|
+
* it again after surface gating): when confident, the first non-weak row;
|
|
335
|
+
* otherwise the read-only planning / intent-fallback row, else
|
|
336
|
+
* `shrk start-here` — never a writes-source guess.
|
|
337
|
+
*/
|
|
338
|
+
export function pickNextCommand(rows, confident) {
|
|
339
|
+
if (confident) {
|
|
340
|
+
const first = rows.find((r) => r.weak !== true && r.safetyLevel !== undefined);
|
|
341
|
+
if (first)
|
|
342
|
+
return first.command;
|
|
343
|
+
}
|
|
344
|
+
const fallback = rows.find((r) => (r.source === RecommendationSource.Planning || r.source === RecommendationSource.IntentFallback) &&
|
|
345
|
+
r.safetyLevel === 'read-only');
|
|
346
|
+
return fallback?.command ?? 'shrk start-here';
|
|
347
|
+
}
|
|
348
|
+
/** Build THE ranked recommendation list for a query. See the module comment. */
|
|
349
|
+
export async function rankRecommendationCandidates(inspection, query, opts = {}) {
|
|
350
|
+
const trimmed = query.trim();
|
|
351
|
+
const floor = resolveRecommendFloor(inspection, opts.minScore);
|
|
352
|
+
const scaffoldGate = opts.scaffoldRequiresCreateIntent ?? inspection.config?.recommend?.scaffoldRequiresCreateIntent ?? true;
|
|
353
|
+
const intent = classifyQueryIntent(trimmed);
|
|
354
|
+
const quoted = trimmed.replace(/"/g, '\\"');
|
|
355
|
+
const drafts = [];
|
|
356
|
+
const push = (input) => {
|
|
357
|
+
drafts.push(makeCandidate(input, floor, opts.safetyOf));
|
|
358
|
+
};
|
|
359
|
+
// 1. Diagnostics — a stderr blob matching a known failure.
|
|
360
|
+
if (opts.fromError && opts.fromError.length > 0) {
|
|
361
|
+
const escape = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
362
|
+
for (const e of listDiagnostics()) {
|
|
363
|
+
const built = buildDiagnosticByCode(e.code, {});
|
|
364
|
+
const problem = built.problem.slice(0, 20);
|
|
365
|
+
const hit = new RegExp(escape(e.code), 'i').test(opts.fromError) ||
|
|
366
|
+
(problem.length > 0 && new RegExp(escape(problem), 'i').test(opts.fromError));
|
|
367
|
+
if (!hit)
|
|
368
|
+
continue;
|
|
369
|
+
push({
|
|
370
|
+
command: built.nextCommand,
|
|
371
|
+
why: `Diagnostic match: ${e.code}.`,
|
|
372
|
+
source: RecommendationSource.Diagnostic,
|
|
373
|
+
sourceId: e.code,
|
|
374
|
+
rawScore: 1,
|
|
375
|
+
...(built.docsLink ? { docsLink: built.docsLink } : {}),
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
// 2. Planning — grounding is the first step of a planning thread (DX#2, moved from the CLI).
|
|
380
|
+
if (trimmed.length > 0 && intent.intent === QueryIntent.Plan) {
|
|
381
|
+
push({
|
|
382
|
+
command: `shrk grounding "${quoted}" --json`,
|
|
383
|
+
why: `The query reads as planning ("${intent.planVerb ?? 'plan'}") — start with grounding (task-relevant rules / knowledge / templates / verification ids) before picking a write verb.`,
|
|
384
|
+
source: RecommendationSource.Planning,
|
|
385
|
+
sourceId: intent.planVerb ?? 'plan',
|
|
386
|
+
rawScore: 1,
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
// 3. Routing hints — one row per recommends.commands entry, in declared order.
|
|
390
|
+
let routingMatches = [];
|
|
391
|
+
if (trimmed.length > 0) {
|
|
392
|
+
try {
|
|
393
|
+
routingMatches = await explainTaskRouting(inspection, trimmed);
|
|
394
|
+
}
|
|
395
|
+
catch {
|
|
396
|
+
routingMatches = [];
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
const hintFloor = RECOMMEND_SOURCE_FLOORS[RecommendationSource.RoutingHint];
|
|
400
|
+
for (const m of routingMatches) {
|
|
401
|
+
const evidence = m.reasons.map((r) => r.replace(/^(keyword|phrase|regex): /, '$1 '));
|
|
402
|
+
for (const command of m.hint.recommends?.commands ?? []) {
|
|
403
|
+
if (typeof command !== 'string' || command.trim().length === 0)
|
|
404
|
+
continue;
|
|
405
|
+
push({
|
|
406
|
+
command,
|
|
407
|
+
why: `Routing hint "${m.hint.id}" matched (score ${m.score}, floor ${hintFloor}: ${evidence.join(', ')}).`,
|
|
408
|
+
source: RecommendationSource.RoutingHint,
|
|
409
|
+
sourceId: m.hint.id,
|
|
410
|
+
rawScore: m.score,
|
|
411
|
+
matchedTerms: evidence,
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
// 4. Built-in recipes — THE term matcher, 2 points per distinct matched term.
|
|
416
|
+
if (trimmed.length > 0) {
|
|
417
|
+
const termQuery = prepareTermQuery(trimmed);
|
|
418
|
+
for (const recipe of RECOMMEND_RECIPES) {
|
|
419
|
+
const matched = matchRecommendRecipe(recipe, termQuery, trimmed);
|
|
420
|
+
if (matched.length === 0)
|
|
421
|
+
continue;
|
|
422
|
+
for (const rec of recipe.recommendations) {
|
|
423
|
+
push({
|
|
424
|
+
command: rec.command,
|
|
425
|
+
why: rec.why,
|
|
426
|
+
source: RecommendationSource.Recipe,
|
|
427
|
+
sourceId: recipe.id,
|
|
428
|
+
rawScore: 2 * matched.length,
|
|
429
|
+
matchedTerms: matched,
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
// 5. The shared ranker (the one `brief` / `task` use) — its top template and pipeline.
|
|
435
|
+
let rankerTop = null;
|
|
436
|
+
if (trimmed.length > 0) {
|
|
437
|
+
try {
|
|
438
|
+
const ranking = rankAll(inspection, trimmed);
|
|
439
|
+
const t = ranking.templates[0];
|
|
440
|
+
const p = ranking.pipelines[0];
|
|
441
|
+
rankerTop = {
|
|
442
|
+
topTemplate: t ? { id: t.item.id, score: t.score } : null,
|
|
443
|
+
topPipeline: p ? { id: p.item.id, score: p.score } : null,
|
|
444
|
+
};
|
|
445
|
+
if (t) {
|
|
446
|
+
const terms = t.matchedTerms ?? [];
|
|
447
|
+
push({
|
|
448
|
+
command: `shrk gen ${t.item.id} <name> --dry-run`,
|
|
449
|
+
why: `Ranker matched template "${t.item.name}" (score ${t.score}, floor ${RECOMMEND_SOURCE_FLOORS[RecommendationSource.RankerTemplate]}; terms: ${terms.join(', ') || 'none'}) — the project scaffold for this create/build task.`,
|
|
450
|
+
source: RecommendationSource.RankerTemplate,
|
|
451
|
+
sourceId: t.item.id,
|
|
452
|
+
rawScore: t.score,
|
|
453
|
+
matchedTerms: terms,
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
if (p) {
|
|
457
|
+
const terms = p.matchedTerms ?? [];
|
|
458
|
+
push({
|
|
459
|
+
command: `shrk task "${quoted}"`,
|
|
460
|
+
why: `Ranker matched pipeline "${p.item.title}" (score ${p.score}, floor ${RECOMMEND_SOURCE_FLOORS[RecommendationSource.RankerPipeline]}; terms: ${terms.join(', ') || 'none'}) — run the full task packet for this task.`,
|
|
461
|
+
source: RecommendationSource.RankerPipeline,
|
|
462
|
+
sourceId: p.item.id,
|
|
463
|
+
rawScore: p.score,
|
|
464
|
+
matchedTerms: terms,
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
catch {
|
|
469
|
+
// The ranker is advisory — the other sources still answer.
|
|
470
|
+
rankerTop = null;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
// 6. Eligibility: THE intent classifier gates source-writing rows; a ranker
|
|
474
|
+
// match needs distinct-term evidence.
|
|
475
|
+
const gate = (c) => {
|
|
476
|
+
if (c.writesSource && scaffoldGate && !intentAdmitsSourceWrites(intent)) {
|
|
477
|
+
return RecommendationSuppression.NonCreateIntent;
|
|
478
|
+
}
|
|
479
|
+
if ((c.source === RecommendationSource.RankerTemplate || c.source === RecommendationSource.RankerPipeline) &&
|
|
480
|
+
c.matchedTerms.length < MIN_RANKER_TERMS) {
|
|
481
|
+
return RecommendationSuppression.SingleIncidentalTerm;
|
|
482
|
+
}
|
|
483
|
+
return undefined;
|
|
484
|
+
};
|
|
485
|
+
let candidates = drafts.map((c) => withSuppression(c, gate(c)));
|
|
486
|
+
// 7. Intent fallback — only when nothing counting cleared the floor; always below it.
|
|
487
|
+
if (!hasConfidentCandidate(candidates, floor)) {
|
|
488
|
+
const change = await classifyChangeIntent(trimmed, inspection);
|
|
489
|
+
const fallback = (command, why) => {
|
|
490
|
+
const c = makeCandidate({
|
|
491
|
+
command,
|
|
492
|
+
why,
|
|
493
|
+
source: RecommendationSource.IntentFallback,
|
|
494
|
+
sourceId: change.kind,
|
|
495
|
+
rawScore: INTENT_FALLBACK_SCORE,
|
|
496
|
+
normalisedOverride: INTENT_FALLBACK_SCORE,
|
|
497
|
+
}, floor, opts.safetyOf);
|
|
498
|
+
return withSuppression(c, gate(c));
|
|
499
|
+
};
|
|
500
|
+
candidates.push(fallback(change.suggestedFirstCommand, `Intent fallback (${change.kind}).`));
|
|
501
|
+
if (change.kind === ChangeIntentKind.Unknown) {
|
|
502
|
+
candidates.push(fallback('shrk start-here', 'No clear intent — start here.'));
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
// 8. A source-writing action never holds a slot at low confidence.
|
|
506
|
+
const confident = hasConfidentCandidate(candidates, floor);
|
|
507
|
+
candidates = candidates.map((c) => !c.suppressedReason && c.writesSource && (!confident || c.weak)
|
|
508
|
+
? withSuppression(c, RecommendationSuppression.BelowFloor)
|
|
509
|
+
: c);
|
|
510
|
+
// 9. Rank, dedup, then confidence and nextCommand from the final list.
|
|
511
|
+
const ordered = sortCandidates(candidates);
|
|
512
|
+
const recommendations = dedupeByCommand(ordered.filter((c) => !c.suppressedReason));
|
|
513
|
+
const suppressed = ordered.filter((c) => c.suppressedReason !== undefined);
|
|
514
|
+
const all = [...recommendations, ...suppressed];
|
|
515
|
+
const confidence = deriveRecommendationConfidence(all, floor);
|
|
516
|
+
return {
|
|
517
|
+
query: trimmed,
|
|
518
|
+
intent,
|
|
519
|
+
floor,
|
|
520
|
+
candidates: all,
|
|
521
|
+
recommendations,
|
|
522
|
+
confidence,
|
|
523
|
+
nextCommand: pickNextCommand(recommendations, confidence.confident),
|
|
524
|
+
routingMatches,
|
|
525
|
+
rankerTop,
|
|
526
|
+
};
|
|
527
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which signal proposed a recommendation. Every candidate in THE ranked list
|
|
3
|
+
* carries one, so a headline row is always attributable, and ties break on
|
|
4
|
+
* this precedence: project data (diagnostic, routing hint, ranker) beats the
|
|
5
|
+
* engine's built-in recipes and the intent fallback.
|
|
6
|
+
*/
|
|
7
|
+
export declare enum RecommendationSource {
|
|
8
|
+
/** A `--from-error` stderr blob matched a known diagnostic. */
|
|
9
|
+
Diagnostic = "diagnostic",
|
|
10
|
+
/** The query reads as planning: `shrk grounding` is pinned first (never counts toward confidence). */
|
|
11
|
+
Planning = "planning",
|
|
12
|
+
/** A project/pack task-routing hint matched; one row per `recommends.commands` entry. */
|
|
13
|
+
RoutingHint = "routing-hint",
|
|
14
|
+
/** The shared ranker's top template (`shrk gen <template>`). */
|
|
15
|
+
RankerTemplate = "ranker-template",
|
|
16
|
+
/** The shared ranker's top pipeline (`shrk task "<query>"`). */
|
|
17
|
+
RankerPipeline = "ranker-pipeline",
|
|
18
|
+
/** A built-in keyword recipe. */
|
|
19
|
+
Recipe = "recipe",
|
|
20
|
+
/** change-intent's suggested first command — always below the floor. */
|
|
21
|
+
IntentFallback = "intent-fallback"
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=recommendation-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recommendation-source.d.ts","sourceRoot":"","sources":["../src/recommendation-source.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,oBAAY,oBAAoB;IAC9B,+DAA+D;IAC/D,UAAU,eAAe;IACzB,sGAAsG;IACtG,QAAQ,aAAa;IACrB,yFAAyF;IACzF,WAAW,iBAAiB;IAC5B,gEAAgE;IAChE,cAAc,oBAAoB;IAClC,gEAAgE;IAChE,cAAc,oBAAoB;IAClC,iCAAiC;IACjC,MAAM,WAAW;IACjB,wEAAwE;IACxE,cAAc,oBAAoB;CACnC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which signal proposed a recommendation. Every candidate in THE ranked list
|
|
3
|
+
* carries one, so a headline row is always attributable, and ties break on
|
|
4
|
+
* this precedence: project data (diagnostic, routing hint, ranker) beats the
|
|
5
|
+
* engine's built-in recipes and the intent fallback.
|
|
6
|
+
*/
|
|
7
|
+
export var RecommendationSource;
|
|
8
|
+
(function (RecommendationSource) {
|
|
9
|
+
/** A `--from-error` stderr blob matched a known diagnostic. */
|
|
10
|
+
RecommendationSource["Diagnostic"] = "diagnostic";
|
|
11
|
+
/** The query reads as planning: `shrk grounding` is pinned first (never counts toward confidence). */
|
|
12
|
+
RecommendationSource["Planning"] = "planning";
|
|
13
|
+
/** A project/pack task-routing hint matched; one row per `recommends.commands` entry. */
|
|
14
|
+
RecommendationSource["RoutingHint"] = "routing-hint";
|
|
15
|
+
/** The shared ranker's top template (`shrk gen <template>`). */
|
|
16
|
+
RecommendationSource["RankerTemplate"] = "ranker-template";
|
|
17
|
+
/** The shared ranker's top pipeline (`shrk task "<query>"`). */
|
|
18
|
+
RecommendationSource["RankerPipeline"] = "ranker-pipeline";
|
|
19
|
+
/** A built-in keyword recipe. */
|
|
20
|
+
RecommendationSource["Recipe"] = "recipe";
|
|
21
|
+
/** change-intent's suggested first command — always below the floor. */
|
|
22
|
+
RecommendationSource["IntentFallback"] = "intent-fallback";
|
|
23
|
+
})(RecommendationSource || (RecommendationSource = {}));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why a candidate is kept OUT of the recommendation list. A suppressed row
|
|
3
|
+
* stays in the report's `ranked` list with its reason and is counted in one
|
|
4
|
+
* printed line — suppression is never silent.
|
|
5
|
+
*/
|
|
6
|
+
export declare enum RecommendationSuppression {
|
|
7
|
+
/** Writes source, and the query is not create/build work (`recommend.scaffoldRequiresCreateIntent`). */
|
|
8
|
+
NonCreateIntent = "non-create-intent",
|
|
9
|
+
/** A ranker match sharing fewer than 2 distinct terms with the query — one incidental word is not evidence. */
|
|
10
|
+
SingleIncidentalTerm = "single-incidental-term",
|
|
11
|
+
/** Writes source while nothing is confident, or below its own floor — never a low-confidence headline. */
|
|
12
|
+
BelowFloor = "below-floor"
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=recommendation-suppression.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recommendation-suppression.d.ts","sourceRoot":"","sources":["../src/recommendation-suppression.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,oBAAY,yBAAyB;IACnC,wGAAwG;IACxG,eAAe,sBAAsB;IACrC,+GAA+G;IAC/G,oBAAoB,2BAA2B;IAC/C,0GAA0G;IAC1G,UAAU,gBAAgB;CAC3B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why a candidate is kept OUT of the recommendation list. A suppressed row
|
|
3
|
+
* stays in the report's `ranked` list with its reason and is counted in one
|
|
4
|
+
* printed line — suppression is never silent.
|
|
5
|
+
*/
|
|
6
|
+
export var RecommendationSuppression;
|
|
7
|
+
(function (RecommendationSuppression) {
|
|
8
|
+
/** Writes source, and the query is not create/build work (`recommend.scaffoldRequiresCreateIntent`). */
|
|
9
|
+
RecommendationSuppression["NonCreateIntent"] = "non-create-intent";
|
|
10
|
+
/** A ranker match sharing fewer than 2 distinct terms with the query — one incidental word is not evidence. */
|
|
11
|
+
RecommendationSuppression["SingleIncidentalTerm"] = "single-incidental-term";
|
|
12
|
+
/** Writes source while nothing is confident, or below its own floor — never a low-confidence headline. */
|
|
13
|
+
RecommendationSuppression["BelowFloor"] = "below-floor";
|
|
14
|
+
})(RecommendationSuppression || (RecommendationSuppression = {}));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which asset kind declared a reference the staleness sweep visited.
|
|
3
|
+
*
|
|
4
|
+
* Knowledge entries were the only kind the sweep enumerated; boundary rules and
|
|
5
|
+
* policy checks describe directories and packages too, and a stale one was
|
|
6
|
+
* reported by nothing. Each kind is counted separately, so a reader can tell
|
|
7
|
+
* whether a kind was in the sweep at all.
|
|
8
|
+
*/
|
|
9
|
+
export declare enum ReferenceAssetKind {
|
|
10
|
+
Knowledge = "knowledge",
|
|
11
|
+
BoundaryRule = "boundary-rule",
|
|
12
|
+
Policy = "policy"
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=reference-asset-kind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference-asset-kind.d.ts","sourceRoot":"","sources":["../src/reference-asset-kind.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,oBAAY,kBAAkB;IAC5B,SAAS,cAAc;IACvB,YAAY,kBAAkB;IAC9B,MAAM,WAAW;CAClB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which asset kind declared a reference the staleness sweep visited.
|
|
3
|
+
*
|
|
4
|
+
* Knowledge entries were the only kind the sweep enumerated; boundary rules and
|
|
5
|
+
* policy checks describe directories and packages too, and a stale one was
|
|
6
|
+
* reported by nothing. Each kind is counted separately, so a reader can tell
|
|
7
|
+
* whether a kind was in the sweep at all.
|
|
8
|
+
*/
|
|
9
|
+
export var ReferenceAssetKind;
|
|
10
|
+
(function (ReferenceAssetKind) {
|
|
11
|
+
ReferenceAssetKind["Knowledge"] = "knowledge";
|
|
12
|
+
ReferenceAssetKind["BoundaryRule"] = "boundary-rule";
|
|
13
|
+
ReferenceAssetKind["Policy"] = "policy";
|
|
14
|
+
})(ReferenceAssetKind || (ReferenceAssetKind = {}));
|