@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
|
@@ -1,44 +1,80 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `shrk helper` commands.
|
|
3
3
|
*
|
|
4
|
-
* shrk helper list
|
|
4
|
+
* shrk helper list [--source builtin|local|pack]
|
|
5
5
|
* shrk helper get <id>
|
|
6
6
|
* shrk helper plan <id> --var k=v [--dry-run] [--output <plan.json>]
|
|
7
|
+
* shrk helper doctor [--allow-empty]
|
|
7
8
|
*
|
|
8
|
-
*
|
|
9
|
+
* Every verb reads THE helper catalog (`listAllHelpers`): built-in helpers ∪
|
|
10
|
+
* pack/local-contributed ones — the same list the id resolver and the MCP
|
|
11
|
+
* helper tools read. Dry-run by default; never writes source.
|
|
9
12
|
*/
|
|
10
13
|
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
11
14
|
import * as nodePath from 'node:path';
|
|
12
|
-
import { buildHelperPlan,
|
|
15
|
+
import { buildHelperPlan, buildPackHelperPlan, ContributionKind, HELPER_SYNTHETIC_TEMPLATE, helperPlanToSavedPlan, inspectSharkcraft, listAllHelpers, renderHelperPlanText, } from '@shrkcrft/inspector';
|
|
13
16
|
import { savePlanToFile, signPlan } from '@shrkcrft/generator';
|
|
14
17
|
import { flagBool, flagString, flagVars, resolveCwd, } from "../command-registry.js";
|
|
18
|
+
import { PositionalMode } from "../dispatch/positional-mode.js";
|
|
15
19
|
import { asJson, header } from "../output/format-output.js";
|
|
20
|
+
import { writeRejectedEntriesNote } from "../output/rejected-entries-note.js";
|
|
21
|
+
import { ALLOW_EMPTY_FLAG, allowEmptyValve } from "../gates/allow-empty.js";
|
|
22
|
+
import { settleVerdict } from "../gates/settle-verdict.js";
|
|
23
|
+
import { verdictLine } from "../gates/verdict-line.js";
|
|
24
|
+
const HELPER_SOURCES = ['builtin', 'local', 'pack'];
|
|
16
25
|
function writePlanFile(content, outputArg, cwd) {
|
|
17
26
|
const abs = nodePath.isAbsolute(outputArg) ? outputArg : nodePath.resolve(cwd, outputArg);
|
|
18
27
|
mkdirSync(nodePath.dirname(abs), { recursive: true });
|
|
19
28
|
writeFileSync(abs, content + '\n', 'utf8');
|
|
20
29
|
return abs;
|
|
21
30
|
}
|
|
31
|
+
function describeSource(h) {
|
|
32
|
+
if (h.source === 'pack')
|
|
33
|
+
return `pack ${h.packageName ?? '?'}`;
|
|
34
|
+
return h.source;
|
|
35
|
+
}
|
|
22
36
|
export const helperListCommand = {
|
|
23
37
|
name: 'list',
|
|
24
|
-
description: 'List
|
|
25
|
-
usage: 'shrk helper list [--json]',
|
|
38
|
+
description: 'List every helper (built-in + pack/local-contributed) with its source. `--source builtin|local|pack` filters.',
|
|
39
|
+
usage: 'shrk helper list [--source builtin|local|pack] [--json]',
|
|
26
40
|
async run(args) {
|
|
41
|
+
const source = flagString(args, 'source');
|
|
42
|
+
if (args.flags.has('source') && (source === undefined || !HELPER_SOURCES.includes(source))) {
|
|
43
|
+
process.stderr.write(`Invalid --source ${JSON.stringify(source ?? '')}. Expected one of: ${HELPER_SOURCES.join(', ')}\n`);
|
|
44
|
+
return 3;
|
|
45
|
+
}
|
|
46
|
+
const inspection = await inspectSharkcraft({ cwd: resolveCwd(args) });
|
|
47
|
+
const catalog = await listAllHelpers(inspection);
|
|
48
|
+
const entries = source ? catalog.entries.filter((h) => h.source === source) : catalog.entries;
|
|
49
|
+
const note = { ...(source ? { source } : {}), next: 'shrk helper doctor' };
|
|
27
50
|
if (flagBool(args, 'json')) {
|
|
28
|
-
process.stdout.write(asJson(
|
|
51
|
+
process.stdout.write(asJson(entries) + '\n');
|
|
52
|
+
await writeRejectedEntriesNote(inspection, [ContributionKind.Helper], { ...note, json: true });
|
|
29
53
|
return 0;
|
|
30
54
|
}
|
|
31
|
-
process.stdout.write(header(`Helpers (${
|
|
32
|
-
|
|
55
|
+
process.stdout.write(header(`Helpers (${entries.length})`));
|
|
56
|
+
if (entries.length > 0) {
|
|
57
|
+
process.stdout.write(` ${'ID'.padEnd(34)} ${'SOURCE'.padEnd(24)} DESCRIPTION\n`);
|
|
58
|
+
}
|
|
59
|
+
for (const h of entries) {
|
|
33
60
|
const marker = h.destructive ? '[destructive] ' : ' ';
|
|
34
|
-
process.stdout.write(` ${marker}${h.id.padEnd(34)} ${h.description}\n`);
|
|
61
|
+
process.stdout.write(` ${marker}${h.id.padEnd(34)} ${describeSource(h).padEnd(24)} ${h.description}\n`);
|
|
35
62
|
}
|
|
63
|
+
// A FILE that did not load is said as such; an ENTRY its loader refused is
|
|
64
|
+
// named with its reason (round 12, 12.1) — the old line counted both as
|
|
65
|
+
// "helper file error(s)".
|
|
66
|
+
const brokenFiles = catalog.files.filter((f) => f.status !== 'loaded').length;
|
|
67
|
+
if (brokenFiles > 0) {
|
|
68
|
+
process.stdout.write(`\n${brokenFiles} helper file(s) failed to load or are missing — run \`shrk helper doctor\`.\n`);
|
|
69
|
+
}
|
|
70
|
+
// Load failures are the broken-file line above — never said twice.
|
|
71
|
+
await writeRejectedEntriesNote(inspection, [ContributionKind.Helper], { ...note, loadFailures: false });
|
|
36
72
|
return 0;
|
|
37
73
|
},
|
|
38
74
|
};
|
|
39
75
|
export const helperGetCommand = {
|
|
40
76
|
name: 'get',
|
|
41
|
-
description: 'Show a helper definition (variables, safety flags).',
|
|
77
|
+
description: 'Show a helper definition (source, variables, safety flags, operations).',
|
|
42
78
|
usage: 'shrk helper get <id> [--json]',
|
|
43
79
|
async run(args) {
|
|
44
80
|
const id = args.positional[0];
|
|
@@ -46,7 +82,8 @@ export const helperGetCommand = {
|
|
|
46
82
|
process.stderr.write('Usage: shrk helper get <id>\n');
|
|
47
83
|
return 2;
|
|
48
84
|
}
|
|
49
|
-
const
|
|
85
|
+
const inspection = await inspectSharkcraft({ cwd: resolveCwd(args) });
|
|
86
|
+
const def = (await listAllHelpers(inspection)).entries.find((h) => h.id === id);
|
|
50
87
|
if (!def) {
|
|
51
88
|
process.stderr.write(`Unknown helper: ${id}\n`);
|
|
52
89
|
return 1;
|
|
@@ -56,19 +93,63 @@ export const helperGetCommand = {
|
|
|
56
93
|
return 0;
|
|
57
94
|
}
|
|
58
95
|
process.stdout.write(header(`Helper: ${def.id}`));
|
|
96
|
+
process.stdout.write(` title ${def.title}\n`);
|
|
59
97
|
process.stdout.write(` description ${def.description}\n`);
|
|
98
|
+
process.stdout.write(` source ${describeSource(def)}${def.sourceFile ? ` (${def.sourceFile})` : ''}\n`);
|
|
99
|
+
process.stdout.write(` output ${def.outputKind}\n`);
|
|
60
100
|
process.stdout.write(` destructive ${def.destructive ? 'yes' : 'no'}\n`);
|
|
61
101
|
process.stdout.write(` review ${def.requiresHumanReview ? 'human review required' : 'auto'}\n`);
|
|
102
|
+
if (def.requiresProfile)
|
|
103
|
+
process.stdout.write(` profile required\n`);
|
|
62
104
|
process.stdout.write(` variables ${def.variables.length}\n`);
|
|
63
105
|
for (const v of def.variables) {
|
|
64
|
-
|
|
106
|
+
const dflt = v.defaultValue !== undefined ? ` [default: ${v.defaultValue}]` : '';
|
|
107
|
+
process.stdout.write(` • ${v.name}${v.required ? ' (required)' : ''}${dflt} — ${v.description}\n`);
|
|
108
|
+
}
|
|
109
|
+
if (def.operations.length > 0) {
|
|
110
|
+
process.stdout.write(` operations ${def.operations.length}\n`);
|
|
111
|
+
for (const op of def.operations) {
|
|
112
|
+
// A pack op may omit `description` (a manual-checklist op usually
|
|
113
|
+
// carries only `checklist[]`) — never interpolate an absent field.
|
|
114
|
+
const desc = op.description;
|
|
115
|
+
const detail = desc && desc.trim().length > 0 ? desc : (op.checklist ?? []).join('; ');
|
|
116
|
+
process.stdout.write(` • ${op.kind}${op.targetPath ? ` ${op.targetPath}` : ''}${detail ? ` — ${detail}` : ''}\n`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (def.manualChecklist.length > 0) {
|
|
120
|
+
process.stdout.write(` checklist ${def.manualChecklist.length}\n`);
|
|
121
|
+
for (const c of def.manualChecklist)
|
|
122
|
+
process.stdout.write(` • ${c}\n`);
|
|
65
123
|
}
|
|
66
124
|
return 0;
|
|
67
125
|
},
|
|
68
126
|
};
|
|
127
|
+
function writePlanOutput(plan, args, cwd) {
|
|
128
|
+
const output = flagString(args, 'output');
|
|
129
|
+
if (flagBool(args, 'json')) {
|
|
130
|
+
const body = asJson(plan);
|
|
131
|
+
if (output) {
|
|
132
|
+
const abs = writePlanFile(body, output, cwd);
|
|
133
|
+
process.stdout.write(`Wrote ${abs}\n`);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
process.stdout.write(body + '\n');
|
|
137
|
+
}
|
|
138
|
+
return 0;
|
|
139
|
+
}
|
|
140
|
+
process.stdout.write(renderHelperPlanText(plan));
|
|
141
|
+
if (plan.destructive) {
|
|
142
|
+
process.stdout.write('\n⚠ DESTRUCTIVE — human approval required.\n');
|
|
143
|
+
}
|
|
144
|
+
if (output) {
|
|
145
|
+
const abs = writePlanFile(asJson(plan), output, cwd);
|
|
146
|
+
process.stdout.write(`\nSaved plan to ${abs}\n`);
|
|
147
|
+
}
|
|
148
|
+
return 0;
|
|
149
|
+
}
|
|
69
150
|
export const helperPlanCommand = {
|
|
70
151
|
name: 'plan',
|
|
71
|
-
description: 'Generate a plan-only helper plan (dry-run by default).
|
|
152
|
+
description: 'Generate a plan-only helper plan (dry-run by default). Built-in helpers: pass --save-plan <file> to emit a saved plan that flows through `shrk apply`. Pack/local helpers render their declarative operations; --save-plan is refused for them.',
|
|
72
153
|
usage: 'shrk helper plan <id> --var k=v [--output <plan.json>] [--save-plan <file>] [--sign] [--json]',
|
|
73
154
|
async run(args) {
|
|
74
155
|
const id = args.positional[0];
|
|
@@ -76,23 +157,37 @@ export const helperPlanCommand = {
|
|
|
76
157
|
process.stderr.write('Usage: shrk helper plan <id> --var k=v\n');
|
|
77
158
|
return 2;
|
|
78
159
|
}
|
|
79
|
-
const
|
|
160
|
+
const cwd = resolveCwd(args);
|
|
161
|
+
const inspection = await inspectSharkcraft({ cwd });
|
|
162
|
+
const def = (await listAllHelpers(inspection)).entries.find((h) => h.id === id);
|
|
80
163
|
if (!def) {
|
|
81
164
|
process.stderr.write(`Unknown helper: ${id}\n`);
|
|
82
165
|
return 1;
|
|
83
166
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
167
|
+
const vars = flagVars(args);
|
|
168
|
+
const savePlanPath = flagString(args, 'save-plan');
|
|
169
|
+
if (def.source !== 'builtin') {
|
|
170
|
+
if (savePlanPath) {
|
|
171
|
+
// helperPlanToSavedPlan is an identity stub: writing its output would
|
|
172
|
+
// produce a file `shrk apply` cannot read. Refuse loudly, never fake it.
|
|
173
|
+
process.stderr.write(`Refusing --save-plan for ${describeSource(def)} helper "${id}": a declarative helper plan cannot yet be converted into a saved plan \`shrk apply\` reads. Use --output <file> (the preview JSON) and apply the operations by hand.\n`);
|
|
174
|
+
return 2;
|
|
175
|
+
}
|
|
176
|
+
if (def.requiresProfile) {
|
|
177
|
+
process.stderr.write(`Helper "${id}" requires a registered profile. Available:\n $ shrk profiles list\n`);
|
|
178
|
+
}
|
|
179
|
+
const built = buildPackHelperPlan(def, vars);
|
|
180
|
+
if (!built.ok) {
|
|
181
|
+
process.stderr.write(`${built.message}\n`);
|
|
182
|
+
return 1;
|
|
183
|
+
}
|
|
184
|
+
return writePlanOutput(built.plan, args, cwd);
|
|
185
|
+
}
|
|
186
|
+
if (def.requiresProfile) {
|
|
88
187
|
process.stderr.write(`Helper "${id}" requires a registered profile. Available:\n $ shrk profiles list\n`);
|
|
89
|
-
// Still try to build the plan; the registry throws with the same idea.
|
|
90
188
|
}
|
|
91
|
-
const cwd = resolveCwd(args);
|
|
92
|
-
const vars = flagVars(args);
|
|
93
189
|
try {
|
|
94
190
|
const plan = buildHelperPlan({ helperId: id, projectRoot: cwd, vars });
|
|
95
|
-
const savePlanPath = flagString(args, 'save-plan');
|
|
96
191
|
if (savePlanPath) {
|
|
97
192
|
const saved = helperPlanToSavedPlan(plan, cwd);
|
|
98
193
|
let toWrite = saved;
|
|
@@ -118,27 +213,7 @@ export const helperPlanCommand = {
|
|
|
118
213
|
}
|
|
119
214
|
return 0;
|
|
120
215
|
}
|
|
121
|
-
|
|
122
|
-
if (flagBool(args, 'json')) {
|
|
123
|
-
const body = asJson(plan);
|
|
124
|
-
if (output) {
|
|
125
|
-
const abs = writePlanFile(body, output, cwd);
|
|
126
|
-
process.stdout.write(`Wrote ${abs}\n`);
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
process.stdout.write(body + '\n');
|
|
130
|
-
}
|
|
131
|
-
return 0;
|
|
132
|
-
}
|
|
133
|
-
process.stdout.write(renderHelperPlanText(plan));
|
|
134
|
-
if (plan.destructive) {
|
|
135
|
-
process.stdout.write('\n⚠ DESTRUCTIVE — human approval required.\n');
|
|
136
|
-
}
|
|
137
|
-
if (output) {
|
|
138
|
-
const abs = writePlanFile(asJson(plan), output, cwd);
|
|
139
|
-
process.stdout.write(`\nSaved plan to ${abs}\n`);
|
|
140
|
-
}
|
|
141
|
-
return 0;
|
|
216
|
+
return writePlanOutput(plan, args, cwd);
|
|
142
217
|
}
|
|
143
218
|
catch (e) {
|
|
144
219
|
process.stderr.write(`${e.message}\n`);
|
|
@@ -146,25 +221,89 @@ export const helperPlanCommand = {
|
|
|
146
221
|
}
|
|
147
222
|
},
|
|
148
223
|
};
|
|
224
|
+
export const helperDoctorCommand = {
|
|
225
|
+
name: 'doctor',
|
|
226
|
+
description: 'Validate every helper file (local helpers.ts + pack helperFiles[]): load failures, invalid helpers, duplicate ids, unknown operation keys. Exit 0 clean · 1 errors · 2 nothing examined (pass --allow-empty to accept an empty helper set).',
|
|
227
|
+
usage: 'shrk helper doctor [--allow-empty] [--json]',
|
|
228
|
+
booleanFlags: new Set([ALLOW_EMPTY_FLAG, 'json']),
|
|
229
|
+
async run(args) {
|
|
230
|
+
const inspection = await inspectSharkcraft({ cwd: resolveCwd(args) });
|
|
231
|
+
const catalog = await listAllHelpers(inspection);
|
|
232
|
+
const errors = catalog.issues.filter((i) => i.severity === 'error');
|
|
233
|
+
const warnings = catalog.issues.filter((i) => i.severity === 'warning');
|
|
234
|
+
const unexamined = catalog.files.filter((f) => f.status !== 'loaded');
|
|
235
|
+
const coverage = {
|
|
236
|
+
unit: 'helper files',
|
|
237
|
+
expected: catalog.files.length,
|
|
238
|
+
examined: catalog.files.length - unexamined.length,
|
|
239
|
+
root: inspection.projectRoot,
|
|
240
|
+
...(unexamined.length > 0
|
|
241
|
+
? {
|
|
242
|
+
unexamined: unexamined.slice(0, 20).map((f) => nodePath.relative(inspection.projectRoot, f.file) || f.file),
|
|
243
|
+
unexaminedTotal: unexamined.length,
|
|
244
|
+
reason: 'failed to load or missing',
|
|
245
|
+
}
|
|
246
|
+
: { reason: 'no helpers.ts and no pack helperFiles[] declared' }),
|
|
247
|
+
...allowEmptyValve(args, catalog.files.length),
|
|
248
|
+
};
|
|
249
|
+
const settled = settleVerdict(errors.length > 0 ? 1 : 0, [coverage]);
|
|
250
|
+
if (flagBool(args, 'json')) {
|
|
251
|
+
process.stdout.write(asJson({
|
|
252
|
+
helpers: catalog.entries.length,
|
|
253
|
+
files: catalog.files,
|
|
254
|
+
issues: catalog.issues,
|
|
255
|
+
coverage,
|
|
256
|
+
exitCode: settled.exit,
|
|
257
|
+
verdict: settled.verdict,
|
|
258
|
+
shortfalls: settled.shortfalls,
|
|
259
|
+
accepted: settled.accepted,
|
|
260
|
+
}) + '\n');
|
|
261
|
+
return settled.exit;
|
|
262
|
+
}
|
|
263
|
+
process.stdout.write(header('Helper doctor'));
|
|
264
|
+
process.stdout.write(` helpers ${catalog.entries.length} · files ${catalog.files.length} (${catalog.files.length - unexamined.length} loaded)\n\n`);
|
|
265
|
+
for (const i of catalog.issues) {
|
|
266
|
+
process.stdout.write(` ${i.severity.toUpperCase().padEnd(8)} ${i.code.padEnd(16)} ${i.helperId ? `${i.helperId} ` : ''}${i.message}${i.source ? ` (${i.source})` : ''}\n`);
|
|
267
|
+
}
|
|
268
|
+
if (catalog.issues.length > 0)
|
|
269
|
+
process.stdout.write('\n');
|
|
270
|
+
if (settled.exit === 1) {
|
|
271
|
+
process.stdout.write(`${errors.length} helper error(s), ${warnings.length} warning(s).\n`);
|
|
272
|
+
}
|
|
273
|
+
const line = verdictLine(settled, `Helpers OK — ${catalog.entries.length} helper(s) from ${catalog.files.length} file(s)${warnings.length > 0 ? `, ${warnings.length} warning(s) above` : ''}. ✓`, catalog.files.length === 0 ? 'No helper files to examine.' : undefined);
|
|
274
|
+
if (line)
|
|
275
|
+
process.stdout.write(line + '\n');
|
|
276
|
+
if (settled.exit === 2 && catalog.files.length === 0) {
|
|
277
|
+
process.stdout.write('Pass --allow-empty to accept an empty helper set explicitly.\n');
|
|
278
|
+
}
|
|
279
|
+
return settled.exit;
|
|
280
|
+
},
|
|
281
|
+
};
|
|
149
282
|
export const helperCommand = {
|
|
150
283
|
name: 'helper',
|
|
151
|
-
|
|
152
|
-
|
|
284
|
+
positionals: PositionalMode.None,
|
|
285
|
+
subverbs: [
|
|
286
|
+
{ name: 'list', description: 'List the helpers.', usage: 'shrk helper list [--json]' },
|
|
287
|
+
{ name: 'get', description: 'Show one helper.', usage: 'shrk helper get <id> [--json]', positionals: PositionalMode.Free },
|
|
288
|
+
{ name: 'plan', description: 'Plan one helper (dry-run).', usage: 'shrk helper plan <id> --var k=v', positionals: PositionalMode.Free },
|
|
289
|
+
{ name: 'doctor', description: 'Helper files loaded + validated.', usage: 'shrk helper doctor [--allow-empty] [--json]' },
|
|
290
|
+
],
|
|
291
|
+
description: 'Helper plan generators (list / get / plan / doctor). Plan-only, dry-run default.',
|
|
292
|
+
usage: 'shrk helper list|get <id>|plan <id> --var k=v|doctor',
|
|
153
293
|
async run(args) {
|
|
154
294
|
const sub = args.positional[0];
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
if (sub === 'plan') {
|
|
295
|
+
const dispatch = {
|
|
296
|
+
list: helperListCommand,
|
|
297
|
+
get: helperGetCommand,
|
|
298
|
+
plan: helperPlanCommand,
|
|
299
|
+
doctor: helperDoctorCommand,
|
|
300
|
+
};
|
|
301
|
+
const handler = sub ? dispatch[sub] : undefined;
|
|
302
|
+
if (handler) {
|
|
164
303
|
args.positional = args.positional.slice(1);
|
|
165
|
-
return
|
|
304
|
+
return handler.run(args);
|
|
166
305
|
}
|
|
167
|
-
process.stderr.write('Usage: shrk helper list|get <id>|plan <id
|
|
306
|
+
process.stderr.write('Usage: shrk helper list|get <id>|plan <id>|doctor\n');
|
|
168
307
|
return 2;
|
|
169
308
|
},
|
|
170
309
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impact.command.d.ts","sourceRoot":"","sources":["../../src/commands/impact.command.ts"],"names":[],"mappings":"AAsBA,OAAO,
|
|
1
|
+
{"version":3,"file":"impact.command.d.ts","sourceRoot":"","sources":["../../src/commands/impact.command.ts"],"names":[],"mappings":"AAsBA,OAAO,EAQL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AA0ehC,eAAO,MAAM,aAAa,EAAE,eAmZ3B,CAAC"}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import * as nodePath from 'node:path';
|
|
3
3
|
import { analyzeImpact, analyzeTestImpact, findSymbolInProject, FuzzyImpactSourceKind, getChangedFiles, ImpactInputKind, inspectSharkcraft, QueryMatchKind, readFeatureBundle, renderImpactGraph, renderImpactHtml, renderImpactMarkdown, renderImpactText, resolveFuzzyImpact, warmConstructCache, } from '@shrkcrft/inspector';
|
|
4
|
-
import { flagBool, flagNumber, flagString, flagList, resolveCwd, } from "../command-registry.js";
|
|
4
|
+
import { emptySelectionExit, flagBool, flagNumber, flagString, flagList, requireInputSelector, resolveCwd, } from "../command-registry.js";
|
|
5
|
+
import { PositionalMode } from "../dispatch/positional-mode.js";
|
|
6
|
+
import { formatCoverage } from '@shrkcrft/core';
|
|
5
7
|
import { asJson, header, kv } from "../output/format-output.js";
|
|
6
8
|
import { fuzzyImpactAmbiguousHints, renderFailureHints } from "../output/failure-hints.js";
|
|
7
9
|
import { computeDeletedOrphans } from "../diff/deleted-orphans.js";
|
|
10
|
+
import { deletedOrphanCoverage } from "../diff/deleted-orphan-coverage.js";
|
|
11
|
+
import { deletedOrphanScopeNotes } from "../diff/deleted-orphan-scope-notes.js";
|
|
12
|
+
import { ExitCode } from "../exit-codes.js";
|
|
13
|
+
import { ALLOW_EMPTY_FLAG, allowEmptyValve } from "../gates/allow-empty.js";
|
|
14
|
+
import { settleVerdict } from "../gates/settle-verdict.js";
|
|
15
|
+
import { verdictLine } from "../gates/verdict-line.js";
|
|
8
16
|
function collectFiles(args, cwd) {
|
|
9
17
|
const diagnostics = [];
|
|
10
18
|
const explicitFiles = flagList(args, 'files');
|
|
@@ -286,12 +294,20 @@ async function runViaGraph(args) {
|
|
|
286
294
|
* default branch) and queries the graph for surviving files that still
|
|
287
295
|
* import them or reference a symbol they declared (alias-resolved, incl.
|
|
288
296
|
* barrel re-exports). Any surviving importer is reported with `file:line`
|
|
289
|
-
* and the command exits
|
|
290
|
-
* "no orphaned importers". Mirrors `--via-graph`'s flag/JSON style.
|
|
297
|
+
* and the command exits 1. Mirrors `--via-graph`'s flag/JSON style.
|
|
291
298
|
*
|
|
292
299
|
* The graph is queried against the CURRENT index snapshot — a not-yet-
|
|
293
300
|
* reindexed delete still carries its inbound edges, which is exactly what
|
|
294
301
|
* lets the check see the broken importers before they hit the build.
|
|
302
|
+
*
|
|
303
|
+
* It answers the same question as `shrk check orphans`, from the same scan,
|
|
304
|
+
* and settles the same way: "no orphaned importers" (exit 0) only when every
|
|
305
|
+
* deleted source file was checked against an index current for every
|
|
306
|
+
* surviving importer. A deleted source file the index does not know, an index
|
|
307
|
+
* that never read files changed since it was built, or nothing deleted at all
|
|
308
|
+
* is NOT VERIFIED (2). `--allow-empty` accepts an EMPTY scope (nothing the
|
|
309
|
+
* graph indexes was deleted) explicitly — never a stale one. `--json` carries
|
|
310
|
+
* `coverage`, `indexDivergence`, `exitCode`, `verdict` and `shortfalls`.
|
|
295
311
|
*/
|
|
296
312
|
async function runDeletedOrphans(args) {
|
|
297
313
|
const cwd = resolveCwd(args);
|
|
@@ -314,8 +330,17 @@ async function runDeletedOrphans(args) {
|
|
|
314
330
|
}
|
|
315
331
|
return 2;
|
|
316
332
|
}
|
|
333
|
+
// What the scan examined — the ONE authority `check orphans` settles on
|
|
334
|
+
// (`deletedOrphanCoverage`): the deleted source files the index knows, over
|
|
335
|
+
// an index current for every surviving importer. This verb answers the same
|
|
336
|
+
// question from the same scan, so it settles the same way (`settleVerdict`;
|
|
337
|
+
// it has no gate envelope): "no orphaned importers" is printed only through
|
|
338
|
+
// the settled verdict, never over a stale, unindexed or empty scope.
|
|
339
|
+
const measured = deletedOrphanCoverage(scan);
|
|
340
|
+
const coverage = { ...measured, ...allowEmptyValve(args, measured.expected) };
|
|
317
341
|
const deleted = scan.deleted;
|
|
318
342
|
if (deleted.length === 0) {
|
|
343
|
+
const settled = settleVerdict(ExitCode.VerifiedPass, [coverage]);
|
|
319
344
|
if (wantJson) {
|
|
320
345
|
process.stdout.write(asJson({
|
|
321
346
|
schema: 'sharkcraft.deleted-orphans/v1',
|
|
@@ -323,25 +348,55 @@ async function runDeletedOrphans(args) {
|
|
|
323
348
|
unresolvedDeleted: [],
|
|
324
349
|
orphans: [],
|
|
325
350
|
diagnostics: [`no deleted files in diff vs ${scan.ref}`],
|
|
351
|
+
coverage,
|
|
352
|
+
exitCode: settled.exit,
|
|
353
|
+
verdict: settled.verdict,
|
|
354
|
+
shortfalls: settled.shortfalls,
|
|
355
|
+
accepted: settled.accepted,
|
|
326
356
|
}) + '\n');
|
|
327
|
-
return
|
|
357
|
+
return settled.exit;
|
|
328
358
|
}
|
|
329
359
|
process.stdout.write(header('Deleted-symbol orphans'));
|
|
330
360
|
process.stdout.write(`No deleted files in diff vs ${scan.ref}.\n`);
|
|
331
|
-
|
|
361
|
+
const line = verdictLine(settled, 'Nothing deleted — accepted.');
|
|
362
|
+
if (line)
|
|
363
|
+
process.stdout.write(`\n${line}\n`);
|
|
364
|
+
if (settled.exit === ExitCode.NotVerified) {
|
|
365
|
+
process.stdout.write(` Pass --${ALLOW_EMPTY_FLAG} to accept an empty diff explicitly.\n`);
|
|
366
|
+
}
|
|
367
|
+
return settled.exit;
|
|
332
368
|
}
|
|
333
369
|
const report = scan.report;
|
|
370
|
+
const settled = settleVerdict(report.orphans.length > 0 ? ExitCode.Failure : ExitCode.VerifiedPass, [coverage]);
|
|
371
|
+
const exit = settled.exit;
|
|
334
372
|
if (wantJson) {
|
|
335
|
-
process.stdout.write(asJson(
|
|
336
|
-
|
|
373
|
+
process.stdout.write(asJson({
|
|
374
|
+
...report,
|
|
375
|
+
...(scan.indexDivergence ? { indexDivergence: scan.indexDivergence } : {}),
|
|
376
|
+
coverage,
|
|
377
|
+
exitCode: exit,
|
|
378
|
+
verdict: settled.verdict,
|
|
379
|
+
shortfalls: settled.shortfalls,
|
|
380
|
+
accepted: settled.accepted,
|
|
381
|
+
}) + '\n');
|
|
382
|
+
return exit;
|
|
337
383
|
}
|
|
384
|
+
const notes = deletedOrphanScopeNotes(scan, coverage, 'shrk impact --deleted');
|
|
338
385
|
process.stdout.write(header('Deleted-symbol orphans'));
|
|
339
386
|
process.stdout.write(`Deleted files (vs ${scan.ref}): ${deleted.length}\n`);
|
|
387
|
+
process.stdout.write(kv('coverage', formatCoverage(coverage)) + '\n');
|
|
388
|
+
if (notes.index !== undefined)
|
|
389
|
+
process.stdout.write(kv('index', notes.index) + '\n');
|
|
340
390
|
if (report.orphans.length === 0) {
|
|
341
|
-
process.stdout.write('no orphaned importers\n');
|
|
342
391
|
for (const d of report.diagnostics.slice(0, 5))
|
|
343
392
|
process.stdout.write(`! ${d}\n`);
|
|
344
|
-
|
|
393
|
+
const line = verdictLine(settled, 'no orphaned importers', notes.lead);
|
|
394
|
+
if (line)
|
|
395
|
+
process.stdout.write(`${line}\n`);
|
|
396
|
+
if (exit === ExitCode.NotVerified && coverage.expected === 0) {
|
|
397
|
+
process.stdout.write(` Pass --${ALLOW_EMPTY_FLAG} to accept a delete with no indexed source files explicitly.\n`);
|
|
398
|
+
}
|
|
399
|
+
return exit;
|
|
345
400
|
}
|
|
346
401
|
process.stdout.write(`\n${report.orphans.length} surviving importer(s) still reference deleted code:\n`);
|
|
347
402
|
for (const o of report.orphans) {
|
|
@@ -353,12 +408,42 @@ async function runDeletedOrphans(args) {
|
|
|
353
408
|
}
|
|
354
409
|
for (const d of report.diagnostics.slice(0, 5))
|
|
355
410
|
process.stdout.write(`! ${d}\n`);
|
|
356
|
-
|
|
411
|
+
// A surviving importer is real even over a partial scope (1); the line names
|
|
412
|
+
// what was not examined next to it.
|
|
413
|
+
const tail = verdictLine(settled, '');
|
|
414
|
+
if (tail)
|
|
415
|
+
process.stdout.write(`${tail}\n`);
|
|
416
|
+
return exit;
|
|
357
417
|
}
|
|
358
418
|
export const impactCommand = {
|
|
359
419
|
name: 'impact',
|
|
420
|
+
// Free: `impact <fileOrQuery>` resolves a fuzzy query, never refused.
|
|
421
|
+
positionals: PositionalMode.Free,
|
|
422
|
+
subverbs: [
|
|
423
|
+
{ name: 'tests', description: 'The tests a change impacts.', usage: 'shrk impact tests ["<task>"] [--files a,b] [--since <ref>] [--json]', positionals: PositionalMode.Free },
|
|
424
|
+
{
|
|
425
|
+
name: 'graph',
|
|
426
|
+
description: 'Render a saved impact report as a graph.',
|
|
427
|
+
usage: 'shrk impact graph <impact-report.json> [--format mermaid|dot] [--output <path>]',
|
|
428
|
+
positionals: PositionalMode.Path,
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
name: 'baseline',
|
|
432
|
+
description: 'Write / show / clear the impact baseline (`show` is the default).',
|
|
433
|
+
usage: 'shrk impact baseline <write|show|clear> [--json]',
|
|
434
|
+
positionals: PositionalMode.None,
|
|
435
|
+
subverbs: [
|
|
436
|
+
{ name: 'write', description: 'Write the impact baseline.', usage: 'shrk impact baseline write [--json]' },
|
|
437
|
+
{ name: 'show', description: 'Show the impact baseline.', usage: 'shrk impact baseline show [--json]' },
|
|
438
|
+
{ name: 'clear', description: 'Clear the impact baseline.', usage: 'shrk impact baseline clear [--json]' },
|
|
439
|
+
],
|
|
440
|
+
},
|
|
441
|
+
],
|
|
360
442
|
description: 'Architecture impact analysis: direct + transitive dependents, risk + suggested commands. Supports fuzzy <query> resolution. Read-only.',
|
|
361
|
-
usage: 'shrk impact <fileOrQuery> | --file <path> | --specifier <spec> | --since <ref> | --staged | --files a,b | --plan <plan.json> | --bundle <id> | --deleted [--since <ref>] [--max-depth N] [--limit N] [--format text|markdown|html|json] [--output <path>] [--tree|--no-tree] [--json] [--html] [--resolve|--resolve-only|--explain-resolution|--no-resolve]',
|
|
443
|
+
usage: 'shrk impact <fileOrQuery> | --file <path> | --specifier <spec> | --since <ref> | --staged | --files a,b | --plan <plan.json> | --bundle <id> | --deleted [--since <ref>] [--allow-empty] [--max-depth N] [--limit N] [--format text|markdown|html|json] [--output <path>] [--tree|--no-tree] [--json] [--html] [--resolve|--resolve-only|--explain-resolution|--no-resolve]',
|
|
444
|
+
// `--deleted` and `--allow-empty` take no value — they must never swallow a
|
|
445
|
+
// following positional.
|
|
446
|
+
booleanFlags: new Set(['deleted', ALLOW_EMPTY_FLAG]),
|
|
362
447
|
async run(args) {
|
|
363
448
|
if (args.positional[0] === 'tests') {
|
|
364
449
|
return runImpactTests({ ...args, positional: args.positional.slice(1) });
|
|
@@ -383,6 +468,15 @@ export const impactCommand = {
|
|
|
383
468
|
if (args.flags.has('deleted')) {
|
|
384
469
|
return runDeletedOrphans(args);
|
|
385
470
|
}
|
|
471
|
+
// No input at all is a usage error (3) — it used to render as a confident
|
|
472
|
+
// `Impact (empty) … Risk: low`, a verdict over nothing.
|
|
473
|
+
const noSelector = requireInputSelector(args, {
|
|
474
|
+
flags: ['file', 'files', 'specifier', 'since', 'staged', 'plan', 'bundle', 'task', 'symbol'],
|
|
475
|
+
positional: true,
|
|
476
|
+
usage: 'shrk impact <fileOrQuery> | --file <path> | --files a,b | --specifier <spec> | --since <ref> | --staged | --plan <plan.json> | --bundle <id> | --task "<text>" | --symbol <Name> | --deleted',
|
|
477
|
+
});
|
|
478
|
+
if (noSelector !== null)
|
|
479
|
+
return noSelector;
|
|
386
480
|
const cwd = resolveCwd(args);
|
|
387
481
|
const inspection = await inspectSharkcraft({ cwd });
|
|
388
482
|
// Warm construct cache so fuzzy resolution can map plugin keys / events /
|
|
@@ -415,7 +509,7 @@ export const impactCommand = {
|
|
|
415
509
|
}
|
|
416
510
|
process.stdout.write('\nNext commands:\n');
|
|
417
511
|
process.stdout.write(` shrk trace --symbol ${symbolFlag}\n`);
|
|
418
|
-
process.stdout.write(` shrk
|
|
512
|
+
process.stdout.write(` shrk search "${symbolFlag}"\n`);
|
|
419
513
|
}
|
|
420
514
|
return 1;
|
|
421
515
|
}
|
|
@@ -464,6 +558,15 @@ export const impactCommand = {
|
|
|
464
558
|
const collected = collectFiles(args, cwd);
|
|
465
559
|
const positionalRest = args.positional.slice(1).join(' ').trim();
|
|
466
560
|
const task = flagString(args, 'task') ?? (positionalRest.length > 0 ? positionalRest : undefined);
|
|
561
|
+
// A selector was given but resolved to 0 files (`--since HEAD` on a clean
|
|
562
|
+
// tree): nothing was analysed — 2, never `Impact (empty) … Risk: low`.
|
|
563
|
+
if (collected.files.length === 0 &&
|
|
564
|
+
collected.planTargets.length === 0 &&
|
|
565
|
+
collected.specifier === undefined &&
|
|
566
|
+
task === undefined &&
|
|
567
|
+
args.positional.length === 0) {
|
|
568
|
+
return emptySelectionExit(flagBool(args, 'json') || flagString(args, 'format') === 'json');
|
|
569
|
+
}
|
|
467
570
|
const maxDepth = flagNumber(args, 'max-depth');
|
|
468
571
|
const limit = flagNumber(args, 'limit');
|
|
469
572
|
// Fuzzy query resolution.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"infer.command.d.ts","sourceRoot":"","sources":["../../src/commands/infer.command.ts"],"names":[],"mappings":"AAYA,OAAO,EAIL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"infer.command.d.ts","sourceRoot":"","sources":["../../src/commands/infer.command.ts"],"names":[],"mappings":"AAYA,OAAO,EAIL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AA4BhC,eAAO,MAAM,YAAY,EAAE,eAuB1B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { existsSync, readdirSync, statSync } from 'node:fs';
|
|
2
1
|
import * as nodePath from 'node:path';
|
|
3
|
-
import { inferTemplateBodyV2, inspectSharkcraft, loadScaffoldPatternsFromInspection,
|
|
2
|
+
import { enumerateScaffoldPatternCandidates, inferTemplateBodyV2, inspectSharkcraft, loadScaffoldPatternsFromInspection, walkScaffoldCandidateFiles, extractVariablesForFile, } from '@shrkcrft/inspector';
|
|
4
3
|
import { flagBool, flagString, resolveCwd, } from "../command-registry.js";
|
|
4
|
+
import { PositionalMode } from "../dispatch/positional-mode.js";
|
|
5
5
|
import { asJson, header } from "../output/format-output.js";
|
|
6
6
|
const KIND_MAP = {
|
|
7
7
|
service: 'service',
|
|
@@ -17,6 +17,14 @@ const KIND_MAP = {
|
|
|
17
17
|
};
|
|
18
18
|
export const inferCommand = {
|
|
19
19
|
name: 'infer',
|
|
20
|
+
positionals: PositionalMode.None,
|
|
21
|
+
subverbs: [
|
|
22
|
+
{
|
|
23
|
+
name: 'templates',
|
|
24
|
+
description: 'Template-body draft candidates (TypeScript compiler API + pack scaffold patterns).',
|
|
25
|
+
usage: 'shrk infer templates [--ast] [--kind service|utility|test|component] [--include <glob>] [--limit N] [--json]',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
20
28
|
description: 'Inference helpers (templates / boundaries). `shrk infer templates --ast` produces template-body draft candidates using the TypeScript compiler API when available, with scaffold-pattern–driven detection from installed packs.',
|
|
21
29
|
usage: 'shrk [--cwd <dir>] infer templates [--ast] [--kind service|utility|test|component] [--include <glob>] [--limit N] [--json]',
|
|
22
30
|
async run(args) {
|
|
@@ -125,22 +133,20 @@ async function runInferTemplates(args) {
|
|
|
125
133
|
}
|
|
126
134
|
function collectCandidateFiles(input) {
|
|
127
135
|
const seen = new Map();
|
|
128
|
-
// 1. Scaffold-pattern matches
|
|
136
|
+
// 1. Scaffold-pattern matches — THE enumeration the scaffold doctor counts
|
|
137
|
+
// with, so a pattern the doctor calls dead is one infer never matches.
|
|
129
138
|
if (input.patterns.length > 0) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
+
const byId = new Map(input.patterns.map((p) => [p.pattern.id, p]));
|
|
140
|
+
for (const m of enumerateScaffoldPatternCandidates(input.cwd, input.patterns).firstMatch) {
|
|
141
|
+
const abs = nodePath.join(input.cwd, m.file);
|
|
142
|
+
if (!seen.has(abs))
|
|
143
|
+
seen.set(abs, { absPath: abs, pattern: byId.get(m.patternId) });
|
|
144
|
+
}
|
|
139
145
|
}
|
|
140
|
-
// 2. Generic kind-based scan if there are no matches yet.
|
|
146
|
+
// 2. Generic kind-based scan if there are no matches yet (the same walker).
|
|
141
147
|
if (seen.size === 0) {
|
|
142
148
|
const dirToken = kindToDir(input.kind);
|
|
143
|
-
|
|
149
|
+
walkScaffoldCandidateFiles(input.cwd, (abs, rel) => {
|
|
144
150
|
if (rel.includes(`/${dirToken}/`) && /\.(tsx?|jsx?)$/.test(abs)) {
|
|
145
151
|
if (!seen.has(abs))
|
|
146
152
|
seen.set(abs, { absPath: abs });
|
|
@@ -166,37 +172,6 @@ function kindToDir(kind) {
|
|
|
166
172
|
return 'components';
|
|
167
173
|
}
|
|
168
174
|
}
|
|
169
|
-
function walk(root, onFile) {
|
|
170
|
-
const visit = (dir) => {
|
|
171
|
-
let entries;
|
|
172
|
-
try {
|
|
173
|
-
entries = readdirSync(dir);
|
|
174
|
-
}
|
|
175
|
-
catch {
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
for (const e of entries) {
|
|
179
|
-
if (e === 'node_modules' || e === '.git' || e === 'dist' || e === '.sharkcraft' || e === '__tests__')
|
|
180
|
-
continue;
|
|
181
|
-
const full = nodePath.join(dir, e);
|
|
182
|
-
let st;
|
|
183
|
-
try {
|
|
184
|
-
st = statSync(full);
|
|
185
|
-
}
|
|
186
|
-
catch {
|
|
187
|
-
continue;
|
|
188
|
-
}
|
|
189
|
-
if (st.isDirectory())
|
|
190
|
-
visit(full);
|
|
191
|
-
else if (st.isFile()) {
|
|
192
|
-
const rel = nodePath.relative(root, full).split(nodePath.sep).join('/');
|
|
193
|
-
onFile(full, rel);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
if (existsSync(root))
|
|
198
|
-
visit(root);
|
|
199
|
-
}
|
|
200
175
|
function globRe(g) {
|
|
201
176
|
let re = '^';
|
|
202
177
|
for (let i = 0; i < g.length; i += 1) {
|