@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,745 @@
|
|
|
1
|
+
import { existsSync, statSync } from 'node:fs';
|
|
2
|
+
import * as nodePath from 'node:path';
|
|
3
|
+
import { createImportContext, DEFAULT_SAFE_IMPORT_TIMEOUT_MS, } from '@shrkcrft/core';
|
|
4
|
+
import { inspectWorkspace } from '@shrkcrft/workspace';
|
|
5
|
+
import { loadProjectConfig } from '@shrkcrft/config';
|
|
6
|
+
import { KnowledgeIndex, MarkdownKnowledgeLoader, TypeScriptKnowledgeLoader, validateKnowledgeEntries, } from '@shrkcrft/knowledge';
|
|
7
|
+
import { RuleService } from '@shrkcrft/rules';
|
|
8
|
+
import { PathService } from '@shrkcrft/paths';
|
|
9
|
+
import { loadTemplatesFromFile, TemplateRegistry } from '@shrkcrft/templates';
|
|
10
|
+
import { loadPipelinesFromFile, PipelineRegistry } from '@shrkcrft/pipelines';
|
|
11
|
+
import { discoverPacks } from '@shrkcrft/packs';
|
|
12
|
+
import { BUILTIN_PRESETS, loadPresetsFromFile, PresetRegistry } from '@shrkcrft/presets';
|
|
13
|
+
import { BoundaryRegistry, loadBoundaryRulesFromFile } from '@shrkcrft/boundaries';
|
|
14
|
+
import { DoctorSeverity } from "./doctor-result.js";
|
|
15
|
+
import { diagnoseActionHints } from "./action-hint-diagnostics.js";
|
|
16
|
+
import { computeFileFingerprint, createInspectorCache, } from "./inspector-cache.js";
|
|
17
|
+
import { DEFAULT_SLOW_LOADER_THRESHOLD_MS, LARGE_FILE_THRESHOLD_BYTES, } from "./loader-diagnostics.js";
|
|
18
|
+
import { suggestSurfaceProfile } from "./surface-profile-detect.js";
|
|
19
|
+
function suggestNextCommand(kind, packName) {
|
|
20
|
+
if (packName)
|
|
21
|
+
return 'shrk packs doctor --release';
|
|
22
|
+
if (kind === 'templates')
|
|
23
|
+
return 'shrk templates doctor';
|
|
24
|
+
if (kind === 'pipelines')
|
|
25
|
+
return 'shrk pipelines list';
|
|
26
|
+
if (kind === 'rules' || kind === 'knowledge' || kind === 'paths')
|
|
27
|
+
return 'shrk doctor --debug';
|
|
28
|
+
if (kind === 'boundaries')
|
|
29
|
+
return 'shrk check boundaries';
|
|
30
|
+
if (kind === 'presets')
|
|
31
|
+
return 'shrk presets list';
|
|
32
|
+
return 'shrk doctor --debug';
|
|
33
|
+
}
|
|
34
|
+
function recordDiagnostic(ctx, d) {
|
|
35
|
+
ctx.diagnostics.push(d);
|
|
36
|
+
ctx.onLoaderDiagnostic?.(d);
|
|
37
|
+
}
|
|
38
|
+
async function loadAssetTracked(ctx, filePath, kind, origin, packName, performLoad) {
|
|
39
|
+
const start = Date.now();
|
|
40
|
+
let sizeBytes;
|
|
41
|
+
try {
|
|
42
|
+
sizeBytes = statSync(filePath).size;
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// ignore
|
|
46
|
+
}
|
|
47
|
+
const largeFile = sizeBytes !== undefined && sizeBytes >= LARGE_FILE_THRESHOLD_BYTES;
|
|
48
|
+
const cachedEntry = ctx.cache.get(filePath);
|
|
49
|
+
// Skip when the cache says this asset previously failed and the file
|
|
50
|
+
// hasn't changed since. This is the killer feature that prevents a
|
|
51
|
+
// permanently-broken pack file from hanging every subsequent
|
|
52
|
+
// inspection — and the only signal that lets `doctor` keep telling
|
|
53
|
+
// the truth across runs.
|
|
54
|
+
if (cachedEntry &&
|
|
55
|
+
cachedEntry.status !== 'ok' &&
|
|
56
|
+
ctx.cache.isFreshFor(filePath, cachedEntry) &&
|
|
57
|
+
cachedEntry.kind === kind) {
|
|
58
|
+
const elapsedMs = Date.now() - start;
|
|
59
|
+
const message = cachedEntry.errorMessage ?? 'previously failed; cached';
|
|
60
|
+
recordDiagnostic(ctx, {
|
|
61
|
+
filePath,
|
|
62
|
+
kind,
|
|
63
|
+
origin,
|
|
64
|
+
packName,
|
|
65
|
+
elapsedMs,
|
|
66
|
+
status: 'cached-skip',
|
|
67
|
+
count: 0,
|
|
68
|
+
warningCount: 1,
|
|
69
|
+
errorMessage: message,
|
|
70
|
+
cachedStatus: cachedEntry.status,
|
|
71
|
+
deduped: false,
|
|
72
|
+
largeFile,
|
|
73
|
+
sizeBytes,
|
|
74
|
+
slow: false,
|
|
75
|
+
suggestedNextCommand: suggestNextCommand(kind, packName),
|
|
76
|
+
});
|
|
77
|
+
return {
|
|
78
|
+
count: 0,
|
|
79
|
+
warnings: [
|
|
80
|
+
`${kind} loader skipped ${filePath} — cache says previous attempt ${cachedEntry.status}: ${message}`,
|
|
81
|
+
],
|
|
82
|
+
errorMessage: message,
|
|
83
|
+
skipped: true,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
const dedupedBefore = ctx.importContext.hasSettled(filePath);
|
|
87
|
+
const loaded = await performLoad();
|
|
88
|
+
const elapsedMs = Date.now() - start;
|
|
89
|
+
const slow = elapsedMs >= DEFAULT_SLOW_LOADER_THRESHOLD_MS;
|
|
90
|
+
const errorMessage = loaded.errorMessage ??
|
|
91
|
+
(loaded.warnings.find((w) => /^(failed to (?:import|load)|timed out)/i.test(w)) ?? undefined);
|
|
92
|
+
const importResult = ctx.importContext['_settled'];
|
|
93
|
+
// Defensive: the dedup state is internal to ImportContext. We don't
|
|
94
|
+
// peek into it for correctness — we only use the public surface.
|
|
95
|
+
void importResult;
|
|
96
|
+
const status = errorMessage
|
|
97
|
+
? /timed out/i.test(errorMessage)
|
|
98
|
+
? 'timeout'
|
|
99
|
+
: 'failed'
|
|
100
|
+
: 'ok';
|
|
101
|
+
const fingerprint = computeFileFingerprint(filePath);
|
|
102
|
+
if (fingerprint) {
|
|
103
|
+
ctx.cache.put({
|
|
104
|
+
v: 1,
|
|
105
|
+
filePath,
|
|
106
|
+
mtimeMs: fingerprint.mtimeMs,
|
|
107
|
+
sizeBytes: fingerprint.sizeBytes,
|
|
108
|
+
contentHashPrefix: fingerprint.contentHashPrefix,
|
|
109
|
+
status,
|
|
110
|
+
elapsedMs,
|
|
111
|
+
recordedAtMs: Date.now(),
|
|
112
|
+
kind,
|
|
113
|
+
ids: [],
|
|
114
|
+
warningCount: loaded.warnings.length,
|
|
115
|
+
errorMessage,
|
|
116
|
+
timedOut: status === 'timeout' ? true : undefined,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
recordDiagnostic(ctx, {
|
|
120
|
+
filePath,
|
|
121
|
+
kind,
|
|
122
|
+
origin,
|
|
123
|
+
packName,
|
|
124
|
+
elapsedMs,
|
|
125
|
+
status,
|
|
126
|
+
count: loaded.count,
|
|
127
|
+
warningCount: loaded.warnings.length,
|
|
128
|
+
errorMessage,
|
|
129
|
+
deduped: dedupedBefore,
|
|
130
|
+
largeFile,
|
|
131
|
+
sizeBytes,
|
|
132
|
+
slow,
|
|
133
|
+
suggestedNextCommand: status !== 'ok' || slow ? suggestNextCommand(kind, packName) : undefined,
|
|
134
|
+
});
|
|
135
|
+
return { count: loaded.count, warnings: loaded.warnings, errorMessage, skipped: false };
|
|
136
|
+
}
|
|
137
|
+
export async function inspectSharkcraft(options = {}) {
|
|
138
|
+
const inspectStart = Date.now();
|
|
139
|
+
const cwd = options.cwd ?? process.cwd();
|
|
140
|
+
const workspace = await inspectWorkspace({ startDir: cwd });
|
|
141
|
+
const importContext = createImportContext({
|
|
142
|
+
timeoutMs: options.loaderTimeoutMs ?? DEFAULT_SAFE_IMPORT_TIMEOUT_MS,
|
|
143
|
+
});
|
|
144
|
+
const cache = createInspectorCache({
|
|
145
|
+
projectRoot: workspace.projectRoot,
|
|
146
|
+
enabled: options.useCache === true,
|
|
147
|
+
});
|
|
148
|
+
const diagnostics = [];
|
|
149
|
+
const ctx = {
|
|
150
|
+
importContext,
|
|
151
|
+
cache,
|
|
152
|
+
diagnostics,
|
|
153
|
+
onLoaderDiagnostic: options.onLoaderDiagnostic,
|
|
154
|
+
cwdProjectRoot: workspace.projectRoot,
|
|
155
|
+
};
|
|
156
|
+
const cfgResult = await loadProjectConfig(cwd);
|
|
157
|
+
const cfg = cfgResult.ok ? cfgResult.value : null;
|
|
158
|
+
const warnings = [];
|
|
159
|
+
const sourceFiles = [];
|
|
160
|
+
const knowledgeEntries = [];
|
|
161
|
+
const templates = [];
|
|
162
|
+
const pipelines = [];
|
|
163
|
+
if (cfg) {
|
|
164
|
+
const tsLoader = new TypeScriptKnowledgeLoader({ importContext });
|
|
165
|
+
const mdLoader = new MarkdownKnowledgeLoader();
|
|
166
|
+
const collectFile = async (relPath, kindHint) => {
|
|
167
|
+
const full = nodePath.join(cfg.sharkcraftDir, relPath);
|
|
168
|
+
if (!existsSync(full))
|
|
169
|
+
return;
|
|
170
|
+
sourceFiles.push(full);
|
|
171
|
+
if (tsLoader.canLoad(full)) {
|
|
172
|
+
const tracked = await loadAssetTracked(ctx, full, kindHint, 'local-config', undefined, async () => {
|
|
173
|
+
const r = await tsLoader.load(full);
|
|
174
|
+
knowledgeEntries.push(...r.entries);
|
|
175
|
+
warnings.push(...r.warnings);
|
|
176
|
+
return { count: r.entries.length, warnings: r.warnings };
|
|
177
|
+
});
|
|
178
|
+
if (tracked.skipped)
|
|
179
|
+
warnings.push(...tracked.warnings);
|
|
180
|
+
}
|
|
181
|
+
else if (mdLoader.canLoad(full)) {
|
|
182
|
+
const tracked = await loadAssetTracked(ctx, full, kindHint, 'local-config', undefined, async () => {
|
|
183
|
+
const r = await mdLoader.load(full);
|
|
184
|
+
knowledgeEntries.push(...r.entries);
|
|
185
|
+
warnings.push(...r.warnings);
|
|
186
|
+
return { count: r.entries.length, warnings: r.warnings };
|
|
187
|
+
});
|
|
188
|
+
if (tracked.skipped)
|
|
189
|
+
warnings.push(...tracked.warnings);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
const fileSets = [
|
|
193
|
+
{ kind: 'knowledge', files: cfg.config.knowledgeFiles ?? [] },
|
|
194
|
+
{ kind: 'rules', files: cfg.config.ruleFiles ?? [] },
|
|
195
|
+
{ kind: 'paths', files: cfg.config.pathFiles ?? [] },
|
|
196
|
+
{ kind: 'docs', files: cfg.config.docsFiles ?? [] },
|
|
197
|
+
];
|
|
198
|
+
const seen = new Set();
|
|
199
|
+
for (const { kind, files } of fileSets) {
|
|
200
|
+
for (const f of files) {
|
|
201
|
+
if (seen.has(f))
|
|
202
|
+
continue;
|
|
203
|
+
seen.add(f);
|
|
204
|
+
await collectFile(f, kind);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
for (const f of cfg.config.templateFiles ?? []) {
|
|
208
|
+
const full = nodePath.join(cfg.sharkcraftDir, f);
|
|
209
|
+
if (!existsSync(full))
|
|
210
|
+
continue;
|
|
211
|
+
sourceFiles.push(full);
|
|
212
|
+
const tracked = await loadAssetTracked(ctx, full, 'templates', 'local-config', undefined, async () => {
|
|
213
|
+
const r = await loadTemplatesFromFile(full, { importContext });
|
|
214
|
+
templates.push(...r.templates);
|
|
215
|
+
warnings.push(...r.warnings);
|
|
216
|
+
return { count: r.templates.length, warnings: r.warnings };
|
|
217
|
+
});
|
|
218
|
+
if (tracked.skipped)
|
|
219
|
+
warnings.push(...tracked.warnings);
|
|
220
|
+
}
|
|
221
|
+
for (const f of cfg.config.pipelineFiles ?? []) {
|
|
222
|
+
const full = nodePath.join(cfg.sharkcraftDir, f);
|
|
223
|
+
if (!existsSync(full))
|
|
224
|
+
continue;
|
|
225
|
+
sourceFiles.push(full);
|
|
226
|
+
const tracked = await loadAssetTracked(ctx, full, 'pipelines', 'local-config', undefined, async () => {
|
|
227
|
+
const r = await loadPipelinesFromFile(full, { importContext });
|
|
228
|
+
pipelines.push(...r.pipelines);
|
|
229
|
+
warnings.push(...r.warnings);
|
|
230
|
+
return { count: r.pipelines.length, warnings: r.warnings };
|
|
231
|
+
});
|
|
232
|
+
if (tracked.skipped)
|
|
233
|
+
warnings.push(...tracked.warnings);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
else if (cfgResult.ok === false) {
|
|
237
|
+
warnings.push(cfgResult.error.message);
|
|
238
|
+
}
|
|
239
|
+
const entrySources = new Map();
|
|
240
|
+
for (const e of knowledgeEntries) {
|
|
241
|
+
entrySources.set(e.id, { type: 'local', file: e.source?.origin });
|
|
242
|
+
}
|
|
243
|
+
const templateSources = new Map();
|
|
244
|
+
for (const t of templates) {
|
|
245
|
+
templateSources.set(t.id, { type: 'local' });
|
|
246
|
+
}
|
|
247
|
+
const pipelineSources = new Map();
|
|
248
|
+
for (const p of pipelines) {
|
|
249
|
+
pipelineSources.set(p.id, { type: 'local' });
|
|
250
|
+
}
|
|
251
|
+
const packs = await discoverPacks({
|
|
252
|
+
projectRoot: workspace.projectRoot,
|
|
253
|
+
...(options.verifyPackSignatures !== undefined
|
|
254
|
+
? { verifySignatures: options.verifyPackSignatures }
|
|
255
|
+
: {}),
|
|
256
|
+
...(options.packSecret !== undefined ? { packSecret: options.packSecret } : {}),
|
|
257
|
+
});
|
|
258
|
+
const tsLoader = new TypeScriptKnowledgeLoader({ importContext });
|
|
259
|
+
const mdLoader = new MarkdownKnowledgeLoader();
|
|
260
|
+
for (const pack of packs.validPacks) {
|
|
261
|
+
const manifest = pack.manifest;
|
|
262
|
+
const c = manifest.contributions;
|
|
263
|
+
const resolved = {
|
|
264
|
+
knowledgeEntries: 0,
|
|
265
|
+
rules: 0,
|
|
266
|
+
pathConventions: 0,
|
|
267
|
+
templates: 0,
|
|
268
|
+
pipelines: 0,
|
|
269
|
+
docs: 0,
|
|
270
|
+
presets: 0,
|
|
271
|
+
scaffoldPatterns: 0,
|
|
272
|
+
policyChecks: 0,
|
|
273
|
+
};
|
|
274
|
+
const loadFile = async (rel, kind) => {
|
|
275
|
+
const full = nodePath.resolve(pack.packageRoot, rel);
|
|
276
|
+
if (!existsSync(full)) {
|
|
277
|
+
warnings.push(`pack ${pack.packageName}: missing contribution file ${rel}`);
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
sourceFiles.push(full);
|
|
281
|
+
const src = {
|
|
282
|
+
type: 'pack',
|
|
283
|
+
packageName: pack.packageName,
|
|
284
|
+
packageVersion: pack.packageVersion,
|
|
285
|
+
file: full,
|
|
286
|
+
};
|
|
287
|
+
if (kind === 'templates') {
|
|
288
|
+
const tracked = await loadAssetTracked(ctx, full, 'templates', 'pack-manifest', pack.packageName, async () => {
|
|
289
|
+
const r = await loadTemplatesFromFile(full, { importContext });
|
|
290
|
+
for (const t of r.templates) {
|
|
291
|
+
if (templateSources.has(t.id)) {
|
|
292
|
+
warnings.push(`pack ${pack.packageName}: template "${t.id}" already provided locally — pack version skipped`);
|
|
293
|
+
continue;
|
|
294
|
+
}
|
|
295
|
+
templates.push(t);
|
|
296
|
+
templateSources.set(t.id, src);
|
|
297
|
+
resolved.templates += 1;
|
|
298
|
+
}
|
|
299
|
+
warnings.push(...r.warnings);
|
|
300
|
+
return { count: r.templates.length, warnings: r.warnings };
|
|
301
|
+
});
|
|
302
|
+
if (tracked.skipped)
|
|
303
|
+
warnings.push(...tracked.warnings);
|
|
304
|
+
}
|
|
305
|
+
else if (kind === 'pipelines') {
|
|
306
|
+
const tracked = await loadAssetTracked(ctx, full, 'pipelines', 'pack-manifest', pack.packageName, async () => {
|
|
307
|
+
const r = await loadPipelinesFromFile(full, { importContext });
|
|
308
|
+
for (const p of r.pipelines) {
|
|
309
|
+
if (pipelineSources.has(p.id)) {
|
|
310
|
+
warnings.push(`pack ${pack.packageName}: pipeline "${p.id}" already provided locally — pack version skipped`);
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
313
|
+
pipelines.push(p);
|
|
314
|
+
pipelineSources.set(p.id, src);
|
|
315
|
+
resolved.pipelines += 1;
|
|
316
|
+
}
|
|
317
|
+
warnings.push(...r.warnings);
|
|
318
|
+
return { count: r.pipelines.length, warnings: r.warnings };
|
|
319
|
+
});
|
|
320
|
+
if (tracked.skipped)
|
|
321
|
+
warnings.push(...tracked.warnings);
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
const loader = tsLoader.canLoad(full) ? tsLoader : mdLoader.canLoad(full) ? mdLoader : null;
|
|
325
|
+
if (!loader) {
|
|
326
|
+
warnings.push(`pack ${pack.packageName}: unsupported contribution file ${rel}`);
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
const tracked = await loadAssetTracked(ctx, full, kind, 'pack-manifest', pack.packageName, async () => {
|
|
330
|
+
const r = await loader.load(full);
|
|
331
|
+
for (const entry of r.entries) {
|
|
332
|
+
if (entrySources.has(entry.id)) {
|
|
333
|
+
warnings.push(`pack ${pack.packageName}: knowledge id "${entry.id}" already provided locally — pack version skipped`);
|
|
334
|
+
continue;
|
|
335
|
+
}
|
|
336
|
+
knowledgeEntries.push(entry);
|
|
337
|
+
entrySources.set(entry.id, src);
|
|
338
|
+
const t = String(entry.type);
|
|
339
|
+
if (t === 'rule')
|
|
340
|
+
resolved.rules += 1;
|
|
341
|
+
else if (t === 'path')
|
|
342
|
+
resolved.pathConventions += 1;
|
|
343
|
+
else
|
|
344
|
+
resolved.knowledgeEntries += 1;
|
|
345
|
+
}
|
|
346
|
+
if (kind === 'docs')
|
|
347
|
+
resolved.docs += 1;
|
|
348
|
+
warnings.push(...r.warnings);
|
|
349
|
+
return { count: r.entries.length, warnings: r.warnings };
|
|
350
|
+
});
|
|
351
|
+
if (tracked.skipped)
|
|
352
|
+
warnings.push(...tracked.warnings);
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
for (const rel of c.knowledgeFiles ?? [])
|
|
356
|
+
await loadFile(rel, 'knowledge');
|
|
357
|
+
for (const rel of c.ruleFiles ?? [])
|
|
358
|
+
await loadFile(rel, 'rules');
|
|
359
|
+
for (const rel of c.pathFiles ?? [])
|
|
360
|
+
await loadFile(rel, 'paths');
|
|
361
|
+
for (const rel of c.docsFiles ?? [])
|
|
362
|
+
await loadFile(rel, 'docs');
|
|
363
|
+
for (const rel of c.templateFiles ?? [])
|
|
364
|
+
await loadFile(rel, 'templates');
|
|
365
|
+
for (const rel of c.pipelineFiles ?? [])
|
|
366
|
+
await loadFile(rel, 'pipelines');
|
|
367
|
+
pack.resolvedCounts = resolved;
|
|
368
|
+
}
|
|
369
|
+
for (const invalid of packs.invalidPacks) {
|
|
370
|
+
warnings.push(`pack ${invalid.packageName}@${invalid.packageVersion}: ${invalid.loadError ??
|
|
371
|
+
(invalid.validationIssues.map((i) => `${i.field}: ${i.message}`).join('; ') || 'invalid manifest')}`);
|
|
372
|
+
}
|
|
373
|
+
const validation = validateKnowledgeEntries(knowledgeEntries);
|
|
374
|
+
const cleanEntries = validation.uniqueEntries;
|
|
375
|
+
const index = new KnowledgeIndex(cleanEntries);
|
|
376
|
+
const ruleService = new RuleService(cleanEntries);
|
|
377
|
+
const pathService = new PathService(cleanEntries);
|
|
378
|
+
const templateRegistry = new TemplateRegistry(templates);
|
|
379
|
+
const pipelineRegistry = new PipelineRegistry(pipelines);
|
|
380
|
+
const presetRegistry = new PresetRegistry([...BUILTIN_PRESETS]);
|
|
381
|
+
const presetSources = new Map();
|
|
382
|
+
for (const builtin of BUILTIN_PRESETS) {
|
|
383
|
+
presetSources.set(builtin.id, { type: 'local', file: 'builtin' });
|
|
384
|
+
}
|
|
385
|
+
for (const pack of packs.validPacks) {
|
|
386
|
+
const c = pack.manifest.contributions;
|
|
387
|
+
for (const rel of c.presetFiles ?? []) {
|
|
388
|
+
const full = nodePath.resolve(pack.packageRoot, rel);
|
|
389
|
+
if (!existsSync(full)) {
|
|
390
|
+
warnings.push(`pack ${pack.packageName}: missing preset file ${rel}`);
|
|
391
|
+
continue;
|
|
392
|
+
}
|
|
393
|
+
const tracked = await loadAssetTracked(ctx, full, 'presets', 'pack-manifest', pack.packageName, async () => {
|
|
394
|
+
const r = await loadPresetsFromFile(full, { importContext });
|
|
395
|
+
warnings.push(...r.warnings);
|
|
396
|
+
for (const preset of r.presets) {
|
|
397
|
+
if (presetRegistry.has(preset.id)) {
|
|
398
|
+
warnings.push(`pack ${pack.packageName}: preset "${preset.id}" already provided — pack version skipped`);
|
|
399
|
+
continue;
|
|
400
|
+
}
|
|
401
|
+
presetRegistry.add(preset);
|
|
402
|
+
presetSources.set(preset.id, {
|
|
403
|
+
type: 'pack',
|
|
404
|
+
packageName: pack.packageName,
|
|
405
|
+
packageVersion: pack.packageVersion,
|
|
406
|
+
file: full,
|
|
407
|
+
});
|
|
408
|
+
if (pack.resolvedCounts)
|
|
409
|
+
pack.resolvedCounts.presets += 1;
|
|
410
|
+
}
|
|
411
|
+
return { count: r.presets.length, warnings: r.warnings };
|
|
412
|
+
});
|
|
413
|
+
if (tracked.skipped)
|
|
414
|
+
warnings.push(...tracked.warnings);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
const cfgExt = cfg?.config;
|
|
418
|
+
const localPresetFiles = cfgExt?.presetFiles ?? [];
|
|
419
|
+
for (const rel of localPresetFiles) {
|
|
420
|
+
if (!cfg)
|
|
421
|
+
continue;
|
|
422
|
+
const full = nodePath.join(cfg.sharkcraftDir, rel);
|
|
423
|
+
if (!existsSync(full))
|
|
424
|
+
continue;
|
|
425
|
+
const tracked = await loadAssetTracked(ctx, full, 'presets', 'local-config', undefined, async () => {
|
|
426
|
+
const r = await loadPresetsFromFile(full, { importContext });
|
|
427
|
+
warnings.push(...r.warnings);
|
|
428
|
+
for (const preset of r.presets) {
|
|
429
|
+
presetRegistry.add(preset);
|
|
430
|
+
presetSources.set(preset.id, { type: 'local', file: full });
|
|
431
|
+
}
|
|
432
|
+
return { count: r.presets.length, warnings: r.warnings };
|
|
433
|
+
});
|
|
434
|
+
if (tracked.skipped)
|
|
435
|
+
warnings.push(...tracked.warnings);
|
|
436
|
+
}
|
|
437
|
+
const boundaryRegistry = new BoundaryRegistry();
|
|
438
|
+
const boundarySources = new Map();
|
|
439
|
+
for (const pack of packs.validPacks) {
|
|
440
|
+
const c = pack.manifest.contributions;
|
|
441
|
+
for (const rel of c.boundaryFiles ?? []) {
|
|
442
|
+
const full = nodePath.resolve(pack.packageRoot, rel);
|
|
443
|
+
if (!existsSync(full)) {
|
|
444
|
+
warnings.push(`pack ${pack.packageName}: missing boundary file ${rel}`);
|
|
445
|
+
continue;
|
|
446
|
+
}
|
|
447
|
+
const tracked = await loadAssetTracked(ctx, full, 'boundaries', 'pack-manifest', pack.packageName, async () => {
|
|
448
|
+
const r = await loadBoundaryRulesFromFile(full, { importContext });
|
|
449
|
+
warnings.push(...r.warnings);
|
|
450
|
+
for (const rule of r.rules) {
|
|
451
|
+
if (boundaryRegistry.has(rule.id)) {
|
|
452
|
+
warnings.push(`pack ${pack.packageName}: boundary "${rule.id}" already provided — pack version skipped`);
|
|
453
|
+
continue;
|
|
454
|
+
}
|
|
455
|
+
boundaryRegistry.add(rule);
|
|
456
|
+
boundarySources.set(rule.id, {
|
|
457
|
+
type: 'pack',
|
|
458
|
+
packageName: pack.packageName,
|
|
459
|
+
packageVersion: pack.packageVersion,
|
|
460
|
+
file: full,
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
return { count: r.rules.length, warnings: r.warnings };
|
|
464
|
+
});
|
|
465
|
+
if (tracked.skipped)
|
|
466
|
+
warnings.push(...tracked.warnings);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
for (const rel of cfgExt?.boundaryFiles ?? []) {
|
|
470
|
+
if (!cfg)
|
|
471
|
+
continue;
|
|
472
|
+
const full = nodePath.join(cfg.sharkcraftDir, rel);
|
|
473
|
+
if (!existsSync(full))
|
|
474
|
+
continue;
|
|
475
|
+
const tracked = await loadAssetTracked(ctx, full, 'boundaries', 'local-config', undefined, async () => {
|
|
476
|
+
const r = await loadBoundaryRulesFromFile(full, { importContext });
|
|
477
|
+
warnings.push(...r.warnings);
|
|
478
|
+
for (const rule of r.rules) {
|
|
479
|
+
boundaryRegistry.add(rule);
|
|
480
|
+
boundarySources.set(rule.id, { type: 'local', file: full });
|
|
481
|
+
}
|
|
482
|
+
return { count: r.rules.length, warnings: r.warnings };
|
|
483
|
+
});
|
|
484
|
+
if (tracked.skipped)
|
|
485
|
+
warnings.push(...tracked.warnings);
|
|
486
|
+
}
|
|
487
|
+
return {
|
|
488
|
+
projectRoot: workspace.projectRoot,
|
|
489
|
+
workspace,
|
|
490
|
+
hasSharkcraftFolder: workspace.hasSharkcraftFolder,
|
|
491
|
+
sharkcraftDir: cfg?.sharkcraftDir ?? workspace.sharkcraftPath ?? null,
|
|
492
|
+
config: cfg?.config ?? null,
|
|
493
|
+
configFile: cfg?.configFile ?? null,
|
|
494
|
+
knowledgeEntries: cleanEntries,
|
|
495
|
+
templates,
|
|
496
|
+
pipelines,
|
|
497
|
+
warnings,
|
|
498
|
+
sourceFiles,
|
|
499
|
+
validationIssues: validation.issues,
|
|
500
|
+
packs,
|
|
501
|
+
entrySources,
|
|
502
|
+
templateSources,
|
|
503
|
+
pipelineSources,
|
|
504
|
+
presetRegistry,
|
|
505
|
+
presetSources,
|
|
506
|
+
boundaryRegistry,
|
|
507
|
+
boundarySources,
|
|
508
|
+
index,
|
|
509
|
+
ruleService,
|
|
510
|
+
pathService,
|
|
511
|
+
templateRegistry,
|
|
512
|
+
pipelineRegistry,
|
|
513
|
+
loaderDiagnostics: diagnostics,
|
|
514
|
+
inspectionElapsedMs: Date.now() - inspectStart,
|
|
515
|
+
cacheEnabled: cache.enabled,
|
|
516
|
+
cacheDir: cache.dir,
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
export function runDoctor(inspection) {
|
|
520
|
+
const checks = [];
|
|
521
|
+
if (!inspection.workspace.hasPackageJson) {
|
|
522
|
+
checks.push({
|
|
523
|
+
id: 'package-json',
|
|
524
|
+
title: 'package.json present',
|
|
525
|
+
severity: DoctorSeverity.Warning,
|
|
526
|
+
message: 'No package.json detected — this may not be a Node-compatible project.',
|
|
527
|
+
fix: 'Run "bun init" or create a package.json.',
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
else {
|
|
531
|
+
checks.push({
|
|
532
|
+
id: 'package-json',
|
|
533
|
+
title: 'package.json present',
|
|
534
|
+
severity: DoctorSeverity.Ok,
|
|
535
|
+
message: `${inspection.workspace.packageName ?? '(unnamed)'} @ ${inspection.workspace.packageVersion ?? '0.0.0'}`,
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
if (!inspection.hasSharkcraftFolder) {
|
|
539
|
+
checks.push({
|
|
540
|
+
id: 'sharkcraft-folder',
|
|
541
|
+
title: 'sharkcraft/ folder',
|
|
542
|
+
severity: DoctorSeverity.Error,
|
|
543
|
+
message: 'No sharkcraft/ folder found.',
|
|
544
|
+
fix: 'Run `shrk init` to create one.',
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
else {
|
|
548
|
+
checks.push({
|
|
549
|
+
id: 'sharkcraft-folder',
|
|
550
|
+
title: 'sharkcraft/ folder',
|
|
551
|
+
severity: DoctorSeverity.Ok,
|
|
552
|
+
message: `Found at ${inspection.sharkcraftDir}`,
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
if (!inspection.configFile) {
|
|
556
|
+
checks.push({
|
|
557
|
+
id: 'config',
|
|
558
|
+
title: 'sharkcraft.config.ts',
|
|
559
|
+
severity: DoctorSeverity.Warning,
|
|
560
|
+
message: 'No config file detected — using defaults.',
|
|
561
|
+
fix: 'Create sharkcraft/sharkcraft.config.ts to customize knowledge file paths.',
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
else {
|
|
565
|
+
checks.push({
|
|
566
|
+
id: 'config',
|
|
567
|
+
title: 'sharkcraft.config.ts',
|
|
568
|
+
severity: DoctorSeverity.Ok,
|
|
569
|
+
message: `Loaded from ${inspection.configFile}`,
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
if (inspection.knowledgeEntries.length === 0) {
|
|
573
|
+
checks.push({
|
|
574
|
+
id: 'knowledge',
|
|
575
|
+
title: 'knowledge entries',
|
|
576
|
+
severity: DoctorSeverity.Warning,
|
|
577
|
+
message: 'No knowledge entries loaded.',
|
|
578
|
+
fix: 'Add entries to sharkcraft/knowledge.ts using defineKnowledgeEntry()',
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
else {
|
|
582
|
+
checks.push({
|
|
583
|
+
id: 'knowledge',
|
|
584
|
+
title: 'knowledge entries',
|
|
585
|
+
severity: DoctorSeverity.Ok,
|
|
586
|
+
message: `${inspection.knowledgeEntries.length} entries loaded.`,
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
if (inspection.templates.length === 0) {
|
|
590
|
+
checks.push({
|
|
591
|
+
id: 'templates',
|
|
592
|
+
title: 'templates',
|
|
593
|
+
severity: DoctorSeverity.Info,
|
|
594
|
+
message: 'No templates registered.',
|
|
595
|
+
fix: 'Define templates via defineTemplate() in sharkcraft/templates.ts',
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
else {
|
|
599
|
+
checks.push({
|
|
600
|
+
id: 'templates',
|
|
601
|
+
title: 'templates',
|
|
602
|
+
severity: DoctorSeverity.Ok,
|
|
603
|
+
message: `${inspection.templates.length} templates registered.`,
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
if (inspection.packs.discoveredPacks.length > 0) {
|
|
607
|
+
const v = inspection.packs.validPacks.length;
|
|
608
|
+
const i = inspection.packs.invalidPacks.length;
|
|
609
|
+
checks.push({
|
|
610
|
+
id: 'packs',
|
|
611
|
+
title: 'packs',
|
|
612
|
+
severity: i === 0 ? DoctorSeverity.Ok : DoctorSeverity.Warning,
|
|
613
|
+
message: i === 0
|
|
614
|
+
? `${v} pack(s) discovered.`
|
|
615
|
+
: `${v} valid, ${i} invalid pack(s). See \`shrk packs doctor\`.`,
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
if (inspection.pipelines.length === 0) {
|
|
619
|
+
checks.push({
|
|
620
|
+
id: 'pipelines',
|
|
621
|
+
title: 'pipelines',
|
|
622
|
+
severity: DoctorSeverity.Info,
|
|
623
|
+
message: 'No pipelines registered.',
|
|
624
|
+
fix: 'Define pipelines via definePipeline() in sharkcraft/pipelines.ts (optional but recommended).',
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
else {
|
|
628
|
+
checks.push({
|
|
629
|
+
id: 'pipelines',
|
|
630
|
+
title: 'pipelines',
|
|
631
|
+
severity: DoctorSeverity.Ok,
|
|
632
|
+
message: `${inspection.pipelines.length} pipelines registered.`,
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
// Surface loader timeouts / failures as doctor errors so a
|
|
636
|
+
// broken pack asset is immediately visible instead of swallowed.
|
|
637
|
+
for (const d of inspection.loaderDiagnostics) {
|
|
638
|
+
if (d.status === 'ok')
|
|
639
|
+
continue;
|
|
640
|
+
const sevByStatus = d.status === 'timeout' || d.status === 'failed'
|
|
641
|
+
? DoctorSeverity.Error
|
|
642
|
+
: DoctorSeverity.Warning;
|
|
643
|
+
checks.push({
|
|
644
|
+
id: `loader-${d.status}-${nodePath.basename(d.filePath)}`,
|
|
645
|
+
title: `Loader ${d.status} (${d.kind})`,
|
|
646
|
+
severity: sevByStatus,
|
|
647
|
+
message: `${d.kind} loader ${d.status} after ${d.elapsedMs}ms: ${d.filePath}${d.errorMessage ? ` — ${d.errorMessage}` : ''}`,
|
|
648
|
+
fix: d.suggestedNextCommand,
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
for (const w of inspection.warnings) {
|
|
652
|
+
checks.push({
|
|
653
|
+
id: `warning-${checks.length}`,
|
|
654
|
+
title: 'Loader warning',
|
|
655
|
+
severity: DoctorSeverity.Warning,
|
|
656
|
+
message: w,
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
for (const v of inspection.validationIssues) {
|
|
660
|
+
checks.push({
|
|
661
|
+
id: `validation-${v.code}-${v.entryId}`,
|
|
662
|
+
title: `Knowledge validation (${v.code})`,
|
|
663
|
+
severity: v.severity === 'error' ? DoctorSeverity.Error : DoctorSeverity.Warning,
|
|
664
|
+
message: v.message,
|
|
665
|
+
fix: v.source ? `Edit ${v.source}` : undefined,
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
// Surface profile drift advisory. Warn (advisory) when the
|
|
669
|
+
// configured `surface.profile` no longer matches what the workspace
|
|
670
|
+
// shape suggests today, so the user knows to re-run init or override.
|
|
671
|
+
const cfgSurface = inspection.config?.surface;
|
|
672
|
+
if (cfgSurface?.profile) {
|
|
673
|
+
try {
|
|
674
|
+
const detected = suggestSurfaceProfile(inspection.workspace.profiles);
|
|
675
|
+
if (detected.profile !== cfgSurface.profile) {
|
|
676
|
+
checks.push({
|
|
677
|
+
id: 'surface-profile-drift',
|
|
678
|
+
title: 'Surface profile drift',
|
|
679
|
+
severity: DoctorSeverity.Warning,
|
|
680
|
+
advisory: true,
|
|
681
|
+
message: `surface.profile is "${cfgSurface.profile}" but the workspace now looks like "${detected.profile}" (${detected.reason})`,
|
|
682
|
+
fix: `Re-run with: shrk init --surface-profile ${detected.profile} --write`,
|
|
683
|
+
category: 'surface-profile',
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
catch {
|
|
688
|
+
// best-effort
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
const hintsEnabled = inspection.config?.actionHintDiagnostics !==
|
|
692
|
+
false;
|
|
693
|
+
if (hintsEnabled) {
|
|
694
|
+
const hintReport = diagnoseActionHints(inspection.knowledgeEntries);
|
|
695
|
+
for (const i of hintReport.issues) {
|
|
696
|
+
checks.push({
|
|
697
|
+
id: `actionhints-${i.code}-${i.entryId}`,
|
|
698
|
+
title: `Action-hint quality (${i.code})`,
|
|
699
|
+
severity: DoctorSeverity.Warning,
|
|
700
|
+
message: i.message,
|
|
701
|
+
fix: i.suggestion,
|
|
702
|
+
category: 'action-hint-quality',
|
|
703
|
+
code: i.code,
|
|
704
|
+
recommendedFix: `shrk fix preview --action-hints --target ${i.entryId}`,
|
|
705
|
+
whyThisMatters: actionHintWhyThisMatters(i.code),
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
const summary = { ok: 0, info: 0, warnings: 0, errors: 0, advisoryCount: 0 };
|
|
710
|
+
for (const c of checks) {
|
|
711
|
+
if (c.severity === DoctorSeverity.Ok)
|
|
712
|
+
summary.ok += 1;
|
|
713
|
+
else if (c.severity === DoctorSeverity.Info)
|
|
714
|
+
summary.info += 1;
|
|
715
|
+
else if (c.severity === DoctorSeverity.Warning)
|
|
716
|
+
summary.warnings += 1;
|
|
717
|
+
else if (c.severity === DoctorSeverity.Error)
|
|
718
|
+
summary.errors += 1;
|
|
719
|
+
// AdvisoryCount = info-severity OR explicitly marked advisory.
|
|
720
|
+
if (c.severity === DoctorSeverity.Info || c.advisory === true) {
|
|
721
|
+
summary.advisoryCount += 1;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
return { passed: summary.errors === 0, checks, summary };
|
|
725
|
+
}
|
|
726
|
+
function actionHintWhyThisMatters(code) {
|
|
727
|
+
switch (code) {
|
|
728
|
+
case 'missing-hints':
|
|
729
|
+
return 'Without actionHints the agent must guess what to run; high-priority rules cannot drive a deterministic flow.';
|
|
730
|
+
case 'missing-commands-or-mcp':
|
|
731
|
+
return 'A high-priority rule with no commands/mcpTools cannot be acted on automatically.';
|
|
732
|
+
case 'missing-forbidden-actions':
|
|
733
|
+
return 'Rules that ban behaviour need an explicit forbiddenActions list so agents and reviewers know what to avoid.';
|
|
734
|
+
case 'missing-verification':
|
|
735
|
+
return 'Enforceable rules need verificationCommands so `shrk apply --validate` and the agent can check the result.';
|
|
736
|
+
case 'missing-write-policy':
|
|
737
|
+
return 'Write-related rules must declare writePolicy so agents know whether mutation is allowed via MCP/CLI.';
|
|
738
|
+
case 'missing-related-templates':
|
|
739
|
+
return 'Template-related rules without relatedTemplates leave agents guessing which scaffold to use.';
|
|
740
|
+
case 'missing-related-path-conventions':
|
|
741
|
+
return 'Path-related rules without relatedPathConventions leave agents guessing where to write files.';
|
|
742
|
+
default:
|
|
743
|
+
return 'Improving action-hint quality keeps doctor output actionable instead of permanent yellow noise.';
|
|
744
|
+
}
|
|
745
|
+
}
|