@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 @@
|
|
|
1
|
+
{"version":3,"file":"gen.command.d.ts","sourceRoot":"","sources":["../../src/commands/gen.command.ts"],"names":[],"mappings":"AASA,OAAO,EAKL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AAkBhC,eAAO,MAAM,UAAU,EAAE,eAmJxB,CAAC"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { inspectSharkcraft } from '@shrkcrft/inspector';
|
|
2
|
+
import { buildSavedPlan, FileChangeType, generate, OverwriteStrategy, savePlanToFile, signPlan, } from '@shrkcrft/generator';
|
|
3
|
+
import { flagBool, flagString, flagVars, resolveCwd, } from "../command-registry.js";
|
|
4
|
+
import { asJson, header } from "../output/format-output.js";
|
|
5
|
+
import { printError } from "../output/print-error.js";
|
|
6
|
+
const CHANGE_LABEL = {
|
|
7
|
+
[FileChangeType.Create]: 'CREATE',
|
|
8
|
+
[FileChangeType.Update]: 'UPDATE',
|
|
9
|
+
[FileChangeType.Skip]: 'SKIP ',
|
|
10
|
+
[FileChangeType.Conflict]: 'CONFL ',
|
|
11
|
+
[FileChangeType.Append]: 'APPEND',
|
|
12
|
+
[FileChangeType.InsertAfter]: 'INSAFT',
|
|
13
|
+
[FileChangeType.InsertBefore]: 'INSBEF',
|
|
14
|
+
[FileChangeType.Replace]: 'REPL ',
|
|
15
|
+
[FileChangeType.Export]: 'EXPORT',
|
|
16
|
+
[FileChangeType.RenameFolder]: 'RMFLDR',
|
|
17
|
+
[FileChangeType.DeleteFolder]: 'DELFLD',
|
|
18
|
+
};
|
|
19
|
+
export const genCommand = {
|
|
20
|
+
name: 'gen',
|
|
21
|
+
description: 'Generate code from a template. Defaults to dry-run.',
|
|
22
|
+
usage: 'shrk gen <templateId> [<name>] [--var key=value ...] [--dry-run] [--write] [--force] [--save-plan <file>] [--json]',
|
|
23
|
+
async run(args) {
|
|
24
|
+
const templateId = args.positional[0];
|
|
25
|
+
const name = args.positional[1];
|
|
26
|
+
if (!templateId) {
|
|
27
|
+
process.stderr.write('Usage: shrk gen <templateId> [<name>] [--var key=value ...] [--dry-run] [--write] [--save-plan <file>]\n');
|
|
28
|
+
return 2;
|
|
29
|
+
}
|
|
30
|
+
const inspection = await inspectSharkcraft({ cwd: resolveCwd(args) });
|
|
31
|
+
const template = inspection.templateRegistry.get(templateId);
|
|
32
|
+
if (!template) {
|
|
33
|
+
process.stderr.write(`No template with id "${templateId}".\n`);
|
|
34
|
+
return 1;
|
|
35
|
+
}
|
|
36
|
+
const write = flagBool(args, 'write');
|
|
37
|
+
const force = flagBool(args, 'force');
|
|
38
|
+
const overwrite = force
|
|
39
|
+
? OverwriteStrategy.Overwrite
|
|
40
|
+
: flagString(args, 'overwrite') ?? OverwriteStrategy.Never;
|
|
41
|
+
const variables = flagVars(args);
|
|
42
|
+
const savePlanPath = flagString(args, 'save-plan');
|
|
43
|
+
const result = generate(template, {
|
|
44
|
+
templateId: template.id,
|
|
45
|
+
name,
|
|
46
|
+
variables,
|
|
47
|
+
projectRoot: inspection.projectRoot,
|
|
48
|
+
overwriteStrategy: overwrite,
|
|
49
|
+
write,
|
|
50
|
+
});
|
|
51
|
+
if (!result.ok) {
|
|
52
|
+
printError(result.error);
|
|
53
|
+
return 1;
|
|
54
|
+
}
|
|
55
|
+
const { plan, summary, written } = result.value;
|
|
56
|
+
// --save-plan is allowed regardless of write/dry-run, but we refuse to
|
|
57
|
+
// save plans that have conflicts (since `shrk apply` would refuse them too).
|
|
58
|
+
if (savePlanPath) {
|
|
59
|
+
if (plan.hasConflicts) {
|
|
60
|
+
process.stderr.write('Refusing to save a plan with conflicts. Resolve conflicts first.\n');
|
|
61
|
+
return 1;
|
|
62
|
+
}
|
|
63
|
+
let saved = buildSavedPlan({
|
|
64
|
+
templateId: template.id,
|
|
65
|
+
name: name ?? undefined,
|
|
66
|
+
variables,
|
|
67
|
+
projectRoot: inspection.projectRoot,
|
|
68
|
+
plan,
|
|
69
|
+
});
|
|
70
|
+
if (flagBool(args, 'sign')) {
|
|
71
|
+
const signed = signPlan(saved);
|
|
72
|
+
if (!signed.ok) {
|
|
73
|
+
printError(signed.error);
|
|
74
|
+
return 1;
|
|
75
|
+
}
|
|
76
|
+
saved = signed.value;
|
|
77
|
+
}
|
|
78
|
+
const saveResult = savePlanToFile(saved, savePlanPath);
|
|
79
|
+
if (!saveResult.ok) {
|
|
80
|
+
printError(saveResult.error);
|
|
81
|
+
return 1;
|
|
82
|
+
}
|
|
83
|
+
const signedSuffix = saved.signature ? ' [signed]' : '';
|
|
84
|
+
process.stdout.write(`Saved plan${signedSuffix} → ${savePlanPath}\n`);
|
|
85
|
+
}
|
|
86
|
+
if (flagBool(args, 'json')) {
|
|
87
|
+
process.stdout.write(asJson({
|
|
88
|
+
plan,
|
|
89
|
+
summary,
|
|
90
|
+
written: written.map((w) => w.relativePath),
|
|
91
|
+
savedPlanPath: savePlanPath ?? null,
|
|
92
|
+
}) + '\n');
|
|
93
|
+
return plan.hasConflicts ? 1 : 0;
|
|
94
|
+
}
|
|
95
|
+
process.stdout.write(header(write ? `Generation: ${template.id}` : `Dry-run: ${template.id}`));
|
|
96
|
+
if (plan.warnings.length) {
|
|
97
|
+
process.stdout.write('Warnings:\n');
|
|
98
|
+
for (const w of plan.warnings)
|
|
99
|
+
process.stdout.write(` - ${w}\n`);
|
|
100
|
+
// Best-effort hint when warnings look like missing required variables.
|
|
101
|
+
const missingVarNames = plan.warnings
|
|
102
|
+
.map((w) => w.match(/^(\w+):\s+Variable\s+'\w+'\s+is required/)?.[1])
|
|
103
|
+
.filter((v) => typeof v === 'string');
|
|
104
|
+
if (missingVarNames.length > 0) {
|
|
105
|
+
process.stdout.write('\nSee `shrk templates vars ' + template.id + '` for required variables.\n');
|
|
106
|
+
const sampleVars = template.variables
|
|
107
|
+
.map((v) => `--var ${v.name}=${v.examples?.[0] ?? v.default ?? '<value>'}`)
|
|
108
|
+
.join(' ');
|
|
109
|
+
process.stdout.write(`Example:\n $ shrk gen ${template.id} <name> ${sampleVars} --dry-run\n`);
|
|
110
|
+
}
|
|
111
|
+
if (!plan.changes.length)
|
|
112
|
+
return 1;
|
|
113
|
+
}
|
|
114
|
+
for (const change of plan.changes) {
|
|
115
|
+
process.stdout.write(`${CHANGE_LABEL[change.type]} ${change.relativePath} (${change.sizeBytes} bytes) — ${change.reason}\n`);
|
|
116
|
+
}
|
|
117
|
+
if (plan.postGenerationNotes.length) {
|
|
118
|
+
process.stdout.write('\nPost-generation notes:\n');
|
|
119
|
+
for (const note of plan.postGenerationNotes)
|
|
120
|
+
process.stdout.write(` • ${note}\n`);
|
|
121
|
+
}
|
|
122
|
+
const updateLike = plan.changes.filter((c) => c.type === FileChangeType.Append ||
|
|
123
|
+
c.type === FileChangeType.InsertAfter ||
|
|
124
|
+
c.type === FileChangeType.InsertBefore ||
|
|
125
|
+
c.type === FileChangeType.Replace ||
|
|
126
|
+
c.type === FileChangeType.Export);
|
|
127
|
+
if (updateLike.length > 0) {
|
|
128
|
+
process.stdout.write(`\nHUMAN REVIEW REQUIRED — ${updateLike.length} update entry/entries modify existing files.\n`);
|
|
129
|
+
}
|
|
130
|
+
process.stdout.write(`\nSummary: written=${summary.written}, skipped=${summary.skipped}, conflicts=${summary.conflicts}\n`);
|
|
131
|
+
if (!write && !savePlanPath) {
|
|
132
|
+
process.stdout.write('\nRe-run with --write to apply, or --save-plan <file> + `shrk apply`.\n');
|
|
133
|
+
}
|
|
134
|
+
return plan.hasConflicts ? 1 : 0;
|
|
135
|
+
},
|
|
136
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ICommandHandler } from '../command-registry.js';
|
|
2
|
+
export declare const gitChangedCommand: ICommandHandler;
|
|
3
|
+
export declare const gitRootCommand: ICommandHandler;
|
|
4
|
+
export declare const gitBranchCommand: ICommandHandler;
|
|
5
|
+
export declare const gitStatusSummaryCommand: ICommandHandler;
|
|
6
|
+
//# sourceMappingURL=git.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.command.d.ts","sourceRoot":"","sources":["../../src/commands/git.command.ts"],"names":[],"mappings":"AAOA,OAAO,EAIL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AAGhC,eAAO,MAAM,iBAAiB,EAAE,eAuB/B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,eAc5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,eAc9B,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,eAoBrC,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { getChangedFiles, getGitBranch, getGitRoot, getStatusSummary, isGitRepo, } from '@shrkcrft/inspector';
|
|
2
|
+
import { flagBool, flagString, resolveCwd, } from "../command-registry.js";
|
|
3
|
+
import { asJson } from "../output/format-output.js";
|
|
4
|
+
export const gitChangedCommand = {
|
|
5
|
+
name: 'changed',
|
|
6
|
+
description: 'List changed files (read-only git diff).',
|
|
7
|
+
usage: 'shrk git changed [--since <ref>] [--staged] [--include-worktree] [--json]',
|
|
8
|
+
run(args) {
|
|
9
|
+
const cwd = resolveCwd(args);
|
|
10
|
+
if (!isGitRepo(cwd)) {
|
|
11
|
+
process.stderr.write('Not a git repo.\n');
|
|
12
|
+
return 1;
|
|
13
|
+
}
|
|
14
|
+
const opts = {};
|
|
15
|
+
const since = flagString(args, 'since');
|
|
16
|
+
if (since)
|
|
17
|
+
opts.since = since;
|
|
18
|
+
if (flagBool(args, 'staged'))
|
|
19
|
+
opts.staged = true;
|
|
20
|
+
if (flagBool(args, 'include-worktree'))
|
|
21
|
+
opts.includeWorktree = true;
|
|
22
|
+
const files = getChangedFiles(cwd, opts);
|
|
23
|
+
if (flagBool(args, 'json')) {
|
|
24
|
+
process.stdout.write(asJson({ files }) + '\n');
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
for (const f of files)
|
|
28
|
+
process.stdout.write(`${f}\n`);
|
|
29
|
+
}
|
|
30
|
+
return 0;
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
export const gitRootCommand = {
|
|
34
|
+
name: 'root',
|
|
35
|
+
description: 'Print the git repo root.',
|
|
36
|
+
usage: 'shrk git root',
|
|
37
|
+
run(args) {
|
|
38
|
+
const cwd = resolveCwd(args);
|
|
39
|
+
const r = getGitRoot(cwd);
|
|
40
|
+
if (!r) {
|
|
41
|
+
process.stderr.write('Not a git repo.\n');
|
|
42
|
+
return 1;
|
|
43
|
+
}
|
|
44
|
+
process.stdout.write(r + '\n');
|
|
45
|
+
return 0;
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
export const gitBranchCommand = {
|
|
49
|
+
name: 'branch',
|
|
50
|
+
description: 'Print the current git branch.',
|
|
51
|
+
usage: 'shrk git branch',
|
|
52
|
+
run(args) {
|
|
53
|
+
const cwd = resolveCwd(args);
|
|
54
|
+
const b = getGitBranch(cwd);
|
|
55
|
+
if (!b) {
|
|
56
|
+
process.stderr.write('Not a git repo.\n');
|
|
57
|
+
return 1;
|
|
58
|
+
}
|
|
59
|
+
process.stdout.write(b + '\n');
|
|
60
|
+
return 0;
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
export const gitStatusSummaryCommand = {
|
|
64
|
+
name: 'status-summary',
|
|
65
|
+
description: 'Compact, read-only git status summary.',
|
|
66
|
+
usage: 'shrk git status-summary [--json]',
|
|
67
|
+
run(args) {
|
|
68
|
+
const cwd = resolveCwd(args);
|
|
69
|
+
const summary = getStatusSummary(cwd);
|
|
70
|
+
if (flagBool(args, 'json')) {
|
|
71
|
+
process.stdout.write(asJson(summary) + '\n');
|
|
72
|
+
return 0;
|
|
73
|
+
}
|
|
74
|
+
process.stdout.write(`branch=${summary.branch ?? '(none)'} ` +
|
|
75
|
+
`ahead=${summary.ahead} behind=${summary.behind} ` +
|
|
76
|
+
`staged=${summary.staged} modified=${summary.modified} ` +
|
|
77
|
+
`untracked=${summary.untracked} conflicts=${summary.conflicts} ` +
|
|
78
|
+
`clean=${summary.clean}\n`);
|
|
79
|
+
return 0;
|
|
80
|
+
},
|
|
81
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.command.d.ts","sourceRoot":"","sources":["../../src/commands/graph.command.ts"],"names":[],"mappings":"AAUA,OAAO,EAIL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AAehC,eAAO,MAAM,YAAY,EAAE,eA6L1B,CAAC"}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import * as nodePath from 'node:path';
|
|
3
|
+
import { analyzeImportGraph, buildKnowledgeGraph, findGraphPath, getGraphNode, inspectSharkcraft, } from '@shrkcrft/inspector';
|
|
4
|
+
import { flagBool, flagString, resolveCwd, } from "../command-registry.js";
|
|
5
|
+
import { asJson, header, kv } from "../output/format-output.js";
|
|
6
|
+
const KNOWN_KINDS = [
|
|
7
|
+
'knowledge',
|
|
8
|
+
'rule',
|
|
9
|
+
'path',
|
|
10
|
+
'template',
|
|
11
|
+
'pipeline',
|
|
12
|
+
'preset',
|
|
13
|
+
'pack',
|
|
14
|
+
'boundary',
|
|
15
|
+
'doc',
|
|
16
|
+
];
|
|
17
|
+
export const graphCommand = {
|
|
18
|
+
name: 'graph',
|
|
19
|
+
description: 'Show the SharkCraft knowledge graph: nodes (knowledge/rules/paths/templates/pipelines/presets/packs/boundaries) and edges (related-template, preset-references, pipeline-step-references, …). Supports text|json|dot|mermaid output and an `export` subcommand for writing to file.',
|
|
20
|
+
usage: 'shrk [--cwd <dir>] graph [<id>] [--type <kind>] [--format text|json|dot|mermaid] [--output <file>] [--json] | shrk graph export --format dot|mermaid --output <file>',
|
|
21
|
+
async run(args) {
|
|
22
|
+
const inspection = await inspectSharkcraft({ cwd: resolveCwd(args) });
|
|
23
|
+
const graph = buildKnowledgeGraph(inspection);
|
|
24
|
+
const sub = args.positional[0];
|
|
25
|
+
const typeFlag = flagString(args, 'type');
|
|
26
|
+
const formatFlag = (flagString(args, 'format') ?? 'text');
|
|
27
|
+
const outputFlag = flagString(args, 'output');
|
|
28
|
+
// `shrk graph imports` — import-graph analysis.
|
|
29
|
+
if (sub === 'imports') {
|
|
30
|
+
const cwd = resolveCwd(args);
|
|
31
|
+
const analysis = analyzeImportGraph(cwd);
|
|
32
|
+
const wantJson = flagBool(args, 'json');
|
|
33
|
+
const wantCycles = flagBool(args, 'cycles');
|
|
34
|
+
const wantFanIn = flagBool(args, 'fan-in');
|
|
35
|
+
const wantFanOut = flagBool(args, 'fan-out');
|
|
36
|
+
const wantOrphans = flagBool(args, 'orphans');
|
|
37
|
+
if (wantJson) {
|
|
38
|
+
process.stdout.write(asJson(analysis) + '\n');
|
|
39
|
+
return 0;
|
|
40
|
+
}
|
|
41
|
+
process.stdout.write(header('Import graph analysis'));
|
|
42
|
+
process.stdout.write(kv('files scanned', String(analysis.filesScanned)) + '\n');
|
|
43
|
+
process.stdout.write(kv('workspace packages', String(analysis.packageCount)) + '\n');
|
|
44
|
+
if (!wantCycles && !wantFanIn && !wantFanOut && !wantOrphans) {
|
|
45
|
+
process.stdout.write(`cycles=${analysis.cycles.length} orphans=${analysis.orphans.length} unused=${analysis.unusedPublicEntrypoints.length}\n`);
|
|
46
|
+
process.stdout.write('Top fan-in:\n');
|
|
47
|
+
for (const f of analysis.topFanIn.slice(0, 5))
|
|
48
|
+
process.stdout.write(` ${f.in} ${f.file}\n`);
|
|
49
|
+
return 0;
|
|
50
|
+
}
|
|
51
|
+
if (wantCycles) {
|
|
52
|
+
for (const c of analysis.cycles)
|
|
53
|
+
process.stdout.write(`cycle: ${c.nodes.join(' → ')}\n`);
|
|
54
|
+
}
|
|
55
|
+
if (wantFanIn) {
|
|
56
|
+
for (const f of analysis.topFanIn)
|
|
57
|
+
process.stdout.write(`${f.in}\t${f.file}\n`);
|
|
58
|
+
}
|
|
59
|
+
if (wantFanOut) {
|
|
60
|
+
for (const f of analysis.topFanOut)
|
|
61
|
+
process.stdout.write(`${f.out}\t${f.file}\n`);
|
|
62
|
+
}
|
|
63
|
+
if (wantOrphans) {
|
|
64
|
+
for (const f of analysis.orphans)
|
|
65
|
+
process.stdout.write(`${f}\n`);
|
|
66
|
+
}
|
|
67
|
+
return 0;
|
|
68
|
+
}
|
|
69
|
+
// `shrk graph export --format dot|mermaid --output <file>`.
|
|
70
|
+
if (sub === 'export') {
|
|
71
|
+
if (formatFlag !== 'dot' && formatFlag !== 'mermaid' && formatFlag !== 'json') {
|
|
72
|
+
process.stderr.write('Usage: shrk graph export --format dot|mermaid|json --output <file>\n');
|
|
73
|
+
return 2;
|
|
74
|
+
}
|
|
75
|
+
if (!outputFlag) {
|
|
76
|
+
process.stderr.write('Usage: shrk graph export --format dot|mermaid|json --output <file>\n');
|
|
77
|
+
return 2;
|
|
78
|
+
}
|
|
79
|
+
return exportGraph(args, graph, formatFlag, outputFlag);
|
|
80
|
+
}
|
|
81
|
+
// `shrk graph why <from> <to>` — shortest-path search.
|
|
82
|
+
if (sub === 'why') {
|
|
83
|
+
const fromId = args.positional[1];
|
|
84
|
+
const toId = args.positional[2];
|
|
85
|
+
if (!fromId || !toId) {
|
|
86
|
+
process.stderr.write('Usage: shrk graph why <fromId> <toId>\n');
|
|
87
|
+
return 2;
|
|
88
|
+
}
|
|
89
|
+
const path = findGraphPath(graph, { id: fromId }, { id: toId });
|
|
90
|
+
if (flagBool(args, 'json')) {
|
|
91
|
+
process.stdout.write(asJson(path) + '\n');
|
|
92
|
+
return path.found ? 0 : 1;
|
|
93
|
+
}
|
|
94
|
+
process.stdout.write(header(`Graph why: ${fromId} → ${toId}`));
|
|
95
|
+
if (!path.found) {
|
|
96
|
+
// Prefer the kind-aware explanation when available (rules don't
|
|
97
|
+
// connect to rules directly, etc.). Fall back to the short reason
|
|
98
|
+
// for older inspectors that don't populate `explanation`.
|
|
99
|
+
process.stdout.write(`${path.explanation ?? path.reason ?? 'No path: unknown'}\n`);
|
|
100
|
+
return 1;
|
|
101
|
+
}
|
|
102
|
+
for (let i = 0; i < path.steps.length; i += 1) {
|
|
103
|
+
const s = path.steps[i];
|
|
104
|
+
if (s.via) {
|
|
105
|
+
process.stdout.write(` → (${s.via.relation}) ${s.via.why}\n`);
|
|
106
|
+
}
|
|
107
|
+
process.stdout.write(` ${i + 1}. ${s.node}\n`);
|
|
108
|
+
}
|
|
109
|
+
return 0;
|
|
110
|
+
}
|
|
111
|
+
const id = sub;
|
|
112
|
+
if (id) {
|
|
113
|
+
const node = getGraphNode(graph, typeFlag ? { kind: typeFlag, id } : { id });
|
|
114
|
+
if (!node) {
|
|
115
|
+
process.stderr.write(`No graph node for "${id}".\n`);
|
|
116
|
+
return 1;
|
|
117
|
+
}
|
|
118
|
+
// Subgraph export (single node + neighbours) in dot/mermaid format.
|
|
119
|
+
if (formatFlag === 'dot' || formatFlag === 'mermaid') {
|
|
120
|
+
const body = formatFlag === 'dot' ? renderDotForNode(node) : renderMermaidForNode(node);
|
|
121
|
+
if (outputFlag) {
|
|
122
|
+
writeOutput(args, outputFlag, body);
|
|
123
|
+
return 0;
|
|
124
|
+
}
|
|
125
|
+
process.stdout.write(body);
|
|
126
|
+
return 0;
|
|
127
|
+
}
|
|
128
|
+
if (flagBool(args, 'json')) {
|
|
129
|
+
process.stdout.write(asJson(node) + '\n');
|
|
130
|
+
return 0;
|
|
131
|
+
}
|
|
132
|
+
process.stdout.write(header(`Graph: ${node.node.kind}:${node.node.id}`));
|
|
133
|
+
process.stdout.write(kv('title', node.node.title) + '\n');
|
|
134
|
+
if (node.node.summary)
|
|
135
|
+
process.stdout.write(kv('summary', node.node.summary) + '\n');
|
|
136
|
+
process.stdout.write(kv('source', node.node.source) + '\n');
|
|
137
|
+
if (node.outgoing.length) {
|
|
138
|
+
process.stdout.write('\nOutgoing:\n');
|
|
139
|
+
for (const e of node.outgoing) {
|
|
140
|
+
process.stdout.write(` → ${e.to.padEnd(40)} (${e.relation}) ${e.why}\n`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (node.incoming.length) {
|
|
144
|
+
process.stdout.write('\nIncoming:\n');
|
|
145
|
+
for (const e of node.incoming) {
|
|
146
|
+
process.stdout.write(` ← ${e.from.padEnd(40)} (${e.relation}) ${e.why}\n`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return 0;
|
|
150
|
+
}
|
|
151
|
+
// Whole graph summary.
|
|
152
|
+
const nodes = typeFlag
|
|
153
|
+
? graph.nodes.filter((n) => n.kind === typeFlag)
|
|
154
|
+
: graph.nodes;
|
|
155
|
+
if (formatFlag === 'dot' || formatFlag === 'mermaid') {
|
|
156
|
+
const filteredGraph = typeFlag
|
|
157
|
+
? {
|
|
158
|
+
...graph,
|
|
159
|
+
nodes,
|
|
160
|
+
edges: graph.edges.filter((e) => {
|
|
161
|
+
const fromNode = graph.nodes.find((n) => n.id === e.from);
|
|
162
|
+
const toNode = graph.nodes.find((n) => n.id === e.to);
|
|
163
|
+
return fromNode?.kind === typeFlag || toNode?.kind === typeFlag;
|
|
164
|
+
}),
|
|
165
|
+
}
|
|
166
|
+
: graph;
|
|
167
|
+
const body = formatFlag === 'dot' ? renderDotGraph(filteredGraph) : renderMermaidGraph(filteredGraph);
|
|
168
|
+
if (outputFlag) {
|
|
169
|
+
writeOutput(args, outputFlag, body);
|
|
170
|
+
return 0;
|
|
171
|
+
}
|
|
172
|
+
process.stdout.write(body);
|
|
173
|
+
return 0;
|
|
174
|
+
}
|
|
175
|
+
if (formatFlag === 'json' || flagBool(args, 'json')) {
|
|
176
|
+
process.stdout.write(asJson({ nodes, edges: graph.edges }) + '\n');
|
|
177
|
+
return 0;
|
|
178
|
+
}
|
|
179
|
+
process.stdout.write(header('Knowledge graph'));
|
|
180
|
+
process.stdout.write(kv('nodes', String(graph.nodes.length)) + '\n');
|
|
181
|
+
process.stdout.write(kv('edges', String(graph.edges.length)) + '\n');
|
|
182
|
+
if (!typeFlag) {
|
|
183
|
+
const byKind = new Map();
|
|
184
|
+
for (const n of graph.nodes)
|
|
185
|
+
byKind.set(n.kind, (byKind.get(n.kind) ?? 0) + 1);
|
|
186
|
+
process.stdout.write('\nNodes by kind:\n');
|
|
187
|
+
for (const k of KNOWN_KINDS) {
|
|
188
|
+
process.stdout.write(` ${k.padEnd(10)} ${byKind.get(k) ?? 0}\n`);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
process.stdout.write(`\n${typeFlag} nodes:\n`);
|
|
193
|
+
for (const n of nodes.slice(0, 30)) {
|
|
194
|
+
process.stdout.write(` ${n.id.padEnd(30)} ${n.title}\n`);
|
|
195
|
+
}
|
|
196
|
+
if (nodes.length > 30) {
|
|
197
|
+
process.stdout.write(` … (${nodes.length - 30} more)\n`);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return 0;
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
function escapeDot(value) {
|
|
204
|
+
return value.replace(/"/g, '\\"');
|
|
205
|
+
}
|
|
206
|
+
function renderDotGraph(graph) {
|
|
207
|
+
const lines = [];
|
|
208
|
+
lines.push('digraph SharkCraftKnowledge {');
|
|
209
|
+
lines.push(' rankdir=LR;');
|
|
210
|
+
lines.push(' node [shape=box, style="rounded,filled", fillcolor="#f5f5fa", fontname="Helvetica"];');
|
|
211
|
+
for (const n of graph.nodes) {
|
|
212
|
+
lines.push(` "${n.kind}:${n.id}" [label="${escapeDot(n.kind + ': ' + n.id)}\\n${escapeDot(n.title)}"];`);
|
|
213
|
+
}
|
|
214
|
+
for (const e of graph.edges) {
|
|
215
|
+
lines.push(` "${e.from}" -> "${e.to}" [label="${escapeDot(e.relation)}"];`);
|
|
216
|
+
}
|
|
217
|
+
lines.push('}');
|
|
218
|
+
return lines.join('\n') + '\n';
|
|
219
|
+
}
|
|
220
|
+
function renderMermaidGraph(graph) {
|
|
221
|
+
const lines = [];
|
|
222
|
+
lines.push('graph LR');
|
|
223
|
+
for (const n of graph.nodes) {
|
|
224
|
+
lines.push(` ${mermaidId(n.kind, n.id)}["${n.kind}:${n.id}"]`);
|
|
225
|
+
}
|
|
226
|
+
for (const e of graph.edges) {
|
|
227
|
+
const fromNode = graph.nodes.find((n) => n.id === e.from);
|
|
228
|
+
const toNode = graph.nodes.find((n) => n.id === e.to);
|
|
229
|
+
if (!fromNode || !toNode)
|
|
230
|
+
continue;
|
|
231
|
+
lines.push(` ${mermaidId(fromNode.kind, fromNode.id)} -->|${escapeMermaid(e.relation)}| ${mermaidId(toNode.kind, toNode.id)}`);
|
|
232
|
+
}
|
|
233
|
+
return lines.join('\n') + '\n';
|
|
234
|
+
}
|
|
235
|
+
function mermaidId(kind, id) {
|
|
236
|
+
return (kind + '_' + id).replace(/[^a-zA-Z0-9_]/g, '_');
|
|
237
|
+
}
|
|
238
|
+
function escapeMermaid(value) {
|
|
239
|
+
return value.replace(/\|/g, '/');
|
|
240
|
+
}
|
|
241
|
+
function renderDotForNode(node) {
|
|
242
|
+
const lines = [];
|
|
243
|
+
lines.push('digraph SharkCraftNode {');
|
|
244
|
+
lines.push(' rankdir=LR;');
|
|
245
|
+
lines.push(' node [shape=box, style="rounded,filled", fillcolor="#f5f5fa", fontname="Helvetica"];');
|
|
246
|
+
if (node.node) {
|
|
247
|
+
lines.push(` "${node.node.kind}:${node.node.id}" [label="${escapeDot(node.node.kind + ': ' + node.node.id)}\\n${escapeDot(node.node.title)}", fillcolor="#dde7ff"];`);
|
|
248
|
+
}
|
|
249
|
+
for (const e of node.outgoing) {
|
|
250
|
+
lines.push(` "${node.node?.kind ?? ''}:${node.node?.id ?? ''}" -> "${e.to}" [label="${escapeDot(e.relation)}"];`);
|
|
251
|
+
}
|
|
252
|
+
for (const e of node.incoming) {
|
|
253
|
+
lines.push(` "${e.from}" -> "${node.node?.kind ?? ''}:${node.node?.id ?? ''}" [label="${escapeDot(e.relation)}"];`);
|
|
254
|
+
}
|
|
255
|
+
lines.push('}');
|
|
256
|
+
return lines.join('\n') + '\n';
|
|
257
|
+
}
|
|
258
|
+
function renderMermaidForNode(node) {
|
|
259
|
+
const lines = [];
|
|
260
|
+
lines.push('graph LR');
|
|
261
|
+
if (node.node) {
|
|
262
|
+
lines.push(` ${mermaidId(node.node.kind, node.node.id)}["${node.node.kind}:${node.node.id}"]`);
|
|
263
|
+
}
|
|
264
|
+
for (const e of node.outgoing) {
|
|
265
|
+
lines.push(` ${mermaidId(node.node?.kind ?? '', node.node?.id ?? '')} -->|${escapeMermaid(e.relation)}| ${mermaidId('node', e.to)}`);
|
|
266
|
+
}
|
|
267
|
+
for (const e of node.incoming) {
|
|
268
|
+
lines.push(` ${mermaidId('node', e.from)} -->|${escapeMermaid(e.relation)}| ${mermaidId(node.node?.kind ?? '', node.node?.id ?? '')}`);
|
|
269
|
+
}
|
|
270
|
+
return lines.join('\n') + '\n';
|
|
271
|
+
}
|
|
272
|
+
function exportGraph(args, graph, format, output) {
|
|
273
|
+
const body = format === 'dot'
|
|
274
|
+
? renderDotGraph(graph)
|
|
275
|
+
: format === 'mermaid'
|
|
276
|
+
? renderMermaidGraph(graph)
|
|
277
|
+
: JSON.stringify({ nodes: graph.nodes, edges: graph.edges }, null, 2) + '\n';
|
|
278
|
+
writeOutput(args, output, body);
|
|
279
|
+
return 0;
|
|
280
|
+
}
|
|
281
|
+
function writeOutput(args, output, body) {
|
|
282
|
+
const cwd = resolveCwd(args);
|
|
283
|
+
const full = nodePath.isAbsolute(output) ? output : nodePath.resolve(cwd, output);
|
|
284
|
+
mkdirSync(nodePath.dirname(full), { recursive: true });
|
|
285
|
+
writeFileSync(full, body, 'utf8');
|
|
286
|
+
process.stdout.write(`Wrote ${body.length} bytes to ${full}\n`);
|
|
287
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `shrk grounding "<task>"` — thin context primer for
|
|
3
|
+
* plugin / skill consumption. Read-only. JSON-first output.
|
|
4
|
+
*/
|
|
5
|
+
import { type ICommandHandler } from '../command-registry.js';
|
|
6
|
+
export declare const groundingCommand: ICommandHandler;
|
|
7
|
+
//# sourceMappingURL=grounding.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grounding.command.d.ts","sourceRoot":"","sources":["../../src/commands/grounding.command.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAIL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AAGhC,eAAO,MAAM,gBAAgB,EAAE,eA+C9B,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `shrk grounding "<task>"` — thin context primer for
|
|
3
|
+
* plugin / skill consumption. Read-only. JSON-first output.
|
|
4
|
+
*/
|
|
5
|
+
import { buildGrounding, inspectSharkcraft } from '@shrkcrft/inspector';
|
|
6
|
+
import { flagBool, flagNumber, resolveCwd, } from "../command-registry.js";
|
|
7
|
+
import { asJson, header } from "../output/format-output.js";
|
|
8
|
+
export const groundingCommand = {
|
|
9
|
+
name: 'grounding',
|
|
10
|
+
description: 'Emit task-relevant rules / knowledge / paths / templates / verification IDs as JSON. Read-only. Pure composition of the task-packet ranker — no LLM, no shell, no writes.',
|
|
11
|
+
usage: 'shrk grounding "<task>" [--limit 5] [--max-tokens 2500] [--json]',
|
|
12
|
+
async run(args) {
|
|
13
|
+
const task = args.positional[0];
|
|
14
|
+
if (!task || task.trim().length === 0) {
|
|
15
|
+
process.stderr.write('Usage: shrk grounding "<task>"\n');
|
|
16
|
+
return 2;
|
|
17
|
+
}
|
|
18
|
+
const cwd = resolveCwd(args);
|
|
19
|
+
const inspection = await inspectSharkcraft({ cwd });
|
|
20
|
+
const limit = flagNumber(args, 'limit') ?? 5;
|
|
21
|
+
const maxTokens = flagNumber(args, 'max-tokens') ?? 2500;
|
|
22
|
+
const report = buildGrounding(task, inspection, { limit, maxTokens });
|
|
23
|
+
if (flagBool(args, 'json')) {
|
|
24
|
+
process.stdout.write(asJson(report) + '\n');
|
|
25
|
+
return 0;
|
|
26
|
+
}
|
|
27
|
+
process.stdout.write(header(`Grounding: ${task}`));
|
|
28
|
+
process.stdout.write(` rules: ${report.rules.length}\n`);
|
|
29
|
+
process.stdout.write(` knowledge: ${report.knowledge.length}\n`);
|
|
30
|
+
process.stdout.write(` paths: ${report.paths.length}\n`);
|
|
31
|
+
process.stdout.write(` templates: ${report.templates.length}\n`);
|
|
32
|
+
process.stdout.write(` verification IDs (trusted): ${report.verificationCommandIds.join(', ') || '(none)'}\n`);
|
|
33
|
+
if (report.rules.length > 0) {
|
|
34
|
+
process.stdout.write('\nRules:\n');
|
|
35
|
+
for (const r of report.rules) {
|
|
36
|
+
process.stdout.write(` ${r.id.padEnd(40)} [${r.priority ?? '-'}] ${r.title}\n`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (report.knowledge.length > 0) {
|
|
40
|
+
process.stdout.write('\nKnowledge:\n');
|
|
41
|
+
for (const k of report.knowledge) {
|
|
42
|
+
process.stdout.write(` ${k.id.padEnd(40)} ${k.title}\n`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (report.templates.length > 0) {
|
|
46
|
+
process.stdout.write('\nTemplates:\n');
|
|
47
|
+
for (const t of report.templates) {
|
|
48
|
+
process.stdout.write(` ${t.id.padEnd(40)} ${t.name}\n`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
process.stdout.write(`\nPass --json for the structured \`sharkcraft.grounding/v1\` payload.\n`);
|
|
52
|
+
return 0;
|
|
53
|
+
},
|
|
54
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CommandRegistry } from '../command-registry.js';
|
|
2
|
+
/**
|
|
3
|
+
* Short product start screen for bare `shrk` / `shrk --help`. Pruned
|
|
4
|
+
* to the core tier set; extended verbs live one link away via
|
|
5
|
+
* `shrk surface list`.
|
|
6
|
+
*
|
|
7
|
+
* Returns the lines (without trailing newline). Pulled into a function
|
|
8
|
+
* so tests can assert on the structure without grepping stdout.
|
|
9
|
+
*/
|
|
10
|
+
export declare function renderStartScreen(): string;
|
|
11
|
+
export declare function makeHelpCommand(registry: CommandRegistry): {
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
usage: string;
|
|
15
|
+
run(args: {
|
|
16
|
+
positional: string[];
|
|
17
|
+
flags: Map<string, string | boolean>;
|
|
18
|
+
}): number;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=help.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help.command.d.ts","sourceRoot":"","sources":["../../src/commands/help.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAG9D;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAuB1C;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,eAAe;;;;cAK3C;QAAE,UAAU,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAA;KAAE,GAAG,MAAM;EA2FpF"}
|