@shrkcrft/inspector 0.1.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +15 -0
- package/dist/acceptance-replay.d.ts +63 -0
- package/dist/acceptance-replay.d.ts.map +1 -0
- package/dist/acceptance-replay.js +240 -0
- package/dist/action-hint-diagnostics.d.ts +32 -0
- package/dist/action-hint-diagnostics.d.ts.map +1 -0
- package/dist/action-hint-diagnostics.js +133 -0
- package/dist/adoption-check.d.ts +28 -0
- package/dist/adoption-check.d.ts.map +1 -0
- package/dist/adoption-check.js +181 -0
- package/dist/adoption-checkpoint.d.ts +97 -0
- package/dist/adoption-checkpoint.d.ts.map +1 -0
- package/dist/adoption-checkpoint.js +209 -0
- package/dist/adoption-merge-preview.d.ts +28 -0
- package/dist/adoption-merge-preview.d.ts.map +1 -0
- package/dist/adoption-merge-preview.js +254 -0
- package/dist/adoption-report-renderer.d.ts +33 -0
- package/dist/adoption-report-renderer.d.ts.map +1 -0
- package/dist/adoption-report-renderer.js +257 -0
- package/dist/adoption-state.d.ts +100 -0
- package/dist/adoption-state.d.ts.map +1 -0
- package/dist/adoption-state.js +296 -0
- package/dist/adoption-three-way.d.ts +46 -0
- package/dist/adoption-three-way.d.ts.map +1 -0
- package/dist/adoption-three-way.js +181 -0
- package/dist/agent-brief.d.ts +77 -0
- package/dist/agent-brief.d.ts.map +1 -0
- package/dist/agent-brief.js +490 -0
- package/dist/agent-contract-gate.d.ts +108 -0
- package/dist/agent-contract-gate.d.ts.map +1 -0
- package/dist/agent-contract-gate.js +412 -0
- package/dist/agent-contract-templates.d.ts +63 -0
- package/dist/agent-contract-templates.d.ts.map +1 -0
- package/dist/agent-contract-templates.js +346 -0
- package/dist/agent-contract.d.ts +65 -0
- package/dist/agent-contract.d.ts.map +1 -0
- package/dist/agent-contract.js +555 -0
- package/dist/agent-handoff.d.ts +123 -0
- package/dist/agent-handoff.d.ts.map +1 -0
- package/dist/agent-handoff.js +470 -0
- package/dist/agent-instructions.d.ts +2 -0
- package/dist/agent-instructions.d.ts.map +1 -0
- package/dist/agent-instructions.js +21 -0
- package/dist/agent-orchestration.d.ts +61 -0
- package/dist/agent-orchestration.d.ts.map +1 -0
- package/dist/agent-orchestration.js +285 -0
- package/dist/agent-task-prep.d.ts +31 -0
- package/dist/agent-task-prep.d.ts.map +1 -0
- package/dist/agent-task-prep.js +73 -0
- package/dist/ai-readiness.d.ts +30 -0
- package/dist/ai-readiness.d.ts.map +1 -0
- package/dist/ai-readiness.js +279 -0
- package/dist/api-report.d.ts +51 -0
- package/dist/api-report.d.ts.map +1 -0
- package/dist/api-report.js +254 -0
- package/dist/apply-dispatch-trace.d.ts +93 -0
- package/dist/apply-dispatch-trace.d.ts.map +1 -0
- package/dist/apply-dispatch-trace.js +283 -0
- package/dist/apply-gate-result.d.ts +52 -0
- package/dist/apply-gate-result.d.ts.map +1 -0
- package/dist/apply-gate-result.js +44 -0
- package/dist/architecture-map.d.ts +118 -0
- package/dist/architecture-map.d.ts.map +1 -0
- package/dist/architecture-map.js +543 -0
- package/dist/area-explore.d.ts +75 -0
- package/dist/area-explore.d.ts.map +1 -0
- package/dist/area-explore.js +438 -0
- package/dist/area-map.d.ts +43 -0
- package/dist/area-map.d.ts.map +1 -0
- package/dist/area-map.js +197 -0
- package/dist/asset-provenance.d.ts +123 -0
- package/dist/asset-provenance.d.ts.map +1 -0
- package/dist/asset-provenance.js +209 -0
- package/dist/barrel-operations.d.ts +45 -0
- package/dist/barrel-operations.d.ts.map +1 -0
- package/dist/barrel-operations.js +159 -0
- package/dist/boundaries-changed-only.d.ts +62 -0
- package/dist/boundaries-changed-only.d.ts.map +1 -0
- package/dist/boundaries-changed-only.js +97 -0
- package/dist/boundary-suggestions.d.ts +20 -0
- package/dist/boundary-suggestions.d.ts.map +1 -0
- package/dist/boundary-suggestions.js +51 -0
- package/dist/bundle-diff.d.ts +98 -0
- package/dist/bundle-diff.d.ts.map +1 -0
- package/dist/bundle-diff.js +531 -0
- package/dist/bundle-replay.d.ts +68 -0
- package/dist/bundle-replay.d.ts.map +1 -0
- package/dist/bundle-replay.js +273 -0
- package/dist/bundle-validate-html.d.ts +11 -0
- package/dist/bundle-validate-html.d.ts.map +1 -0
- package/dist/bundle-validate-html.js +60 -0
- package/dist/change-intent.d.ts +36 -0
- package/dist/change-intent.d.ts.map +1 -0
- package/dist/change-intent.js +259 -0
- package/dist/changed-preflight.d.ts +59 -0
- package/dist/changed-preflight.d.ts.map +1 -0
- package/dist/changed-preflight.js +358 -0
- package/dist/changed-scope.d.ts +112 -0
- package/dist/changed-scope.d.ts.map +1 -0
- package/dist/changed-scope.js +172 -0
- package/dist/changes-summary.d.ts +87 -0
- package/dist/changes-summary.d.ts.map +1 -0
- package/dist/changes-summary.js +323 -0
- package/dist/check-result-v1.d.ts +90 -0
- package/dist/check-result-v1.d.ts.map +1 -0
- package/dist/check-result-v1.js +335 -0
- package/dist/ci-integrity-report.d.ts +38 -0
- package/dist/ci-integrity-report.d.ts.map +1 -0
- package/dist/ci-integrity-report.js +324 -0
- package/dist/ci-permissions-fix.d.ts +38 -0
- package/dist/ci-permissions-fix.d.ts.map +1 -0
- package/dist/ci-permissions-fix.js +201 -0
- package/dist/ci-permissions.d.ts +51 -0
- package/dist/ci-permissions.d.ts.map +1 -0
- package/dist/ci-permissions.js +431 -0
- package/dist/ci-predict.d.ts +42 -0
- package/dist/ci-predict.d.ts.map +1 -0
- package/dist/ci-predict.js +300 -0
- package/dist/ci-scaffold.d.ts +47 -0
- package/dist/ci-scaffold.d.ts.map +1 -0
- package/dist/ci-scaffold.js +638 -0
- package/dist/codemod-assist.d.ts +97 -0
- package/dist/codemod-assist.d.ts.map +1 -0
- package/dist/codemod-assist.js +261 -0
- package/dist/command-recommender.d.ts +25 -0
- package/dist/command-recommender.d.ts.map +1 -0
- package/dist/command-recommender.js +145 -0
- package/dist/command-suggester.d.ts +61 -0
- package/dist/command-suggester.d.ts.map +1 -0
- package/dist/command-suggester.js +159 -0
- package/dist/command-taxonomy.d.ts +38 -0
- package/dist/command-taxonomy.d.ts.map +1 -0
- package/dist/command-taxonomy.js +164 -0
- package/dist/compliance-evidence.d.ts +58 -0
- package/dist/compliance-evidence.d.ts.map +1 -0
- package/dist/compliance-evidence.js +260 -0
- package/dist/compliance-profiles.d.ts +42 -0
- package/dist/compliance-profiles.d.ts.map +1 -0
- package/dist/compliance-profiles.js +171 -0
- package/dist/construct-adoption-diff.d.ts +55 -0
- package/dist/construct-adoption-diff.d.ts.map +1 -0
- package/dist/construct-adoption-diff.js +331 -0
- package/dist/construct-adoption.d.ts +71 -0
- package/dist/construct-adoption.d.ts.map +1 -0
- package/dist/construct-adoption.js +331 -0
- package/dist/construct-inference.d.ts +44 -0
- package/dist/construct-inference.d.ts.map +1 -0
- package/dist/construct-inference.js +391 -0
- package/dist/construct-registry.d.ts +32 -0
- package/dist/construct-registry.d.ts.map +1 -0
- package/dist/construct-registry.js +198 -0
- package/dist/contract-file-rule.d.ts +37 -0
- package/dist/contract-file-rule.d.ts.map +1 -0
- package/dist/contract-file-rule.js +99 -0
- package/dist/contract-template-registry.d.ts +28 -0
- package/dist/contract-template-registry.d.ts.map +1 -0
- package/dist/contract-template-registry.js +161 -0
- package/dist/contradictions.d.ts +52 -0
- package/dist/contradictions.d.ts.map +1 -0
- package/dist/contradictions.js +391 -0
- package/dist/convention-registry.d.ts +44 -0
- package/dist/convention-registry.d.ts.map +1 -0
- package/dist/convention-registry.js +195 -0
- package/dist/coverage-report.d.ts +25 -0
- package/dist/coverage-report.d.ts.map +1 -0
- package/dist/coverage-report.js +190 -0
- package/dist/custom-checks.d.ts +146 -0
- package/dist/custom-checks.d.ts.map +1 -0
- package/dist/custom-checks.js +260 -0
- package/dist/dashboard/dashboard-data.d.ts +59 -0
- package/dist/dashboard/dashboard-data.d.ts.map +1 -0
- package/dist/dashboard/dashboard-data.js +653 -0
- package/dist/dashboard-export.d.ts +67 -0
- package/dist/dashboard-export.d.ts.map +1 -0
- package/dist/dashboard-export.js +203 -0
- package/dist/decision-records.d.ts +47 -0
- package/dist/decision-records.d.ts.map +1 -0
- package/dist/decision-records.js +255 -0
- package/dist/demo-package.d.ts +49 -0
- package/dist/demo-package.d.ts.map +1 -0
- package/dist/demo-package.js +305 -0
- package/dist/demo-script.d.ts +25 -0
- package/dist/demo-script.d.ts.map +1 -0
- package/dist/demo-script.js +198 -0
- package/dist/demo-workflow.d.ts +28 -0
- package/dist/demo-workflow.d.ts.map +1 -0
- package/dist/demo-workflow.js +178 -0
- package/dist/dev-cycle.d.ts +41 -0
- package/dist/dev-cycle.d.ts.map +1 -0
- package/dist/dev-cycle.js +94 -0
- package/dist/dev-session-html.d.ts +13 -0
- package/dist/dev-session-html.d.ts.map +1 -0
- package/dist/dev-session-html.js +223 -0
- package/dist/dev-session-report.d.ts +11 -0
- package/dist/dev-session-report.d.ts.map +1 -0
- package/dist/dev-session-report.js +206 -0
- package/dist/dev-session.d.ts +257 -0
- package/dist/dev-session.d.ts.map +1 -0
- package/dist/dev-session.js +568 -0
- package/dist/diagnostics-suggest.d.ts +17 -0
- package/dist/diagnostics-suggest.d.ts.map +1 -0
- package/dist/diagnostics-suggest.js +69 -0
- package/dist/docs-check.d.ts +40 -0
- package/dist/docs-check.d.ts.map +1 -0
- package/dist/docs-check.js +221 -0
- package/dist/doctor-acknowledgements.d.ts +69 -0
- package/dist/doctor-acknowledgements.d.ts.map +1 -0
- package/dist/doctor-acknowledgements.js +150 -0
- package/dist/doctor-result.d.ts +51 -0
- package/dist/doctor-result.d.ts.map +1 -0
- package/dist/doctor-result.js +7 -0
- package/dist/doctor-suppressions.d.ts +91 -0
- package/dist/doctor-suppressions.d.ts.map +1 -0
- package/dist/doctor-suppressions.js +238 -0
- package/dist/drift-baseline.d.ts +29 -0
- package/dist/drift-baseline.d.ts.map +1 -0
- package/dist/drift-baseline.js +80 -0
- package/dist/drift.d.ts +38 -0
- package/dist/drift.d.ts.map +1 -0
- package/dist/drift.js +107 -0
- package/dist/entrypoint-matrix.d.ts +61 -0
- package/dist/entrypoint-matrix.d.ts.map +1 -0
- package/dist/entrypoint-matrix.js +221 -0
- package/dist/examples-check.d.ts +36 -0
- package/dist/examples-check.d.ts.map +1 -0
- package/dist/examples-check.js +168 -0
- package/dist/execution-graph.d.ts +98 -0
- package/dist/execution-graph.d.ts.map +1 -0
- package/dist/execution-graph.js +484 -0
- package/dist/export-bundle.d.ts +10 -0
- package/dist/export-bundle.d.ts.map +1 -0
- package/dist/export-bundle.js +90 -0
- package/dist/failure-diagnostics.d.ts +63 -0
- package/dist/failure-diagnostics.d.ts.map +1 -0
- package/dist/failure-diagnostics.js +243 -0
- package/dist/feature-bundle.d.ts +111 -0
- package/dist/feature-bundle.d.ts.map +1 -0
- package/dist/feature-bundle.js +211 -0
- package/dist/feedback-actions-v2.d.ts +65 -0
- package/dist/feedback-actions-v2.d.ts.map +1 -0
- package/dist/feedback-actions-v2.js +183 -0
- package/dist/feedback-ingestion.d.ts +96 -0
- package/dist/feedback-ingestion.d.ts.map +1 -0
- package/dist/feedback-ingestion.js +400 -0
- package/dist/fix-preview.d.ts +82 -0
- package/dist/fix-preview.d.ts.map +1 -0
- package/dist/fix-preview.js +365 -0
- package/dist/fuzzy-impact.d.ts +50 -0
- package/dist/fuzzy-impact.d.ts.map +1 -0
- package/dist/fuzzy-impact.js +446 -0
- package/dist/generated-code.d.ts +97 -0
- package/dist/generated-code.d.ts.map +1 -0
- package/dist/generated-code.js +395 -0
- package/dist/git-helpers.d.ts +26 -0
- package/dist/git-helpers.d.ts.map +1 -0
- package/dist/git-helpers.js +110 -0
- package/dist/golden-output.d.ts +33 -0
- package/dist/golden-output.d.ts.map +1 -0
- package/dist/golden-output.js +92 -0
- package/dist/grounding/build-grounding.d.ts +53 -0
- package/dist/grounding/build-grounding.d.ts.map +1 -0
- package/dist/grounding/build-grounding.js +51 -0
- package/dist/grounding/nx-projects.d.ts +29 -0
- package/dist/grounding/nx-projects.d.ts.map +1 -0
- package/dist/grounding/nx-projects.js +109 -0
- package/dist/grounding/validate-extracted-plan.d.ts +20 -0
- package/dist/grounding/validate-extracted-plan.d.ts.map +1 -0
- package/dist/grounding/validate-extracted-plan.js +127 -0
- package/dist/healing-plan.d.ts +33 -0
- package/dist/healing-plan.d.ts.map +1 -0
- package/dist/healing-plan.js +346 -0
- package/dist/helper-registry.d.ts +90 -0
- package/dist/helper-registry.d.ts.map +1 -0
- package/dist/helper-registry.js +529 -0
- package/dist/impact-analysis.d.ts +150 -0
- package/dist/impact-analysis.d.ts.map +1 -0
- package/dist/impact-analysis.js +697 -0
- package/dist/impact-graph-render.d.ts +51 -0
- package/dist/impact-graph-render.d.ts.map +1 -0
- package/dist/impact-graph-render.js +139 -0
- package/dist/impact-graph.d.ts +17 -0
- package/dist/impact-graph.d.ts.map +1 -0
- package/dist/impact-graph.js +119 -0
- package/dist/impact-render.d.ts +22 -0
- package/dist/impact-render.d.ts.map +1 -0
- package/dist/impact-render.js +413 -0
- package/dist/import-graph-analysis.d.ts +28 -0
- package/dist/import-graph-analysis.d.ts.map +1 -0
- package/dist/import-graph-analysis.js +193 -0
- package/dist/import-hygiene.d.ts +93 -0
- package/dist/import-hygiene.d.ts.map +1 -0
- package/dist/import-hygiene.js +366 -0
- package/dist/index.d.ts +223 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +233 -0
- package/dist/ingest-adoption.d.ts +50 -0
- package/dist/ingest-adoption.d.ts.map +1 -0
- package/dist/ingest-adoption.js +183 -0
- package/dist/ingest-apply.d.ts +80 -0
- package/dist/ingest-apply.d.ts.map +1 -0
- package/dist/ingest-apply.js +227 -0
- package/dist/ingest-body-extractor.d.ts +28 -0
- package/dist/ingest-body-extractor.d.ts.map +1 -0
- package/dist/ingest-body-extractor.js +129 -0
- package/dist/ingest-drafts.d.ts +16 -0
- package/dist/ingest-drafts.d.ts.map +1 -0
- package/dist/ingest-drafts.js +482 -0
- package/dist/inspector-cache.d.ts +41 -0
- package/dist/inspector-cache.d.ts.map +1 -0
- package/dist/inspector-cache.js +104 -0
- package/dist/install-smoke.d.ts +44 -0
- package/dist/install-smoke.d.ts.map +1 -0
- package/dist/install-smoke.js +31 -0
- package/dist/knowledge-authoring.d.ts +151 -0
- package/dist/knowledge-authoring.d.ts.map +1 -0
- package/dist/knowledge-authoring.js +586 -0
- package/dist/knowledge-graph.d.ts +76 -0
- package/dist/knowledge-graph.d.ts.map +1 -0
- package/dist/knowledge-graph.js +336 -0
- package/dist/knowledge-lint.d.ts +97 -0
- package/dist/knowledge-lint.d.ts.map +1 -0
- package/dist/knowledge-lint.js +302 -0
- package/dist/knowledge-rename.d.ts +38 -0
- package/dist/knowledge-rename.d.ts.map +1 -0
- package/dist/knowledge-rename.js +88 -0
- package/dist/knowledge-stale.d.ts +124 -0
- package/dist/knowledge-stale.d.ts.map +1 -0
- package/dist/knowledge-stale.js +892 -0
- package/dist/languages/command-inference.d.ts +27 -0
- package/dist/languages/command-inference.d.ts.map +1 -0
- package/dist/languages/command-inference.js +214 -0
- package/dist/languages/dependency-scan.d.ts +33 -0
- package/dist/languages/dependency-scan.d.ts.map +1 -0
- package/dist/languages/dependency-scan.js +343 -0
- package/dist/languages/index.d.ts +14 -0
- package/dist/languages/index.d.ts.map +1 -0
- package/dist/languages/index.js +13 -0
- package/dist/languages/language-boundaries.d.ts +30 -0
- package/dist/languages/language-boundaries.d.ts.map +1 -0
- package/dist/languages/language-boundaries.js +176 -0
- package/dist/languages/language-cache.d.ts +54 -0
- package/dist/languages/language-cache.d.ts.map +1 -0
- package/dist/languages/language-cache.js +236 -0
- package/dist/languages/language-detection.d.ts +30 -0
- package/dist/languages/language-detection.d.ts.map +1 -0
- package/dist/languages/language-detection.js +584 -0
- package/dist/languages/language-id.d.ts +15 -0
- package/dist/languages/language-id.d.ts.map +1 -0
- package/dist/languages/language-id.js +15 -0
- package/dist/languages/language-runner.d.ts +90 -0
- package/dist/languages/language-runner.d.ts.map +1 -0
- package/dist/languages/language-runner.js +346 -0
- package/dist/languages/polyglot-boundary.d.ts +80 -0
- package/dist/languages/polyglot-boundary.d.ts.map +1 -0
- package/dist/languages/polyglot-boundary.js +373 -0
- package/dist/languages/polyglot-ci.d.ts +25 -0
- package/dist/languages/polyglot-ci.d.ts.map +1 -0
- package/dist/languages/polyglot-ci.js +278 -0
- package/dist/languages/test-impact.d.ts +19 -0
- package/dist/languages/test-impact.d.ts.map +1 -0
- package/dist/languages/test-impact.js +157 -0
- package/dist/loader-diagnostics.d.ts +40 -0
- package/dist/loader-diagnostics.d.ts.map +1 -0
- package/dist/loader-diagnostics.js +49 -0
- package/dist/memory-diff.d.ts +60 -0
- package/dist/memory-diff.d.ts.map +1 -0
- package/dist/memory-diff.js +302 -0
- package/dist/migration-profile-registry.d.ts +26 -0
- package/dist/migration-profile-registry.d.ts.map +1 -0
- package/dist/migration-profile-registry.js +135 -0
- package/dist/migration-readiness.d.ts +101 -0
- package/dist/migration-readiness.d.ts.map +1 -0
- package/dist/migration-readiness.js +253 -0
- package/dist/monorepo-onboarding.d.ts +51 -0
- package/dist/monorepo-onboarding.d.ts.map +1 -0
- package/dist/monorepo-onboarding.js +235 -0
- package/dist/onboarding-adoption-diff.d.ts +53 -0
- package/dist/onboarding-adoption-diff.d.ts.map +1 -0
- package/dist/onboarding-adoption-diff.js +285 -0
- package/dist/onboarding-adoption.d.ts +136 -0
- package/dist/onboarding-adoption.d.ts.map +1 -0
- package/dist/onboarding-adoption.js +702 -0
- package/dist/onboarding-agent-import.d.ts +40 -0
- package/dist/onboarding-agent-import.d.ts.map +1 -0
- package/dist/onboarding-agent-import.js +114 -0
- package/dist/onboarding-diff.d.ts +39 -0
- package/dist/onboarding-diff.d.ts.map +1 -0
- package/dist/onboarding-diff.js +240 -0
- package/dist/onboarding-drafts.d.ts +28 -0
- package/dist/onboarding-drafts.d.ts.map +1 -0
- package/dist/onboarding-drafts.js +234 -0
- package/dist/onboarding-report.d.ts +8 -0
- package/dist/onboarding-report.d.ts.map +1 -0
- package/dist/onboarding-report.js +239 -0
- package/dist/onboarding.d.ts +134 -0
- package/dist/onboarding.d.ts.map +1 -0
- package/dist/onboarding.js +729 -0
- package/dist/ownership.d.ts +38 -0
- package/dist/ownership.d.ts.map +1 -0
- package/dist/ownership.js +102 -0
- package/dist/pack-author-ux.d.ts +58 -0
- package/dist/pack-author-ux.d.ts.map +1 -0
- package/dist/pack-author-ux.js +219 -0
- package/dist/pack-author.d.ts +94 -0
- package/dist/pack-author.d.ts.map +1 -0
- package/dist/pack-author.js +208 -0
- package/dist/pack-compatibility.d.ts +21 -0
- package/dist/pack-compatibility.d.ts.map +1 -0
- package/dist/pack-compatibility.js +114 -0
- package/dist/pack-contributions-inventory.d.ts +121 -0
- package/dist/pack-contributions-inventory.d.ts.map +1 -0
- package/dist/pack-contributions-inventory.js +732 -0
- package/dist/pack-docs.d.ts +11 -0
- package/dist/pack-docs.d.ts.map +1 -0
- package/dist/pack-docs.js +101 -0
- package/dist/pack-doctor.d.ts +50 -0
- package/dist/pack-doctor.d.ts.map +1 -0
- package/dist/pack-doctor.js +302 -0
- package/dist/pack-helper-registry.d.ts +29 -0
- package/dist/pack-helper-registry.d.ts.map +1 -0
- package/dist/pack-helper-registry.js +144 -0
- package/dist/pack-pending.d.ts +68 -0
- package/dist/pack-pending.d.ts.map +1 -0
- package/dist/pack-pending.js +189 -0
- package/dist/pack-quality-score.d.ts +44 -0
- package/dist/pack-quality-score.d.ts.map +1 -0
- package/dist/pack-quality-score.js +155 -0
- package/dist/pack-release-check.d.ts +24 -0
- package/dist/pack-release-check.d.ts.map +1 -0
- package/dist/pack-release-check.js +258 -0
- package/dist/pack-signature-status.d.ts +72 -0
- package/dist/pack-signature-status.d.ts.map +1 -0
- package/dist/pack-signature-status.js +222 -0
- package/dist/pack-symbol-compat.d.ts +60 -0
- package/dist/pack-symbol-compat.d.ts.map +1 -0
- package/dist/pack-symbol-compat.js +371 -0
- package/dist/pack-test-runner.d.ts +59 -0
- package/dist/pack-test-runner.d.ts.map +1 -0
- package/dist/pack-test-runner.js +211 -0
- package/dist/pipeline-command-dictionary.d.ts +2 -0
- package/dist/pipeline-command-dictionary.d.ts.map +1 -0
- package/dist/pipeline-command-dictionary.js +20 -0
- package/dist/pipeline-lint.d.ts +30 -0
- package/dist/pipeline-lint.d.ts.map +1 -0
- package/dist/pipeline-lint.js +134 -0
- package/dist/plan-dependency-graph.d.ts +25 -0
- package/dist/plan-dependency-graph.d.ts.map +1 -0
- package/dist/plan-dependency-graph.js +195 -0
- package/dist/plan-review.d.ts +64 -0
- package/dist/plan-review.d.ts.map +1 -0
- package/dist/plan-review.js +242 -0
- package/dist/plan-simulation.d.ts +108 -0
- package/dist/plan-simulation.d.ts.map +1 -0
- package/dist/plan-simulation.js +767 -0
- package/dist/playbook-registry.d.ts +25 -0
- package/dist/playbook-registry.d.ts.map +1 -0
- package/dist/playbook-registry.js +148 -0
- package/dist/playbook-script.d.ts +60 -0
- package/dist/playbook-script.d.ts.map +1 -0
- package/dist/playbook-script.js +161 -0
- package/dist/plugin-lifecycle-profile-registry.d.ts +52 -0
- package/dist/plugin-lifecycle-profile-registry.d.ts.map +1 -0
- package/dist/plugin-lifecycle-profile-registry.js +202 -0
- package/dist/plugin-lifecycle.d.ts +132 -0
- package/dist/plugin-lifecycle.d.ts.map +1 -0
- package/dist/plugin-lifecycle.js +477 -0
- package/dist/policy-engine.d.ts +101 -0
- package/dist/policy-engine.d.ts.map +1 -0
- package/dist/policy-engine.js +321 -0
- package/dist/policy-override-audit.d.ts +18 -0
- package/dist/policy-override-audit.d.ts.map +1 -0
- package/dist/policy-override-audit.js +54 -0
- package/dist/policy-overrides.d.ts +35 -0
- package/dist/policy-overrides.d.ts.map +1 -0
- package/dist/policy-overrides.js +84 -0
- package/dist/policy-test.d.ts +83 -0
- package/dist/policy-test.d.ts.map +1 -0
- package/dist/policy-test.js +342 -0
- package/dist/pr-summary.d.ts +34 -0
- package/dist/pr-summary.d.ts.map +1 -0
- package/dist/pr-summary.js +220 -0
- package/dist/product-coherence.d.ts +21 -0
- package/dist/product-coherence.d.ts.map +1 -0
- package/dist/product-coherence.js +158 -0
- package/dist/profile-registry.d.ts +42 -0
- package/dist/profile-registry.d.ts.map +1 -0
- package/dist/profile-registry.js +104 -0
- package/dist/project-coupling-audit.d.ts +64 -0
- package/dist/project-coupling-audit.d.ts.map +1 -0
- package/dist/project-coupling-audit.js +282 -0
- package/dist/project-overview.d.ts +14 -0
- package/dist/project-overview.d.ts.map +1 -0
- package/dist/project-overview.js +27 -0
- package/dist/propose-knowledge.d.ts +64 -0
- package/dist/propose-knowledge.d.ts.map +1 -0
- package/dist/propose-knowledge.js +367 -0
- package/dist/quality-baseline.d.ts +123 -0
- package/dist/quality-baseline.d.ts.map +1 -0
- package/dist/quality-baseline.js +433 -0
- package/dist/quality-html.d.ts +7 -0
- package/dist/quality-html.d.ts.map +1 -0
- package/dist/quality-html.js +64 -0
- package/dist/quality-report.d.ts +49 -0
- package/dist/quality-report.d.ts.map +1 -0
- package/dist/quality-report.js +296 -0
- package/dist/query-resolver.d.ts +38 -0
- package/dist/query-resolver.d.ts.map +1 -0
- package/dist/query-resolver.js +163 -0
- package/dist/ranker-explainability.d.ts +91 -0
- package/dist/ranker-explainability.d.ts.map +1 -0
- package/dist/ranker-explainability.js +550 -0
- package/dist/reference-lookup.d.ts +8 -0
- package/dist/reference-lookup.d.ts.map +1 -0
- package/dist/reference-lookup.js +18 -0
- package/dist/registration-hint-registry.d.ts +55 -0
- package/dist/registration-hint-registry.d.ts.map +1 -0
- package/dist/registration-hint-registry.js +327 -0
- package/dist/registry-lifecycle.d.ts +47 -0
- package/dist/registry-lifecycle.d.ts.map +1 -0
- package/dist/registry-lifecycle.js +214 -0
- package/dist/release-readiness.d.ts +64 -0
- package/dist/release-readiness.d.ts.map +1 -0
- package/dist/release-readiness.js +456 -0
- package/dist/release-smoke.d.ts +138 -0
- package/dist/release-smoke.d.ts.map +1 -0
- package/dist/release-smoke.js +459 -0
- package/dist/release-train.d.ts +33 -0
- package/dist/release-train.d.ts.map +1 -0
- package/dist/release-train.js +104 -0
- package/dist/repo-memory.d.ts +95 -0
- package/dist/repo-memory.d.ts.map +1 -0
- package/dist/repo-memory.js +614 -0
- package/dist/report-site.d.ts +92 -0
- package/dist/report-site.d.ts.map +1 -0
- package/dist/report-site.js +658 -0
- package/dist/reposet.d.ts +56 -0
- package/dist/reposet.d.ts.map +1 -0
- package/dist/reposet.js +160 -0
- package/dist/repository-intelligence.d.ts +145 -0
- package/dist/repository-intelligence.d.ts.map +1 -0
- package/dist/repository-intelligence.js +729 -0
- package/dist/repository-knowledge-model.d.ts +218 -0
- package/dist/repository-knowledge-model.d.ts.map +1 -0
- package/dist/repository-knowledge-model.js +939 -0
- package/dist/repository-map.d.ts +72 -0
- package/dist/repository-map.d.ts.map +1 -0
- package/dist/repository-map.js +332 -0
- package/dist/repository-stats.d.ts +66 -0
- package/dist/repository-stats.d.ts.map +1 -0
- package/dist/repository-stats.js +329 -0
- package/dist/review-comment-renderer.d.ts +59 -0
- package/dist/review-comment-renderer.d.ts.map +1 -0
- package/dist/review-comment-renderer.js +181 -0
- package/dist/review-comment-v2.d.ts +9 -0
- package/dist/review-comment-v2.d.ts.map +1 -0
- package/dist/review-comment-v2.js +178 -0
- package/dist/review-html.d.ts +13 -0
- package/dist/review-html.d.ts.map +1 -0
- package/dist/review-html.js +79 -0
- package/dist/review-packet-v2.d.ts +29 -0
- package/dist/review-packet-v2.d.ts.map +1 -0
- package/dist/review-packet-v2.js +71 -0
- package/dist/review-packet-v3.d.ts +22 -0
- package/dist/review-packet-v3.d.ts.map +1 -0
- package/dist/review-packet-v3.js +181 -0
- package/dist/review-packet.d.ts +49 -0
- package/dist/review-packet.d.ts.map +1 -0
- package/dist/review-packet.js +129 -0
- package/dist/risk-signals.d.ts +28 -0
- package/dist/risk-signals.d.ts.map +1 -0
- package/dist/risk-signals.js +68 -0
- package/dist/role-views.d.ts +50 -0
- package/dist/role-views.d.ts.map +1 -0
- package/dist/role-views.js +334 -0
- package/dist/rounds.d.ts +52 -0
- package/dist/rounds.d.ts.map +1 -0
- package/dist/rounds.js +172 -0
- package/dist/rule-drift.d.ts +42 -0
- package/dist/rule-drift.d.ts.map +1 -0
- package/dist/rule-drift.js +148 -0
- package/dist/rule-quality.d.ts +73 -0
- package/dist/rule-quality.d.ts.map +1 -0
- package/dist/rule-quality.js +356 -0
- package/dist/rule-scaffold.d.ts +71 -0
- package/dist/rule-scaffold.d.ts.map +1 -0
- package/dist/rule-scaffold.js +258 -0
- package/dist/safety-audit-deep.d.ts +38 -0
- package/dist/safety-audit-deep.d.ts.map +1 -0
- package/dist/safety-audit-deep.js +162 -0
- package/dist/safety-audit.d.ts +91 -0
- package/dist/safety-audit.d.ts.map +1 -0
- package/dist/safety-audit.js +138 -0
- package/dist/safety-html.d.ts +7 -0
- package/dist/safety-html.d.ts.map +1 -0
- package/dist/safety-html.js +70 -0
- package/dist/scaffold-coverage.d.ts +46 -0
- package/dist/scaffold-coverage.d.ts.map +1 -0
- package/dist/scaffold-coverage.js +273 -0
- package/dist/scaffold-patterns.d.ts +38 -0
- package/dist/scaffold-patterns.d.ts.map +1 -0
- package/dist/scaffold-patterns.js +282 -0
- package/dist/schema-inventory.d.ts +55 -0
- package/dist/schema-inventory.d.ts.map +1 -0
- package/dist/schema-inventory.js +301 -0
- package/dist/search-index.d.ts +75 -0
- package/dist/search-index.d.ts.map +1 -0
- package/dist/search-index.js +531 -0
- package/dist/search-tuning-explain.d.ts +68 -0
- package/dist/search-tuning-explain.d.ts.map +1 -0
- package/dist/search-tuning-explain.js +207 -0
- package/dist/search-tuning-registry.d.ts +54 -0
- package/dist/search-tuning-registry.d.ts.map +1 -0
- package/dist/search-tuning-registry.js +303 -0
- package/dist/self-audit.d.ts +59 -0
- package/dist/self-audit.d.ts.map +1 -0
- package/dist/self-audit.js +192 -0
- package/dist/self-config-doctor-v2.d.ts +57 -0
- package/dist/self-config-doctor-v2.d.ts.map +1 -0
- package/dist/self-config-doctor-v2.js +653 -0
- package/dist/self-config-doctor.d.ts +47 -0
- package/dist/self-config-doctor.d.ts.map +1 -0
- package/dist/self-config-doctor.js +432 -0
- package/dist/sharkcraft-inspector.d.ts +73 -0
- package/dist/sharkcraft-inspector.d.ts.map +1 -0
- package/dist/sharkcraft-inspector.js +745 -0
- package/dist/spec/spec-cross-validate.d.ts +17 -0
- package/dist/spec/spec-cross-validate.d.ts.map +1 -0
- package/dist/spec/spec-cross-validate.js +53 -0
- package/dist/spec/spec-discovery.d.ts +27 -0
- package/dist/spec/spec-discovery.d.ts.map +1 -0
- package/dist/spec/spec-discovery.js +78 -0
- package/dist/spec/spec-review.d.ts +36 -0
- package/dist/spec/spec-review.d.ts.map +1 -0
- package/dist/spec/spec-review.js +37 -0
- package/dist/stability-map.d.ts +62 -0
- package/dist/stability-map.d.ts.map +1 -0
- package/dist/stability-map.js +404 -0
- package/dist/start-here.d.ts +49 -0
- package/dist/start-here.d.ts.map +1 -0
- package/dist/start-here.js +259 -0
- package/dist/surface-profile-detect.d.ts +42 -0
- package/dist/surface-profile-detect.d.ts.map +1 -0
- package/dist/surface-profile-detect.js +76 -0
- package/dist/symbol-index.d.ts +108 -0
- package/dist/symbol-index.d.ts.map +1 -0
- package/dist/symbol-index.js +483 -0
- package/dist/task-decompose.d.ts +38 -0
- package/dist/task-decompose.d.ts.map +1 -0
- package/dist/task-decompose.js +154 -0
- package/dist/task-packet.d.ts +104 -0
- package/dist/task-packet.d.ts.map +1 -0
- package/dist/task-packet.js +156 -0
- package/dist/task-ranker.d.ts +51 -0
- package/dist/task-ranker.d.ts.map +1 -0
- package/dist/task-ranker.js +410 -0
- package/dist/task-risk.d.ts +84 -0
- package/dist/task-risk.d.ts.map +1 -0
- package/dist/task-risk.js +731 -0
- package/dist/task-routing-hint-registry.d.ts +36 -0
- package/dist/task-routing-hint-registry.d.ts.map +1 -0
- package/dist/task-routing-hint-registry.js +186 -0
- package/dist/template-authoring.d.ts +113 -0
- package/dist/template-authoring.d.ts.map +1 -0
- package/dist/template-authoring.js +521 -0
- package/dist/template-body-inference-v2.d.ts +19 -0
- package/dist/template-body-inference-v2.d.ts.map +1 -0
- package/dist/template-body-inference-v2.js +468 -0
- package/dist/template-body-inference.d.ts +59 -0
- package/dist/template-body-inference.d.ts.map +1 -0
- package/dist/template-body-inference.js +277 -0
- package/dist/template-drift.d.ts +39 -0
- package/dist/template-drift.d.ts.map +1 -0
- package/dist/template-drift.js +353 -0
- package/dist/template-lint.d.ts +31 -0
- package/dist/template-lint.d.ts.map +1 -0
- package/dist/template-lint.js +113 -0
- package/dist/test-definitions.d.ts +41 -0
- package/dist/test-definitions.d.ts.map +1 -0
- package/dist/test-definitions.js +6 -0
- package/dist/test-impact.d.ts +30 -0
- package/dist/test-impact.d.ts.map +1 -0
- package/dist/test-impact.js +173 -0
- package/dist/test-runner.d.ts +87 -0
- package/dist/test-runner.d.ts.map +1 -0
- package/dist/test-runner.js +560 -0
- package/dist/uncertainty-report.d.ts +46 -0
- package/dist/uncertainty-report.d.ts.map +1 -0
- package/dist/uncertainty-report.js +108 -0
- package/dist/uncertainty.d.ts +38 -0
- package/dist/uncertainty.d.ts.map +1 -0
- package/dist/uncertainty.js +115 -0
- package/dist/universal-search.d.ts +64 -0
- package/dist/universal-search.d.ts.map +1 -0
- package/dist/universal-search.js +347 -0
- package/dist/upgrade-advisor.d.ts +22 -0
- package/dist/upgrade-advisor.d.ts.map +1 -0
- package/dist/upgrade-advisor.js +109 -0
- package/dist/why-file.d.ts +75 -0
- package/dist/why-file.d.ts.map +1 -0
- package/dist/why-file.js +202 -0
- package/dist/workflow-simulation.d.ts +46 -0
- package/dist/workflow-simulation.d.ts.map +1 -0
- package/dist/workflow-simulation.js +154 -0
- package/package.json +66 -0
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace-aware "explore this directory".
|
|
3
|
+
*
|
|
4
|
+
* Answers "explain this *specific* directory" with one deterministic
|
|
5
|
+
* call. Built on top of `buildAreaMap` (whole-repo) and the registries
|
|
6
|
+
* already in `ISharkcraftInspection`.
|
|
7
|
+
*
|
|
8
|
+
* Output:
|
|
9
|
+
* - inferred area kind + role,
|
|
10
|
+
* - key modules (largest / construct-defining),
|
|
11
|
+
* - related commands (from the command catalog the caller injects),
|
|
12
|
+
* - related MCP tools (id proximity to area name),
|
|
13
|
+
* - tests under the dir,
|
|
14
|
+
* - boundary rules / path conventions that mention the dir,
|
|
15
|
+
* - common edit risks (generated files, signed/sensitive files,
|
|
16
|
+
* dist/ subdir, etc.).
|
|
17
|
+
*
|
|
18
|
+
* Pure-data; no execution.
|
|
19
|
+
*/
|
|
20
|
+
import { existsSync, readdirSync, statSync } from 'node:fs';
|
|
21
|
+
import * as nodePath from 'node:path';
|
|
22
|
+
import { AreaKind, buildAreaMap } from "./area-map.js";
|
|
23
|
+
export const AREA_EXPLORE_SCHEMA = 'sharkcraft.area-explore/v1';
|
|
24
|
+
const IGNORE_DIRS = new Set([
|
|
25
|
+
'node_modules',
|
|
26
|
+
'.git',
|
|
27
|
+
'.sharkcraft',
|
|
28
|
+
'dist',
|
|
29
|
+
'build',
|
|
30
|
+
'.cache',
|
|
31
|
+
'.turbo',
|
|
32
|
+
'.nx',
|
|
33
|
+
'coverage',
|
|
34
|
+
'.next',
|
|
35
|
+
]);
|
|
36
|
+
function classifyFileKind(file) {
|
|
37
|
+
if (/\.(test|spec)\.[tj]sx?$/.test(file) || file.includes('/__tests__/'))
|
|
38
|
+
return 'test';
|
|
39
|
+
if (/\.md$/.test(file))
|
|
40
|
+
return 'doc';
|
|
41
|
+
if (/\/dist\/|\.d\.ts$|\.map$|\/generated\//.test(file))
|
|
42
|
+
return 'generated';
|
|
43
|
+
if (/^(package\.json|tsconfig\.json|tsconfig\.[a-z]+\.json|\.eslintrc|\.prettierrc|\.editorconfig|bun\.lockb)$/.test(file.split('/').pop() ?? ''))
|
|
44
|
+
return 'config';
|
|
45
|
+
if (/\.(ts|tsx|js|jsx|mjs|cjs|json)$/.test(file))
|
|
46
|
+
return 'source';
|
|
47
|
+
return 'other';
|
|
48
|
+
}
|
|
49
|
+
function walkLimited(root, base, maxFiles = 4000) {
|
|
50
|
+
const out = [];
|
|
51
|
+
const stack = [base];
|
|
52
|
+
while (stack.length > 0 && out.length < maxFiles) {
|
|
53
|
+
const rel = stack.pop();
|
|
54
|
+
const abs = nodePath.join(root, rel);
|
|
55
|
+
let entries;
|
|
56
|
+
try {
|
|
57
|
+
entries = readdirSync(abs);
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
for (const name of entries) {
|
|
63
|
+
if (name.startsWith('.') && !['.github', '.gitlab'].includes(name))
|
|
64
|
+
continue;
|
|
65
|
+
if (IGNORE_DIRS.has(name))
|
|
66
|
+
continue;
|
|
67
|
+
const childRel = rel ? `${rel}/${name}` : name;
|
|
68
|
+
const childAbs = nodePath.join(root, childRel);
|
|
69
|
+
let stat;
|
|
70
|
+
try {
|
|
71
|
+
stat = statSync(childAbs);
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if (stat.isDirectory()) {
|
|
77
|
+
stack.push(childRel);
|
|
78
|
+
}
|
|
79
|
+
else if (stat.isFile()) {
|
|
80
|
+
out.push(childRel);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return out;
|
|
85
|
+
}
|
|
86
|
+
function inferKindForPath(relPath, areaMap) {
|
|
87
|
+
for (const a of areaMap.areas) {
|
|
88
|
+
if (a.paths.some((p) => relPath === p || relPath.startsWith(p + '/')))
|
|
89
|
+
return a.kind;
|
|
90
|
+
}
|
|
91
|
+
// fallback heuristics: match against AreaPatterns through area-map
|
|
92
|
+
if (/^packages\//.test(relPath) || /^apps\//.test(relPath)) {
|
|
93
|
+
if (/\/__tests__\//.test(relPath))
|
|
94
|
+
return AreaKind.Tests;
|
|
95
|
+
}
|
|
96
|
+
return AreaKind.Unknown;
|
|
97
|
+
}
|
|
98
|
+
function describeRole(relPath, kind) {
|
|
99
|
+
const segs = relPath.split('/');
|
|
100
|
+
if (relPath.startsWith('packages/cli/src/commands')) {
|
|
101
|
+
return 'CLI command handlers (one .command.ts per shrk subcommand).';
|
|
102
|
+
}
|
|
103
|
+
if (relPath.startsWith('packages/mcp-server/src/tools')) {
|
|
104
|
+
return 'MCP read-only tools (must never write).';
|
|
105
|
+
}
|
|
106
|
+
if (/^packages\/[a-z-]+\/src\/__tests__/.test(relPath)) {
|
|
107
|
+
return 'Unit tests for the parent package.';
|
|
108
|
+
}
|
|
109
|
+
if (/^packages\/[a-z-]+\/src$/.test(relPath)) {
|
|
110
|
+
return `Source root for package ${segs[1]}.`;
|
|
111
|
+
}
|
|
112
|
+
if (relPath === 'docs' || relPath.startsWith('docs/')) {
|
|
113
|
+
return 'Authoritative docs (per-feature; cross-linked from docs/overview.md).';
|
|
114
|
+
}
|
|
115
|
+
if (relPath === 'sharkcraft' || relPath.startsWith('sharkcraft/')) {
|
|
116
|
+
return 'Local SharkCraft registries (rules / paths / templates / pipelines / config).';
|
|
117
|
+
}
|
|
118
|
+
if (relPath === 'scripts' || relPath.startsWith('scripts/')) {
|
|
119
|
+
return 'Repo-level shell/TS scripts (release, publish, preflight).';
|
|
120
|
+
}
|
|
121
|
+
if (relPath.startsWith('examples/')) {
|
|
122
|
+
return 'Dogfood / fixture target packages.';
|
|
123
|
+
}
|
|
124
|
+
switch (kind) {
|
|
125
|
+
case AreaKind.Core:
|
|
126
|
+
return 'Core building blocks (Result, errors, ids) — lowest in the layer order.';
|
|
127
|
+
case AreaKind.Tests:
|
|
128
|
+
return 'Tests.';
|
|
129
|
+
case AreaKind.Docs:
|
|
130
|
+
return 'Documentation.';
|
|
131
|
+
case AreaKind.Generated:
|
|
132
|
+
return 'Generated output — do not hand-edit.';
|
|
133
|
+
case AreaKind.Adapter:
|
|
134
|
+
return 'Framework / runtime adapter glue.';
|
|
135
|
+
case AreaKind.Plugin:
|
|
136
|
+
return 'Plugin / pack code.';
|
|
137
|
+
default:
|
|
138
|
+
return `${kind} area.`;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
function detectRisks(opts) {
|
|
142
|
+
const risks = [];
|
|
143
|
+
const hasTests = opts.files.some((f) => f.kind === 'test');
|
|
144
|
+
const hasGenerated = opts.files.some((f) => f.kind === 'generated');
|
|
145
|
+
if (opts.relPath.startsWith('packages/mcp-server/src/tools')) {
|
|
146
|
+
risks.push({
|
|
147
|
+
kind: 'mcp-tool-dir',
|
|
148
|
+
severity: 'warning',
|
|
149
|
+
message: 'MCP tools must remain read-only — never add file writes. Returning a next-command hint is fine.',
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
if (opts.relPath.startsWith('packages/cli/src/commands') ||
|
|
153
|
+
opts.relPath.startsWith('packages/generator/src')) {
|
|
154
|
+
risks.push({
|
|
155
|
+
kind: 'cli-write-path',
|
|
156
|
+
severity: 'info',
|
|
157
|
+
message: 'CLI is the only write path. Apply requires --verify-signature on signed plans; do not weaken this.',
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
if (opts.relPath.startsWith('packages/packs/')) {
|
|
161
|
+
risks.push({
|
|
162
|
+
kind: 'signed-asset',
|
|
163
|
+
severity: 'warning',
|
|
164
|
+
message: 'Pack manifests are HMAC-signed. Re-sign with `shrk packs sign` after changing pack assets.',
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
if (/sharkcraft-pack|sharkcraft\/pack/.test(opts.relPath)) {
|
|
168
|
+
risks.push({
|
|
169
|
+
kind: 'pack-contribution',
|
|
170
|
+
severity: 'info',
|
|
171
|
+
message: 'Pack-contributed assets must not introduce project-specific logic into the engine — keep the adapter/pack boundary clean.',
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
if (hasGenerated) {
|
|
175
|
+
risks.push({
|
|
176
|
+
kind: 'generated-files',
|
|
177
|
+
severity: 'info',
|
|
178
|
+
message: 'Contains generated files (dist/ / .d.ts / .map) — do not hand-edit; rebuild via `bun run build:dist`.',
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
if (!hasTests &&
|
|
182
|
+
opts.files.length > 5 &&
|
|
183
|
+
opts.relPath.startsWith('packages/') &&
|
|
184
|
+
!opts.relPath.startsWith('packages/shared')) {
|
|
185
|
+
risks.push({
|
|
186
|
+
kind: 'no-tests',
|
|
187
|
+
severity: 'warning',
|
|
188
|
+
message: 'No tests detected in this directory — add one before extending public surface.',
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
return risks;
|
|
192
|
+
}
|
|
193
|
+
function commandRelevance(command, area) {
|
|
194
|
+
const tokens = area.toLowerCase().split(/[/\-_.]/).filter((t) => t.length >= 3);
|
|
195
|
+
let score = 0;
|
|
196
|
+
for (const t of tokens) {
|
|
197
|
+
if (command.toLowerCase().includes(t))
|
|
198
|
+
score += 1;
|
|
199
|
+
}
|
|
200
|
+
return score;
|
|
201
|
+
}
|
|
202
|
+
export function exploreArea(input) {
|
|
203
|
+
const root = input.inspection.projectRoot;
|
|
204
|
+
const rawPath = input.path;
|
|
205
|
+
const absPath = nodePath.isAbsolute(rawPath) ? rawPath : nodePath.resolve(root, rawPath);
|
|
206
|
+
const relPath = nodePath.relative(root, absPath).split(nodePath.sep).join('/');
|
|
207
|
+
const exists = existsSync(absPath);
|
|
208
|
+
if (!exists) {
|
|
209
|
+
return {
|
|
210
|
+
schema: AREA_EXPLORE_SCHEMA,
|
|
211
|
+
projectRoot: root,
|
|
212
|
+
path: rawPath,
|
|
213
|
+
resolvedPath: relPath,
|
|
214
|
+
exists: false,
|
|
215
|
+
inferredKind: AreaKind.Unknown,
|
|
216
|
+
role: `Path does not exist: ${relPath}`,
|
|
217
|
+
fileCount: 0,
|
|
218
|
+
testCount: 0,
|
|
219
|
+
keyFiles: [],
|
|
220
|
+
relatedCommands: [],
|
|
221
|
+
relatedMcpTools: [],
|
|
222
|
+
relatedTemplates: [],
|
|
223
|
+
relatedPipelines: [],
|
|
224
|
+
boundaryRuleIds: [],
|
|
225
|
+
pathConventionIds: [],
|
|
226
|
+
risks: [],
|
|
227
|
+
nextCommands: [`shrk map # repo-wide map`],
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
const stat = statSync(absPath);
|
|
231
|
+
const isDir = stat.isDirectory();
|
|
232
|
+
const files = [];
|
|
233
|
+
if (isDir) {
|
|
234
|
+
const rels = walkLimited(root, relPath || '.');
|
|
235
|
+
for (const r of rels) {
|
|
236
|
+
let st;
|
|
237
|
+
try {
|
|
238
|
+
st = statSync(nodePath.join(root, r));
|
|
239
|
+
}
|
|
240
|
+
catch {
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
files.push({ relPath: r, sizeBytes: st.size, kind: classifyFileKind(r) });
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
files.push({
|
|
248
|
+
relPath,
|
|
249
|
+
sizeBytes: stat.size,
|
|
250
|
+
kind: classifyFileKind(relPath),
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
files.sort((a, b) => b.sizeBytes - a.sizeBytes);
|
|
254
|
+
const areaMap = buildAreaMap(input.inspection);
|
|
255
|
+
const inferredKind = inferKindForPath(relPath, areaMap);
|
|
256
|
+
const role = describeRole(relPath, inferredKind);
|
|
257
|
+
const topFiles = input.topFiles ?? 10;
|
|
258
|
+
const keyFiles = files
|
|
259
|
+
.filter((f) => f.kind === 'source' || f.kind === 'config')
|
|
260
|
+
.slice(0, topFiles);
|
|
261
|
+
// Related commands by token overlap.
|
|
262
|
+
const commands = (input.commandCatalog ?? [])
|
|
263
|
+
.map((c) => ({ command: c.command, score: commandRelevance(c.command, relPath) }))
|
|
264
|
+
.filter((x) => x.score > 0)
|
|
265
|
+
.sort((a, b) => b.score - a.score)
|
|
266
|
+
.slice(0, 6)
|
|
267
|
+
.map((x) => x.command);
|
|
268
|
+
const mcpTools = (input.mcpToolNames ?? [])
|
|
269
|
+
.map((t) => ({ tool: t, score: commandRelevance(t, relPath) }))
|
|
270
|
+
.filter((x) => x.score > 0)
|
|
271
|
+
.sort((a, b) => b.score - a.score)
|
|
272
|
+
.slice(0, 6)
|
|
273
|
+
.map((x) => x.tool);
|
|
274
|
+
// Boundary rules and path conventions that reference this dir.
|
|
275
|
+
// Boundary rules carry `from` globs (file patterns) and import lists; we
|
|
276
|
+
// only match against `from` since that's the file-side.
|
|
277
|
+
const boundaryRules = input.inspection.boundaryRegistry.list();
|
|
278
|
+
const boundaryRuleIds = boundaryRules
|
|
279
|
+
.filter((r) => {
|
|
280
|
+
const from = r.from ?? [];
|
|
281
|
+
return from.some((p) => {
|
|
282
|
+
const stripped = String(p).replace(/[*?]/g, '');
|
|
283
|
+
return stripped.length > 0 && (relPath.includes(stripped) || stripped.includes(relPath));
|
|
284
|
+
});
|
|
285
|
+
})
|
|
286
|
+
.map((r) => r.id);
|
|
287
|
+
const pathConventions = (input.pathConventions ?? [])
|
|
288
|
+
.filter((p) => {
|
|
289
|
+
const pat = (p.pattern ?? p.path ?? '').replace(/[*?]/g, '');
|
|
290
|
+
return pat && (relPath.includes(pat) || pat.includes(relPath));
|
|
291
|
+
})
|
|
292
|
+
.map((p) => p.id);
|
|
293
|
+
// Related templates / pipelines from the registries (heuristic).
|
|
294
|
+
const templates = input.inspection.templateRegistry.list();
|
|
295
|
+
const relatedTemplates = templates
|
|
296
|
+
.filter((t) => {
|
|
297
|
+
const tp = t.targetPath;
|
|
298
|
+
return typeof tp === 'string' && relPath && tp.includes(relPath.split('/').pop() ?? '');
|
|
299
|
+
})
|
|
300
|
+
.map((t) => t.id);
|
|
301
|
+
const pipelines = input.inspection.pipelineRegistry.list();
|
|
302
|
+
const relatedPipelines = pipelines
|
|
303
|
+
.filter((p) => (p.steps ?? []).some((s) => JSON.stringify(s).toLowerCase().includes(relPath.toLowerCase())))
|
|
304
|
+
.map((p) => p.id);
|
|
305
|
+
const risks = detectRisks({ relPath, files, inferredKind });
|
|
306
|
+
const testCount = files.filter((f) => f.kind === 'test').length;
|
|
307
|
+
const nextCommands = [];
|
|
308
|
+
nextCommands.push(`shrk impact --files "${relPath}"`);
|
|
309
|
+
nextCommands.push(`shrk check boundaries --files "${relPath}"`);
|
|
310
|
+
if (testCount === 0 && isDir)
|
|
311
|
+
nextCommands.push(`shrk tests missing --area "${relPath}"`);
|
|
312
|
+
if (relPath.startsWith('packages/'))
|
|
313
|
+
nextCommands.push(`shrk architecture area packages/${relPath.split('/')[1]}`);
|
|
314
|
+
return {
|
|
315
|
+
schema: AREA_EXPLORE_SCHEMA,
|
|
316
|
+
projectRoot: root,
|
|
317
|
+
path: rawPath,
|
|
318
|
+
resolvedPath: relPath,
|
|
319
|
+
exists: true,
|
|
320
|
+
inferredKind,
|
|
321
|
+
role,
|
|
322
|
+
fileCount: files.length,
|
|
323
|
+
testCount,
|
|
324
|
+
keyFiles,
|
|
325
|
+
relatedCommands: commands,
|
|
326
|
+
relatedMcpTools: mcpTools,
|
|
327
|
+
relatedTemplates,
|
|
328
|
+
relatedPipelines,
|
|
329
|
+
boundaryRuleIds,
|
|
330
|
+
pathConventionIds: pathConventions,
|
|
331
|
+
risks,
|
|
332
|
+
nextCommands,
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
export function renderAreaExploreText(report) {
|
|
336
|
+
const lines = [];
|
|
337
|
+
lines.push(`=== Explore: ${report.resolvedPath || '(root)'} ===`);
|
|
338
|
+
if (!report.exists) {
|
|
339
|
+
lines.push(` path does not exist.`);
|
|
340
|
+
return lines.join('\n') + '\n';
|
|
341
|
+
}
|
|
342
|
+
lines.push(` kind: ${report.inferredKind}`);
|
|
343
|
+
lines.push(` role: ${report.role}`);
|
|
344
|
+
lines.push(` files: ${report.fileCount} tests: ${report.testCount}`);
|
|
345
|
+
if (report.keyFiles.length > 0) {
|
|
346
|
+
lines.push('\nKey files:');
|
|
347
|
+
for (const f of report.keyFiles) {
|
|
348
|
+
lines.push(` ${f.kind.padEnd(9)} ${f.relPath} (${f.sizeBytes}B)`);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
if (report.relatedCommands.length > 0) {
|
|
352
|
+
lines.push('\nRelated commands:');
|
|
353
|
+
for (const c of report.relatedCommands)
|
|
354
|
+
lines.push(` $ shrk ${c}`);
|
|
355
|
+
}
|
|
356
|
+
if (report.relatedMcpTools.length > 0) {
|
|
357
|
+
lines.push('\nRelated MCP tools:');
|
|
358
|
+
for (const t of report.relatedMcpTools)
|
|
359
|
+
lines.push(` • ${t}`);
|
|
360
|
+
}
|
|
361
|
+
if (report.relatedTemplates.length > 0) {
|
|
362
|
+
lines.push('\nRelated templates:');
|
|
363
|
+
for (const t of report.relatedTemplates)
|
|
364
|
+
lines.push(` • ${t}`);
|
|
365
|
+
}
|
|
366
|
+
if (report.relatedPipelines.length > 0) {
|
|
367
|
+
lines.push('\nRelated pipelines:');
|
|
368
|
+
for (const p of report.relatedPipelines)
|
|
369
|
+
lines.push(` • ${p}`);
|
|
370
|
+
}
|
|
371
|
+
if (report.boundaryRuleIds.length > 0) {
|
|
372
|
+
lines.push('\nBoundary rules covering this dir:');
|
|
373
|
+
for (const r of report.boundaryRuleIds)
|
|
374
|
+
lines.push(` • ${r}`);
|
|
375
|
+
}
|
|
376
|
+
if (report.pathConventionIds.length > 0) {
|
|
377
|
+
lines.push('\nPath conventions covering this dir:');
|
|
378
|
+
for (const p of report.pathConventionIds)
|
|
379
|
+
lines.push(` • ${p}`);
|
|
380
|
+
}
|
|
381
|
+
if (report.risks.length > 0) {
|
|
382
|
+
lines.push('\nCommon edit risks:');
|
|
383
|
+
for (const r of report.risks) {
|
|
384
|
+
const tag = r.severity === 'warning' ? 'WARN' : 'INFO';
|
|
385
|
+
lines.push(` [${tag}] ${r.kind.padEnd(20)} ${r.message}`);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
if (report.nextCommands.length > 0) {
|
|
389
|
+
lines.push('\nNext:');
|
|
390
|
+
for (const n of report.nextCommands)
|
|
391
|
+
lines.push(` $ ${n}`);
|
|
392
|
+
}
|
|
393
|
+
return lines.join('\n') + '\n';
|
|
394
|
+
}
|
|
395
|
+
export function renderAreaExploreMarkdown(report) {
|
|
396
|
+
const lines = [];
|
|
397
|
+
lines.push(`# Explore: \`${report.resolvedPath || '(root)'}\``);
|
|
398
|
+
lines.push('');
|
|
399
|
+
if (!report.exists) {
|
|
400
|
+
lines.push(`Path does not exist.`);
|
|
401
|
+
return lines.join('\n') + '\n';
|
|
402
|
+
}
|
|
403
|
+
lines.push(`- **Kind:** ${report.inferredKind}`);
|
|
404
|
+
lines.push(`- **Role:** ${report.role}`);
|
|
405
|
+
lines.push(`- **Files:** ${report.fileCount} (tests: ${report.testCount})`);
|
|
406
|
+
if (report.keyFiles.length > 0) {
|
|
407
|
+
lines.push('');
|
|
408
|
+
lines.push('## Key files');
|
|
409
|
+
for (const f of report.keyFiles)
|
|
410
|
+
lines.push(`- \`${f.relPath}\` _(${f.kind}, ${f.sizeBytes}B)_`);
|
|
411
|
+
}
|
|
412
|
+
if (report.relatedCommands.length > 0) {
|
|
413
|
+
lines.push('');
|
|
414
|
+
lines.push('## Related commands');
|
|
415
|
+
for (const c of report.relatedCommands)
|
|
416
|
+
lines.push(`- \`shrk ${c}\``);
|
|
417
|
+
}
|
|
418
|
+
if (report.relatedMcpTools.length > 0) {
|
|
419
|
+
lines.push('');
|
|
420
|
+
lines.push('## Related MCP tools');
|
|
421
|
+
for (const t of report.relatedMcpTools)
|
|
422
|
+
lines.push(`- \`${t}\``);
|
|
423
|
+
}
|
|
424
|
+
if (report.risks.length > 0) {
|
|
425
|
+
lines.push('');
|
|
426
|
+
lines.push('## Common edit risks');
|
|
427
|
+
for (const r of report.risks) {
|
|
428
|
+
lines.push(`- **${r.kind}** (_${r.severity}_) — ${r.message}`);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
if (report.nextCommands.length > 0) {
|
|
432
|
+
lines.push('');
|
|
433
|
+
lines.push('## Next commands');
|
|
434
|
+
for (const n of report.nextCommands)
|
|
435
|
+
lines.push(`- \`${n}\``);
|
|
436
|
+
}
|
|
437
|
+
return lines.join('\n') + '\n';
|
|
438
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ISharkcraftInspection } from './sharkcraft-inspector.js';
|
|
2
|
+
export declare const AREA_MAP_SCHEMA = "sharkcraft.area-map/v1";
|
|
3
|
+
export declare enum AreaKind {
|
|
4
|
+
Core = "core",
|
|
5
|
+
Common = "common",
|
|
6
|
+
Runtime = "runtime",
|
|
7
|
+
Kernel = "kernel",
|
|
8
|
+
Plugin = "plugin",
|
|
9
|
+
Adapter = "adapter",
|
|
10
|
+
Ui = "ui",
|
|
11
|
+
App = "app",
|
|
12
|
+
Api = "api",
|
|
13
|
+
Tests = "tests",
|
|
14
|
+
Docs = "docs",
|
|
15
|
+
Infra = "infra",
|
|
16
|
+
Generated = "generated",
|
|
17
|
+
Unknown = "unknown"
|
|
18
|
+
}
|
|
19
|
+
export interface IAreaMapEntry {
|
|
20
|
+
id: string;
|
|
21
|
+
kind: AreaKind;
|
|
22
|
+
paths: readonly string[];
|
|
23
|
+
fileCount: number;
|
|
24
|
+
/** Best-effort: import edges into this area (from import graph). */
|
|
25
|
+
importsIn: number;
|
|
26
|
+
/** Best-effort: import edges out of this area. */
|
|
27
|
+
importsOut: number;
|
|
28
|
+
boundaryRuleIds: readonly string[];
|
|
29
|
+
relatedTemplateIds: readonly string[];
|
|
30
|
+
relatedPipelineIds: readonly string[];
|
|
31
|
+
/** 0–100; high when an area has many fan-in edges with weak guard-rails. */
|
|
32
|
+
riskScore: number;
|
|
33
|
+
}
|
|
34
|
+
export interface IAreaMap {
|
|
35
|
+
schema: typeof AREA_MAP_SCHEMA;
|
|
36
|
+
projectRoot: string;
|
|
37
|
+
areas: readonly IAreaMapEntry[];
|
|
38
|
+
unclassifiedFiles: number;
|
|
39
|
+
}
|
|
40
|
+
export declare function buildAreaMap(inspection: ISharkcraftInspection): IAreaMap;
|
|
41
|
+
export declare function renderAreaMapText(map: IAreaMap): string;
|
|
42
|
+
export declare function renderAreaMapMarkdown(map: IAreaMap): string;
|
|
43
|
+
//# sourceMappingURL=area-map.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"area-map.d.ts","sourceRoot":"","sources":["../src/area-map.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,eAAO,MAAM,eAAe,2BAA2B,CAAC;AAExD,oBAAY,QAAQ;IAClB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,EAAE,OAAO;IACT,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,KAAK,UAAU;IACf,IAAI,SAAS;IACb,KAAK,UAAU;IACf,SAAS,cAAc;IACvB,OAAO,YAAY;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,SAAS,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,4EAA4E;IAC5E,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,OAAO,eAAe,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IAChC,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAyED,wBAAgB,YAAY,CAAC,UAAU,EAAE,qBAAqB,GAAG,QAAQ,CA4ExE;AA0BD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,QAAQ,GAAG,MAAM,CASvD;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,QAAQ,GAAG,MAAM,CAc3D"}
|
package/dist/area-map.js
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { existsSync, readdirSync, statSync } from 'node:fs';
|
|
2
|
+
import * as nodePath from 'node:path';
|
|
3
|
+
export const AREA_MAP_SCHEMA = 'sharkcraft.area-map/v1';
|
|
4
|
+
export var AreaKind;
|
|
5
|
+
(function (AreaKind) {
|
|
6
|
+
AreaKind["Core"] = "core";
|
|
7
|
+
AreaKind["Common"] = "common";
|
|
8
|
+
AreaKind["Runtime"] = "runtime";
|
|
9
|
+
AreaKind["Kernel"] = "kernel";
|
|
10
|
+
AreaKind["Plugin"] = "plugin";
|
|
11
|
+
AreaKind["Adapter"] = "adapter";
|
|
12
|
+
AreaKind["Ui"] = "ui";
|
|
13
|
+
AreaKind["App"] = "app";
|
|
14
|
+
AreaKind["Api"] = "api";
|
|
15
|
+
AreaKind["Tests"] = "tests";
|
|
16
|
+
AreaKind["Docs"] = "docs";
|
|
17
|
+
AreaKind["Infra"] = "infra";
|
|
18
|
+
AreaKind["Generated"] = "generated";
|
|
19
|
+
AreaKind["Unknown"] = "unknown";
|
|
20
|
+
})(AreaKind || (AreaKind = {}));
|
|
21
|
+
const AREA_PATTERNS = [
|
|
22
|
+
{ kind: AreaKind.Core, match: [/^packages\/core(\/|$)/, /^src\/core(\/|$)/], idHint: 'core' },
|
|
23
|
+
{ kind: AreaKind.Common, match: [/^packages\/(common|shared)(\/|$)/, /^src\/(common|shared)(\/|$)/], idHint: 'common' },
|
|
24
|
+
{ kind: AreaKind.Runtime, match: [/^packages\/runtime(\/|$)/, /^src\/runtime(\/|$)/], idHint: 'runtime' },
|
|
25
|
+
{ kind: AreaKind.Kernel, match: [/^packages\/kernel(\/|$)/, /^src\/kernel(\/|$)/], idHint: 'kernel' },
|
|
26
|
+
{ kind: AreaKind.Plugin, match: [/plugins?(\/|$)/, /^packages\/plugin-/], idHint: 'plugin' },
|
|
27
|
+
{ kind: AreaKind.Adapter, match: [/adapters?(\/|$)/, /^packages\/adapter-/], idHint: 'adapter' },
|
|
28
|
+
{ kind: AreaKind.Ui, match: [/^packages\/(ui|dashboard|web)(\/|$)/, /^(src|app)\/(ui|components|pages|views)(\/|$)/], idHint: 'ui' },
|
|
29
|
+
{ kind: AreaKind.App, match: [/^apps?\//, /^packages\/app(\/|$)/], idHint: 'app' },
|
|
30
|
+
{ kind: AreaKind.Api, match: [/^packages\/api(\/|$)/, /\/api\//, /\/routes\//, /\/controllers\//], idHint: 'api' },
|
|
31
|
+
{ kind: AreaKind.Tests, match: [/^tests?\//, /\.spec\.[tj]sx?$/, /\.test\.[tj]sx?$/, /\/__tests__\//], idHint: 'tests' },
|
|
32
|
+
{ kind: AreaKind.Docs, match: [/^docs?\//, /\.md$/], idHint: 'docs' },
|
|
33
|
+
{ kind: AreaKind.Infra, match: [/^(\.github|scripts|infra|docker|deploy)\//, /^Dockerfile/], idHint: 'infra' },
|
|
34
|
+
{ kind: AreaKind.Generated, match: [/\/dist\//, /\/generated\//, /\/build\//, /\.d\.ts$/], idHint: 'generated' },
|
|
35
|
+
];
|
|
36
|
+
const IGNORE_DIRS = new Set([
|
|
37
|
+
'node_modules',
|
|
38
|
+
'.git',
|
|
39
|
+
'.sharkcraft',
|
|
40
|
+
'dist',
|
|
41
|
+
'build',
|
|
42
|
+
'.cache',
|
|
43
|
+
'.turbo',
|
|
44
|
+
'.nx',
|
|
45
|
+
'coverage',
|
|
46
|
+
'.next',
|
|
47
|
+
]);
|
|
48
|
+
function walk(root, base = '') {
|
|
49
|
+
const out = [];
|
|
50
|
+
const target = base ? nodePath.join(root, base) : root;
|
|
51
|
+
let entries;
|
|
52
|
+
try {
|
|
53
|
+
entries = readdirSync(target);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return out;
|
|
57
|
+
}
|
|
58
|
+
for (const name of entries) {
|
|
59
|
+
if (name.startsWith('.') && !['.github', '.gitlab'].includes(name))
|
|
60
|
+
continue;
|
|
61
|
+
if (IGNORE_DIRS.has(name))
|
|
62
|
+
continue;
|
|
63
|
+
const rel = base ? `${base}/${name}` : name;
|
|
64
|
+
let stat;
|
|
65
|
+
try {
|
|
66
|
+
stat = statSync(nodePath.join(root, rel));
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
if (stat.isDirectory()) {
|
|
72
|
+
out.push(...walk(root, rel));
|
|
73
|
+
}
|
|
74
|
+
else if (stat.isFile()) {
|
|
75
|
+
out.push(rel);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
function classify(file) {
|
|
81
|
+
for (const p of AREA_PATTERNS) {
|
|
82
|
+
if (p.match.some((re) => re.test(file)))
|
|
83
|
+
return p.kind;
|
|
84
|
+
}
|
|
85
|
+
return AreaKind.Unknown;
|
|
86
|
+
}
|
|
87
|
+
function packageOrTopSegment(file) {
|
|
88
|
+
const segs = file.split('/');
|
|
89
|
+
if (segs[0] === 'packages' && segs[1])
|
|
90
|
+
return `packages/${segs[1]}`;
|
|
91
|
+
if (segs[0] === 'apps' && segs[1])
|
|
92
|
+
return `apps/${segs[1]}`;
|
|
93
|
+
return segs[0] ?? '';
|
|
94
|
+
}
|
|
95
|
+
export function buildAreaMap(inspection) {
|
|
96
|
+
const root = inspection.projectRoot;
|
|
97
|
+
const allFiles = existsSync(root) ? walk(root) : [];
|
|
98
|
+
const byKey = new Map();
|
|
99
|
+
let unclassified = 0;
|
|
100
|
+
for (const f of allFiles) {
|
|
101
|
+
const kind = classify(f);
|
|
102
|
+
if (kind === AreaKind.Unknown)
|
|
103
|
+
unclassified += 1;
|
|
104
|
+
const seg = packageOrTopSegment(f);
|
|
105
|
+
const key = `${kind}:${seg}`;
|
|
106
|
+
let entry = byKey.get(key);
|
|
107
|
+
if (!entry) {
|
|
108
|
+
entry = { kind, paths: new Set(), fileCount: 0 };
|
|
109
|
+
byKey.set(key, entry);
|
|
110
|
+
}
|
|
111
|
+
entry.paths.add(seg);
|
|
112
|
+
entry.fileCount += 1;
|
|
113
|
+
}
|
|
114
|
+
const boundaryRules = inspection.boundaryRegistry.list();
|
|
115
|
+
const templates = inspection.templateRegistry.list();
|
|
116
|
+
const pipelines = inspection.pipelineRegistry.list();
|
|
117
|
+
const areas = [];
|
|
118
|
+
for (const [key, info] of byKey) {
|
|
119
|
+
const paths = [...info.paths].sort();
|
|
120
|
+
const boundaryRuleIds = boundaryRules
|
|
121
|
+
.filter((r) => paths.some((p) => (r.from ?? []).some((g) => p.includes(stripGlob(g)))))
|
|
122
|
+
.map((r) => r.id);
|
|
123
|
+
const relatedTemplateIds = templates
|
|
124
|
+
.filter((t) => paths.some((p) => targetPathString(t).includes(p.split('/').pop() ?? '')))
|
|
125
|
+
.map((t) => t.id);
|
|
126
|
+
const relatedPipelineIds = pipelines
|
|
127
|
+
.filter((p) => paths.some((path) => (p.steps ?? []).some((s) => JSON.stringify(s).toLowerCase().includes(path.toLowerCase()))))
|
|
128
|
+
.map((p) => p.id);
|
|
129
|
+
areas.push({
|
|
130
|
+
id: key,
|
|
131
|
+
kind: info.kind,
|
|
132
|
+
paths,
|
|
133
|
+
fileCount: info.fileCount,
|
|
134
|
+
importsIn: 0,
|
|
135
|
+
importsOut: 0,
|
|
136
|
+
boundaryRuleIds,
|
|
137
|
+
relatedTemplateIds,
|
|
138
|
+
relatedPipelineIds,
|
|
139
|
+
riskScore: computeRiskScore({
|
|
140
|
+
kind: info.kind,
|
|
141
|
+
fileCount: info.fileCount,
|
|
142
|
+
boundaryRules: boundaryRuleIds.length,
|
|
143
|
+
}),
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
areas.sort((a, b) => b.fileCount - a.fileCount);
|
|
147
|
+
return {
|
|
148
|
+
schema: AREA_MAP_SCHEMA,
|
|
149
|
+
projectRoot: root,
|
|
150
|
+
areas,
|
|
151
|
+
unclassifiedFiles: unclassified,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function stripGlob(s) {
|
|
155
|
+
return s.replace(/[*?]/g, '');
|
|
156
|
+
}
|
|
157
|
+
function targetPathString(t) {
|
|
158
|
+
const tp = t.targetPath;
|
|
159
|
+
if (typeof tp === 'string')
|
|
160
|
+
return tp;
|
|
161
|
+
return '';
|
|
162
|
+
}
|
|
163
|
+
function computeRiskScore(input) {
|
|
164
|
+
let score = 0;
|
|
165
|
+
if (input.kind === AreaKind.Unknown)
|
|
166
|
+
score += 30;
|
|
167
|
+
if (input.kind === AreaKind.Generated)
|
|
168
|
+
score -= 10;
|
|
169
|
+
if (input.fileCount > 100)
|
|
170
|
+
score += 15;
|
|
171
|
+
if (input.fileCount > 25 && input.boundaryRules === 0)
|
|
172
|
+
score += 20;
|
|
173
|
+
if (input.boundaryRules > 3)
|
|
174
|
+
score -= 10;
|
|
175
|
+
return Math.max(0, Math.min(100, 30 + score));
|
|
176
|
+
}
|
|
177
|
+
export function renderAreaMapText(map) {
|
|
178
|
+
const lines = [];
|
|
179
|
+
lines.push(`Area map (${map.areas.length} areas, ${map.unclassifiedFiles} unclassified files)`);
|
|
180
|
+
for (const a of map.areas.slice(0, 50)) {
|
|
181
|
+
lines.push(` ${a.kind.padEnd(10)} ${String(a.fileCount).padStart(5)} files paths=${a.paths.join(', ')} risk=${a.riskScore}`);
|
|
182
|
+
}
|
|
183
|
+
return lines.join('\n');
|
|
184
|
+
}
|
|
185
|
+
export function renderAreaMapMarkdown(map) {
|
|
186
|
+
const lines = [];
|
|
187
|
+
lines.push(`# Repository area map`);
|
|
188
|
+
lines.push('');
|
|
189
|
+
lines.push(`Total areas: **${map.areas.length}** — unclassified files: ${map.unclassifiedFiles}.`);
|
|
190
|
+
lines.push('');
|
|
191
|
+
lines.push('| Kind | Files | Paths | Boundary rules | Risk |');
|
|
192
|
+
lines.push('| --- | ---: | --- | ---: | ---: |');
|
|
193
|
+
for (const a of map.areas) {
|
|
194
|
+
lines.push(`| ${a.kind} | ${a.fileCount} | ${a.paths.join(', ')} | ${a.boundaryRuleIds.length} | ${a.riskScore} |`);
|
|
195
|
+
}
|
|
196
|
+
return lines.join('\n') + '\n';
|
|
197
|
+
}
|