@shrkcrft/inspector 0.1.0-alpha.1
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 +57 -0
- package/dist/area-map.d.ts.map +1 -0
- package/dist/area-map.js +214 -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 +382 -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 +38 -0
- package/dist/git-helpers.d.ts.map +1 -0
- package/dist/git-helpers.js +173 -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 +422 -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 +224 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +234 -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-merge.d.ts +71 -0
- package/dist/onboarding-drafts-merge.d.ts.map +1 -0
- package/dist/onboarding-drafts-merge.js +174 -0
- package/dist/onboarding-drafts.d.ts +42 -0
- package/dist/onboarding-drafts.d.ts.map +1 -0
- package/dist/onboarding-drafts.js +268 -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 +73 -0
- package/dist/pack-symbol-compat.d.ts.map +1 -0
- package/dist/pack-symbol-compat.js +519 -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 +81 -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 +65 -0
|
@@ -0,0 +1,729 @@
|
|
|
1
|
+
import { existsSync, readdirSync, statSync } from 'node:fs';
|
|
2
|
+
import * as nodePath from 'node:path';
|
|
3
|
+
import { PackageManager, WorkspaceProfile, findFiles, } from '@shrkcrft/workspace';
|
|
4
|
+
import { recommendPresets, } from '@shrkcrft/presets';
|
|
5
|
+
import { buildAiReadinessReport, } from "./ai-readiness.js";
|
|
6
|
+
import { inferTemplateBody, } from "./template-body-inference.js";
|
|
7
|
+
import { buildMonorepoSummary, } from "./monorepo-onboarding.js";
|
|
8
|
+
// ─── Top-level orchestrator ───────────────────────────────────────────────────
|
|
9
|
+
export function buildOnboardingPlan(inspection, options = {}) {
|
|
10
|
+
const ws = inspection.workspace;
|
|
11
|
+
const subDirs = listSubDirs(ws.projectRoot);
|
|
12
|
+
const inferredPathConventions = inferPathConventions(ws, subDirs);
|
|
13
|
+
const inferredVerificationCommands = inferVerificationCommands(ws);
|
|
14
|
+
const inferredBoundaryRules = inferBoundaryRules(ws, subDirs);
|
|
15
|
+
const inferredTemplateCandidates = inferTemplateCandidates(ws, {
|
|
16
|
+
scaffoldTemplates: options.scaffoldTemplates === true,
|
|
17
|
+
});
|
|
18
|
+
const inferredRules = inferRules(ws);
|
|
19
|
+
const inferredPipelines = inferPipelines(ws, inferredVerificationCommands);
|
|
20
|
+
const detectedInstructionFiles = detectInstructionFiles(ws.projectRoot);
|
|
21
|
+
const monorepoSummary = buildMonorepoSummary(ws, subDirs);
|
|
22
|
+
// RecommendPresets now applies a miss penalty (-3 per missing
|
|
23
|
+
// appliesTo profile), so a preferred preset that previously ranked just
|
|
24
|
+
// inside the top 5 can drop out on minor profile changes. Use a wider
|
|
25
|
+
// window when a preferredPreset is set so the reorder helper always has
|
|
26
|
+
// something to pin.
|
|
27
|
+
const presetRecs = recommendPresets(inspection.presetRegistry.list(), {
|
|
28
|
+
profiles: ws.profiles,
|
|
29
|
+
limit: options.preferredPreset ? 20 : 5,
|
|
30
|
+
});
|
|
31
|
+
const recommendedPresets = options.preferredPreset
|
|
32
|
+
? reorderForPreferredPreset(presetRecs, options.preferredPreset, inspection.presetRegistry)
|
|
33
|
+
: presetRecs;
|
|
34
|
+
const suggestedFiles = buildSuggestedFiles(ws);
|
|
35
|
+
const risks = collectRisks(ws, inferredTemplateCandidates);
|
|
36
|
+
const readiness = estimateReadinessImpact(inspection, inferredPathConventions, inferredRules, inferredPipelines, inferredVerificationCommands, inferredBoundaryRules);
|
|
37
|
+
const nextCommands = buildNextCommands(ws.hasSharkcraftFolder, {
|
|
38
|
+
scaffoldTemplates: options.scaffoldTemplates === true,
|
|
39
|
+
isMonorepo: !!monorepoSummary,
|
|
40
|
+
});
|
|
41
|
+
return {
|
|
42
|
+
projectSummary: {
|
|
43
|
+
projectRoot: ws.projectRoot,
|
|
44
|
+
...(ws.packageName ? { projectName: ws.packageName } : {}),
|
|
45
|
+
...(ws.description ? { description: ws.description } : {}),
|
|
46
|
+
packageManager: ws.packageManager.manager,
|
|
47
|
+
profiles: ws.profiles,
|
|
48
|
+
hasSharkcraftFolder: ws.hasSharkcraftFolder,
|
|
49
|
+
},
|
|
50
|
+
recommendedPresets,
|
|
51
|
+
suggestedFiles,
|
|
52
|
+
inferredPathConventions,
|
|
53
|
+
inferredVerificationCommands,
|
|
54
|
+
inferredBoundaryRules,
|
|
55
|
+
inferredTemplateCandidates,
|
|
56
|
+
inferredRules,
|
|
57
|
+
inferredPipelines,
|
|
58
|
+
detectedInstructionFiles,
|
|
59
|
+
risks,
|
|
60
|
+
nextCommands,
|
|
61
|
+
readiness,
|
|
62
|
+
monorepoSummary,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
// ─── Path conventions ────────────────────────────────────────────────────────
|
|
66
|
+
const PATH_CONVENTIONS = [
|
|
67
|
+
{
|
|
68
|
+
id: 'paths.src',
|
|
69
|
+
dir: 'src',
|
|
70
|
+
title: 'Application source under src/',
|
|
71
|
+
content: 'Application source code lives in src/. Avoid sibling top-level directories that duplicate src/ semantics.',
|
|
72
|
+
patterns: ['src/**'],
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: 'paths.services',
|
|
76
|
+
dir: 'src/services',
|
|
77
|
+
title: 'Services in src/services/',
|
|
78
|
+
content: 'Services live under src/services/ and follow the `*.service.ts` naming pattern.',
|
|
79
|
+
patterns: ['src/services/**', '**/*.service.ts'],
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: 'paths.utils',
|
|
83
|
+
dir: 'src/utils',
|
|
84
|
+
title: 'Utilities in src/utils/',
|
|
85
|
+
content: 'Pure utility functions live in src/utils/. One construct per file.',
|
|
86
|
+
patterns: ['src/utils/**'],
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: 'paths.components',
|
|
90
|
+
dir: 'src/components',
|
|
91
|
+
title: 'UI components in src/components/',
|
|
92
|
+
content: 'UI components live in src/components/<Name>/, one component per folder.',
|
|
93
|
+
patterns: ['src/components/**'],
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: 'paths.features',
|
|
97
|
+
dir: 'src/features',
|
|
98
|
+
title: 'Feature folders in src/features/',
|
|
99
|
+
content: 'Each feature gets its own folder under src/features/<feature-name>/.',
|
|
100
|
+
patterns: ['src/features/**'],
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
id: 'paths.libs',
|
|
104
|
+
dir: 'libs',
|
|
105
|
+
title: 'Libraries in libs/',
|
|
106
|
+
content: 'Reusable libraries live in libs/<lib-name>/. Public entrypoint at libs/<lib-name>/src/index.ts.',
|
|
107
|
+
patterns: ['libs/**'],
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: 'paths.packages',
|
|
111
|
+
dir: 'packages',
|
|
112
|
+
title: 'Packages in packages/',
|
|
113
|
+
content: 'Workspace packages live in packages/<pkg>/, each with its own package.json.',
|
|
114
|
+
patterns: ['packages/**'],
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id: 'paths.apps',
|
|
118
|
+
dir: 'apps',
|
|
119
|
+
title: 'Apps in apps/',
|
|
120
|
+
content: 'Deployable applications live in apps/<app-name>/.',
|
|
121
|
+
patterns: ['apps/**'],
|
|
122
|
+
},
|
|
123
|
+
];
|
|
124
|
+
const TEST_DIRS = ['tests', 'test', '__tests__'];
|
|
125
|
+
export function inferPathConventions(ws, subDirs) {
|
|
126
|
+
const out = [];
|
|
127
|
+
for (const candidate of PATH_CONVENTIONS) {
|
|
128
|
+
if (dirExists(ws.projectRoot, candidate.dir)) {
|
|
129
|
+
out.push({
|
|
130
|
+
id: candidate.id,
|
|
131
|
+
title: candidate.title,
|
|
132
|
+
content: candidate.content,
|
|
133
|
+
patterns: candidate.patterns,
|
|
134
|
+
reason: `${candidate.dir}/ directory present`,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// Test directory (tests / test / __tests__).
|
|
139
|
+
for (const t of TEST_DIRS) {
|
|
140
|
+
if (ws.topLevelDirs.includes(t)) {
|
|
141
|
+
out.push({
|
|
142
|
+
id: 'paths.tests',
|
|
143
|
+
title: `Tests live in ${t}/`,
|
|
144
|
+
content: `Test files live in ${t}/, mirroring src/. Use the *.spec.ts / *.test.ts suffix.`,
|
|
145
|
+
patterns: [`${t}/**`, `**/*.spec.ts`, `**/*.test.ts`],
|
|
146
|
+
reason: `${t}/ directory present`,
|
|
147
|
+
});
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
// Co-located tests under src/.
|
|
152
|
+
if (subDirs.get('src')?.includes('__tests__') ||
|
|
153
|
+
findOne(ws.projectRoot, /\.(spec|test)\.tsx?$/)) {
|
|
154
|
+
if (!out.some((p) => p.id === 'paths.tests')) {
|
|
155
|
+
out.push({
|
|
156
|
+
id: 'paths.tests',
|
|
157
|
+
title: 'Co-located tests next to source',
|
|
158
|
+
content: 'Tests live next to the source they cover, with *.spec.ts or *.test.ts naming.',
|
|
159
|
+
patterns: ['**/*.spec.ts', '**/*.test.ts'],
|
|
160
|
+
reason: 'Detected *.spec/*.test files under src/',
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return out;
|
|
165
|
+
}
|
|
166
|
+
// ─── Verification commands ───────────────────────────────────────────────────
|
|
167
|
+
const SCRIPT_KEYS = [
|
|
168
|
+
{ scriptName: 'test', id: 'test', label: 'Tests' },
|
|
169
|
+
{ scriptName: 'typecheck', id: 'typecheck', label: 'Type check' },
|
|
170
|
+
{ scriptName: 'lint', id: 'lint', label: 'Lint' },
|
|
171
|
+
{ scriptName: 'build', id: 'build', label: 'Build' },
|
|
172
|
+
{ scriptName: 'test:mutation', id: 'mutation-tests', label: 'Mutation tests' },
|
|
173
|
+
{ scriptName: 'affected:test', id: 'affected-test', label: 'Affected tests' },
|
|
174
|
+
{ scriptName: 'affected:lint', id: 'affected-lint', label: 'Affected lint' },
|
|
175
|
+
];
|
|
176
|
+
export function inferVerificationCommands(ws) {
|
|
177
|
+
const runner = packageManagerRunPrefix(effectivePackageManager(ws));
|
|
178
|
+
const out = [];
|
|
179
|
+
for (const [name, value] of Object.entries(ws.scripts)) {
|
|
180
|
+
if (typeof value !== 'string')
|
|
181
|
+
continue;
|
|
182
|
+
const match = SCRIPT_KEYS.find((s) => typeof s.scriptName === 'string'
|
|
183
|
+
? s.scriptName === name
|
|
184
|
+
: s.scriptName.test(name));
|
|
185
|
+
if (!match)
|
|
186
|
+
continue;
|
|
187
|
+
if (out.some((v) => v.id === match.id))
|
|
188
|
+
continue;
|
|
189
|
+
out.push({
|
|
190
|
+
id: match.id,
|
|
191
|
+
label: match.label,
|
|
192
|
+
command: match.override ?? `${runner} ${name}`,
|
|
193
|
+
trusted: true,
|
|
194
|
+
reason: `package.json scripts.${name}`,
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
return out;
|
|
198
|
+
}
|
|
199
|
+
function effectivePackageManager(ws) {
|
|
200
|
+
if (ws.packageManager.manager !== PackageManager.Unknown) {
|
|
201
|
+
return ws.packageManager.manager;
|
|
202
|
+
}
|
|
203
|
+
// Fall back to profile signals when no lockfile / packageManager field is set.
|
|
204
|
+
if (ws.profiles.includes(WorkspaceProfile.HasBun))
|
|
205
|
+
return PackageManager.Bun;
|
|
206
|
+
return PackageManager.Npm;
|
|
207
|
+
}
|
|
208
|
+
function packageManagerRunPrefix(manager) {
|
|
209
|
+
switch (manager) {
|
|
210
|
+
case PackageManager.Bun:
|
|
211
|
+
return 'bun run';
|
|
212
|
+
case PackageManager.Pnpm:
|
|
213
|
+
return 'pnpm';
|
|
214
|
+
case PackageManager.Yarn:
|
|
215
|
+
return 'yarn';
|
|
216
|
+
case PackageManager.Npm:
|
|
217
|
+
return 'npm run';
|
|
218
|
+
default:
|
|
219
|
+
return 'npm run';
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
// ─── Boundary rule candidates ────────────────────────────────────────────────
|
|
223
|
+
const LAYER_ORDER = [
|
|
224
|
+
'core',
|
|
225
|
+
'common',
|
|
226
|
+
'runtime',
|
|
227
|
+
'kernel',
|
|
228
|
+
'plugin',
|
|
229
|
+
'adapter',
|
|
230
|
+
'ui',
|
|
231
|
+
];
|
|
232
|
+
export function inferBoundaryRules(ws, subDirs) {
|
|
233
|
+
const out = [];
|
|
234
|
+
// Detect layer prefixes in libs/* and packages/* and (top-level) layer dirs.
|
|
235
|
+
const layerHits = new Map(); // layer → from-pattern
|
|
236
|
+
for (const layer of LAYER_ORDER) {
|
|
237
|
+
if (ws.topLevelDirs.includes(layer)) {
|
|
238
|
+
layerHits.set(layer, `${layer}/**`);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
for (const parent of ['libs', 'packages']) {
|
|
242
|
+
const children = subDirs.get(parent) ?? [];
|
|
243
|
+
for (const layer of LAYER_ORDER) {
|
|
244
|
+
if (children.includes(layer)) {
|
|
245
|
+
layerHits.set(layer, `${parent}/${layer}/**`);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if (layerHits.size < 3)
|
|
250
|
+
return out;
|
|
251
|
+
// Build one rule per detected layer that forbids importing from any higher
|
|
252
|
+
// layer.
|
|
253
|
+
for (let i = 0; i < LAYER_ORDER.length; i += 1) {
|
|
254
|
+
const layer = LAYER_ORDER[i];
|
|
255
|
+
if (!layerHits.has(layer))
|
|
256
|
+
continue;
|
|
257
|
+
const higher = LAYER_ORDER.slice(i + 1).filter((l) => layerHits.has(l));
|
|
258
|
+
if (higher.length === 0)
|
|
259
|
+
continue;
|
|
260
|
+
const forbiddenImports = higher.flatMap((l) => {
|
|
261
|
+
const from = layerHits.get(l);
|
|
262
|
+
const prefix = from.replace(/\/\*\*$/, '');
|
|
263
|
+
return [prefix, `${prefix}/**`];
|
|
264
|
+
});
|
|
265
|
+
out.push({
|
|
266
|
+
id: `architecture.${layer}.no-imports-up`,
|
|
267
|
+
title: `${layer} must not import higher layers`,
|
|
268
|
+
severity: 'error',
|
|
269
|
+
from: [layerHits.get(layer)],
|
|
270
|
+
forbiddenImports,
|
|
271
|
+
suggestedFix: `Move shared contracts down to ${layer}/ or invert the dependency so the higher layer depends on a contract defined in ${layer}/.`,
|
|
272
|
+
reason: `${layer}/ + ${higher.length} higher layer(s) detected`,
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
return out;
|
|
276
|
+
}
|
|
277
|
+
const TEMPLATE_PATTERNS = [
|
|
278
|
+
{
|
|
279
|
+
id: 'inferred.service',
|
|
280
|
+
name: 'Service',
|
|
281
|
+
description: 'New service file under src/services/.',
|
|
282
|
+
pattern: /\.service\.ts$/,
|
|
283
|
+
targetPathHint: 'src/services/<name>.service.ts',
|
|
284
|
+
highThreshold: 3,
|
|
285
|
+
kind: 'service',
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
id: 'inferred.util',
|
|
289
|
+
name: 'Utility',
|
|
290
|
+
description: 'New utility module under src/utils/.',
|
|
291
|
+
pattern: /\.util\.ts$/,
|
|
292
|
+
targetPathHint: 'src/utils/<name>.util.ts',
|
|
293
|
+
highThreshold: 3,
|
|
294
|
+
kind: 'utility',
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
id: 'inferred.component',
|
|
298
|
+
name: 'Component',
|
|
299
|
+
description: 'New UI component.',
|
|
300
|
+
pattern: /\.component\.tsx?$/,
|
|
301
|
+
targetPathHint: 'src/components/<Name>/<Name>.component.tsx',
|
|
302
|
+
highThreshold: 3,
|
|
303
|
+
kind: 'component',
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
id: 'inferred.spec',
|
|
307
|
+
name: 'Spec / test file',
|
|
308
|
+
description: 'New spec/test file colocated with source.',
|
|
309
|
+
pattern: /\.(spec|test)\.tsx?$/,
|
|
310
|
+
targetPathHint: 'src/<area>/<name>.spec.ts',
|
|
311
|
+
highThreshold: 4,
|
|
312
|
+
kind: 'test',
|
|
313
|
+
},
|
|
314
|
+
];
|
|
315
|
+
export function inferTemplateCandidates(ws, options = {}) {
|
|
316
|
+
const out = [];
|
|
317
|
+
for (const t of TEMPLATE_PATTERNS) {
|
|
318
|
+
const matches = findFiles(ws.projectRoot, t.pattern, { maxDepth: 5 });
|
|
319
|
+
if (matches.length === 0)
|
|
320
|
+
continue;
|
|
321
|
+
const confidence = matches.length >= t.highThreshold
|
|
322
|
+
? 'high'
|
|
323
|
+
: matches.length >= 2
|
|
324
|
+
? 'medium'
|
|
325
|
+
: 'low';
|
|
326
|
+
const sample = nodePath.relative(ws.projectRoot, matches[0]);
|
|
327
|
+
const candidate = {
|
|
328
|
+
id: t.id,
|
|
329
|
+
name: t.name,
|
|
330
|
+
description: t.description,
|
|
331
|
+
sample,
|
|
332
|
+
targetPathHint: t.targetPathHint,
|
|
333
|
+
confidence,
|
|
334
|
+
reason: `${matches.length} matching file(s) found`,
|
|
335
|
+
};
|
|
336
|
+
// Scaffolding is opt-in AND we never scaffold low-confidence single-sample
|
|
337
|
+
// candidates — they overfit too easily.
|
|
338
|
+
if (options.scaffoldTemplates && confidence !== 'low') {
|
|
339
|
+
const result = inferTemplateBody({
|
|
340
|
+
projectRoot: ws.projectRoot,
|
|
341
|
+
sample,
|
|
342
|
+
kind: t.kind,
|
|
343
|
+
baseId: `inferred.typescript.${t.kind}`,
|
|
344
|
+
});
|
|
345
|
+
if (result.scaffold)
|
|
346
|
+
candidate.scaffold = result.scaffold;
|
|
347
|
+
}
|
|
348
|
+
out.push(candidate);
|
|
349
|
+
}
|
|
350
|
+
return out;
|
|
351
|
+
}
|
|
352
|
+
// ─── Rule candidates ─────────────────────────────────────────────────────────
|
|
353
|
+
export function inferRules(ws) {
|
|
354
|
+
const out = [];
|
|
355
|
+
// Package manager.
|
|
356
|
+
const manager = effectivePackageManager(ws);
|
|
357
|
+
if (manager !== PackageManager.Unknown) {
|
|
358
|
+
const evidence = ws.packageManager.manager !== PackageManager.Unknown
|
|
359
|
+
? `${ws.packageManager.manager} lockfile / manager field detected`
|
|
360
|
+
: `inferred from project signals (${ws.profiles.includes(WorkspaceProfile.HasBun) ? 'has-bun profile' : 'fallback'})`;
|
|
361
|
+
out.push({
|
|
362
|
+
id: 'project.package-manager',
|
|
363
|
+
title: `Use ${manager} for install/run`,
|
|
364
|
+
content: `This repo uses ${manager}. Run scripts with \`${packageManagerRunPrefix(manager)} <script>\`.`,
|
|
365
|
+
priority: 'medium',
|
|
366
|
+
source: 'package-json',
|
|
367
|
+
reason: evidence,
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
// TypeScript.
|
|
371
|
+
if (ws.hasTypeScript) {
|
|
372
|
+
const strict = !!ws.tsConfig?.strict;
|
|
373
|
+
out.push({
|
|
374
|
+
id: 'typescript.strict-mode',
|
|
375
|
+
title: strict
|
|
376
|
+
? 'TypeScript strict mode enabled'
|
|
377
|
+
: 'Enable TypeScript strict mode',
|
|
378
|
+
content: strict
|
|
379
|
+
? 'TypeScript strict mode is enabled. Keep it that way — do not weaken `strict` to land code.'
|
|
380
|
+
: 'TypeScript strict mode is OFF. Turning it on is a one-line tsconfig change and significantly improves type safety. Plan a separate task for the cleanup.',
|
|
381
|
+
priority: strict ? 'high' : 'medium',
|
|
382
|
+
source: 'tsconfig',
|
|
383
|
+
reason: `tsconfig strict=${strict}`,
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
// Test runner.
|
|
387
|
+
if (ws.profiles.includes(WorkspaceProfile.HasBunTest)) {
|
|
388
|
+
out.push({
|
|
389
|
+
id: 'testing.runner',
|
|
390
|
+
title: 'Run tests with `bun test`',
|
|
391
|
+
content: 'Tests are executed via `bun test`. Use `bun test <path>` to run a single file.',
|
|
392
|
+
priority: 'medium',
|
|
393
|
+
source: 'package-json',
|
|
394
|
+
reason: 'bun test script detected',
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
else if (ws.profiles.includes(WorkspaceProfile.HasVitest)) {
|
|
398
|
+
out.push({
|
|
399
|
+
id: 'testing.runner',
|
|
400
|
+
title: 'Run tests with Vitest',
|
|
401
|
+
content: 'Tests are executed via Vitest. Configuration lives in vitest.config.ts.',
|
|
402
|
+
priority: 'medium',
|
|
403
|
+
source: 'package-json',
|
|
404
|
+
reason: 'vitest dependency',
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
else if (ws.profiles.includes(WorkspaceProfile.HasJest)) {
|
|
408
|
+
out.push({
|
|
409
|
+
id: 'testing.runner',
|
|
410
|
+
title: 'Run tests with Jest',
|
|
411
|
+
content: 'Tests are executed via Jest.',
|
|
412
|
+
priority: 'medium',
|
|
413
|
+
source: 'package-json',
|
|
414
|
+
reason: 'jest dependency',
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
// Monorepo layering.
|
|
418
|
+
if (ws.profiles.includes(WorkspaceProfile.IsMonorepo)) {
|
|
419
|
+
out.push({
|
|
420
|
+
id: 'architecture.layer-order',
|
|
421
|
+
title: 'Respect monorepo layer order',
|
|
422
|
+
content: 'Lower layers (core, common, runtime) must not import from higher layers (kernel, plugin, ui, apps). Run `shrk check boundaries` after touching cross-layer code.',
|
|
423
|
+
priority: 'high',
|
|
424
|
+
source: 'folder-structure',
|
|
425
|
+
reason: 'monorepo layout detected',
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
// ESLint.
|
|
429
|
+
if (ws.profiles.includes(WorkspaceProfile.HasEslint)) {
|
|
430
|
+
out.push({
|
|
431
|
+
id: 'quality.lint-before-commit',
|
|
432
|
+
title: 'Run lint before committing',
|
|
433
|
+
content: 'ESLint is configured. Run the lint script before opening a PR — CI will fail otherwise.',
|
|
434
|
+
priority: 'medium',
|
|
435
|
+
source: 'package-json',
|
|
436
|
+
reason: 'eslint dependency',
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
// AGENTS.md / CLAUDE.md present → recommend import.
|
|
440
|
+
const detected = detectInstructionFiles(ws.projectRoot);
|
|
441
|
+
for (const f of detected) {
|
|
442
|
+
out.push({
|
|
443
|
+
id: `import.${f.kind}`,
|
|
444
|
+
title: `Existing ${f.kind === 'cursor-rules' ? '.cursor/rules' : f.kind} instructions detected`,
|
|
445
|
+
content: `An existing ${f.path} ships agent instructions. Import them with \`${f.importCommand}\` to seed SharkCraft rules.`,
|
|
446
|
+
priority: 'medium',
|
|
447
|
+
source: 'agents-md',
|
|
448
|
+
reason: `${f.path} present`,
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
return out;
|
|
452
|
+
}
|
|
453
|
+
// ─── Pipeline candidates ─────────────────────────────────────────────────────
|
|
454
|
+
export function inferPipelines(ws, verification) {
|
|
455
|
+
const out = [];
|
|
456
|
+
const verifyIds = new Set(verification.map((v) => v.id));
|
|
457
|
+
// unit-test pipeline whenever tests exist.
|
|
458
|
+
if (ws.profiles.includes(WorkspaceProfile.HasTests)) {
|
|
459
|
+
out.push({
|
|
460
|
+
id: 'unit-test',
|
|
461
|
+
title: 'Unit test pipeline',
|
|
462
|
+
description: 'Pick a focused unit under test and write/run the spec.',
|
|
463
|
+
steps: ['pick-target', 'write-spec', 'run-tests'],
|
|
464
|
+
reason: 'test runner detected',
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
// safe-generation pipeline when there is a builder/codegen-style setup.
|
|
468
|
+
if (ws.hasTypeScript) {
|
|
469
|
+
out.push({
|
|
470
|
+
id: 'safe-generation',
|
|
471
|
+
title: 'Safe generation pipeline',
|
|
472
|
+
description: 'Use `shrk gen --dry-run --save-plan` → review → `shrk apply --verify-signature` for risky writes.',
|
|
473
|
+
steps: ['plan', 'review', 'apply'],
|
|
474
|
+
reason: 'TypeScript project — codegen flows benefit from plan review',
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
// feature-dev pipeline when there is both source structure + tests.
|
|
478
|
+
if (ws.profiles.includes(WorkspaceProfile.HasTests) &&
|
|
479
|
+
ws.topLevelDirs.includes('src')) {
|
|
480
|
+
out.push({
|
|
481
|
+
id: 'feature-dev',
|
|
482
|
+
title: 'Feature development pipeline',
|
|
483
|
+
description: 'Implement a new feature: plan → scaffold → wire → test → verify.',
|
|
484
|
+
steps: ['plan', 'scaffold', 'wire-up', 'add-tests', 'verify'],
|
|
485
|
+
reason: 'src/ + test runner present',
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
// release-check when both build + test scripts exist.
|
|
489
|
+
if (verifyIds.has('test') && verifyIds.has('build')) {
|
|
490
|
+
out.push({
|
|
491
|
+
id: 'release-check',
|
|
492
|
+
title: 'Release readiness pipeline',
|
|
493
|
+
description: 'Typecheck → lint → tests → build → boundary scan.',
|
|
494
|
+
steps: ['typecheck', 'lint', 'test', 'build', 'boundaries'],
|
|
495
|
+
reason: 'build + test scripts present',
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
// pr-review when GitHub Actions present.
|
|
499
|
+
if (ws.profiles.includes(WorkspaceProfile.HasGithubActions)) {
|
|
500
|
+
out.push({
|
|
501
|
+
id: 'pr-review',
|
|
502
|
+
title: 'PR review packet pipeline',
|
|
503
|
+
description: 'Build the review packet on each PR: `shrk review --since origin/main --json`.',
|
|
504
|
+
steps: ['diff', 'review-packet', 'comment'],
|
|
505
|
+
reason: '.github/ directory present (GitHub Actions likely)',
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
return out;
|
|
509
|
+
}
|
|
510
|
+
// ─── Instruction-file detection ──────────────────────────────────────────────
|
|
511
|
+
export function detectInstructionFiles(projectRoot) {
|
|
512
|
+
const out = [];
|
|
513
|
+
if (existsSync(nodePath.join(projectRoot, 'AGENTS.md'))) {
|
|
514
|
+
out.push({
|
|
515
|
+
kind: 'agents-md',
|
|
516
|
+
path: 'AGENTS.md',
|
|
517
|
+
importCommand: 'shrk import agents AGENTS.md',
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
if (existsSync(nodePath.join(projectRoot, 'CLAUDE.md'))) {
|
|
521
|
+
out.push({
|
|
522
|
+
kind: 'claude-md',
|
|
523
|
+
path: 'CLAUDE.md',
|
|
524
|
+
importCommand: 'shrk import claude CLAUDE.md',
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
const cursor = nodePath.join(projectRoot, '.cursor', 'rules');
|
|
528
|
+
if (existsSync(cursor)) {
|
|
529
|
+
out.push({
|
|
530
|
+
kind: 'cursor-rules',
|
|
531
|
+
path: '.cursor/rules',
|
|
532
|
+
importCommand: 'shrk import cursor .cursor/rules',
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
return out;
|
|
536
|
+
}
|
|
537
|
+
// ─── Risks / warnings ────────────────────────────────────────────────────────
|
|
538
|
+
function collectRisks(ws, templateCandidates) {
|
|
539
|
+
const risks = [];
|
|
540
|
+
if (!ws.hasPackageJson) {
|
|
541
|
+
risks.push('No package.json found — verification commands and rules cannot be inferred from scripts.');
|
|
542
|
+
}
|
|
543
|
+
if (!ws.hasTypeScript) {
|
|
544
|
+
risks.push('No TypeScript signal detected — many templates assume TS. Review inferred templates carefully.');
|
|
545
|
+
}
|
|
546
|
+
for (const c of templateCandidates) {
|
|
547
|
+
if (c.confidence === 'low') {
|
|
548
|
+
risks.push(`Template candidate "${c.id}" rests on a single sample file (${c.sample ?? 'unknown'}); review before keeping.`);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
return risks;
|
|
552
|
+
}
|
|
553
|
+
// ─── Suggested files ─────────────────────────────────────────────────────────
|
|
554
|
+
function buildSuggestedFiles(ws) {
|
|
555
|
+
if (ws.hasSharkcraftFolder) {
|
|
556
|
+
return [
|
|
557
|
+
'sharkcraft/onboarding/onboarding-report.md',
|
|
558
|
+
'sharkcraft/onboarding/inferred-rules.draft.ts',
|
|
559
|
+
'sharkcraft/onboarding/inferred-paths.draft.ts',
|
|
560
|
+
'sharkcraft/onboarding/inferred-templates.draft.ts',
|
|
561
|
+
'sharkcraft/onboarding/inferred-boundaries.draft.ts',
|
|
562
|
+
'sharkcraft/onboarding/inferred-pipelines.draft.ts',
|
|
563
|
+
];
|
|
564
|
+
}
|
|
565
|
+
return [
|
|
566
|
+
'sharkcraft/sharkcraft.config.ts',
|
|
567
|
+
'sharkcraft/knowledge.ts',
|
|
568
|
+
'sharkcraft/rules.ts',
|
|
569
|
+
'sharkcraft/paths.ts',
|
|
570
|
+
'sharkcraft/templates.ts',
|
|
571
|
+
'sharkcraft/pipelines.ts',
|
|
572
|
+
'sharkcraft/onboarding/onboarding-report.md',
|
|
573
|
+
'sharkcraft/onboarding/inferred-rules.draft.ts',
|
|
574
|
+
'sharkcraft/onboarding/inferred-paths.draft.ts',
|
|
575
|
+
'sharkcraft/onboarding/inferred-templates.draft.ts',
|
|
576
|
+
'sharkcraft/onboarding/inferred-boundaries.draft.ts',
|
|
577
|
+
'sharkcraft/onboarding/inferred-pipelines.draft.ts',
|
|
578
|
+
];
|
|
579
|
+
}
|
|
580
|
+
// ─── Readiness estimate ──────────────────────────────────────────────────────
|
|
581
|
+
function gradeOf(score) {
|
|
582
|
+
if (score >= 85)
|
|
583
|
+
return 'excellent';
|
|
584
|
+
if (score >= 70)
|
|
585
|
+
return 'good';
|
|
586
|
+
if (score >= 50)
|
|
587
|
+
return 'partial';
|
|
588
|
+
return 'poor';
|
|
589
|
+
}
|
|
590
|
+
function estimateReadinessImpact(inspection, paths, rules, pipelines, verification, boundaryRules) {
|
|
591
|
+
const current = buildAiReadinessReport(inspection);
|
|
592
|
+
// Heuristic: each dimension gets a modest bump from the inferred additions.
|
|
593
|
+
// We DO NOT claim certainty. Cap the bonus to keep things honest.
|
|
594
|
+
let bonus = 0;
|
|
595
|
+
if (!inspection.configFile)
|
|
596
|
+
bonus += 5; // creating config alone.
|
|
597
|
+
if (rules.length >= 3)
|
|
598
|
+
bonus += 5;
|
|
599
|
+
if (paths.length >= 3)
|
|
600
|
+
bonus += 4;
|
|
601
|
+
if (pipelines.length >= 2)
|
|
602
|
+
bonus += 3;
|
|
603
|
+
if (verification.length >= 1)
|
|
604
|
+
bonus += 2;
|
|
605
|
+
if (boundaryRules.length >= 1)
|
|
606
|
+
bonus += 3;
|
|
607
|
+
// Cap raw uplift to a tasteful ceiling so we don't claim "poor → excellent".
|
|
608
|
+
bonus = Math.min(20, bonus);
|
|
609
|
+
const expectedScore = Math.min(95, current.score + bonus);
|
|
610
|
+
const topImprovements = [
|
|
611
|
+
!inspection.configFile
|
|
612
|
+
? 'Create sharkcraft/sharkcraft.config.ts.'
|
|
613
|
+
: 'Keep config in sync with inferred drafts.',
|
|
614
|
+
rules.length > 0
|
|
615
|
+
? `Adopt ${rules.length} inferred rule${rules.length === 1 ? '' : 's'}.`
|
|
616
|
+
: 'Author rules for the most violated conventions.',
|
|
617
|
+
paths.length > 0
|
|
618
|
+
? `Adopt ${paths.length} inferred path convention${paths.length === 1 ? '' : 's'}.`
|
|
619
|
+
: 'Author path conventions for the directories you actually use.',
|
|
620
|
+
pipelines.length > 0
|
|
621
|
+
? `Adopt ${pipelines.length} pipeline${pipelines.length === 1 ? '' : 's'}.`
|
|
622
|
+
: 'Define at least feature-dev + safe-generation pipelines.',
|
|
623
|
+
boundaryRules.length > 0
|
|
624
|
+
? `Adopt ${boundaryRules.length} boundary rule${boundaryRules.length === 1 ? '' : 's'}.`
|
|
625
|
+
: 'Author boundary rules once your layer boundaries stabilise.',
|
|
626
|
+
];
|
|
627
|
+
return {
|
|
628
|
+
current: current.grade,
|
|
629
|
+
expected: gradeOf(expectedScore),
|
|
630
|
+
currentScore: current.score,
|
|
631
|
+
expectedScore,
|
|
632
|
+
topImprovements,
|
|
633
|
+
};
|
|
634
|
+
}
|
|
635
|
+
function buildNextCommands(hasSharkcraftFolder, ctx = { scaffoldTemplates: false, isMonorepo: false }) {
|
|
636
|
+
const cmds = [];
|
|
637
|
+
if (!hasSharkcraftFolder) {
|
|
638
|
+
cmds.push('shrk init # scaffold sharkcraft/');
|
|
639
|
+
}
|
|
640
|
+
cmds.push('shrk onboard --write-drafts # write drafts under sharkcraft/onboarding/', 'shrk onboard --write-drafts --scaffold-templates # also draft runnable templates', 'shrk onboard --write-drafts --import-agents # also import existing agent rules', 'shrk onboard --diff # compare drafts to live config', 'shrk doctor # validate config + entries', 'shrk coverage # see what is still missing', 'shrk task "<task>" # try a focused task packet');
|
|
641
|
+
if (ctx.isMonorepo) {
|
|
642
|
+
cmds.push('shrk onboard --dry-run # re-run after adding per-package configs');
|
|
643
|
+
}
|
|
644
|
+
return cmds;
|
|
645
|
+
}
|
|
646
|
+
// ─── Helpers ─────────────────────────────────────────────────────────────────
|
|
647
|
+
const IGNORE_DIRS = new Set([
|
|
648
|
+
'node_modules',
|
|
649
|
+
'.git',
|
|
650
|
+
'.idea',
|
|
651
|
+
'.vscode',
|
|
652
|
+
'dist',
|
|
653
|
+
'build',
|
|
654
|
+
'.cache',
|
|
655
|
+
'.nx',
|
|
656
|
+
'.turbo',
|
|
657
|
+
'coverage',
|
|
658
|
+
]);
|
|
659
|
+
function dirExists(root, rel) {
|
|
660
|
+
try {
|
|
661
|
+
const full = nodePath.join(root, rel);
|
|
662
|
+
return existsSync(full) && statSync(full).isDirectory();
|
|
663
|
+
}
|
|
664
|
+
catch {
|
|
665
|
+
return false;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
function listSubDirs(projectRoot) {
|
|
669
|
+
const out = new Map();
|
|
670
|
+
if (!existsSync(projectRoot))
|
|
671
|
+
return out;
|
|
672
|
+
let topLevel = [];
|
|
673
|
+
try {
|
|
674
|
+
topLevel = readdirSync(projectRoot, { withFileTypes: true })
|
|
675
|
+
.filter((e) => e.isDirectory() && !IGNORE_DIRS.has(e.name))
|
|
676
|
+
.map((e) => e.name);
|
|
677
|
+
}
|
|
678
|
+
catch {
|
|
679
|
+
return out;
|
|
680
|
+
}
|
|
681
|
+
for (const top of topLevel) {
|
|
682
|
+
try {
|
|
683
|
+
const fullTop = nodePath.join(projectRoot, top);
|
|
684
|
+
const children = readdirSync(fullTop, { withFileTypes: true })
|
|
685
|
+
.filter((e) => e.isDirectory() && !IGNORE_DIRS.has(e.name))
|
|
686
|
+
.map((e) => e.name);
|
|
687
|
+
out.set(top, children);
|
|
688
|
+
}
|
|
689
|
+
catch {
|
|
690
|
+
out.set(top, []);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
return out;
|
|
694
|
+
}
|
|
695
|
+
function findOne(projectRoot, pattern) {
|
|
696
|
+
const found = findFiles(projectRoot, pattern, { maxDepth: 4 });
|
|
697
|
+
return found.length > 0;
|
|
698
|
+
}
|
|
699
|
+
function reorderForPreferredPreset(recs, preferredId, registry) {
|
|
700
|
+
const idx = recs.findIndex((r) => r.preset.id === preferredId);
|
|
701
|
+
if (idx > 0) {
|
|
702
|
+
const out = [...recs];
|
|
703
|
+
const [pinned] = out.splice(idx, 1);
|
|
704
|
+
out.unshift(pinned);
|
|
705
|
+
return out;
|
|
706
|
+
}
|
|
707
|
+
if (idx === 0)
|
|
708
|
+
return [...recs];
|
|
709
|
+
// Pin the preferred preset to the front even if it isn't in the
|
|
710
|
+
// recommendations bucket (e.g. the miss penalty dropped it out of the
|
|
711
|
+
// top N). We look it up from the registry and synthesize a low-score
|
|
712
|
+
// recommendation entry so the downstream consumer still sees `id` at
|
|
713
|
+
// position 0.
|
|
714
|
+
if (registry) {
|
|
715
|
+
const preset = registry.get(preferredId);
|
|
716
|
+
if (preset) {
|
|
717
|
+
return [
|
|
718
|
+
{
|
|
719
|
+
preset,
|
|
720
|
+
score: 0,
|
|
721
|
+
confidence: 'low',
|
|
722
|
+
reasons: ['pinned via preferredPreset option'],
|
|
723
|
+
},
|
|
724
|
+
...recs,
|
|
725
|
+
];
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
return [...recs];
|
|
729
|
+
}
|