@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,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `shrk why <file>` — closes the dangling promise from
|
|
3
|
+
* `ide.command.ts:112`. For any file path under the project root,
|
|
4
|
+
* surface:
|
|
5
|
+
*
|
|
6
|
+
* - inferred package / layer
|
|
7
|
+
* - path conventions whose canonical path matches
|
|
8
|
+
* - rules whose scope / tags / appliesWhen overlap with the file's
|
|
9
|
+
* path tokens (top-N by priority)
|
|
10
|
+
* - boundary rules whose `from` glob matches the file (these dictate
|
|
11
|
+
* what the file is allowed to import)
|
|
12
|
+
* - knowledge entries that reference the file or its basename
|
|
13
|
+
* - suggested next commands
|
|
14
|
+
*
|
|
15
|
+
* Read-only. Pure composition over the live inspection — no LLM,
|
|
16
|
+
* no shell, no writes.
|
|
17
|
+
*
|
|
18
|
+
* Symbol queries (`shrk why <symbol>`) intentionally route to
|
|
19
|
+
* `shrk knowledge search` instead of trying to ground a symbol
|
|
20
|
+
* without an AST pass. Honest about scope.
|
|
21
|
+
*/
|
|
22
|
+
import { buildWhyReport, inspectSharkcraft, } from '@shrkcrft/inspector';
|
|
23
|
+
import { flagBool, flagNumber, resolveCwd, } from "../command-registry.js";
|
|
24
|
+
import { asJson, header } from "../output/format-output.js";
|
|
25
|
+
export const whyCommand = {
|
|
26
|
+
name: 'why',
|
|
27
|
+
description: 'Explain the constraints that apply to a file: package / layer, path conventions, rules, boundary rules, and related knowledge. Read-only. Pure composition — no LLM, no shell.',
|
|
28
|
+
usage: 'shrk why <file> [--limit 10] [--json]',
|
|
29
|
+
async run(args) {
|
|
30
|
+
const target = args.positional[0];
|
|
31
|
+
if (!target) {
|
|
32
|
+
process.stderr.write('Usage: shrk why <file>\n' +
|
|
33
|
+
'\nFor symbol queries, use:\n $ shrk knowledge search "<symbol>"\n' +
|
|
34
|
+
' $ shrk search "<symbol>"\n');
|
|
35
|
+
return 2;
|
|
36
|
+
}
|
|
37
|
+
const cwd = resolveCwd(args);
|
|
38
|
+
const inspection = await inspectSharkcraft({ cwd });
|
|
39
|
+
const limit = flagNumber(args, 'limit') ?? 10;
|
|
40
|
+
const report = buildWhyReport({
|
|
41
|
+
inspection,
|
|
42
|
+
projectRoot: cwd,
|
|
43
|
+
target,
|
|
44
|
+
limit,
|
|
45
|
+
});
|
|
46
|
+
if (flagBool(args, 'json')) {
|
|
47
|
+
process.stdout.write(asJson(report) + '\n');
|
|
48
|
+
return 0;
|
|
49
|
+
}
|
|
50
|
+
renderHuman(report);
|
|
51
|
+
return 0;
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
function renderHuman(report) {
|
|
55
|
+
process.stdout.write(header(`Why: ${report.target.relativePath}`));
|
|
56
|
+
process.stdout.write(` kind: ${report.target.kind}\n`);
|
|
57
|
+
if (report.inferredPackage) {
|
|
58
|
+
process.stdout.write(` package: ${report.inferredPackage}\n`);
|
|
59
|
+
}
|
|
60
|
+
if (report.inferredLayer) {
|
|
61
|
+
process.stdout.write(` layer: ${report.inferredLayer}\n`);
|
|
62
|
+
}
|
|
63
|
+
if (report.target.kind === 'missing') {
|
|
64
|
+
process.stdout.write(`\n (file not on disk — results below are based on the input path string only)\n`);
|
|
65
|
+
}
|
|
66
|
+
if (report.pathConventions.length > 0) {
|
|
67
|
+
process.stdout.write('\nPath conventions:\n');
|
|
68
|
+
for (const p of report.pathConventions) {
|
|
69
|
+
process.stdout.write(` ${p.id.padEnd(35)} ${p.title}\n`);
|
|
70
|
+
process.stdout.write(` canonical: ${p.canonicalPath}\n`);
|
|
71
|
+
if (p.source)
|
|
72
|
+
process.stdout.write(` source: ${p.source}\n`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (report.rules.length > 0) {
|
|
76
|
+
process.stdout.write('\nApplicable rules (top by priority):\n');
|
|
77
|
+
for (const r of report.rules) {
|
|
78
|
+
process.stdout.write(` ${r.id.padEnd(40)} [${r.priority}] ${r.title}\n`);
|
|
79
|
+
process.stdout.write(` ${r.reason}\n`);
|
|
80
|
+
if (r.source)
|
|
81
|
+
process.stdout.write(` source: ${r.source}\n`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (report.boundaries.length > 0) {
|
|
85
|
+
process.stdout.write('\nBoundary rules (constrain imports from this file):\n');
|
|
86
|
+
for (const b of report.boundaries) {
|
|
87
|
+
const sev = b.severity ? `[${b.severity}]` : '';
|
|
88
|
+
process.stdout.write(` ${b.id.padEnd(40)} ${sev} ${b.title}\n`);
|
|
89
|
+
if (b.forbiddenImports && b.forbiddenImports.length > 0) {
|
|
90
|
+
process.stdout.write(` forbidden: ${b.forbiddenImports.slice(0, 5).join(', ')}\n`);
|
|
91
|
+
}
|
|
92
|
+
if (b.allowedImports && b.allowedImports.length > 0) {
|
|
93
|
+
process.stdout.write(` allowed: ${b.allowedImports.slice(0, 5).join(', ')}\n`);
|
|
94
|
+
}
|
|
95
|
+
if (b.source)
|
|
96
|
+
process.stdout.write(` source: ${b.source}\n`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (report.knowledge.length > 0) {
|
|
100
|
+
process.stdout.write('\nRelated knowledge:\n');
|
|
101
|
+
for (const k of report.knowledge) {
|
|
102
|
+
process.stdout.write(` ${k.id.padEnd(35)} (${k.type}) ${k.title}\n`);
|
|
103
|
+
process.stdout.write(` ${k.reason}\n`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (report.suggestedNext.length > 0) {
|
|
107
|
+
process.stdout.write('\nSuggested next:\n');
|
|
108
|
+
for (const cmd of report.suggestedNext) {
|
|
109
|
+
process.stdout.write(` $ ${cmd}\n`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (report.pathConventions.length === 0 &&
|
|
113
|
+
report.rules.length === 0 &&
|
|
114
|
+
report.boundaries.length === 0 &&
|
|
115
|
+
report.knowledge.length === 0) {
|
|
116
|
+
process.stdout.write('\n(no registry entries matched. The file may be outside the conventions ' +
|
|
117
|
+
'or the workspace may not have rules / paths defined yet.)\n');
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
interface IServerOptions {
|
|
2
|
+
cwd: string;
|
|
3
|
+
host?: string;
|
|
4
|
+
port?: number;
|
|
5
|
+
/** Optional MCP tool list (passed in to avoid a CLI → MCP dependency). */
|
|
6
|
+
mcpTools?: ReadonlyArray<{
|
|
7
|
+
name: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
}>;
|
|
10
|
+
/** Directory containing built dashboard static assets. When absent, /<non-api> returns 404. */
|
|
11
|
+
staticDir?: string | null;
|
|
12
|
+
}
|
|
13
|
+
interface IServerHandle {
|
|
14
|
+
url: string;
|
|
15
|
+
host: string;
|
|
16
|
+
port: number;
|
|
17
|
+
close: () => Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export declare function startDashboardApiServer(opts: IServerOptions): Promise<IServerHandle>;
|
|
20
|
+
export type { IServerHandle, IServerOptions };
|
|
21
|
+
//# sourceMappingURL=dashboard-api-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard-api-server.d.ts","sourceRoot":"","sources":["../../src/dashboard/dashboard-api-server.ts"],"names":[],"mappings":"AAsDA,UAAU,cAAc;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,aAAa,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACjE,+FAA+F;IAC/F,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,UAAU,aAAa;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAcD,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAiC1F;AA4ZD,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read-only local dashboard API server.
|
|
3
|
+
*
|
|
4
|
+
* Safety contract (must hold forever):
|
|
5
|
+
* - only GET and HEAD are allowed; everything else returns 405
|
|
6
|
+
* - no source writes — server reads inspection state and serves JSON
|
|
7
|
+
* - no apply / shell / onboard-write endpoints
|
|
8
|
+
* - binds 127.0.0.1 by default; a non-localhost host emits a loud warning
|
|
9
|
+
* - /api/health.readOnly === true
|
|
10
|
+
*
|
|
11
|
+
* This module is structured so the future `shrk dashboard --serve` command
|
|
12
|
+
* and the in-process tests share the same handler.
|
|
13
|
+
*/
|
|
14
|
+
import * as http from 'node:http';
|
|
15
|
+
import * as fs from 'node:fs';
|
|
16
|
+
import { existsSync, readFileSync, statSync } from 'node:fs';
|
|
17
|
+
import * as nodePath from 'node:path';
|
|
18
|
+
import { buildDashboardAdoption, buildDashboardArchitecture, buildDashboardBoundaries, buildDashboardCapabilities, buildDashboardCommands, buildDashboardCoverage, buildDashboardDoctor, buildDashboardDrift, buildDashboardGraph, buildDashboardGraphNode, buildDashboardGraphPath, buildDashboardHealth, buildDashboardMcpSummary, buildDashboardOnboarding, buildDashboardOverview, buildDashboardPacks, buildDashboardPipelines, buildDashboardPresets, buildDashboardQuality, buildDashboardReports, buildDashboardReview, buildDashboardSafety, buildDashboardScaffolds, buildDashboardSchemas, buildDashboardSessionDetail, buildDashboardSessions, buildDashboardStats, inspectSharkcraft, renderDevSessionHtml, scanDevSession, } from '@shrkcrft/inspector';
|
|
19
|
+
import { COMMAND_CATALOG } from "../commands/command-catalog.js";
|
|
20
|
+
const SCHEMA_ID = 'sharkcraft.dashboard-api/v1';
|
|
21
|
+
export async function startDashboardApiServer(opts) {
|
|
22
|
+
const host = opts.host ?? '127.0.0.1';
|
|
23
|
+
const port = opts.port ?? 0;
|
|
24
|
+
if (host !== '127.0.0.1' && host !== 'localhost' && host !== '::1') {
|
|
25
|
+
process.stderr.write(`WARNING: --host ${host} exposes the dashboard API server beyond localhost. Press Ctrl+C to abort if unintended.\n`);
|
|
26
|
+
}
|
|
27
|
+
const startedAt = Date.now();
|
|
28
|
+
const sessionHubs = new Map();
|
|
29
|
+
const ctx = { opts, startedAt, sessionHubs };
|
|
30
|
+
const server = http.createServer(async (req, res) => {
|
|
31
|
+
try {
|
|
32
|
+
await handle(req, res, ctx);
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
respondError(res, 500, 'internal', err.message);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
await new Promise((resolve) => server.listen(port, host, () => resolve()));
|
|
39
|
+
const addr = server.address();
|
|
40
|
+
const realPort = typeof addr === 'object' && addr ? addr.port : port;
|
|
41
|
+
return {
|
|
42
|
+
url: `http://${host}:${realPort}`,
|
|
43
|
+
host,
|
|
44
|
+
port: realPort,
|
|
45
|
+
close: () => new Promise((resolve) => {
|
|
46
|
+
// Tear down every active SSE hub first.
|
|
47
|
+
for (const hub of sessionHubs.values())
|
|
48
|
+
closeHub(hub);
|
|
49
|
+
sessionHubs.clear();
|
|
50
|
+
server.close(() => resolve());
|
|
51
|
+
}),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function closeHub(hub) {
|
|
55
|
+
if (hub.debounceTimer) {
|
|
56
|
+
clearTimeout(hub.debounceTimer);
|
|
57
|
+
hub.debounceTimer = null;
|
|
58
|
+
}
|
|
59
|
+
for (const w of hub.watchers) {
|
|
60
|
+
try {
|
|
61
|
+
w.close();
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
/* ignore */
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
hub.watchers = [];
|
|
68
|
+
hub.subscribers.clear();
|
|
69
|
+
}
|
|
70
|
+
function ensureSessionHub(ctx, sessionId) {
|
|
71
|
+
const existing = ctx.sessionHubs.get(sessionId);
|
|
72
|
+
if (existing)
|
|
73
|
+
return existing;
|
|
74
|
+
const hub = {
|
|
75
|
+
subscribers: new Set(),
|
|
76
|
+
watchers: [],
|
|
77
|
+
version: 0,
|
|
78
|
+
debounceTimer: null,
|
|
79
|
+
};
|
|
80
|
+
const sessionDir = nodePath.join(ctx.opts.cwd, '.sharkcraft', 'sessions', sessionId);
|
|
81
|
+
const scheduleBroadcast = (event) => {
|
|
82
|
+
if (hub.debounceTimer)
|
|
83
|
+
clearTimeout(hub.debounceTimer);
|
|
84
|
+
hub.debounceTimer = setTimeout(() => {
|
|
85
|
+
hub.version += 1;
|
|
86
|
+
const line = `event: change\ndata: ${event}\nid: ${hub.version}\n\n`;
|
|
87
|
+
for (const send of [...hub.subscribers]) {
|
|
88
|
+
try {
|
|
89
|
+
send(line);
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
hub.subscribers.delete(send);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}, 200);
|
|
96
|
+
};
|
|
97
|
+
for (const sub of ['session.json', 'plans', 'reports']) {
|
|
98
|
+
const target = nodePath.join(sessionDir, sub);
|
|
99
|
+
if (!fs.existsSync(target))
|
|
100
|
+
continue;
|
|
101
|
+
try {
|
|
102
|
+
const w = fs.watch(target, { recursive: true }, () => scheduleBroadcast(sub));
|
|
103
|
+
hub.watchers.push(w);
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
try {
|
|
107
|
+
const w = fs.watch(target, () => scheduleBroadcast(sub));
|
|
108
|
+
hub.watchers.push(w);
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
/* ignore */
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
ctx.sessionHubs.set(sessionId, hub);
|
|
116
|
+
return hub;
|
|
117
|
+
}
|
|
118
|
+
async function handle(req, res, ctx) {
|
|
119
|
+
if (req.method !== 'GET' && req.method !== 'HEAD') {
|
|
120
|
+
res.setHeader('allow', 'GET, HEAD');
|
|
121
|
+
return respondError(res, 405, 'method-not-allowed', `Method ${req.method} not allowed`);
|
|
122
|
+
}
|
|
123
|
+
const url = new URL(req.url ?? '/', 'http://localhost');
|
|
124
|
+
const path = url.pathname;
|
|
125
|
+
const opts = ctx.opts;
|
|
126
|
+
const startedAt = ctx.startedAt;
|
|
127
|
+
const projectRoot = opts.cwd;
|
|
128
|
+
// Static assets — only when not /api/*. SPA fallback to index.html.
|
|
129
|
+
if (!path.startsWith('/api/') && opts.staticDir) {
|
|
130
|
+
return serveStatic(res, opts.staticDir, path);
|
|
131
|
+
}
|
|
132
|
+
// Session live events (SSE). Subscribe via EventSource on the session detail page.
|
|
133
|
+
const sseMatch = path.match(/^\/api\/sessions\/([^/]+)\/events$/);
|
|
134
|
+
if (sseMatch) {
|
|
135
|
+
return serveSessionEvents(req, res, ctx, decodeURIComponent(sseMatch[1]));
|
|
136
|
+
}
|
|
137
|
+
// Rendered HTML report for the session (or any report on disk under the
|
|
138
|
+
// session dir). Served with a content-security-policy that disallows
|
|
139
|
+
// anything but inline styles — the report renderer never emits scripts,
|
|
140
|
+
// but iframe sandboxing in the UI is the second line of defence.
|
|
141
|
+
const reportMatch = path.match(/^\/api\/sessions\/([^/]+)\/report\.html$/);
|
|
142
|
+
if (reportMatch) {
|
|
143
|
+
return serveSessionReportHtml(res, ctx.opts.cwd, decodeURIComponent(reportMatch[1]));
|
|
144
|
+
}
|
|
145
|
+
if (path === '/api/health') {
|
|
146
|
+
return respond(res, buildEnvelope(projectRoot, buildDashboardHealth(Math.floor((Date.now() - startedAt) / 1000))));
|
|
147
|
+
}
|
|
148
|
+
if (path === '/api/capabilities') {
|
|
149
|
+
return respond(res, buildEnvelope(projectRoot, buildDashboardCapabilities()));
|
|
150
|
+
}
|
|
151
|
+
if (path === '/api/commands') {
|
|
152
|
+
return respond(res, buildEnvelope(projectRoot, buildDashboardCommands(COMMAND_CATALOG)));
|
|
153
|
+
}
|
|
154
|
+
if (path === '/api/schemas') {
|
|
155
|
+
return respond(res, buildEnvelope(projectRoot, buildDashboardSchemas()));
|
|
156
|
+
}
|
|
157
|
+
if (path === '/api/mcp') {
|
|
158
|
+
return respond(res, buildEnvelope(projectRoot, buildDashboardMcpSummary(opts.mcpTools ?? [])));
|
|
159
|
+
}
|
|
160
|
+
if (path === '/api/reports') {
|
|
161
|
+
const inspection = await inspectSharkcraft({ cwd: projectRoot });
|
|
162
|
+
return respond(res, buildEnvelope(projectRoot, buildDashboardReports(inspection)));
|
|
163
|
+
}
|
|
164
|
+
if (path === '/api/stats') {
|
|
165
|
+
const urlObj = new URL(req.url ?? '/', `http://${opts.host ?? '127.0.0.1'}`);
|
|
166
|
+
const topStr = urlObj.searchParams.get('top');
|
|
167
|
+
const language = urlObj.searchParams.get('language') ?? undefined;
|
|
168
|
+
const maxTopFiles = topStr !== null ? Math.max(0, Number(topStr) || 0) : undefined;
|
|
169
|
+
const stats = await buildDashboardStats(projectRoot, {
|
|
170
|
+
...(maxTopFiles !== undefined ? { maxTopFiles } : {}),
|
|
171
|
+
...(language ? { language } : {}),
|
|
172
|
+
});
|
|
173
|
+
return respond(res, buildEnvelope(projectRoot, stats));
|
|
174
|
+
}
|
|
175
|
+
// For data routes that need inspection, load once per request.
|
|
176
|
+
const needsInspection = path.startsWith('/api/overview') ||
|
|
177
|
+
path.startsWith('/api/doctor') ||
|
|
178
|
+
path.startsWith('/api/quality') ||
|
|
179
|
+
path.startsWith('/api/safety') ||
|
|
180
|
+
path.startsWith('/api/packs') ||
|
|
181
|
+
path.startsWith('/api/presets') ||
|
|
182
|
+
path.startsWith('/api/pipelines') ||
|
|
183
|
+
path.startsWith('/api/architecture') ||
|
|
184
|
+
path.startsWith('/api/graph') ||
|
|
185
|
+
path.startsWith('/api/onboarding') ||
|
|
186
|
+
path.startsWith('/api/review') ||
|
|
187
|
+
path.startsWith('/api/scaffolds');
|
|
188
|
+
const inspection = needsInspection
|
|
189
|
+
? await inspectSharkcraft({ cwd: projectRoot })
|
|
190
|
+
: null;
|
|
191
|
+
if (path === '/api/overview') {
|
|
192
|
+
return respond(res, buildEnvelope(projectRoot, await buildDashboardOverview(inspection)));
|
|
193
|
+
}
|
|
194
|
+
if (path === '/api/doctor') {
|
|
195
|
+
return respond(res, buildEnvelope(projectRoot, buildDashboardDoctor(inspection)));
|
|
196
|
+
}
|
|
197
|
+
if (path === '/api/quality') {
|
|
198
|
+
return respond(res, buildEnvelope(projectRoot, await buildDashboardQuality(inspection)));
|
|
199
|
+
}
|
|
200
|
+
if (path === '/api/safety') {
|
|
201
|
+
return respond(res, buildEnvelope(projectRoot, buildDashboardSafety(inspection, COMMAND_CATALOG, (opts.mcpTools ?? []).map((t) => ({ name: t.name, description: t.description ?? '' })))));
|
|
202
|
+
}
|
|
203
|
+
if (path === '/api/packs') {
|
|
204
|
+
return respond(res, buildEnvelope(projectRoot, buildDashboardPacks(inspection)));
|
|
205
|
+
}
|
|
206
|
+
if (path === '/api/presets') {
|
|
207
|
+
return respond(res, buildEnvelope(projectRoot, buildDashboardPresets(inspection)));
|
|
208
|
+
}
|
|
209
|
+
if (path === '/api/pipelines') {
|
|
210
|
+
return respond(res, buildEnvelope(projectRoot, buildDashboardPipelines(inspection)));
|
|
211
|
+
}
|
|
212
|
+
if (path === '/api/architecture') {
|
|
213
|
+
return respond(res, buildEnvelope(projectRoot, buildDashboardArchitecture(inspection)));
|
|
214
|
+
}
|
|
215
|
+
if (path === '/api/architecture/boundaries') {
|
|
216
|
+
return respond(res, buildEnvelope(projectRoot, buildDashboardBoundaries(inspection)));
|
|
217
|
+
}
|
|
218
|
+
if (path === '/api/architecture/drift') {
|
|
219
|
+
return respond(res, buildEnvelope(projectRoot, buildDashboardDrift(inspection)));
|
|
220
|
+
}
|
|
221
|
+
if (path === '/api/architecture/coverage') {
|
|
222
|
+
return respond(res, buildEnvelope(projectRoot, buildDashboardCoverage(inspection)));
|
|
223
|
+
}
|
|
224
|
+
if (path === '/api/graph') {
|
|
225
|
+
return respond(res, buildEnvelope(projectRoot, buildDashboardGraph(inspection)));
|
|
226
|
+
}
|
|
227
|
+
const nodeMatch = path.match(/^\/api\/graph\/node\/(.+)$/);
|
|
228
|
+
if (nodeMatch) {
|
|
229
|
+
return respond(res, buildEnvelope(projectRoot, buildDashboardGraphNode(inspection, decodeURIComponent(nodeMatch[1]))));
|
|
230
|
+
}
|
|
231
|
+
if (path === '/api/graph/why') {
|
|
232
|
+
const from = url.searchParams.get('from');
|
|
233
|
+
const to = url.searchParams.get('to');
|
|
234
|
+
if (!from || !to)
|
|
235
|
+
return respondError(res, 400, 'bad-request', 'from and to query params required');
|
|
236
|
+
return respond(res, buildEnvelope(projectRoot, buildDashboardGraphPath(inspection, from, to)));
|
|
237
|
+
}
|
|
238
|
+
if (path === '/api/onboarding') {
|
|
239
|
+
return respond(res, buildEnvelope(projectRoot, buildDashboardOnboarding(inspection)));
|
|
240
|
+
}
|
|
241
|
+
if (path === '/api/onboarding/adoption') {
|
|
242
|
+
return respond(res, buildEnvelope(projectRoot, buildDashboardAdoption(inspection)));
|
|
243
|
+
}
|
|
244
|
+
if (path === '/api/scaffolds') {
|
|
245
|
+
return respond(res, buildEnvelope(projectRoot, await buildDashboardScaffolds(inspection)));
|
|
246
|
+
}
|
|
247
|
+
if (path === '/api/review') {
|
|
248
|
+
return respond(res, buildEnvelope(projectRoot, buildDashboardReview(inspection, { packetPath: url.searchParams.get('packet') ?? undefined })));
|
|
249
|
+
}
|
|
250
|
+
if (path === '/api/sessions') {
|
|
251
|
+
return respond(res, buildEnvelope(projectRoot, buildDashboardSessions(projectRoot)));
|
|
252
|
+
}
|
|
253
|
+
const sessionMatch = path.match(/^\/api\/sessions\/([^/]+)(\/report)?$/);
|
|
254
|
+
if (sessionMatch) {
|
|
255
|
+
const id = decodeURIComponent(sessionMatch[1]);
|
|
256
|
+
const detail = buildDashboardSessionDetail(projectRoot, id);
|
|
257
|
+
if (!detail.available)
|
|
258
|
+
return respondError(res, 404, 'not-found', `Unknown session: ${id}`);
|
|
259
|
+
return respond(res, buildEnvelope(projectRoot, detail));
|
|
260
|
+
}
|
|
261
|
+
return respondError(res, 404, 'not-found', `Unknown route: ${path}`);
|
|
262
|
+
}
|
|
263
|
+
function buildEnvelope(projectRoot, data) {
|
|
264
|
+
return {
|
|
265
|
+
schema: SCHEMA_ID,
|
|
266
|
+
generatedAt: new Date().toISOString(),
|
|
267
|
+
projectRoot,
|
|
268
|
+
data,
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
function respond(res, payload) {
|
|
272
|
+
res.statusCode = 200;
|
|
273
|
+
res.setHeader('content-type', 'application/json; charset=utf-8');
|
|
274
|
+
res.setHeader('cache-control', 'no-store');
|
|
275
|
+
res.setHeader('x-content-type-options', 'nosniff');
|
|
276
|
+
res.setHeader('referrer-policy', 'no-referrer');
|
|
277
|
+
res.setHeader('x-sharkcraft-dashboard-api', '1');
|
|
278
|
+
if ((res.req?.method ?? 'GET') === 'HEAD') {
|
|
279
|
+
res.end();
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
res.end(JSON.stringify(payload));
|
|
283
|
+
}
|
|
284
|
+
function respondError(res, status, code, message) {
|
|
285
|
+
res.statusCode = status;
|
|
286
|
+
res.setHeader('content-type', 'application/json; charset=utf-8');
|
|
287
|
+
res.end(JSON.stringify({
|
|
288
|
+
schema: SCHEMA_ID,
|
|
289
|
+
generatedAt: new Date().toISOString(),
|
|
290
|
+
data: { error: message, code },
|
|
291
|
+
}));
|
|
292
|
+
}
|
|
293
|
+
const MIME = {
|
|
294
|
+
'.html': 'text/html; charset=utf-8',
|
|
295
|
+
'.css': 'text/css; charset=utf-8',
|
|
296
|
+
'.js': 'application/javascript; charset=utf-8',
|
|
297
|
+
'.mjs': 'application/javascript; charset=utf-8',
|
|
298
|
+
'.json': 'application/json; charset=utf-8',
|
|
299
|
+
'.svg': 'image/svg+xml',
|
|
300
|
+
'.png': 'image/png',
|
|
301
|
+
'.jpg': 'image/jpeg',
|
|
302
|
+
'.jpeg': 'image/jpeg',
|
|
303
|
+
'.ico': 'image/x-icon',
|
|
304
|
+
'.woff2': 'font/woff2',
|
|
305
|
+
'.woff': 'font/woff',
|
|
306
|
+
'.map': 'application/json; charset=utf-8',
|
|
307
|
+
};
|
|
308
|
+
function serveSessionEvents(req, res, ctx, sessionId) {
|
|
309
|
+
// Confirm the session exists before subscribing watchers.
|
|
310
|
+
const load = scanDevSession(ctx.opts.cwd, sessionId);
|
|
311
|
+
if (!load) {
|
|
312
|
+
return respondError(res, 404, 'not-found', `Unknown session: ${sessionId}`);
|
|
313
|
+
}
|
|
314
|
+
const hub = ensureSessionHub(ctx, sessionId);
|
|
315
|
+
res.writeHead(200, {
|
|
316
|
+
'content-type': 'text/event-stream',
|
|
317
|
+
'cache-control': 'no-store',
|
|
318
|
+
'x-content-type-options': 'nosniff',
|
|
319
|
+
connection: 'keep-alive',
|
|
320
|
+
});
|
|
321
|
+
const send = (line) => {
|
|
322
|
+
res.write(line);
|
|
323
|
+
};
|
|
324
|
+
hub.subscribers.add(send);
|
|
325
|
+
// Initial hello so the client knows the stream is open.
|
|
326
|
+
send(`event: hello\ndata: ${sessionId}\nid: ${hub.version}\n\n`);
|
|
327
|
+
// Keep-alive comment ping so proxies don't close the connection.
|
|
328
|
+
const ping = setInterval(() => {
|
|
329
|
+
try {
|
|
330
|
+
res.write(`: ping\n\n`);
|
|
331
|
+
}
|
|
332
|
+
catch {
|
|
333
|
+
/* ignore */
|
|
334
|
+
}
|
|
335
|
+
}, 15000);
|
|
336
|
+
const close = () => {
|
|
337
|
+
clearInterval(ping);
|
|
338
|
+
hub.subscribers.delete(send);
|
|
339
|
+
// If we're the last subscriber, tear the hub down so file watchers
|
|
340
|
+
// don't outlive their clients.
|
|
341
|
+
if (hub.subscribers.size === 0) {
|
|
342
|
+
closeHub(hub);
|
|
343
|
+
ctx.sessionHubs.delete(sessionId);
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
req.on('close', close);
|
|
347
|
+
req.on('end', close);
|
|
348
|
+
}
|
|
349
|
+
function serveSessionReportHtml(res, cwd, sessionId) {
|
|
350
|
+
const load = scanDevSession(cwd, sessionId);
|
|
351
|
+
if (!load) {
|
|
352
|
+
return respondError(res, 404, 'not-found', `Unknown session: ${sessionId}`);
|
|
353
|
+
}
|
|
354
|
+
const html = renderDevSessionHtml(load, {
|
|
355
|
+
nextActionLine: load.state?.nextAction ?? undefined,
|
|
356
|
+
});
|
|
357
|
+
res.statusCode = 200;
|
|
358
|
+
res.setHeader('content-type', 'text/html; charset=utf-8');
|
|
359
|
+
res.setHeader('cache-control', 'no-store');
|
|
360
|
+
res.setHeader('x-content-type-options', 'nosniff');
|
|
361
|
+
res.setHeader('referrer-policy', 'no-referrer');
|
|
362
|
+
// Belt-and-braces: even though the renderer never emits scripts and the
|
|
363
|
+
// dashboard wraps this in a sandboxed iframe, a CSP keeps any future
|
|
364
|
+
// mishap from running JS.
|
|
365
|
+
res.setHeader('content-security-policy', "default-src 'none'; style-src 'unsafe-inline'; img-src data:; base-uri 'none'; form-action 'none'");
|
|
366
|
+
if ((res.req?.method ?? 'GET') === 'HEAD') {
|
|
367
|
+
res.end();
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
res.end(html);
|
|
371
|
+
}
|
|
372
|
+
function serveStatic(res, staticDir, urlPath) {
|
|
373
|
+
// Strip leading / and resolve against staticDir. Reject traversal.
|
|
374
|
+
const rel = urlPath.replace(/^\/+/, '');
|
|
375
|
+
const abs = nodePath.resolve(staticDir, rel);
|
|
376
|
+
if (!abs.startsWith(nodePath.resolve(staticDir))) {
|
|
377
|
+
return respondError(res, 400, 'bad-request', 'invalid path');
|
|
378
|
+
}
|
|
379
|
+
let target = abs;
|
|
380
|
+
try {
|
|
381
|
+
const st = statSync(target);
|
|
382
|
+
if (st.isDirectory())
|
|
383
|
+
target = nodePath.join(target, 'index.html');
|
|
384
|
+
}
|
|
385
|
+
catch {
|
|
386
|
+
// Not found — SPA fallback to index.html for client-side routing.
|
|
387
|
+
target = nodePath.join(staticDir, 'index.html');
|
|
388
|
+
}
|
|
389
|
+
if (!existsSync(target)) {
|
|
390
|
+
return respondError(res, 404, 'not-found', 'asset not found');
|
|
391
|
+
}
|
|
392
|
+
const ext = nodePath.extname(target).toLowerCase();
|
|
393
|
+
const mime = MIME[ext] ?? 'application/octet-stream';
|
|
394
|
+
const body = readFileSync(target);
|
|
395
|
+
res.statusCode = 200;
|
|
396
|
+
res.setHeader('content-type', mime);
|
|
397
|
+
res.setHeader('x-content-type-options', 'nosniff');
|
|
398
|
+
res.setHeader('referrer-policy', 'no-referrer');
|
|
399
|
+
if (ext === '.html') {
|
|
400
|
+
res.setHeader('cache-control', 'no-store');
|
|
401
|
+
}
|
|
402
|
+
else {
|
|
403
|
+
res.setHeader('cache-control', 'public, max-age=3600');
|
|
404
|
+
}
|
|
405
|
+
if ((res.req?.method ?? 'GET') === 'HEAD') {
|
|
406
|
+
res.end();
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
res.end(body);
|
|
410
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type IDevSessionLoad } from '@shrkcrft/inspector';
|
|
2
|
+
export interface ILiveSessionServerOptions {
|
|
3
|
+
cwd: string;
|
|
4
|
+
load: IDevSessionLoad;
|
|
5
|
+
host?: string;
|
|
6
|
+
port?: number;
|
|
7
|
+
live?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface ILiveSessionServerHandle {
|
|
10
|
+
url: string;
|
|
11
|
+
host: string;
|
|
12
|
+
port: number;
|
|
13
|
+
/** Force-broadcast a synthetic SSE event (used by tests). */
|
|
14
|
+
triggerEvent: (event: string) => void;
|
|
15
|
+
close: () => Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export declare function startLiveSessionServer(opts: ILiveSessionServerOptions): Promise<ILiveSessionServerHandle>;
|
|
18
|
+
//# sourceMappingURL=live-session-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live-session-server.d.ts","sourceRoot":"","sources":["../../src/dashboard/live-session-server.ts"],"names":[],"mappings":"AAUA,OAAO,EAAwC,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEjG,MAAM,WAAW,yBAAyB;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,wBAAwB;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAID,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,wBAAwB,CAAC,CAwHnC"}
|