@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,422 @@
|
|
|
1
|
+
function riskBadgeTag(risk) {
|
|
2
|
+
switch (risk) {
|
|
3
|
+
case 'low':
|
|
4
|
+
return 'ok';
|
|
5
|
+
case 'medium':
|
|
6
|
+
case 'high':
|
|
7
|
+
return 'warn';
|
|
8
|
+
case 'critical':
|
|
9
|
+
return 'fail';
|
|
10
|
+
default:
|
|
11
|
+
return 'warn';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function escapeHtml(s) {
|
|
15
|
+
return s
|
|
16
|
+
.replace(/&/g, '&')
|
|
17
|
+
.replace(/</g, '<')
|
|
18
|
+
.replace(/>/g, '>')
|
|
19
|
+
.replace(/"/g, '"');
|
|
20
|
+
}
|
|
21
|
+
function bullet(items, prefix = ' - ') {
|
|
22
|
+
if (items.length === 0)
|
|
23
|
+
return '_(none)_';
|
|
24
|
+
return items.map((i) => `${prefix}${i}`).join('\n');
|
|
25
|
+
}
|
|
26
|
+
/** Build a small dependency tree rooted at every normalized target. */
|
|
27
|
+
export function buildImpactTree(impact, opts = {}) {
|
|
28
|
+
const depth = Math.max(1, opts.depth ?? 3);
|
|
29
|
+
const width = Math.max(1, opts.width ?? 5);
|
|
30
|
+
// Reconstruct importer→[importers] map from the dependencyPathExamples.
|
|
31
|
+
// Each example chain is `from → via... → to`; the importer relationship is
|
|
32
|
+
// each consecutive pair in reverse order (the `to` is imported by `from`).
|
|
33
|
+
const importers = new Map();
|
|
34
|
+
for (const p of impact.dependencyPathExamples) {
|
|
35
|
+
const chain = [p.from, ...p.via, p.to];
|
|
36
|
+
for (let i = 0; i < chain.length - 1; i += 1) {
|
|
37
|
+
const importer = chain[i];
|
|
38
|
+
const target = chain[i + 1];
|
|
39
|
+
// Skip self-references — a file cannot import itself in the
|
|
40
|
+
// dependency tree we render. (Cycles do exist in import graphs,
|
|
41
|
+
// but the renderer's job is reviewer clarity, not topology.)
|
|
42
|
+
if (importer === target)
|
|
43
|
+
continue;
|
|
44
|
+
const set = importers.get(target) ?? new Set();
|
|
45
|
+
set.add(importer);
|
|
46
|
+
importers.set(target, set);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// Also seed the root targets with their direct dependents.
|
|
50
|
+
for (const target of impact.normalizedTargets) {
|
|
51
|
+
const set = importers.get(target) ?? new Set();
|
|
52
|
+
for (const dep of impact.directDependents) {
|
|
53
|
+
// Skip self — a target appearing in its own directDependents list
|
|
54
|
+
// is a graph artifact, not a real edge to render.
|
|
55
|
+
if (dep === target)
|
|
56
|
+
continue;
|
|
57
|
+
// Heuristic: every direct dependent is a candidate importer of every
|
|
58
|
+
// target (the real graph is captured in dependencyPathExamples).
|
|
59
|
+
// We only add direct dependents if they don't already appear as
|
|
60
|
+
// importers via the example chain to avoid noise.
|
|
61
|
+
if (!set.has(dep))
|
|
62
|
+
set.add(dep);
|
|
63
|
+
}
|
|
64
|
+
importers.set(target, set);
|
|
65
|
+
}
|
|
66
|
+
const visited = new Set();
|
|
67
|
+
const build = (file, d) => {
|
|
68
|
+
if (visited.has(file) || d >= depth) {
|
|
69
|
+
return { file, children: [] };
|
|
70
|
+
}
|
|
71
|
+
visited.add(file);
|
|
72
|
+
const direct = [...(importers.get(file) ?? [])].slice(0, width);
|
|
73
|
+
return {
|
|
74
|
+
file,
|
|
75
|
+
children: direct.map((c) => build(c, d + 1)),
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
return impact.normalizedTargets.map((t) => build(t, 0));
|
|
79
|
+
}
|
|
80
|
+
function renderTreeText(nodes) {
|
|
81
|
+
const lines = [];
|
|
82
|
+
const walk = (node, prefix, isLast) => {
|
|
83
|
+
const connector = prefix === '' ? '' : isLast ? '└─ ' : '├─ ';
|
|
84
|
+
lines.push(prefix + connector + node.file);
|
|
85
|
+
const childPrefix = prefix + (isLast ? ' ' : '│ ');
|
|
86
|
+
for (let i = 0; i < node.children.length; i += 1) {
|
|
87
|
+
walk(node.children[i], childPrefix, i === node.children.length - 1);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
for (const root of nodes)
|
|
91
|
+
walk(root, '', true);
|
|
92
|
+
return lines.join('\n');
|
|
93
|
+
}
|
|
94
|
+
function renderTreeHtml(nodes) {
|
|
95
|
+
const walk = (node) => {
|
|
96
|
+
if (node.children.length === 0) {
|
|
97
|
+
return `<li><code>${escapeHtml(node.file)}</code></li>`;
|
|
98
|
+
}
|
|
99
|
+
return [
|
|
100
|
+
'<li>',
|
|
101
|
+
`<details open><summary><code>${escapeHtml(node.file)}</code></summary>`,
|
|
102
|
+
'<ul>',
|
|
103
|
+
...node.children.map(walk),
|
|
104
|
+
'</ul></details>',
|
|
105
|
+
'</li>',
|
|
106
|
+
].join('');
|
|
107
|
+
};
|
|
108
|
+
return `<ul class="impact-tree">${nodes.map(walk).join('')}</ul>`;
|
|
109
|
+
}
|
|
110
|
+
export function renderImpactText(impact, opts = {}) {
|
|
111
|
+
const lines = [];
|
|
112
|
+
lines.push(`=== Impact (${impact.inputKind}) ===`);
|
|
113
|
+
if (impact.task)
|
|
114
|
+
lines.push(`Task: ${impact.task}`);
|
|
115
|
+
if (impact.specifier)
|
|
116
|
+
lines.push(`Specifier: ${impact.specifier}`);
|
|
117
|
+
lines.push(`Risk: ${impact.risk}`);
|
|
118
|
+
if (impact.riskReasons.length > 0) {
|
|
119
|
+
lines.push('Reasons:');
|
|
120
|
+
for (const r of impact.riskReasons.slice(0, 6))
|
|
121
|
+
lines.push(` - ${r.code}: ${r.message}`);
|
|
122
|
+
}
|
|
123
|
+
lines.push(`Targets (${impact.normalizedTargets.length}):`);
|
|
124
|
+
for (const f of impact.normalizedTargets.slice(0, 12))
|
|
125
|
+
lines.push(` • ${f}`);
|
|
126
|
+
lines.push(`Direct dependents (${impact.directDependents.length}):`);
|
|
127
|
+
for (const f of impact.directDependents.slice(0, 12))
|
|
128
|
+
lines.push(` ← ${f}`);
|
|
129
|
+
lines.push(`Transitive dependents (${impact.transitiveDependents.length}):`);
|
|
130
|
+
for (const f of impact.transitiveDependents.slice(0, 12))
|
|
131
|
+
lines.push(` ⤵ ${f}`);
|
|
132
|
+
if (opts.tree !== false) {
|
|
133
|
+
const tree = buildImpactTree(impact, {
|
|
134
|
+
...(opts.treeDepth ? { depth: opts.treeDepth } : {}),
|
|
135
|
+
...(opts.treeWidth ? { width: opts.treeWidth } : {}),
|
|
136
|
+
});
|
|
137
|
+
lines.push('');
|
|
138
|
+
lines.push('Dependency tree:');
|
|
139
|
+
lines.push(renderTreeText(tree));
|
|
140
|
+
if (impact.transitiveDependents.length > (opts.treeWidth ?? 5) * impact.normalizedTargets.length) {
|
|
141
|
+
lines.push(`... rerun with --limit for the full list`);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (impact.affectedPackages.length > 0) {
|
|
145
|
+
lines.push(`Packages: ${impact.affectedPackages.map((p) => p.name).join(', ')}`);
|
|
146
|
+
}
|
|
147
|
+
if (impact.potentialBoundaryRisks.length > 0) {
|
|
148
|
+
lines.push('Boundary risks:');
|
|
149
|
+
for (const b of impact.potentialBoundaryRisks.slice(0, 6))
|
|
150
|
+
lines.push(` ! ${b.ruleId}: ${b.reason}`);
|
|
151
|
+
}
|
|
152
|
+
if (impact.affectedPolicies.length > 0) {
|
|
153
|
+
lines.push('Policy concerns:');
|
|
154
|
+
for (const p of impact.affectedPolicies)
|
|
155
|
+
lines.push(` [${p.severity}] ${p.policyId}`);
|
|
156
|
+
}
|
|
157
|
+
if (impact.affectedOwnership?.requiredReviewFiles.length) {
|
|
158
|
+
lines.push(`Required review: ${impact.affectedOwnership.requiredReviewFiles.length} file(s)`);
|
|
159
|
+
}
|
|
160
|
+
lines.push('Suggested tests:');
|
|
161
|
+
for (const c of impact.suggestedTestCommands.slice(0, 4))
|
|
162
|
+
lines.push(` $ ${c}`);
|
|
163
|
+
lines.push('Suggested verification:');
|
|
164
|
+
for (const c of impact.suggestedValidationCommands.slice(0, 4))
|
|
165
|
+
lines.push(` $ ${c}`);
|
|
166
|
+
if (impact.suggestedReviewCommands.length > 0) {
|
|
167
|
+
lines.push('Suggested review:');
|
|
168
|
+
for (const c of impact.suggestedReviewCommands.slice(0, 3))
|
|
169
|
+
lines.push(` $ ${c}`);
|
|
170
|
+
}
|
|
171
|
+
if (impact.truncations.length > 0) {
|
|
172
|
+
lines.push('Truncated:');
|
|
173
|
+
for (const t of impact.truncations)
|
|
174
|
+
lines.push(` ${t.list}: ${t.shown}/${t.total}`);
|
|
175
|
+
}
|
|
176
|
+
if (impact.diagnostics.length > 0) {
|
|
177
|
+
lines.push('Diagnostics:');
|
|
178
|
+
for (const d of impact.diagnostics)
|
|
179
|
+
lines.push(` ! ${d}`);
|
|
180
|
+
}
|
|
181
|
+
lines.push('');
|
|
182
|
+
lines.push(impact.explanation);
|
|
183
|
+
return lines.join('\n') + '\n';
|
|
184
|
+
}
|
|
185
|
+
export function renderImpactMarkdown(impact, opts = {}) {
|
|
186
|
+
const lines = [];
|
|
187
|
+
lines.push(`# Impact report`);
|
|
188
|
+
lines.push('');
|
|
189
|
+
lines.push(`**Risk:** \`${impact.risk}\` · **Input:** \`${impact.inputKind}\``);
|
|
190
|
+
if (impact.task)
|
|
191
|
+
lines.push(`**Task:** ${impact.task}`);
|
|
192
|
+
if (impact.specifier)
|
|
193
|
+
lines.push(`**Specifier:** \`${impact.specifier}\``);
|
|
194
|
+
lines.push('');
|
|
195
|
+
lines.push(`## Summary`);
|
|
196
|
+
lines.push('');
|
|
197
|
+
lines.push(impact.explanation);
|
|
198
|
+
lines.push('');
|
|
199
|
+
lines.push(`## Targets (${impact.normalizedTargets.length})`);
|
|
200
|
+
lines.push('');
|
|
201
|
+
lines.push(bullet(impact.normalizedTargets.slice(0, 20).map((f) => `\`${f}\``)));
|
|
202
|
+
lines.push('');
|
|
203
|
+
lines.push(`## Risk reasons`);
|
|
204
|
+
lines.push('');
|
|
205
|
+
if (impact.riskReasons.length === 0)
|
|
206
|
+
lines.push('_None._');
|
|
207
|
+
for (const r of impact.riskReasons)
|
|
208
|
+
lines.push(`- **${r.code}** — ${r.message}`);
|
|
209
|
+
lines.push('');
|
|
210
|
+
lines.push(`## Direct dependents (${impact.directDependents.length})`);
|
|
211
|
+
lines.push('');
|
|
212
|
+
lines.push(bullet(impact.directDependents.slice(0, 50).map((f) => `\`${f}\``)));
|
|
213
|
+
lines.push('');
|
|
214
|
+
lines.push(`## Transitive dependents (${impact.transitiveDependents.length})`);
|
|
215
|
+
lines.push('');
|
|
216
|
+
lines.push(bullet(impact.transitiveDependents.slice(0, 50).map((f) => `\`${f}\``)));
|
|
217
|
+
if (impact.dependencyPathExamples.length > 0) {
|
|
218
|
+
lines.push('');
|
|
219
|
+
lines.push('### Example dependency paths');
|
|
220
|
+
lines.push('');
|
|
221
|
+
for (const p of impact.dependencyPathExamples.slice(0, 5)) {
|
|
222
|
+
const chain = [p.from, ...p.via, p.to].map((x) => `\`${x}\``).join(' → ');
|
|
223
|
+
lines.push(`- ${chain}`);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
if (opts.tree !== false) {
|
|
227
|
+
const tree = buildImpactTree(impact, {
|
|
228
|
+
...(opts.treeDepth ? { depth: opts.treeDepth } : {}),
|
|
229
|
+
...(opts.treeWidth ? { width: opts.treeWidth } : {}),
|
|
230
|
+
});
|
|
231
|
+
lines.push('');
|
|
232
|
+
lines.push('## Dependency tree');
|
|
233
|
+
lines.push('');
|
|
234
|
+
lines.push('```');
|
|
235
|
+
lines.push(renderTreeText(tree));
|
|
236
|
+
lines.push('```');
|
|
237
|
+
}
|
|
238
|
+
if (impact.affectedPackages.length > 0) {
|
|
239
|
+
lines.push('');
|
|
240
|
+
lines.push(`## Affected packages`);
|
|
241
|
+
lines.push('');
|
|
242
|
+
for (const p of impact.affectedPackages)
|
|
243
|
+
lines.push(`- \`${p.name}\` (${p.fileCount})`);
|
|
244
|
+
}
|
|
245
|
+
if (impact.affectedOwnership && impact.affectedOwnership.owners.length > 0) {
|
|
246
|
+
lines.push('');
|
|
247
|
+
lines.push(`## Ownership`);
|
|
248
|
+
lines.push('');
|
|
249
|
+
lines.push(`Owners: ${impact.affectedOwnership.owners.join(', ') || '_none_'}`);
|
|
250
|
+
if (impact.affectedOwnership.requiredReviewFiles.length > 0) {
|
|
251
|
+
lines.push(`Requires review on: ${impact.affectedOwnership.requiredReviewFiles
|
|
252
|
+
.slice(0, 20)
|
|
253
|
+
.map((f) => '`' + f + '`')
|
|
254
|
+
.join(', ')}`);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
if (impact.potentialBoundaryRisks.length > 0) {
|
|
258
|
+
lines.push('');
|
|
259
|
+
lines.push(`## Boundary risks`);
|
|
260
|
+
lines.push('');
|
|
261
|
+
for (const b of impact.potentialBoundaryRisks)
|
|
262
|
+
lines.push(`- [${b.severity}] \`${b.ruleId}\` — ${b.reason}`);
|
|
263
|
+
}
|
|
264
|
+
if (impact.affectedPolicies.length > 0) {
|
|
265
|
+
lines.push('');
|
|
266
|
+
lines.push(`## Policy concerns`);
|
|
267
|
+
lines.push('');
|
|
268
|
+
for (const p of impact.affectedPolicies)
|
|
269
|
+
lines.push(`- [${p.severity}] **${p.policyId}** — ${p.reason}`);
|
|
270
|
+
}
|
|
271
|
+
lines.push('');
|
|
272
|
+
lines.push(`## Suggested tests`);
|
|
273
|
+
lines.push('');
|
|
274
|
+
for (const c of impact.suggestedTestCommands)
|
|
275
|
+
lines.push(`- \`${c}\``);
|
|
276
|
+
lines.push('');
|
|
277
|
+
lines.push(`## Suggested verification`);
|
|
278
|
+
lines.push('');
|
|
279
|
+
for (const c of impact.suggestedValidationCommands)
|
|
280
|
+
lines.push(`- \`${c}\``);
|
|
281
|
+
if (impact.suggestedReviewCommands.length > 0) {
|
|
282
|
+
lines.push('');
|
|
283
|
+
lines.push(`## Suggested review`);
|
|
284
|
+
lines.push('');
|
|
285
|
+
for (const c of impact.suggestedReviewCommands)
|
|
286
|
+
lines.push(`- \`${c}\``);
|
|
287
|
+
}
|
|
288
|
+
if (impact.truncations.length > 0) {
|
|
289
|
+
lines.push('');
|
|
290
|
+
lines.push(`## Truncations`);
|
|
291
|
+
lines.push('');
|
|
292
|
+
for (const t of impact.truncations)
|
|
293
|
+
lines.push(`- ${t.list}: ${t.shown}/${t.total}`);
|
|
294
|
+
}
|
|
295
|
+
lines.push('');
|
|
296
|
+
return lines.join('\n');
|
|
297
|
+
}
|
|
298
|
+
export function renderImpactHtml(impact, opts = {}) {
|
|
299
|
+
const badge = riskBadgeTag(impact.risk);
|
|
300
|
+
const parts = [];
|
|
301
|
+
parts.push('<!doctype html><html><head><meta charset="utf-8">');
|
|
302
|
+
parts.push(`<title>SharkCraft impact — ${escapeHtml(impact.task || impact.inputKind)}</title>`);
|
|
303
|
+
parts.push('<style>');
|
|
304
|
+
parts.push('body{font:14px/1.5 -apple-system,Segoe UI,Roboto,sans-serif;max-width:1080px;margin:24px auto;padding:0 16px;color:#1f2328;background:#fff}');
|
|
305
|
+
parts.push('h1{font-size:22px;border-bottom:1px solid #d0d7de;padding-bottom:8px}');
|
|
306
|
+
parts.push('h2{font-size:16px;margin-top:24px}');
|
|
307
|
+
parts.push('table{border-collapse:collapse;width:100%;margin:8px 0}');
|
|
308
|
+
parts.push('th,td{border:1px solid #d0d7de;padding:6px 10px;text-align:left;vertical-align:top}');
|
|
309
|
+
parts.push('th{background:#f6f8fa}');
|
|
310
|
+
parts.push('code,pre{background:#f6f8fa;padding:1px 4px;border-radius:4px;font-size:12px}');
|
|
311
|
+
parts.push('.tag{display:inline-block;padding:2px 10px;border-radius:9999px;font-size:11px;font-weight:700}');
|
|
312
|
+
parts.push('.tag.ok{background:#dafbe1;color:#1a7f37}');
|
|
313
|
+
parts.push('.tag.warn{background:#fff8c5;color:#9a6700}');
|
|
314
|
+
parts.push('.tag.fail{background:#ffebe9;color:#cf222e}');
|
|
315
|
+
parts.push('.impact-tree{list-style:none;padding-left:0}');
|
|
316
|
+
parts.push('.impact-tree ul{list-style:none;padding-left:18px;border-left:1px solid #d0d7de;margin:4px 0}');
|
|
317
|
+
parts.push('details>summary{cursor:pointer}');
|
|
318
|
+
parts.push('@media (prefers-color-scheme: dark){body{background:#0f1419;color:#e6e1cf}th{background:#1c2329}code,pre{background:#1c2329}.tag.ok{background:#1f4d2a;color:#bae67e}.tag.warn{background:#5a4a00;color:#ffd866}.tag.fail{background:#5a1f1f;color:#ff8a80}}');
|
|
319
|
+
parts.push('</style></head><body>');
|
|
320
|
+
parts.push(`<h1>Impact report <span class="tag ${badge}">${escapeHtml(impact.risk.toUpperCase())}</span></h1>`);
|
|
321
|
+
parts.push('<table>');
|
|
322
|
+
parts.push(`<tr><th>Input</th><td><code>${escapeHtml(impact.inputKind)}</code></td></tr>`);
|
|
323
|
+
if (impact.task)
|
|
324
|
+
parts.push(`<tr><th>Task</th><td>${escapeHtml(impact.task)}</td></tr>`);
|
|
325
|
+
if (impact.specifier)
|
|
326
|
+
parts.push(`<tr><th>Specifier</th><td><code>${escapeHtml(impact.specifier)}</code></td></tr>`);
|
|
327
|
+
parts.push(`<tr><th>Targets</th><td>${impact.normalizedTargets.length}</td></tr>`);
|
|
328
|
+
parts.push(`<tr><th>Direct</th><td>${impact.directDependents.length}</td></tr>`);
|
|
329
|
+
parts.push(`<tr><th>Transitive</th><td>${impact.transitiveDependents.length}</td></tr>`);
|
|
330
|
+
parts.push(`<tr><th>Boundary risks</th><td>${impact.potentialBoundaryRisks.length}</td></tr>`);
|
|
331
|
+
parts.push(`<tr><th>Policy concerns</th><td>${impact.affectedPolicies.length}</td></tr>`);
|
|
332
|
+
parts.push('</table>');
|
|
333
|
+
parts.push(`<p>${escapeHtml(impact.explanation)}</p>`);
|
|
334
|
+
parts.push('<h2>Targets</h2><ul>');
|
|
335
|
+
for (const f of impact.normalizedTargets)
|
|
336
|
+
parts.push(`<li><code>${escapeHtml(f)}</code></li>`);
|
|
337
|
+
parts.push('</ul>');
|
|
338
|
+
if (impact.riskReasons.length > 0) {
|
|
339
|
+
parts.push('<h2>Risk reasons</h2><ul>');
|
|
340
|
+
for (const r of impact.riskReasons)
|
|
341
|
+
parts.push(`<li><strong>${escapeHtml(r.code)}</strong> — ${escapeHtml(r.message)}</li>`);
|
|
342
|
+
parts.push('</ul>');
|
|
343
|
+
}
|
|
344
|
+
parts.push(`<h2>Direct dependents (${impact.directDependents.length})</h2>`);
|
|
345
|
+
if (impact.directDependents.length === 0)
|
|
346
|
+
parts.push('<p><em>(none)</em></p>');
|
|
347
|
+
else {
|
|
348
|
+
parts.push('<ul>');
|
|
349
|
+
for (const f of impact.directDependents.slice(0, 100))
|
|
350
|
+
parts.push(`<li><code>${escapeHtml(f)}</code></li>`);
|
|
351
|
+
parts.push('</ul>');
|
|
352
|
+
}
|
|
353
|
+
parts.push(`<h2>Transitive dependents (${impact.transitiveDependents.length})</h2>`);
|
|
354
|
+
if (impact.transitiveDependents.length === 0)
|
|
355
|
+
parts.push('<p><em>(none)</em></p>');
|
|
356
|
+
else {
|
|
357
|
+
parts.push('<ul>');
|
|
358
|
+
for (const f of impact.transitiveDependents.slice(0, 100))
|
|
359
|
+
parts.push(`<li><code>${escapeHtml(f)}</code></li>`);
|
|
360
|
+
parts.push('</ul>');
|
|
361
|
+
}
|
|
362
|
+
if (opts.tree !== false) {
|
|
363
|
+
const tree = buildImpactTree(impact, {
|
|
364
|
+
...(opts.treeDepth ? { depth: opts.treeDepth } : {}),
|
|
365
|
+
...(opts.treeWidth ? { width: opts.treeWidth } : {}),
|
|
366
|
+
});
|
|
367
|
+
parts.push('<h2>Dependency tree</h2>');
|
|
368
|
+
parts.push(renderTreeHtml(tree));
|
|
369
|
+
}
|
|
370
|
+
if (impact.affectedPackages.length > 0) {
|
|
371
|
+
parts.push('<h2>Affected packages</h2><ul>');
|
|
372
|
+
for (const p of impact.affectedPackages)
|
|
373
|
+
parts.push(`<li><code>${escapeHtml(p.name)}</code> (${p.fileCount})</li>`);
|
|
374
|
+
parts.push('</ul>');
|
|
375
|
+
}
|
|
376
|
+
if (impact.affectedOwnership?.owners.length) {
|
|
377
|
+
parts.push('<h2>Ownership</h2>');
|
|
378
|
+
parts.push(`<p>Owners: ${impact.affectedOwnership.owners.map((o) => escapeHtml(o)).join(', ')}</p>`);
|
|
379
|
+
if (impact.affectedOwnership.requiredReviewFiles.length > 0) {
|
|
380
|
+
parts.push('<p>Required review files:</p><ul>');
|
|
381
|
+
for (const f of impact.affectedOwnership.requiredReviewFiles)
|
|
382
|
+
parts.push(`<li><code>${escapeHtml(f)}</code></li>`);
|
|
383
|
+
parts.push('</ul>');
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
if (impact.potentialBoundaryRisks.length > 0) {
|
|
387
|
+
parts.push('<h2>Boundary risks</h2><ul>');
|
|
388
|
+
for (const b of impact.potentialBoundaryRisks)
|
|
389
|
+
parts.push(`<li><span class="tag warn">${escapeHtml(b.severity.toUpperCase())}</span> <code>${escapeHtml(b.ruleId)}</code> — ${escapeHtml(b.reason)}</li>`);
|
|
390
|
+
parts.push('</ul>');
|
|
391
|
+
}
|
|
392
|
+
if (impact.affectedPolicies.length > 0) {
|
|
393
|
+
parts.push('<h2>Policy concerns</h2><ul>');
|
|
394
|
+
for (const p of impact.affectedPolicies)
|
|
395
|
+
parts.push(`<li><span class="tag warn">${escapeHtml(p.severity.toUpperCase())}</span> <strong>${escapeHtml(p.policyId)}</strong> — ${escapeHtml(p.reason)}</li>`);
|
|
396
|
+
parts.push('</ul>');
|
|
397
|
+
}
|
|
398
|
+
parts.push('<h2>Suggested commands</h2>');
|
|
399
|
+
parts.push('<table><thead><tr><th>Kind</th><th>Command</th></tr></thead><tbody>');
|
|
400
|
+
for (const c of impact.suggestedTestCommands)
|
|
401
|
+
parts.push(`<tr><td>test</td><td><code>${escapeHtml(c)}</code></td></tr>`);
|
|
402
|
+
for (const c of impact.suggestedValidationCommands)
|
|
403
|
+
parts.push(`<tr><td>verify</td><td><code>${escapeHtml(c)}</code></td></tr>`);
|
|
404
|
+
for (const c of impact.suggestedReviewCommands)
|
|
405
|
+
parts.push(`<tr><td>review</td><td><code>${escapeHtml(c)}</code></td></tr>`);
|
|
406
|
+
parts.push('</tbody></table>');
|
|
407
|
+
if (impact.truncations.length > 0) {
|
|
408
|
+
parts.push('<h2>Truncations</h2><ul>');
|
|
409
|
+
for (const t of impact.truncations)
|
|
410
|
+
parts.push(`<li><code>${escapeHtml(t.list)}</code>: ${t.shown}/${t.total}</li>`);
|
|
411
|
+
parts.push('</ul>');
|
|
412
|
+
}
|
|
413
|
+
if (impact.diagnostics.length > 0) {
|
|
414
|
+
parts.push('<h2>Diagnostics</h2><ul>');
|
|
415
|
+
for (const d of impact.diagnostics)
|
|
416
|
+
parts.push(`<li>${escapeHtml(d)}</li>`);
|
|
417
|
+
parts.push('</ul>');
|
|
418
|
+
}
|
|
419
|
+
parts.push('<p><em>Generated by SharkCraft impact-analysis v2.</em></p>');
|
|
420
|
+
parts.push('</body></html>');
|
|
421
|
+
return parts.join('\n') + '\n';
|
|
422
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const IMPORT_GRAPH_ANALYSIS_SCHEMA = "sharkcraft.import-graph-analysis/v1";
|
|
2
|
+
export interface IImportGraphCycle {
|
|
3
|
+
nodes: readonly string[];
|
|
4
|
+
}
|
|
5
|
+
export interface IImportGraphAnalysis {
|
|
6
|
+
schema: typeof IMPORT_GRAPH_ANALYSIS_SCHEMA;
|
|
7
|
+
projectRoot: string;
|
|
8
|
+
filesScanned: number;
|
|
9
|
+
packageCount: number;
|
|
10
|
+
workspacePackages: readonly string[];
|
|
11
|
+
topFanIn: readonly {
|
|
12
|
+
file: string;
|
|
13
|
+
in: number;
|
|
14
|
+
}[];
|
|
15
|
+
topFanOut: readonly {
|
|
16
|
+
file: string;
|
|
17
|
+
out: number;
|
|
18
|
+
}[];
|
|
19
|
+
orphans: readonly string[];
|
|
20
|
+
cycles: readonly IImportGraphCycle[];
|
|
21
|
+
internalAliasGroups: readonly {
|
|
22
|
+
alias: string;
|
|
23
|
+
count: number;
|
|
24
|
+
}[];
|
|
25
|
+
unusedPublicEntrypoints: readonly string[];
|
|
26
|
+
}
|
|
27
|
+
export declare function analyzeImportGraph(projectRoot: string): IImportGraphAnalysis;
|
|
28
|
+
//# sourceMappingURL=import-graph-analysis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-graph-analysis.d.ts","sourceRoot":"","sources":["../src/import-graph-analysis.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,4BAA4B,wCAAwC,CAAC;AAElF,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,OAAO,4BAA4B,CAAC;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,EAAE,SAAS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAClD,SAAS,EAAE,SAAS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACpD,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,MAAM,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACrC,mBAAmB,EAAE,SAAS;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACjE,uBAAuB,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5C;AA6CD,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,oBAAoB,CAmF5E"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
|
2
|
+
import * as nodePath from 'node:path';
|
|
3
|
+
import { scanImports } from '@shrkcrft/boundaries';
|
|
4
|
+
export const IMPORT_GRAPH_ANALYSIS_SCHEMA = 'sharkcraft.import-graph-analysis/v1';
|
|
5
|
+
function detectWorkspacePackages(projectRoot) {
|
|
6
|
+
const pkgPath = nodePath.join(projectRoot, 'package.json');
|
|
7
|
+
if (!existsSync(pkgPath))
|
|
8
|
+
return [];
|
|
9
|
+
try {
|
|
10
|
+
const json = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
11
|
+
const ws = json.workspaces;
|
|
12
|
+
const raw = Array.isArray(ws)
|
|
13
|
+
? ws
|
|
14
|
+
: ws?.packages ?? [];
|
|
15
|
+
const names = [];
|
|
16
|
+
for (const pattern of raw) {
|
|
17
|
+
const dir = pattern.replace(/\/\*?$/, '');
|
|
18
|
+
const full = nodePath.join(projectRoot, dir);
|
|
19
|
+
if (!existsSync(full))
|
|
20
|
+
continue;
|
|
21
|
+
try {
|
|
22
|
+
for (const child of readdirSync(full)) {
|
|
23
|
+
const inner = nodePath.join(full, child);
|
|
24
|
+
try {
|
|
25
|
+
if (!statSync(inner).isDirectory())
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
const childPkg = nodePath.join(inner, 'package.json');
|
|
32
|
+
if (!existsSync(childPkg))
|
|
33
|
+
continue;
|
|
34
|
+
try {
|
|
35
|
+
const pj = JSON.parse(readFileSync(childPkg, 'utf8'));
|
|
36
|
+
if (pj.name)
|
|
37
|
+
names.push(pj.name);
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
/* ignore */
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
/* ignore */
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return names.sort();
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export function analyzeImportGraph(projectRoot) {
|
|
55
|
+
let scan;
|
|
56
|
+
try {
|
|
57
|
+
scan = scanImports({ projectRoot });
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
scan = { filesScanned: 0, edges: [], warnings: [] };
|
|
61
|
+
}
|
|
62
|
+
const workspacePackages = detectWorkspacePackages(projectRoot);
|
|
63
|
+
// Fan-in / fan-out by file.
|
|
64
|
+
const fanIn = new Map();
|
|
65
|
+
const fanOut = new Map();
|
|
66
|
+
const adj = new Map();
|
|
67
|
+
for (const e of scan.edges) {
|
|
68
|
+
if (e.kind !== 'internal')
|
|
69
|
+
continue;
|
|
70
|
+
const target = resolveRelative(e.from, e.importSpecifier);
|
|
71
|
+
if (!target)
|
|
72
|
+
continue;
|
|
73
|
+
fanOut.set(e.from, (fanOut.get(e.from) ?? 0) + 1);
|
|
74
|
+
fanIn.set(target, (fanIn.get(target) ?? 0) + 1);
|
|
75
|
+
const set = adj.get(e.from) ?? new Set();
|
|
76
|
+
set.add(target);
|
|
77
|
+
adj.set(e.from, set);
|
|
78
|
+
}
|
|
79
|
+
const topFanIn = [...fanIn.entries()]
|
|
80
|
+
.sort((a, b) => b[1] - a[1])
|
|
81
|
+
.slice(0, 10)
|
|
82
|
+
.map(([file, n]) => ({ file, in: n }));
|
|
83
|
+
const topFanOut = [...fanOut.entries()]
|
|
84
|
+
.sort((a, b) => b[1] - a[1])
|
|
85
|
+
.slice(0, 10)
|
|
86
|
+
.map(([file, n]) => ({ file, out: n }));
|
|
87
|
+
// Orphans: files we know about that have no incoming edges and are not entry-shaped.
|
|
88
|
+
const knownFiles = new Set();
|
|
89
|
+
for (const e of scan.edges)
|
|
90
|
+
knownFiles.add(e.from);
|
|
91
|
+
for (const t of fanIn.keys())
|
|
92
|
+
knownFiles.add(t);
|
|
93
|
+
const orphans = [];
|
|
94
|
+
for (const f of knownFiles) {
|
|
95
|
+
if ((fanIn.get(f) ?? 0) > 0)
|
|
96
|
+
continue;
|
|
97
|
+
if (isPublicEntry(f))
|
|
98
|
+
continue;
|
|
99
|
+
orphans.push(f);
|
|
100
|
+
}
|
|
101
|
+
orphans.sort();
|
|
102
|
+
// Cycles via Tarjan's SCC.
|
|
103
|
+
const cycles = stronglyConnectedComponents(adj).filter((c) => c.length > 1).map((nodes) => ({
|
|
104
|
+
nodes,
|
|
105
|
+
}));
|
|
106
|
+
// Internal alias groups: count occurrences of @org/* style specifiers.
|
|
107
|
+
const aliasCounts = new Map();
|
|
108
|
+
for (const e of scan.edges) {
|
|
109
|
+
if (e.kind === 'external' && e.importSpecifier.startsWith('@')) {
|
|
110
|
+
const top = e.importSpecifier.split('/').slice(0, 2).join('/');
|
|
111
|
+
aliasCounts.set(top, (aliasCounts.get(top) ?? 0) + 1);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const internalAliasGroups = [...aliasCounts.entries()]
|
|
115
|
+
.sort((a, b) => b[1] - a[1])
|
|
116
|
+
.map(([alias, count]) => ({ alias, count }))
|
|
117
|
+
.slice(0, 10);
|
|
118
|
+
// Unused public entrypoints: index.ts files that no other internal file imports.
|
|
119
|
+
const unusedPublicEntrypoints = [];
|
|
120
|
+
for (const f of knownFiles) {
|
|
121
|
+
if (!/\/index\.ts$/.test(f) && !/^index\.ts$/.test(f))
|
|
122
|
+
continue;
|
|
123
|
+
if ((fanIn.get(f) ?? 0) === 0)
|
|
124
|
+
unusedPublicEntrypoints.push(f);
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
schema: IMPORT_GRAPH_ANALYSIS_SCHEMA,
|
|
128
|
+
projectRoot,
|
|
129
|
+
filesScanned: scan.filesScanned,
|
|
130
|
+
packageCount: workspacePackages.length,
|
|
131
|
+
workspacePackages,
|
|
132
|
+
topFanIn,
|
|
133
|
+
topFanOut,
|
|
134
|
+
orphans: orphans.slice(0, 50),
|
|
135
|
+
cycles,
|
|
136
|
+
internalAliasGroups,
|
|
137
|
+
unusedPublicEntrypoints: unusedPublicEntrypoints.slice(0, 30),
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function resolveRelative(from, spec) {
|
|
141
|
+
if (!spec.startsWith('.'))
|
|
142
|
+
return null;
|
|
143
|
+
const dir = nodePath.posix.dirname(from);
|
|
144
|
+
const joined = nodePath.posix.normalize(nodePath.posix.join(dir, spec));
|
|
145
|
+
return joined;
|
|
146
|
+
}
|
|
147
|
+
function isPublicEntry(file) {
|
|
148
|
+
return (file.endsWith('/index.ts') ||
|
|
149
|
+
file === 'index.ts' ||
|
|
150
|
+
file.endsWith('/main.ts') ||
|
|
151
|
+
file === 'main.ts' ||
|
|
152
|
+
file.endsWith('.d.ts'));
|
|
153
|
+
}
|
|
154
|
+
function stronglyConnectedComponents(adj) {
|
|
155
|
+
let index = 0;
|
|
156
|
+
const stack = [];
|
|
157
|
+
const onStack = new Set();
|
|
158
|
+
const indices = new Map();
|
|
159
|
+
const lowlinks = new Map();
|
|
160
|
+
const result = [];
|
|
161
|
+
const strongconnect = (v) => {
|
|
162
|
+
indices.set(v, index);
|
|
163
|
+
lowlinks.set(v, index);
|
|
164
|
+
index += 1;
|
|
165
|
+
stack.push(v);
|
|
166
|
+
onStack.add(v);
|
|
167
|
+
for (const w of adj.get(v) ?? []) {
|
|
168
|
+
if (!indices.has(w)) {
|
|
169
|
+
strongconnect(w);
|
|
170
|
+
lowlinks.set(v, Math.min(lowlinks.get(v), lowlinks.get(w)));
|
|
171
|
+
}
|
|
172
|
+
else if (onStack.has(w)) {
|
|
173
|
+
lowlinks.set(v, Math.min(lowlinks.get(v), indices.get(w)));
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
if (lowlinks.get(v) === indices.get(v)) {
|
|
177
|
+
const scc = [];
|
|
178
|
+
while (true) {
|
|
179
|
+
const w = stack.pop();
|
|
180
|
+
onStack.delete(w);
|
|
181
|
+
scc.push(w);
|
|
182
|
+
if (w === v)
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
result.push(scc);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
for (const v of adj.keys()) {
|
|
189
|
+
if (!indices.has(v))
|
|
190
|
+
strongconnect(v);
|
|
191
|
+
}
|
|
192
|
+
return result;
|
|
193
|
+
}
|