@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,646 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import * as nodePath from 'node:path';
|
|
3
|
+
import { analyzeImportGraph, buildAgentBrief, buildContradictionReport, buildGeneratedCodeReport, buildRepositoryKnowledgeModel, buildTaskPacket, buildTaskRiskReport, classifyChangeIntent, detectLanguageProfiles, getChangedFiles, getStatusSummary, inspectSharkcraft, isGitRepo, listConstructs, loadRepositoryMemory, } from '@shrkcrft/inspector';
|
|
4
|
+
import { flagBool, flagString, flagList, resolveCwd, } from "../command-registry.js";
|
|
5
|
+
import { asJson, header, kv } from "../output/format-output.js";
|
|
6
|
+
const CONTEXT_BASE = nodePath.join('.sharkcraft', 'context');
|
|
7
|
+
function slug(s) {
|
|
8
|
+
return s
|
|
9
|
+
.toLowerCase()
|
|
10
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
11
|
+
.replace(/(^-+|-+$)/g, '')
|
|
12
|
+
.slice(0, 60) || 'task';
|
|
13
|
+
}
|
|
14
|
+
export const understandTaskCommand = {
|
|
15
|
+
name: 'understand-task',
|
|
16
|
+
description: 'Build a task-specific context bundle: intent + relevant rules + likely files + risks + recommended commands. Read-only unless --save is passed.',
|
|
17
|
+
usage: 'shrk [--cwd <dir>] understand-task "<task>" [--format text|markdown|json] [--save] [--preset <id>]',
|
|
18
|
+
async run(args) {
|
|
19
|
+
const task = args.positional[0] ?? flagString(args, 'task');
|
|
20
|
+
if (!task) {
|
|
21
|
+
process.stderr.write('Usage: shrk understand-task "<task>"\n');
|
|
22
|
+
return 2;
|
|
23
|
+
}
|
|
24
|
+
const cwd = resolveCwd(args);
|
|
25
|
+
const format = (flagString(args, 'format') ?? 'text').toLowerCase();
|
|
26
|
+
const save = flagBool(args, 'save');
|
|
27
|
+
const presets = flagList(args, 'preset');
|
|
28
|
+
const explain = flagBool(args, 'explain');
|
|
29
|
+
const inspection = await inspectSharkcraft({ cwd });
|
|
30
|
+
const packet = buildTaskPacket(inspection, task);
|
|
31
|
+
const intent = await classifyChangeIntent(task, inspection);
|
|
32
|
+
const risk = await buildTaskRiskReport(task, inspection);
|
|
33
|
+
const brief = await buildAgentBrief(inspection, { task });
|
|
34
|
+
const model = await buildRepositoryKnowledgeModel({
|
|
35
|
+
inspection,
|
|
36
|
+
task,
|
|
37
|
+
forcedPresetIds: presets,
|
|
38
|
+
});
|
|
39
|
+
const ranking = await collectLikelyFilesV2({ inspection, task, model, cwd });
|
|
40
|
+
const data = {
|
|
41
|
+
task,
|
|
42
|
+
intent,
|
|
43
|
+
relevantRules: packet.relevantRules.map((r) => ({ id: r.id, title: r.title, priority: String(r.priority ?? 'medium') })),
|
|
44
|
+
relevantPaths: packet.relevantPaths.map((p) => ({ id: p.id, title: p.title })),
|
|
45
|
+
likelyFiles: ranking.files.map((f) => f.path),
|
|
46
|
+
likelyFilesExplained: ranking.files.slice(0, 30),
|
|
47
|
+
likelyConstructs: ranking.constructs,
|
|
48
|
+
likelyLanguages: ranking.languages,
|
|
49
|
+
likelyTests: ranking.tests,
|
|
50
|
+
riskyGeneratedFiles: ranking.generatedFiles,
|
|
51
|
+
stabilityWarnings: ranking.stabilityWarnings,
|
|
52
|
+
memoryWarnings: ranking.memoryWarnings,
|
|
53
|
+
suggestedFirstCommands: ranking.suggestedFirstCommands,
|
|
54
|
+
confidence: ranking.confidence,
|
|
55
|
+
risks: risk.reasons.map((r) => r.message),
|
|
56
|
+
riskLevel: risk.riskLevel,
|
|
57
|
+
requiredValidations: packet.recommendedCliCommands.map((c) => ({ command: c, label: c })),
|
|
58
|
+
recommendedContract: 'shrk contract create --task "<task>" --save',
|
|
59
|
+
recommendedPlaybook: packet.recommendedPipelines[0]?.pipelineId ?? null,
|
|
60
|
+
nextSafeCommand: pickNextCommand(brief) ?? packet.recommendedCliCommands[0] ?? 'shrk context --task "<task>"',
|
|
61
|
+
relatedModelSections: model.selectedSections,
|
|
62
|
+
transformationalIntents: model.transformationalIntents,
|
|
63
|
+
explain,
|
|
64
|
+
};
|
|
65
|
+
if (save) {
|
|
66
|
+
const dir = nodePath.join(cwd, CONTEXT_BASE, 'task-contexts');
|
|
67
|
+
if (!existsSync(dir))
|
|
68
|
+
mkdirSync(dir, { recursive: true });
|
|
69
|
+
const file = nodePath.join(dir, `${slug(task)}.json`);
|
|
70
|
+
writeFileSync(file, asJson(data), 'utf8');
|
|
71
|
+
process.stderr.write(`wrote ${file}\n`);
|
|
72
|
+
}
|
|
73
|
+
if (format === 'json') {
|
|
74
|
+
process.stdout.write(asJson(data) + '\n');
|
|
75
|
+
return 0;
|
|
76
|
+
}
|
|
77
|
+
if (format === 'markdown') {
|
|
78
|
+
process.stdout.write(renderMarkdown(data) + '\n');
|
|
79
|
+
return 0;
|
|
80
|
+
}
|
|
81
|
+
renderText(data);
|
|
82
|
+
return 0;
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
export const validateChangeCommand = {
|
|
86
|
+
name: 'validate-change',
|
|
87
|
+
description: 'Validate a proposed/staged change: boundary violations, missing tests, policy gates, memory risk, contradictions. Read-only.',
|
|
88
|
+
usage: 'shrk [--cwd <dir>] validate-change [--files a,b,c] [--since <ref>] [--staged] [--format text|markdown|json]',
|
|
89
|
+
async run(args) {
|
|
90
|
+
const cwd = resolveCwd(args);
|
|
91
|
+
const format = (flagString(args, 'format') ?? 'text').toLowerCase();
|
|
92
|
+
const files = flagList(args, 'files');
|
|
93
|
+
const since = flagString(args, 'since');
|
|
94
|
+
const staged = flagBool(args, 'staged');
|
|
95
|
+
const json = flagBool(args, 'json');
|
|
96
|
+
const inspection = await inspectSharkcraft({ cwd });
|
|
97
|
+
let changed = [...files];
|
|
98
|
+
if (changed.length === 0) {
|
|
99
|
+
if (isGitRepo(cwd)) {
|
|
100
|
+
changed = getChangedFiles(cwd, { staged, ...(since ? { since } : {}) });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// Fallback path through getStatusSummary not necessary — getChangedFiles already covers it.
|
|
104
|
+
void getStatusSummary;
|
|
105
|
+
const contradictions = buildContradictionReport({ inspection });
|
|
106
|
+
const generated = buildGeneratedCodeReport({ inspection });
|
|
107
|
+
const generatedPaths = new Set(generated.generatedFiles.map((f) => f.path));
|
|
108
|
+
const boundaryHits = changed.filter((f) => looksLikeBoundaryViolation(f));
|
|
109
|
+
const generatedHits = changed.filter((f) => generatedPaths.has(f) || f.endsWith('.d.ts'));
|
|
110
|
+
const missingTests = changed.filter(missingTestNeighbour(inspection));
|
|
111
|
+
const docHits = changed.filter((f) => f.endsWith('.md'));
|
|
112
|
+
const docContradictions = contradictions.findings.filter((c) => docHits.includes(c.source));
|
|
113
|
+
const result = {
|
|
114
|
+
changedFiles: changed,
|
|
115
|
+
boundaryHits,
|
|
116
|
+
generatedHits,
|
|
117
|
+
missingTests,
|
|
118
|
+
docContradictions: docContradictions.map((c) => ({ source: c.source, line: c.line, message: c.message })),
|
|
119
|
+
requiredValidations: [
|
|
120
|
+
'bun x tsc -p tsconfig.base.json --noEmit',
|
|
121
|
+
'bun test',
|
|
122
|
+
'shrk check boundaries',
|
|
123
|
+
],
|
|
124
|
+
verdict: boundaryHits.length === 0 && generatedHits.length === 0 ? 'pass' : 'review',
|
|
125
|
+
};
|
|
126
|
+
if (json || format === 'json') {
|
|
127
|
+
process.stdout.write(asJson(result) + '\n');
|
|
128
|
+
return 0;
|
|
129
|
+
}
|
|
130
|
+
process.stdout.write(header('Validate change'));
|
|
131
|
+
process.stdout.write(kv('files', changed.length) + '\n');
|
|
132
|
+
process.stdout.write(kv('boundary hits', boundaryHits.length) + '\n');
|
|
133
|
+
process.stdout.write(kv('generated hits', generatedHits.length) + '\n');
|
|
134
|
+
process.stdout.write(kv('missing tests', missingTests.length) + '\n');
|
|
135
|
+
process.stdout.write(kv('doc contradictions', docContradictions.length) + '\n');
|
|
136
|
+
process.stdout.write(kv('verdict', result.verdict) + '\n');
|
|
137
|
+
if (boundaryHits.length > 0) {
|
|
138
|
+
process.stdout.write('\nBoundary-suspect files:\n');
|
|
139
|
+
for (const f of boundaryHits.slice(0, 20))
|
|
140
|
+
process.stdout.write(` - ${f}\n`);
|
|
141
|
+
}
|
|
142
|
+
if (generatedHits.length > 0) {
|
|
143
|
+
process.stdout.write('\nGenerated-file edits (review required):\n');
|
|
144
|
+
for (const f of generatedHits.slice(0, 20))
|
|
145
|
+
process.stdout.write(` - ${f}\n`);
|
|
146
|
+
}
|
|
147
|
+
return 0;
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
// Subcommands grafted onto the top-level `context` command.
|
|
151
|
+
export const contextBuildCommand = {
|
|
152
|
+
name: 'build',
|
|
153
|
+
description: 'Build and (optionally) save a task-specific context bundle under .sharkcraft/context/.',
|
|
154
|
+
usage: 'shrk context build --task "<task>" [--preset <id>] [--format text|markdown|json]',
|
|
155
|
+
async run(args) {
|
|
156
|
+
const task = flagString(args, 'task');
|
|
157
|
+
if (!task) {
|
|
158
|
+
process.stderr.write('Missing --task\n');
|
|
159
|
+
return 2;
|
|
160
|
+
}
|
|
161
|
+
const cwd = resolveCwd(args);
|
|
162
|
+
const format = (flagString(args, 'format') ?? 'text').toLowerCase();
|
|
163
|
+
const presets = flagList(args, 'preset');
|
|
164
|
+
const inspection = await inspectSharkcraft({ cwd });
|
|
165
|
+
const packet = buildTaskPacket(inspection, task);
|
|
166
|
+
const model = await buildRepositoryKnowledgeModel({
|
|
167
|
+
inspection,
|
|
168
|
+
task,
|
|
169
|
+
forcedPresetIds: presets,
|
|
170
|
+
});
|
|
171
|
+
const dir = nodePath.join(cwd, CONTEXT_BASE, 'task-contexts');
|
|
172
|
+
if (!existsSync(dir))
|
|
173
|
+
mkdirSync(dir, { recursive: true });
|
|
174
|
+
const baseName = slug(task);
|
|
175
|
+
const jsonFile = nodePath.join(dir, `${baseName}.json`);
|
|
176
|
+
const mdFile = nodePath.join(dir, `${baseName}.md`);
|
|
177
|
+
const bundle = {
|
|
178
|
+
task,
|
|
179
|
+
generatedAt: new Date().toISOString(),
|
|
180
|
+
rules: packet.relevantRules.map((r) => ({ id: r.id, title: r.title })),
|
|
181
|
+
paths: packet.relevantPaths.map((p) => ({ id: p.id, title: p.title })),
|
|
182
|
+
templates: packet.relevantTemplates.map((t) => ({ id: t.id, name: t.name ?? t.id })),
|
|
183
|
+
modelSections: model.selectedSections,
|
|
184
|
+
modelPresets: model.presets.map((p) => p.preset.id),
|
|
185
|
+
recommendedCommands: packet.recommendedCliCommands.map((c) => ({ command: c, label: c })),
|
|
186
|
+
};
|
|
187
|
+
writeFileSync(jsonFile, asJson(bundle), 'utf8');
|
|
188
|
+
writeFileSync(mdFile, renderBundleMarkdown(bundle), 'utf8');
|
|
189
|
+
const statusFile = nodePath.join(cwd, CONTEXT_BASE, 'status.json');
|
|
190
|
+
const statusDir = nodePath.dirname(statusFile);
|
|
191
|
+
if (!existsSync(statusDir))
|
|
192
|
+
mkdirSync(statusDir, { recursive: true });
|
|
193
|
+
writeFileSync(statusFile, asJson({
|
|
194
|
+
lastTask: task,
|
|
195
|
+
lastBuilt: bundle.generatedAt,
|
|
196
|
+
bundles: [jsonFile, mdFile],
|
|
197
|
+
}), 'utf8');
|
|
198
|
+
if (format === 'json') {
|
|
199
|
+
process.stdout.write(asJson({ jsonFile, mdFile, bundle }) + '\n');
|
|
200
|
+
return 0;
|
|
201
|
+
}
|
|
202
|
+
process.stdout.write(header('Context built'));
|
|
203
|
+
process.stdout.write(kv('json', jsonFile) + '\n');
|
|
204
|
+
process.stdout.write(kv('markdown', mdFile) + '\n');
|
|
205
|
+
return 0;
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
export const contextRefreshCommand = {
|
|
209
|
+
name: 'refresh',
|
|
210
|
+
description: 'Re-build the most recently-saved task context. Reads .sharkcraft/context/status.json.',
|
|
211
|
+
usage: 'shrk context refresh',
|
|
212
|
+
async run(args) {
|
|
213
|
+
const cwd = resolveCwd(args);
|
|
214
|
+
const file = nodePath.join(cwd, CONTEXT_BASE, 'status.json');
|
|
215
|
+
if (!existsSync(file)) {
|
|
216
|
+
process.stderr.write('No saved task context to refresh. Run `shrk context build --task "..."` first.\n');
|
|
217
|
+
return 1;
|
|
218
|
+
}
|
|
219
|
+
const { readFileSync } = await import('node:fs');
|
|
220
|
+
const status = JSON.parse(readFileSync(file, 'utf8'));
|
|
221
|
+
if (!status.lastTask) {
|
|
222
|
+
process.stderr.write('No lastTask in status.json.\n');
|
|
223
|
+
return 1;
|
|
224
|
+
}
|
|
225
|
+
const flags = new Map(args.flags);
|
|
226
|
+
flags.set('task', status.lastTask);
|
|
227
|
+
return contextBuildCommand.run({ ...args, flags });
|
|
228
|
+
},
|
|
229
|
+
};
|
|
230
|
+
export const contextStatusCommand = {
|
|
231
|
+
name: 'status',
|
|
232
|
+
description: 'Show the current task context status (last task / built / bundles).',
|
|
233
|
+
usage: 'shrk context status',
|
|
234
|
+
async run(args) {
|
|
235
|
+
const cwd = resolveCwd(args);
|
|
236
|
+
const file = nodePath.join(cwd, CONTEXT_BASE, 'status.json');
|
|
237
|
+
if (!existsSync(file)) {
|
|
238
|
+
process.stdout.write('No context status yet.\n');
|
|
239
|
+
return 0;
|
|
240
|
+
}
|
|
241
|
+
const { readFileSync } = await import('node:fs');
|
|
242
|
+
const body = readFileSync(file, 'utf8');
|
|
243
|
+
if (flagBool(args, 'json')) {
|
|
244
|
+
process.stdout.write(body + '\n');
|
|
245
|
+
return 0;
|
|
246
|
+
}
|
|
247
|
+
process.stdout.write(body + '\n');
|
|
248
|
+
return 0;
|
|
249
|
+
},
|
|
250
|
+
};
|
|
251
|
+
function tokenize(task) {
|
|
252
|
+
return Array.from(new Set(task.toLowerCase().split(/[^a-z0-9]+/).filter((t) => t.length >= 3)));
|
|
253
|
+
}
|
|
254
|
+
function languagesFromTask(task) {
|
|
255
|
+
const lower = task.toLowerCase();
|
|
256
|
+
const out = [];
|
|
257
|
+
if (/\bangular\b|\bcomponent\b|\bsignal\b|\bdirective\b/.test(lower))
|
|
258
|
+
out.push('typescript');
|
|
259
|
+
if (/\btypescript\b|\b\.ts\b/.test(lower))
|
|
260
|
+
out.push('typescript');
|
|
261
|
+
if (/\bjava\b|\bspring\b/.test(lower))
|
|
262
|
+
out.push('java');
|
|
263
|
+
if (/\b(c#|csharp|dotnet|asp\.?net)\b/.test(lower))
|
|
264
|
+
out.push('csharp');
|
|
265
|
+
if (/\bpython\b|\bdjango\b|\bfastapi\b|\bflask\b/.test(lower))
|
|
266
|
+
out.push('python');
|
|
267
|
+
if (/\bgolang\b|\bgo\s+(service|module|test)\b/.test(lower))
|
|
268
|
+
out.push('go');
|
|
269
|
+
if (/\brust\b|\bcargo\b/.test(lower))
|
|
270
|
+
out.push('rust');
|
|
271
|
+
return Array.from(new Set(out));
|
|
272
|
+
}
|
|
273
|
+
function constructTokens(c) {
|
|
274
|
+
const id = c.id.toLowerCase();
|
|
275
|
+
const title = (c.title ?? '').toLowerCase();
|
|
276
|
+
return Array.from(new Set([
|
|
277
|
+
...id.split(/[^a-z0-9]+/).filter((t) => t.length >= 3),
|
|
278
|
+
...title.split(/[^a-z0-9]+/).filter((t) => t.length >= 3),
|
|
279
|
+
]));
|
|
280
|
+
}
|
|
281
|
+
async function collectLikelyFilesV2(input) {
|
|
282
|
+
const { inspection, task, model } = input;
|
|
283
|
+
const tokens = tokenize(task);
|
|
284
|
+
const allFiles = inspection.sourceFiles;
|
|
285
|
+
const scoreByPath = new Map();
|
|
286
|
+
const bump = (path, score, reason) => {
|
|
287
|
+
const cur = scoreByPath.get(path) ?? { score: 0, reasons: new Set() };
|
|
288
|
+
cur.score += score;
|
|
289
|
+
cur.reasons.add(reason);
|
|
290
|
+
scoreByPath.set(path, cur);
|
|
291
|
+
};
|
|
292
|
+
// 1) Token matching (baseline, but now scored by token-strength).
|
|
293
|
+
for (const f of allFiles) {
|
|
294
|
+
const lf = f.toLowerCase();
|
|
295
|
+
for (const t of tokens) {
|
|
296
|
+
if (lf.includes(t))
|
|
297
|
+
bump(f, t.length >= 6 ? 4 : 2, `token "${t}" appears in path`);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
// 2) Construct vocabulary + path matching.
|
|
301
|
+
let constructs = [];
|
|
302
|
+
try {
|
|
303
|
+
constructs = listConstructs(inspection);
|
|
304
|
+
}
|
|
305
|
+
catch { /* ignore */ }
|
|
306
|
+
const constructMatches = [];
|
|
307
|
+
for (const c of constructs) {
|
|
308
|
+
const ctokens = constructTokens(c);
|
|
309
|
+
const overlap = ctokens.filter((t) => tokens.includes(t));
|
|
310
|
+
if (overlap.length === 0)
|
|
311
|
+
continue;
|
|
312
|
+
constructMatches.push({ id: c.id, title: c.title, reason: `construct vocabulary overlap: ${overlap.join(', ')}` });
|
|
313
|
+
const filesForConstruct = [...(c.files ?? []), ...(c.publicApi ?? [])];
|
|
314
|
+
for (const f of filesForConstruct)
|
|
315
|
+
bump(f, 6, `construct match: ${c.id}`);
|
|
316
|
+
}
|
|
317
|
+
// 3) Language vocabulary boost — files whose extension matches a detected
|
|
318
|
+
// language token bias toward inclusion.
|
|
319
|
+
const taskLangs = languagesFromTask(task);
|
|
320
|
+
const profile = detectLanguageProfiles(input.cwd);
|
|
321
|
+
const detectedLangs = profile.profiles.map((p) => p.language);
|
|
322
|
+
const langsToBoost = taskLangs.length > 0 ? taskLangs : detectedLangs;
|
|
323
|
+
for (const f of allFiles) {
|
|
324
|
+
const lf = f.toLowerCase();
|
|
325
|
+
for (const lang of langsToBoost) {
|
|
326
|
+
if ((lang === 'typescript' && /\.tsx?$/.test(lf)) || (lang === 'java' && lf.endsWith('.java'))
|
|
327
|
+
|| (lang === 'csharp' && lf.endsWith('.cs')) || (lang === 'python' && lf.endsWith('.py'))
|
|
328
|
+
|| (lang === 'go' && lf.endsWith('.go')) || (lang === 'rust' && lf.endsWith('.rs'))) {
|
|
329
|
+
if (scoreByPath.has(f))
|
|
330
|
+
bump(f, 1, `language match: ${lang}`);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
// 4) Dependency-graph proximity — neighbours of a matched file (callers/callees).
|
|
335
|
+
let graph;
|
|
336
|
+
try {
|
|
337
|
+
graph = analyzeImportGraph(input.cwd);
|
|
338
|
+
}
|
|
339
|
+
catch { /* ignore */ }
|
|
340
|
+
if (graph) {
|
|
341
|
+
const matchedSoFar = new Set([...scoreByPath.keys()]);
|
|
342
|
+
for (const node of graph.topFanIn) {
|
|
343
|
+
const file = node.file.replace(/\\/g, '/');
|
|
344
|
+
if (matchedSoFar.has(file)) {
|
|
345
|
+
bump(file, 2, `high fan-in (${node.in} importers)`);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
// 5) Stability-aware boost / penalty.
|
|
350
|
+
const stabilityWarnings = [];
|
|
351
|
+
for (const area of model.stableExperimentalDeprecated.areas) {
|
|
352
|
+
for (const f of [...scoreByPath.keys()]) {
|
|
353
|
+
if (!f.startsWith(area.path + '/') && f !== area.path)
|
|
354
|
+
continue;
|
|
355
|
+
if (area.kind === 'public-api' || area.kind === 'stable')
|
|
356
|
+
bump(f, 3, `under ${area.kind} area`);
|
|
357
|
+
if (area.kind === 'deprecated' || area.kind === 'legacy') {
|
|
358
|
+
bump(f, -3, `under ${area.kind} area`);
|
|
359
|
+
stabilityWarnings.push(`${f} is under ${area.kind} area "${area.path}"`);
|
|
360
|
+
}
|
|
361
|
+
if (area.kind === 'experimental') {
|
|
362
|
+
stabilityWarnings.push(`${f} is in experimental area "${area.path}"`);
|
|
363
|
+
}
|
|
364
|
+
if (area.kind === 'high-risk')
|
|
365
|
+
stabilityWarnings.push(`${f} sits in high-risk area "${area.path}"`);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
// 6) Memory hotspot boost (repo memory if available).
|
|
369
|
+
const memory = loadRepositoryMemory(input.cwd);
|
|
370
|
+
const memoryWarnings = [];
|
|
371
|
+
if (memory) {
|
|
372
|
+
for (const f of memory.files) {
|
|
373
|
+
const score = f.touchCount + f.conflictCount + f.failedValidationCount;
|
|
374
|
+
if (score < 2)
|
|
375
|
+
continue;
|
|
376
|
+
if (scoreByPath.has(f.path)) {
|
|
377
|
+
bump(f.path, Math.min(score, 6), `memory hotspot (${score}x)`);
|
|
378
|
+
if (f.conflictCount > 0)
|
|
379
|
+
memoryWarnings.push(`${f.path} has ${f.conflictCount} historical plan conflict(s)`);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
// 7) Generated-code penalty + warning.
|
|
384
|
+
const generatedFiles = [];
|
|
385
|
+
for (const f of model.generatedVsHandwritten.generatedFiles) {
|
|
386
|
+
if (scoreByPath.has(f.path)) {
|
|
387
|
+
bump(f.path, -10, `generated file (${f.kind})`);
|
|
388
|
+
generatedFiles.push(f.path);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
// 8) Path-convention boost — paths from rulesAndConventions.paths.
|
|
392
|
+
for (const p of model.rulesAndConventions.paths) {
|
|
393
|
+
const pattern = (p.pattern ?? '').toLowerCase();
|
|
394
|
+
if (!pattern)
|
|
395
|
+
continue;
|
|
396
|
+
for (const f of [...scoreByPath.keys()]) {
|
|
397
|
+
if (f.toLowerCase().includes(pattern.replace(/\*/g, '').replace(/\//g, ''))) {
|
|
398
|
+
bump(f, 1, `path convention match: ${p.id}`);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
// Boost files that sit on registered plugin-lifecycle profile barrels.
|
|
403
|
+
try {
|
|
404
|
+
const { listPluginLifecycleProfiles } = await import('@shrkcrft/inspector');
|
|
405
|
+
const profiles = await listPluginLifecycleProfiles(inspection);
|
|
406
|
+
for (const entry of profiles) {
|
|
407
|
+
for (const b of entry.profile.barrels ?? []) {
|
|
408
|
+
for (const f of [...scoreByPath.keys()]) {
|
|
409
|
+
if (f.includes(b.path))
|
|
410
|
+
bump(f, 3, `lifecycle profile barrel: ${b.id}`);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
catch {
|
|
416
|
+
// Profile registry unavailable — skip the boost.
|
|
417
|
+
}
|
|
418
|
+
// 10) Tests — files that look like they test the matched files.
|
|
419
|
+
const tests = [];
|
|
420
|
+
for (const f of [...scoreByPath.keys()]) {
|
|
421
|
+
const base = f.replace(/\.(ts|tsx|js|jsx|java|cs|py|go|rs)$/, '');
|
|
422
|
+
for (const cand of [`${base}.test.ts`, `${base}.spec.ts`, `${base}_test.go`, `${base}_test.py`, `${base}_spec.py`]) {
|
|
423
|
+
if (allFiles.includes(cand))
|
|
424
|
+
tests.push(cand);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
// Sort and slice.
|
|
428
|
+
const sorted = [...scoreByPath.entries()]
|
|
429
|
+
.map(([path, v]) => ({ path, score: v.score, reasons: Array.from(v.reasons) }))
|
|
430
|
+
.filter((f) => f.score > 0 && !generatedFiles.includes(f.path))
|
|
431
|
+
.sort((a, b) => b.score - a.score)
|
|
432
|
+
.slice(0, 60);
|
|
433
|
+
const confidence = Math.min(100, Math.round(20
|
|
434
|
+
+ Math.min(40, sorted.length * 2)
|
|
435
|
+
+ (constructMatches.length > 0 ? 15 : 0)
|
|
436
|
+
+ (graph ? 10 : 0)
|
|
437
|
+
+ (memory ? 10 : 0)));
|
|
438
|
+
const suggestedFirstCommands = [];
|
|
439
|
+
if (constructMatches.length > 0)
|
|
440
|
+
suggestedFirstCommands.push(`shrk constructs get ${constructMatches[0].id}`);
|
|
441
|
+
if (sorted.length > 0 && sorted[0])
|
|
442
|
+
suggestedFirstCommands.push(`shrk impact ${sorted[0].path}`);
|
|
443
|
+
if (generatedFiles.length > 0)
|
|
444
|
+
suggestedFirstCommands.push('shrk generated report');
|
|
445
|
+
if (stabilityWarnings.length > 0)
|
|
446
|
+
suggestedFirstCommands.push('shrk stability map');
|
|
447
|
+
if (suggestedFirstCommands.length === 0)
|
|
448
|
+
suggestedFirstCommands.push('shrk task "' + task + '"');
|
|
449
|
+
return {
|
|
450
|
+
files: sorted,
|
|
451
|
+
constructs: constructMatches.slice(0, 8),
|
|
452
|
+
languages: langsToBoost.slice(0, 4),
|
|
453
|
+
tests: Array.from(new Set(tests)).slice(0, 12),
|
|
454
|
+
generatedFiles: generatedFiles.slice(0, 12),
|
|
455
|
+
stabilityWarnings: Array.from(new Set(stabilityWarnings)).slice(0, 12),
|
|
456
|
+
memoryWarnings: Array.from(new Set(memoryWarnings)).slice(0, 12),
|
|
457
|
+
suggestedFirstCommands: Array.from(new Set(suggestedFirstCommands)).slice(0, 6),
|
|
458
|
+
confidence,
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
function looksLikeBoundaryViolation(file) {
|
|
462
|
+
// Heuristic: edits to cross-package barrels often signal a boundary change.
|
|
463
|
+
return /(^|\/)packages\/[^\/]+\/src\/index\.(ts|tsx|js)$/.test(file);
|
|
464
|
+
}
|
|
465
|
+
function missingTestNeighbour(inspection) {
|
|
466
|
+
const set = new Set(inspection.sourceFiles);
|
|
467
|
+
return (file) => {
|
|
468
|
+
if (!/\.(ts|tsx)$/.test(file))
|
|
469
|
+
return false;
|
|
470
|
+
if (/\.test\.|\.spec\.|__tests__\//.test(file))
|
|
471
|
+
return false;
|
|
472
|
+
const base = file.replace(/\.(ts|tsx)$/, '');
|
|
473
|
+
const candidates = [`${base}.test.ts`, `${base}.spec.ts`, `${base}.test.tsx`];
|
|
474
|
+
return !candidates.some((c) => set.has(c));
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
function renderMarkdown(data) {
|
|
478
|
+
const lines = [];
|
|
479
|
+
lines.push(`# Understand task — ${data.task}`);
|
|
480
|
+
lines.push('');
|
|
481
|
+
lines.push(`- Risk: **${data.riskLevel}**`);
|
|
482
|
+
lines.push(`- Confidence: **${data.confidence}/100**`);
|
|
483
|
+
lines.push(`- Languages: ${data.likelyLanguages.map((l) => '`' + l + '`').join(', ') || '_(none)_'}`);
|
|
484
|
+
lines.push('');
|
|
485
|
+
if (data.relevantRules.length > 0) {
|
|
486
|
+
lines.push('## Relevant rules');
|
|
487
|
+
for (const r of data.relevantRules)
|
|
488
|
+
lines.push(`- \`${r.id}\` — ${r.title} (priority: ${r.priority})`);
|
|
489
|
+
lines.push('');
|
|
490
|
+
}
|
|
491
|
+
if (data.likelyFiles.length > 0) {
|
|
492
|
+
lines.push('## Likely files');
|
|
493
|
+
if (data.explain) {
|
|
494
|
+
lines.push('| Score | Path | Reasons |');
|
|
495
|
+
lines.push('|---|---|---|');
|
|
496
|
+
for (const f of data.likelyFilesExplained.slice(0, 30)) {
|
|
497
|
+
lines.push(`| ${f.score} | \`${f.path}\` | ${f.reasons.join('; ')} |`);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
else {
|
|
501
|
+
for (const f of data.likelyFiles)
|
|
502
|
+
lines.push(`- \`${f}\``);
|
|
503
|
+
}
|
|
504
|
+
lines.push('');
|
|
505
|
+
}
|
|
506
|
+
if (data.likelyConstructs.length > 0) {
|
|
507
|
+
lines.push('## Likely constructs');
|
|
508
|
+
for (const c of data.likelyConstructs)
|
|
509
|
+
lines.push(`- \`${c.id}\` — ${c.title} (${c.reason})`);
|
|
510
|
+
lines.push('');
|
|
511
|
+
}
|
|
512
|
+
if (data.likelyTests.length > 0) {
|
|
513
|
+
lines.push('## Likely tests');
|
|
514
|
+
for (const t of data.likelyTests)
|
|
515
|
+
lines.push(`- \`${t}\``);
|
|
516
|
+
lines.push('');
|
|
517
|
+
}
|
|
518
|
+
if (data.riskyGeneratedFiles.length > 0) {
|
|
519
|
+
lines.push('## Risky generated files (do NOT edit by hand)');
|
|
520
|
+
for (const f of data.riskyGeneratedFiles)
|
|
521
|
+
lines.push(`- \`${f}\``);
|
|
522
|
+
lines.push('');
|
|
523
|
+
}
|
|
524
|
+
if (data.stabilityWarnings.length > 0) {
|
|
525
|
+
lines.push('## Stability warnings');
|
|
526
|
+
for (const w of data.stabilityWarnings)
|
|
527
|
+
lines.push(`- ${w}`);
|
|
528
|
+
lines.push('');
|
|
529
|
+
}
|
|
530
|
+
if (data.memoryWarnings.length > 0) {
|
|
531
|
+
lines.push('## Memory warnings');
|
|
532
|
+
for (const w of data.memoryWarnings)
|
|
533
|
+
lines.push(`- ${w}`);
|
|
534
|
+
lines.push('');
|
|
535
|
+
}
|
|
536
|
+
if (data.suggestedFirstCommands.length > 0) {
|
|
537
|
+
lines.push('## Suggested first commands');
|
|
538
|
+
for (const c of data.suggestedFirstCommands)
|
|
539
|
+
lines.push(`- \`${c}\``);
|
|
540
|
+
lines.push('');
|
|
541
|
+
}
|
|
542
|
+
if (data.requiredValidations.length > 0) {
|
|
543
|
+
lines.push('## Required validations');
|
|
544
|
+
for (const v of data.requiredValidations)
|
|
545
|
+
lines.push(`- \`${v.command}\``);
|
|
546
|
+
lines.push('');
|
|
547
|
+
}
|
|
548
|
+
lines.push(`**Next safe command:** \`${data.nextSafeCommand}\``);
|
|
549
|
+
return lines.join('\n');
|
|
550
|
+
}
|
|
551
|
+
function pickNextCommand(brief) {
|
|
552
|
+
for (const s of brief.sections) {
|
|
553
|
+
if (s.id === 'action-hints' && s.items && s.items.length > 0 && s.items[0]?.command) {
|
|
554
|
+
return s.items[0].command;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
return undefined;
|
|
558
|
+
}
|
|
559
|
+
function renderBundleMarkdown(b) {
|
|
560
|
+
const lines = [];
|
|
561
|
+
lines.push(`# Task context — ${b.task}`);
|
|
562
|
+
lines.push('');
|
|
563
|
+
lines.push(`_Built ${b.generatedAt}._`);
|
|
564
|
+
lines.push('');
|
|
565
|
+
lines.push(`## Relevant rules (${b.rules.length})`);
|
|
566
|
+
for (const r of b.rules)
|
|
567
|
+
lines.push(`- \`${r.id}\` — ${r.title}`);
|
|
568
|
+
lines.push('');
|
|
569
|
+
lines.push(`## Relevant paths (${b.paths.length})`);
|
|
570
|
+
for (const p of b.paths)
|
|
571
|
+
lines.push(`- \`${p.id}\` — ${p.title}`);
|
|
572
|
+
lines.push('');
|
|
573
|
+
lines.push(`## Templates (${b.templates.length})`);
|
|
574
|
+
for (const t of b.templates)
|
|
575
|
+
lines.push(`- \`${t.id}\` — ${t.name}`);
|
|
576
|
+
lines.push('');
|
|
577
|
+
lines.push(`## Presets: ${b.modelPresets.join(', ') || '_(none)_'}`);
|
|
578
|
+
lines.push('');
|
|
579
|
+
lines.push('## Recommended commands');
|
|
580
|
+
for (const c of b.recommendedCommands)
|
|
581
|
+
lines.push(`- \`${c.command}\` — ${c.label}`);
|
|
582
|
+
return lines.join('\n');
|
|
583
|
+
}
|
|
584
|
+
function renderText(data) {
|
|
585
|
+
process.stdout.write(header(`understand-task — ${data.task}`));
|
|
586
|
+
process.stdout.write(kv('risk', data.riskLevel) + '\n');
|
|
587
|
+
process.stdout.write(kv('confidence', `${data.confidence}/100`) + '\n');
|
|
588
|
+
process.stdout.write(kv('rules', data.relevantRules.length) + '\n');
|
|
589
|
+
process.stdout.write(kv('paths', data.relevantPaths.length) + '\n');
|
|
590
|
+
process.stdout.write(kv('likely files', data.likelyFiles.length) + '\n');
|
|
591
|
+
process.stdout.write(kv('likely constructs', data.likelyConstructs.length) + '\n');
|
|
592
|
+
process.stdout.write(kv('likely languages', data.likelyLanguages.join(', ') || '-') + '\n');
|
|
593
|
+
if (data.risks.length > 0) {
|
|
594
|
+
process.stdout.write('\nRisks:\n');
|
|
595
|
+
for (const r of data.risks.slice(0, 10))
|
|
596
|
+
process.stdout.write(` - ${r}\n`);
|
|
597
|
+
}
|
|
598
|
+
if (data.likelyFiles.length > 0) {
|
|
599
|
+
process.stdout.write('\nLikely files:\n');
|
|
600
|
+
if (data.explain) {
|
|
601
|
+
for (const f of data.likelyFilesExplained.slice(0, 20)) {
|
|
602
|
+
process.stdout.write(` [${f.score}] ${f.path}\n`);
|
|
603
|
+
for (const r of f.reasons)
|
|
604
|
+
process.stdout.write(` - ${r}\n`);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
else {
|
|
608
|
+
for (const f of data.likelyFiles.slice(0, 15))
|
|
609
|
+
process.stdout.write(` - ${f}\n`);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
if (data.likelyTests.length > 0) {
|
|
613
|
+
process.stdout.write('\nLikely tests:\n');
|
|
614
|
+
for (const t of data.likelyTests.slice(0, 10))
|
|
615
|
+
process.stdout.write(` - ${t}\n`);
|
|
616
|
+
}
|
|
617
|
+
if (data.riskyGeneratedFiles.length > 0) {
|
|
618
|
+
process.stdout.write('\nGenerated files (do NOT edit by hand):\n');
|
|
619
|
+
for (const f of data.riskyGeneratedFiles.slice(0, 10))
|
|
620
|
+
process.stdout.write(` - ${f}\n`);
|
|
621
|
+
}
|
|
622
|
+
if (data.stabilityWarnings.length > 0) {
|
|
623
|
+
process.stdout.write('\nStability warnings:\n');
|
|
624
|
+
for (const w of data.stabilityWarnings.slice(0, 10))
|
|
625
|
+
process.stdout.write(` - ${w}\n`);
|
|
626
|
+
}
|
|
627
|
+
if (data.memoryWarnings.length > 0) {
|
|
628
|
+
process.stdout.write('\nMemory warnings:\n');
|
|
629
|
+
for (const w of data.memoryWarnings.slice(0, 10))
|
|
630
|
+
process.stdout.write(` - ${w}\n`);
|
|
631
|
+
}
|
|
632
|
+
if (data.suggestedFirstCommands.length > 0) {
|
|
633
|
+
process.stdout.write('\nSuggested first commands:\n');
|
|
634
|
+
for (const c of data.suggestedFirstCommands)
|
|
635
|
+
process.stdout.write(` - ${c}\n`);
|
|
636
|
+
}
|
|
637
|
+
if (data.requiredValidations.length > 0) {
|
|
638
|
+
process.stdout.write('\nRequired validations:\n');
|
|
639
|
+
for (const v of data.requiredValidations)
|
|
640
|
+
process.stdout.write(` - ${v.command}\n`);
|
|
641
|
+
}
|
|
642
|
+
process.stdout.write(`\nNext safe command: \`${data.nextSafeCommand}\`\n`);
|
|
643
|
+
process.stdout.write(`Recommended contract: \`${data.recommendedContract}\`\n`);
|
|
644
|
+
if (data.recommendedPlaybook)
|
|
645
|
+
process.stdout.write(`Recommended playbook: \`${data.recommendedPlaybook}\`\n`);
|
|
646
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.command.d.ts","sourceRoot":"","sources":["../../src/commands/task.command.ts"],"names":[],"mappings":"AAiBA,OAAO,EAKL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AA2DhC,eAAO,MAAM,WAAW,EAAE,eA8PzB,CAAC"}
|