@shrkcrft/cli 0.1.0-alpha.2
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/LICENSE +21 -0
- package/README.md +15 -0
- package/dist/asset-preview/apply-action-hint-stub.d.ts +28 -0
- package/dist/asset-preview/apply-action-hint-stub.d.ts.map +1 -0
- package/dist/asset-preview/apply-action-hint-stub.js +170 -0
- package/dist/asset-preview/apply-asset-preview.d.ts +31 -0
- package/dist/asset-preview/apply-asset-preview.d.ts.map +1 -0
- package/dist/asset-preview/apply-asset-preview.js +210 -0
- package/dist/asset-preview/apply-knowledge-stale-fix.d.ts +37 -0
- package/dist/asset-preview/apply-knowledge-stale-fix.d.ts.map +1 -0
- package/dist/asset-preview/apply-knowledge-stale-fix.js +344 -0
- package/dist/asset-preview/apply-missing-barrel.d.ts +15 -0
- package/dist/asset-preview/apply-missing-barrel.d.ts.map +1 -0
- package/dist/asset-preview/apply-missing-barrel.js +65 -0
- package/dist/asset-preview/apply-template-drift-fix.d.ts +21 -0
- package/dist/asset-preview/apply-template-drift-fix.d.ts.map +1 -0
- package/dist/asset-preview/apply-template-drift-fix.js +125 -0
- package/dist/asset-preview/apply-template-update.d.ts +43 -0
- package/dist/asset-preview/apply-template-update.d.ts.map +1 -0
- package/dist/asset-preview/apply-template-update.js +257 -0
- package/dist/asset-preview/entry-mutator.d.ts +106 -0
- package/dist/asset-preview/entry-mutator.d.ts.map +1 -0
- package/dist/asset-preview/entry-mutator.js +428 -0
- package/dist/authoring/authoring-kit.d.ts +36 -0
- package/dist/authoring/authoring-kit.d.ts.map +1 -0
- package/dist/authoring/authoring-kit.js +106 -0
- package/dist/command-registry.d.ts +158 -0
- package/dist/command-registry.d.ts.map +1 -0
- package/dist/command-registry.js +348 -0
- package/dist/commands/apply.command.d.ts +3 -0
- package/dist/commands/apply.command.d.ts.map +1 -0
- package/dist/commands/apply.command.js +879 -0
- package/dist/commands/architecture.command.d.ts +5 -0
- package/dist/commands/architecture.command.d.ts.map +1 -0
- package/dist/commands/architecture.command.js +141 -0
- package/dist/commands/ask.command.d.ts +3 -0
- package/dist/commands/ask.command.d.ts.map +1 -0
- package/dist/commands/ask.command.js +58 -0
- package/dist/commands/audit.command.d.ts +3 -0
- package/dist/commands/audit.command.d.ts.map +1 -0
- package/dist/commands/audit.command.js +141 -0
- package/dist/commands/biome.command.d.ts +7 -0
- package/dist/commands/biome.command.d.ts.map +1 -0
- package/dist/commands/biome.command.js +350 -0
- package/dist/commands/boundaries.command.d.ts +9 -0
- package/dist/commands/boundaries.command.d.ts.map +1 -0
- package/dist/commands/boundaries.command.js +314 -0
- package/dist/commands/brief.command.d.ts +3 -0
- package/dist/commands/brief.command.d.ts.map +1 -0
- package/dist/commands/brief.command.js +206 -0
- package/dist/commands/bundle.command.d.ts +3 -0
- package/dist/commands/bundle.command.d.ts.map +1 -0
- package/dist/commands/bundle.command.js +1183 -0
- package/dist/commands/changes.command.d.ts +3 -0
- package/dist/commands/changes.command.d.ts.map +1 -0
- package/dist/commands/changes.command.js +155 -0
- package/dist/commands/check.command.d.ts +3 -0
- package/dist/commands/check.command.d.ts.map +1 -0
- package/dist/commands/check.command.js +553 -0
- package/dist/commands/checks.command.d.ts +29 -0
- package/dist/commands/checks.command.d.ts.map +1 -0
- package/dist/commands/checks.command.js +521 -0
- package/dist/commands/ci.command.d.ts +3 -0
- package/dist/commands/ci.command.d.ts.map +1 -0
- package/dist/commands/ci.command.js +680 -0
- package/dist/commands/codemod.command.d.ts +3 -0
- package/dist/commands/codemod.command.d.ts.map +1 -0
- package/dist/commands/codemod.command.js +130 -0
- package/dist/commands/command-catalog.d.ts +265 -0
- package/dist/commands/command-catalog.d.ts.map +1 -0
- package/dist/commands/command-catalog.js +3242 -0
- package/dist/commands/commands.command.d.ts +92 -0
- package/dist/commands/commands.command.d.ts.map +1 -0
- package/dist/commands/commands.command.js +1208 -0
- package/dist/commands/constructs.command.d.ts +15 -0
- package/dist/commands/constructs.command.d.ts.map +1 -0
- package/dist/commands/constructs.command.js +669 -0
- package/dist/commands/context.command.d.ts +3 -0
- package/dist/commands/context.command.d.ts.map +1 -0
- package/dist/commands/context.command.js +120 -0
- package/dist/commands/contract-gate.command.d.ts +5 -0
- package/dist/commands/contract-gate.command.d.ts.map +1 -0
- package/dist/commands/contract-gate.command.js +208 -0
- package/dist/commands/contract-templates.command.d.ts +8 -0
- package/dist/commands/contract-templates.command.d.ts.map +1 -0
- package/dist/commands/contract-templates.command.js +151 -0
- package/dist/commands/contract.command.d.ts +3 -0
- package/dist/commands/contract.command.d.ts.map +1 -0
- package/dist/commands/contract.command.js +105 -0
- package/dist/commands/conventions.command.d.ts +8 -0
- package/dist/commands/conventions.command.d.ts.map +1 -0
- package/dist/commands/conventions.command.js +169 -0
- package/dist/commands/coverage.command.d.ts +3 -0
- package/dist/commands/coverage.command.d.ts.map +1 -0
- package/dist/commands/coverage.command.js +56 -0
- package/dist/commands/daily.commands.d.ts +5 -0
- package/dist/commands/daily.commands.d.ts.map +1 -0
- package/dist/commands/daily.commands.js +224 -0
- package/dist/commands/dashboard-export.command.d.ts +4 -0
- package/dist/commands/dashboard-export.command.d.ts.map +1 -0
- package/dist/commands/dashboard-export.command.js +86 -0
- package/dist/commands/dashboard.command.d.ts +3 -0
- package/dist/commands/dashboard.command.d.ts.map +1 -0
- package/dist/commands/dashboard.command.js +106 -0
- package/dist/commands/dev.command.d.ts +3 -0
- package/dist/commands/dev.command.d.ts.map +1 -0
- package/dist/commands/dev.command.js +1392 -0
- package/dist/commands/diagnostics.command.d.ts +5 -0
- package/dist/commands/diagnostics.command.d.ts.map +1 -0
- package/dist/commands/diagnostics.command.js +97 -0
- package/dist/commands/docs.command.d.ts +4 -0
- package/dist/commands/docs.command.d.ts.map +1 -0
- package/dist/commands/docs.command.js +34 -0
- package/dist/commands/doctor.command.d.ts +7 -0
- package/dist/commands/doctor.command.d.ts.map +1 -0
- package/dist/commands/doctor.command.js +681 -0
- package/dist/commands/drift.command.d.ts +3 -0
- package/dist/commands/drift.command.d.ts.map +1 -0
- package/dist/commands/drift.command.js +124 -0
- package/dist/commands/eslint.command.d.ts +7 -0
- package/dist/commands/eslint.command.d.ts.map +1 -0
- package/dist/commands/eslint.command.js +423 -0
- package/dist/commands/explore.command.d.ts +3 -0
- package/dist/commands/explore.command.d.ts.map +1 -0
- package/dist/commands/explore.command.js +65 -0
- package/dist/commands/export-bundle.command.d.ts +6 -0
- package/dist/commands/export-bundle.command.d.ts.map +1 -0
- package/dist/commands/export-bundle.command.js +96 -0
- package/dist/commands/export.command.d.ts +3 -0
- package/dist/commands/export.command.d.ts.map +1 -0
- package/dist/commands/export.command.js +83 -0
- package/dist/commands/feedback-dispatch.command.d.ts +12 -0
- package/dist/commands/feedback-dispatch.command.d.ts.map +1 -0
- package/dist/commands/feedback-dispatch.command.js +63 -0
- package/dist/commands/feedback.command.d.ts +11 -0
- package/dist/commands/feedback.command.d.ts.map +1 -0
- package/dist/commands/feedback.command.js +336 -0
- package/dist/commands/fix.command.d.ts +3 -0
- package/dist/commands/fix.command.d.ts.map +1 -0
- package/dist/commands/fix.command.js +776 -0
- package/dist/commands/gen.command.d.ts +3 -0
- package/dist/commands/gen.command.d.ts.map +1 -0
- package/dist/commands/gen.command.js +136 -0
- package/dist/commands/git.command.d.ts +6 -0
- package/dist/commands/git.command.d.ts.map +1 -0
- package/dist/commands/git.command.js +81 -0
- package/dist/commands/graph.command.d.ts +3 -0
- package/dist/commands/graph.command.d.ts.map +1 -0
- package/dist/commands/graph.command.js +287 -0
- package/dist/commands/grounding.command.d.ts +7 -0
- package/dist/commands/grounding.command.d.ts.map +1 -0
- package/dist/commands/grounding.command.js +54 -0
- package/dist/commands/help.command.d.ts +20 -0
- package/dist/commands/help.command.d.ts.map +1 -0
- package/dist/commands/help.command.js +127 -0
- package/dist/commands/helper.command.d.ts +6 -0
- package/dist/commands/helper.command.d.ts.map +1 -0
- package/dist/commands/helper.command.js +170 -0
- package/dist/commands/ide.command.d.ts +6 -0
- package/dist/commands/ide.command.d.ts.map +1 -0
- package/dist/commands/ide.command.js +340 -0
- package/dist/commands/impact.command.d.ts +3 -0
- package/dist/commands/impact.command.d.ts.map +1 -0
- package/dist/commands/impact.command.js +819 -0
- package/dist/commands/import.command.d.ts +3 -0
- package/dist/commands/import.command.d.ts.map +1 -0
- package/dist/commands/import.command.js +115 -0
- package/dist/commands/infer.command.d.ts +3 -0
- package/dist/commands/infer.command.d.ts.map +1 -0
- package/dist/commands/infer.command.js +227 -0
- package/dist/commands/ingest.command.d.ts +6 -0
- package/dist/commands/ingest.command.d.ts.map +1 -0
- package/dist/commands/ingest.command.js +532 -0
- package/dist/commands/init.command.d.ts +3 -0
- package/dist/commands/init.command.d.ts.map +1 -0
- package/dist/commands/init.command.js +301 -0
- package/dist/commands/inspect.command.d.ts +3 -0
- package/dist/commands/inspect.command.d.ts.map +1 -0
- package/dist/commands/inspect.command.js +122 -0
- package/dist/commands/knowledge-author.command.d.ts +22 -0
- package/dist/commands/knowledge-author.command.d.ts.map +1 -0
- package/dist/commands/knowledge-author.command.js +366 -0
- package/dist/commands/knowledge-propose.command.d.ts +3 -0
- package/dist/commands/knowledge-propose.command.d.ts.map +1 -0
- package/dist/commands/knowledge-propose.command.js +125 -0
- package/dist/commands/knowledge.command.d.ts +18 -0
- package/dist/commands/knowledge.command.d.ts.map +1 -0
- package/dist/commands/knowledge.command.js +538 -0
- package/dist/commands/languages.command.d.ts +3 -0
- package/dist/commands/languages.command.d.ts.map +1 -0
- package/dist/commands/languages.command.js +300 -0
- package/dist/commands/lint.command.d.ts +15 -0
- package/dist/commands/lint.command.d.ts.map +1 -0
- package/dist/commands/lint.command.js +194 -0
- package/dist/commands/mcp.command.d.ts +3 -0
- package/dist/commands/mcp.command.d.ts.map +1 -0
- package/dist/commands/mcp.command.js +74 -0
- package/dist/commands/memory.command.d.ts +11 -0
- package/dist/commands/memory.command.d.ts.map +1 -0
- package/dist/commands/memory.command.js +264 -0
- package/dist/commands/onboard.command.d.ts +3 -0
- package/dist/commands/onboard.command.d.ts.map +1 -0
- package/dist/commands/onboard.command.js +650 -0
- package/dist/commands/orchestrate.command.d.ts +3 -0
- package/dist/commands/orchestrate.command.d.ts.map +1 -0
- package/dist/commands/orchestrate.command.js +49 -0
- package/dist/commands/owners.command.d.ts +5 -0
- package/dist/commands/owners.command.d.ts.map +1 -0
- package/dist/commands/owners.command.js +113 -0
- package/dist/commands/ownership.command.d.ts +5 -0
- package/dist/commands/ownership.command.d.ts.map +1 -0
- package/dist/commands/ownership.command.js +117 -0
- package/dist/commands/pack-author.command.d.ts +30 -0
- package/dist/commands/pack-author.command.d.ts.map +1 -0
- package/dist/commands/pack-author.command.js +242 -0
- package/dist/commands/packs-new.d.ts +27 -0
- package/dist/commands/packs-new.d.ts.map +1 -0
- package/dist/commands/packs-new.js +805 -0
- package/dist/commands/packs.command.d.ts +15 -0
- package/dist/commands/packs.command.d.ts.map +1 -0
- package/dist/commands/packs.command.js +958 -0
- package/dist/commands/paths.command.d.ts +6 -0
- package/dist/commands/paths.command.d.ts.map +1 -0
- package/dist/commands/paths.command.js +97 -0
- package/dist/commands/pipelines.command.d.ts +9 -0
- package/dist/commands/pipelines.command.d.ts.map +1 -0
- package/dist/commands/pipelines.command.js +308 -0
- package/dist/commands/plan-check.command.d.ts +27 -0
- package/dist/commands/plan-check.command.d.ts.map +1 -0
- package/dist/commands/plan-check.command.js +150 -0
- package/dist/commands/plan-simulate.command.d.ts +3 -0
- package/dist/commands/plan-simulate.command.d.ts.map +1 -0
- package/dist/commands/plan-simulate.command.js +60 -0
- package/dist/commands/plan.command.d.ts +8 -0
- package/dist/commands/plan.command.d.ts.map +1 -0
- package/dist/commands/plan.command.js +139 -0
- package/dist/commands/playbooks.command.d.ts +10 -0
- package/dist/commands/playbooks.command.d.ts.map +1 -0
- package/dist/commands/playbooks.command.js +296 -0
- package/dist/commands/plugin.command.d.ts +11 -0
- package/dist/commands/plugin.command.d.ts.map +1 -0
- package/dist/commands/plugin.command.js +394 -0
- package/dist/commands/policy.command.d.ts +8 -0
- package/dist/commands/policy.command.d.ts.map +1 -0
- package/dist/commands/policy.command.js +451 -0
- package/dist/commands/pr.command.d.ts +3 -0
- package/dist/commands/pr.command.d.ts.map +1 -0
- package/dist/commands/pr.command.js +132 -0
- package/dist/commands/preflight.command.d.ts +3 -0
- package/dist/commands/preflight.command.d.ts.map +1 -0
- package/dist/commands/preflight.command.js +102 -0
- package/dist/commands/presets.command.d.ts +17 -0
- package/dist/commands/presets.command.d.ts.map +1 -0
- package/dist/commands/presets.command.js +647 -0
- package/dist/commands/profiles.command.d.ts +7 -0
- package/dist/commands/profiles.command.d.ts.map +1 -0
- package/dist/commands/profiles.command.js +151 -0
- package/dist/commands/provenance.command.d.ts +26 -0
- package/dist/commands/provenance.command.d.ts.map +1 -0
- package/dist/commands/provenance.command.js +237 -0
- package/dist/commands/quality.command.d.ts +5 -0
- package/dist/commands/quality.command.d.ts.map +1 -0
- package/dist/commands/quality.command.js +69 -0
- package/dist/commands/recommend.command.d.ts +4 -0
- package/dist/commands/recommend.command.d.ts.map +1 -0
- package/dist/commands/recommend.command.js +270 -0
- package/dist/commands/registrations.command.d.ts +3 -0
- package/dist/commands/registrations.command.d.ts.map +1 -0
- package/dist/commands/registrations.command.js +300 -0
- package/dist/commands/registry.command.d.ts +4 -0
- package/dist/commands/registry.command.d.ts.map +1 -0
- package/dist/commands/registry.command.js +37 -0
- package/dist/commands/release.command.d.ts +4 -0
- package/dist/commands/release.command.d.ts.map +1 -0
- package/dist/commands/release.command.js +639 -0
- package/dist/commands/repo.command.d.ts +3 -0
- package/dist/commands/repo.command.d.ts.map +1 -0
- package/dist/commands/repo.command.js +24 -0
- package/dist/commands/report.command.d.ts +3 -0
- package/dist/commands/report.command.d.ts.map +1 -0
- package/dist/commands/report.command.js +511 -0
- package/dist/commands/reposet.command.d.ts +6 -0
- package/dist/commands/reposet.command.d.ts.map +1 -0
- package/dist/commands/reposet.command.js +120 -0
- package/dist/commands/review.command.d.ts +3 -0
- package/dist/commands/review.command.d.ts.map +1 -0
- package/dist/commands/review.command.js +354 -0
- package/dist/commands/risk.command.d.ts +3 -0
- package/dist/commands/risk.command.d.ts.map +1 -0
- package/dist/commands/risk.command.js +56 -0
- package/dist/commands/rounds.command.d.ts +8 -0
- package/dist/commands/rounds.command.d.ts.map +1 -0
- package/dist/commands/rounds.command.js +180 -0
- package/dist/commands/rules.command.d.ts +49 -0
- package/dist/commands/rules.command.d.ts.map +1 -0
- package/dist/commands/rules.command.js +435 -0
- package/dist/commands/runtime.command.d.ts +3 -0
- package/dist/commands/runtime.command.d.ts.map +1 -0
- package/dist/commands/runtime.command.js +56 -0
- package/dist/commands/safety.command.d.ts +3 -0
- package/dist/commands/safety.command.d.ts.map +1 -0
- package/dist/commands/safety.command.js +117 -0
- package/dist/commands/scaffolds.command.d.ts +5 -0
- package/dist/commands/scaffolds.command.d.ts.map +1 -0
- package/dist/commands/scaffolds.command.js +122 -0
- package/dist/commands/schemas.command.d.ts +21 -0
- package/dist/commands/schemas.command.d.ts.map +1 -0
- package/dist/commands/schemas.command.js +296 -0
- package/dist/commands/search.command.d.ts +12 -0
- package/dist/commands/search.command.d.ts.map +1 -0
- package/dist/commands/search.command.js +275 -0
- package/dist/commands/self-config.command.d.ts +7 -0
- package/dist/commands/self-config.command.d.ts.map +1 -0
- package/dist/commands/self-config.command.js +156 -0
- package/dist/commands/self.command.d.ts +3 -0
- package/dist/commands/self.command.d.ts.map +1 -0
- package/dist/commands/self.command.js +117 -0
- package/dist/commands/simulate.command.d.ts +3 -0
- package/dist/commands/simulate.command.d.ts.map +1 -0
- package/dist/commands/simulate.command.js +54 -0
- package/dist/commands/spec.command.d.ts +29 -0
- package/dist/commands/spec.command.d.ts.map +1 -0
- package/dist/commands/spec.command.js +985 -0
- package/dist/commands/start-here.command.d.ts +3 -0
- package/dist/commands/start-here.command.d.ts.map +1 -0
- package/dist/commands/start-here.command.js +35 -0
- package/dist/commands/stats.command.d.ts +3 -0
- package/dist/commands/stats.command.d.ts.map +1 -0
- package/dist/commands/stats.command.js +88 -0
- package/dist/commands/surface.command.d.ts +15 -0
- package/dist/commands/surface.command.d.ts.map +1 -0
- package/dist/commands/surface.command.js +328 -0
- package/dist/commands/task-context.command.d.ts +7 -0
- package/dist/commands/task-context.command.d.ts.map +1 -0
- package/dist/commands/task-context.command.js +646 -0
- package/dist/commands/task.command.d.ts +3 -0
- package/dist/commands/task.command.d.ts.map +1 -0
- package/dist/commands/task.command.js +301 -0
- package/dist/commands/template-quality.command.d.ts +5 -0
- package/dist/commands/template-quality.command.d.ts.map +1 -0
- package/dist/commands/template-quality.command.js +128 -0
- package/dist/commands/templates.command.d.ts +26 -0
- package/dist/commands/templates.command.d.ts.map +1 -0
- package/dist/commands/templates.command.js +964 -0
- package/dist/commands/test.command.d.ts +3 -0
- package/dist/commands/test.command.d.ts.map +1 -0
- package/dist/commands/test.command.js +262 -0
- package/dist/commands/tests.command.d.ts +5 -0
- package/dist/commands/tests.command.d.ts.map +1 -0
- package/dist/commands/tests.command.js +97 -0
- package/dist/commands/trace.command.d.ts +3 -0
- package/dist/commands/trace.command.d.ts.map +1 -0
- package/dist/commands/trace.command.js +121 -0
- package/dist/commands/upgrade.command.d.ts +4 -0
- package/dist/commands/upgrade.command.d.ts.map +1 -0
- package/dist/commands/upgrade.command.js +43 -0
- package/dist/commands/version.command.d.ts +3 -0
- package/dist/commands/version.command.d.ts.map +1 -0
- package/dist/commands/version.command.js +10 -0
- package/dist/commands/why.command.d.ts +24 -0
- package/dist/commands/why.command.d.ts.map +1 -0
- package/dist/commands/why.command.js +119 -0
- package/dist/dashboard/dashboard-api-server.d.ts +21 -0
- package/dist/dashboard/dashboard-api-server.d.ts.map +1 -0
- package/dist/dashboard/dashboard-api-server.js +410 -0
- package/dist/dashboard/live-session-server.d.ts +18 -0
- package/dist/dashboard/live-session-server.d.ts.map +1 -0
- package/dist/dashboard/live-session-server.js +133 -0
- package/dist/diff/collect-changed-paths.d.ts +27 -0
- package/dist/diff/collect-changed-paths.d.ts.map +1 -0
- package/dist/diff/collect-changed-paths.js +68 -0
- package/dist/doctor/doctor-tags.d.ts +63 -0
- package/dist/doctor/doctor-tags.d.ts.map +1 -0
- package/dist/doctor/doctor-tags.js +146 -0
- package/dist/export/export-formats.d.ts +22 -0
- package/dist/export/export-formats.d.ts.map +1 -0
- package/dist/export/export-formats.js +135 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/init/detected-block.d.ts +57 -0
- package/dist/init/detected-block.d.ts.map +1 -0
- package/dist/init/detected-block.js +197 -0
- package/dist/init/gitignore.d.ts +30 -0
- package/dist/init/gitignore.d.ts.map +1 -0
- package/dist/init/gitignore.js +110 -0
- package/dist/init/init-templates.d.ts +6 -0
- package/dist/init/init-templates.d.ts.map +1 -0
- package/dist/init/init-templates.js +413 -0
- package/dist/main.d.ts +18 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +699 -0
- package/dist/output/failure-hints.d.ts +55 -0
- package/dist/output/failure-hints.d.ts.map +1 -0
- package/dist/output/failure-hints.js +159 -0
- package/dist/output/format-output.d.ts +9 -0
- package/dist/output/format-output.d.ts.map +1 -0
- package/dist/output/format-output.js +26 -0
- package/dist/output/print-error.d.ts +3 -0
- package/dist/output/print-error.d.ts.map +1 -0
- package/dist/output/print-error.js +14 -0
- package/dist/output/watch-loop.d.ts +37 -0
- package/dist/output/watch-loop.d.ts.map +1 -0
- package/dist/output/watch-loop.js +115 -0
- package/dist/schemas/json-schemas.d.ts +1630 -0
- package/dist/schemas/json-schemas.d.ts.map +1 -0
- package/dist/schemas/json-schemas.js +811 -0
- package/dist/surface/about.d.ts +10 -0
- package/dist/surface/about.d.ts.map +1 -0
- package/dist/surface/about.js +53 -0
- package/dist/surface/load-surface-context.d.ts +34 -0
- package/dist/surface/load-surface-context.d.ts.map +1 -0
- package/dist/surface/load-surface-context.js +100 -0
- package/dist/surface/no-args-landing.d.ts +7 -0
- package/dist/surface/no-args-landing.d.ts.map +1 -0
- package/dist/surface/no-args-landing.js +36 -0
- package/dist/surface/not-enabled-error.d.ts +24 -0
- package/dist/surface/not-enabled-error.d.ts.map +1 -0
- package/dist/surface/not-enabled-error.js +36 -0
- package/dist/surface/profiles.d.ts +37 -0
- package/dist/surface/profiles.d.ts.map +1 -0
- package/dist/surface/profiles.js +151 -0
- package/dist/surface/shape-defaults.d.ts +21 -0
- package/dist/surface/shape-defaults.d.ts.map +1 -0
- package/dist/surface/shape-defaults.js +50 -0
- package/dist/surface/spine-extractor.d.ts +38 -0
- package/dist/surface/spine-extractor.d.ts.map +1 -0
- package/dist/surface/spine-extractor.js +100 -0
- package/dist/surface/surface-config-writer.d.ts +59 -0
- package/dist/surface/surface-config-writer.d.ts.map +1 -0
- package/dist/surface/surface-config-writer.js +135 -0
- package/dist/surface/surface-summary.d.ts +66 -0
- package/dist/surface/surface-summary.d.ts.map +1 -0
- package/dist/surface/surface-summary.js +162 -0
- package/dist/surface/tier.d.ts +100 -0
- package/dist/surface/tier.d.ts.map +1 -0
- package/dist/surface/tier.js +172 -0
- package/dist/task-next/apply-batch-runner.d.ts +42 -0
- package/dist/task-next/apply-batch-runner.d.ts.map +1 -0
- package/dist/task-next/apply-batch-runner.js +192 -0
- package/dist/task-next/task-next-ranker.d.ts +75 -0
- package/dist/task-next/task-next-ranker.d.ts.map +1 -0
- package/dist/task-next/task-next-ranker.js +179 -0
- package/dist/usage/usage-log.d.ts +54 -0
- package/dist/usage/usage-log.d.ts.map +1 -0
- package/dist/usage/usage-log.js +105 -0
- package/dist/validation/run-validation-loop.d.ts +38 -0
- package/dist/validation/run-validation-loop.d.ts.map +1 -0
- package/dist/validation/run-validation-loop.js +100 -0
- package/package.json +73 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { CommandTier, } from "../commands/command-catalog.js";
|
|
2
|
+
/**
|
|
3
|
+
* Bootstrap commands. Always tier=Core regardless of any other
|
|
4
|
+
* derivation rule. Listed here (and only here) so the rule is mechanical:
|
|
5
|
+
* a fresh repo with NO `sharkcraft.config.ts` can always reach these.
|
|
6
|
+
*
|
|
7
|
+
* Tokens are catalog `command` strings (the same form as
|
|
8
|
+
* {@link ICommandCatalogEntry.command}). Multi-token entries (e.g.
|
|
9
|
+
* `pack author status`) are matched exactly.
|
|
10
|
+
*
|
|
11
|
+
* Brutally small set. Discovery verbs (`commands`, `start-here`) live
|
|
12
|
+
* in extended tier; users find them via `shrk surface list` or `shrk
|
|
13
|
+
* recommend`.
|
|
14
|
+
*/
|
|
15
|
+
export const BOOTSTRAP_COMMANDS = Object.freeze([
|
|
16
|
+
'init',
|
|
17
|
+
'doctor',
|
|
18
|
+
'recommend',
|
|
19
|
+
'surface',
|
|
20
|
+
'help',
|
|
21
|
+
'version',
|
|
22
|
+
// Meta verbs that must always work. `--about` is a top-level
|
|
23
|
+
// meta flag handled in main.ts; included here for documentation
|
|
24
|
+
// completeness so `surface list` surfaces it.
|
|
25
|
+
'--about',
|
|
26
|
+
]);
|
|
27
|
+
/**
|
|
28
|
+
* Source explanations for tier classification. Returned by the
|
|
29
|
+
* resolver so `shrk surface explain <name>` can describe why a
|
|
30
|
+
* command's tier is what it is.
|
|
31
|
+
*/
|
|
32
|
+
export var TierSource;
|
|
33
|
+
(function (TierSource) {
|
|
34
|
+
TierSource["Bootstrap"] = "bootstrap";
|
|
35
|
+
TierSource["Spine"] = "spine";
|
|
36
|
+
TierSource["PackContribution"] = "pack-contribution";
|
|
37
|
+
TierSource["Override"] = "override";
|
|
38
|
+
TierSource["Hidden"] = "hidden-flag";
|
|
39
|
+
TierSource["Default"] = "default";
|
|
40
|
+
})(TierSource || (TierSource = {}));
|
|
41
|
+
/**
|
|
42
|
+
* Mechanically derive a command's tier.
|
|
43
|
+
*
|
|
44
|
+
* Resolution order (HIGHEST wins, never demotes Core):
|
|
45
|
+
*
|
|
46
|
+
* 1. Bootstrap set → Core.
|
|
47
|
+
* 2. Spine pipeline reference → Core.
|
|
48
|
+
* 3. Pack contribution → Experimental (unless in surface.enabled).
|
|
49
|
+
* 4. Explicit catalog `tier` override → that value (cannot demote Core).
|
|
50
|
+
* 5. Catalog overlay `hidden` verdict → Experimental.
|
|
51
|
+
* 6. Otherwise → Extended.
|
|
52
|
+
*
|
|
53
|
+
* After derivation, the user's `surface.enabled` / `surface.hidden`
|
|
54
|
+
* config can flip a single dimension:
|
|
55
|
+
*
|
|
56
|
+
* - `surface.enabled` contains the command → promote Experimental
|
|
57
|
+
* to Extended (callable, visible in `surface list` only — `--help`
|
|
58
|
+
* visibility is governed by the catalog's own defaultShowInHelp).
|
|
59
|
+
* - `surface.hidden` contains the command AND tier is Extended →
|
|
60
|
+
* remains Extended-tier but hidden from `--help`. The visibility
|
|
61
|
+
* flip is read by the help renderer, not by the tier resolver
|
|
62
|
+
* directly.
|
|
63
|
+
*
|
|
64
|
+
* Core commands cannot be hidden or disabled. Attempts to do so are
|
|
65
|
+
* surfaced as warnings by `shrk doctor` and `shrk surface list --json`.
|
|
66
|
+
*/
|
|
67
|
+
export function resolveTier(entry, context) {
|
|
68
|
+
const name = entry.command;
|
|
69
|
+
// 1. Bootstrap set always wins.
|
|
70
|
+
if (BOOTSTRAP_COMMANDS.includes(name)) {
|
|
71
|
+
return {
|
|
72
|
+
tier: CommandTier.Core,
|
|
73
|
+
source: TierSource.Bootstrap,
|
|
74
|
+
detail: 'bootstrap command (always on)',
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
// 2. Spine pipeline reference — also Core.
|
|
78
|
+
if (context.spineCommands.has(name)) {
|
|
79
|
+
return {
|
|
80
|
+
tier: CommandTier.Core,
|
|
81
|
+
source: TierSource.Spine,
|
|
82
|
+
detail: 'referenced from a spine pipeline',
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
// 3. Pack contributions default to Experimental, unless explicitly enabled.
|
|
86
|
+
const pack = context.packContributions.get(name);
|
|
87
|
+
if (pack !== undefined) {
|
|
88
|
+
const enabled = (context.surfaceConfig?.enabled ?? []).includes(name);
|
|
89
|
+
return {
|
|
90
|
+
tier: enabled ? CommandTier.Extended : CommandTier.Experimental,
|
|
91
|
+
source: TierSource.PackContribution,
|
|
92
|
+
detail: enabled
|
|
93
|
+
? `pack-contributed (${pack}), enabled in surface.enabled`
|
|
94
|
+
: `pack-contributed (${pack})`,
|
|
95
|
+
configApplied: enabled,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
// 4. Explicit override on the catalog entry.
|
|
99
|
+
if (entry.tier !== undefined) {
|
|
100
|
+
// Cannot demote Core. The override applies for Extended/Experimental only.
|
|
101
|
+
if (entry.tier === CommandTier.Experimental) {
|
|
102
|
+
const enabled = (context.surfaceConfig?.enabled ?? []).includes(name);
|
|
103
|
+
return {
|
|
104
|
+
tier: enabled ? CommandTier.Extended : CommandTier.Experimental,
|
|
105
|
+
source: TierSource.Override,
|
|
106
|
+
detail: 'catalog override (tier=experimental)',
|
|
107
|
+
configApplied: enabled,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
tier: entry.tier,
|
|
112
|
+
source: TierSource.Override,
|
|
113
|
+
detail: `catalog override (tier=${entry.tier})`,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
// 5. Catalog overlay `hidden` verdict implies Experimental.
|
|
117
|
+
// We can't import the overlay here without a circular dep risk; the
|
|
118
|
+
// caller passes a precomputed view via context. For now, we rely on
|
|
119
|
+
// the catalog's surface=Internal/Legacy combined with showInDefaultHelp.
|
|
120
|
+
// If the entry is marked showInDefaultHelp: false explicitly, that's a
|
|
121
|
+
// weaker signal than the overlay but still pushes toward Experimental.
|
|
122
|
+
if (entry.showInDefaultHelp === false) {
|
|
123
|
+
const enabled = (context.surfaceConfig?.enabled ?? []).includes(name);
|
|
124
|
+
return {
|
|
125
|
+
tier: enabled ? CommandTier.Extended : CommandTier.Experimental,
|
|
126
|
+
source: TierSource.Hidden,
|
|
127
|
+
detail: 'showInDefaultHelp=false in catalog',
|
|
128
|
+
configApplied: enabled,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
// 6. Default — Extended.
|
|
132
|
+
return {
|
|
133
|
+
tier: CommandTier.Extended,
|
|
134
|
+
source: TierSource.Default,
|
|
135
|
+
detail: 'default for catalog entries not in spine and not pack-contributed',
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Is the command callable from the CLI / MCP in the current
|
|
140
|
+
* surface configuration?
|
|
141
|
+
*
|
|
142
|
+
* - Core: always callable.
|
|
143
|
+
* - Extended: always callable.
|
|
144
|
+
* - Experimental: callable only if in `surface.enabled`.
|
|
145
|
+
*
|
|
146
|
+
* The resolver's promotion of Experimental → Extended already accounts
|
|
147
|
+
* for `enabled[]`, so this is a simple tier check.
|
|
148
|
+
*/
|
|
149
|
+
export function isCallable(resolution) {
|
|
150
|
+
return (resolution.tier === CommandTier.Core ||
|
|
151
|
+
resolution.tier === CommandTier.Extended);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Should the command be visible in `--help` output?
|
|
155
|
+
*
|
|
156
|
+
* - Core: always visible.
|
|
157
|
+
* - Extended: visible unless in `surface.hidden` (the help renderer
|
|
158
|
+
* checks the config and consults `defaultShowInHelp(entry)`).
|
|
159
|
+
* - Experimental: never visible in `--help`; only in `surface list`.
|
|
160
|
+
*
|
|
161
|
+
* The caller still consults `defaultShowInHelp(entry)` for the
|
|
162
|
+
* underlying surface/lifecycle gating; this function answers "does
|
|
163
|
+
* the tier permit visibility at all?".
|
|
164
|
+
*/
|
|
165
|
+
export function isVisibleInDefaultHelp(resolution, hiddenByConfig) {
|
|
166
|
+
if (resolution.tier === CommandTier.Core)
|
|
167
|
+
return true;
|
|
168
|
+
if (resolution.tier === CommandTier.Experimental)
|
|
169
|
+
return false;
|
|
170
|
+
// Extended: respects hidden[].
|
|
171
|
+
return !hiddenByConfig;
|
|
172
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare const APPLY_BATCH_SCHEMA = "sharkcraft.apply-batch.v1";
|
|
2
|
+
export type BatchStepKind = 'action-hints' | 'knowledge-stale' | 'template-drift';
|
|
3
|
+
export interface IApplyBatchStep {
|
|
4
|
+
readonly kind: BatchStepKind;
|
|
5
|
+
readonly args?: Readonly<Record<string, string | number | boolean | readonly string[]>>;
|
|
6
|
+
}
|
|
7
|
+
export interface IApplyBatchPlan {
|
|
8
|
+
readonly schema: typeof APPLY_BATCH_SCHEMA;
|
|
9
|
+
readonly steps: readonly IApplyBatchStep[];
|
|
10
|
+
}
|
|
11
|
+
export interface IApplyBatchStepResult {
|
|
12
|
+
readonly kind: BatchStepKind;
|
|
13
|
+
readonly stepIndex: number;
|
|
14
|
+
readonly exitCode: number;
|
|
15
|
+
readonly outcome: 'applied' | 'refused' | 'no-op' | 'error';
|
|
16
|
+
readonly stdoutJson?: unknown;
|
|
17
|
+
readonly stderr?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface IApplyBatchReport {
|
|
20
|
+
readonly schema: 'sharkcraft.apply-batch-report/v1';
|
|
21
|
+
readonly batchId: string;
|
|
22
|
+
readonly allowDivergent: boolean;
|
|
23
|
+
readonly steps: readonly IApplyBatchStepResult[];
|
|
24
|
+
readonly stopped: boolean;
|
|
25
|
+
readonly success: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare class ApplyBatchPlanError extends Error {
|
|
28
|
+
constructor(message: string);
|
|
29
|
+
}
|
|
30
|
+
export declare function parseApplyBatchPlan(raw: string): IApplyBatchPlan;
|
|
31
|
+
export declare function computeBatchId(plan: IApplyBatchPlan): string;
|
|
32
|
+
export interface IRunApplyBatchOptions {
|
|
33
|
+
readonly plan: IApplyBatchPlan;
|
|
34
|
+
readonly allowDivergent: boolean;
|
|
35
|
+
readonly dryRun?: boolean;
|
|
36
|
+
/** Working directory for the spawned shrk processes. */
|
|
37
|
+
readonly cwd: string;
|
|
38
|
+
/** Absolute path to the `shrk` executable. */
|
|
39
|
+
readonly shrkBin: string;
|
|
40
|
+
}
|
|
41
|
+
export declare function runApplyBatch(options: IRunApplyBatchOptions): IApplyBatchReport;
|
|
42
|
+
//# sourceMappingURL=apply-batch-runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-batch-runner.d.ts","sourceRoot":"","sources":["../../src/task-next/apply-batch-runner.ts"],"names":[],"mappings":"AA6BA,eAAO,MAAM,kBAAkB,8BAA8B,CAAC;AAE9D,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG,iBAAiB,GAAG,gBAAgB,CAAC;AAElF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;CACzF;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,OAAO,kBAAkB,CAAC;IAC3C,QAAQ,CAAC,KAAK,EAAE,SAAS,eAAe,EAAE,CAAC;CAC5C;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;IAC5D,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,EAAE,kCAAkC,CAAC;IACpD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACjD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,OAAO,EAAE,MAAM;CAI5B;AAQD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAqDhE;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAI5D;AAuBD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,wDAAwD;IACxD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,8CAA8C;IAC9C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,qBAAqB,GAAG,iBAAiB,CAqE/E"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `shrk apply --batch <plan.json>` runner.
|
|
3
|
+
*
|
|
4
|
+
* Executes a multi-step fix-chain. Each step is a single `shrk` invocation
|
|
5
|
+
* with a stable kind keyword and forwarded args. The runner:
|
|
6
|
+
*
|
|
7
|
+
* 1. Parses the plan JSON, validates the schema and step kinds.
|
|
8
|
+
* 2. Computes a content-hash `batchId` for provenance grouping.
|
|
9
|
+
* 3. Runs each step in sequence with `--apply --json`.
|
|
10
|
+
* 4. Stops on the first refusal unless `--allow-divergent` is set.
|
|
11
|
+
* 5. Returns an aggregated structured report.
|
|
12
|
+
*
|
|
13
|
+
* Each underlying step is itself preview-first (it previews internally
|
|
14
|
+
* then writes), so a non-atomic batch matches the documented contract: a
|
|
15
|
+
* refusal in step N stops the batch but step N-1's writes are kept.
|
|
16
|
+
* With `--allow-divergent`, refused steps are skipped and survivors
|
|
17
|
+
* apply, identical to per-command semantics today.
|
|
18
|
+
*
|
|
19
|
+
* Supported step kinds:
|
|
20
|
+
* - `action-hints`
|
|
21
|
+
* - `knowledge-stale`
|
|
22
|
+
* - `template-drift`
|
|
23
|
+
*
|
|
24
|
+
* Each step's `args` is a free-form record forwarded to the underlying
|
|
25
|
+
* CLI. The runner translates them to `--key value` / `--flag` form.
|
|
26
|
+
*/
|
|
27
|
+
import { spawnSync } from 'node:child_process';
|
|
28
|
+
import { createHash } from 'node:crypto';
|
|
29
|
+
export const APPLY_BATCH_SCHEMA = 'sharkcraft.apply-batch.v1';
|
|
30
|
+
export class ApplyBatchPlanError extends Error {
|
|
31
|
+
constructor(message) {
|
|
32
|
+
super(message);
|
|
33
|
+
this.name = 'ApplyBatchPlanError';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const VALID_KINDS = new Set([
|
|
37
|
+
'action-hints',
|
|
38
|
+
'knowledge-stale',
|
|
39
|
+
'template-drift',
|
|
40
|
+
]);
|
|
41
|
+
export function parseApplyBatchPlan(raw) {
|
|
42
|
+
let json;
|
|
43
|
+
try {
|
|
44
|
+
json = JSON.parse(raw);
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
throw new ApplyBatchPlanError(`Plan is not valid JSON: ${e.message}`);
|
|
48
|
+
}
|
|
49
|
+
if (!json || typeof json !== 'object') {
|
|
50
|
+
throw new ApplyBatchPlanError('Plan must be a JSON object.');
|
|
51
|
+
}
|
|
52
|
+
const o = json;
|
|
53
|
+
if (o.schema !== APPLY_BATCH_SCHEMA) {
|
|
54
|
+
throw new ApplyBatchPlanError(`Plan schema must be "${APPLY_BATCH_SCHEMA}".`);
|
|
55
|
+
}
|
|
56
|
+
if (!Array.isArray(o.steps)) {
|
|
57
|
+
throw new ApplyBatchPlanError('Plan.steps must be an array.');
|
|
58
|
+
}
|
|
59
|
+
const steps = [];
|
|
60
|
+
for (let i = 0; i < o.steps.length; i++) {
|
|
61
|
+
const s = o.steps[i];
|
|
62
|
+
if (!s || typeof s !== 'object') {
|
|
63
|
+
throw new ApplyBatchPlanError(`step[${i}] must be an object.`);
|
|
64
|
+
}
|
|
65
|
+
const kind = s.kind;
|
|
66
|
+
if (typeof kind !== 'string' || !VALID_KINDS.has(kind)) {
|
|
67
|
+
throw new ApplyBatchPlanError(`step[${i}].kind must be one of: ${[...VALID_KINDS].join(', ')}. Got ${JSON.stringify(kind)}.`);
|
|
68
|
+
}
|
|
69
|
+
const argsRaw = s.args;
|
|
70
|
+
if (argsRaw !== undefined && (typeof argsRaw !== 'object' || argsRaw === null || Array.isArray(argsRaw))) {
|
|
71
|
+
throw new ApplyBatchPlanError(`step[${i}].args must be a flat record if present.`);
|
|
72
|
+
}
|
|
73
|
+
const args = {};
|
|
74
|
+
if (argsRaw) {
|
|
75
|
+
for (const [k, v] of Object.entries(argsRaw)) {
|
|
76
|
+
if (typeof v === 'string' ||
|
|
77
|
+
typeof v === 'number' ||
|
|
78
|
+
typeof v === 'boolean' ||
|
|
79
|
+
(Array.isArray(v) && v.every((x) => typeof x === 'string'))) {
|
|
80
|
+
args[k] = v;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
throw new ApplyBatchPlanError(`step[${i}].args.${k} must be string|number|boolean|string[]. Got ${JSON.stringify(v)}.`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
steps.push({ kind: kind, ...(Object.keys(args).length > 0 ? { args } : {}) });
|
|
88
|
+
}
|
|
89
|
+
return { schema: APPLY_BATCH_SCHEMA, steps };
|
|
90
|
+
}
|
|
91
|
+
export function computeBatchId(plan) {
|
|
92
|
+
const h = createHash('sha256');
|
|
93
|
+
h.update(JSON.stringify(plan));
|
|
94
|
+
return 'batch_' + h.digest('hex').slice(0, 12);
|
|
95
|
+
}
|
|
96
|
+
function buildCliArgs(step) {
|
|
97
|
+
// All batch steps target `shrk fix --<kind> --apply --json`.
|
|
98
|
+
const out = ['fix', `--${step.kind}`, '--apply', '--json'];
|
|
99
|
+
if (step.args) {
|
|
100
|
+
for (const [k, v] of Object.entries(step.args)) {
|
|
101
|
+
if (typeof v === 'boolean') {
|
|
102
|
+
if (v)
|
|
103
|
+
out.push(`--${k}`);
|
|
104
|
+
}
|
|
105
|
+
else if (Array.isArray(v)) {
|
|
106
|
+
for (const item of v) {
|
|
107
|
+
out.push(`--${k}`);
|
|
108
|
+
out.push(item);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
out.push(`--${k}`);
|
|
113
|
+
out.push(String(v));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return out;
|
|
118
|
+
}
|
|
119
|
+
export function runApplyBatch(options) {
|
|
120
|
+
const { plan, allowDivergent, cwd, shrkBin, dryRun } = options;
|
|
121
|
+
const batchId = computeBatchId(plan);
|
|
122
|
+
const results = [];
|
|
123
|
+
let stopped = false;
|
|
124
|
+
let success = true;
|
|
125
|
+
for (let i = 0; i < plan.steps.length; i++) {
|
|
126
|
+
const step = plan.steps[i];
|
|
127
|
+
const cliArgs = buildCliArgs(step);
|
|
128
|
+
if (dryRun) {
|
|
129
|
+
results.push({
|
|
130
|
+
kind: step.kind,
|
|
131
|
+
stepIndex: i,
|
|
132
|
+
exitCode: 0,
|
|
133
|
+
outcome: 'no-op',
|
|
134
|
+
stdoutJson: { dryRun: true, command: `${shrkBin} ${cliArgs.join(' ')}` },
|
|
135
|
+
});
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
const proc = spawnSync(shrkBin, cliArgs, {
|
|
139
|
+
cwd,
|
|
140
|
+
encoding: 'utf8',
|
|
141
|
+
env: { ...process.env, SHARKCRAFT_BATCH_ID: batchId, SHARKCRAFT_BATCH_STEP: String(i) },
|
|
142
|
+
});
|
|
143
|
+
const exitCode = typeof proc.status === 'number' ? proc.status : 1;
|
|
144
|
+
let parsed = undefined;
|
|
145
|
+
try {
|
|
146
|
+
parsed = JSON.parse(proc.stdout ?? '{}');
|
|
147
|
+
}
|
|
148
|
+
catch {
|
|
149
|
+
// leave undefined
|
|
150
|
+
}
|
|
151
|
+
let outcome = 'applied';
|
|
152
|
+
if (exitCode !== 0) {
|
|
153
|
+
outcome = 'refused';
|
|
154
|
+
}
|
|
155
|
+
else if (parsed && typeof parsed === 'object') {
|
|
156
|
+
const m = parsed.mode;
|
|
157
|
+
if (m === 'refused')
|
|
158
|
+
outcome = 'refused';
|
|
159
|
+
else if (m === 'applied')
|
|
160
|
+
outcome = 'applied';
|
|
161
|
+
else
|
|
162
|
+
outcome = 'no-op';
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
outcome = 'no-op';
|
|
166
|
+
}
|
|
167
|
+
results.push({
|
|
168
|
+
kind: step.kind,
|
|
169
|
+
stepIndex: i,
|
|
170
|
+
exitCode,
|
|
171
|
+
outcome,
|
|
172
|
+
...(parsed !== undefined ? { stdoutJson: parsed } : {}),
|
|
173
|
+
...(proc.stderr ? { stderr: proc.stderr } : {}),
|
|
174
|
+
});
|
|
175
|
+
if (outcome === 'refused' && !allowDivergent) {
|
|
176
|
+
stopped = true;
|
|
177
|
+
success = false;
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
if (outcome === 'refused') {
|
|
181
|
+
success = false;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return {
|
|
185
|
+
schema: 'sharkcraft.apply-batch-report/v1',
|
|
186
|
+
batchId,
|
|
187
|
+
allowDivergent,
|
|
188
|
+
steps: results,
|
|
189
|
+
stopped,
|
|
190
|
+
success,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `shrk task --next` ranker.
|
|
3
|
+
*
|
|
4
|
+
* Surveys the workspace, partitions findings by mechanical safety, and
|
|
5
|
+
* proposes the single highest-leverage next action. Pure ranker over
|
|
6
|
+
* existing JSON outputs — no new asset kinds, no AI, no domain logic
|
|
7
|
+
* besides priority order.
|
|
8
|
+
*
|
|
9
|
+
* Ranking rules (deterministic, documented in dev-workflow.md):
|
|
10
|
+
* 1. Doctor blockers (errors that fail-close release).
|
|
11
|
+
* 2. Stale knowledge with `replaceWith` (mechanically safe --apply).
|
|
12
|
+
* 3. Template drift `missing-barrel` (mechanically safe --apply).
|
|
13
|
+
* 4. Action-hint stubs (mechanically safe --apply).
|
|
14
|
+
* 5. Stale knowledge without `replaceWith` (needs --drop-stale).
|
|
15
|
+
* 6. Template drift `forbidden-legacy-path` (needs human review).
|
|
16
|
+
* 7. Everything else (preview-only).
|
|
17
|
+
*/
|
|
18
|
+
import type { IDoctorResult, IKnowledgeStaleReport, ITemplateDriftReport } from '@shrkcrft/inspector';
|
|
19
|
+
export declare const TASK_NEXT_SCHEMA = "sharkcraft.task-next/v1";
|
|
20
|
+
export type NextActionKind = 'fix' | 'apply' | 'investigate';
|
|
21
|
+
export interface INextAction {
|
|
22
|
+
readonly kind: NextActionKind;
|
|
23
|
+
readonly command: string;
|
|
24
|
+
readonly reason: string;
|
|
25
|
+
/** How many blockers / findings this action resolves. */
|
|
26
|
+
readonly resolves: number;
|
|
27
|
+
/** True iff the action's --apply path is mechanically safe (no human review). */
|
|
28
|
+
readonly autoApplyEligible: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface ITaskNextReport {
|
|
31
|
+
readonly schema: typeof TASK_NEXT_SCHEMA;
|
|
32
|
+
readonly generatedAt: string;
|
|
33
|
+
readonly nextAction: INextAction | null;
|
|
34
|
+
/** Up to 3 follow-on actions in descending priority order. */
|
|
35
|
+
readonly secondary: readonly {
|
|
36
|
+
command: string;
|
|
37
|
+
reason: string;
|
|
38
|
+
}[];
|
|
39
|
+
/** Quick totals so the agent can sanity-check the ranker. */
|
|
40
|
+
readonly totals: {
|
|
41
|
+
readonly doctorBlockers: number;
|
|
42
|
+
readonly staleWithReplaceWith: number;
|
|
43
|
+
readonly staleWithoutReplaceWith: number;
|
|
44
|
+
readonly templateDriftMissingBarrel: number;
|
|
45
|
+
readonly templateDriftForbiddenLegacyPath: number;
|
|
46
|
+
readonly templateDriftOther: number;
|
|
47
|
+
readonly knowledgeActionHintGaps: number;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export interface ITaskNextInputs {
|
|
51
|
+
readonly doctor: IDoctorResult;
|
|
52
|
+
readonly stale: IKnowledgeStaleReport;
|
|
53
|
+
readonly drift: ITemplateDriftReport;
|
|
54
|
+
/**
|
|
55
|
+
* Knowledge lint summary — used for the action-hint stubs leg. The
|
|
56
|
+
* shape mirrors the `shrk lint --kind knowledge` JSON.
|
|
57
|
+
*/
|
|
58
|
+
readonly knowledgeLint?: {
|
|
59
|
+
readonly categories?: Readonly<Record<string, number>>;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Spec status summary. The ranker picks the highest-leverage
|
|
63
|
+
* unverified spec as a next action when no doctor blockers exist.
|
|
64
|
+
* Pass-through `null` (or omit) when the workspace has no specs.
|
|
65
|
+
*/
|
|
66
|
+
readonly specs?: {
|
|
67
|
+
readonly implementingUnverified?: readonly {
|
|
68
|
+
id: string;
|
|
69
|
+
title: string;
|
|
70
|
+
}[];
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/** Pure ranking over the structured inputs. */
|
|
74
|
+
export declare function buildTaskNextReport(inputs: ITaskNextInputs): ITaskNextReport;
|
|
75
|
+
//# sourceMappingURL=task-next-ranker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-next-ranker.d.ts","sourceRoot":"","sources":["../../src/task-next/task-next-ranker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EACV,aAAa,EACb,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAE7B,eAAO,MAAM,gBAAgB,4BAA4B,CAAC;AAE1D,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,OAAO,GAAG,aAAa,CAAC;AAE7D,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,yDAAyD;IACzD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,iFAAiF;IACjF,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;CACrC;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,OAAO,gBAAgB,CAAC;IACzC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,WAAW,GAAG,IAAI,CAAC;IACxC,8DAA8D;IAC9D,QAAQ,CAAC,SAAS,EAAE,SAAS;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACnE,6DAA6D;IAC7D,QAAQ,CAAC,MAAM,EAAE;QACf,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;QAChC,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;QACtC,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;QACzC,QAAQ,CAAC,0BAA0B,EAAE,MAAM,CAAC;QAC5C,QAAQ,CAAC,gCAAgC,EAAE,MAAM,CAAC;QAClD,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;QACpC,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;KAC1C,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,qBAAqB,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,oBAAoB,CAAC;IACrC;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE;QACvB,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;KACxD,CAAC;IACF;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE;QACf,QAAQ,CAAC,sBAAsB,CAAC,EAAE,SAAS;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;KAC5E,CAAC;CACH;AAWD,+CAA+C;AAC/C,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,eAAe,GAAG,eAAe,CAkL5E"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
export const TASK_NEXT_SCHEMA = 'sharkcraft.task-next/v1';
|
|
2
|
+
const BLOCKER_CATEGORIES = new Set([
|
|
3
|
+
'config-invalid',
|
|
4
|
+
'pack-signature-invalid',
|
|
5
|
+
'plan-signature-divergent',
|
|
6
|
+
'asset-load-failed',
|
|
7
|
+
'config',
|
|
8
|
+
'pack-doctor',
|
|
9
|
+
]);
|
|
10
|
+
/** Pure ranking over the structured inputs. */
|
|
11
|
+
export function buildTaskNextReport(inputs) {
|
|
12
|
+
const { doctor, stale, drift, knowledgeLint, specs } = inputs;
|
|
13
|
+
// 1. Doctor blockers — errors + warning-categories that gate release.
|
|
14
|
+
// Mirrors `shrk doctor --blockers` semantics.
|
|
15
|
+
const doctorBlockers = doctor.checks.filter((c) => c.severity === 'error' ||
|
|
16
|
+
(c.severity === 'warning' && c.category !== undefined && BLOCKER_CATEGORIES.has(c.category))).length;
|
|
17
|
+
// 2. Stale knowledge with replaceWith.
|
|
18
|
+
const staleChecks = stale.referenceChecks.filter((c) => c.outcome === 'stale' || c.outcome === 'missing');
|
|
19
|
+
const staleWithReplaceWith = staleChecks.filter((c) => c.replaceWith).length;
|
|
20
|
+
const staleWithoutReplaceWith = staleChecks.length - staleWithReplaceWith;
|
|
21
|
+
// 3 & 6. Template drift split by code.
|
|
22
|
+
let templateDriftMissingBarrel = 0;
|
|
23
|
+
let templateDriftForbiddenLegacyPath = 0;
|
|
24
|
+
let templateDriftOther = 0;
|
|
25
|
+
for (const e of drift.entries) {
|
|
26
|
+
for (const i of e.issues) {
|
|
27
|
+
if (i.severity !== 'error' && i.severity !== 'warning')
|
|
28
|
+
continue;
|
|
29
|
+
if (i.code === 'missing-barrel')
|
|
30
|
+
templateDriftMissingBarrel += 1;
|
|
31
|
+
else if (i.code === 'forbidden-legacy-path')
|
|
32
|
+
templateDriftForbiddenLegacyPath += 1;
|
|
33
|
+
else
|
|
34
|
+
templateDriftOther += 1;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// 4. Action-hint stubs from the knowledge lint.
|
|
38
|
+
const cats = knowledgeLint?.categories ?? {};
|
|
39
|
+
const knowledgeActionHintGaps = (cats['missing-action-hints'] ?? 0) + (cats['safe-mechanical-stub'] ?? 0);
|
|
40
|
+
const totals = {
|
|
41
|
+
doctorBlockers,
|
|
42
|
+
staleWithReplaceWith,
|
|
43
|
+
staleWithoutReplaceWith,
|
|
44
|
+
templateDriftMissingBarrel,
|
|
45
|
+
templateDriftForbiddenLegacyPath,
|
|
46
|
+
templateDriftOther,
|
|
47
|
+
knowledgeActionHintGaps,
|
|
48
|
+
};
|
|
49
|
+
const secondary = [];
|
|
50
|
+
let nextAction = null;
|
|
51
|
+
// Priority 1 — doctor blockers.
|
|
52
|
+
if (doctorBlockers > 0) {
|
|
53
|
+
nextAction = {
|
|
54
|
+
kind: 'fix',
|
|
55
|
+
command: 'shrk doctor --blockers',
|
|
56
|
+
reason: `${doctorBlockers} blocker(s) — release is gated until these clear.`,
|
|
57
|
+
resolves: doctorBlockers,
|
|
58
|
+
autoApplyEligible: false,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
// Priority 1.5: specs in `implementing` status that have NOT
|
|
62
|
+
// passed `spec verify`. Surfaced after doctor blockers but before
|
|
63
|
+
// stale-knowledge fixes — closing the spec loop is the highest-
|
|
64
|
+
// leverage next step once blockers are clear.
|
|
65
|
+
const implementingUnverified = specs?.implementingUnverified ?? [];
|
|
66
|
+
if (!nextAction && implementingUnverified.length > 0) {
|
|
67
|
+
const target = implementingUnverified[0];
|
|
68
|
+
nextAction = {
|
|
69
|
+
kind: 'investigate',
|
|
70
|
+
command: `shrk spec verify ${target.id}`,
|
|
71
|
+
reason: `Spec "${target.id}" is implementing but has no passing verification yet — close the loop.`,
|
|
72
|
+
resolves: implementingUnverified.length,
|
|
73
|
+
autoApplyEligible: false,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
else if (implementingUnverified.length > 0) {
|
|
77
|
+
secondary.push({
|
|
78
|
+
command: `shrk spec verify ${implementingUnverified[0].id}`,
|
|
79
|
+
reason: `${implementingUnverified.length} spec(s) implementing without verification.`,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
// Priority 2 — stale knowledge with replaceWith.
|
|
83
|
+
if (!nextAction && staleWithReplaceWith > 0) {
|
|
84
|
+
nextAction = {
|
|
85
|
+
kind: 'apply',
|
|
86
|
+
command: 'shrk fix --knowledge-stale --apply',
|
|
87
|
+
reason: `${staleWithReplaceWith} stale reference(s) have a replaceWith signal — apply renames in place.`,
|
|
88
|
+
resolves: staleWithReplaceWith,
|
|
89
|
+
autoApplyEligible: true,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
else if (staleWithReplaceWith > 0) {
|
|
93
|
+
secondary.push({
|
|
94
|
+
command: 'shrk fix --knowledge-stale --apply',
|
|
95
|
+
reason: `${staleWithReplaceWith} stale reference(s) with replaceWith.`,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
// Priority 3 — template drift missing-barrel.
|
|
99
|
+
if (!nextAction && templateDriftMissingBarrel > 0) {
|
|
100
|
+
nextAction = {
|
|
101
|
+
kind: 'apply',
|
|
102
|
+
command: 'shrk fix --template-drift --apply',
|
|
103
|
+
reason: `${templateDriftMissingBarrel} missing-barrel finding(s) — creates the file with a placeholder body.`,
|
|
104
|
+
resolves: templateDriftMissingBarrel,
|
|
105
|
+
autoApplyEligible: true,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
else if (templateDriftMissingBarrel > 0) {
|
|
109
|
+
secondary.push({
|
|
110
|
+
command: 'shrk fix --template-drift --apply',
|
|
111
|
+
reason: `${templateDriftMissingBarrel} missing-barrel finding(s).`,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
// Priority 4 — action-hint stubs.
|
|
115
|
+
if (!nextAction && knowledgeActionHintGaps > 0) {
|
|
116
|
+
nextAction = {
|
|
117
|
+
kind: 'apply',
|
|
118
|
+
command: 'shrk fix --action-hints --apply',
|
|
119
|
+
reason: `${knowledgeActionHintGaps} knowledge entr(y/ies) missing action hints — stubs are mechanically safe.`,
|
|
120
|
+
resolves: knowledgeActionHintGaps,
|
|
121
|
+
autoApplyEligible: true,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
else if (knowledgeActionHintGaps > 0) {
|
|
125
|
+
secondary.push({
|
|
126
|
+
command: 'shrk fix --action-hints --apply',
|
|
127
|
+
reason: `${knowledgeActionHintGaps} action-hint stub(s).`,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
// Priority 5 — stale knowledge without replaceWith.
|
|
131
|
+
if (!nextAction && staleWithoutReplaceWith > 0) {
|
|
132
|
+
nextAction = {
|
|
133
|
+
kind: 'investigate',
|
|
134
|
+
command: 'shrk knowledge stale-check --ci',
|
|
135
|
+
reason: `${staleWithoutReplaceWith} stale reference(s) without an unambiguous rename — review then re-run with --drop-stale.`,
|
|
136
|
+
resolves: staleWithoutReplaceWith,
|
|
137
|
+
autoApplyEligible: false,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
else if (staleWithoutReplaceWith > 0) {
|
|
141
|
+
secondary.push({
|
|
142
|
+
command: 'shrk knowledge stale-check --ci',
|
|
143
|
+
reason: `${staleWithoutReplaceWith} stale reference(s) need human review.`,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
// Priority 6 — template drift forbidden-legacy-path.
|
|
147
|
+
if (!nextAction && templateDriftForbiddenLegacyPath > 0) {
|
|
148
|
+
nextAction = {
|
|
149
|
+
kind: 'investigate',
|
|
150
|
+
command: 'shrk templates drift --min-severity warning',
|
|
151
|
+
reason: `${templateDriftForbiddenLegacyPath} forbidden-legacy-path finding(s) — needs human decision on convention.`,
|
|
152
|
+
resolves: templateDriftForbiddenLegacyPath,
|
|
153
|
+
autoApplyEligible: false,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
else if (templateDriftForbiddenLegacyPath > 0) {
|
|
157
|
+
secondary.push({
|
|
158
|
+
command: 'shrk templates drift --min-severity warning',
|
|
159
|
+
reason: `${templateDriftForbiddenLegacyPath} forbidden-legacy-path finding(s).`,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
// Priority 7 — everything else.
|
|
163
|
+
if (!nextAction && templateDriftOther > 0) {
|
|
164
|
+
nextAction = {
|
|
165
|
+
kind: 'investigate',
|
|
166
|
+
command: 'shrk templates drift --min-severity warning',
|
|
167
|
+
reason: `${templateDriftOther} other template-drift finding(s) — preview-only.`,
|
|
168
|
+
resolves: templateDriftOther,
|
|
169
|
+
autoApplyEligible: false,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
return {
|
|
173
|
+
schema: TASK_NEXT_SCHEMA,
|
|
174
|
+
generatedAt: new Date().toISOString(),
|
|
175
|
+
nextAction,
|
|
176
|
+
secondary: secondary.slice(0, 3),
|
|
177
|
+
totals,
|
|
178
|
+
};
|
|
179
|
+
}
|