@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,572 @@
|
|
|
1
|
+
import { CommandResolutionStatus, } from '@shrkcrft/inspector';
|
|
2
|
+
import { parseArgs } from "../command-registry.js";
|
|
3
|
+
import { closestMatches, typoTolerance } from "../dispatch/closest-match.js";
|
|
4
|
+
import { GLOBAL_VALUE_FLAGS, PATH_TRANSPARENCY, STRIPPED_GLOBAL_FLAGS, withoutPathGlobals, } from "../dispatch/global-flags.js";
|
|
5
|
+
import { wantsHelp } from "../dispatch/help-intercept.js";
|
|
6
|
+
import { InvocationRejectionKind } from "../dispatch/invocation-rejection-kind.js";
|
|
7
|
+
import { judgeInvocation } from "../dispatch/judge-invocation.js";
|
|
8
|
+
import { PositionalMode } from "../dispatch/positional-mode.js";
|
|
9
|
+
import { isCommandWord, subverbNamesOf } from "./command-index.js";
|
|
10
|
+
const SHRK_PREFIXES = [
|
|
11
|
+
['shrk'],
|
|
12
|
+
['npx', 'shrk'],
|
|
13
|
+
['bunx', 'shrk'],
|
|
14
|
+
['bun', 'run', 'shrk'],
|
|
15
|
+
['bun', 'x', 'shrk'],
|
|
16
|
+
['pnpm', 'exec', 'shrk'],
|
|
17
|
+
['pnpm', 'shrk'],
|
|
18
|
+
['yarn', 'shrk'],
|
|
19
|
+
['bun', 'packages/cli/src/main.ts'],
|
|
20
|
+
['bun', './packages/cli/src/main.ts'],
|
|
21
|
+
];
|
|
22
|
+
const PACKAGE_MANAGERS = new Set(['bun', 'npm', 'pnpm', 'yarn']);
|
|
23
|
+
/**
|
|
24
|
+
* Heads a command REFERENCE may legitimately cite that are not shrk verbs —
|
|
25
|
+
* only consulted under `assumeShrk`, and only when shrk does not PROVE the
|
|
26
|
+
* whole string (`ok` / `prefix-only`): shrk has a `git` group, so `git status`
|
|
27
|
+
* is the real git, while a string shrk fully dispatches still reads as shrk. A
|
|
28
|
+
* head not listed here is reported as the unknown shrk verb it was read as:
|
|
29
|
+
* loud, with the closest real command, never silently skipped.
|
|
30
|
+
*/
|
|
31
|
+
const KNOWN_EXECUTABLES = new Set([
|
|
32
|
+
...PACKAGE_MANAGERS,
|
|
33
|
+
'npx',
|
|
34
|
+
'bunx',
|
|
35
|
+
'node',
|
|
36
|
+
'deno',
|
|
37
|
+
'tsc',
|
|
38
|
+
'tsx',
|
|
39
|
+
'git',
|
|
40
|
+
'gh',
|
|
41
|
+
'make',
|
|
42
|
+
'docker',
|
|
43
|
+
'jq',
|
|
44
|
+
'curl',
|
|
45
|
+
'echo',
|
|
46
|
+
'cat',
|
|
47
|
+
'ls',
|
|
48
|
+
'cd',
|
|
49
|
+
'rm',
|
|
50
|
+
'mkdir',
|
|
51
|
+
'cp',
|
|
52
|
+
'mv',
|
|
53
|
+
'grep',
|
|
54
|
+
'rg',
|
|
55
|
+
'sed',
|
|
56
|
+
'awk',
|
|
57
|
+
'cargo',
|
|
58
|
+
'go',
|
|
59
|
+
'python',
|
|
60
|
+
'python3',
|
|
61
|
+
'pip',
|
|
62
|
+
'eslint',
|
|
63
|
+
'prettier',
|
|
64
|
+
'vitest',
|
|
65
|
+
'jest',
|
|
66
|
+
'pytest',
|
|
67
|
+
]);
|
|
68
|
+
/** `shrk@latest`, `shrk@0.1.0-alpha.31` — a versioned package spec of the shrk binary. */
|
|
69
|
+
const VERSIONED_SHRK = /^shrk@\S+$/;
|
|
70
|
+
const MCP_TOOL_ID = /^[a-z][a-z0-9]*(?:_[a-z0-9]+)+$/;
|
|
71
|
+
const ENV_ASSIGNMENT = /^[A-Za-z_][A-Za-z0-9_]*=/;
|
|
72
|
+
/**
|
|
73
|
+
* A shell redirection (`> out.json`, `>> log`, `2>&1`, `&> x`, a bare `<`):
|
|
74
|
+
* the command ends before it — the target is the shell's, never an argument.
|
|
75
|
+
* A `<placeholder>` is not one (it closes its own `>`).
|
|
76
|
+
*/
|
|
77
|
+
const REDIRECTION = /^(?:\d*>>?|&>>?|\d*>&\d*|<)[^<>\s]*$/;
|
|
78
|
+
/** A token that could be a subverb name (lowercase kebab, starts with a letter). */
|
|
79
|
+
const BARE_SUBVERB = /^[a-z][a-z0-9-]*$/;
|
|
80
|
+
/**
|
|
81
|
+
* THE dispatcher's pre-dispatch strip set (dispatch/global-flags.ts) as argv
|
|
82
|
+
* tokens: a value-taking global is removed with its value, a bare one alone.
|
|
83
|
+
* Derived, never copied — a global flag the dispatcher learns reaches the
|
|
84
|
+
* resolver the same day.
|
|
85
|
+
*/
|
|
86
|
+
const STRIPPED_VALUE_TOKENS = new Set([...STRIPPED_GLOBAL_FLAGS].filter((f) => GLOBAL_VALUE_FLAGS.has(f)).map((f) => `--${f}`));
|
|
87
|
+
const STRIPPED_BARE_TOKENS = new Set([...STRIPPED_GLOBAL_FLAGS].filter((f) => !GLOBAL_VALUE_FLAGS.has(f)).map((f) => `--${f}`));
|
|
88
|
+
/** `--cwd=<dir>` / `--compress-type=<t>` — the `=` form of a stripped value global. */
|
|
89
|
+
function isStrippedValueAssignment(text) {
|
|
90
|
+
const eq = text.indexOf('=');
|
|
91
|
+
return eq > 2 && STRIPPED_VALUE_TOKENS.has(text.slice(0, eq));
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* `argv` in the order the dispatcher reads it: the command path first, the
|
|
95
|
+
* path-transparent globals (`--no-hints`, `--strict`) stepped over exactly as
|
|
96
|
+
* the trie descent steps over them (`withoutPathGlobals`, THE authority) — so
|
|
97
|
+
* `shrk --no-hints scaffolds list` resolves `scaffolds list`, and `doctor
|
|
98
|
+
* --strict warnings` keeps `warnings` as the value of `--strict`. A quoted
|
|
99
|
+
* token never takes part in the descent. The registry-less fallback index has
|
|
100
|
+
* no trie to descend, and keeps argv as written.
|
|
101
|
+
*/
|
|
102
|
+
function dispatchView(index, argv) {
|
|
103
|
+
if (!index.registry)
|
|
104
|
+
return [...argv];
|
|
105
|
+
const quoted = new Map();
|
|
106
|
+
const texts = argv.map((t, i) => {
|
|
107
|
+
if (!t.quoted)
|
|
108
|
+
return t.text;
|
|
109
|
+
// An unquoted token never contains whitespace, so this key cannot collide.
|
|
110
|
+
const key = `quoted #${i}`;
|
|
111
|
+
quoted.set(key, t);
|
|
112
|
+
return key;
|
|
113
|
+
});
|
|
114
|
+
return withoutPathGlobals(texts, index.registry).map((text) => quoted.get(text) ?? { text, quoted: false });
|
|
115
|
+
}
|
|
116
|
+
/** Meta flags `runCliInner` handles before dispatch. */
|
|
117
|
+
const META_FLAGS = new Set([
|
|
118
|
+
'--help',
|
|
119
|
+
'-h',
|
|
120
|
+
'--full-help',
|
|
121
|
+
'--version',
|
|
122
|
+
'-v',
|
|
123
|
+
'--about',
|
|
124
|
+
]);
|
|
125
|
+
function rank(status) {
|
|
126
|
+
switch (status) {
|
|
127
|
+
case CommandResolutionStatus.UnknownVerb:
|
|
128
|
+
case CommandResolutionStatus.UnknownSubverb:
|
|
129
|
+
case CommandResolutionStatus.UnknownFlag:
|
|
130
|
+
case CommandResolutionStatus.UnknownScript:
|
|
131
|
+
case CommandResolutionStatus.UnknownTool:
|
|
132
|
+
return 3;
|
|
133
|
+
case CommandResolutionStatus.PrefixOnly:
|
|
134
|
+
return 2;
|
|
135
|
+
case CommandResolutionStatus.Ok:
|
|
136
|
+
return 1;
|
|
137
|
+
default:
|
|
138
|
+
return 0;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
function stripPrompt(raw) {
|
|
142
|
+
let text = raw.trim();
|
|
143
|
+
if (text.length >= 2 && text.startsWith('`') && text.endsWith('`') && !text.slice(1, -1).includes('`')) {
|
|
144
|
+
text = text.slice(1, -1).trim();
|
|
145
|
+
}
|
|
146
|
+
if (text.startsWith('$ '))
|
|
147
|
+
text = text.slice(2).trim();
|
|
148
|
+
return text;
|
|
149
|
+
}
|
|
150
|
+
/** Split on `&&`, `||`, `;`, `|` and newlines that sit outside quotes. */
|
|
151
|
+
function splitSegments(text) {
|
|
152
|
+
const out = [];
|
|
153
|
+
let current = '';
|
|
154
|
+
let quote = null;
|
|
155
|
+
for (let i = 0; i < text.length; i += 1) {
|
|
156
|
+
const ch = text[i];
|
|
157
|
+
if (quote) {
|
|
158
|
+
current += ch;
|
|
159
|
+
if (ch === quote)
|
|
160
|
+
quote = null;
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
if (ch === '"' || ch === "'" || ch === '`') {
|
|
164
|
+
quote = ch;
|
|
165
|
+
current += ch;
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
if (ch === ';' || ch === '\n' || ch === '|' || (ch === '&' && text[i + 1] === '&')) {
|
|
169
|
+
out.push(current);
|
|
170
|
+
current = '';
|
|
171
|
+
if ((ch === '&' || ch === '|') && text[i + 1] === ch)
|
|
172
|
+
i += 1;
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
current += ch;
|
|
176
|
+
}
|
|
177
|
+
out.push(current);
|
|
178
|
+
return out.map((s) => s.trim()).filter((s) => s.length > 0);
|
|
179
|
+
}
|
|
180
|
+
function tokenize(segment) {
|
|
181
|
+
const out = [];
|
|
182
|
+
let current = '';
|
|
183
|
+
let quoted = false;
|
|
184
|
+
let inToken = false;
|
|
185
|
+
let quote = null;
|
|
186
|
+
const flush = () => {
|
|
187
|
+
if (inToken)
|
|
188
|
+
out.push({ text: current, quoted });
|
|
189
|
+
current = '';
|
|
190
|
+
quoted = false;
|
|
191
|
+
inToken = false;
|
|
192
|
+
};
|
|
193
|
+
for (const ch of segment) {
|
|
194
|
+
if (quote) {
|
|
195
|
+
if (ch === quote)
|
|
196
|
+
quote = null;
|
|
197
|
+
else
|
|
198
|
+
current += ch;
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
if (ch === '"' || ch === "'" || ch === '`') {
|
|
202
|
+
quote = ch;
|
|
203
|
+
quoted = true;
|
|
204
|
+
inToken = true;
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
if (/\s/.test(ch)) {
|
|
208
|
+
flush();
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
current += ch;
|
|
212
|
+
inToken = true;
|
|
213
|
+
}
|
|
214
|
+
flush();
|
|
215
|
+
return out;
|
|
216
|
+
}
|
|
217
|
+
function matchShrkPrefix(tokens) {
|
|
218
|
+
let best = -1;
|
|
219
|
+
for (const prefix of SHRK_PREFIXES) {
|
|
220
|
+
if (prefix.length > tokens.length)
|
|
221
|
+
continue;
|
|
222
|
+
const matches = (p, t) => !t.quoted && (t.text === p || (p === 'shrk' && VERSIONED_SHRK.test(t.text)));
|
|
223
|
+
if (prefix.every((p, i) => matches(p, tokens[i]))) {
|
|
224
|
+
best = Math.max(best, prefix.length);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return best;
|
|
228
|
+
}
|
|
229
|
+
function shrk(path) {
|
|
230
|
+
return path.length > 0 ? `shrk ${path}` : 'shrk';
|
|
231
|
+
}
|
|
232
|
+
function unknownVerb(index, run, raw) {
|
|
233
|
+
const attempt = run.join(' ');
|
|
234
|
+
const suggestions = [];
|
|
235
|
+
// Full-path candidates first (`search-tuning explain` → `search tuning
|
|
236
|
+
// explain` is one edit), then the top-level verb alone.
|
|
237
|
+
for (let n = Math.min(3, run.length); n >= 1; n -= 1) {
|
|
238
|
+
const head = run.slice(0, n).join(' ');
|
|
239
|
+
for (const hit of closestMatches(head, index.entries.map((e) => e.path), 3, typoTolerance(head))) {
|
|
240
|
+
if (!suggestions.includes(hit))
|
|
241
|
+
suggestions.push(hit);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
const tops = new Set();
|
|
245
|
+
for (const e of index.entries) {
|
|
246
|
+
const head = e.tokens[0];
|
|
247
|
+
if (head && !head.startsWith('-'))
|
|
248
|
+
tops.add(head);
|
|
249
|
+
for (const alias of e.aliases) {
|
|
250
|
+
const aliasHead = alias.split(' ')[0];
|
|
251
|
+
if (aliasHead)
|
|
252
|
+
tops.add(aliasHead);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
for (const hit of closestMatches(run[0] ?? attempt, tops, 3)) {
|
|
256
|
+
if (!suggestions.includes(hit))
|
|
257
|
+
suggestions.push(hit);
|
|
258
|
+
}
|
|
259
|
+
return {
|
|
260
|
+
status: CommandResolutionStatus.UnknownVerb,
|
|
261
|
+
reason: `shrk has no \`${run[0] ?? raw}\` command`,
|
|
262
|
+
...(suggestions.length > 0 ? { closest: suggestions.slice(0, 3).map(shrk) } : {}),
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
/** A token a usage line or doc writes in place of a real argument (`<file>`, `[a|b]`, `...`, `$VAR`, `*`). */
|
|
266
|
+
const PLACEHOLDER = /^(?:<|\[|\.\.\.|…|\$|\*)|\|/;
|
|
267
|
+
/** The name a documented flag spells: `--save-conversation[=<path>]` → `save-conversation`. */
|
|
268
|
+
const FLAG_NAME = /^[A-Za-z0-9][A-Za-z0-9-]*/;
|
|
269
|
+
/**
|
|
270
|
+
* `parsed` as far as a DOCUMENTED string can be judged: the positionals up to
|
|
271
|
+
* the first placeholder — what follows one is not a real argument — and each
|
|
272
|
+
* flag by the name it spells (`--a|--b` → `a`); a flag with no name-shaped
|
|
273
|
+
* prefix is not judged.
|
|
274
|
+
*/
|
|
275
|
+
function judgeable(parsed) {
|
|
276
|
+
const cut = parsed.positional.findIndex((p) => PLACEHOLDER.test(p));
|
|
277
|
+
const flags = new Map();
|
|
278
|
+
for (const [key, value] of parsed.flags) {
|
|
279
|
+
const name = FLAG_NAME.exec(key)?.[0];
|
|
280
|
+
if (name !== undefined)
|
|
281
|
+
flags.set(name, value);
|
|
282
|
+
}
|
|
283
|
+
return {
|
|
284
|
+
positional: cut < 0 ? [...parsed.positional] : parsed.positional.slice(0, cut),
|
|
285
|
+
flags,
|
|
286
|
+
multiFlags: parsed.multiFlags,
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Drop the `[ … ]` optional groups a usage line spells (`doctor --watch
|
|
291
|
+
* [--debounce N]`) — documentation of what MAY follow, never an argument.
|
|
292
|
+
*/
|
|
293
|
+
function dropOptionalGroups(tokens) {
|
|
294
|
+
const out = [];
|
|
295
|
+
let depth = 0;
|
|
296
|
+
for (const t of tokens) {
|
|
297
|
+
if (!t.quoted && (depth > 0 || t.text.startsWith('['))) {
|
|
298
|
+
depth += (t.text.match(/\[/g)?.length ?? 0) - (t.text.match(/\]/g)?.length ?? 0);
|
|
299
|
+
if (depth < 0)
|
|
300
|
+
depth = 0;
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
303
|
+
out.push(t);
|
|
304
|
+
}
|
|
305
|
+
return out;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* THE dispatcher's pre-run judgement (`judgeInvocation`) over the argv
|
|
309
|
+
* `runCliInner` would dispatch — the stripped globals removed, the same
|
|
310
|
+
* path-transparent descent, the handler's own boolean flags — mapped onto the
|
|
311
|
+
* resolver's vocabulary. `undefined` when the dispatcher would run it (or when
|
|
312
|
+
* the index has no registry to dispatch from).
|
|
313
|
+
*/
|
|
314
|
+
function dispatcherRefusal(index, stripped, ctx) {
|
|
315
|
+
const registry = index.registry;
|
|
316
|
+
if (!registry)
|
|
317
|
+
return undefined;
|
|
318
|
+
const res = registry.resolve(dropOptionalGroups(stripped).map((t) => t.text), PATH_TRANSPARENCY);
|
|
319
|
+
if (res.matchedPath.length === 0)
|
|
320
|
+
return undefined;
|
|
321
|
+
const parsed = judgeable(parseArgs(res.rest, res.handler?.booleanFlags ? { booleanFlags: res.handler.booleanFlags } : {}));
|
|
322
|
+
// `--help` / `-h` anywhere prints help and runs nothing — the dispatcher's intercept.
|
|
323
|
+
if (parsed.flags.has('help') || parsed.flags.has('h'))
|
|
324
|
+
return undefined;
|
|
325
|
+
const rejection = judgeInvocation({
|
|
326
|
+
registry,
|
|
327
|
+
handler: res.handler,
|
|
328
|
+
matchedPath: res.matchedPath,
|
|
329
|
+
trieChildren: [...res.node.children.keys()],
|
|
330
|
+
parsed,
|
|
331
|
+
index,
|
|
332
|
+
...(ctx.root !== undefined ? { cwd: ctx.root } : {}),
|
|
333
|
+
});
|
|
334
|
+
if (!rejection)
|
|
335
|
+
return undefined;
|
|
336
|
+
const reason = (rejection.message.split('\n')[0] ?? '').replace(/^!\s*/, '').trim();
|
|
337
|
+
return {
|
|
338
|
+
status: rejection.kind === InvocationRejectionKind.UnknownFlag
|
|
339
|
+
? CommandResolutionStatus.UnknownFlag
|
|
340
|
+
: CommandResolutionStatus.UnknownSubverb,
|
|
341
|
+
matched: res.matchedPath.join(' '),
|
|
342
|
+
reason,
|
|
343
|
+
...(rejection.closest && rejection.closest.length > 0 ? { closest: [...rejection.closest] } : {}),
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
function resolveShrk(index, tokens, raw, ctx) {
|
|
347
|
+
// The global flags runCliInner strips from anywhere, then the dispatcher's
|
|
348
|
+
// own descent over the path-transparent ones.
|
|
349
|
+
const stripped = [];
|
|
350
|
+
for (let i = 0; i < tokens.length; i += 1) {
|
|
351
|
+
const t = tokens[i];
|
|
352
|
+
if (!t.quoted && STRIPPED_VALUE_TOKENS.has(t.text)) {
|
|
353
|
+
const next = tokens[i + 1];
|
|
354
|
+
if (next && !next.text.startsWith('-'))
|
|
355
|
+
i += 1;
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
358
|
+
if (!t.quoted && isStrippedValueAssignment(t.text))
|
|
359
|
+
continue;
|
|
360
|
+
if (!t.quoted && STRIPPED_BARE_TOKENS.has(t.text))
|
|
361
|
+
continue;
|
|
362
|
+
stripped.push(t);
|
|
363
|
+
}
|
|
364
|
+
const argv = dispatchView(index, stripped);
|
|
365
|
+
const first = argv[0];
|
|
366
|
+
if (!first) {
|
|
367
|
+
return { status: CommandResolutionStatus.Ok, matched: '', reason: 'bare `shrk` (the landing screen)' };
|
|
368
|
+
}
|
|
369
|
+
if (!first.quoted && META_FLAGS.has(first.text)) {
|
|
370
|
+
return { status: CommandResolutionStatus.Ok, matched: first.text };
|
|
371
|
+
}
|
|
372
|
+
const run = [];
|
|
373
|
+
for (const t of argv) {
|
|
374
|
+
if (t.quoted || !isCommandWord(t.text))
|
|
375
|
+
break;
|
|
376
|
+
run.push(t.text);
|
|
377
|
+
}
|
|
378
|
+
if (run.length === 0) {
|
|
379
|
+
if (first.quoted || first.text.startsWith('<')) {
|
|
380
|
+
// `shrk "<task>"` — documented: free-form text routes to `shrk recommend`.
|
|
381
|
+
return {
|
|
382
|
+
status: CommandResolutionStatus.Ok,
|
|
383
|
+
matched: '',
|
|
384
|
+
reason: 'free-form task text (routes to `shrk recommend`)',
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
return {
|
|
388
|
+
status: CommandResolutionStatus.UnknownVerb,
|
|
389
|
+
reason: `\`${first.text}\` before the verb is not a global flag — shrk would not dispatch this`,
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
// Alias-aware trie descent (the real dispatch authority), or — for the
|
|
393
|
+
// registry-less fallback index — the longest indexed prefix.
|
|
394
|
+
let matched;
|
|
395
|
+
let pureGroup = false;
|
|
396
|
+
if (index.registry) {
|
|
397
|
+
const res = index.registry.resolve(run);
|
|
398
|
+
matched = [...res.matchedPath];
|
|
399
|
+
if (matched.length === 0)
|
|
400
|
+
return unknownVerb(index, run, raw);
|
|
401
|
+
pureGroup = !res.handler && res.node.children.size > 0;
|
|
402
|
+
}
|
|
403
|
+
else {
|
|
404
|
+
matched = [];
|
|
405
|
+
for (let n = run.length; n >= 1; n -= 1) {
|
|
406
|
+
if (index.byPath.has(run.slice(0, n).join(' '))) {
|
|
407
|
+
matched = run.slice(0, n);
|
|
408
|
+
break;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
if (matched.length === 0)
|
|
412
|
+
return unknownVerb(index, run, raw);
|
|
413
|
+
}
|
|
414
|
+
// Extend through subverbs the index knows (catalog-documented or declared) —
|
|
415
|
+
// the LONGEST indexed path, even when an intermediate level has no row of its
|
|
416
|
+
// own (`ci scaffold gitlab` is documented; `ci scaffold` is not).
|
|
417
|
+
const canonical = [...matched, ...run.slice(matched.length)];
|
|
418
|
+
let depth = matched.length;
|
|
419
|
+
let path = matched.join(' ');
|
|
420
|
+
for (let k = canonical.length; k > matched.length; k -= 1) {
|
|
421
|
+
const deeper = canonical.slice(0, k).join(' ');
|
|
422
|
+
// A declared subverb's alias (`commands workflows` → `commands
|
|
423
|
+
// entrypoints`) dispatches exactly like its name — the declared walk
|
|
424
|
+
// matches aliases, so the resolver reads them too.
|
|
425
|
+
const entry = index.byPath.get(deeper) ?? index.entries.find((e) => e.aliases.includes(deeper));
|
|
426
|
+
if (entry) {
|
|
427
|
+
depth = k;
|
|
428
|
+
path = entry.path;
|
|
429
|
+
pureGroup = false;
|
|
430
|
+
break;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
// `--help` / `-h` anywhere after a proven verb prints help and runs nothing —
|
|
434
|
+
// the dispatcher's help intercept answers before any guard, whatever the
|
|
435
|
+
// rest of the line says (`check rules --help` is help for `check`).
|
|
436
|
+
if (wantsHelp(argv.slice(matched.length).map((t) => t.text))) {
|
|
437
|
+
return { status: CommandResolutionStatus.Ok, matched: path, reason: '`--help` prints help and runs nothing' };
|
|
438
|
+
}
|
|
439
|
+
// A chain the index proves is still put through the dispatcher's own
|
|
440
|
+
// judgement before it is certified: the one answer to "does this run?".
|
|
441
|
+
const settle = (proven) => dispatcherRefusal(index, stripped, ctx) ?? proven;
|
|
442
|
+
const next = argv[depth];
|
|
443
|
+
if (!next || next.quoted || !BARE_SUBVERB.test(next.text)) {
|
|
444
|
+
return settle({ status: CommandResolutionStatus.Ok, matched: path });
|
|
445
|
+
}
|
|
446
|
+
const children = subverbNamesOf(index, path);
|
|
447
|
+
const closest = closestMatches(next.text, children, 3).map((c) => shrk(`${path} ${c}`));
|
|
448
|
+
const withClosest = closest.length > 0 ? { closest } : {};
|
|
449
|
+
if (pureGroup) {
|
|
450
|
+
return {
|
|
451
|
+
status: CommandResolutionStatus.UnknownSubverb,
|
|
452
|
+
matched: path,
|
|
453
|
+
reason: `\`shrk ${path}\` is a command group; \`${next.text}\` is not one of its subcommands`,
|
|
454
|
+
...withClosest,
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
const mode = index.byPath.get(path)?.positionals;
|
|
458
|
+
if (mode === PositionalMode.None) {
|
|
459
|
+
return {
|
|
460
|
+
status: CommandResolutionStatus.UnknownSubverb,
|
|
461
|
+
matched: path,
|
|
462
|
+
reason: `\`shrk ${path}\` has no \`${next.text}\` subcommand`,
|
|
463
|
+
...withClosest,
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
if (mode === PositionalMode.Free || mode === PositionalMode.Path) {
|
|
467
|
+
// A path-mode verb-shaped token that is no subverb and no file is refused
|
|
468
|
+
// by the dispatcher (`api-diff status`) — `settle` finds that out.
|
|
469
|
+
return settle({ status: CommandResolutionStatus.Ok, matched: path });
|
|
470
|
+
}
|
|
471
|
+
if (children.length > 0) {
|
|
472
|
+
return settle({
|
|
473
|
+
status: CommandResolutionStatus.PrefixOnly,
|
|
474
|
+
matched: path,
|
|
475
|
+
reason: `\`shrk ${path}\` dispatches \`${next.text}\` internally — not provable from the command index`,
|
|
476
|
+
...withClosest,
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
// A leaf with no known subverbs: the token is its positional argument.
|
|
480
|
+
return settle({ status: CommandResolutionStatus.Ok, matched: path });
|
|
481
|
+
}
|
|
482
|
+
function resolveScript(pm, name, ctx) {
|
|
483
|
+
if (!ctx.scripts) {
|
|
484
|
+
return { status: CommandResolutionStatus.NotShrk, reason: 'no root package.json scripts to check against' };
|
|
485
|
+
}
|
|
486
|
+
if (ctx.scripts.has(name))
|
|
487
|
+
return { status: CommandResolutionStatus.Ok, reason: `package script \`${name}\`` };
|
|
488
|
+
const closest = closestMatches(name, ctx.scripts, 3).map((s) => `${pm} run ${s}`);
|
|
489
|
+
return {
|
|
490
|
+
status: CommandResolutionStatus.UnknownScript,
|
|
491
|
+
reason: `the root package.json has no \`${name}\` script`,
|
|
492
|
+
...(closest.length > 0 ? { closest } : {}),
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
function resolveTool(name, ctx) {
|
|
496
|
+
if (!ctx.mcpToolNames) {
|
|
497
|
+
return { status: CommandResolutionStatus.NotShrk, reason: 'no MCP tool list to check against' };
|
|
498
|
+
}
|
|
499
|
+
if (ctx.mcpToolNames.has(name))
|
|
500
|
+
return { status: CommandResolutionStatus.Ok, reason: `MCP tool \`${name}\`` };
|
|
501
|
+
const closest = closestMatches(name, ctx.mcpToolNames, 3);
|
|
502
|
+
return {
|
|
503
|
+
status: CommandResolutionStatus.UnknownTool,
|
|
504
|
+
reason: `no MCP tool is named \`${name}\``,
|
|
505
|
+
...(closest.length > 0 ? { closest } : {}),
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
function resolveSegment(index, segment, ctx, options) {
|
|
509
|
+
const tokens = tokenize(segment);
|
|
510
|
+
// A shell prompt on ANY segment (`… && $ shrk x`), not only the first: a
|
|
511
|
+
// `$` left in place made the segment not-shrk, which outranked nothing and
|
|
512
|
+
// let a dead verb behind it pass.
|
|
513
|
+
if (tokens.length > 0 && !tokens[0].quoted && tokens[0].text === '$')
|
|
514
|
+
tokens.shift();
|
|
515
|
+
while (tokens.length > 0 && !tokens[0].quoted && ENV_ASSIGNMENT.test(tokens[0].text)) {
|
|
516
|
+
tokens.shift();
|
|
517
|
+
}
|
|
518
|
+
// `shrk quality --ci > quality.json` runs `shrk quality --ci`.
|
|
519
|
+
const redirect = tokens.findIndex((t) => !t.quoted && REDIRECTION.test(t.text));
|
|
520
|
+
if (redirect >= 0)
|
|
521
|
+
tokens.splice(redirect);
|
|
522
|
+
if (tokens.length === 0)
|
|
523
|
+
return { status: CommandResolutionStatus.NotShrk };
|
|
524
|
+
const prefix = matchShrkPrefix(tokens);
|
|
525
|
+
if (prefix >= 0)
|
|
526
|
+
return resolveShrk(index, tokens.slice(prefix), segment, ctx);
|
|
527
|
+
const [a, b, c] = tokens;
|
|
528
|
+
if (a && b && c && !a.quoted && PACKAGE_MANAGERS.has(a.text) && b.text === 'run' && !c.quoted) {
|
|
529
|
+
return resolveScript(a.text, c.text, ctx);
|
|
530
|
+
}
|
|
531
|
+
if (tokens.length === 1 && a && !a.quoted && MCP_TOOL_ID.test(a.text)) {
|
|
532
|
+
return resolveTool(a.text, ctx);
|
|
533
|
+
}
|
|
534
|
+
if (options.assumeShrk === true && a && !a.quoted && isCommandWord(a.text)) {
|
|
535
|
+
// A command REFERENCE: the bare form names a shrk verb (`doctor` →
|
|
536
|
+
// `shrk doctor`). A known-executable head (`git status`, `bun test`) is
|
|
537
|
+
// not ours to judge unless shrk PROVES the whole string — shrk has a `git`
|
|
538
|
+
// group, and `git status` must not read as its unknown subverb.
|
|
539
|
+
const asShrk = resolveShrk(index, tokens, segment, ctx);
|
|
540
|
+
const proven = asShrk.status === CommandResolutionStatus.Ok || asShrk.status === CommandResolutionStatus.PrefixOnly;
|
|
541
|
+
if (!proven && KNOWN_EXECUTABLES.has(a.text)) {
|
|
542
|
+
return { status: CommandResolutionStatus.NotShrk, reason: `\`${a.text}\` is read as a shell command, not shrk` };
|
|
543
|
+
}
|
|
544
|
+
if (asShrk.status === CommandResolutionStatus.UnknownVerb) {
|
|
545
|
+
return {
|
|
546
|
+
...asShrk,
|
|
547
|
+
reason: `${asShrk.reason ?? `shrk has no \`${a.text}\` command`} (a bare command reference is read as \`shrk ${a.text}\`)`,
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
return asShrk;
|
|
551
|
+
}
|
|
552
|
+
return { status: CommandResolutionStatus.NotShrk };
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* Resolve one command string against the command index. Deterministic and
|
|
556
|
+
* pure. `options.assumeShrk` asks for the command-REFERENCE reading of a bare
|
|
557
|
+
* form (see the module comment).
|
|
558
|
+
*/
|
|
559
|
+
export function resolveCommandString(index, raw, ctx = {}, options = {}) {
|
|
560
|
+
const segments = splitSegments(stripPrompt(raw));
|
|
561
|
+
if (segments.length === 0) {
|
|
562
|
+
return { status: CommandResolutionStatus.NotShrk, reason: 'empty command string' };
|
|
563
|
+
}
|
|
564
|
+
let worst;
|
|
565
|
+
for (const segment of segments) {
|
|
566
|
+
const r = resolveSegment(index, segment, ctx, options);
|
|
567
|
+
const tagged = segments.length > 1 ? { ...r, segment } : r;
|
|
568
|
+
if (!worst || rank(r.status) > rank(worst.status))
|
|
569
|
+
worst = tagged;
|
|
570
|
+
}
|
|
571
|
+
return worst;
|
|
572
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ISurfaceConfig } from '@shrkcrft/config';
|
|
2
2
|
export interface ISurfaceConfigEdit {
|
|
3
3
|
/** What changed. */
|
|
4
|
-
field: 'enabled' | 'hidden';
|
|
4
|
+
field: 'enabled' | 'hidden' | 'disabled';
|
|
5
5
|
/** Command name that was added/removed. */
|
|
6
6
|
command: string;
|
|
7
7
|
/** Operation. */
|
|
@@ -22,10 +22,15 @@ export interface ISurfaceConfigWriteResult {
|
|
|
22
22
|
fileExisted: boolean;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
* Mutate the `surface.enabled[]`
|
|
25
|
+
* Mutate the `surface.enabled[]` / `hidden[]` / `disabled[]` arrays in
|
|
26
26
|
* `sharkcraft.config.ts`. Preview-first: the caller computes the diff
|
|
27
27
|
* via {@link planSurfaceEdit} and only applies it via
|
|
28
28
|
* {@link applySurfaceEdit} when `--write` is passed.
|
|
29
|
+
*
|
|
30
|
+
* `before` must be the project config's OWN `surface{}` block — never the
|
|
31
|
+
* profile-merged view: the rendered block replaces the file's block
|
|
32
|
+
* wholesale, so a merged input would write the profile's lists into the
|
|
33
|
+
* config. `profile` is carried over untouched.
|
|
29
34
|
*/
|
|
30
35
|
export declare function planSurfaceEdit(configFile: string, before: ISurfaceConfig | undefined, edits: readonly ISurfaceConfigEdit[]): ISurfaceConfigDiff;
|
|
31
36
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surface-config-writer.d.ts","sourceRoot":"","sources":["../../src/surface/surface-config-writer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,WAAW,kBAAkB;IACjC,oBAAoB;IACpB,KAAK,EAAE,SAAS,GAAG,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"surface-config-writer.d.ts","sourceRoot":"","sources":["../../src/surface/surface-config-writer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,WAAW,kBAAkB;IACjC,oBAAoB;IACpB,KAAK,EAAE,SAAS,GAAG,QAAQ,GAAG,UAAU,CAAC;IACzC,2CAA2C;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB;IACjB,SAAS,EAAE,KAAK,GAAG,QAAQ,CAAC;CAC7B;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,cAAc,CAAC;IACvB,KAAK,EAAE,cAAc,CAAC;IACtB,KAAK,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACrC,yDAAyD;IACzD,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACrC,iDAAiD;IACjD,WAAW,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,cAAc,GAAG,SAAS,EAClC,KAAK,EAAE,SAAS,kBAAkB,EAAE,GACnC,kBAAkB,CAiCpB;AAOD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,kBAAkB,GACvB,yBAAyB,CAe3B;AAoBD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAO,GAAG,MAAM,CA4BjF;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,MAAM,CA6BtF;AAED,8CAA8C;AAC9C,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAE/D"}
|
|
@@ -1,28 +1,40 @@
|
|
|
1
1
|
import { readFileSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import * as nodePath from 'node:path';
|
|
3
3
|
/**
|
|
4
|
-
* Mutate the `surface.enabled[]`
|
|
4
|
+
* Mutate the `surface.enabled[]` / `hidden[]` / `disabled[]` arrays in
|
|
5
5
|
* `sharkcraft.config.ts`. Preview-first: the caller computes the diff
|
|
6
6
|
* via {@link planSurfaceEdit} and only applies it via
|
|
7
7
|
* {@link applySurfaceEdit} when `--write` is passed.
|
|
8
|
+
*
|
|
9
|
+
* `before` must be the project config's OWN `surface{}` block — never the
|
|
10
|
+
* profile-merged view: the rendered block replaces the file's block
|
|
11
|
+
* wholesale, so a merged input would write the profile's lists into the
|
|
12
|
+
* config. `profile` is carried over untouched.
|
|
8
13
|
*/
|
|
9
14
|
export function planSurfaceEdit(configFile, before, edits) {
|
|
10
15
|
const beforeNormalised = {
|
|
16
|
+
...(before?.profile ? { profile: before.profile } : {}),
|
|
11
17
|
enabled: [...(before?.enabled ?? [])],
|
|
12
18
|
hidden: [...(before?.hidden ?? [])],
|
|
19
|
+
...(before?.disabled && before.disabled.length > 0 ? { disabled: [...before.disabled] } : {}),
|
|
20
|
+
};
|
|
21
|
+
const lists = {
|
|
22
|
+
enabled: new Set(beforeNormalised.enabled ?? []),
|
|
23
|
+
hidden: new Set(beforeNormalised.hidden ?? []),
|
|
24
|
+
disabled: new Set(beforeNormalised.disabled ?? []),
|
|
13
25
|
};
|
|
14
|
-
const afterEnabled = new Set(beforeNormalised.enabled ?? []);
|
|
15
|
-
const afterHidden = new Set(beforeNormalised.hidden ?? []);
|
|
16
26
|
for (const edit of edits) {
|
|
17
|
-
const target = edit.field
|
|
27
|
+
const target = lists[edit.field];
|
|
18
28
|
if (edit.operation === 'add')
|
|
19
29
|
target.add(edit.command);
|
|
20
30
|
else
|
|
21
31
|
target.delete(edit.command);
|
|
22
32
|
}
|
|
23
33
|
const after = {
|
|
24
|
-
|
|
25
|
-
|
|
34
|
+
...(before?.profile ? { profile: before.profile } : {}),
|
|
35
|
+
enabled: [...lists.enabled].sort(),
|
|
36
|
+
hidden: [...lists.hidden].sort(),
|
|
37
|
+
...(lists.disabled.size > 0 ? { disabled: [...lists.disabled].sort() } : {}),
|
|
26
38
|
};
|
|
27
39
|
return {
|
|
28
40
|
configFile,
|
|
@@ -106,6 +118,13 @@ export function renderSurfaceBlock(surface, indent = ' ') {
|
|
|
106
118
|
else {
|
|
107
119
|
lines.push(`${indent} hidden: [],`);
|
|
108
120
|
}
|
|
121
|
+
// Rendered only when present, so a block without a deny list is unchanged.
|
|
122
|
+
if (surface.disabled && surface.disabled.length > 0) {
|
|
123
|
+
lines.push(`${indent} disabled: [`);
|
|
124
|
+
for (const name of surface.disabled)
|
|
125
|
+
lines.push(`${indent} ${JSON.stringify(name)},`);
|
|
126
|
+
lines.push(`${indent} ],`);
|
|
127
|
+
}
|
|
109
128
|
lines.push(`${indent}},`);
|
|
110
129
|
return lines.join('\n') + '\n';
|
|
111
130
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which layer of the `surface{}` composition declared a selector: the
|
|
3
|
+
* project's own `sharkcraft.config.ts`, or the active surface profile it
|
|
4
|
+
* selects. Config wins over the profile — an explicit `surface.enabled`
|
|
5
|
+
* overrides a PROFILE's deny, never a config deny.
|
|
6
|
+
*/
|
|
7
|
+
export declare enum SurfaceLayer {
|
|
8
|
+
Config = "config",
|
|
9
|
+
Profile = "profile"
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=surface-layer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface-layer.d.ts","sourceRoot":"","sources":["../../src/surface/surface-layer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,oBAAY,YAAY;IACtB,MAAM,WAAW;IACjB,OAAO,YAAY;CACpB"}
|