@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,33 @@
|
|
|
1
|
+
import type { IGuardInvocationInput } from './guard-invocation-input.js';
|
|
2
|
+
import type { IInvocationRejection } from './invocation-rejection.js';
|
|
3
|
+
/**
|
|
4
|
+
* THE pre-run invocation guard (round 11 §5.2): cheap, no inspection, runs
|
|
5
|
+
* after the help intercept and before the surface gate and the command body.
|
|
6
|
+
*
|
|
7
|
+
* Before it, a wrong command ran something else and exited 0 —
|
|
8
|
+
* `shrk check rules --tag auth` printed a full green sweep, `shrk templates
|
|
9
|
+
* lst` printed group help at exit 0, `shrk api-diff status` reported a missing
|
|
10
|
+
* baseline FILE named `status`. The guard judges only what a handler DECLARES,
|
|
11
|
+
* so a legitimate free positional (`task "add a thing"`) is never rejected:
|
|
12
|
+
*
|
|
13
|
+
* - a pure command group + a bare token → unknown subcommand;
|
|
14
|
+
* - `positionals: None` + a token that names no subverb → unknown subcommand
|
|
15
|
+
* (the closest match, and "`rules` is a command of its own" when it is);
|
|
16
|
+
* - `positionals: Path` + a VERB-SHAPED token that is neither a subverb nor
|
|
17
|
+
* an existing file → "has no `status` verb, and no file named `status`
|
|
18
|
+
* exists", with the sibling commands that do have that verb;
|
|
19
|
+
* - declared `flags` → any other flag (the global flags excepted).
|
|
20
|
+
*
|
|
21
|
+
* Every rejection exits `usageExitFor(path)` — 3 on a verdict verb, 2
|
|
22
|
+
* elsewhere — and never 0. The dispatcher calls it through
|
|
23
|
+
* `judgeInvocation`, which adds the undocumented-flag refusal; the
|
|
24
|
+
* command-string resolver calls the same function.
|
|
25
|
+
*/
|
|
26
|
+
export declare function guardInvocation(input: IGuardInvocationInput): IInvocationRejection | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* A token that reads as a VERB, not a path: lowercase kebab starting with a
|
|
29
|
+
* letter — no `.`, `/`, `\`, `:`, `{`, `=` or uppercase. Inline JSON (`{…}`),
|
|
30
|
+
* `-` (stdin) and any real path fail it, so the Path rule never blocks them.
|
|
31
|
+
*/
|
|
32
|
+
export declare function isVerbShaped(token: string): boolean;
|
|
33
|
+
//# sourceMappingURL=guard-invocation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guard-invocation.d.ts","sourceRoot":"","sources":["../../src/dispatch/guard-invocation.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAOtE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,qBAAqB,GAAG,oBAAoB,GAAG,SAAS,CAyB9F;AAID;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEnD"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import * as nodePath from 'node:path';
|
|
3
|
+
import { firstUnknownFlag } from "../command-registry.js";
|
|
4
|
+
import { usageExitFor } from "../exit-codes.js";
|
|
5
|
+
import { commandIndexFor, subverbNamesOf } from "../surface/command-index.js";
|
|
6
|
+
import { closestMatches } from "./closest-match.js";
|
|
7
|
+
import { GLOBAL_FLAGS, IMPLICIT_FLAGS } from "./global-flags.js";
|
|
8
|
+
import { InvocationRejectionKind } from "./invocation-rejection-kind.js";
|
|
9
|
+
import { PositionalMode } from "./positional-mode.js";
|
|
10
|
+
import { unknownFlagRefusal } from "./unknown-flag-refusal.js";
|
|
11
|
+
import { walkDeclaredSubverbs } from "./walk-declared-subverbs.js";
|
|
12
|
+
/**
|
|
13
|
+
* THE pre-run invocation guard (round 11 §5.2): cheap, no inspection, runs
|
|
14
|
+
* after the help intercept and before the surface gate and the command body.
|
|
15
|
+
*
|
|
16
|
+
* Before it, a wrong command ran something else and exited 0 —
|
|
17
|
+
* `shrk check rules --tag auth` printed a full green sweep, `shrk templates
|
|
18
|
+
* lst` printed group help at exit 0, `shrk api-diff status` reported a missing
|
|
19
|
+
* baseline FILE named `status`. The guard judges only what a handler DECLARES,
|
|
20
|
+
* so a legitimate free positional (`task "add a thing"`) is never rejected:
|
|
21
|
+
*
|
|
22
|
+
* - a pure command group + a bare token → unknown subcommand;
|
|
23
|
+
* - `positionals: None` + a token that names no subverb → unknown subcommand
|
|
24
|
+
* (the closest match, and "`rules` is a command of its own" when it is);
|
|
25
|
+
* - `positionals: Path` + a VERB-SHAPED token that is neither a subverb nor
|
|
26
|
+
* an existing file → "has no `status` verb, and no file named `status`
|
|
27
|
+
* exists", with the sibling commands that do have that verb;
|
|
28
|
+
* - declared `flags` → any other flag (the global flags excepted).
|
|
29
|
+
*
|
|
30
|
+
* Every rejection exits `usageExitFor(path)` — 3 on a verdict verb, 2
|
|
31
|
+
* elsewhere — and never 0. The dispatcher calls it through
|
|
32
|
+
* `judgeInvocation`, which adds the undocumented-flag refusal; the
|
|
33
|
+
* command-string resolver calls the same function.
|
|
34
|
+
*/
|
|
35
|
+
export function guardInvocation(input) {
|
|
36
|
+
const { handler, matchedPath, parsed } = input;
|
|
37
|
+
if (matchedPath.length === 0)
|
|
38
|
+
return undefined;
|
|
39
|
+
if (!handler) {
|
|
40
|
+
const token = parsed.positional[0];
|
|
41
|
+
if (token === undefined)
|
|
42
|
+
return undefined;
|
|
43
|
+
return unknownSubcommand(input, matchedPath, token, input.trieChildren);
|
|
44
|
+
}
|
|
45
|
+
const walk = walkDeclaredSubverbs(handler, matchedPath, parsed.positional);
|
|
46
|
+
const token = parsed.positional[walk.consumed];
|
|
47
|
+
if (token !== undefined) {
|
|
48
|
+
const specs = walk.level.subverbs ?? [];
|
|
49
|
+
if (walk.level.positionals === PositionalMode.None) {
|
|
50
|
+
const names = [...specs.map((s) => s.name), ...(walk.consumed === 0 ? input.trieChildren : [])];
|
|
51
|
+
return unknownSubcommand(input, walk.path, token, names);
|
|
52
|
+
}
|
|
53
|
+
if (walk.level.positionals === PositionalMode.Path && isVerbShaped(token) && !namesAFile(input, token)) {
|
|
54
|
+
return noSuchVerbOrFile(input, walk.path, token, specs);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (walk.flags) {
|
|
58
|
+
const bad = firstUnknownFlag(parsed, new Set([...walk.flags, ...GLOBAL_FLAGS]));
|
|
59
|
+
if (bad !== undefined)
|
|
60
|
+
return unknownFlag(walk.path, bad, walk.flags, parsed.argv);
|
|
61
|
+
}
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
const VERB_SHAPED = /^[a-z][a-z0-9-]*$/;
|
|
65
|
+
/**
|
|
66
|
+
* A token that reads as a VERB, not a path: lowercase kebab starting with a
|
|
67
|
+
* letter — no `.`, `/`, `\`, `:`, `{`, `=` or uppercase. Inline JSON (`{…}`),
|
|
68
|
+
* `-` (stdin) and any real path fail it, so the Path rule never blocks them.
|
|
69
|
+
*/
|
|
70
|
+
export function isVerbShaped(token) {
|
|
71
|
+
return VERB_SHAPED.test(token);
|
|
72
|
+
}
|
|
73
|
+
function indexOf(input) {
|
|
74
|
+
return input.index ?? commandIndexFor(input.registry);
|
|
75
|
+
}
|
|
76
|
+
/** An existing file or directory under the invocation's cwd (none without a cwd). */
|
|
77
|
+
function namesAFile(input, token) {
|
|
78
|
+
return input.cwd !== undefined && existsSync(nodePath.resolve(input.cwd, token));
|
|
79
|
+
}
|
|
80
|
+
function subcommandList(names) {
|
|
81
|
+
return [...new Set(names)].sort();
|
|
82
|
+
}
|
|
83
|
+
/** The closest real subcommands of `label`, as full invocations. */
|
|
84
|
+
function closestSubcommands(label, token, names) {
|
|
85
|
+
return closestMatches(token, names, 3).map((c) => `shrk ${label} ${c}`);
|
|
86
|
+
}
|
|
87
|
+
function didYouMean(closest) {
|
|
88
|
+
if (closest.length === 0)
|
|
89
|
+
return '';
|
|
90
|
+
return ` Did you mean ${closest.map((c) => `\`${c}\``).join(' or ')}?\n`;
|
|
91
|
+
}
|
|
92
|
+
/** "`rules` is a command of its own: shrk rules add|doctor|…" — when it is. */
|
|
93
|
+
function ownCommandHint(input, token) {
|
|
94
|
+
const own = input.registry.resolve([token]);
|
|
95
|
+
const head = own.matchedPath[0];
|
|
96
|
+
if (own.matchedPath.length !== 1 || head === undefined)
|
|
97
|
+
return '';
|
|
98
|
+
const subs = subverbNamesOf(indexOf(input), head);
|
|
99
|
+
const shown = subs.slice(0, 6).join('|');
|
|
100
|
+
const tail = subs.length === 0 ? '' : ` ${shown}${subs.length > 6 ? '|…' : ''}`;
|
|
101
|
+
return ` \`${token}\` is a command of its own: shrk ${head}${tail} — see \`shrk help ${head}\`.\n`;
|
|
102
|
+
}
|
|
103
|
+
/** "`status` is a verb of: shrk graph status, shrk context status, …" — from the index. */
|
|
104
|
+
function siblingVerbHint(input, token) {
|
|
105
|
+
const owners = indexOf(input)
|
|
106
|
+
.entries.filter((e) => e.tokens.length > 1 && e.tokens[e.tokens.length - 1] === token)
|
|
107
|
+
.map((e) => `shrk ${e.path}`);
|
|
108
|
+
if (owners.length === 0)
|
|
109
|
+
return '';
|
|
110
|
+
const shown = owners.slice(0, 6);
|
|
111
|
+
const more = owners.length > shown.length ? ` (+${owners.length - shown.length} more)` : '';
|
|
112
|
+
return ` \`${token}\` is a verb of: ${shown.join(', ')}${more}\n`;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Subverbs that were REMOVED, keyed `<path> <token>`, and the command that
|
|
116
|
+
* replaced each — named in place of the own-command hint, so `commands explain
|
|
117
|
+
* doctor` never points at `shrk explain` (the knowledge / rule topic search) as
|
|
118
|
+
* if it described a command.
|
|
119
|
+
*/
|
|
120
|
+
const RETIRED_SUBVERBS = new Map([
|
|
121
|
+
['commands suggest', 'shrk commands search "<partial>"'],
|
|
122
|
+
['commands explain', 'shrk help <cmd>'],
|
|
123
|
+
]);
|
|
124
|
+
function unknownSubcommand(input, path, token, names) {
|
|
125
|
+
const label = path.join(' ');
|
|
126
|
+
const subs = subcommandList(names);
|
|
127
|
+
const closest = closestSubcommands(label, token, subs);
|
|
128
|
+
let message = `\`shrk ${label}\` has no \`${token}\` subcommand.\n`;
|
|
129
|
+
if (subs.length > 0)
|
|
130
|
+
message += ` Subcommands: ${subs.join(', ')}\n`;
|
|
131
|
+
message += didYouMean(closest);
|
|
132
|
+
const replacement = RETIRED_SUBVERBS.get(`${label} ${token}`);
|
|
133
|
+
message +=
|
|
134
|
+
replacement !== undefined
|
|
135
|
+
? ` \`${token}\` was removed from \`shrk ${label}\` — use \`${replacement}\`.\n`
|
|
136
|
+
: ownCommandHint(input, token);
|
|
137
|
+
message += ` Run \`shrk help ${label}\` for usage.\n`;
|
|
138
|
+
return {
|
|
139
|
+
message,
|
|
140
|
+
exitCode: usageExitFor(label),
|
|
141
|
+
kind: InvocationRejectionKind.UnknownSubcommand,
|
|
142
|
+
...(closest.length > 0 ? { closest } : {}),
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function noSuchVerbOrFile(input, path, token, specs) {
|
|
146
|
+
const label = path.join(' ');
|
|
147
|
+
const closest = closestSubcommands(label, token, specs.map((s) => s.name));
|
|
148
|
+
let message = `\`shrk ${label}\` has no \`${token}\` verb, and no file named \`${token}\` exists.\n`;
|
|
149
|
+
if (specs.length > 0) {
|
|
150
|
+
message += ' Subcommands:\n';
|
|
151
|
+
for (const s of specs)
|
|
152
|
+
message += ` ${s.name} — ${(s.usage.split('\n')[0] ?? '').trim()}\n`;
|
|
153
|
+
}
|
|
154
|
+
message += didYouMean(closest);
|
|
155
|
+
message += siblingVerbHint(input, token);
|
|
156
|
+
message += ` Run \`shrk help ${label}\` for usage.\n`;
|
|
157
|
+
return {
|
|
158
|
+
message,
|
|
159
|
+
exitCode: usageExitFor(label),
|
|
160
|
+
kind: InvocationRejectionKind.NoSuchVerbOrFile,
|
|
161
|
+
...(closest.length > 0 ? { closest } : {}),
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* A flag outside a DECLARED set, worded by THE one refusal format (round 13)
|
|
166
|
+
* — the same message the documentation refusal prints, plus the declared set
|
|
167
|
+
* as one `Accepts:` line. It printed `Unknown flag "--x" for \`shrk …\`` while
|
|
168
|
+
* every other refusal printed `--x is not a flag of this command`. A
|
|
169
|
+
* `--depth -1` misread names the flag the number was meant for; otherwise the
|
|
170
|
+
* flag is echoed as TYPED (the key alone cannot tell `--x` from `-x`).
|
|
171
|
+
*/
|
|
172
|
+
function unknownFlag(path, bad, declared, argv) {
|
|
173
|
+
const label = path.join(' ');
|
|
174
|
+
const listed = [...declared].filter((f) => !IMPLICIT_FLAGS.has(f));
|
|
175
|
+
return unknownFlagRefusal({
|
|
176
|
+
label,
|
|
177
|
+
flags: [bad],
|
|
178
|
+
known: listed,
|
|
179
|
+
accepts: listed,
|
|
180
|
+
...(argv !== undefined ? { argv } : {}),
|
|
181
|
+
exitCode: usageExitFor(label),
|
|
182
|
+
});
|
|
183
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ICommandIndex } from '../surface/i-command-index.js';
|
|
2
|
+
/**
|
|
3
|
+
* `--help` / `-h` ANYWHERE in the leftover tokens — after a subverb, a
|
|
4
|
+
* positional or another flag — up to the POSIX `--` sentinel. Tokens after
|
|
5
|
+
* `--` are literal positionals (`shrk languages run -- --help` passes `--help`
|
|
6
|
+
* through untouched).
|
|
7
|
+
*
|
|
8
|
+
* Before round 11 only a LEADING `--help` was intercepted, so on every
|
|
9
|
+
* internally-dispatched subverb the command body ran instead: `report site
|
|
10
|
+
* --help` wrote twelve HTML files and `graph index --help` built the store.
|
|
11
|
+
*/
|
|
12
|
+
export declare function wantsHelp(tokens: readonly string[]): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* The help topic for an intercepted invocation: the matched trie path,
|
|
15
|
+
* extended through the leading bare tokens to the LONGEST path the command
|
|
16
|
+
* index knows (`graph importers foo --help` → `graph importers`;
|
|
17
|
+
* `bundle replay scaffold github-actions --help` → that whole row). An alias
|
|
18
|
+
* spelling resolves to its canonical entry. A token the index does not know
|
|
19
|
+
* leaves the topic at the deepest known path — help never invents one.
|
|
20
|
+
*/
|
|
21
|
+
export declare function helpTopicFor(index: ICommandIndex, matchedPath: readonly string[], leftover: readonly string[]): string[];
|
|
22
|
+
//# sourceMappingURL=help-intercept.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help-intercept.d.ts","sourceRoot":"","sources":["../../src/dispatch/help-intercept.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAM5D;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,aAAa,EACpB,WAAW,EAAE,SAAS,MAAM,EAAE,EAC9B,QAAQ,EAAE,SAAS,MAAM,EAAE,GAC1B,MAAM,EAAE,CAaV"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `--help` / `-h` ANYWHERE in the leftover tokens — after a subverb, a
|
|
3
|
+
* positional or another flag — up to the POSIX `--` sentinel. Tokens after
|
|
4
|
+
* `--` are literal positionals (`shrk languages run -- --help` passes `--help`
|
|
5
|
+
* through untouched).
|
|
6
|
+
*
|
|
7
|
+
* Before round 11 only a LEADING `--help` was intercepted, so on every
|
|
8
|
+
* internally-dispatched subverb the command body ran instead: `report site
|
|
9
|
+
* --help` wrote twelve HTML files and `graph index --help` built the store.
|
|
10
|
+
*/
|
|
11
|
+
export function wantsHelp(tokens) {
|
|
12
|
+
for (const token of tokens) {
|
|
13
|
+
if (token === '--')
|
|
14
|
+
return false;
|
|
15
|
+
if (token === '--help' || token === '-h')
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The help topic for an intercepted invocation: the matched trie path,
|
|
22
|
+
* extended through the leading bare tokens to the LONGEST path the command
|
|
23
|
+
* index knows (`graph importers foo --help` → `graph importers`;
|
|
24
|
+
* `bundle replay scaffold github-actions --help` → that whole row). An alias
|
|
25
|
+
* spelling resolves to its canonical entry. A token the index does not know
|
|
26
|
+
* leaves the topic at the deepest known path — help never invents one.
|
|
27
|
+
*/
|
|
28
|
+
export function helpTopicFor(index, matchedPath, leftover) {
|
|
29
|
+
const bare = [];
|
|
30
|
+
for (const token of leftover) {
|
|
31
|
+
if (token.startsWith('-'))
|
|
32
|
+
break;
|
|
33
|
+
bare.push(token);
|
|
34
|
+
}
|
|
35
|
+
for (let k = bare.length; k >= 1; k -= 1) {
|
|
36
|
+
const candidate = [...matchedPath, ...bare.slice(0, k)].join(' ');
|
|
37
|
+
const entry = index.byPath.get(candidate) ?? index.entries.find((e) => e.aliases.includes(candidate));
|
|
38
|
+
if (entry)
|
|
39
|
+
return [...entry.tokens];
|
|
40
|
+
}
|
|
41
|
+
return [...matchedPath];
|
|
42
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ISubverbSpec } from './subverb-spec.js';
|
|
2
|
+
/**
|
|
3
|
+
* How far a handler's declarations explain an invocation's positionals: the
|
|
4
|
+
* walk descends through each positional that names a declared subverb (at any
|
|
5
|
+
* nesting depth) and stops at the first one that does not.
|
|
6
|
+
*/
|
|
7
|
+
export interface IDeclaredInvocation {
|
|
8
|
+
/** The trie path plus every declared subverb the positionals named (`search tuning explain`). */
|
|
9
|
+
readonly path: readonly string[];
|
|
10
|
+
/** The declaration the walk stopped at: the handler itself, or the deepest matched subverb. */
|
|
11
|
+
readonly level: Pick<ISubverbSpec, 'subverbs' | 'positionals' | 'flags' | 'usage'>;
|
|
12
|
+
/** How many positionals named declared subverbs; `positional[consumed]` is the first that did not. */
|
|
13
|
+
readonly consumed: number;
|
|
14
|
+
/** The union of every flag set declared along the walk; absent when none was declared. */
|
|
15
|
+
readonly flags?: ReadonlySet<string>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=i-declared-invocation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i-declared-invocation.d.ts","sourceRoot":"","sources":["../../src/dispatch/i-declared-invocation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,iGAAiG;IACjG,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,+FAA+F;IAC/F,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,UAAU,GAAG,aAAa,GAAG,OAAO,GAAG,OAAO,CAAC,CAAC;IACnF,sGAAsG;IACtG,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,0FAA0F;IAC1F,QAAQ,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { UnknownFlagRefusalMode } from './unknown-flag-refusal-mode.js';
|
|
2
|
+
/** What {@link unknownFlagRefusal} needs to word one refused invocation. */
|
|
3
|
+
export interface IUnknownFlagRefusalInput {
|
|
4
|
+
/** When the refusal happens (default {@link UnknownFlagRefusalMode.BeforeRun}). */
|
|
5
|
+
readonly mode?: UnknownFlagRefusalMode;
|
|
6
|
+
/**
|
|
7
|
+
* Per flag key, the OTHER command paths whose documentation names it (a
|
|
8
|
+
* sibling subverb) — worded `— only \`shrk check boundaries\` documents it`.
|
|
9
|
+
*/
|
|
10
|
+
readonly documentedOn?: Readonly<Record<string, readonly string[]>>;
|
|
11
|
+
/** The walked command path (`gates check`, `self-config doctor`) — what the message and help pointer name. */
|
|
12
|
+
readonly label: string;
|
|
13
|
+
/** The parsed flag keys being refused, in the order they were supplied. */
|
|
14
|
+
readonly flags: readonly string[];
|
|
15
|
+
/** Flag names the command documents — the did-you-mean candidates. */
|
|
16
|
+
readonly known: readonly string[];
|
|
17
|
+
/**
|
|
18
|
+
* The command's complete DECLARED flag set, when it declares one (`gates
|
|
19
|
+
* check`, `check boundaries`) — printed as one `Accepts:` line. Absent for a
|
|
20
|
+
* command judged by its documentation.
|
|
21
|
+
*/
|
|
22
|
+
readonly accepts?: readonly string[];
|
|
23
|
+
/** The argv the flags were parsed from — to name each flag as TYPED (`-x` vs `--x`). */
|
|
24
|
+
readonly argv?: readonly string[];
|
|
25
|
+
/** The exit the refusal returns: `usageExitFor(label)` — 3 on a verdict verb, 2 elsewhere. */
|
|
26
|
+
readonly exitCode: number;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=i-unknown-flag-refusal-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i-unknown-flag-refusal-input.d.ts","sourceRoot":"","sources":["../../src/dispatch/i-unknown-flag-refusal-input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAE7E,4EAA4E;AAC5E,MAAM,WAAW,wBAAwB;IACvC,mFAAmF;IACnF,QAAQ,CAAC,IAAI,CAAC,EAAE,sBAAsB,CAAC;IACvC;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;IACpE,8GAA8G;IAC9G,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,sEAAsE;IACtE,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,wFAAwF;IACxF,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,8FAA8F;IAC9F,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a pre-run refusal refused. The dispatcher prints the message either
|
|
3
|
+
* way; the command-string resolver maps the kind onto its own vocabulary
|
|
4
|
+
* (`UnknownSubverb` / `UnknownFlag`), so "does this command run?" is answered
|
|
5
|
+
* by the dispatcher's judgement, never by a parallel model of it.
|
|
6
|
+
*/
|
|
7
|
+
export declare enum InvocationRejectionKind {
|
|
8
|
+
/** A bare token under a command group, or under a `positionals: None` handler, that names no subverb. */
|
|
9
|
+
UnknownSubcommand = "unknown-subcommand",
|
|
10
|
+
/** `positionals: Path` + a verb-shaped token that is neither a subverb nor an existing file. */
|
|
11
|
+
NoSuchVerbOrFile = "no-such-verb-or-file",
|
|
12
|
+
/** A flag outside a declared set, or one no documentation of the command names. */
|
|
13
|
+
UnknownFlag = "unknown-flag"
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=invocation-rejection-kind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invocation-rejection-kind.d.ts","sourceRoot":"","sources":["../../src/dispatch/invocation-rejection-kind.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,oBAAY,uBAAuB;IACjC,yGAAyG;IACzG,iBAAiB,uBAAuB;IACxC,gGAAgG;IAChG,gBAAgB,yBAAyB;IACzC,mFAAmF;IACnF,WAAW,iBAAiB;CAC7B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a pre-run refusal refused. The dispatcher prints the message either
|
|
3
|
+
* way; the command-string resolver maps the kind onto its own vocabulary
|
|
4
|
+
* (`UnknownSubverb` / `UnknownFlag`), so "does this command run?" is answered
|
|
5
|
+
* by the dispatcher's judgement, never by a parallel model of it.
|
|
6
|
+
*/
|
|
7
|
+
export var InvocationRejectionKind;
|
|
8
|
+
(function (InvocationRejectionKind) {
|
|
9
|
+
/** A bare token under a command group, or under a `positionals: None` handler, that names no subverb. */
|
|
10
|
+
InvocationRejectionKind["UnknownSubcommand"] = "unknown-subcommand";
|
|
11
|
+
/** `positionals: Path` + a verb-shaped token that is neither a subverb nor an existing file. */
|
|
12
|
+
InvocationRejectionKind["NoSuchVerbOrFile"] = "no-such-verb-or-file";
|
|
13
|
+
/** A flag outside a declared set, or one no documentation of the command names. */
|
|
14
|
+
InvocationRejectionKind["UnknownFlag"] = "unknown-flag";
|
|
15
|
+
})(InvocationRejectionKind || (InvocationRejectionKind = {}));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { InvocationRejectionKind } from './invocation-rejection-kind.js';
|
|
2
|
+
/**
|
|
3
|
+
* Why the dispatcher refused an invocation BEFORE any command body ran — an
|
|
4
|
+
* unknown subcommand, a verb-shaped token that is neither a subverb nor an
|
|
5
|
+
* existing file, a flag outside a handler's declared set, or a flag no
|
|
6
|
+
* documentation of the command names.
|
|
7
|
+
*/
|
|
8
|
+
export interface IInvocationRejection {
|
|
9
|
+
/** The complete stderr text, newline-terminated. */
|
|
10
|
+
readonly message: string;
|
|
11
|
+
/** `usageExitFor(path)`: 3 on a verdict verb, 2 elsewhere. Never 0. */
|
|
12
|
+
readonly exitCode: number;
|
|
13
|
+
/** What was refused — the resolver maps it to a resolution status. */
|
|
14
|
+
readonly kind: InvocationRejectionKind;
|
|
15
|
+
/** The closest real invocations (`shrk templates list`, `shrk gates check --changed-only`), nearest first. */
|
|
16
|
+
readonly closest?: readonly string[];
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=invocation-rejection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invocation-rejection.d.ts","sourceRoot":"","sources":["../../src/dispatch/invocation-rejection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAE9E;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,oDAAoD;IACpD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,uEAAuE;IACvE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,sEAAsE;IACtE,QAAQ,CAAC,IAAI,EAAE,uBAAuB,CAAC;IACvC,8GAA8G;IAC9G,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { IGuardInvocationInput } from './guard-invocation-input.js';
|
|
2
|
+
import type { IInvocationRejection } from './invocation-rejection.js';
|
|
3
|
+
/**
|
|
4
|
+
* THE pre-run judgement of one invocation — "would the dispatcher run this?":
|
|
5
|
+
*
|
|
6
|
+
* 1. {@link guardInvocation} — what the handler DECLARES (an unknown
|
|
7
|
+
* subcommand, a verb-shaped token that is no subverb and no file, a flag
|
|
8
|
+
* outside a declared set);
|
|
9
|
+
* 2. for a handler without a declared flag set (the post-run detector
|
|
10
|
+
* tracks it), {@link refuseUndocumentedFlags} — a flag its documentation
|
|
11
|
+
* does not name is refused before the body runs;
|
|
12
|
+
* 3. round 13 (K1), for the same handlers, {@link refuseSiblingValveFlags} —
|
|
13
|
+
* a VERDICT-VALVE flag (`--fail-on-dead-units`, `--allow-empty`,
|
|
14
|
+
* `--min-referenced`, `--fail-on`) the resolved subverb does not document
|
|
15
|
+
* is refused before the body runs, naming the subverbs that accept it
|
|
16
|
+
* (`shrk check --fail-on-dead-units` printed the whole sweep, then 3).
|
|
17
|
+
*
|
|
18
|
+
* `runCliInner` calls it before the surface gate and the command body, and the
|
|
19
|
+
* command-string resolver (`resolveCommandString`) calls the same function, so
|
|
20
|
+
* a string the resolver certifies is one the dispatcher runs — two code paths
|
|
21
|
+
* never answer "does this command run?" again (round 11 review CLI-1).
|
|
22
|
+
*/
|
|
23
|
+
export declare function judgeInvocation(input: IGuardInvocationInput): IInvocationRejection | undefined;
|
|
24
|
+
//# sourceMappingURL=judge-invocation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"judge-invocation.d.ts","sourceRoot":"","sources":["../../src/dispatch/judge-invocation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAKtE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,qBAAqB,GAAG,oBAAoB,GAAG,SAAS,CAwB9F"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { commandIndexFor } from "../surface/command-index.js";
|
|
2
|
+
import { guardInvocation } from "./guard-invocation.js";
|
|
3
|
+
import { refuseSiblingValveFlags } from "./refuse-sibling-valve-flags.js";
|
|
4
|
+
import { refuseUndocumentedFlags, tracksFlagReads } from "./unread-flags.js";
|
|
5
|
+
import { walkDeclaredSubverbs } from "./walk-declared-subverbs.js";
|
|
6
|
+
/**
|
|
7
|
+
* THE pre-run judgement of one invocation — "would the dispatcher run this?":
|
|
8
|
+
*
|
|
9
|
+
* 1. {@link guardInvocation} — what the handler DECLARES (an unknown
|
|
10
|
+
* subcommand, a verb-shaped token that is no subverb and no file, a flag
|
|
11
|
+
* outside a declared set);
|
|
12
|
+
* 2. for a handler without a declared flag set (the post-run detector
|
|
13
|
+
* tracks it), {@link refuseUndocumentedFlags} — a flag its documentation
|
|
14
|
+
* does not name is refused before the body runs;
|
|
15
|
+
* 3. round 13 (K1), for the same handlers, {@link refuseSiblingValveFlags} —
|
|
16
|
+
* a VERDICT-VALVE flag (`--fail-on-dead-units`, `--allow-empty`,
|
|
17
|
+
* `--min-referenced`, `--fail-on`) the resolved subverb does not document
|
|
18
|
+
* is refused before the body runs, naming the subverbs that accept it
|
|
19
|
+
* (`shrk check --fail-on-dead-units` printed the whole sweep, then 3).
|
|
20
|
+
*
|
|
21
|
+
* `runCliInner` calls it before the surface gate and the command body, and the
|
|
22
|
+
* command-string resolver (`resolveCommandString`) calls the same function, so
|
|
23
|
+
* a string the resolver certifies is one the dispatcher runs — two code paths
|
|
24
|
+
* never answer "does this command run?" again (round 11 review CLI-1).
|
|
25
|
+
*/
|
|
26
|
+
export function judgeInvocation(input) {
|
|
27
|
+
const rejection = guardInvocation(input);
|
|
28
|
+
if (rejection !== undefined || input.handler === undefined || input.matchedPath.length === 0)
|
|
29
|
+
return rejection;
|
|
30
|
+
const handler = input.handler;
|
|
31
|
+
const walk = walkDeclaredSubverbs(handler, input.matchedPath, input.parsed.positional);
|
|
32
|
+
if (!tracksFlagReads(handler, walk))
|
|
33
|
+
return undefined;
|
|
34
|
+
// One lazily built index for both refusals — the common run pays nothing.
|
|
35
|
+
let built = input.index;
|
|
36
|
+
const index = () => (built ??= commandIndexFor(input.registry));
|
|
37
|
+
return (refuseUndocumentedFlags({
|
|
38
|
+
handler,
|
|
39
|
+
matchedPath: input.matchedPath,
|
|
40
|
+
label: walk.path.join(' '),
|
|
41
|
+
parsed: input.parsed,
|
|
42
|
+
index,
|
|
43
|
+
}) ??
|
|
44
|
+
refuseSiblingValveFlags({
|
|
45
|
+
handler,
|
|
46
|
+
matchedPath: input.matchedPath,
|
|
47
|
+
parsed: input.parsed,
|
|
48
|
+
index,
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a handler's `positional[0]` means when it is NOT one of its subverbs.
|
|
3
|
+
*
|
|
4
|
+
* Declared opt-in on {@link ICommandHandler.positionals}; `undefined` means
|
|
5
|
+
* legacy (unchecked). The command index and the command-string resolver read
|
|
6
|
+
* it: only a handler that declares `None` can prove an unknown bare token is an
|
|
7
|
+
* unknown subverb rather than a legitimate free positional.
|
|
8
|
+
*
|
|
9
|
+
* - `None` — every positional[0] must be a declared subverb.
|
|
10
|
+
* - `Free` — any other token is a free positional (a query, an id).
|
|
11
|
+
* - `Path` — any other token is a file path.
|
|
12
|
+
*/
|
|
13
|
+
export declare enum PositionalMode {
|
|
14
|
+
None = "none",
|
|
15
|
+
Free = "free",
|
|
16
|
+
Path = "path"
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=positional-mode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"positional-mode.d.ts","sourceRoot":"","sources":["../../src/dispatch/positional-mode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,oBAAY,cAAc;IACxB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,IAAI,SAAS;CACd"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a handler's `positional[0]` means when it is NOT one of its subverbs.
|
|
3
|
+
*
|
|
4
|
+
* Declared opt-in on {@link ICommandHandler.positionals}; `undefined` means
|
|
5
|
+
* legacy (unchecked). The command index and the command-string resolver read
|
|
6
|
+
* it: only a handler that declares `None` can prove an unknown bare token is an
|
|
7
|
+
* unknown subverb rather than a legitimate free positional.
|
|
8
|
+
*
|
|
9
|
+
* - `None` — every positional[0] must be a declared subverb.
|
|
10
|
+
* - `Free` — any other token is a free positional (a query, an id).
|
|
11
|
+
* - `Path` — any other token is a file path.
|
|
12
|
+
*/
|
|
13
|
+
export var PositionalMode;
|
|
14
|
+
(function (PositionalMode) {
|
|
15
|
+
PositionalMode["None"] = "none";
|
|
16
|
+
PositionalMode["Free"] = "free";
|
|
17
|
+
PositionalMode["Path"] = "path";
|
|
18
|
+
})(PositionalMode || (PositionalMode = {}));
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A `Map` that records which keys were READ — the substrate of the dispatcher's
|
|
3
|
+
* post-run unknown-flag detector.
|
|
4
|
+
*
|
|
5
|
+
* `runCliInner` swaps `parsed.flags` / `parsed.multiFlags` for tracking copies
|
|
6
|
+
* before a handler runs; afterwards, a supplied flag the handler never read was
|
|
7
|
+
* silently dropped. `get` / `has` / `delete` mark one key. Any whole-map read
|
|
8
|
+
* (iteration, spread, `forEach`, `keys`, `values`, `entries`) marks EVERY key,
|
|
9
|
+
* so a handler that forwards or copies its flags is never accused of ignoring
|
|
10
|
+
* them — the detector errs toward silence, never toward a false rejection.
|
|
11
|
+
*/
|
|
12
|
+
export declare class ReadTrackingMap<K, V> extends Map<K, V> {
|
|
13
|
+
private readonly readKeys;
|
|
14
|
+
private everyKeyRead;
|
|
15
|
+
/** A tracking copy of `source`: its entries, nothing marked read yet. */
|
|
16
|
+
static from<K, V>(source: ReadonlyMap<K, V>): ReadTrackingMap<K, V>;
|
|
17
|
+
get(key: K): V | undefined;
|
|
18
|
+
has(key: K): boolean;
|
|
19
|
+
delete(key: K): boolean;
|
|
20
|
+
keys(): MapIterator<K>;
|
|
21
|
+
values(): MapIterator<V>;
|
|
22
|
+
entries(): MapIterator<[K, V]>;
|
|
23
|
+
forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: unknown): void;
|
|
24
|
+
[Symbol.iterator](): MapIterator<[K, V]>;
|
|
25
|
+
/** True when `key` was read — individually, or by a whole-map read. */
|
|
26
|
+
wasRead(key: K): boolean;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=read-tracking-map.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-tracking-map.d.ts","sourceRoot":"","sources":["../../src/dispatch/read-tracking-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,qBAAa,eAAe,CAAC,CAAC,EAAE,CAAC,CAAE,SAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;IAClD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgB;IACzC,OAAO,CAAC,YAAY,CAAS;IAE7B,yEAAyE;IACzE,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;IAM1D,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS;IAK1B,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO;IAKpB,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO;IAKvB,IAAI;IAKJ,MAAM;IAKN,OAAO;IAKP,OAAO,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI;IAKxF,CAAC,MAAM,CAAC,QAAQ,CAAC;IAK1B,uEAAuE;IACvE,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO;CAGzB"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A `Map` that records which keys were READ — the substrate of the dispatcher's
|
|
3
|
+
* post-run unknown-flag detector.
|
|
4
|
+
*
|
|
5
|
+
* `runCliInner` swaps `parsed.flags` / `parsed.multiFlags` for tracking copies
|
|
6
|
+
* before a handler runs; afterwards, a supplied flag the handler never read was
|
|
7
|
+
* silently dropped. `get` / `has` / `delete` mark one key. Any whole-map read
|
|
8
|
+
* (iteration, spread, `forEach`, `keys`, `values`, `entries`) marks EVERY key,
|
|
9
|
+
* so a handler that forwards or copies its flags is never accused of ignoring
|
|
10
|
+
* them — the detector errs toward silence, never toward a false rejection.
|
|
11
|
+
*/
|
|
12
|
+
export class ReadTrackingMap extends Map {
|
|
13
|
+
readKeys = new Set();
|
|
14
|
+
everyKeyRead = false;
|
|
15
|
+
/** A tracking copy of `source`: its entries, nothing marked read yet. */
|
|
16
|
+
static from(source) {
|
|
17
|
+
const out = new ReadTrackingMap();
|
|
18
|
+
for (const [key, value] of source)
|
|
19
|
+
out.set(key, value);
|
|
20
|
+
return out;
|
|
21
|
+
}
|
|
22
|
+
get(key) {
|
|
23
|
+
this.readKeys.add(key);
|
|
24
|
+
return super.get(key);
|
|
25
|
+
}
|
|
26
|
+
has(key) {
|
|
27
|
+
this.readKeys.add(key);
|
|
28
|
+
return super.has(key);
|
|
29
|
+
}
|
|
30
|
+
delete(key) {
|
|
31
|
+
this.readKeys.add(key);
|
|
32
|
+
return super.delete(key);
|
|
33
|
+
}
|
|
34
|
+
keys() {
|
|
35
|
+
this.everyKeyRead = true;
|
|
36
|
+
return super.keys();
|
|
37
|
+
}
|
|
38
|
+
values() {
|
|
39
|
+
this.everyKeyRead = true;
|
|
40
|
+
return super.values();
|
|
41
|
+
}
|
|
42
|
+
entries() {
|
|
43
|
+
this.everyKeyRead = true;
|
|
44
|
+
return super.entries();
|
|
45
|
+
}
|
|
46
|
+
forEach(callbackfn, thisArg) {
|
|
47
|
+
this.everyKeyRead = true;
|
|
48
|
+
super.forEach(callbackfn, thisArg);
|
|
49
|
+
}
|
|
50
|
+
[Symbol.iterator]() {
|
|
51
|
+
this.everyKeyRead = true;
|
|
52
|
+
return super[Symbol.iterator]();
|
|
53
|
+
}
|
|
54
|
+
/** True when `key` was read — individually, or by a whole-map read. */
|
|
55
|
+
wasRead(key) {
|
|
56
|
+
return this.everyKeyRead || this.readKeys.has(key);
|
|
57
|
+
}
|
|
58
|
+
}
|