@shrkcrft/cli 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/asset-preview/apply-asset-preview.js +1 -1
- package/dist/authoring/authoring-kit.d.ts +9 -1
- package/dist/authoring/authoring-kit.d.ts.map +1 -1
- package/dist/authoring/authoring-kit.js +26 -13
- package/dist/bootstrap/unlinked-workspace-dependency.d.ts +11 -0
- package/dist/bootstrap/unlinked-workspace-dependency.d.ts.map +1 -0
- package/dist/bootstrap/unlinked-workspace-dependency.js +99 -0
- package/dist/command-registry.d.ts +100 -1
- package/dist/command-registry.d.ts.map +1 -1
- package/dist/command-registry.js +130 -3
- package/dist/commands/api-diff.command.d.ts.map +1 -1
- package/dist/commands/api-diff.command.js +12 -0
- package/dist/commands/apply.command.d.ts.map +1 -1
- package/dist/commands/apply.command.js +3 -0
- package/dist/commands/arch.command.d.ts.map +1 -1
- package/dist/commands/arch.command.js +26 -7
- package/dist/commands/architecture.command.d.ts.map +1 -1
- package/dist/commands/architecture.command.js +8 -2
- package/dist/commands/baseline.command.d.ts +54 -3
- package/dist/commands/baseline.command.d.ts.map +1 -1
- package/dist/commands/baseline.command.js +582 -74
- package/dist/commands/biome.command.d.ts.map +1 -1
- package/dist/commands/biome.command.js +20 -0
- package/dist/commands/boundaries.command.d.ts +9 -1
- package/dist/commands/boundaries.command.d.ts.map +1 -1
- package/dist/commands/boundaries.command.js +88 -20
- package/dist/commands/bundle.command.d.ts.map +1 -1
- package/dist/commands/bundle.command.js +57 -11
- package/dist/commands/cache-align.command.d.ts.map +1 -1
- package/dist/commands/cache-align.command.js +3 -1
- package/dist/commands/changelog-data.d.ts.map +1 -1
- package/dist/commands/changelog-data.js +138 -0
- package/dist/commands/changes.command.d.ts.map +1 -1
- package/dist/commands/changes.command.js +15 -0
- package/dist/commands/check.command.d.ts.map +1 -1
- package/dist/commands/check.command.js +1241 -322
- package/dist/commands/checks.command.d.ts.map +1 -1
- package/dist/commands/checks.command.js +188 -40
- package/dist/commands/ci.command.d.ts.map +1 -1
- package/dist/commands/ci.command.js +35 -2
- package/dist/commands/code-intel.command.d.ts.map +1 -1
- package/dist/commands/code-intel.command.js +3 -0
- package/dist/commands/command-catalog.d.ts +23 -1
- package/dist/commands/command-catalog.d.ts.map +1 -1
- package/dist/commands/command-catalog.js +152 -35
- package/dist/commands/commands.command.d.ts +21 -3
- package/dist/commands/commands.command.d.ts.map +1 -1
- package/dist/commands/commands.command.js +172 -27
- package/dist/commands/compress.command.d.ts.map +1 -1
- package/dist/commands/compress.command.js +4 -0
- package/dist/commands/constructs.command.d.ts.map +1 -1
- package/dist/commands/constructs.command.js +50 -12
- package/dist/commands/context.command.d.ts.map +1 -1
- package/dist/commands/context.command.js +40 -5
- package/dist/commands/contract-templates.command.d.ts.map +1 -1
- package/dist/commands/contract-templates.command.js +9 -1
- package/dist/commands/contract.command.d.ts.map +1 -1
- package/dist/commands/contract.command.js +35 -0
- package/dist/commands/conventions.command.d.ts.map +1 -1
- package/dist/commands/conventions.command.js +189 -29
- package/dist/commands/coverage.command.d.ts.map +1 -1
- package/dist/commands/coverage.command.js +9 -0
- package/dist/commands/daily.commands.d.ts +0 -1
- package/dist/commands/daily.commands.d.ts.map +1 -1
- package/dist/commands/daily.commands.js +12 -76
- package/dist/commands/dashboard.command.d.ts.map +1 -1
- package/dist/commands/dashboard.command.js +10 -0
- package/dist/commands/dev.command.d.ts.map +1 -1
- package/dist/commands/dev.command.js +45 -2
- package/dist/commands/diagnostics.command.d.ts +0 -2
- package/dist/commands/diagnostics.command.d.ts.map +1 -1
- package/dist/commands/diagnostics.command.js +5 -78
- package/dist/commands/diff-check.command.d.ts +6 -4
- package/dist/commands/diff-check.command.d.ts.map +1 -1
- package/dist/commands/diff-check.command.js +190 -103
- package/dist/commands/docs-references.command.d.ts +13 -0
- package/dist/commands/docs-references.command.d.ts.map +1 -1
- package/dist/commands/docs-references.command.js +269 -72
- package/dist/commands/doctor.command.d.ts.map +1 -1
- package/dist/commands/doctor.command.js +58 -4
- package/dist/commands/drift.command.d.ts.map +1 -1
- package/dist/commands/drift.command.js +17 -4
- package/dist/commands/eslint.command.d.ts.map +1 -1
- package/dist/commands/eslint.command.js +20 -0
- package/dist/commands/export.command.d.ts.map +1 -1
- package/dist/commands/export.command.js +23 -1
- package/dist/commands/feedback-dispatch.command.d.ts.map +1 -1
- package/dist/commands/feedback-dispatch.command.js +29 -0
- package/dist/commands/feedback.command.d.ts.map +1 -1
- package/dist/commands/feedback.command.js +6 -1
- package/dist/commands/finish.command.d.ts.map +1 -1
- package/dist/commands/finish.command.js +32 -8
- package/dist/commands/fix.command.d.ts.map +1 -1
- package/dist/commands/fix.command.js +19 -0
- package/dist/commands/gate.command.d.ts +6 -1
- package/dist/commands/gate.command.d.ts.map +1 -1
- package/dist/commands/gate.command.js +50 -124
- package/dist/commands/gates.command.d.ts +52 -0
- package/dist/commands/gates.command.d.ts.map +1 -1
- package/dist/commands/gates.command.js +811 -185
- package/dist/commands/gen.command.d.ts.map +1 -1
- package/dist/commands/gen.command.js +4 -0
- package/dist/commands/generated.command.d.ts +33 -3
- package/dist/commands/generated.command.d.ts.map +1 -1
- package/dist/commands/generated.command.js +499 -147
- package/dist/commands/graph-code-subverbs.d.ts +15 -0
- package/dist/commands/graph-code-subverbs.d.ts.map +1 -1
- package/dist/commands/graph-code-subverbs.js +198 -24
- package/dist/commands/graph.command.d.ts.map +1 -1
- package/dist/commands/graph.command.js +79 -37
- package/dist/commands/help.command.d.ts +30 -6
- package/dist/commands/help.command.d.ts.map +1 -1
- package/dist/commands/help.command.js +323 -199
- package/dist/commands/helper.command.d.ts +1 -0
- package/dist/commands/helper.command.d.ts.map +1 -1
- package/dist/commands/helper.command.js +195 -56
- package/dist/commands/impact.command.d.ts.map +1 -1
- package/dist/commands/impact.command.js +115 -12
- package/dist/commands/infer.command.d.ts.map +1 -1
- package/dist/commands/infer.command.js +20 -45
- package/dist/commands/ingest.command.d.ts +0 -1
- package/dist/commands/ingest.command.d.ts.map +1 -1
- package/dist/commands/ingest.command.js +25 -41
- package/dist/commands/knowledge-author.command.d.ts +0 -3
- package/dist/commands/knowledge-author.command.d.ts.map +1 -1
- package/dist/commands/knowledge-author.command.js +10 -23
- package/dist/commands/knowledge.command.d.ts.map +1 -1
- package/dist/commands/knowledge.command.js +469 -129
- package/dist/commands/languages.command.d.ts.map +1 -1
- package/dist/commands/languages.command.js +27 -0
- package/dist/commands/lint.command.d.ts.map +1 -1
- package/dist/commands/lint.command.js +3 -0
- package/dist/commands/mcp.command.d.ts +18 -0
- package/dist/commands/mcp.command.d.ts.map +1 -1
- package/dist/commands/mcp.command.js +33 -8
- package/dist/commands/onboard.command.d.ts.map +1 -1
- package/dist/commands/onboard.command.js +20 -0
- package/dist/commands/owners.command.d.ts.map +1 -1
- package/dist/commands/owners.command.js +14 -2
- package/dist/commands/packs-new.d.ts +13 -1
- package/dist/commands/packs-new.d.ts.map +1 -1
- package/dist/commands/packs-new.js +500 -335
- package/dist/commands/packs.command.d.ts.map +1 -1
- package/dist/commands/packs.command.js +378 -36
- package/dist/commands/paths.command.d.ts.map +1 -1
- package/dist/commands/paths.command.js +9 -1
- package/dist/commands/pipelines.command.d.ts.map +1 -1
- package/dist/commands/pipelines.command.js +7 -1
- package/dist/commands/plan-check.command.d.ts.map +1 -1
- package/dist/commands/plan-check.command.js +3 -0
- package/dist/commands/plan.command.d.ts.map +1 -1
- package/dist/commands/plan.command.js +3 -0
- package/dist/commands/playbooks.command.d.ts.map +1 -1
- package/dist/commands/playbooks.command.js +7 -2
- package/dist/commands/policy-lint.command.d.ts +19 -2
- package/dist/commands/policy-lint.command.d.ts.map +1 -1
- package/dist/commands/policy-lint.command.js +224 -65
- package/dist/commands/policy.command.d.ts.map +1 -1
- package/dist/commands/policy.command.js +6 -1
- package/dist/commands/pr.command.d.ts.map +1 -1
- package/dist/commands/pr.command.js +14 -0
- package/dist/commands/presets.command.d.ts.map +1 -1
- package/dist/commands/presets.command.js +12 -27
- package/dist/commands/profiles.command.d.ts.map +1 -1
- package/dist/commands/profiles.command.js +94 -26
- package/dist/commands/provenance.command.js +1 -1
- package/dist/commands/quality.command.d.ts.map +1 -1
- package/dist/commands/quality.command.js +129 -33
- package/dist/commands/recommend.command.d.ts +20 -4
- package/dist/commands/recommend.command.d.ts.map +1 -1
- package/dist/commands/recommend.command.js +172 -278
- package/dist/commands/registrations.command.d.ts.map +1 -1
- package/dist/commands/registrations.command.js +138 -13
- package/dist/commands/registry-lifecycle-run.d.ts +14 -0
- package/dist/commands/registry-lifecycle-run.d.ts.map +1 -0
- package/dist/commands/registry-lifecycle-run.js +336 -0
- package/dist/commands/registry.command.d.ts.map +1 -1
- package/dist/commands/registry.command.js +235 -62
- package/dist/commands/release.command.d.ts.map +1 -1
- package/dist/commands/release.command.js +99 -20
- package/dist/commands/report.command.d.ts.map +1 -1
- package/dist/commands/report.command.js +38 -2
- package/dist/commands/reuse-coverage.command.d.ts +23 -0
- package/dist/commands/reuse-coverage.command.d.ts.map +1 -0
- package/dist/commands/reuse-coverage.command.js +536 -0
- package/dist/commands/reuse.command.d.ts +3 -18
- package/dist/commands/reuse.command.d.ts.map +1 -1
- package/dist/commands/reuse.command.js +395 -244
- package/dist/commands/review.command.d.ts.map +1 -1
- package/dist/commands/review.command.js +33 -1
- package/dist/commands/rounds.command.d.ts.map +1 -1
- package/dist/commands/rounds.command.js +5 -0
- package/dist/commands/safety.command.d.ts.map +1 -1
- package/dist/commands/safety.command.js +9 -0
- package/dist/commands/scaffolds.command.d.ts.map +1 -1
- package/dist/commands/scaffolds.command.js +97 -25
- package/dist/commands/search.command.d.ts +0 -8
- package/dist/commands/search.command.d.ts.map +1 -1
- package/dist/commands/search.command.js +136 -28
- package/dist/commands/self-config-xrefs.command.d.ts +24 -0
- package/dist/commands/self-config-xrefs.command.d.ts.map +1 -0
- package/dist/commands/self-config-xrefs.command.js +170 -0
- package/dist/commands/self-config.command.d.ts.map +1 -1
- package/dist/commands/self-config.command.js +261 -65
- package/dist/commands/smart-context.command.d.ts.map +1 -1
- package/dist/commands/smart-context.command.js +39 -3
- package/dist/commands/spec.command.d.ts.map +1 -1
- package/dist/commands/spec.command.js +3 -0
- package/dist/commands/stats.command.d.ts.map +1 -1
- package/dist/commands/stats.command.js +3 -0
- package/dist/commands/surface.command.d.ts +6 -1
- package/dist/commands/surface.command.d.ts.map +1 -1
- package/dist/commands/surface.command.js +256 -54
- package/dist/commands/task-context.command.js +1 -1
- package/dist/commands/task.command.d.ts.map +1 -1
- package/dist/commands/task.command.js +22 -1
- package/dist/commands/templates.command.d.ts +4 -0
- package/dist/commands/templates.command.d.ts.map +1 -1
- package/dist/commands/templates.command.js +109 -22
- package/dist/commands/test.command.d.ts.map +1 -1
- package/dist/commands/test.command.js +161 -33
- package/dist/commands/tests.command.d.ts.map +1 -1
- package/dist/commands/tests.command.js +29 -3
- package/dist/commands/trace.command.d.ts.map +1 -1
- package/dist/commands/trace.command.js +29 -4
- package/dist/commands/watch.command.d.ts.map +1 -1
- package/dist/commands/watch.command.js +3 -0
- package/dist/commands/why.command.d.ts.map +1 -1
- package/dist/commands/why.command.js +3 -0
- package/dist/commands/wiring.command.d.ts +18 -4
- package/dist/commands/wiring.command.d.ts.map +1 -1
- package/dist/commands/wiring.command.js +360 -73
- package/dist/dashboard/code-intelligence-data.js +4 -4
- package/dist/diff/deleted-orphan-coverage.d.ts +32 -0
- package/dist/diff/deleted-orphan-coverage.d.ts.map +1 -0
- package/dist/diff/deleted-orphan-coverage.js +107 -0
- package/dist/diff/deleted-orphan-scope-notes.d.ts +23 -0
- package/dist/diff/deleted-orphan-scope-notes.d.ts.map +1 -0
- package/dist/diff/deleted-orphan-scope-notes.js +49 -0
- package/dist/diff/deleted-orphans.d.ts +32 -0
- package/dist/diff/deleted-orphans.d.ts.map +1 -1
- package/dist/diff/deleted-orphans.js +42 -2
- package/dist/dispatch/closest-match.d.ts +15 -0
- package/dist/dispatch/closest-match.d.ts.map +1 -0
- package/dist/dispatch/closest-match.js +47 -0
- package/dist/dispatch/global-flags.d.ts +94 -0
- package/dist/dispatch/global-flags.d.ts.map +1 -0
- package/dist/dispatch/global-flags.js +123 -0
- package/dist/dispatch/guard-invocation-input.d.ts +24 -0
- package/dist/dispatch/guard-invocation-input.d.ts.map +1 -0
- package/dist/dispatch/guard-invocation-input.js +1 -0
- package/dist/dispatch/guard-invocation.d.ts +33 -0
- package/dist/dispatch/guard-invocation.d.ts.map +1 -0
- package/dist/dispatch/guard-invocation.js +183 -0
- package/dist/dispatch/help-intercept.d.ts +22 -0
- package/dist/dispatch/help-intercept.d.ts.map +1 -0
- package/dist/dispatch/help-intercept.js +42 -0
- package/dist/dispatch/i-declared-invocation.d.ts +17 -0
- package/dist/dispatch/i-declared-invocation.d.ts.map +1 -0
- package/dist/dispatch/i-declared-invocation.js +1 -0
- package/dist/dispatch/i-unknown-flag-refusal-input.d.ts +28 -0
- package/dist/dispatch/i-unknown-flag-refusal-input.d.ts.map +1 -0
- package/dist/dispatch/i-unknown-flag-refusal-input.js +1 -0
- package/dist/dispatch/invocation-rejection-kind.d.ts +15 -0
- package/dist/dispatch/invocation-rejection-kind.d.ts.map +1 -0
- package/dist/dispatch/invocation-rejection-kind.js +15 -0
- package/dist/dispatch/invocation-rejection.d.ts +18 -0
- package/dist/dispatch/invocation-rejection.d.ts.map +1 -0
- package/dist/dispatch/invocation-rejection.js +1 -0
- package/dist/dispatch/judge-invocation.d.ts +24 -0
- package/dist/dispatch/judge-invocation.d.ts.map +1 -0
- package/dist/dispatch/judge-invocation.js +50 -0
- package/dist/dispatch/positional-mode.d.ts +18 -0
- package/dist/dispatch/positional-mode.d.ts.map +1 -0
- package/dist/dispatch/positional-mode.js +18 -0
- package/dist/dispatch/read-tracking-map.d.ts +28 -0
- package/dist/dispatch/read-tracking-map.d.ts.map +1 -0
- package/dist/dispatch/read-tracking-map.js +58 -0
- package/dist/dispatch/refuse-sibling-valve-flags.d.ts +30 -0
- package/dist/dispatch/refuse-sibling-valve-flags.d.ts.map +1 -0
- package/dist/dispatch/refuse-sibling-valve-flags.js +65 -0
- package/dist/dispatch/subverb-spec.d.ts +26 -0
- package/dist/dispatch/subverb-spec.d.ts.map +1 -0
- package/dist/dispatch/subverb-spec.js +1 -0
- package/dist/dispatch/undocumented-flag-reads.d.ts +22 -0
- package/dist/dispatch/undocumented-flag-reads.d.ts.map +1 -0
- package/dist/dispatch/undocumented-flag-reads.js +283 -0
- package/dist/dispatch/unknown-flag-refusal-mode.d.ts +13 -0
- package/dist/dispatch/unknown-flag-refusal-mode.d.ts.map +1 -0
- package/dist/dispatch/unknown-flag-refusal-mode.js +13 -0
- package/dist/dispatch/unknown-flag-refusal.d.ts +22 -0
- package/dist/dispatch/unknown-flag-refusal.d.ts.map +1 -0
- package/dist/dispatch/unknown-flag-refusal.js +57 -0
- package/dist/dispatch/unread-flags.d.ts +152 -0
- package/dist/dispatch/unread-flags.d.ts.map +1 -0
- package/dist/dispatch/unread-flags.js +295 -0
- package/dist/dispatch/verdict-valve-flag.d.ts +21 -0
- package/dist/dispatch/verdict-valve-flag.d.ts.map +1 -0
- package/dist/dispatch/verdict-valve-flag.js +21 -0
- package/dist/dispatch/walk-declared-subverbs.d.ts +14 -0
- package/dist/dispatch/walk-declared-subverbs.d.ts.map +1 -0
- package/dist/dispatch/walk-declared-subverbs.js +28 -0
- package/dist/exit-codes.d.ts +41 -3
- package/dist/exit-codes.d.ts.map +1 -1
- package/dist/exit-codes.js +153 -14
- package/dist/finish/run-finish.d.ts +72 -5
- package/dist/finish/run-finish.d.ts.map +1 -1
- package/dist/finish/run-finish.js +453 -104
- package/dist/gates/accepted-empty-note.d.ts +10 -0
- package/dist/gates/accepted-empty-note.d.ts.map +1 -0
- package/dist/gates/accepted-empty-note.js +11 -0
- package/dist/gates/allow-empty.d.ts +25 -0
- package/dist/gates/allow-empty.d.ts.map +1 -0
- package/dist/gates/allow-empty.js +27 -0
- package/dist/gates/asset-doctor-failing-units.d.ts +16 -0
- package/dist/gates/asset-doctor-failing-units.d.ts.map +1 -0
- package/dist/gates/asset-doctor-failing-units.js +14 -0
- package/dist/gates/asset-doctor-failure-line.d.ts +16 -0
- package/dist/gates/asset-doctor-failure-line.d.ts.map +1 -0
- package/dist/gates/asset-doctor-failure-line.js +28 -0
- package/dist/gates/empty-rule-advice-lines.d.ts +15 -0
- package/dist/gates/empty-rule-advice-lines.d.ts.map +1 -0
- package/dist/gates/empty-rule-advice-lines.js +20 -0
- package/dist/gates/gate-envelope.d.ts +85 -8
- package/dist/gates/gate-envelope.d.ts.map +1 -1
- package/dist/gates/gate-envelope.js +56 -7
- package/dist/gates/gate-rule-globs.d.ts +37 -3
- package/dist/gates/gate-rule-globs.d.ts.map +1 -1
- package/dist/gates/gate-rule-globs.js +78 -40
- package/dist/gates/gate-rule-view.d.ts +17 -4
- package/dist/gates/gate-rule-view.d.ts.map +1 -1
- package/dist/gates/gate-rule-view.js +105 -90
- package/dist/gates/i-coverage-dead-glob.d.ts +19 -0
- package/dist/gates/i-coverage-dead-glob.d.ts.map +1 -0
- package/dist/gates/i-coverage-dead-glob.js +1 -0
- package/dist/gates/i-coverage-negation.d.ts +13 -0
- package/dist/gates/i-coverage-negation.d.ts.map +1 -0
- package/dist/gates/i-coverage-negation.js +1 -0
- package/dist/gates/i-registration-query-settle-input.d.ts +18 -0
- package/dist/gates/i-registration-query-settle-input.d.ts.map +1 -0
- package/dist/gates/i-registration-query-settle-input.js +1 -0
- package/dist/gates/i-unit-state-note-row.d.ts +16 -0
- package/dist/gates/i-unit-state-note-row.d.ts.map +1 -0
- package/dist/gates/i-unit-state-note-row.js +1 -0
- package/dist/gates/i-unit-state-notes.d.ts +32 -0
- package/dist/gates/i-unit-state-notes.d.ts.map +1 -0
- package/dist/gates/i-unit-state-notes.js +1 -0
- package/dist/gates/incomplete-registry-inventory.d.ts +19 -0
- package/dist/gates/incomplete-registry-inventory.d.ts.map +1 -0
- package/dist/gates/incomplete-registry-inventory.js +63 -0
- package/dist/gates/measure-registration-roles.d.ts +10 -0
- package/dist/gates/measure-registration-roles.d.ts.map +1 -0
- package/dist/gates/measure-registration-roles.js +9 -0
- package/dist/gates/plane-verdict.d.ts +14 -0
- package/dist/gates/plane-verdict.d.ts.map +1 -0
- package/dist/gates/plane-verdict.js +22 -0
- package/dist/gates/qualify-clean-for-units.d.ts +12 -0
- package/dist/gates/qualify-clean-for-units.d.ts.map +1 -0
- package/dist/gates/qualify-clean-for-units.js +18 -0
- package/dist/gates/registration-graph-verdict.d.ts +34 -0
- package/dist/gates/registration-graph-verdict.d.ts.map +1 -0
- package/dist/gates/registration-graph-verdict.js +70 -0
- package/dist/gates/registration-roles.d.ts +9 -0
- package/dist/gates/registration-roles.d.ts.map +1 -0
- package/dist/gates/registration-roles.js +1 -0
- package/dist/gates/registry-liveness.d.ts +11 -0
- package/dist/gates/registry-liveness.d.ts.map +1 -0
- package/dist/gates/registry-liveness.js +13 -0
- package/dist/gates/rule-coverage.d.ts +187 -4
- package/dist/gates/rule-coverage.d.ts.map +1 -1
- package/dist/gates/rule-coverage.js +501 -49
- package/dist/gates/run-gate-planes.d.ts +14 -0
- package/dist/gates/run-gate-planes.d.ts.map +1 -1
- package/dist/gates/run-gate-planes.js +172 -30
- package/dist/gates/scaffold-selftest.d.ts +56 -0
- package/dist/gates/scaffold-selftest.d.ts.map +1 -0
- package/dist/gates/scaffold-selftest.js +119 -0
- package/dist/gates/seam-rejected-rules.d.ts +28 -0
- package/dist/gates/seam-rejected-rules.d.ts.map +1 -0
- package/dist/gates/seam-rejected-rules.js +95 -0
- package/dist/gates/self-test-check.d.ts +29 -0
- package/dist/gates/self-test-check.d.ts.map +1 -0
- package/dist/gates/self-test-check.js +1 -0
- package/dist/gates/self-test-subject.d.ts +28 -0
- package/dist/gates/self-test-subject.d.ts.map +1 -0
- package/dist/gates/self-test-subject.js +1 -0
- package/dist/gates/self-test.d.ts +20 -0
- package/dist/gates/self-test.d.ts.map +1 -0
- package/dist/gates/self-test.js +82 -0
- package/dist/gates/settle-verdict.d.ts +14 -0
- package/dist/gates/settle-verdict.d.ts.map +1 -0
- package/dist/gates/settle-verdict.js +13 -0
- package/dist/gates/settled-verdict.d.ts +8 -0
- package/dist/gates/settled-verdict.d.ts.map +1 -0
- package/dist/gates/settled-verdict.js +1 -0
- package/dist/gates/template-registry-coverage.d.ts +18 -0
- package/dist/gates/template-registry-coverage.d.ts.map +1 -0
- package/dist/gates/template-registry-coverage.js +24 -0
- package/dist/gates/unit-state-notes.d.ts +40 -0
- package/dist/gates/unit-state-notes.d.ts.map +1 -0
- package/dist/gates/unit-state-notes.js +71 -0
- package/dist/gates/verdict-line.d.ts +18 -0
- package/dist/gates/verdict-line.d.ts.map +1 -0
- package/dist/gates/verdict-line.js +40 -0
- package/dist/graph/graph-reuse-lookup.d.ts +10 -0
- package/dist/graph/graph-reuse-lookup.d.ts.map +1 -0
- package/dist/graph/graph-reuse-lookup.js +41 -0
- package/dist/graph/index-behind-hint.d.ts +11 -0
- package/dist/graph/index-behind-hint.d.ts.map +1 -0
- package/dist/graph/index-behind-hint.js +27 -0
- package/dist/knowledge/knowledge-stale-gate-flags.d.ts +3 -0
- package/dist/knowledge/knowledge-stale-gate-flags.d.ts.map +1 -0
- package/dist/knowledge/knowledge-stale-gate-flags.js +1 -0
- package/dist/knowledge/knowledge-stale-gate-input.d.ts +3 -0
- package/dist/knowledge/knowledge-stale-gate-input.d.ts.map +1 -0
- package/dist/knowledge/knowledge-stale-gate-input.js +1 -0
- package/dist/knowledge/knowledge-stale-gate-result.d.ts +3 -0
- package/dist/knowledge/knowledge-stale-gate-result.d.ts.map +1 -0
- package/dist/knowledge/knowledge-stale-gate-result.js +1 -0
- package/dist/knowledge/knowledge-stale-gate.d.ts +10 -0
- package/dist/knowledge/knowledge-stale-gate.d.ts.map +1 -0
- package/dist/knowledge/knowledge-stale-gate.js +9 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +200 -83
- package/dist/output/failure-hints.d.ts.map +1 -1
- package/dist/output/failure-hints.js +11 -9
- package/dist/output/rejected-entries-note.d.ts +57 -0
- package/dist/output/rejected-entries-note.d.ts.map +1 -0
- package/dist/output/rejected-entries-note.js +103 -0
- package/dist/output/stdout-is-pipe.d.ts +13 -0
- package/dist/output/stdout-is-pipe.d.ts.map +1 -0
- package/dist/output/stdout-is-pipe.js +21 -0
- package/dist/packs/stale-build-warning.d.ts +11 -0
- package/dist/packs/stale-build-warning.d.ts.map +1 -0
- package/dist/packs/stale-build-warning.js +23 -0
- package/dist/quality/run-quality.d.ts +123 -0
- package/dist/quality/run-quality.d.ts.map +1 -0
- package/dist/quality/run-quality.js +442 -0
- package/dist/schemas/json-schemas.d.ts +184 -3
- package/dist/schemas/json-schemas.d.ts.map +1 -1
- package/dist/schemas/json-schemas.js +113 -2
- package/dist/shrk.d.ts +3 -0
- package/dist/shrk.d.ts.map +1 -0
- package/dist/shrk.js +30 -0
- package/dist/surface/audience-applicability.d.ts +26 -0
- package/dist/surface/audience-applicability.d.ts.map +1 -0
- package/dist/surface/audience-applicability.js +60 -0
- package/dist/surface/catalog-command-safety.d.ts +18 -0
- package/dist/surface/catalog-command-safety.d.ts.map +1 -0
- package/dist/surface/catalog-command-safety.js +62 -0
- package/dist/surface/cli-command-resolver.d.ts +21 -0
- package/dist/surface/cli-command-resolver.d.ts.map +1 -0
- package/dist/surface/cli-command-resolver.js +87 -0
- package/dist/surface/command-dispatch-kind.d.ts +20 -0
- package/dist/surface/command-dispatch-kind.d.ts.map +1 -0
- package/dist/surface/command-dispatch-kind.js +20 -0
- package/dist/surface/command-index-entry.d.ts +40 -0
- package/dist/surface/command-index-entry.d.ts.map +1 -0
- package/dist/surface/command-index-entry.js +1 -0
- package/dist/surface/command-index.d.ts +77 -0
- package/dist/surface/command-index.d.ts.map +1 -0
- package/dist/surface/command-index.js +323 -0
- package/dist/surface/i-command-index.d.ts +22 -0
- package/dist/surface/i-command-index.d.ts.map +1 -0
- package/dist/surface/i-command-index.js +1 -0
- package/dist/surface/i-command-string-context.d.ts +20 -0
- package/dist/surface/i-command-string-context.d.ts.map +1 -0
- package/dist/surface/i-command-string-context.js +1 -0
- package/dist/surface/i-surface-denial.d.ts +13 -0
- package/dist/surface/i-surface-denial.d.ts.map +1 -0
- package/dist/surface/i-surface-denial.js +1 -0
- package/dist/surface/load-surface-context.d.ts +17 -1
- package/dist/surface/load-surface-context.d.ts.map +1 -1
- package/dist/surface/load-surface-context.js +48 -10
- package/dist/surface/not-enabled-error.d.ts +38 -4
- package/dist/surface/not-enabled-error.d.ts.map +1 -1
- package/dist/surface/not-enabled-error.js +96 -6
- package/dist/surface/profiles.d.ts +7 -0
- package/dist/surface/profiles.d.ts.map +1 -1
- package/dist/surface/resolve-command-string.d.ts +10 -0
- package/dist/surface/resolve-command-string.d.ts.map +1 -0
- package/dist/surface/resolve-command-string.js +572 -0
- package/dist/surface/surface-config-writer.d.ts +7 -2
- package/dist/surface/surface-config-writer.d.ts.map +1 -1
- package/dist/surface/surface-config-writer.js +25 -6
- package/dist/surface/surface-layer.d.ts +11 -0
- package/dist/surface/surface-layer.d.ts.map +1 -0
- package/dist/surface/surface-layer.js +11 -0
- package/dist/surface/surface-refusal-reason.d.ts +16 -0
- package/dist/surface/surface-refusal-reason.d.ts.map +1 -0
- package/dist/surface/surface-refusal-reason.js +16 -0
- package/dist/surface/surface-selector.d.ts +26 -0
- package/dist/surface/surface-selector.d.ts.map +1 -0
- package/dist/surface/surface-selector.js +42 -0
- package/dist/surface/surface-summary.d.ts +61 -18
- package/dist/surface/surface-summary.d.ts.map +1 -1
- package/dist/surface/surface-summary.js +147 -60
- package/dist/surface/tier.d.ts +85 -22
- package/dist/surface/tier.d.ts.map +1 -1
- package/dist/surface/tier.js +132 -30
- package/dist/usage/usage-log.d.ts +6 -1
- package/dist/usage/usage-log.d.ts.map +1 -1
- package/dist/usage/usage-log.js +7 -2
- package/dist/validation/run-validation-loop.d.ts +9 -0
- package/dist/validation/run-validation-loop.d.ts.map +1 -1
- package/dist/validation/run-validation-loop.js +14 -11
- package/dist/validation/typecheck-emitted.d.ts +8 -9
- package/dist/validation/typecheck-emitted.d.ts.map +1 -1
- package/dist/validation/typecheck-emitted.js +17 -97
- package/package.json +34 -34
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { IVerdictCoverage } from '@shrkcrft/core';
|
|
2
|
+
import type { IDeletedOrphanScan } from './deleted-orphans.js';
|
|
3
|
+
/**
|
|
4
|
+
* What an orphan scan EXAMINED against what the delete asked it to — the one
|
|
5
|
+
* coverage authority for `check orphans` and the `finish` orphans sub-gate.
|
|
6
|
+
*
|
|
7
|
+
* "Who still imports the deleted code?" has two sides, and the code-graph
|
|
8
|
+
* index must be current on both for a clean answer to mean anything:
|
|
9
|
+
*
|
|
10
|
+
* - the DELETED side: a deleted source file the index does not know (the
|
|
11
|
+
* index predates it, or was rebuilt after the delete) had its importers
|
|
12
|
+
* never checked — expected, not examined;
|
|
13
|
+
* - the IMPORTER side: a file added or edited since the index was built may
|
|
14
|
+
* import the deleted code, and the index never read its current imports.
|
|
15
|
+
* While any such file exists, NO deleted file's importer set is complete,
|
|
16
|
+
* so every deleted file in scope is unexamined and the reason names the
|
|
17
|
+
* files the index never read (`scan.indexDivergence`, measured by the one
|
|
18
|
+
* freshness authority, `detectGraphFreshness`).
|
|
19
|
+
*
|
|
20
|
+
* Defining the unit as "indexed deleted files", or ignoring the importer side,
|
|
21
|
+
* would make either gap disappear by construction — the clean-over-a-stale-
|
|
22
|
+
* index verdict this closes.
|
|
23
|
+
*
|
|
24
|
+
* Only files the graph would index are in scope (`indexableDeleted`, the
|
|
25
|
+
* graph's `isGraphIndexablePath`), so deleting a README or a `dist/*.js` next
|
|
26
|
+
* to a `.ts` still reads clean. Nothing deleted, or nothing deleted that the
|
|
27
|
+
* graph indexes, is `expected: 0` — "nothing to examine" — which the caller may
|
|
28
|
+
* accept explicitly with `--allow-empty`; a stale index is irrelevant there
|
|
29
|
+
* (there is no deleted code for anything to import).
|
|
30
|
+
*/
|
|
31
|
+
export declare function deletedOrphanCoverage(scan: IDeletedOrphanScan): IVerdictCoverage;
|
|
32
|
+
//# sourceMappingURL=deleted-orphan-coverage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleted-orphan-coverage.d.ts","sourceRoot":"","sources":["../../src/diff/deleted-orphan-coverage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAU/D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,kBAAkB,GAAG,gBAAgB,CA6ChF"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/** How many unexamined labels the coverage carries (the verdict line shows 5). */
|
|
2
|
+
const LABEL_CAP = 20;
|
|
3
|
+
/** How many files-changed-since-the-index the reason names before summarising. */
|
|
4
|
+
const STALE_NAMES_IN_REASON = 3;
|
|
5
|
+
const UNINDEXED_REASON = 'not in the code-graph index, so their importers were never checked';
|
|
6
|
+
/**
|
|
7
|
+
* What an orphan scan EXAMINED against what the delete asked it to — the one
|
|
8
|
+
* coverage authority for `check orphans` and the `finish` orphans sub-gate.
|
|
9
|
+
*
|
|
10
|
+
* "Who still imports the deleted code?" has two sides, and the code-graph
|
|
11
|
+
* index must be current on both for a clean answer to mean anything:
|
|
12
|
+
*
|
|
13
|
+
* - the DELETED side: a deleted source file the index does not know (the
|
|
14
|
+
* index predates it, or was rebuilt after the delete) had its importers
|
|
15
|
+
* never checked — expected, not examined;
|
|
16
|
+
* - the IMPORTER side: a file added or edited since the index was built may
|
|
17
|
+
* import the deleted code, and the index never read its current imports.
|
|
18
|
+
* While any such file exists, NO deleted file's importer set is complete,
|
|
19
|
+
* so every deleted file in scope is unexamined and the reason names the
|
|
20
|
+
* files the index never read (`scan.indexDivergence`, measured by the one
|
|
21
|
+
* freshness authority, `detectGraphFreshness`).
|
|
22
|
+
*
|
|
23
|
+
* Defining the unit as "indexed deleted files", or ignoring the importer side,
|
|
24
|
+
* would make either gap disappear by construction — the clean-over-a-stale-
|
|
25
|
+
* index verdict this closes.
|
|
26
|
+
*
|
|
27
|
+
* Only files the graph would index are in scope (`indexableDeleted`, the
|
|
28
|
+
* graph's `isGraphIndexablePath`), so deleting a README or a `dist/*.js` next
|
|
29
|
+
* to a `.ts` still reads clean. Nothing deleted, or nothing deleted that the
|
|
30
|
+
* graph indexes, is `expected: 0` — "nothing to examine" — which the caller may
|
|
31
|
+
* accept explicitly with `--allow-empty`; a stale index is irrelevant there
|
|
32
|
+
* (there is no deleted code for anything to import).
|
|
33
|
+
*/
|
|
34
|
+
export function deletedOrphanCoverage(scan) {
|
|
35
|
+
const unit = 'deleted code files';
|
|
36
|
+
const scopeLabel = scan.ref === 'STAGED' ? 'staged' : `vs ${scan.ref}`;
|
|
37
|
+
if (scan.deleted.length === 0) {
|
|
38
|
+
return { unit, expected: 0, examined: 0, reason: `nothing deleted (${scopeLabel})` };
|
|
39
|
+
}
|
|
40
|
+
const resolved = scan.report?.resolvedDeleted ?? [];
|
|
41
|
+
const resolvedSet = new Set(resolved);
|
|
42
|
+
const indexable = new Set(scan.indexableDeleted ?? scan.deleted);
|
|
43
|
+
const unindexed = (scan.report?.unresolvedDeleted ?? []).filter((p) => indexable.has(p) && !resolvedSet.has(p));
|
|
44
|
+
const expected = resolved.length + unindexed.length;
|
|
45
|
+
if (expected === 0) {
|
|
46
|
+
return {
|
|
47
|
+
unit,
|
|
48
|
+
expected: 0,
|
|
49
|
+
examined: 0,
|
|
50
|
+
reason: `${scan.deleted.length} file(s) deleted (${scopeLabel}), none of them source the code graph indexes`,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const stale = staleIndexReason(scan);
|
|
54
|
+
if (stale !== undefined) {
|
|
55
|
+
const inScope = [...resolved, ...unindexed];
|
|
56
|
+
return {
|
|
57
|
+
unit,
|
|
58
|
+
expected,
|
|
59
|
+
examined: 0,
|
|
60
|
+
unexamined: inScope.slice(0, LABEL_CAP),
|
|
61
|
+
unexaminedTotal: inScope.length,
|
|
62
|
+
reason: unindexed.length > 0 ? `not in the code-graph index, or ${stale}` : stale,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
unit,
|
|
67
|
+
expected,
|
|
68
|
+
examined: resolved.length,
|
|
69
|
+
...(unindexed.length > 0
|
|
70
|
+
? {
|
|
71
|
+
unexamined: unindexed.slice(0, LABEL_CAP),
|
|
72
|
+
unexaminedTotal: unindexed.length,
|
|
73
|
+
reason: UNINDEXED_REASON,
|
|
74
|
+
}
|
|
75
|
+
: {}),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Why the importer side is unexamined, or `undefined` when the index is current
|
|
80
|
+
* for every surviving file. Reads as the tail of `…, K <reason>: <files>`.
|
|
81
|
+
*/
|
|
82
|
+
function staleIndexReason(scan) {
|
|
83
|
+
const divergence = scan.indexDivergence;
|
|
84
|
+
if (divergence === undefined)
|
|
85
|
+
return undefined;
|
|
86
|
+
if (!divergence.measured)
|
|
87
|
+
return 'checked against an index whose freshness could not be measured';
|
|
88
|
+
const changed = divergence.changed;
|
|
89
|
+
// The package half of the freshness authority: a package entry that changed
|
|
90
|
+
// since the index (and that the delete does not explain) means a bare
|
|
91
|
+
// `import … from '<pkg>'` was never re-resolved — the same stale input.
|
|
92
|
+
const packages = divergence.packagesChanged ?? [];
|
|
93
|
+
if (changed.length === 0 && packages.length === 0)
|
|
94
|
+
return undefined;
|
|
95
|
+
const parts = [];
|
|
96
|
+
if (changed.length > 0) {
|
|
97
|
+
const shown = changed.slice(0, STALE_NAMES_IN_REASON).join(', ');
|
|
98
|
+
const more = changed.length > STALE_NAMES_IN_REASON ? `, +${changed.length - STALE_NAMES_IN_REASON} more` : '';
|
|
99
|
+
parts.push(`checked against a stale index that never read ${changed.length} file(s) changed since it was built (${shown}${more})`);
|
|
100
|
+
}
|
|
101
|
+
if (packages.length > 0) {
|
|
102
|
+
const shown = packages.slice(0, STALE_NAMES_IN_REASON).join(', ');
|
|
103
|
+
const more = packages.length > STALE_NAMES_IN_REASON ? `, +${packages.length - STALE_NAMES_IN_REASON} more` : '';
|
|
104
|
+
parts.push(`${changed.length > 0 ? 'whose' : 'checked against a stale index whose'} package entry changed since it was built (${shown}${more}), so imports through it were never re-resolved`);
|
|
105
|
+
}
|
|
106
|
+
return parts.join(', and ');
|
|
107
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { IVerdictCoverage } from '@shrkcrft/core';
|
|
2
|
+
import type { IDeletedOrphanScan } from './deleted-orphans.js';
|
|
3
|
+
/**
|
|
4
|
+
* What an orphan answer must say about its own scope, next to the verdict line.
|
|
5
|
+
* Shared by `check orphans` and `impact --deleted`, which answer the same
|
|
6
|
+
* question ("who still imports the deleted code?") from the same scan and so
|
|
7
|
+
* must explain a partial answer the same way.
|
|
8
|
+
*
|
|
9
|
+
* - `index` — the `index` kv value, set when indexed code was deleted and the
|
|
10
|
+
* importer side is stale (the index never read files changed since it was
|
|
11
|
+
* built) or its freshness could not be measured;
|
|
12
|
+
* - `lead` — the NOT VERIFIED lead, set when the coverage left deleted code
|
|
13
|
+
* unexamined: why, and the remedy (index the PRE-delete tree, re-run
|
|
14
|
+
* `rerun`).
|
|
15
|
+
*
|
|
16
|
+
* The coverage itself comes from `deletedOrphanCoverage`, the one authority for
|
|
17
|
+
* what the scan examined; this only words it.
|
|
18
|
+
*/
|
|
19
|
+
export declare function deletedOrphanScopeNotes(scan: IDeletedOrphanScan, coverage: IVerdictCoverage, rerun: string): {
|
|
20
|
+
readonly index?: string;
|
|
21
|
+
readonly lead?: string;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=deleted-orphan-scope-notes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleted-orphan-scope-notes.d.ts","sourceRoot":"","sources":["../../src/diff/deleted-orphan-scope-notes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,kBAAkB,EACxB,QAAQ,EAAE,gBAAgB,EAC1B,KAAK,EAAE,MAAM,GACZ;IAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAqCrD"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an orphan answer must say about its own scope, next to the verdict line.
|
|
3
|
+
* Shared by `check orphans` and `impact --deleted`, which answer the same
|
|
4
|
+
* question ("who still imports the deleted code?") from the same scan and so
|
|
5
|
+
* must explain a partial answer the same way.
|
|
6
|
+
*
|
|
7
|
+
* - `index` — the `index` kv value, set when indexed code was deleted and the
|
|
8
|
+
* importer side is stale (the index never read files changed since it was
|
|
9
|
+
* built) or its freshness could not be measured;
|
|
10
|
+
* - `lead` — the NOT VERIFIED lead, set when the coverage left deleted code
|
|
11
|
+
* unexamined: why, and the remedy (index the PRE-delete tree, re-run
|
|
12
|
+
* `rerun`).
|
|
13
|
+
*
|
|
14
|
+
* The coverage itself comes from `deletedOrphanCoverage`, the one authority for
|
|
15
|
+
* what the scan examined; this only words it.
|
|
16
|
+
*/
|
|
17
|
+
export function deletedOrphanScopeNotes(scan, coverage, rerun) {
|
|
18
|
+
const divergence = scan.indexDivergence;
|
|
19
|
+
const packages = divergence?.packagesChanged ?? [];
|
|
20
|
+
const staleIndex = coverage.expected > 0 &&
|
|
21
|
+
divergence !== undefined &&
|
|
22
|
+
(!divergence.measured || divergence.changed.length > 0 || packages.length > 0);
|
|
23
|
+
const packageNote = packages.length > 0
|
|
24
|
+
? `package entry changed (${packages.slice(0, 3).join(', ')}${packages.length > 3 ? `, +${packages.length - 3} more` : ''})`
|
|
25
|
+
: undefined;
|
|
26
|
+
const index = staleIndex && divergence !== undefined
|
|
27
|
+
? divergence.measured
|
|
28
|
+
? `stale — ${[
|
|
29
|
+
divergence.changed.length > 0 ? `${divergence.changed.length} file(s) changed since it was built` : undefined,
|
|
30
|
+
packageNote,
|
|
31
|
+
]
|
|
32
|
+
.filter((s) => s !== undefined)
|
|
33
|
+
.join('; ')}`
|
|
34
|
+
: 'freshness could not be measured'
|
|
35
|
+
: undefined;
|
|
36
|
+
const staleLead = divergence !== undefined && divergence.measured && divergence.changed.length === 0 && packages.length > 0
|
|
37
|
+
? `The code-graph index predates a package entry change (${packages.slice(0, 3).join(', ')}), so an import of the deleted code through it was never re-resolved.\n`
|
|
38
|
+
: 'The code-graph index predates files changed since it was built, so an import of the deleted code in them was never checked.\n';
|
|
39
|
+
const lead = coverage.expected > 0 && coverage.examined < coverage.expected
|
|
40
|
+
? (staleIndex
|
|
41
|
+
? staleLead
|
|
42
|
+
: 'Deleted source files the code-graph index does not know were never checked for importers.\n') +
|
|
43
|
+
`Index the PRE-delete tree (\`shrk graph index\`), then re-run \`${rerun}\`.`
|
|
44
|
+
: undefined;
|
|
45
|
+
return {
|
|
46
|
+
...(index !== undefined ? { index } : {}),
|
|
47
|
+
...(lead !== undefined ? { lead } : {}),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -19,6 +19,38 @@ export interface IDeletedOrphanScan {
|
|
|
19
19
|
* loading the graph, so there is no report (and none is needed).
|
|
20
20
|
*/
|
|
21
21
|
readonly report?: IDeletedOrphanReport;
|
|
22
|
+
/**
|
|
23
|
+
* The deleted paths the code graph INDEXES (the graph's own authority,
|
|
24
|
+
* `isGraphIndexablePath` — extension AND skipped directories). A deleted
|
|
25
|
+
* README or `dist/x.js` is outside the orphan check's scope; a deleted `.ts`
|
|
26
|
+
* the index does not know is a gap in it. Present iff {@link report} is.
|
|
27
|
+
* Read by `deletedOrphanCoverage`.
|
|
28
|
+
*/
|
|
29
|
+
readonly indexableDeleted?: readonly string[];
|
|
30
|
+
/**
|
|
31
|
+
* How the code-graph index diverges from the tree on disk, measured by the
|
|
32
|
+
* one freshness authority (`detectGraphFreshness`). `changed` = indexable
|
|
33
|
+
* files NEW or MODIFIED since the index was built, the deleted set excluded:
|
|
34
|
+
* each is a possible importer of the deleted code whose current imports the
|
|
35
|
+
* index never read, so a clean orphan answer over them proves nothing.
|
|
36
|
+
* `measured: false` = the divergence could not be measured (also never a
|
|
37
|
+
* pass). Present iff {@link report} is. Read by `deletedOrphanCoverage`.
|
|
38
|
+
*/
|
|
39
|
+
readonly indexDivergence?: {
|
|
40
|
+
readonly measured: boolean;
|
|
41
|
+
readonly changed: readonly string[];
|
|
42
|
+
/**
|
|
43
|
+
* Workspace packages whose entry diverged since the index was built, that
|
|
44
|
+
* the delete does NOT explain (the one freshness authority's
|
|
45
|
+
* `packageDivergences`). Package entries are an index input no source
|
|
46
|
+
* fingerprint covers: after a package.json edit a bare `import … from
|
|
47
|
+
* '<pkg>'` resolves somewhere else, and the stale index still resolves it
|
|
48
|
+
* to the old entry — so an importer of the deleted code through it is
|
|
49
|
+
* invisible. A divergence whose indexed entry FILE is itself in the delete
|
|
50
|
+
* (dir unchanged) is explained: the orphan query covers imports of it.
|
|
51
|
+
*/
|
|
52
|
+
readonly packagesChanged?: readonly string[];
|
|
53
|
+
};
|
|
22
54
|
/** Why the scan failed. Present iff not `ok`. */
|
|
23
55
|
readonly reason?: DeletedOrphanScanFailure;
|
|
24
56
|
/** Human-readable failure detail. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleted-orphans.d.ts","sourceRoot":"","sources":["../../src/diff/deleted-orphans.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deleted-orphans.d.ts","sourceRoot":"","sources":["../../src/diff/deleted-orphans.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAGpE;;;;GAIG;AACH,MAAM,MAAM,wBAAwB,GAAG,kBAAkB,GAAG,eAAe,CAAC;AAE5E,+CAA+C;AAC/C,MAAM,WAAW,kBAAkB;IACjC,mFAAmF;IACnF,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,8EAA8E;IAC9E,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,8EAA8E;IAC9E,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,oBAAoB,CAAC;IACvC;;;;;;OAMG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9C;;;;;;;;OAQG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE;QACzB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;QAC3B,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;QACpC;;;;;;;;;WASG;QACH,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;KAC9C,CAAC;IACF,iDAAiD;IACjD,QAAQ,CAAC,MAAM,CAAC,EAAE,wBAAwB,CAAC;IAC3C,qCAAqC;IACrC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GACzC,OAAO,CAAC,kBAAkB,CAAC,CAoE7B"}
|
|
@@ -30,7 +30,7 @@ export async function computeDeletedOrphans(cwd, opts) {
|
|
|
30
30
|
if (changed.deleted.length === 0) {
|
|
31
31
|
return { ok: true, ref: changed.ref, deleted: [] };
|
|
32
32
|
}
|
|
33
|
-
const { GraphStore, GraphQueryApi } = await import('@shrkcrft/graph');
|
|
33
|
+
const { GraphStore, GraphQueryApi, detectGraphFreshness, isGraphIndexablePath } = await import('@shrkcrft/graph');
|
|
34
34
|
if (!new GraphStore(cwd).exists()) {
|
|
35
35
|
return {
|
|
36
36
|
ok: false,
|
|
@@ -42,5 +42,45 @@ export async function computeDeletedOrphans(cwd, opts) {
|
|
|
42
42
|
}
|
|
43
43
|
const { findDeletedOrphans } = await import('@shrkcrft/impact-engine');
|
|
44
44
|
const report = findDeletedOrphans(GraphQueryApi.fromStore(cwd), changed.deleted);
|
|
45
|
-
|
|
45
|
+
// The importer side of the question: the index answers "who imports the
|
|
46
|
+
// deleted code?" only for files whose CURRENT imports it has read. A file
|
|
47
|
+
// added or edited since the index was built may import the deleted code and
|
|
48
|
+
// the query would never see it — the stale-input shape CLAUDE.md says must be
|
|
49
|
+
// loud-skipped, measured by the one freshness authority.
|
|
50
|
+
const freshness = detectGraphFreshness(cwd);
|
|
51
|
+
const deletedSet = new Set(changed.deleted);
|
|
52
|
+
const changedSinceIndex = [...freshness.added, ...freshness.modified]
|
|
53
|
+
.filter((p) => !deletedSet.has(p))
|
|
54
|
+
.sort((a, b) => a.localeCompare(b));
|
|
55
|
+
// The package half of the same authority (`graphFreshnessBehind` counts it):
|
|
56
|
+
// a package entry that diverged since the index, unless the delete itself
|
|
57
|
+
// explains it. Reading added+modified alone called an index "current" that
|
|
58
|
+
// `graph status` calls stale (round 11 review).
|
|
59
|
+
const divergences = freshness.packageDivergences ?? freshness.packagesChanged.map((name) => ({ name }));
|
|
60
|
+
const packagesChanged = divergences
|
|
61
|
+
.filter((d) => !deleteExplainsDivergence(d, deletedSet))
|
|
62
|
+
.map((d) => d.name)
|
|
63
|
+
.sort((a, b) => a.localeCompare(b));
|
|
64
|
+
return {
|
|
65
|
+
ok: true,
|
|
66
|
+
ref: changed.ref,
|
|
67
|
+
deleted: changed.deleted,
|
|
68
|
+
report,
|
|
69
|
+
indexableDeleted: changed.deleted.filter((p) => isGraphIndexablePath(p)),
|
|
70
|
+
indexDivergence: {
|
|
71
|
+
measured: freshness.hasIndex,
|
|
72
|
+
changed: changedSinceIndex,
|
|
73
|
+
...(packagesChanged.length > 0 ? { packagesChanged } : {}),
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A package-entry divergence the delete EXPLAINS: the indexed entry file is
|
|
79
|
+
* part of the delete and the package did not move. Imports of that entry are
|
|
80
|
+
* exactly what the orphan query checks, so the index is not stale about it.
|
|
81
|
+
*/
|
|
82
|
+
function deleteExplainsDivergence(d, deleted) {
|
|
83
|
+
return (typeof d.storedEntry === 'string' &&
|
|
84
|
+
deleted.has(d.storedEntry) &&
|
|
85
|
+
(d.currentDir === undefined || d.currentDir === d.storedDir));
|
|
46
86
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Levenshtein edit distance — THE one (`@shrkcrft/inspector` `levenshtein`), under the CLI's name. */
|
|
2
|
+
export declare const editDistance: (a: string, b: string) => number;
|
|
3
|
+
/**
|
|
4
|
+
* Typo tolerance for an attempt: `max(1, floor(len / 4))` edits. A
|
|
5
|
+
* fingers-on-keys typo (`doctr`) is inside it; a different word is not.
|
|
6
|
+
*/
|
|
7
|
+
export declare function typoTolerance(attempt: string): number;
|
|
8
|
+
/**
|
|
9
|
+
* Candidates within `tolerance` edits of `attempt` (case-insensitive), nearest
|
|
10
|
+
* first, ties broken lexically — deterministic. At most `limit`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function closestMatches(attempt: string, candidates: Iterable<string>, limit?: number, tolerance?: number): string[];
|
|
13
|
+
/** The single nearest candidate within `tolerance`, or `undefined`. */
|
|
14
|
+
export declare function nearest(attempt: string, candidates: Iterable<string>, tolerance?: number): string | undefined;
|
|
15
|
+
//# sourceMappingURL=closest-match.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"closest-match.d.ts","sourceRoot":"","sources":["../../src/dispatch/closest-match.ts"],"names":[],"mappings":"AAgBA,uGAAuG;AACvG,eAAO,MAAM,YAAY,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAoB,CAAC;AAE1E;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,EAC5B,KAAK,SAAI,EACT,SAAS,GAAE,MAA+B,GACzC,MAAM,EAAE,CAYV;AAED,uEAAuE;AACvE,wBAAgB,OAAO,CACrB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,EAC5B,SAAS,GAAE,MAA+B,GACzC,MAAM,GAAG,SAAS,CAEpB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The command-TYPO tolerance policy for command NAMES and flags.
|
|
3
|
+
*
|
|
4
|
+
* `main.ts` (unknown verb), `help` (unknown topic), the flag guard and the
|
|
5
|
+
* command-string resolver (`resolveCommandString`) used to carry their own
|
|
6
|
+
* Levenshtein copies with their own tolerances; two of them agreed only by
|
|
7
|
+
* coincidence. They all read this now.
|
|
8
|
+
*
|
|
9
|
+
* The DISTANCE is not defined here: it is `@shrkcrft/inspector`'s `levenshtein`
|
|
10
|
+
* (nearest-id.ts), the one edit distance every "did you mean" in the tree
|
|
11
|
+
* uses. An unknown DECLARED ID (a test id, a rule id, a check id) is not a
|
|
12
|
+
* command typo — those sites call `nearestIds` (prefix / substring affinity,
|
|
13
|
+
* a length-scaled cutoff), never this module.
|
|
14
|
+
*/
|
|
15
|
+
import { levenshtein } from '@shrkcrft/inspector';
|
|
16
|
+
/** Levenshtein edit distance — THE one (`@shrkcrft/inspector` `levenshtein`), under the CLI's name. */
|
|
17
|
+
export const editDistance = levenshtein;
|
|
18
|
+
/**
|
|
19
|
+
* Typo tolerance for an attempt: `max(1, floor(len / 4))` edits. A
|
|
20
|
+
* fingers-on-keys typo (`doctr`) is inside it; a different word is not.
|
|
21
|
+
*/
|
|
22
|
+
export function typoTolerance(attempt) {
|
|
23
|
+
return Math.max(1, Math.floor(attempt.length / 4));
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Candidates within `tolerance` edits of `attempt` (case-insensitive), nearest
|
|
27
|
+
* first, ties broken lexically — deterministic. At most `limit`.
|
|
28
|
+
*/
|
|
29
|
+
export function closestMatches(attempt, candidates, limit = 3, tolerance = typoTolerance(attempt)) {
|
|
30
|
+
const lower = attempt.toLowerCase();
|
|
31
|
+
const scored = [];
|
|
32
|
+
const seen = new Set();
|
|
33
|
+
for (const c of candidates) {
|
|
34
|
+
if (seen.has(c))
|
|
35
|
+
continue;
|
|
36
|
+
seen.add(c);
|
|
37
|
+
const d = editDistance(lower, c.toLowerCase());
|
|
38
|
+
if (d <= tolerance)
|
|
39
|
+
scored.push({ c, d });
|
|
40
|
+
}
|
|
41
|
+
scored.sort((x, y) => (x.d !== y.d ? x.d - y.d : x.c < y.c ? -1 : x.c > y.c ? 1 : 0));
|
|
42
|
+
return scored.slice(0, limit).map((s) => s.c);
|
|
43
|
+
}
|
|
44
|
+
/** The single nearest candidate within `tolerance`, or `undefined`. */
|
|
45
|
+
export function nearest(attempt, candidates, tolerance = typoTolerance(attempt)) {
|
|
46
|
+
return closestMatches(attempt, candidates, 1, tolerance)[0];
|
|
47
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { type CommandRegistry, type IGlobalCompressDirective } from '../command-registry.js';
|
|
2
|
+
/**
|
|
3
|
+
* The dispatcher's GLOBAL flags — accepted by every command, anywhere before
|
|
4
|
+
* the `--` sentinel: leading (`shrk --no-hints scaffolds list`), between the
|
|
5
|
+
* path tokens (`shrk scaffolds --no-hints list`) or trailing
|
|
6
|
+
* (`shrk scaffolds list --no-hints`).
|
|
7
|
+
*
|
|
8
|
+
* `--cwd`, `--exit-trailer` and the `--compress*` family are stripped from the
|
|
9
|
+
* argv before dispatch; `--strict` (also a per-command flag) and `--no-hints`
|
|
10
|
+
* reach the handler; `--help` / `-h` are intercepted before any body runs. The
|
|
11
|
+
* declared-flag guard accepts every one of them on top of a handler's own set,
|
|
12
|
+
* and the post-run read-tracking detector never judges them.
|
|
13
|
+
*/
|
|
14
|
+
export declare const GLOBAL_FLAGS: ReadonlySet<string>;
|
|
15
|
+
/**
|
|
16
|
+
* The global flags that take a VALUE — `--cwd <dir>`, `--compress-type <t>`,
|
|
17
|
+
* `--compress-query <q>` (or the `--flag=value` form). A subset of
|
|
18
|
+
* {@link GLOBAL_FLAGS}; the pre-dispatch strip removes each with its value.
|
|
19
|
+
*/
|
|
20
|
+
export declare const GLOBAL_VALUE_FLAGS: ReadonlySet<string>;
|
|
21
|
+
/**
|
|
22
|
+
* Presentation-only flags. An unread one is still WARNED about, but it never
|
|
23
|
+
* changes the exit: ignoring `--json` or `--verbose` loses formatting, not an
|
|
24
|
+
* input the verdict depended on. (`-v` is the short `--verbose`.)
|
|
25
|
+
*/
|
|
26
|
+
export declare const SOFT_FLAGS: ReadonlySet<string>;
|
|
27
|
+
/**
|
|
28
|
+
* A global flag the trie descent steps OVER instead of stopping at — while it
|
|
29
|
+
* sits inside the command path. Before round 11 a leading `--no-hints` /
|
|
30
|
+
* `--strict` ended the descent at the first token, so `shrk --no-hints
|
|
31
|
+
* scaffolds list` reported "shrk doesn't have a `scaffolds list` command" and
|
|
32
|
+
* `shrk --strict doctor` suggested `shrk doctor`. The descent hoists these into
|
|
33
|
+
* the handler's argv (before any `--`), so the handler still sees its own
|
|
34
|
+
* `--strict`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isPathTransparentGlobal(token: string): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* A path-transparent global flag that may take the NEXT token as its value:
|
|
39
|
+
* the bare `--strict` (`doctor --strict warnings` reads `warnings` as the
|
|
40
|
+
* level). The descent steps over it only while the path continues after it;
|
|
41
|
+
* past the path it stays in front of its value, never turning the value into a
|
|
42
|
+
* positional. `--strict=<level>` and `--no-hints` are self-contained.
|
|
43
|
+
*/
|
|
44
|
+
export declare function bindsFollowingValue(token: string): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* The global flags `runCliInner` strips from ANYWHERE before dispatch
|
|
47
|
+
* (`extractGlobalCwd`, `extractGlobalCompress`, `extractGlobalExitTrailer`):
|
|
48
|
+
* every global except the path-transparent ones, which reach the handler, and
|
|
49
|
+
* `--help` / `-h`, which the help intercept answers. The command-string
|
|
50
|
+
* resolver strips exactly these, so a documented `shrk --cwd x doctor` and the
|
|
51
|
+
* real dispatch read the same command.
|
|
52
|
+
*/
|
|
53
|
+
export declare const STRIPPED_GLOBAL_FLAGS: ReadonlySet<string>;
|
|
54
|
+
/**
|
|
55
|
+
* THE pre-dispatch strip: `--cwd`, `--exit-trailer` and the `--compress*`
|
|
56
|
+
* family ({@link STRIPPED_GLOBAL_FLAGS}) removed from anywhere before `--`, in
|
|
57
|
+
* the one order both readers use. `runCliInner` dispatches from `rest`, and
|
|
58
|
+
* `runCli` derives the verdict path (the pipe note, `--exit-trailer`, the usage
|
|
59
|
+
* record) from the SAME `rest` — before this, `runCli` stripped only `--cwd` and
|
|
60
|
+
* `--exit-trailer`, so a leading `--compress` ended the descent at the first
|
|
61
|
+
* token and `shrk --compress check wiring --exit-trailer` printed no trailer.
|
|
62
|
+
*/
|
|
63
|
+
export declare function stripPreDispatchGlobals(argv: readonly string[]): {
|
|
64
|
+
readonly cwd?: string;
|
|
65
|
+
readonly trailer: boolean;
|
|
66
|
+
readonly compress?: IGlobalCompressDirective;
|
|
67
|
+
readonly rest: string[];
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Flags every command accepts implicitly — left out of an "Accepts:" list.
|
|
71
|
+
* `--strict` stays listed: it is also a per-command flag with its own meaning
|
|
72
|
+
* (`check --strict`).
|
|
73
|
+
*/
|
|
74
|
+
export declare const IMPLICIT_FLAGS: ReadonlySet<string>;
|
|
75
|
+
/**
|
|
76
|
+
* THE trie-descent options for the dispatcher's global flags. `runCliInner`'s
|
|
77
|
+
* descent and {@link withoutPathGlobals} (the verdict path and the usage
|
|
78
|
+
* record) both pass exactly this, so they cannot disagree about where the
|
|
79
|
+
* command path ends.
|
|
80
|
+
*/
|
|
81
|
+
export declare const PATH_TRANSPARENCY: {
|
|
82
|
+
readonly transparent: typeof isPathTransparentGlobal;
|
|
83
|
+
readonly bindsValue: typeof bindsFollowingValue;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* `argv` as the dispatcher reads it: the command path first — spelled as
|
|
87
|
+
* typed, the path-transparent global flags stepped over exactly as the trie
|
|
88
|
+
* descent steps over them — then everything else. The view `extractCommandPath`
|
|
89
|
+
* needs: a leading `--no-hints` does not zero out the verdict path (and with it
|
|
90
|
+
* `--exit-trailer`), and `doctor --strict warnings` keeps `warnings` as the
|
|
91
|
+
* value of `--strict`, never a path segment.
|
|
92
|
+
*/
|
|
93
|
+
export declare function withoutPathGlobals(argv: readonly string[], registry: CommandRegistry): string[];
|
|
94
|
+
//# sourceMappingURL=global-flags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-flags.d.ts","sourceRoot":"","sources":["../../src/dispatch/global-flags.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC9B,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,MAAM,CAW3C,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAAuD,CAAC;AAE3G;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC,MAAM,CAOzC,CAAC;AAEH;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,MAAM,CAErD,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG;IAChE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IAC7C,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;CACzB,CAUA;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,WAAW,CAAC,MAAM,CAA4D,CAAC;AAE5G;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AAEX;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,QAAQ,EAAE,eAAe,GAAG,MAAM,EAAE,CAG/F"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { extractGlobalCompress, extractGlobalCwd, extractGlobalExitTrailer, } from "../command-registry.js";
|
|
2
|
+
/**
|
|
3
|
+
* The dispatcher's GLOBAL flags — accepted by every command, anywhere before
|
|
4
|
+
* the `--` sentinel: leading (`shrk --no-hints scaffolds list`), between the
|
|
5
|
+
* path tokens (`shrk scaffolds --no-hints list`) or trailing
|
|
6
|
+
* (`shrk scaffolds list --no-hints`).
|
|
7
|
+
*
|
|
8
|
+
* `--cwd`, `--exit-trailer` and the `--compress*` family are stripped from the
|
|
9
|
+
* argv before dispatch; `--strict` (also a per-command flag) and `--no-hints`
|
|
10
|
+
* reach the handler; `--help` / `-h` are intercepted before any body runs. The
|
|
11
|
+
* declared-flag guard accepts every one of them on top of a handler's own set,
|
|
12
|
+
* and the post-run read-tracking detector never judges them.
|
|
13
|
+
*/
|
|
14
|
+
export const GLOBAL_FLAGS = new Set([
|
|
15
|
+
'cwd',
|
|
16
|
+
'strict',
|
|
17
|
+
'no-hints',
|
|
18
|
+
'exit-trailer',
|
|
19
|
+
'compress',
|
|
20
|
+
'ccr',
|
|
21
|
+
'compress-type',
|
|
22
|
+
'compress-query',
|
|
23
|
+
'help',
|
|
24
|
+
'h',
|
|
25
|
+
]);
|
|
26
|
+
/**
|
|
27
|
+
* The global flags that take a VALUE — `--cwd <dir>`, `--compress-type <t>`,
|
|
28
|
+
* `--compress-query <q>` (or the `--flag=value` form). A subset of
|
|
29
|
+
* {@link GLOBAL_FLAGS}; the pre-dispatch strip removes each with its value.
|
|
30
|
+
*/
|
|
31
|
+
export const GLOBAL_VALUE_FLAGS = new Set(['cwd', 'compress-type', 'compress-query']);
|
|
32
|
+
/**
|
|
33
|
+
* Presentation-only flags. An unread one is still WARNED about, but it never
|
|
34
|
+
* changes the exit: ignoring `--json` or `--verbose` loses formatting, not an
|
|
35
|
+
* input the verdict depended on. (`-v` is the short `--verbose`.)
|
|
36
|
+
*/
|
|
37
|
+
export const SOFT_FLAGS = new Set([
|
|
38
|
+
'json',
|
|
39
|
+
'verbose',
|
|
40
|
+
'v',
|
|
41
|
+
'quiet',
|
|
42
|
+
'no-color',
|
|
43
|
+
'color',
|
|
44
|
+
]);
|
|
45
|
+
/**
|
|
46
|
+
* A global flag the trie descent steps OVER instead of stopping at — while it
|
|
47
|
+
* sits inside the command path. Before round 11 a leading `--no-hints` /
|
|
48
|
+
* `--strict` ended the descent at the first token, so `shrk --no-hints
|
|
49
|
+
* scaffolds list` reported "shrk doesn't have a `scaffolds list` command" and
|
|
50
|
+
* `shrk --strict doctor` suggested `shrk doctor`. The descent hoists these into
|
|
51
|
+
* the handler's argv (before any `--`), so the handler still sees its own
|
|
52
|
+
* `--strict`.
|
|
53
|
+
*/
|
|
54
|
+
export function isPathTransparentGlobal(token) {
|
|
55
|
+
return token === '--no-hints' || token === '--strict' || token.startsWith('--strict=');
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A path-transparent global flag that may take the NEXT token as its value:
|
|
59
|
+
* the bare `--strict` (`doctor --strict warnings` reads `warnings` as the
|
|
60
|
+
* level). The descent steps over it only while the path continues after it;
|
|
61
|
+
* past the path it stays in front of its value, never turning the value into a
|
|
62
|
+
* positional. `--strict=<level>` and `--no-hints` are self-contained.
|
|
63
|
+
*/
|
|
64
|
+
export function bindsFollowingValue(token) {
|
|
65
|
+
return token === '--strict';
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The global flags `runCliInner` strips from ANYWHERE before dispatch
|
|
69
|
+
* (`extractGlobalCwd`, `extractGlobalCompress`, `extractGlobalExitTrailer`):
|
|
70
|
+
* every global except the path-transparent ones, which reach the handler, and
|
|
71
|
+
* `--help` / `-h`, which the help intercept answers. The command-string
|
|
72
|
+
* resolver strips exactly these, so a documented `shrk --cwd x doctor` and the
|
|
73
|
+
* real dispatch read the same command.
|
|
74
|
+
*/
|
|
75
|
+
export const STRIPPED_GLOBAL_FLAGS = new Set([...GLOBAL_FLAGS].filter((f) => f !== 'help' && f !== 'h' && !isPathTransparentGlobal(`--${f}`)));
|
|
76
|
+
/**
|
|
77
|
+
* THE pre-dispatch strip: `--cwd`, `--exit-trailer` and the `--compress*`
|
|
78
|
+
* family ({@link STRIPPED_GLOBAL_FLAGS}) removed from anywhere before `--`, in
|
|
79
|
+
* the one order both readers use. `runCliInner` dispatches from `rest`, and
|
|
80
|
+
* `runCli` derives the verdict path (the pipe note, `--exit-trailer`, the usage
|
|
81
|
+
* record) from the SAME `rest` — before this, `runCli` stripped only `--cwd` and
|
|
82
|
+
* `--exit-trailer`, so a leading `--compress` ended the descent at the first
|
|
83
|
+
* token and `shrk --compress check wiring --exit-trailer` printed no trailer.
|
|
84
|
+
*/
|
|
85
|
+
export function stripPreDispatchGlobals(argv) {
|
|
86
|
+
const { cwd, rest: afterCwd } = extractGlobalCwd(argv);
|
|
87
|
+
const { trailer, rest: afterTrailer } = extractGlobalExitTrailer(afterCwd);
|
|
88
|
+
const { directive, rest } = extractGlobalCompress(afterTrailer);
|
|
89
|
+
return {
|
|
90
|
+
...(cwd !== undefined ? { cwd } : {}),
|
|
91
|
+
trailer,
|
|
92
|
+
...(directive !== undefined ? { compress: directive } : {}),
|
|
93
|
+
rest,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Flags every command accepts implicitly — left out of an "Accepts:" list.
|
|
98
|
+
* `--strict` stays listed: it is also a per-command flag with its own meaning
|
|
99
|
+
* (`check --strict`).
|
|
100
|
+
*/
|
|
101
|
+
export const IMPLICIT_FLAGS = new Set([...GLOBAL_FLAGS].filter((f) => f !== 'strict'));
|
|
102
|
+
/**
|
|
103
|
+
* THE trie-descent options for the dispatcher's global flags. `runCliInner`'s
|
|
104
|
+
* descent and {@link withoutPathGlobals} (the verdict path and the usage
|
|
105
|
+
* record) both pass exactly this, so they cannot disagree about where the
|
|
106
|
+
* command path ends.
|
|
107
|
+
*/
|
|
108
|
+
export const PATH_TRANSPARENCY = {
|
|
109
|
+
transparent: isPathTransparentGlobal,
|
|
110
|
+
bindsValue: bindsFollowingValue,
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* `argv` as the dispatcher reads it: the command path first — spelled as
|
|
114
|
+
* typed, the path-transparent global flags stepped over exactly as the trie
|
|
115
|
+
* descent steps over them — then everything else. The view `extractCommandPath`
|
|
116
|
+
* needs: a leading `--no-hints` does not zero out the verdict path (and with it
|
|
117
|
+
* `--exit-trailer`), and `doctor --strict warnings` keeps `warnings` as the
|
|
118
|
+
* value of `--strict`, never a path segment.
|
|
119
|
+
*/
|
|
120
|
+
export function withoutPathGlobals(argv, registry) {
|
|
121
|
+
const resolution = registry.resolve(argv, PATH_TRANSPARENCY);
|
|
122
|
+
return [...resolution.matchedTokens, ...resolution.rest];
|
|
123
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CommandRegistry, ICommandHandler, ParsedArgs } from '../command-registry.js';
|
|
2
|
+
import type { ICommandIndex } from '../surface/i-command-index.js';
|
|
3
|
+
/** What the dispatcher knows about one invocation when it asks the guard. */
|
|
4
|
+
export interface IGuardInvocationInput {
|
|
5
|
+
/** The registry this run dispatches from (the command index is built from it). */
|
|
6
|
+
readonly registry: CommandRegistry;
|
|
7
|
+
/** The handler at the deepest matched trie path; `undefined` for a pure command group. */
|
|
8
|
+
readonly handler: ICommandHandler | undefined;
|
|
9
|
+
/** The canonical trie path the descent matched. */
|
|
10
|
+
readonly matchedPath: readonly string[];
|
|
11
|
+
/** The trie children at the matched node — a mixed-mode parent's or a group's verbs. */
|
|
12
|
+
readonly trieChildren: readonly string[];
|
|
13
|
+
/** The handler's parsed argv (the leftover tokens). */
|
|
14
|
+
readonly parsed: ParsedArgs;
|
|
15
|
+
/**
|
|
16
|
+
* Where a `PositionalMode.Path` token is looked up on disk. Absent → no token
|
|
17
|
+
* names a file: the disk-free reading the command-string resolver uses when it
|
|
18
|
+
* was given no project root.
|
|
19
|
+
*/
|
|
20
|
+
readonly cwd?: string;
|
|
21
|
+
/** The command index of `registry`, when the caller already holds one (else built lazily, memoised per registry). */
|
|
22
|
+
readonly index?: ICommandIndex;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=guard-invocation-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guard-invocation-input.d.ts","sourceRoot":"","sources":["../../src/dispatch/guard-invocation-input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC3F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,6EAA6E;AAC7E,MAAM,WAAW,qBAAqB;IACpC,kFAAkF;IAClF,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IACnC,0FAA0F;IAC1F,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,SAAS,CAAC;IAC9C,mDAAmD;IACnD,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,wFAAwF;IACxF,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,uDAAuD;IACvD,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,qHAAqH;IACrH,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC;CAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|