@shrkcrft/inspector 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/acceptance-replay.d.ts +63 -0
- package/dist/acceptance-replay.d.ts.map +1 -0
- package/dist/acceptance-replay.js +240 -0
- package/dist/action-hint-diagnostics.d.ts +32 -0
- package/dist/action-hint-diagnostics.d.ts.map +1 -0
- package/dist/action-hint-diagnostics.js +133 -0
- package/dist/adoption-check.d.ts +28 -0
- package/dist/adoption-check.d.ts.map +1 -0
- package/dist/adoption-check.js +181 -0
- package/dist/adoption-checkpoint.d.ts +97 -0
- package/dist/adoption-checkpoint.d.ts.map +1 -0
- package/dist/adoption-checkpoint.js +209 -0
- package/dist/adoption-merge-preview.d.ts +28 -0
- package/dist/adoption-merge-preview.d.ts.map +1 -0
- package/dist/adoption-merge-preview.js +254 -0
- package/dist/adoption-report-renderer.d.ts +33 -0
- package/dist/adoption-report-renderer.d.ts.map +1 -0
- package/dist/adoption-report-renderer.js +257 -0
- package/dist/adoption-state.d.ts +100 -0
- package/dist/adoption-state.d.ts.map +1 -0
- package/dist/adoption-state.js +296 -0
- package/dist/adoption-three-way.d.ts +46 -0
- package/dist/adoption-three-way.d.ts.map +1 -0
- package/dist/adoption-three-way.js +181 -0
- package/dist/agent-brief.d.ts +77 -0
- package/dist/agent-brief.d.ts.map +1 -0
- package/dist/agent-brief.js +490 -0
- package/dist/agent-contract-gate.d.ts +108 -0
- package/dist/agent-contract-gate.d.ts.map +1 -0
- package/dist/agent-contract-gate.js +412 -0
- package/dist/agent-contract-templates.d.ts +63 -0
- package/dist/agent-contract-templates.d.ts.map +1 -0
- package/dist/agent-contract-templates.js +346 -0
- package/dist/agent-contract.d.ts +65 -0
- package/dist/agent-contract.d.ts.map +1 -0
- package/dist/agent-contract.js +555 -0
- package/dist/agent-handoff.d.ts +123 -0
- package/dist/agent-handoff.d.ts.map +1 -0
- package/dist/agent-handoff.js +470 -0
- package/dist/agent-instructions.d.ts +2 -0
- package/dist/agent-instructions.d.ts.map +1 -0
- package/dist/agent-instructions.js +21 -0
- package/dist/agent-orchestration.d.ts +61 -0
- package/dist/agent-orchestration.d.ts.map +1 -0
- package/dist/agent-orchestration.js +285 -0
- package/dist/agent-task-prep.d.ts +31 -0
- package/dist/agent-task-prep.d.ts.map +1 -0
- package/dist/agent-task-prep.js +73 -0
- package/dist/ai-readiness.d.ts +30 -0
- package/dist/ai-readiness.d.ts.map +1 -0
- package/dist/ai-readiness.js +279 -0
- package/dist/api-report.d.ts +51 -0
- package/dist/api-report.d.ts.map +1 -0
- package/dist/api-report.js +254 -0
- package/dist/apply-dispatch-trace.d.ts +93 -0
- package/dist/apply-dispatch-trace.d.ts.map +1 -0
- package/dist/apply-dispatch-trace.js +283 -0
- package/dist/apply-gate-result.d.ts +52 -0
- package/dist/apply-gate-result.d.ts.map +1 -0
- package/dist/apply-gate-result.js +44 -0
- package/dist/architecture-map.d.ts +118 -0
- package/dist/architecture-map.d.ts.map +1 -0
- package/dist/architecture-map.js +543 -0
- package/dist/area-explore.d.ts +75 -0
- package/dist/area-explore.d.ts.map +1 -0
- package/dist/area-explore.js +438 -0
- package/dist/area-map.d.ts +43 -0
- package/dist/area-map.d.ts.map +1 -0
- package/dist/area-map.js +197 -0
- package/dist/asset-provenance.d.ts +123 -0
- package/dist/asset-provenance.d.ts.map +1 -0
- package/dist/asset-provenance.js +209 -0
- package/dist/barrel-operations.d.ts +45 -0
- package/dist/barrel-operations.d.ts.map +1 -0
- package/dist/barrel-operations.js +159 -0
- package/dist/boundaries-changed-only.d.ts +62 -0
- package/dist/boundaries-changed-only.d.ts.map +1 -0
- package/dist/boundaries-changed-only.js +97 -0
- package/dist/boundary-suggestions.d.ts +20 -0
- package/dist/boundary-suggestions.d.ts.map +1 -0
- package/dist/boundary-suggestions.js +51 -0
- package/dist/bundle-diff.d.ts +98 -0
- package/dist/bundle-diff.d.ts.map +1 -0
- package/dist/bundle-diff.js +531 -0
- package/dist/bundle-replay.d.ts +68 -0
- package/dist/bundle-replay.d.ts.map +1 -0
- package/dist/bundle-replay.js +273 -0
- package/dist/bundle-validate-html.d.ts +11 -0
- package/dist/bundle-validate-html.d.ts.map +1 -0
- package/dist/bundle-validate-html.js +60 -0
- package/dist/change-intent.d.ts +36 -0
- package/dist/change-intent.d.ts.map +1 -0
- package/dist/change-intent.js +259 -0
- package/dist/changed-preflight.d.ts +59 -0
- package/dist/changed-preflight.d.ts.map +1 -0
- package/dist/changed-preflight.js +358 -0
- package/dist/changed-scope.d.ts +112 -0
- package/dist/changed-scope.d.ts.map +1 -0
- package/dist/changed-scope.js +172 -0
- package/dist/changes-summary.d.ts +87 -0
- package/dist/changes-summary.d.ts.map +1 -0
- package/dist/changes-summary.js +323 -0
- package/dist/check-result-v1.d.ts +90 -0
- package/dist/check-result-v1.d.ts.map +1 -0
- package/dist/check-result-v1.js +335 -0
- package/dist/ci-integrity-report.d.ts +38 -0
- package/dist/ci-integrity-report.d.ts.map +1 -0
- package/dist/ci-integrity-report.js +324 -0
- package/dist/ci-permissions-fix.d.ts +38 -0
- package/dist/ci-permissions-fix.d.ts.map +1 -0
- package/dist/ci-permissions-fix.js +201 -0
- package/dist/ci-permissions.d.ts +51 -0
- package/dist/ci-permissions.d.ts.map +1 -0
- package/dist/ci-permissions.js +431 -0
- package/dist/ci-predict.d.ts +42 -0
- package/dist/ci-predict.d.ts.map +1 -0
- package/dist/ci-predict.js +300 -0
- package/dist/ci-scaffold.d.ts +47 -0
- package/dist/ci-scaffold.d.ts.map +1 -0
- package/dist/ci-scaffold.js +638 -0
- package/dist/codemod-assist.d.ts +97 -0
- package/dist/codemod-assist.d.ts.map +1 -0
- package/dist/codemod-assist.js +261 -0
- package/dist/command-recommender.d.ts +25 -0
- package/dist/command-recommender.d.ts.map +1 -0
- package/dist/command-recommender.js +145 -0
- package/dist/command-suggester.d.ts +61 -0
- package/dist/command-suggester.d.ts.map +1 -0
- package/dist/command-suggester.js +159 -0
- package/dist/command-taxonomy.d.ts +38 -0
- package/dist/command-taxonomy.d.ts.map +1 -0
- package/dist/command-taxonomy.js +164 -0
- package/dist/compliance-evidence.d.ts +58 -0
- package/dist/compliance-evidence.d.ts.map +1 -0
- package/dist/compliance-evidence.js +260 -0
- package/dist/compliance-profiles.d.ts +42 -0
- package/dist/compliance-profiles.d.ts.map +1 -0
- package/dist/compliance-profiles.js +171 -0
- package/dist/construct-adoption-diff.d.ts +55 -0
- package/dist/construct-adoption-diff.d.ts.map +1 -0
- package/dist/construct-adoption-diff.js +331 -0
- package/dist/construct-adoption.d.ts +71 -0
- package/dist/construct-adoption.d.ts.map +1 -0
- package/dist/construct-adoption.js +331 -0
- package/dist/construct-inference.d.ts +44 -0
- package/dist/construct-inference.d.ts.map +1 -0
- package/dist/construct-inference.js +391 -0
- package/dist/construct-registry.d.ts +32 -0
- package/dist/construct-registry.d.ts.map +1 -0
- package/dist/construct-registry.js +198 -0
- package/dist/contract-file-rule.d.ts +37 -0
- package/dist/contract-file-rule.d.ts.map +1 -0
- package/dist/contract-file-rule.js +99 -0
- package/dist/contract-template-registry.d.ts +28 -0
- package/dist/contract-template-registry.d.ts.map +1 -0
- package/dist/contract-template-registry.js +161 -0
- package/dist/contradictions.d.ts +52 -0
- package/dist/contradictions.d.ts.map +1 -0
- package/dist/contradictions.js +391 -0
- package/dist/convention-registry.d.ts +44 -0
- package/dist/convention-registry.d.ts.map +1 -0
- package/dist/convention-registry.js +195 -0
- package/dist/coverage-report.d.ts +25 -0
- package/dist/coverage-report.d.ts.map +1 -0
- package/dist/coverage-report.js +190 -0
- package/dist/custom-checks.d.ts +146 -0
- package/dist/custom-checks.d.ts.map +1 -0
- package/dist/custom-checks.js +260 -0
- package/dist/dashboard/dashboard-data.d.ts +59 -0
- package/dist/dashboard/dashboard-data.d.ts.map +1 -0
- package/dist/dashboard/dashboard-data.js +653 -0
- package/dist/dashboard-export.d.ts +67 -0
- package/dist/dashboard-export.d.ts.map +1 -0
- package/dist/dashboard-export.js +203 -0
- package/dist/decision-records.d.ts +47 -0
- package/dist/decision-records.d.ts.map +1 -0
- package/dist/decision-records.js +255 -0
- package/dist/demo-package.d.ts +49 -0
- package/dist/demo-package.d.ts.map +1 -0
- package/dist/demo-package.js +305 -0
- package/dist/demo-script.d.ts +25 -0
- package/dist/demo-script.d.ts.map +1 -0
- package/dist/demo-script.js +198 -0
- package/dist/demo-workflow.d.ts +28 -0
- package/dist/demo-workflow.d.ts.map +1 -0
- package/dist/demo-workflow.js +178 -0
- package/dist/dev-cycle.d.ts +41 -0
- package/dist/dev-cycle.d.ts.map +1 -0
- package/dist/dev-cycle.js +94 -0
- package/dist/dev-session-html.d.ts +13 -0
- package/dist/dev-session-html.d.ts.map +1 -0
- package/dist/dev-session-html.js +223 -0
- package/dist/dev-session-report.d.ts +11 -0
- package/dist/dev-session-report.d.ts.map +1 -0
- package/dist/dev-session-report.js +206 -0
- package/dist/dev-session.d.ts +257 -0
- package/dist/dev-session.d.ts.map +1 -0
- package/dist/dev-session.js +568 -0
- package/dist/diagnostics-suggest.d.ts +17 -0
- package/dist/diagnostics-suggest.d.ts.map +1 -0
- package/dist/diagnostics-suggest.js +69 -0
- package/dist/docs-check.d.ts +40 -0
- package/dist/docs-check.d.ts.map +1 -0
- package/dist/docs-check.js +221 -0
- package/dist/doctor-acknowledgements.d.ts +69 -0
- package/dist/doctor-acknowledgements.d.ts.map +1 -0
- package/dist/doctor-acknowledgements.js +150 -0
- package/dist/doctor-result.d.ts +51 -0
- package/dist/doctor-result.d.ts.map +1 -0
- package/dist/doctor-result.js +7 -0
- package/dist/doctor-suppressions.d.ts +91 -0
- package/dist/doctor-suppressions.d.ts.map +1 -0
- package/dist/doctor-suppressions.js +238 -0
- package/dist/drift-baseline.d.ts +29 -0
- package/dist/drift-baseline.d.ts.map +1 -0
- package/dist/drift-baseline.js +80 -0
- package/dist/drift.d.ts +38 -0
- package/dist/drift.d.ts.map +1 -0
- package/dist/drift.js +107 -0
- package/dist/entrypoint-matrix.d.ts +61 -0
- package/dist/entrypoint-matrix.d.ts.map +1 -0
- package/dist/entrypoint-matrix.js +221 -0
- package/dist/examples-check.d.ts +36 -0
- package/dist/examples-check.d.ts.map +1 -0
- package/dist/examples-check.js +168 -0
- package/dist/execution-graph.d.ts +98 -0
- package/dist/execution-graph.d.ts.map +1 -0
- package/dist/execution-graph.js +484 -0
- package/dist/export-bundle.d.ts +10 -0
- package/dist/export-bundle.d.ts.map +1 -0
- package/dist/export-bundle.js +90 -0
- package/dist/failure-diagnostics.d.ts +63 -0
- package/dist/failure-diagnostics.d.ts.map +1 -0
- package/dist/failure-diagnostics.js +243 -0
- package/dist/feature-bundle.d.ts +111 -0
- package/dist/feature-bundle.d.ts.map +1 -0
- package/dist/feature-bundle.js +211 -0
- package/dist/feedback-actions-v2.d.ts +65 -0
- package/dist/feedback-actions-v2.d.ts.map +1 -0
- package/dist/feedback-actions-v2.js +183 -0
- package/dist/feedback-ingestion.d.ts +96 -0
- package/dist/feedback-ingestion.d.ts.map +1 -0
- package/dist/feedback-ingestion.js +400 -0
- package/dist/fix-preview.d.ts +82 -0
- package/dist/fix-preview.d.ts.map +1 -0
- package/dist/fix-preview.js +365 -0
- package/dist/fuzzy-impact.d.ts +50 -0
- package/dist/fuzzy-impact.d.ts.map +1 -0
- package/dist/fuzzy-impact.js +446 -0
- package/dist/generated-code.d.ts +97 -0
- package/dist/generated-code.d.ts.map +1 -0
- package/dist/generated-code.js +395 -0
- package/dist/git-helpers.d.ts +26 -0
- package/dist/git-helpers.d.ts.map +1 -0
- package/dist/git-helpers.js +110 -0
- package/dist/golden-output.d.ts +33 -0
- package/dist/golden-output.d.ts.map +1 -0
- package/dist/golden-output.js +92 -0
- package/dist/grounding/build-grounding.d.ts +53 -0
- package/dist/grounding/build-grounding.d.ts.map +1 -0
- package/dist/grounding/build-grounding.js +51 -0
- package/dist/grounding/nx-projects.d.ts +29 -0
- package/dist/grounding/nx-projects.d.ts.map +1 -0
- package/dist/grounding/nx-projects.js +109 -0
- package/dist/grounding/validate-extracted-plan.d.ts +20 -0
- package/dist/grounding/validate-extracted-plan.d.ts.map +1 -0
- package/dist/grounding/validate-extracted-plan.js +127 -0
- package/dist/healing-plan.d.ts +33 -0
- package/dist/healing-plan.d.ts.map +1 -0
- package/dist/healing-plan.js +346 -0
- package/dist/helper-registry.d.ts +90 -0
- package/dist/helper-registry.d.ts.map +1 -0
- package/dist/helper-registry.js +529 -0
- package/dist/impact-analysis.d.ts +150 -0
- package/dist/impact-analysis.d.ts.map +1 -0
- package/dist/impact-analysis.js +697 -0
- package/dist/impact-graph-render.d.ts +51 -0
- package/dist/impact-graph-render.d.ts.map +1 -0
- package/dist/impact-graph-render.js +139 -0
- package/dist/impact-graph.d.ts +17 -0
- package/dist/impact-graph.d.ts.map +1 -0
- package/dist/impact-graph.js +119 -0
- package/dist/impact-render.d.ts +22 -0
- package/dist/impact-render.d.ts.map +1 -0
- package/dist/impact-render.js +413 -0
- package/dist/import-graph-analysis.d.ts +28 -0
- package/dist/import-graph-analysis.d.ts.map +1 -0
- package/dist/import-graph-analysis.js +193 -0
- package/dist/import-hygiene.d.ts +93 -0
- package/dist/import-hygiene.d.ts.map +1 -0
- package/dist/import-hygiene.js +366 -0
- package/dist/index.d.ts +223 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +233 -0
- package/dist/ingest-adoption.d.ts +50 -0
- package/dist/ingest-adoption.d.ts.map +1 -0
- package/dist/ingest-adoption.js +183 -0
- package/dist/ingest-apply.d.ts +80 -0
- package/dist/ingest-apply.d.ts.map +1 -0
- package/dist/ingest-apply.js +227 -0
- package/dist/ingest-body-extractor.d.ts +28 -0
- package/dist/ingest-body-extractor.d.ts.map +1 -0
- package/dist/ingest-body-extractor.js +129 -0
- package/dist/ingest-drafts.d.ts +16 -0
- package/dist/ingest-drafts.d.ts.map +1 -0
- package/dist/ingest-drafts.js +482 -0
- package/dist/inspector-cache.d.ts +41 -0
- package/dist/inspector-cache.d.ts.map +1 -0
- package/dist/inspector-cache.js +104 -0
- package/dist/install-smoke.d.ts +44 -0
- package/dist/install-smoke.d.ts.map +1 -0
- package/dist/install-smoke.js +31 -0
- package/dist/knowledge-authoring.d.ts +151 -0
- package/dist/knowledge-authoring.d.ts.map +1 -0
- package/dist/knowledge-authoring.js +586 -0
- package/dist/knowledge-graph.d.ts +76 -0
- package/dist/knowledge-graph.d.ts.map +1 -0
- package/dist/knowledge-graph.js +336 -0
- package/dist/knowledge-lint.d.ts +97 -0
- package/dist/knowledge-lint.d.ts.map +1 -0
- package/dist/knowledge-lint.js +302 -0
- package/dist/knowledge-rename.d.ts +38 -0
- package/dist/knowledge-rename.d.ts.map +1 -0
- package/dist/knowledge-rename.js +88 -0
- package/dist/knowledge-stale.d.ts +124 -0
- package/dist/knowledge-stale.d.ts.map +1 -0
- package/dist/knowledge-stale.js +892 -0
- package/dist/languages/command-inference.d.ts +27 -0
- package/dist/languages/command-inference.d.ts.map +1 -0
- package/dist/languages/command-inference.js +214 -0
- package/dist/languages/dependency-scan.d.ts +33 -0
- package/dist/languages/dependency-scan.d.ts.map +1 -0
- package/dist/languages/dependency-scan.js +343 -0
- package/dist/languages/index.d.ts +14 -0
- package/dist/languages/index.d.ts.map +1 -0
- package/dist/languages/index.js +13 -0
- package/dist/languages/language-boundaries.d.ts +30 -0
- package/dist/languages/language-boundaries.d.ts.map +1 -0
- package/dist/languages/language-boundaries.js +176 -0
- package/dist/languages/language-cache.d.ts +54 -0
- package/dist/languages/language-cache.d.ts.map +1 -0
- package/dist/languages/language-cache.js +236 -0
- package/dist/languages/language-detection.d.ts +30 -0
- package/dist/languages/language-detection.d.ts.map +1 -0
- package/dist/languages/language-detection.js +584 -0
- package/dist/languages/language-id.d.ts +15 -0
- package/dist/languages/language-id.d.ts.map +1 -0
- package/dist/languages/language-id.js +15 -0
- package/dist/languages/language-runner.d.ts +90 -0
- package/dist/languages/language-runner.d.ts.map +1 -0
- package/dist/languages/language-runner.js +346 -0
- package/dist/languages/polyglot-boundary.d.ts +80 -0
- package/dist/languages/polyglot-boundary.d.ts.map +1 -0
- package/dist/languages/polyglot-boundary.js +373 -0
- package/dist/languages/polyglot-ci.d.ts +25 -0
- package/dist/languages/polyglot-ci.d.ts.map +1 -0
- package/dist/languages/polyglot-ci.js +278 -0
- package/dist/languages/test-impact.d.ts +19 -0
- package/dist/languages/test-impact.d.ts.map +1 -0
- package/dist/languages/test-impact.js +157 -0
- package/dist/loader-diagnostics.d.ts +40 -0
- package/dist/loader-diagnostics.d.ts.map +1 -0
- package/dist/loader-diagnostics.js +49 -0
- package/dist/memory-diff.d.ts +60 -0
- package/dist/memory-diff.d.ts.map +1 -0
- package/dist/memory-diff.js +302 -0
- package/dist/migration-profile-registry.d.ts +26 -0
- package/dist/migration-profile-registry.d.ts.map +1 -0
- package/dist/migration-profile-registry.js +135 -0
- package/dist/migration-readiness.d.ts +101 -0
- package/dist/migration-readiness.d.ts.map +1 -0
- package/dist/migration-readiness.js +253 -0
- package/dist/monorepo-onboarding.d.ts +51 -0
- package/dist/monorepo-onboarding.d.ts.map +1 -0
- package/dist/monorepo-onboarding.js +235 -0
- package/dist/onboarding-adoption-diff.d.ts +53 -0
- package/dist/onboarding-adoption-diff.d.ts.map +1 -0
- package/dist/onboarding-adoption-diff.js +285 -0
- package/dist/onboarding-adoption.d.ts +136 -0
- package/dist/onboarding-adoption.d.ts.map +1 -0
- package/dist/onboarding-adoption.js +702 -0
- package/dist/onboarding-agent-import.d.ts +40 -0
- package/dist/onboarding-agent-import.d.ts.map +1 -0
- package/dist/onboarding-agent-import.js +114 -0
- package/dist/onboarding-diff.d.ts +39 -0
- package/dist/onboarding-diff.d.ts.map +1 -0
- package/dist/onboarding-diff.js +240 -0
- package/dist/onboarding-drafts.d.ts +28 -0
- package/dist/onboarding-drafts.d.ts.map +1 -0
- package/dist/onboarding-drafts.js +234 -0
- package/dist/onboarding-report.d.ts +8 -0
- package/dist/onboarding-report.d.ts.map +1 -0
- package/dist/onboarding-report.js +239 -0
- package/dist/onboarding.d.ts +134 -0
- package/dist/onboarding.d.ts.map +1 -0
- package/dist/onboarding.js +729 -0
- package/dist/ownership.d.ts +38 -0
- package/dist/ownership.d.ts.map +1 -0
- package/dist/ownership.js +102 -0
- package/dist/pack-author-ux.d.ts +58 -0
- package/dist/pack-author-ux.d.ts.map +1 -0
- package/dist/pack-author-ux.js +219 -0
- package/dist/pack-author.d.ts +94 -0
- package/dist/pack-author.d.ts.map +1 -0
- package/dist/pack-author.js +208 -0
- package/dist/pack-compatibility.d.ts +21 -0
- package/dist/pack-compatibility.d.ts.map +1 -0
- package/dist/pack-compatibility.js +114 -0
- package/dist/pack-contributions-inventory.d.ts +121 -0
- package/dist/pack-contributions-inventory.d.ts.map +1 -0
- package/dist/pack-contributions-inventory.js +732 -0
- package/dist/pack-docs.d.ts +11 -0
- package/dist/pack-docs.d.ts.map +1 -0
- package/dist/pack-docs.js +101 -0
- package/dist/pack-doctor.d.ts +50 -0
- package/dist/pack-doctor.d.ts.map +1 -0
- package/dist/pack-doctor.js +302 -0
- package/dist/pack-helper-registry.d.ts +29 -0
- package/dist/pack-helper-registry.d.ts.map +1 -0
- package/dist/pack-helper-registry.js +144 -0
- package/dist/pack-pending.d.ts +68 -0
- package/dist/pack-pending.d.ts.map +1 -0
- package/dist/pack-pending.js +189 -0
- package/dist/pack-quality-score.d.ts +44 -0
- package/dist/pack-quality-score.d.ts.map +1 -0
- package/dist/pack-quality-score.js +155 -0
- package/dist/pack-release-check.d.ts +24 -0
- package/dist/pack-release-check.d.ts.map +1 -0
- package/dist/pack-release-check.js +258 -0
- package/dist/pack-signature-status.d.ts +72 -0
- package/dist/pack-signature-status.d.ts.map +1 -0
- package/dist/pack-signature-status.js +222 -0
- package/dist/pack-symbol-compat.d.ts +60 -0
- package/dist/pack-symbol-compat.d.ts.map +1 -0
- package/dist/pack-symbol-compat.js +371 -0
- package/dist/pack-test-runner.d.ts +59 -0
- package/dist/pack-test-runner.d.ts.map +1 -0
- package/dist/pack-test-runner.js +211 -0
- package/dist/pipeline-command-dictionary.d.ts +2 -0
- package/dist/pipeline-command-dictionary.d.ts.map +1 -0
- package/dist/pipeline-command-dictionary.js +20 -0
- package/dist/pipeline-lint.d.ts +30 -0
- package/dist/pipeline-lint.d.ts.map +1 -0
- package/dist/pipeline-lint.js +134 -0
- package/dist/plan-dependency-graph.d.ts +25 -0
- package/dist/plan-dependency-graph.d.ts.map +1 -0
- package/dist/plan-dependency-graph.js +195 -0
- package/dist/plan-review.d.ts +64 -0
- package/dist/plan-review.d.ts.map +1 -0
- package/dist/plan-review.js +242 -0
- package/dist/plan-simulation.d.ts +108 -0
- package/dist/plan-simulation.d.ts.map +1 -0
- package/dist/plan-simulation.js +767 -0
- package/dist/playbook-registry.d.ts +25 -0
- package/dist/playbook-registry.d.ts.map +1 -0
- package/dist/playbook-registry.js +148 -0
- package/dist/playbook-script.d.ts +60 -0
- package/dist/playbook-script.d.ts.map +1 -0
- package/dist/playbook-script.js +161 -0
- package/dist/plugin-lifecycle-profile-registry.d.ts +52 -0
- package/dist/plugin-lifecycle-profile-registry.d.ts.map +1 -0
- package/dist/plugin-lifecycle-profile-registry.js +202 -0
- package/dist/plugin-lifecycle.d.ts +132 -0
- package/dist/plugin-lifecycle.d.ts.map +1 -0
- package/dist/plugin-lifecycle.js +477 -0
- package/dist/policy-engine.d.ts +101 -0
- package/dist/policy-engine.d.ts.map +1 -0
- package/dist/policy-engine.js +321 -0
- package/dist/policy-override-audit.d.ts +18 -0
- package/dist/policy-override-audit.d.ts.map +1 -0
- package/dist/policy-override-audit.js +54 -0
- package/dist/policy-overrides.d.ts +35 -0
- package/dist/policy-overrides.d.ts.map +1 -0
- package/dist/policy-overrides.js +84 -0
- package/dist/policy-test.d.ts +83 -0
- package/dist/policy-test.d.ts.map +1 -0
- package/dist/policy-test.js +342 -0
- package/dist/pr-summary.d.ts +34 -0
- package/dist/pr-summary.d.ts.map +1 -0
- package/dist/pr-summary.js +220 -0
- package/dist/product-coherence.d.ts +21 -0
- package/dist/product-coherence.d.ts.map +1 -0
- package/dist/product-coherence.js +158 -0
- package/dist/profile-registry.d.ts +42 -0
- package/dist/profile-registry.d.ts.map +1 -0
- package/dist/profile-registry.js +104 -0
- package/dist/project-coupling-audit.d.ts +64 -0
- package/dist/project-coupling-audit.d.ts.map +1 -0
- package/dist/project-coupling-audit.js +282 -0
- package/dist/project-overview.d.ts +14 -0
- package/dist/project-overview.d.ts.map +1 -0
- package/dist/project-overview.js +27 -0
- package/dist/propose-knowledge.d.ts +64 -0
- package/dist/propose-knowledge.d.ts.map +1 -0
- package/dist/propose-knowledge.js +367 -0
- package/dist/quality-baseline.d.ts +123 -0
- package/dist/quality-baseline.d.ts.map +1 -0
- package/dist/quality-baseline.js +433 -0
- package/dist/quality-html.d.ts +7 -0
- package/dist/quality-html.d.ts.map +1 -0
- package/dist/quality-html.js +64 -0
- package/dist/quality-report.d.ts +49 -0
- package/dist/quality-report.d.ts.map +1 -0
- package/dist/quality-report.js +296 -0
- package/dist/query-resolver.d.ts +38 -0
- package/dist/query-resolver.d.ts.map +1 -0
- package/dist/query-resolver.js +163 -0
- package/dist/ranker-explainability.d.ts +91 -0
- package/dist/ranker-explainability.d.ts.map +1 -0
- package/dist/ranker-explainability.js +550 -0
- package/dist/reference-lookup.d.ts +8 -0
- package/dist/reference-lookup.d.ts.map +1 -0
- package/dist/reference-lookup.js +18 -0
- package/dist/registration-hint-registry.d.ts +55 -0
- package/dist/registration-hint-registry.d.ts.map +1 -0
- package/dist/registration-hint-registry.js +327 -0
- package/dist/registry-lifecycle.d.ts +47 -0
- package/dist/registry-lifecycle.d.ts.map +1 -0
- package/dist/registry-lifecycle.js +214 -0
- package/dist/release-readiness.d.ts +64 -0
- package/dist/release-readiness.d.ts.map +1 -0
- package/dist/release-readiness.js +456 -0
- package/dist/release-smoke.d.ts +138 -0
- package/dist/release-smoke.d.ts.map +1 -0
- package/dist/release-smoke.js +459 -0
- package/dist/release-train.d.ts +33 -0
- package/dist/release-train.d.ts.map +1 -0
- package/dist/release-train.js +104 -0
- package/dist/repo-memory.d.ts +95 -0
- package/dist/repo-memory.d.ts.map +1 -0
- package/dist/repo-memory.js +614 -0
- package/dist/report-site.d.ts +92 -0
- package/dist/report-site.d.ts.map +1 -0
- package/dist/report-site.js +658 -0
- package/dist/reposet.d.ts +56 -0
- package/dist/reposet.d.ts.map +1 -0
- package/dist/reposet.js +160 -0
- package/dist/repository-intelligence.d.ts +145 -0
- package/dist/repository-intelligence.d.ts.map +1 -0
- package/dist/repository-intelligence.js +729 -0
- package/dist/repository-knowledge-model.d.ts +218 -0
- package/dist/repository-knowledge-model.d.ts.map +1 -0
- package/dist/repository-knowledge-model.js +939 -0
- package/dist/repository-map.d.ts +72 -0
- package/dist/repository-map.d.ts.map +1 -0
- package/dist/repository-map.js +332 -0
- package/dist/repository-stats.d.ts +66 -0
- package/dist/repository-stats.d.ts.map +1 -0
- package/dist/repository-stats.js +329 -0
- package/dist/review-comment-renderer.d.ts +59 -0
- package/dist/review-comment-renderer.d.ts.map +1 -0
- package/dist/review-comment-renderer.js +181 -0
- package/dist/review-comment-v2.d.ts +9 -0
- package/dist/review-comment-v2.d.ts.map +1 -0
- package/dist/review-comment-v2.js +178 -0
- package/dist/review-html.d.ts +13 -0
- package/dist/review-html.d.ts.map +1 -0
- package/dist/review-html.js +79 -0
- package/dist/review-packet-v2.d.ts +29 -0
- package/dist/review-packet-v2.d.ts.map +1 -0
- package/dist/review-packet-v2.js +71 -0
- package/dist/review-packet-v3.d.ts +22 -0
- package/dist/review-packet-v3.d.ts.map +1 -0
- package/dist/review-packet-v3.js +181 -0
- package/dist/review-packet.d.ts +49 -0
- package/dist/review-packet.d.ts.map +1 -0
- package/dist/review-packet.js +129 -0
- package/dist/risk-signals.d.ts +28 -0
- package/dist/risk-signals.d.ts.map +1 -0
- package/dist/risk-signals.js +68 -0
- package/dist/role-views.d.ts +50 -0
- package/dist/role-views.d.ts.map +1 -0
- package/dist/role-views.js +334 -0
- package/dist/rounds.d.ts +52 -0
- package/dist/rounds.d.ts.map +1 -0
- package/dist/rounds.js +172 -0
- package/dist/rule-drift.d.ts +42 -0
- package/dist/rule-drift.d.ts.map +1 -0
- package/dist/rule-drift.js +148 -0
- package/dist/rule-quality.d.ts +73 -0
- package/dist/rule-quality.d.ts.map +1 -0
- package/dist/rule-quality.js +356 -0
- package/dist/rule-scaffold.d.ts +71 -0
- package/dist/rule-scaffold.d.ts.map +1 -0
- package/dist/rule-scaffold.js +258 -0
- package/dist/safety-audit-deep.d.ts +38 -0
- package/dist/safety-audit-deep.d.ts.map +1 -0
- package/dist/safety-audit-deep.js +162 -0
- package/dist/safety-audit.d.ts +91 -0
- package/dist/safety-audit.d.ts.map +1 -0
- package/dist/safety-audit.js +138 -0
- package/dist/safety-html.d.ts +7 -0
- package/dist/safety-html.d.ts.map +1 -0
- package/dist/safety-html.js +70 -0
- package/dist/scaffold-coverage.d.ts +46 -0
- package/dist/scaffold-coverage.d.ts.map +1 -0
- package/dist/scaffold-coverage.js +273 -0
- package/dist/scaffold-patterns.d.ts +38 -0
- package/dist/scaffold-patterns.d.ts.map +1 -0
- package/dist/scaffold-patterns.js +282 -0
- package/dist/schema-inventory.d.ts +55 -0
- package/dist/schema-inventory.d.ts.map +1 -0
- package/dist/schema-inventory.js +301 -0
- package/dist/search-index.d.ts +75 -0
- package/dist/search-index.d.ts.map +1 -0
- package/dist/search-index.js +531 -0
- package/dist/search-tuning-explain.d.ts +68 -0
- package/dist/search-tuning-explain.d.ts.map +1 -0
- package/dist/search-tuning-explain.js +207 -0
- package/dist/search-tuning-registry.d.ts +54 -0
- package/dist/search-tuning-registry.d.ts.map +1 -0
- package/dist/search-tuning-registry.js +303 -0
- package/dist/self-audit.d.ts +59 -0
- package/dist/self-audit.d.ts.map +1 -0
- package/dist/self-audit.js +192 -0
- package/dist/self-config-doctor-v2.d.ts +57 -0
- package/dist/self-config-doctor-v2.d.ts.map +1 -0
- package/dist/self-config-doctor-v2.js +653 -0
- package/dist/self-config-doctor.d.ts +47 -0
- package/dist/self-config-doctor.d.ts.map +1 -0
- package/dist/self-config-doctor.js +432 -0
- package/dist/sharkcraft-inspector.d.ts +73 -0
- package/dist/sharkcraft-inspector.d.ts.map +1 -0
- package/dist/sharkcraft-inspector.js +745 -0
- package/dist/spec/spec-cross-validate.d.ts +17 -0
- package/dist/spec/spec-cross-validate.d.ts.map +1 -0
- package/dist/spec/spec-cross-validate.js +53 -0
- package/dist/spec/spec-discovery.d.ts +27 -0
- package/dist/spec/spec-discovery.d.ts.map +1 -0
- package/dist/spec/spec-discovery.js +78 -0
- package/dist/spec/spec-review.d.ts +36 -0
- package/dist/spec/spec-review.d.ts.map +1 -0
- package/dist/spec/spec-review.js +37 -0
- package/dist/stability-map.d.ts +62 -0
- package/dist/stability-map.d.ts.map +1 -0
- package/dist/stability-map.js +404 -0
- package/dist/start-here.d.ts +49 -0
- package/dist/start-here.d.ts.map +1 -0
- package/dist/start-here.js +259 -0
- package/dist/surface-profile-detect.d.ts +42 -0
- package/dist/surface-profile-detect.d.ts.map +1 -0
- package/dist/surface-profile-detect.js +76 -0
- package/dist/symbol-index.d.ts +108 -0
- package/dist/symbol-index.d.ts.map +1 -0
- package/dist/symbol-index.js +483 -0
- package/dist/task-decompose.d.ts +38 -0
- package/dist/task-decompose.d.ts.map +1 -0
- package/dist/task-decompose.js +154 -0
- package/dist/task-packet.d.ts +104 -0
- package/dist/task-packet.d.ts.map +1 -0
- package/dist/task-packet.js +156 -0
- package/dist/task-ranker.d.ts +51 -0
- package/dist/task-ranker.d.ts.map +1 -0
- package/dist/task-ranker.js +410 -0
- package/dist/task-risk.d.ts +84 -0
- package/dist/task-risk.d.ts.map +1 -0
- package/dist/task-risk.js +731 -0
- package/dist/task-routing-hint-registry.d.ts +36 -0
- package/dist/task-routing-hint-registry.d.ts.map +1 -0
- package/dist/task-routing-hint-registry.js +186 -0
- package/dist/template-authoring.d.ts +113 -0
- package/dist/template-authoring.d.ts.map +1 -0
- package/dist/template-authoring.js +521 -0
- package/dist/template-body-inference-v2.d.ts +19 -0
- package/dist/template-body-inference-v2.d.ts.map +1 -0
- package/dist/template-body-inference-v2.js +468 -0
- package/dist/template-body-inference.d.ts +59 -0
- package/dist/template-body-inference.d.ts.map +1 -0
- package/dist/template-body-inference.js +277 -0
- package/dist/template-drift.d.ts +39 -0
- package/dist/template-drift.d.ts.map +1 -0
- package/dist/template-drift.js +353 -0
- package/dist/template-lint.d.ts +31 -0
- package/dist/template-lint.d.ts.map +1 -0
- package/dist/template-lint.js +113 -0
- package/dist/test-definitions.d.ts +41 -0
- package/dist/test-definitions.d.ts.map +1 -0
- package/dist/test-definitions.js +6 -0
- package/dist/test-impact.d.ts +30 -0
- package/dist/test-impact.d.ts.map +1 -0
- package/dist/test-impact.js +173 -0
- package/dist/test-runner.d.ts +87 -0
- package/dist/test-runner.d.ts.map +1 -0
- package/dist/test-runner.js +560 -0
- package/dist/uncertainty-report.d.ts +46 -0
- package/dist/uncertainty-report.d.ts.map +1 -0
- package/dist/uncertainty-report.js +108 -0
- package/dist/uncertainty.d.ts +38 -0
- package/dist/uncertainty.d.ts.map +1 -0
- package/dist/uncertainty.js +115 -0
- package/dist/universal-search.d.ts +64 -0
- package/dist/universal-search.d.ts.map +1 -0
- package/dist/universal-search.js +347 -0
- package/dist/upgrade-advisor.d.ts +22 -0
- package/dist/upgrade-advisor.d.ts.map +1 -0
- package/dist/upgrade-advisor.js +109 -0
- package/dist/why-file.d.ts +75 -0
- package/dist/why-file.d.ts.map +1 -0
- package/dist/why-file.js +202 -0
- package/dist/workflow-simulation.d.ts +46 -0
- package/dist/workflow-simulation.d.ts.map +1 -0
- package/dist/workflow-simulation.js +154 -0
- package/package.json +66 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ISharkcraftInspection } from './sharkcraft-inspector.js';
|
|
2
|
+
export declare const UPGRADE_ADVISOR_SCHEMA = "sharkcraft.upgrade-advisor/v1";
|
|
3
|
+
export interface IUpgradeFinding {
|
|
4
|
+
id: string;
|
|
5
|
+
severity: 'info' | 'warning' | 'error';
|
|
6
|
+
message: string;
|
|
7
|
+
suggestedAction: string;
|
|
8
|
+
}
|
|
9
|
+
export interface IUpgradeAdviceReport {
|
|
10
|
+
schema: typeof UPGRADE_ADVISOR_SCHEMA;
|
|
11
|
+
generatedAt: string;
|
|
12
|
+
fromVersion: string;
|
|
13
|
+
toVersion: string;
|
|
14
|
+
detectedSchemas: Record<string, string>;
|
|
15
|
+
findings: readonly IUpgradeFinding[];
|
|
16
|
+
recommendedSteps: readonly string[];
|
|
17
|
+
}
|
|
18
|
+
export declare function buildUpgradeAdvice(inspection: ISharkcraftInspection, options?: {
|
|
19
|
+
from?: string;
|
|
20
|
+
to?: string;
|
|
21
|
+
}): IUpgradeAdviceReport;
|
|
22
|
+
//# sourceMappingURL=upgrade-advisor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade-advisor.d.ts","sourceRoot":"","sources":["../src/upgrade-advisor.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,eAAO,MAAM,sBAAsB,kCAAkC,CAAC;AAEtE,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,OAAO,sBAAsB,CAAC;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,QAAQ,EAAE,SAAS,eAAe,EAAE,CAAC;IACrC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAiDD,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,qBAAqB,EACjC,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAO,GAC3C,oBAAoB,CAwDtB"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SharkCraft upgrade advisor.
|
|
3
|
+
*
|
|
4
|
+
* Read-only advisor that detects schema versions across the repo and
|
|
5
|
+
* suggests safe manual upgrade steps. Never auto-migrates.
|
|
6
|
+
*/
|
|
7
|
+
import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
|
|
8
|
+
import * as nodePath from 'node:path';
|
|
9
|
+
export const UPGRADE_ADVISOR_SCHEMA = 'sharkcraft.upgrade-advisor/v1';
|
|
10
|
+
function detectSchemaVersion(text) {
|
|
11
|
+
const m = /"schema"\s*:\s*"([^"]+)"/.exec(text);
|
|
12
|
+
return m ? (m[1] ?? null) : null;
|
|
13
|
+
}
|
|
14
|
+
function scanFile(file) {
|
|
15
|
+
try {
|
|
16
|
+
const t = readFileSync(file, 'utf8');
|
|
17
|
+
return detectSchemaVersion(t);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function walkSchemas(dir, max) {
|
|
24
|
+
const out = {};
|
|
25
|
+
const stack = [dir];
|
|
26
|
+
let count = 0;
|
|
27
|
+
while (stack.length && count < max) {
|
|
28
|
+
const cur = stack.pop();
|
|
29
|
+
let entries = [];
|
|
30
|
+
try {
|
|
31
|
+
entries = readdirSync(cur);
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
for (const f of entries) {
|
|
37
|
+
const full = nodePath.join(cur, f);
|
|
38
|
+
try {
|
|
39
|
+
const stat = statSync(full);
|
|
40
|
+
if (stat.isDirectory())
|
|
41
|
+
stack.push(full);
|
|
42
|
+
else if (f.endsWith('.json')) {
|
|
43
|
+
const v = scanFile(full);
|
|
44
|
+
if (v)
|
|
45
|
+
out[v] = (out[v] ?? '') + (full + '\n');
|
|
46
|
+
count++;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// Return only the *schema names → first file* pairing.
|
|
55
|
+
const compact = {};
|
|
56
|
+
for (const [k, v] of Object.entries(out))
|
|
57
|
+
compact[k] = v.split('\n')[0] ?? '';
|
|
58
|
+
return compact;
|
|
59
|
+
}
|
|
60
|
+
export function buildUpgradeAdvice(inspection, options = {}) {
|
|
61
|
+
const findings = [];
|
|
62
|
+
const detected = walkSchemas(nodePath.join(inspection.projectRoot, '.sharkcraft'), 600);
|
|
63
|
+
const fromVersion = options.from ?? '0.1.0-alpha.2';
|
|
64
|
+
const toVersion = options.to ?? 'current';
|
|
65
|
+
// Heuristics: surface known evolving schemas.
|
|
66
|
+
if (detected['sharkcraft.repository-map/v1']) {
|
|
67
|
+
findings.push({
|
|
68
|
+
id: 'repository-map-v1-present',
|
|
69
|
+
severity: 'info',
|
|
70
|
+
message: 'sharkcraft.repository-map/v1 artefacts found. sharkcraft.repository-intelligence/v1 ships alongside it.',
|
|
71
|
+
suggestedAction: 'No action required; run `shrk intelligence graph` for the new surface.',
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
if (detected['sharkcraft.feature-bundle/v1']) {
|
|
75
|
+
findings.push({
|
|
76
|
+
id: 'feature-bundle-v1',
|
|
77
|
+
severity: 'info',
|
|
78
|
+
message: 'Feature bundle v1 schema detected.',
|
|
79
|
+
suggestedAction: 'No migration needed — schema is stable across 0.1.x.',
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
// Adoption checkpoints can become stale across SharkCraft versions.
|
|
83
|
+
const checkpointDir = nodePath.join(inspection.projectRoot, '.sharkcraft', 'adoption-checkpoints');
|
|
84
|
+
if (existsSync(checkpointDir)) {
|
|
85
|
+
findings.push({
|
|
86
|
+
id: 'adoption-checkpoint-rehash',
|
|
87
|
+
severity: 'info',
|
|
88
|
+
message: 'Adoption checkpoints found. Upgrading SharkCraft may rewrite diff formatting.',
|
|
89
|
+
suggestedAction: 'After upgrade, re-run adoption with `--record-checkpoint` if hashes diverge.',
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
const recommendedSteps = [
|
|
93
|
+
'shrk doctor',
|
|
94
|
+
'shrk commands doctor',
|
|
95
|
+
'shrk safety audit',
|
|
96
|
+
'shrk release readiness',
|
|
97
|
+
'bun x tsc -p tsconfig.base.json --noEmit',
|
|
98
|
+
'bun test',
|
|
99
|
+
];
|
|
100
|
+
return {
|
|
101
|
+
schema: UPGRADE_ADVISOR_SCHEMA,
|
|
102
|
+
generatedAt: new Date().toISOString(),
|
|
103
|
+
fromVersion,
|
|
104
|
+
toVersion,
|
|
105
|
+
detectedSchemas: detected,
|
|
106
|
+
findings,
|
|
107
|
+
recommendedSteps,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DX/feedback3 — `shrk why <file>`.
|
|
3
|
+
*
|
|
4
|
+
* Closes a dangling promise: `ide.command.ts:112` already suggests
|
|
5
|
+
* `shrk why "<path>"` to the user, but the verb didn't exist until
|
|
6
|
+
* now. This helper answers: "for THIS file, which registries apply
|
|
7
|
+
* and why?" Pure composition over the existing inspection — no new
|
|
8
|
+
* asset kinds, no LLM, no shell.
|
|
9
|
+
*
|
|
10
|
+
* Symbol queries (`shrk why <symbol>`) are intentionally out of scope
|
|
11
|
+
* for the first cut. They require AST analysis that this verb
|
|
12
|
+
* shouldn't grow on its own. The verb gracefully accepts a non-path
|
|
13
|
+
* argument and routes to `shrk knowledge search` via the suggestion
|
|
14
|
+
* block.
|
|
15
|
+
*/
|
|
16
|
+
import type { ISharkcraftInspection } from './sharkcraft-inspector.js';
|
|
17
|
+
export declare const WHY_FILE_SCHEMA = "sharkcraft.why/v1";
|
|
18
|
+
export type WhyTargetKind = 'file' | 'directory' | 'missing';
|
|
19
|
+
export interface IWhyTarget {
|
|
20
|
+
readonly inputPath: string;
|
|
21
|
+
readonly resolvedPath: string;
|
|
22
|
+
readonly relativePath: string;
|
|
23
|
+
readonly kind: WhyTargetKind;
|
|
24
|
+
}
|
|
25
|
+
export interface IWhyPathConvention {
|
|
26
|
+
readonly id: string;
|
|
27
|
+
readonly title: string;
|
|
28
|
+
readonly canonicalPath: string;
|
|
29
|
+
readonly source?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface IWhyRule {
|
|
32
|
+
readonly id: string;
|
|
33
|
+
readonly title: string;
|
|
34
|
+
readonly priority: string;
|
|
35
|
+
readonly scope: readonly string[];
|
|
36
|
+
readonly tags: readonly string[];
|
|
37
|
+
readonly appliesWhen: readonly string[];
|
|
38
|
+
readonly source?: string;
|
|
39
|
+
readonly reason: string;
|
|
40
|
+
}
|
|
41
|
+
export interface IWhyBoundaryRule {
|
|
42
|
+
readonly id: string;
|
|
43
|
+
readonly title: string;
|
|
44
|
+
readonly severity?: string;
|
|
45
|
+
readonly from: readonly string[];
|
|
46
|
+
readonly forbiddenImports?: readonly string[];
|
|
47
|
+
readonly allowedImports?: readonly string[];
|
|
48
|
+
readonly source?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface IWhyKnowledge {
|
|
51
|
+
readonly id: string;
|
|
52
|
+
readonly title: string;
|
|
53
|
+
readonly type: string;
|
|
54
|
+
readonly source?: string;
|
|
55
|
+
readonly reason: string;
|
|
56
|
+
}
|
|
57
|
+
export interface IWhyReport {
|
|
58
|
+
readonly schema: typeof WHY_FILE_SCHEMA;
|
|
59
|
+
readonly target: IWhyTarget;
|
|
60
|
+
readonly inferredPackage?: string;
|
|
61
|
+
readonly inferredLayer?: string;
|
|
62
|
+
readonly pathConventions: readonly IWhyPathConvention[];
|
|
63
|
+
readonly rules: readonly IWhyRule[];
|
|
64
|
+
readonly boundaries: readonly IWhyBoundaryRule[];
|
|
65
|
+
readonly knowledge: readonly IWhyKnowledge[];
|
|
66
|
+
readonly suggestedNext: readonly string[];
|
|
67
|
+
}
|
|
68
|
+
export interface IBuildWhyReportInput {
|
|
69
|
+
readonly inspection: ISharkcraftInspection;
|
|
70
|
+
readonly projectRoot: string;
|
|
71
|
+
readonly target: string;
|
|
72
|
+
readonly limit?: number;
|
|
73
|
+
}
|
|
74
|
+
export declare function buildWhyReport(input: IBuildWhyReportInput): IWhyReport;
|
|
75
|
+
//# sourceMappingURL=why-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"why-file.d.ts","sourceRoot":"","sources":["../src/why-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,eAAO,MAAM,eAAe,sBAAsB,CAAC;AAEnD,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;AAE7D,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;CAC9B;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9C,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,MAAM,EAAE,OAAO,eAAe,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,eAAe,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACxD,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;IACpC,QAAQ,CAAC,UAAU,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACjD,QAAQ,CAAC,SAAS,EAAE,SAAS,aAAa,EAAE,CAAC;IAC7C,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3C;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,UAAU,EAAE,qBAAqB,CAAC;IAC3C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,oBAAoB,GAAG,UAAU,CAuBtE"}
|
package/dist/why-file.js
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DX/feedback3 — `shrk why <file>`.
|
|
3
|
+
*
|
|
4
|
+
* Closes a dangling promise: `ide.command.ts:112` already suggests
|
|
5
|
+
* `shrk why "<path>"` to the user, but the verb didn't exist until
|
|
6
|
+
* now. This helper answers: "for THIS file, which registries apply
|
|
7
|
+
* and why?" Pure composition over the existing inspection — no new
|
|
8
|
+
* asset kinds, no LLM, no shell.
|
|
9
|
+
*
|
|
10
|
+
* Symbol queries (`shrk why <symbol>`) are intentionally out of scope
|
|
11
|
+
* for the first cut. They require AST analysis that this verb
|
|
12
|
+
* shouldn't grow on its own. The verb gracefully accepts a non-path
|
|
13
|
+
* argument and routes to `shrk knowledge search` via the suggestion
|
|
14
|
+
* block.
|
|
15
|
+
*/
|
|
16
|
+
import { existsSync, statSync } from 'node:fs';
|
|
17
|
+
import * as nodePath from 'node:path';
|
|
18
|
+
import { matchesAny } from '@shrkcrft/boundaries';
|
|
19
|
+
export const WHY_FILE_SCHEMA = 'sharkcraft.why/v1';
|
|
20
|
+
export function buildWhyReport(input) {
|
|
21
|
+
const limit = input.limit ?? 10;
|
|
22
|
+
const target = resolveTarget(input.projectRoot, input.target);
|
|
23
|
+
const inferredPackage = inferPackage(target.relativePath);
|
|
24
|
+
const inferredLayer = inferLayer(target.relativePath);
|
|
25
|
+
const pathConventions = matchPathConventions(input.inspection, target);
|
|
26
|
+
const rules = matchRules(input.inspection, target, limit);
|
|
27
|
+
const boundaries = matchBoundaries(input.inspection, target);
|
|
28
|
+
const knowledge = matchKnowledge(input.inspection, target, limit);
|
|
29
|
+
const suggestedNext = buildSuggestions(target, rules, knowledge);
|
|
30
|
+
return {
|
|
31
|
+
schema: WHY_FILE_SCHEMA,
|
|
32
|
+
target,
|
|
33
|
+
...(inferredPackage !== undefined ? { inferredPackage } : {}),
|
|
34
|
+
...(inferredLayer !== undefined ? { inferredLayer } : {}),
|
|
35
|
+
pathConventions,
|
|
36
|
+
rules,
|
|
37
|
+
boundaries,
|
|
38
|
+
knowledge,
|
|
39
|
+
suggestedNext,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function resolveTarget(projectRoot, raw) {
|
|
43
|
+
const resolved = nodePath.isAbsolute(raw) ? raw : nodePath.resolve(projectRoot, raw);
|
|
44
|
+
const relativePath = nodePath.relative(projectRoot, resolved) || '.';
|
|
45
|
+
let kind = 'missing';
|
|
46
|
+
if (existsSync(resolved)) {
|
|
47
|
+
try {
|
|
48
|
+
kind = statSync(resolved).isDirectory() ? 'directory' : 'file';
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
kind = 'missing';
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return { inputPath: raw, resolvedPath: resolved, relativePath, kind };
|
|
55
|
+
}
|
|
56
|
+
function inferPackage(relPath) {
|
|
57
|
+
if (!relPath || relPath === '.')
|
|
58
|
+
return undefined;
|
|
59
|
+
const segments = relPath.split(/[/\\]/).filter((s) => s.length > 0);
|
|
60
|
+
if (segments.length === 0)
|
|
61
|
+
return undefined;
|
|
62
|
+
if (segments[0] === 'packages' && segments.length >= 2)
|
|
63
|
+
return `packages/${segments[1]}`;
|
|
64
|
+
if (segments[0] === 'apps' && segments.length >= 2)
|
|
65
|
+
return `apps/${segments[1]}`;
|
|
66
|
+
if (segments[0] === 'libs' && segments.length >= 2)
|
|
67
|
+
return `libs/${segments[1]}`;
|
|
68
|
+
if (segments[0] === 'tools' && segments.length >= 2)
|
|
69
|
+
return `tools/${segments[1]}`;
|
|
70
|
+
return segments[0];
|
|
71
|
+
}
|
|
72
|
+
function inferLayer(relPath) {
|
|
73
|
+
// Engine-specific heuristic: under `packages/<layer>/...` the layer is
|
|
74
|
+
// the package name (cli, inspector, generator, …). Empty otherwise so
|
|
75
|
+
// the field is omitted rather than guessed.
|
|
76
|
+
const segments = relPath.split(/[/\\]/).filter((s) => s.length > 0);
|
|
77
|
+
if (segments[0] === 'packages' && segments.length >= 2)
|
|
78
|
+
return segments[1];
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
function matchPathConventions(inspection, target) {
|
|
82
|
+
const out = [];
|
|
83
|
+
for (const p of inspection.pathService.list()) {
|
|
84
|
+
const canonical = p.metadata?.path ?? '';
|
|
85
|
+
if (!canonical)
|
|
86
|
+
continue;
|
|
87
|
+
const normalized = canonical.replace(/^\.\//, '');
|
|
88
|
+
if (target.relativePath === normalized || target.relativePath.startsWith(normalized.endsWith('/') ? normalized : `${normalized}/`)) {
|
|
89
|
+
out.push({
|
|
90
|
+
id: p.id,
|
|
91
|
+
title: p.title,
|
|
92
|
+
canonicalPath: canonical,
|
|
93
|
+
...sourceField(inspection, p.id),
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return out;
|
|
98
|
+
}
|
|
99
|
+
function matchRules(inspection, target, limit) {
|
|
100
|
+
const tokens = pathTokens(target.relativePath);
|
|
101
|
+
const out = [];
|
|
102
|
+
for (const rule of inspection.ruleService.list()) {
|
|
103
|
+
const r = rule;
|
|
104
|
+
const scope = r.scope ?? [];
|
|
105
|
+
const tags = r.tags ?? [];
|
|
106
|
+
const appliesWhen = r.appliesWhen ?? [];
|
|
107
|
+
const allTokens = new Set([...scope, ...tags, ...appliesWhen].map((t) => t.toLowerCase()));
|
|
108
|
+
const hits = tokens.filter((t) => allTokens.has(t.toLowerCase()));
|
|
109
|
+
if (hits.length === 0)
|
|
110
|
+
continue;
|
|
111
|
+
out.push({
|
|
112
|
+
id: r.id,
|
|
113
|
+
title: r.title,
|
|
114
|
+
priority: r.priority ?? 'medium',
|
|
115
|
+
scope,
|
|
116
|
+
tags,
|
|
117
|
+
appliesWhen,
|
|
118
|
+
reason: `Matches on: ${hits.join(', ')}`,
|
|
119
|
+
...sourceField(inspection, r.id),
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
// Sort by priority weight desc, then by hit count desc.
|
|
123
|
+
const weight = { critical: 4, high: 3, medium: 2, low: 1 };
|
|
124
|
+
out.sort((a, b) => (weight[b.priority] ?? 2) - (weight[a.priority] ?? 2));
|
|
125
|
+
return out.slice(0, limit);
|
|
126
|
+
}
|
|
127
|
+
function matchBoundaries(inspection, target) {
|
|
128
|
+
const out = [];
|
|
129
|
+
for (const rule of inspection.boundaryRegistry.list()) {
|
|
130
|
+
if (rule.from.length === 0)
|
|
131
|
+
continue;
|
|
132
|
+
if (!matchesAny(target.relativePath, rule.from))
|
|
133
|
+
continue;
|
|
134
|
+
const entry = {
|
|
135
|
+
id: rule.id,
|
|
136
|
+
title: rule.title,
|
|
137
|
+
...(rule.severity !== undefined ? { severity: rule.severity } : {}),
|
|
138
|
+
from: rule.from,
|
|
139
|
+
...(rule.forbiddenImports !== undefined ? { forbiddenImports: rule.forbiddenImports } : {}),
|
|
140
|
+
...(rule.allowedImports !== undefined ? { allowedImports: rule.allowedImports } : {}),
|
|
141
|
+
...sourceField(inspection.boundarySources, rule.id),
|
|
142
|
+
};
|
|
143
|
+
out.push(entry);
|
|
144
|
+
}
|
|
145
|
+
return out;
|
|
146
|
+
}
|
|
147
|
+
function matchKnowledge(inspection, target, limit) {
|
|
148
|
+
const basename = nodePath.basename(target.relativePath).toLowerCase();
|
|
149
|
+
const rel = target.relativePath.toLowerCase();
|
|
150
|
+
const out = [];
|
|
151
|
+
for (const k of inspection.knowledgeEntries) {
|
|
152
|
+
const refs = (k.references ?? []).map((r) => r.path ?? '');
|
|
153
|
+
const refMatch = refs.some((p) => p.toLowerCase() === rel || p.toLowerCase().endsWith(`/${basename}`));
|
|
154
|
+
const contentMatch = ((k.content ?? '') + ' ' + (k.title ?? '')).toLowerCase().includes(basename);
|
|
155
|
+
if (!refMatch && !contentMatch)
|
|
156
|
+
continue;
|
|
157
|
+
out.push({
|
|
158
|
+
id: k.id,
|
|
159
|
+
title: k.title,
|
|
160
|
+
type: String(k.type),
|
|
161
|
+
reason: refMatch ? `references the file` : `mentions ${basename}`,
|
|
162
|
+
...sourceField(inspection, k.id),
|
|
163
|
+
});
|
|
164
|
+
if (out.length >= limit)
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
return out;
|
|
168
|
+
}
|
|
169
|
+
function buildSuggestions(target, rules, knowledge) {
|
|
170
|
+
const out = [];
|
|
171
|
+
if (target.kind === 'missing') {
|
|
172
|
+
out.push(`shrk knowledge search "${target.inputPath}"`);
|
|
173
|
+
out.push(`shrk search "${target.inputPath}"`);
|
|
174
|
+
return out;
|
|
175
|
+
}
|
|
176
|
+
if (rules.length > 0) {
|
|
177
|
+
out.push(`shrk rules get ${rules[0].id}`);
|
|
178
|
+
}
|
|
179
|
+
if (knowledge.length > 0) {
|
|
180
|
+
out.push(`shrk knowledge get ${knowledge[0].id}`);
|
|
181
|
+
}
|
|
182
|
+
out.push(`shrk check boundaries --since origin/main`);
|
|
183
|
+
out.push(`shrk impact "${target.relativePath}"`);
|
|
184
|
+
return out;
|
|
185
|
+
}
|
|
186
|
+
function pathTokens(relPath) {
|
|
187
|
+
return relPath
|
|
188
|
+
.replace(/\.[^./]+$/, '') // drop extension
|
|
189
|
+
.split(/[/\\.\-_]/)
|
|
190
|
+
.filter((t) => t.length > 0);
|
|
191
|
+
}
|
|
192
|
+
function sourceField(inspection, id) {
|
|
193
|
+
let map;
|
|
194
|
+
if (inspection && 'entrySources' in inspection) {
|
|
195
|
+
map = inspection.entrySources;
|
|
196
|
+
}
|
|
197
|
+
else if (inspection instanceof Map) {
|
|
198
|
+
map = inspection;
|
|
199
|
+
}
|
|
200
|
+
const source = map?.get(id)?.file;
|
|
201
|
+
return source !== undefined ? { source } : {};
|
|
202
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safe workflow simulation.
|
|
3
|
+
*
|
|
4
|
+
* Predicts what a workflow would do without executing it. Builds on the
|
|
5
|
+
* orchestration plan + (optionally) a playbook/pipeline to surface:
|
|
6
|
+
* phases, commands that would be suggested, files that might be touched,
|
|
7
|
+
* policies likely to be checked, validations that would run, human-
|
|
8
|
+
* review points, and a risk summary.
|
|
9
|
+
*
|
|
10
|
+
* Read-only. No commands executed. No files written except --output by
|
|
11
|
+
* the caller.
|
|
12
|
+
*/
|
|
13
|
+
import { OrchestrationMode, type IAgentOrchestrationPlan } from './agent-orchestration.js';
|
|
14
|
+
import type { ISharkcraftInspection } from './sharkcraft-inspector.js';
|
|
15
|
+
export declare const WORKFLOW_SIMULATION_SCHEMA = "sharkcraft.workflow-simulation/v1";
|
|
16
|
+
export interface IWorkflowSimulationStep {
|
|
17
|
+
phaseId: string;
|
|
18
|
+
command: string;
|
|
19
|
+
expectedSafetyLevel: 'read-only' | 'writes-drafts' | 'writes-session' | 'writes-source' | 'runs-shell';
|
|
20
|
+
mayWriteFiles: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface IWorkflowSimulation {
|
|
23
|
+
schema: typeof WORKFLOW_SIMULATION_SCHEMA;
|
|
24
|
+
generatedAt: string;
|
|
25
|
+
task: string;
|
|
26
|
+
plan: IAgentOrchestrationPlan;
|
|
27
|
+
playbookId?: string;
|
|
28
|
+
pipelineId?: string;
|
|
29
|
+
predictedSteps: readonly IWorkflowSimulationStep[];
|
|
30
|
+
predictedFiles: readonly string[];
|
|
31
|
+
predictedPolicies: readonly string[];
|
|
32
|
+
predictedValidations: readonly string[];
|
|
33
|
+
humanReviewPoints: readonly string[];
|
|
34
|
+
predictedArtifacts: readonly string[];
|
|
35
|
+
riskSummary: readonly string[];
|
|
36
|
+
notes: readonly string[];
|
|
37
|
+
}
|
|
38
|
+
export interface IWorkflowSimulationOptions {
|
|
39
|
+
playbookId?: string;
|
|
40
|
+
pipelineId?: string;
|
|
41
|
+
bundle?: boolean;
|
|
42
|
+
mode?: OrchestrationMode;
|
|
43
|
+
}
|
|
44
|
+
export declare function simulateWorkflow(task: string, inspection: ISharkcraftInspection, options?: IWorkflowSimulationOptions): Promise<IWorkflowSimulation>;
|
|
45
|
+
export declare function renderWorkflowSimulationText(sim: IWorkflowSimulation): string;
|
|
46
|
+
//# sourceMappingURL=workflow-simulation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-simulation.d.ts","sourceRoot":"","sources":["../src/workflow-simulation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,iBAAiB,EAA+B,KAAK,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAExH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,eAAO,MAAM,0BAA0B,sCAAsC,CAAC;AAE9E,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,mBAAmB,EAAE,WAAW,GAAG,eAAe,GAAG,gBAAgB,GAAG,eAAe,GAAG,YAAY,CAAC;IACvG,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,OAAO,0BAA0B,CAAC;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,uBAAuB,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,SAAS,uBAAuB,EAAE,CAAC;IACnD,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,oBAAoB,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,0BAA0B;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,iBAAiB,CAAC;CAC1B;AAeD,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,qBAAqB,EACjC,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,mBAAmB,CAAC,CAiG9B;AAED,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,mBAAmB,GAAG,MAAM,CAsB7E"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safe workflow simulation.
|
|
3
|
+
*
|
|
4
|
+
* Predicts what a workflow would do without executing it. Builds on the
|
|
5
|
+
* orchestration plan + (optionally) a playbook/pipeline to surface:
|
|
6
|
+
* phases, commands that would be suggested, files that might be touched,
|
|
7
|
+
* policies likely to be checked, validations that would run, human-
|
|
8
|
+
* review points, and a risk summary.
|
|
9
|
+
*
|
|
10
|
+
* Read-only. No commands executed. No files written except --output by
|
|
11
|
+
* the caller.
|
|
12
|
+
*/
|
|
13
|
+
import { OrchestrationMode, buildAgentOrchestrationPlan } from "./agent-orchestration.js";
|
|
14
|
+
import { listPlaybooks, loadPlaybooks } from "./playbook-registry.js";
|
|
15
|
+
export const WORKFLOW_SIMULATION_SCHEMA = 'sharkcraft.workflow-simulation/v1';
|
|
16
|
+
const COMMAND_SAFETY_HINTS = new Map([
|
|
17
|
+
[/^shrk (gen|init|apply|import|presets apply --write|packs (sign|new))/i, 'writes-source'],
|
|
18
|
+
[/^shrk (onboard|brief|dev start|handoff|export|report site|impact|review packet|ci scaffold)/i, 'writes-drafts'],
|
|
19
|
+
[/^shrk (session|dev report|dev open)/i, 'writes-session'],
|
|
20
|
+
[/^bun |^npm |^node |^git /i, 'runs-shell'],
|
|
21
|
+
[/^shrk /i, 'read-only'],
|
|
22
|
+
]);
|
|
23
|
+
function classifyCommand(c) {
|
|
24
|
+
for (const [re, level] of COMMAND_SAFETY_HINTS)
|
|
25
|
+
if (re.test(c))
|
|
26
|
+
return level;
|
|
27
|
+
return 'read-only';
|
|
28
|
+
}
|
|
29
|
+
export async function simulateWorkflow(task, inspection, options = {}) {
|
|
30
|
+
await loadPlaybooks(inspection);
|
|
31
|
+
void inspection;
|
|
32
|
+
const plan = await buildAgentOrchestrationPlan(task, inspection, {
|
|
33
|
+
mode: options.mode ?? OrchestrationMode.Balanced,
|
|
34
|
+
});
|
|
35
|
+
const steps = [];
|
|
36
|
+
for (const phase of plan.phases) {
|
|
37
|
+
for (const c of phase.recommendedCommands) {
|
|
38
|
+
const safety = classifyCommand(c);
|
|
39
|
+
steps.push({
|
|
40
|
+
phaseId: phase.id,
|
|
41
|
+
command: c,
|
|
42
|
+
expectedSafetyLevel: safety,
|
|
43
|
+
mayWriteFiles: safety === 'writes-source' || safety === 'writes-drafts',
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
let playbookId;
|
|
48
|
+
let pipelineId;
|
|
49
|
+
const notes = [];
|
|
50
|
+
if (options.playbookId) {
|
|
51
|
+
const pb = listPlaybooks(inspection).find((p) => p.id === options.playbookId);
|
|
52
|
+
if (pb) {
|
|
53
|
+
playbookId = pb.id;
|
|
54
|
+
for (const s of pb.steps ?? []) {
|
|
55
|
+
for (const c of s.commands ?? []) {
|
|
56
|
+
const safety = classifyCommand(c);
|
|
57
|
+
steps.push({
|
|
58
|
+
phaseId: `playbook:${pb.id}`,
|
|
59
|
+
command: c,
|
|
60
|
+
expectedSafetyLevel: safety,
|
|
61
|
+
mayWriteFiles: safety === 'writes-source' || safety === 'writes-drafts',
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
notes.push(`Playbook "${options.playbookId}" not found.`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (options.pipelineId) {
|
|
71
|
+
const pl = inspection.pipelines.find((p) => p.id === options.pipelineId);
|
|
72
|
+
if (pl) {
|
|
73
|
+
pipelineId = pl.id;
|
|
74
|
+
for (const s of pl.steps ?? []) {
|
|
75
|
+
const c = s.command ?? '';
|
|
76
|
+
if (!c)
|
|
77
|
+
continue;
|
|
78
|
+
const safety = classifyCommand(c);
|
|
79
|
+
steps.push({
|
|
80
|
+
phaseId: `pipeline:${pl.id}`,
|
|
81
|
+
command: c,
|
|
82
|
+
expectedSafetyLevel: safety,
|
|
83
|
+
mayWriteFiles: safety === 'writes-source' || safety === 'writes-drafts',
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
notes.push(`Pipeline "${options.pipelineId}" not found.`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const predictedFiles = [];
|
|
92
|
+
if (plan.intent.likelyTemplates.length > 0) {
|
|
93
|
+
for (const t of plan.intent.likelyTemplates)
|
|
94
|
+
predictedFiles.push(`(template:${t}) target file would be rendered to a location per templates.ts targetPath`);
|
|
95
|
+
}
|
|
96
|
+
const predictedPolicies = plan.intent.kind === 'policy' || plan.intent.kind === 'release'
|
|
97
|
+
? ['policy:run', 'safety:audit', 'readiness:strict']
|
|
98
|
+
: ['safety:audit'];
|
|
99
|
+
const humanReviewPoints = plan.phases.filter((p) => p.humanApprovalRequired).map((p) => p.title);
|
|
100
|
+
const predictedArtifacts = [];
|
|
101
|
+
for (const p of plan.phases)
|
|
102
|
+
for (const a of p.expectedArtifacts)
|
|
103
|
+
predictedArtifacts.push(`${p.id}/${a}`);
|
|
104
|
+
const risks = [];
|
|
105
|
+
if (plan.intent.requiredHumanReview)
|
|
106
|
+
risks.push('Task requires explicit human review before apply.');
|
|
107
|
+
if (steps.some((s) => s.expectedSafetyLevel === 'writes-source'))
|
|
108
|
+
risks.push('Plan contains write-source steps (apply / init / gen --write / presets apply --write).');
|
|
109
|
+
if (steps.some((s) => s.expectedSafetyLevel === 'runs-shell'))
|
|
110
|
+
risks.push('Plan suggests shell-out commands (bun/npm/node/git).');
|
|
111
|
+
return {
|
|
112
|
+
schema: WORKFLOW_SIMULATION_SCHEMA,
|
|
113
|
+
generatedAt: new Date().toISOString(),
|
|
114
|
+
task,
|
|
115
|
+
plan,
|
|
116
|
+
...(playbookId ? { playbookId } : {}),
|
|
117
|
+
...(pipelineId ? { pipelineId } : {}),
|
|
118
|
+
predictedSteps: steps,
|
|
119
|
+
predictedFiles,
|
|
120
|
+
predictedPolicies,
|
|
121
|
+
predictedValidations: plan.validationCommands,
|
|
122
|
+
humanReviewPoints,
|
|
123
|
+
predictedArtifacts,
|
|
124
|
+
riskSummary: risks,
|
|
125
|
+
notes,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
export function renderWorkflowSimulationText(sim) {
|
|
129
|
+
const lines = [];
|
|
130
|
+
lines.push('=== Workflow simulation ===');
|
|
131
|
+
lines.push(` task ${sim.task}`);
|
|
132
|
+
lines.push(` intent ${sim.plan.intent.kind} / ${sim.plan.intent.confidence}`);
|
|
133
|
+
if (sim.playbookId)
|
|
134
|
+
lines.push(` playbook ${sim.playbookId}`);
|
|
135
|
+
if (sim.pipelineId)
|
|
136
|
+
lines.push(` pipeline ${sim.pipelineId}`);
|
|
137
|
+
lines.push(` steps ${sim.predictedSteps.length}`);
|
|
138
|
+
lines.push(` human review points ${sim.humanReviewPoints.length}`);
|
|
139
|
+
if (sim.riskSummary.length > 0) {
|
|
140
|
+
lines.push('Risks:');
|
|
141
|
+
for (const r of sim.riskSummary)
|
|
142
|
+
lines.push(` • ${r}`);
|
|
143
|
+
}
|
|
144
|
+
lines.push('Predicted steps:');
|
|
145
|
+
for (const s of sim.predictedSteps.slice(0, 30)) {
|
|
146
|
+
lines.push(` [${s.expectedSafetyLevel.padEnd(14)}] (${s.phaseId}) ${s.command}`);
|
|
147
|
+
}
|
|
148
|
+
if (sim.notes.length > 0) {
|
|
149
|
+
lines.push('Notes:');
|
|
150
|
+
for (const n of sim.notes)
|
|
151
|
+
lines.push(` • ${n}`);
|
|
152
|
+
}
|
|
153
|
+
return lines.join('\n') + '\n';
|
|
154
|
+
}
|