@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":"context.command.d.ts","sourceRoot":"","sources":["../../src/commands/context.command.ts"],"names":[],"mappings":"AASA,OAAO,EAML,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AAGhC,eAAO,MAAM,cAAc,EAAE,eA6H5B,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { entrypointBanner, inspectSharkcraft } from '@shrkcrft/inspector';
|
|
2
|
+
import { buildContext } from '@shrkcrft/context';
|
|
3
|
+
import { buildUniversalSearch, explainTaskRouting, recommendCommands, renderOverviewText, buildProjectOverview, } from '@shrkcrft/inspector';
|
|
4
|
+
import { flagBool, flagNumber, flagString, flagList, resolveCwd, } from "../command-registry.js";
|
|
5
|
+
import { asJson, header } from "../output/format-output.js";
|
|
6
|
+
export const contextCommand = {
|
|
7
|
+
name: 'context',
|
|
8
|
+
description: 'Build relevant AI-ready context for a task (token-budgeted). Subcommands: build / refresh / status.',
|
|
9
|
+
usage: 'shrk context [build|refresh|status] --task "<task>" [--max-tokens 3000] [--framework x] [--area y] [--json]',
|
|
10
|
+
async run(args) {
|
|
11
|
+
// Dispatch subcommands (build / refresh / status) based on first positional.
|
|
12
|
+
const sub = args.positional[0];
|
|
13
|
+
if (sub === 'build' || sub === 'refresh' || sub === 'status') {
|
|
14
|
+
const sliced = { ...args, positional: args.positional.slice(1) };
|
|
15
|
+
const { contextBuildCommand, contextRefreshCommand, contextStatusCommand } = await import("./task-context.command.js");
|
|
16
|
+
if (sub === 'build')
|
|
17
|
+
return contextBuildCommand.run(sliced);
|
|
18
|
+
if (sub === 'refresh')
|
|
19
|
+
return contextRefreshCommand.run(sliced);
|
|
20
|
+
return contextStatusCommand.run(sliced);
|
|
21
|
+
}
|
|
22
|
+
const task = flagString(args, 'task');
|
|
23
|
+
if (!task) {
|
|
24
|
+
process.stderr.write('Missing --task\n');
|
|
25
|
+
return 2;
|
|
26
|
+
}
|
|
27
|
+
const framework = flagString(args, 'framework');
|
|
28
|
+
const area = flagString(args, 'area');
|
|
29
|
+
const tags = flagList(args, 'tag');
|
|
30
|
+
const scope = flagList(args, 'scope');
|
|
31
|
+
const maxTokens = flagNumber(args, 'max-tokens') ?? flagNumber(args, 'maxTokens');
|
|
32
|
+
const noExamples = flagBool(args, 'no-examples');
|
|
33
|
+
const noTemplates = flagBool(args, 'no-templates');
|
|
34
|
+
const noRules = flagBool(args, 'no-rules');
|
|
35
|
+
const noPaths = flagBool(args, 'no-paths');
|
|
36
|
+
const includeDocs = flagBool(args, 'include-docs');
|
|
37
|
+
const includeCommands = flagBool(args, 'include-commands');
|
|
38
|
+
const inspection = await inspectSharkcraft({ cwd: resolveCwd(args) });
|
|
39
|
+
const overview = buildProjectOverview(inspection.workspace, inspection.config?.projectName);
|
|
40
|
+
const result = buildContext(inspection.knowledgeEntries, {
|
|
41
|
+
task,
|
|
42
|
+
framework,
|
|
43
|
+
area,
|
|
44
|
+
tags,
|
|
45
|
+
scope,
|
|
46
|
+
maxTokens: maxTokens ?? inspection.config?.defaultMaxTokens ?? 3000,
|
|
47
|
+
includeExamples: !noExamples,
|
|
48
|
+
includeTemplates: !noTemplates,
|
|
49
|
+
includeRules: !noRules,
|
|
50
|
+
includePaths: !noPaths,
|
|
51
|
+
includeDocs,
|
|
52
|
+
includeCommands,
|
|
53
|
+
projectOverview: renderOverviewText(overview),
|
|
54
|
+
});
|
|
55
|
+
// Surface top commands prominently before the long context body.
|
|
56
|
+
// Auto-promote commands-first for action-like tasks (rename / add /
|
|
57
|
+
// fix / refactor / remove / migrate / explore / wire). Pass --full to
|
|
58
|
+
// see the long context body anyway.
|
|
59
|
+
const actionVerbRe = /^(rename|add|fix|refactor|remove|delete|migrate|wire|explore|create|implement|update|introduce|build|extract|move|inline|generate|scaffold)\b/i;
|
|
60
|
+
const isActionLike = actionVerbRe.test(task.trim());
|
|
61
|
+
const wantsFull = flagBool(args, 'full');
|
|
62
|
+
const commandsFirst = flagBool(args, 'commands-first') || (isActionLike && !wantsFull);
|
|
63
|
+
let commandRecommendations = null;
|
|
64
|
+
let routingMatches = [];
|
|
65
|
+
let searchReport = null;
|
|
66
|
+
try {
|
|
67
|
+
commandRecommendations = await recommendCommands(inspection, task);
|
|
68
|
+
routingMatches = await explainTaskRouting(inspection, task);
|
|
69
|
+
searchReport = await buildUniversalSearch(inspection, task, {});
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
// ignore — fall back to legacy context only.
|
|
73
|
+
}
|
|
74
|
+
if (flagBool(args, 'json') || flagBool(args, 'machine-json')) {
|
|
75
|
+
process.stdout.write(asJson({
|
|
76
|
+
...result,
|
|
77
|
+
commands: commandRecommendations,
|
|
78
|
+
routingMatches,
|
|
79
|
+
search: searchReport,
|
|
80
|
+
}) + '\n');
|
|
81
|
+
return 0;
|
|
82
|
+
}
|
|
83
|
+
process.stdout.write(header(`Context for: ${task}`));
|
|
84
|
+
// Entrypoint banner: commands surface first when present (already
|
|
85
|
+
// done below), and the banner points operators at the agent-mcp + machine
|
|
86
|
+
// alternatives so the role of each entrypoint is clear.
|
|
87
|
+
process.stdout.write(`(${entrypointBanner('context')})\n\n`);
|
|
88
|
+
process.stdout.write(`tokens ≈ ${result.totalTokens} / ${result.maxTokens}, sections: ${result.sections.length}\n`);
|
|
89
|
+
if (result.omittedSections.length) {
|
|
90
|
+
process.stdout.write(`omitted (budget): ${result.omittedSections.join(', ')}\n`);
|
|
91
|
+
}
|
|
92
|
+
if (commandRecommendations && commandRecommendations.recommendations.length > 0) {
|
|
93
|
+
process.stdout.write('\nTop commands:\n');
|
|
94
|
+
for (const r of commandRecommendations.recommendations.slice(0, 4)) {
|
|
95
|
+
process.stdout.write(` $ ${r.command}\n`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (routingMatches.length > 0) {
|
|
99
|
+
process.stdout.write('\nRouting hints:\n');
|
|
100
|
+
for (const m of routingMatches.slice(0, 3)) {
|
|
101
|
+
process.stdout.write(` • ${m.hint.id} ${m.hint.title}\n`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// Default human text mode keeps the output short. The long
|
|
105
|
+
// context body is one flag away via `--full`. JSON / commands-first /
|
|
106
|
+
// markdown paths are unchanged.
|
|
107
|
+
if (commandsFirst || !wantsFull) {
|
|
108
|
+
if (!wantsFull) {
|
|
109
|
+
process.stdout.write('\n(text mode is summary-only — pass --full for the long context body, --json for machine output.)\n');
|
|
110
|
+
}
|
|
111
|
+
else if (isActionLike && !flagBool(args, 'commands-first')) {
|
|
112
|
+
process.stdout.write('\n(action-like task → commands-first; pass --full to see the long context body.)\n');
|
|
113
|
+
}
|
|
114
|
+
return 0;
|
|
115
|
+
}
|
|
116
|
+
process.stdout.write('\n');
|
|
117
|
+
process.stdout.write(result.body + '\n');
|
|
118
|
+
return 0;
|
|
119
|
+
},
|
|
120
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type ICommandHandler } from '../command-registry.js';
|
|
2
|
+
export declare const contractCheckCommand: ICommandHandler;
|
|
3
|
+
export declare const contractApproveCommand: ICommandHandler;
|
|
4
|
+
export declare const contractStatusCommand: ICommandHandler;
|
|
5
|
+
//# sourceMappingURL=contract-gate.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-gate.command.d.ts","sourceRoot":"","sources":["../../src/commands/contract-gate.command.ts"],"names":[],"mappings":"AAYA,OAAO,EAIL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AAWhC,eAAO,MAAM,oBAAoB,EAAE,eAqDlC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,eA6EpC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,eA6DnC,CAAC"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import * as nodePath from 'node:path';
|
|
3
|
+
import { buildApproval, checkAgentContract, computeContractHash, inspectSharkcraft, parseRelativeExpiry, renderContractCheckMarkdown, renderContractCheckText, } from '@shrkcrft/inspector';
|
|
4
|
+
import { flagBool, flagString, resolveCwd, } from "../command-registry.js";
|
|
5
|
+
import { asJson } from "../output/format-output.js";
|
|
6
|
+
function readContract(file) {
|
|
7
|
+
return JSON.parse(readFileSync(file, 'utf8'));
|
|
8
|
+
}
|
|
9
|
+
function resolveAgainstCwd(cwd, file) {
|
|
10
|
+
return nodePath.isAbsolute(file) ? file : nodePath.resolve(cwd, file);
|
|
11
|
+
}
|
|
12
|
+
export const contractCheckCommand = {
|
|
13
|
+
name: 'check',
|
|
14
|
+
description: 'Validate an agent contract — required gates, plan readiness (if --plan supplied), forbidden files, public-API touch, risk + memory approval. Read-only.',
|
|
15
|
+
usage: 'shrk contract check <contract.json> [--plan <plan.json>] [--approval <approval.json>] [--format text|markdown|json] [--output <file>]',
|
|
16
|
+
async run(args) {
|
|
17
|
+
const contractFile = args.positional[0];
|
|
18
|
+
if (!contractFile) {
|
|
19
|
+
process.stderr.write('Usage: shrk contract check <contract.json>\n');
|
|
20
|
+
return 2;
|
|
21
|
+
}
|
|
22
|
+
const cwd = resolveCwd(args);
|
|
23
|
+
const inspection = await inspectSharkcraft({ cwd });
|
|
24
|
+
const absContract = resolveAgainstCwd(cwd, contractFile);
|
|
25
|
+
if (!existsSync(absContract)) {
|
|
26
|
+
process.stderr.write(`Contract not found: ${absContract}\n`);
|
|
27
|
+
return 1;
|
|
28
|
+
}
|
|
29
|
+
let contract;
|
|
30
|
+
try {
|
|
31
|
+
contract = readContract(absContract);
|
|
32
|
+
}
|
|
33
|
+
catch (e) {
|
|
34
|
+
process.stderr.write(`Failed to parse contract: ${e.message}\n`);
|
|
35
|
+
return 1;
|
|
36
|
+
}
|
|
37
|
+
const planFlag = flagString(args, 'plan');
|
|
38
|
+
const approvalFlag = flagString(args, 'approval');
|
|
39
|
+
const planPath = planFlag ? resolveAgainstCwd(cwd, planFlag) : undefined;
|
|
40
|
+
const approvalPath = approvalFlag ? resolveAgainstCwd(cwd, approvalFlag) : undefined;
|
|
41
|
+
const report = await checkAgentContract(inspection, contract, {
|
|
42
|
+
...(planPath ? { planPath } : {}),
|
|
43
|
+
...(approvalPath ? { approvalPath } : {}),
|
|
44
|
+
});
|
|
45
|
+
const format = (flagString(args, 'format') ?? 'text').toLowerCase();
|
|
46
|
+
let body;
|
|
47
|
+
if (format === 'json' || flagBool(args, 'json'))
|
|
48
|
+
body = asJson(report) + '\n';
|
|
49
|
+
else if (format === 'markdown' || format === 'md')
|
|
50
|
+
body = renderContractCheckMarkdown(report);
|
|
51
|
+
else
|
|
52
|
+
body = renderContractCheckText(report);
|
|
53
|
+
const output = flagString(args, 'output');
|
|
54
|
+
if (output) {
|
|
55
|
+
const abs = resolveAgainstCwd(cwd, output);
|
|
56
|
+
mkdirSync(nodePath.dirname(abs), { recursive: true });
|
|
57
|
+
writeFileSync(abs, body, 'utf8');
|
|
58
|
+
process.stdout.write(`Wrote ${abs}\n`);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
process.stdout.write(body);
|
|
62
|
+
}
|
|
63
|
+
return report.pass ? 0 : 1;
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
export const contractApproveCommand = {
|
|
67
|
+
name: 'approve',
|
|
68
|
+
description: 'Sign an approval for a contract. Approval writes only to the supplied --output path (no implicit locations). Read-only otherwise.',
|
|
69
|
+
usage: 'shrk contract approve <contract.json> --by <name> --reason "<text>" [--expires-in 2d|1h|30m|1w] [--expires-at <ISO>] [--gates a,b,c] [--output <approval.json>] [--secret-env <NAME>]',
|
|
70
|
+
async run(args) {
|
|
71
|
+
const contractFile = args.positional[0];
|
|
72
|
+
if (!contractFile) {
|
|
73
|
+
process.stderr.write('Usage: shrk contract approve <contract.json> --by <name> --reason "<text>"\n');
|
|
74
|
+
return 2;
|
|
75
|
+
}
|
|
76
|
+
const by = flagString(args, 'by');
|
|
77
|
+
const reason = flagString(args, 'reason');
|
|
78
|
+
if (!by || !reason) {
|
|
79
|
+
process.stderr.write('Both --by <name> and --reason "<text>" are required.\n');
|
|
80
|
+
return 2;
|
|
81
|
+
}
|
|
82
|
+
const cwd = resolveCwd(args);
|
|
83
|
+
const absContract = resolveAgainstCwd(cwd, contractFile);
|
|
84
|
+
if (!existsSync(absContract)) {
|
|
85
|
+
process.stderr.write(`Contract not found: ${absContract}\n`);
|
|
86
|
+
return 1;
|
|
87
|
+
}
|
|
88
|
+
let contract;
|
|
89
|
+
try {
|
|
90
|
+
contract = readContract(absContract);
|
|
91
|
+
}
|
|
92
|
+
catch (e) {
|
|
93
|
+
process.stderr.write(`Failed to parse contract: ${e.message}\n`);
|
|
94
|
+
return 1;
|
|
95
|
+
}
|
|
96
|
+
const gates = flagString(args, 'gates');
|
|
97
|
+
const expiresIn = flagString(args, 'expires-in');
|
|
98
|
+
const expiresAt = flagString(args, 'expires-at') ?? flagString(args, 'expires');
|
|
99
|
+
let resolvedExpiresAt;
|
|
100
|
+
if (expiresIn) {
|
|
101
|
+
const parsed = parseRelativeExpiry(expiresIn);
|
|
102
|
+
if (!parsed) {
|
|
103
|
+
process.stderr.write(`Invalid --expires-in value: ${expiresIn} (expected e.g. 30m, 2h, 7d, 1w)\n`);
|
|
104
|
+
return 2;
|
|
105
|
+
}
|
|
106
|
+
resolvedExpiresAt = parsed;
|
|
107
|
+
}
|
|
108
|
+
else if (expiresAt) {
|
|
109
|
+
const t = Date.parse(expiresAt);
|
|
110
|
+
if (Number.isNaN(t)) {
|
|
111
|
+
process.stderr.write(`Invalid --expires-at value: ${expiresAt} (expected ISO 8601 timestamp)\n`);
|
|
112
|
+
return 2;
|
|
113
|
+
}
|
|
114
|
+
resolvedExpiresAt = new Date(t).toISOString();
|
|
115
|
+
}
|
|
116
|
+
const secretEnv = flagString(args, 'secret-env');
|
|
117
|
+
const hash = computeContractHash(contract);
|
|
118
|
+
const approval = buildApproval({
|
|
119
|
+
contractHash: hash,
|
|
120
|
+
approvedBy: by,
|
|
121
|
+
reason,
|
|
122
|
+
...(gates ? { approvedGates: gates.split(',').map((s) => s.trim()).filter(Boolean) } : {}),
|
|
123
|
+
...(resolvedExpiresAt ? { expiresAt: resolvedExpiresAt } : {}),
|
|
124
|
+
...(secretEnv ? { secretEnv } : {}),
|
|
125
|
+
});
|
|
126
|
+
const output = flagString(args, 'output');
|
|
127
|
+
if (!output) {
|
|
128
|
+
// No implicit write location — print and let the human redirect.
|
|
129
|
+
process.stdout.write(JSON.stringify(approval, null, 2) + '\n');
|
|
130
|
+
process.stdout.write(`\n(no --output supplied; redirect or re-run with --output <file> to persist the approval)\n`);
|
|
131
|
+
return 0;
|
|
132
|
+
}
|
|
133
|
+
const abs = resolveAgainstCwd(cwd, output);
|
|
134
|
+
mkdirSync(nodePath.dirname(abs), { recursive: true });
|
|
135
|
+
writeFileSync(abs, JSON.stringify(approval, null, 2) + '\n', 'utf8');
|
|
136
|
+
process.stdout.write(`Wrote ${abs}\n`);
|
|
137
|
+
if (approval.signature)
|
|
138
|
+
process.stdout.write(` signed via ${secretEnv ?? 'SHARKCRAFT_CONTRACT_SECRET'}\n`);
|
|
139
|
+
else
|
|
140
|
+
process.stdout.write(` unsigned (no contract secret env set)\n`);
|
|
141
|
+
return 0;
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
export const contractStatusCommand = {
|
|
145
|
+
name: 'status',
|
|
146
|
+
description: 'Show the status of a contract: hash, role, mode, and (optionally) approval verification. Read-only.',
|
|
147
|
+
usage: 'shrk contract status <contract.json> [--approval <approval.json>] [--json]',
|
|
148
|
+
async run(args) {
|
|
149
|
+
const contractFile = args.positional[0];
|
|
150
|
+
if (!contractFile) {
|
|
151
|
+
process.stderr.write('Usage: shrk contract status <contract.json>\n');
|
|
152
|
+
return 2;
|
|
153
|
+
}
|
|
154
|
+
const cwd = resolveCwd(args);
|
|
155
|
+
const inspection = await inspectSharkcraft({ cwd });
|
|
156
|
+
const absContract = resolveAgainstCwd(cwd, contractFile);
|
|
157
|
+
if (!existsSync(absContract)) {
|
|
158
|
+
process.stderr.write(`Contract not found: ${absContract}\n`);
|
|
159
|
+
return 1;
|
|
160
|
+
}
|
|
161
|
+
let contract;
|
|
162
|
+
try {
|
|
163
|
+
contract = readContract(absContract);
|
|
164
|
+
}
|
|
165
|
+
catch (e) {
|
|
166
|
+
process.stderr.write(`Failed to parse contract: ${e.message}\n`);
|
|
167
|
+
return 1;
|
|
168
|
+
}
|
|
169
|
+
const approvalFlag = flagString(args, 'approval');
|
|
170
|
+
const approvalPath = approvalFlag ? resolveAgainstCwd(cwd, approvalFlag) : undefined;
|
|
171
|
+
const report = await checkAgentContract(inspection, contract, {
|
|
172
|
+
...(approvalPath ? { approvalPath } : {}),
|
|
173
|
+
});
|
|
174
|
+
if (flagBool(args, 'json')) {
|
|
175
|
+
process.stdout.write(asJson({
|
|
176
|
+
contractHash: report.contractHash,
|
|
177
|
+
task: report.task,
|
|
178
|
+
role: report.role,
|
|
179
|
+
mode: report.mode,
|
|
180
|
+
approvalStatus: report.approvalStatus,
|
|
181
|
+
approvalMessage: report.approvalMessage,
|
|
182
|
+
approvalExpiry: report.approvalExpiry,
|
|
183
|
+
pass: report.pass,
|
|
184
|
+
blockingGates: report.blockingGates,
|
|
185
|
+
warnGates: report.warnGates,
|
|
186
|
+
}) + '\n');
|
|
187
|
+
return 0;
|
|
188
|
+
}
|
|
189
|
+
process.stdout.write(`Contract status\n`);
|
|
190
|
+
process.stdout.write(` hash ${report.contractHash}\n`);
|
|
191
|
+
process.stdout.write(` task ${report.task || '(empty)'}\n`);
|
|
192
|
+
process.stdout.write(` role/mode ${report.role} / ${report.mode}\n`);
|
|
193
|
+
process.stdout.write(` approval ${report.approvalStatus}${report.approvalMessage ? ' — ' + report.approvalMessage : ''}\n`);
|
|
194
|
+
if (report.approvalExpiry) {
|
|
195
|
+
const e = report.approvalExpiry;
|
|
196
|
+
const detail = e.expiresAt ? ` — ${e.expiresAt}` : '';
|
|
197
|
+
process.stdout.write(` expiry ${e.status}${detail}\n`);
|
|
198
|
+
if (e.noExpiryWarning)
|
|
199
|
+
process.stdout.write(` warning ${e.noExpiryWarning}\n`);
|
|
200
|
+
}
|
|
201
|
+
process.stdout.write(` pass ${report.pass ? 'yes' : 'no'}\n`);
|
|
202
|
+
if (report.blockingGates.length)
|
|
203
|
+
process.stdout.write(` blocking ${report.blockingGates.join(', ')}\n`);
|
|
204
|
+
if (report.warnGates.length)
|
|
205
|
+
process.stdout.write(` warnings ${report.warnGates.join(', ')}\n`);
|
|
206
|
+
return report.pass ? 0 : 1;
|
|
207
|
+
},
|
|
208
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ICommandHandler } from '../command-registry.js';
|
|
2
|
+
export declare const contractTemplateListCommand: ICommandHandler;
|
|
3
|
+
export declare const contractTemplateGetCommand: ICommandHandler;
|
|
4
|
+
export declare const contractTemplateRenderCommand: ICommandHandler;
|
|
5
|
+
export declare const contractTemplateRecommendCommand: ICommandHandler;
|
|
6
|
+
/** Dispatcher for `shrk contract template <list|get|render|recommend>`. */
|
|
7
|
+
export declare const contractTemplateCommand: ICommandHandler;
|
|
8
|
+
//# sourceMappingURL=contract-templates.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-templates.command.d.ts","sourceRoot":"","sources":["../../src/commands/contract-templates.command.ts"],"names":[],"mappings":"AASA,OAAO,EAIL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AAGhC,eAAO,MAAM,2BAA2B,EAAE,eAiBzC,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,eAgCxC,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,eAuC3C,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE,eA0B9C,CAAC;AAEF,2EAA2E;AAC3E,eAAO,MAAM,uBAAuB,EAAE,eAkBrC,CAAC"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import * as nodePath from 'node:path';
|
|
3
|
+
import { getContractTemplate, listContractTemplates, recommendContractTemplate, renderContractTemplateMarkdown, renderContractTemplateText, } from '@shrkcrft/inspector';
|
|
4
|
+
import { flagBool, flagString, resolveCwd, } from "../command-registry.js";
|
|
5
|
+
import { asJson } from "../output/format-output.js";
|
|
6
|
+
export const contractTemplateListCommand = {
|
|
7
|
+
name: 'list',
|
|
8
|
+
description: 'List built-in contract templates. Read-only.',
|
|
9
|
+
usage: 'shrk contract template list [--json]',
|
|
10
|
+
async run(args) {
|
|
11
|
+
const list = listContractTemplates();
|
|
12
|
+
if (flagBool(args, 'json')) {
|
|
13
|
+
process.stdout.write(asJson(list) + '\n');
|
|
14
|
+
return 0;
|
|
15
|
+
}
|
|
16
|
+
for (const t of list) {
|
|
17
|
+
process.stdout.write(`${t.id.padEnd(32)} ${t.title}\n`);
|
|
18
|
+
process.stdout.write(` role: ${t.role} / mode: ${t.mode}\n`);
|
|
19
|
+
process.stdout.write(` ${t.description}\n\n`);
|
|
20
|
+
}
|
|
21
|
+
return 0;
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
export const contractTemplateGetCommand = {
|
|
25
|
+
name: 'get',
|
|
26
|
+
description: 'Show a single contract template by id. Read-only.',
|
|
27
|
+
usage: 'shrk contract template get <id> [--format text|markdown|json] [--output <file>]',
|
|
28
|
+
async run(args) {
|
|
29
|
+
const id = args.positional[0];
|
|
30
|
+
if (!id) {
|
|
31
|
+
process.stderr.write('Usage: shrk contract template get <id>\n');
|
|
32
|
+
return 2;
|
|
33
|
+
}
|
|
34
|
+
const tpl = getContractTemplate(id);
|
|
35
|
+
if (!tpl) {
|
|
36
|
+
process.stderr.write(`Unknown template id: ${id}\n`);
|
|
37
|
+
return 1;
|
|
38
|
+
}
|
|
39
|
+
const format = (flagString(args, 'format') ?? 'text').toLowerCase();
|
|
40
|
+
let body;
|
|
41
|
+
if (format === 'json' || flagBool(args, 'json'))
|
|
42
|
+
body = asJson(tpl) + '\n';
|
|
43
|
+
else if (format === 'markdown' || format === 'md')
|
|
44
|
+
body = renderContractTemplateMarkdown(tpl);
|
|
45
|
+
else
|
|
46
|
+
body = renderContractTemplateText(tpl);
|
|
47
|
+
const cwd = resolveCwd(args);
|
|
48
|
+
const out = flagString(args, 'output');
|
|
49
|
+
if (out) {
|
|
50
|
+
const abs = nodePath.isAbsolute(out) ? out : nodePath.resolve(cwd, out);
|
|
51
|
+
mkdirSync(nodePath.dirname(abs), { recursive: true });
|
|
52
|
+
writeFileSync(abs, body, 'utf8');
|
|
53
|
+
process.stdout.write(`Wrote ${abs}\n`);
|
|
54
|
+
return 0;
|
|
55
|
+
}
|
|
56
|
+
process.stdout.write(body);
|
|
57
|
+
return 0;
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
export const contractTemplateRenderCommand = {
|
|
61
|
+
name: 'render',
|
|
62
|
+
description: 'Render a contract template against a specific task (does not save). Read-only.',
|
|
63
|
+
usage: 'shrk contract template render <id> --task "<task>" [--role ai-agent|developer|...] [--format text|markdown|json] [--output <file>]',
|
|
64
|
+
async run(args) {
|
|
65
|
+
const id = args.positional[0];
|
|
66
|
+
if (!id) {
|
|
67
|
+
process.stderr.write('Usage: shrk contract template render <id> --task "<task>"\n');
|
|
68
|
+
return 2;
|
|
69
|
+
}
|
|
70
|
+
const task = flagString(args, 'task');
|
|
71
|
+
if (!task) {
|
|
72
|
+
process.stderr.write('--task "<task>" is required.\n');
|
|
73
|
+
return 2;
|
|
74
|
+
}
|
|
75
|
+
const tpl = getContractTemplate(id);
|
|
76
|
+
if (!tpl) {
|
|
77
|
+
process.stderr.write(`Unknown template id: ${id}\n`);
|
|
78
|
+
return 1;
|
|
79
|
+
}
|
|
80
|
+
const format = (flagString(args, 'format') ?? 'markdown').toLowerCase();
|
|
81
|
+
let body;
|
|
82
|
+
if (format === 'json' || flagBool(args, 'json'))
|
|
83
|
+
body = asJson({ template: tpl, task }) + '\n';
|
|
84
|
+
else if (format === 'text' || format === 'txt')
|
|
85
|
+
body = renderContractTemplateText(tpl, task);
|
|
86
|
+
else
|
|
87
|
+
body = renderContractTemplateMarkdown(tpl, task);
|
|
88
|
+
const cwd = resolveCwd(args);
|
|
89
|
+
const out = flagString(args, 'output');
|
|
90
|
+
if (out) {
|
|
91
|
+
const abs = nodePath.isAbsolute(out) ? out : nodePath.resolve(cwd, out);
|
|
92
|
+
mkdirSync(nodePath.dirname(abs), { recursive: true });
|
|
93
|
+
writeFileSync(abs, body, 'utf8');
|
|
94
|
+
process.stdout.write(`Wrote ${abs}\n`);
|
|
95
|
+
return 0;
|
|
96
|
+
}
|
|
97
|
+
process.stdout.write(body);
|
|
98
|
+
return 0;
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
export const contractTemplateRecommendCommand = {
|
|
102
|
+
name: 'recommend',
|
|
103
|
+
description: 'Recommend contract templates for a task. Read-only.',
|
|
104
|
+
usage: 'shrk contract template recommend "<task>" [--role <role>] [--intent <kind>] [--json]',
|
|
105
|
+
async run(args) {
|
|
106
|
+
const task = args.positional.join(' ').trim();
|
|
107
|
+
if (!task) {
|
|
108
|
+
process.stderr.write('Usage: shrk contract template recommend "<task>"\n');
|
|
109
|
+
return 2;
|
|
110
|
+
}
|
|
111
|
+
const role = flagString(args, 'role');
|
|
112
|
+
const intent = flagString(args, 'intent');
|
|
113
|
+
const matches = recommendContractTemplate(task, role, intent);
|
|
114
|
+
if (flagBool(args, 'json')) {
|
|
115
|
+
process.stdout.write(asJson(matches) + '\n');
|
|
116
|
+
return 0;
|
|
117
|
+
}
|
|
118
|
+
if (matches.length === 0) {
|
|
119
|
+
process.stdout.write('No contract templates matched.\n');
|
|
120
|
+
return 0;
|
|
121
|
+
}
|
|
122
|
+
for (const m of matches) {
|
|
123
|
+
process.stdout.write(`${m.match.padEnd(8)} ${m.template.id} — ${m.reason}\n`);
|
|
124
|
+
}
|
|
125
|
+
return 0;
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
/** Dispatcher for `shrk contract template <list|get|render|recommend>`. */
|
|
129
|
+
export const contractTemplateCommand = {
|
|
130
|
+
name: 'template',
|
|
131
|
+
description: 'Reusable agent-contract templates (list / get / render / recommend). Read-only.',
|
|
132
|
+
usage: 'shrk contract template <list|get|render|recommend> [...]',
|
|
133
|
+
async run(args) {
|
|
134
|
+
const sub = args.positional[0];
|
|
135
|
+
if (!sub) {
|
|
136
|
+
process.stderr.write('Usage: shrk contract template <list|get|render|recommend>\n');
|
|
137
|
+
return 2;
|
|
138
|
+
}
|
|
139
|
+
const next = { ...args, positional: args.positional.slice(1) };
|
|
140
|
+
if (sub === 'list')
|
|
141
|
+
return (await contractTemplateListCommand.run(next));
|
|
142
|
+
if (sub === 'get')
|
|
143
|
+
return (await contractTemplateGetCommand.run(next));
|
|
144
|
+
if (sub === 'render')
|
|
145
|
+
return (await contractTemplateRenderCommand.run(next));
|
|
146
|
+
if (sub === 'recommend')
|
|
147
|
+
return (await contractTemplateRecommendCommand.run(next));
|
|
148
|
+
process.stderr.write(`Unknown contract template subcommand: ${sub}\n`);
|
|
149
|
+
return 2;
|
|
150
|
+
},
|
|
151
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.command.d.ts","sourceRoot":"","sources":["../../src/commands/contract.command.ts"],"names":[],"mappings":"AASA,OAAO,EAIL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AA4BhC,eAAO,MAAM,eAAe,EAAE,eAqF7B,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import * as nodePath from 'node:path';
|
|
3
|
+
import { buildAgentContract, inspectSharkcraft, renderAgentContractHtml, renderAgentContractMarkdown, renderAgentContractText, } from '@shrkcrft/inspector';
|
|
4
|
+
import { flagBool, flagString, resolveCwd, } from "../command-registry.js";
|
|
5
|
+
import { asJson } from "../output/format-output.js";
|
|
6
|
+
import { contractApproveCommand, contractCheckCommand, contractStatusCommand, } from "./contract-gate.command.js";
|
|
7
|
+
import { contractTemplateCommand } from "./contract-templates.command.js";
|
|
8
|
+
function parseFiles(args) {
|
|
9
|
+
const raw = flagString(args, 'files');
|
|
10
|
+
if (!raw)
|
|
11
|
+
return [];
|
|
12
|
+
return raw
|
|
13
|
+
.split(',')
|
|
14
|
+
.map((f) => f.trim())
|
|
15
|
+
.filter((f) => f.length > 0);
|
|
16
|
+
}
|
|
17
|
+
function safeSlug(s) {
|
|
18
|
+
return (s
|
|
19
|
+
.toLowerCase()
|
|
20
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
21
|
+
.replace(/^-|-$/g, '')
|
|
22
|
+
.slice(0, 64) || 'contract');
|
|
23
|
+
}
|
|
24
|
+
export const contractCommand = {
|
|
25
|
+
name: 'contract',
|
|
26
|
+
description: 'Build a deterministic agent contract for a task (intent + risk + impact + ownership + boundaries + policies + playbooks). Read-only unless --save (writes only to .sharkcraft/contracts/).',
|
|
27
|
+
usage: 'shrk contract "<task>" [--role developer|reviewer|architect|release-manager|security|ai-agent] [--mode conservative|balanced|aggressive] [--files a,b,c] [--since <ref>] [--staged] [--format text|markdown|html|json] [--output <file>] [--save]',
|
|
28
|
+
async run(args) {
|
|
29
|
+
// Dispatch to subcommands (check / approve / status / template).
|
|
30
|
+
const first = args.positional[0];
|
|
31
|
+
if (first === 'check' || first === 'approve' || first === 'status') {
|
|
32
|
+
const sub = first === 'check'
|
|
33
|
+
? contractCheckCommand
|
|
34
|
+
: first === 'approve'
|
|
35
|
+
? contractApproveCommand
|
|
36
|
+
: contractStatusCommand;
|
|
37
|
+
return (await sub.run({ ...args, positional: args.positional.slice(1) }));
|
|
38
|
+
}
|
|
39
|
+
if (first === 'template') {
|
|
40
|
+
return (await contractTemplateCommand.run({ ...args, positional: args.positional.slice(1) }));
|
|
41
|
+
}
|
|
42
|
+
const task = args.positional.join(' ').trim();
|
|
43
|
+
if (!task) {
|
|
44
|
+
process.stderr.write('Usage: shrk contract "<task>" | shrk contract {check|approve|status} <contract.json>\n');
|
|
45
|
+
return 2;
|
|
46
|
+
}
|
|
47
|
+
const cwd = resolveCwd(args);
|
|
48
|
+
const inspection = await inspectSharkcraft({ cwd });
|
|
49
|
+
const role = flagString(args, 'role');
|
|
50
|
+
const mode = flagString(args, 'mode');
|
|
51
|
+
const files = parseFiles(args);
|
|
52
|
+
const since = flagString(args, 'since');
|
|
53
|
+
const staged = flagBool(args, 'staged');
|
|
54
|
+
const contract = await buildAgentContract(task, inspection, {
|
|
55
|
+
...(role ? { role } : {}),
|
|
56
|
+
...(mode ? { mode } : {}),
|
|
57
|
+
...(files.length > 0 ? { files } : {}),
|
|
58
|
+
...(since ? { since } : {}),
|
|
59
|
+
...(staged ? { staged: true } : {}),
|
|
60
|
+
});
|
|
61
|
+
const format = (flagString(args, 'format') ?? 'text').toLowerCase();
|
|
62
|
+
let body;
|
|
63
|
+
let extension;
|
|
64
|
+
if (format === 'json' || flagBool(args, 'json')) {
|
|
65
|
+
body = asJson(contract) + '\n';
|
|
66
|
+
extension = 'json';
|
|
67
|
+
}
|
|
68
|
+
else if (format === 'markdown' || format === 'md') {
|
|
69
|
+
body = renderAgentContractMarkdown(contract);
|
|
70
|
+
extension = 'md';
|
|
71
|
+
}
|
|
72
|
+
else if (format === 'html') {
|
|
73
|
+
body = renderAgentContractHtml(contract);
|
|
74
|
+
extension = 'html';
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
body = renderAgentContractText(contract);
|
|
78
|
+
extension = 'txt';
|
|
79
|
+
}
|
|
80
|
+
const output = flagString(args, 'output');
|
|
81
|
+
if (output) {
|
|
82
|
+
const abs = nodePath.isAbsolute(output) ? output : nodePath.resolve(cwd, output);
|
|
83
|
+
mkdirSync(nodePath.dirname(abs), { recursive: true });
|
|
84
|
+
writeFileSync(abs, body, 'utf8');
|
|
85
|
+
process.stdout.write(`Wrote ${abs}\n`);
|
|
86
|
+
return 0;
|
|
87
|
+
}
|
|
88
|
+
if (flagBool(args, 'save')) {
|
|
89
|
+
// Writes only under .sharkcraft/contracts/ — never anywhere else.
|
|
90
|
+
const dir = nodePath.join(cwd, '.sharkcraft', 'contracts');
|
|
91
|
+
mkdirSync(dir, { recursive: true });
|
|
92
|
+
const ts = new Date().toISOString().replace(/[:.]/g, '-');
|
|
93
|
+
const file = nodePath.join(dir, `${ts}-${safeSlug(task)}.${extension}`);
|
|
94
|
+
writeFileSync(file, body, 'utf8');
|
|
95
|
+
// Also save the canonical JSON alongside so downstream tools can read it.
|
|
96
|
+
if (extension !== 'json') {
|
|
97
|
+
writeFileSync(file.replace(/\.[^.]+$/, '.json'), asJson(contract) + '\n', 'utf8');
|
|
98
|
+
}
|
|
99
|
+
process.stdout.write(`Wrote ${file}\n`);
|
|
100
|
+
return 0;
|
|
101
|
+
}
|
|
102
|
+
process.stdout.write(body);
|
|
103
|
+
return 0;
|
|
104
|
+
},
|
|
105
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ICommandHandler } from '../command-registry.js';
|
|
2
|
+
export declare const conventionsListCommand: ICommandHandler;
|
|
3
|
+
export declare const conventionsGetCommand: ICommandHandler;
|
|
4
|
+
export declare const conventionsDoctorCommand: ICommandHandler;
|
|
5
|
+
export declare const conventionsCheckCommand: ICommandHandler;
|
|
6
|
+
export declare const conventionsExplainCommand: ICommandHandler;
|
|
7
|
+
export declare const conventionsCommand: ICommandHandler;
|
|
8
|
+
//# sourceMappingURL=conventions.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conventions.command.d.ts","sourceRoot":"","sources":["../../src/commands/conventions.command.ts"],"names":[],"mappings":"AAcA,OAAO,EAKL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AAGhC,eAAO,MAAM,sBAAsB,EAAE,eAgCpC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,eAsCnC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,eAsBtC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,eAkCrC,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,eAOvC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,eAgBhC,CAAC"}
|