@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,731 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-task risk model.
|
|
3
|
+
*
|
|
4
|
+
* Given a task string (plus optional file hints), compute a deterministic
|
|
5
|
+
* per-task risk report. Builds on:
|
|
6
|
+
* - change intent (kind / domain / required-human-review)
|
|
7
|
+
* - impact analysis (direct/transitive dependents, boundary concerns,
|
|
8
|
+
* policy concerns, ownership impact, missing tests)
|
|
9
|
+
* - architecture map signals (high fan-in / fan-out files)
|
|
10
|
+
*
|
|
11
|
+
* Pure data — read-only. No model calls, no embeddings, no telemetry.
|
|
12
|
+
*/
|
|
13
|
+
import { existsSync, statSync } from 'node:fs';
|
|
14
|
+
import * as nodePath from 'node:path';
|
|
15
|
+
import { classifyChangeIntent, ChangeIntentKind, } from "./change-intent.js";
|
|
16
|
+
import { loadRepositoryMemory } from "./repo-memory.js";
|
|
17
|
+
import { analyzeImpact, ImpactInputKind, } from "./impact-analysis.js";
|
|
18
|
+
import { buildArchitectureMap } from "./architecture-map.js";
|
|
19
|
+
import { getChangedFiles } from "./git-helpers.js";
|
|
20
|
+
export const TASK_RISK_SCHEMA = 'sharkcraft.task-risk/v1';
|
|
21
|
+
export var TaskRiskLevel;
|
|
22
|
+
(function (TaskRiskLevel) {
|
|
23
|
+
TaskRiskLevel["Low"] = "low";
|
|
24
|
+
TaskRiskLevel["Medium"] = "medium";
|
|
25
|
+
TaskRiskLevel["High"] = "high";
|
|
26
|
+
TaskRiskLevel["Critical"] = "critical";
|
|
27
|
+
})(TaskRiskLevel || (TaskRiskLevel = {}));
|
|
28
|
+
const HIGH_FAN_THRESHOLD = 40;
|
|
29
|
+
/** Maximum risk score added by memory adjustment. */
|
|
30
|
+
const MEMORY_SCORE_CAP = 14;
|
|
31
|
+
/** Index older than this is considered stale (days). */
|
|
32
|
+
const MEMORY_STALE_DAYS = 30;
|
|
33
|
+
function tokens(s) {
|
|
34
|
+
return s
|
|
35
|
+
.toLowerCase()
|
|
36
|
+
.split(/[^a-z0-9]+/)
|
|
37
|
+
.filter((t) => t.length >= 3);
|
|
38
|
+
}
|
|
39
|
+
function ageInDaysOrInfinity(iso) {
|
|
40
|
+
if (!iso)
|
|
41
|
+
return Infinity;
|
|
42
|
+
const ts = Date.parse(iso);
|
|
43
|
+
if (Number.isNaN(ts))
|
|
44
|
+
return Infinity;
|
|
45
|
+
return (Date.now() - ts) / (1000 * 60 * 60 * 24);
|
|
46
|
+
}
|
|
47
|
+
function buildMemoryReport(index, ctx) {
|
|
48
|
+
if (!index || index.sourceCount === 0) {
|
|
49
|
+
return {
|
|
50
|
+
missing: true,
|
|
51
|
+
stale: false,
|
|
52
|
+
rawScore: 0,
|
|
53
|
+
score: 0,
|
|
54
|
+
level: TaskRiskLevel.Low,
|
|
55
|
+
reasons: [],
|
|
56
|
+
signals: [],
|
|
57
|
+
capped: false,
|
|
58
|
+
cap: MEMORY_SCORE_CAP,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const stale = ageInDaysOrInfinity(index.generatedAt) > MEMORY_STALE_DAYS;
|
|
62
|
+
const signals = [];
|
|
63
|
+
const reasons = [];
|
|
64
|
+
let raw = 0;
|
|
65
|
+
// Helper to match historical files against affected files.
|
|
66
|
+
const fileSet = new Set(ctx.affectedFiles.map((f) => f.toLowerCase()));
|
|
67
|
+
// Files frequently in conflicts or failed validations.
|
|
68
|
+
let conflictFileHits = 0;
|
|
69
|
+
let failedValHits = 0;
|
|
70
|
+
let warningHits = 0;
|
|
71
|
+
let highTouchHits = 0;
|
|
72
|
+
for (const f of index.files) {
|
|
73
|
+
const key = f.path.toLowerCase();
|
|
74
|
+
let touchesTask = false;
|
|
75
|
+
if (fileSet.has(key))
|
|
76
|
+
touchesTask = true;
|
|
77
|
+
else if (ctx.taskTokens.some((t) => key.includes(t)))
|
|
78
|
+
touchesTask = true;
|
|
79
|
+
if (!touchesTask)
|
|
80
|
+
continue;
|
|
81
|
+
if (f.conflictCount > 0) {
|
|
82
|
+
conflictFileHits += 1;
|
|
83
|
+
signals.push({
|
|
84
|
+
code: 'memory-file-conflicts',
|
|
85
|
+
message: `File historically conflicted (${f.conflictCount}×): ${f.path}`,
|
|
86
|
+
weight: 2,
|
|
87
|
+
source: 'file',
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
if (f.failedValidationCount > 0) {
|
|
91
|
+
failedValHits += 1;
|
|
92
|
+
signals.push({
|
|
93
|
+
code: 'memory-file-failed-validations',
|
|
94
|
+
message: `File historically tied to failed validations: ${f.path}`,
|
|
95
|
+
weight: 2,
|
|
96
|
+
source: 'file',
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
if (f.warningCount >= 2) {
|
|
100
|
+
warningHits += 1;
|
|
101
|
+
signals.push({
|
|
102
|
+
code: 'memory-file-warnings',
|
|
103
|
+
message: `File historically warned (${f.warningCount}×): ${f.path}`,
|
|
104
|
+
weight: 1,
|
|
105
|
+
source: 'file',
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
if (f.touchCount >= 3 && f.conflictCount === 0 && f.failedValidationCount === 0 && f.warningCount === 0) {
|
|
109
|
+
highTouchHits += 1;
|
|
110
|
+
signals.push({
|
|
111
|
+
code: 'memory-file-hot-touch',
|
|
112
|
+
message: `Historically active file (${f.touchCount}×): ${f.path}`,
|
|
113
|
+
weight: 1,
|
|
114
|
+
source: 'file',
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (highTouchHits > 0) {
|
|
119
|
+
const w = Math.min(highTouchHits, 4);
|
|
120
|
+
raw += w;
|
|
121
|
+
reasons.push({
|
|
122
|
+
code: 'memory-touch-hotspot',
|
|
123
|
+
message: `${highTouchHits} historically active file(s) overlap the task.`,
|
|
124
|
+
weight: w,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
if (conflictFileHits > 0) {
|
|
128
|
+
const w = Math.min(conflictFileHits, 3) * 2;
|
|
129
|
+
raw += w;
|
|
130
|
+
reasons.push({
|
|
131
|
+
code: 'memory-conflict-hotspot',
|
|
132
|
+
message: `${conflictFileHits} historically conflict-prone file(s) overlap with the task.`,
|
|
133
|
+
weight: w,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
if (failedValHits > 0) {
|
|
137
|
+
const w = Math.min(failedValHits, 3) * 2;
|
|
138
|
+
raw += w;
|
|
139
|
+
reasons.push({
|
|
140
|
+
code: 'memory-failed-validation-hotspot',
|
|
141
|
+
message: `${failedValHits} file(s) overlapping the task have failed validations in history.`,
|
|
142
|
+
weight: w,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
if (warningHits > 0) {
|
|
146
|
+
const w = Math.min(warningHits, 3);
|
|
147
|
+
raw += w;
|
|
148
|
+
reasons.push({
|
|
149
|
+
code: 'memory-warning-hotspot',
|
|
150
|
+
message: `${warningHits} file(s) overlapping the task carry recurring warnings.`,
|
|
151
|
+
weight: w,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
// Recurring boundary violations relevant to the task.
|
|
155
|
+
for (const ruleId of index.boundaryViolationsRecurring) {
|
|
156
|
+
if (ctx.taskTokens.some((t) => ruleId.toLowerCase().includes(t)) ||
|
|
157
|
+
ctx.affectedConstructs.some((c) => ruleId.toLowerCase().includes(c.toLowerCase()))) {
|
|
158
|
+
signals.push({
|
|
159
|
+
code: 'memory-recurring-boundary',
|
|
160
|
+
message: `Recurring boundary rule overlaps: ${ruleId}`,
|
|
161
|
+
weight: 2,
|
|
162
|
+
source: 'boundary',
|
|
163
|
+
});
|
|
164
|
+
raw += 2;
|
|
165
|
+
reasons.push({
|
|
166
|
+
code: 'memory-recurring-boundary',
|
|
167
|
+
message: `Boundary rule "${ruleId}" has recurred historically and overlaps the task.`,
|
|
168
|
+
weight: 2,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
// Recurring policy violations relevant to the task.
|
|
173
|
+
for (const id of index.policyViolationsRecurring) {
|
|
174
|
+
if (ctx.taskTokens.some((t) => id.toLowerCase().includes(t))) {
|
|
175
|
+
signals.push({
|
|
176
|
+
code: 'memory-recurring-policy',
|
|
177
|
+
message: `Recurring policy: ${id}`,
|
|
178
|
+
weight: 2,
|
|
179
|
+
source: 'policy',
|
|
180
|
+
});
|
|
181
|
+
raw += 2;
|
|
182
|
+
reasons.push({
|
|
183
|
+
code: 'memory-recurring-policy',
|
|
184
|
+
message: `Policy "${id}" has recurred historically and overlaps the task.`,
|
|
185
|
+
weight: 2,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
// Recurring diagnostics overlapping the task.
|
|
190
|
+
let diagnosticHits = 0;
|
|
191
|
+
for (const d of index.diagnostics) {
|
|
192
|
+
if (ctx.taskTokens.some((t) => d.code.toLowerCase().includes(t))) {
|
|
193
|
+
diagnosticHits += 1;
|
|
194
|
+
signals.push({
|
|
195
|
+
code: 'memory-recurring-diagnostic',
|
|
196
|
+
message: `Recurring diagnostic ${d.code} (×${d.count})`,
|
|
197
|
+
weight: 1,
|
|
198
|
+
source: 'diagnostic',
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
if (diagnosticHits > 0) {
|
|
203
|
+
const w = Math.min(diagnosticHits, 3);
|
|
204
|
+
raw += w;
|
|
205
|
+
reasons.push({
|
|
206
|
+
code: 'memory-recurring-diagnostics',
|
|
207
|
+
message: `${diagnosticHits} historical diagnostic(s) overlap the task.`,
|
|
208
|
+
weight: w,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
// Historically risky construct overlap.
|
|
212
|
+
let constructHits = 0;
|
|
213
|
+
for (const c of index.highRiskConstructs) {
|
|
214
|
+
if (ctx.affectedConstructs.some((a) => a.toLowerCase() === c.id.toLowerCase()) ||
|
|
215
|
+
ctx.taskTokens.some((t) => c.id.toLowerCase().includes(t))) {
|
|
216
|
+
constructHits += 1;
|
|
217
|
+
signals.push({
|
|
218
|
+
code: 'memory-construct-hotspot',
|
|
219
|
+
message: `Historically active construct: ${c.id} (weight ${c.weight})`,
|
|
220
|
+
weight: 1,
|
|
221
|
+
source: 'construct',
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
if (constructHits > 0) {
|
|
226
|
+
const w = Math.min(constructHits, 3);
|
|
227
|
+
raw += w;
|
|
228
|
+
reasons.push({
|
|
229
|
+
code: 'memory-construct-hotspot',
|
|
230
|
+
message: `${constructHits} historically active construct(s) overlap the task.`,
|
|
231
|
+
weight: w,
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
// Plans with conflicts when the task references templates.
|
|
235
|
+
if (index.plansWithConflicts.length > 0 &&
|
|
236
|
+
ctx.taskTokens.some((t) => /plan|template|update|apply/.test(t))) {
|
|
237
|
+
const w = Math.min(index.plansWithConflicts.length, 3);
|
|
238
|
+
raw += w;
|
|
239
|
+
reasons.push({
|
|
240
|
+
code: 'memory-plans-conflict-history',
|
|
241
|
+
message: `${index.plansWithConflicts.length} historical plan(s) had conflicts.`,
|
|
242
|
+
weight: w,
|
|
243
|
+
});
|
|
244
|
+
signals.push({
|
|
245
|
+
code: 'memory-plans-conflict-history',
|
|
246
|
+
message: `${index.plansWithConflicts.length} historical plans had conflicts.`,
|
|
247
|
+
weight: w,
|
|
248
|
+
source: 'plan',
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
// Pack issues — broad signal.
|
|
252
|
+
if (index.packIssues.length > 0) {
|
|
253
|
+
const w = Math.min(index.packIssues.length, 2);
|
|
254
|
+
raw += w;
|
|
255
|
+
reasons.push({
|
|
256
|
+
code: 'memory-pack-issues',
|
|
257
|
+
message: `${index.packIssues.length} pack(s) flagged in history.`,
|
|
258
|
+
weight: w,
|
|
259
|
+
});
|
|
260
|
+
signals.push({
|
|
261
|
+
code: 'memory-pack-issues',
|
|
262
|
+
message: `${index.packIssues.length} pack(s) historically flagged.`,
|
|
263
|
+
weight: w,
|
|
264
|
+
source: 'pack',
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
// Stale memory dampens influence.
|
|
268
|
+
let score = raw;
|
|
269
|
+
if (stale) {
|
|
270
|
+
const before = score;
|
|
271
|
+
score = Math.floor(score * 0.5);
|
|
272
|
+
if (before !== score) {
|
|
273
|
+
reasons.push({
|
|
274
|
+
code: 'memory-stale',
|
|
275
|
+
message: `Memory index is older than ${MEMORY_STALE_DAYS} days — adjustment halved.`,
|
|
276
|
+
weight: score - before,
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
const capped = score > MEMORY_SCORE_CAP;
|
|
281
|
+
if (capped)
|
|
282
|
+
score = MEMORY_SCORE_CAP;
|
|
283
|
+
// Map memory score to its own level (for explainability).
|
|
284
|
+
const memLevel = classifyLevel(score);
|
|
285
|
+
const out = {
|
|
286
|
+
missing: false,
|
|
287
|
+
stale,
|
|
288
|
+
rawScore: raw,
|
|
289
|
+
score,
|
|
290
|
+
level: memLevel,
|
|
291
|
+
reasons,
|
|
292
|
+
signals,
|
|
293
|
+
capped,
|
|
294
|
+
cap: MEMORY_SCORE_CAP,
|
|
295
|
+
};
|
|
296
|
+
if (index.generatedAt)
|
|
297
|
+
out.indexGeneratedAt = index.generatedAt;
|
|
298
|
+
return out;
|
|
299
|
+
}
|
|
300
|
+
function unique(xs) {
|
|
301
|
+
return [...new Set(xs)].filter((x) => x.length > 0);
|
|
302
|
+
}
|
|
303
|
+
function classifyLevel(score) {
|
|
304
|
+
if (score >= 28)
|
|
305
|
+
return TaskRiskLevel.Critical;
|
|
306
|
+
if (score >= 16)
|
|
307
|
+
return TaskRiskLevel.High;
|
|
308
|
+
if (score >= 6)
|
|
309
|
+
return TaskRiskLevel.Medium;
|
|
310
|
+
return TaskRiskLevel.Low;
|
|
311
|
+
}
|
|
312
|
+
function intentBaseScore(intent) {
|
|
313
|
+
switch (intent.kind) {
|
|
314
|
+
case ChangeIntentKind.Release:
|
|
315
|
+
case ChangeIntentKind.Migration:
|
|
316
|
+
return 12;
|
|
317
|
+
case ChangeIntentKind.Architecture:
|
|
318
|
+
case ChangeIntentKind.Policy:
|
|
319
|
+
return 10;
|
|
320
|
+
case ChangeIntentKind.Refactor:
|
|
321
|
+
return 4;
|
|
322
|
+
case ChangeIntentKind.Feature:
|
|
323
|
+
return 3;
|
|
324
|
+
case ChangeIntentKind.Bugfix:
|
|
325
|
+
return 2;
|
|
326
|
+
case ChangeIntentKind.Test:
|
|
327
|
+
case ChangeIntentKind.Docs:
|
|
328
|
+
return 0;
|
|
329
|
+
default:
|
|
330
|
+
return 1;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
function summarizeFanFiles(files) {
|
|
334
|
+
const highIn = [];
|
|
335
|
+
const highOut = [];
|
|
336
|
+
for (const f of files) {
|
|
337
|
+
if (f.fanIn >= HIGH_FAN_THRESHOLD)
|
|
338
|
+
highIn.push(f.file);
|
|
339
|
+
if (f.fanOut >= HIGH_FAN_THRESHOLD)
|
|
340
|
+
highOut.push(f.file);
|
|
341
|
+
}
|
|
342
|
+
return { highIn: highIn.slice(0, 10), highOut: highOut.slice(0, 10) };
|
|
343
|
+
}
|
|
344
|
+
function isLikelyTouching(file, target) {
|
|
345
|
+
return file === target || file.endsWith('/' + target) || target.endsWith('/' + file);
|
|
346
|
+
}
|
|
347
|
+
async function inferFilesFromContext(inspection, options) {
|
|
348
|
+
const out = [];
|
|
349
|
+
if (options.files && options.files.length > 0) {
|
|
350
|
+
for (const f of options.files) {
|
|
351
|
+
const rel = f.startsWith(inspection.projectRoot)
|
|
352
|
+
? nodePath.relative(inspection.projectRoot, f)
|
|
353
|
+
: f.replace(/^\.\/?/, '');
|
|
354
|
+
out.push(rel.split(nodePath.sep).join('/'));
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
if (options.since || options.staged) {
|
|
358
|
+
try {
|
|
359
|
+
const changed = getChangedFiles(inspection.projectRoot, {
|
|
360
|
+
...(options.since ? { since: options.since } : {}),
|
|
361
|
+
...(options.staged ? { staged: true } : {}),
|
|
362
|
+
});
|
|
363
|
+
for (const c of changed)
|
|
364
|
+
out.push(c);
|
|
365
|
+
}
|
|
366
|
+
catch {
|
|
367
|
+
/* best-effort */
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return unique(out).filter((f) => existsSync(nodePath.join(inspection.projectRoot, f)) || /\.(ts|tsx|js|jsx|md|json)$/i.test(f));
|
|
371
|
+
}
|
|
372
|
+
function inferConstructsFromIntent(intent, inspection) {
|
|
373
|
+
const constructs = inspection.constructs;
|
|
374
|
+
if (!constructs)
|
|
375
|
+
return intent.likelyConstructs.slice(0, 10);
|
|
376
|
+
const hit = new Set(intent.likelyConstructs);
|
|
377
|
+
for (const c of constructs) {
|
|
378
|
+
if (intent.task.toLowerCase().includes(c.id.toLowerCase()))
|
|
379
|
+
hit.add(c.id);
|
|
380
|
+
}
|
|
381
|
+
return [...hit].slice(0, 10);
|
|
382
|
+
}
|
|
383
|
+
export async function buildTaskRiskReport(task, inspection, options = {}) {
|
|
384
|
+
const trimmed = task.trim();
|
|
385
|
+
const intent = await classifyChangeIntent(trimmed, inspection);
|
|
386
|
+
const files = await inferFilesFromContext(inspection, options);
|
|
387
|
+
const impactInput = {
|
|
388
|
+
task: trimmed,
|
|
389
|
+
inputKind: files.length > 0 ? ImpactInputKind.Files : ImpactInputKind.Task,
|
|
390
|
+
};
|
|
391
|
+
if (files.length > 0)
|
|
392
|
+
impactInput.files = files;
|
|
393
|
+
let impact = null;
|
|
394
|
+
try {
|
|
395
|
+
impact = await analyzeImpact(inspection, impactInput);
|
|
396
|
+
}
|
|
397
|
+
catch {
|
|
398
|
+
impact = null;
|
|
399
|
+
}
|
|
400
|
+
const arch = await buildArchitectureMap(inspection, { signals: true });
|
|
401
|
+
const reasons = [];
|
|
402
|
+
let score = intentBaseScore(intent);
|
|
403
|
+
if (score > 0) {
|
|
404
|
+
reasons.push({
|
|
405
|
+
code: `intent-${intent.kind}`,
|
|
406
|
+
message: `Intent ${intent.kind} carries baseline risk weight ${score}.`,
|
|
407
|
+
weight: score,
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
// Boundary violation reasons
|
|
411
|
+
const boundaryConcerns = [];
|
|
412
|
+
if (arch.boundaryViolationCounts.error > 0) {
|
|
413
|
+
const w = Math.min(arch.boundaryViolationCounts.error, 5) * 3;
|
|
414
|
+
score += w;
|
|
415
|
+
reasons.push({
|
|
416
|
+
code: 'boundary-violations-error',
|
|
417
|
+
message: `Repository has ${arch.boundaryViolationCounts.error} boundary violation(s) at error severity.`,
|
|
418
|
+
weight: w,
|
|
419
|
+
});
|
|
420
|
+
boundaryConcerns.push(`${arch.boundaryViolationCounts.error} boundary error(s) outstanding.`);
|
|
421
|
+
}
|
|
422
|
+
if (arch.boundaryViolationCounts.warning > 0) {
|
|
423
|
+
score += 1;
|
|
424
|
+
boundaryConcerns.push(`${arch.boundaryViolationCounts.warning} boundary warning(s) outstanding.`);
|
|
425
|
+
}
|
|
426
|
+
// Impact-driven reasons
|
|
427
|
+
const policyConcerns = [];
|
|
428
|
+
const ownershipGaps = [];
|
|
429
|
+
const testGaps = [];
|
|
430
|
+
if (impact) {
|
|
431
|
+
if (impact.directDependents.length > 5) {
|
|
432
|
+
const w = 6;
|
|
433
|
+
score += w;
|
|
434
|
+
reasons.push({
|
|
435
|
+
code: 'many-direct-dependents',
|
|
436
|
+
message: `${impact.directDependents.length} direct dependents.`,
|
|
437
|
+
weight: w,
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
if (impact.transitiveDependents.length > 25) {
|
|
441
|
+
const w = 8;
|
|
442
|
+
score += w;
|
|
443
|
+
reasons.push({
|
|
444
|
+
code: 'large-transitive-closure',
|
|
445
|
+
message: `${impact.transitiveDependents.length} transitive dependents.`,
|
|
446
|
+
weight: w,
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
if (impact.potentialBoundaryRisks.length > 0) {
|
|
450
|
+
const w = Math.min(impact.potentialBoundaryRisks.length, 3) * 2;
|
|
451
|
+
score += w;
|
|
452
|
+
reasons.push({
|
|
453
|
+
code: 'boundary-rule-impact',
|
|
454
|
+
message: `${impact.potentialBoundaryRisks.length} boundary rule(s) potentially impacted.`,
|
|
455
|
+
weight: w,
|
|
456
|
+
});
|
|
457
|
+
for (const b of impact.potentialBoundaryRisks)
|
|
458
|
+
boundaryConcerns.push(`${b.ruleId} — ${b.reason}`);
|
|
459
|
+
}
|
|
460
|
+
if (impact.affectedPolicies.length > 0) {
|
|
461
|
+
const w = 4;
|
|
462
|
+
score += w;
|
|
463
|
+
reasons.push({
|
|
464
|
+
code: 'policy-impact',
|
|
465
|
+
message: `${impact.affectedPolicies.length} policy concern(s).`,
|
|
466
|
+
weight: w,
|
|
467
|
+
});
|
|
468
|
+
for (const p of impact.affectedPolicies)
|
|
469
|
+
policyConcerns.push(`${p.policyId} — ${p.reason}`);
|
|
470
|
+
}
|
|
471
|
+
if ((impact.affectedOwnership?.requiredReviewFiles.length ?? 0) > 0) {
|
|
472
|
+
const w = 5;
|
|
473
|
+
score += w;
|
|
474
|
+
reasons.push({
|
|
475
|
+
code: 'ownership-required-review',
|
|
476
|
+
message: `${impact.affectedOwnership?.requiredReviewFiles.length} ownership-protected file(s).`,
|
|
477
|
+
weight: w,
|
|
478
|
+
});
|
|
479
|
+
for (const f of impact.affectedOwnership?.requiredReviewFiles ?? [])
|
|
480
|
+
ownershipGaps.push(f);
|
|
481
|
+
}
|
|
482
|
+
else if (files.length > 0 && (impact.affectedOwnership?.matches.length ?? 0) === 0) {
|
|
483
|
+
ownershipGaps.push('No ownership rules match the affected files.');
|
|
484
|
+
}
|
|
485
|
+
if (impact.likelyTests.length === 0 && files.length > 0) {
|
|
486
|
+
const w = 4;
|
|
487
|
+
score += w;
|
|
488
|
+
reasons.push({
|
|
489
|
+
code: 'no-likely-tests',
|
|
490
|
+
message: 'No likely tests detected for the affected files.',
|
|
491
|
+
weight: w,
|
|
492
|
+
});
|
|
493
|
+
testGaps.push('No co-located tests found.');
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
// High-impact files within affected set
|
|
497
|
+
const archHigh = summarizeFanFiles(arch.highImpactFiles);
|
|
498
|
+
const highFanInFiles = [];
|
|
499
|
+
const highFanOutFiles = [];
|
|
500
|
+
if (files.length > 0) {
|
|
501
|
+
for (const f of files) {
|
|
502
|
+
if (archHigh.highIn.some((hi) => isLikelyTouching(f, hi) || isLikelyTouching(hi, f)))
|
|
503
|
+
highFanInFiles.push(f);
|
|
504
|
+
if (archHigh.highOut.some((ho) => isLikelyTouching(f, ho) || isLikelyTouching(ho, f)))
|
|
505
|
+
highFanOutFiles.push(f);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
// Also surface global high-impact files mentioned in the task text
|
|
509
|
+
for (const hi of archHigh.highIn) {
|
|
510
|
+
if (trimmed.toLowerCase().includes(hi.toLowerCase()) && !highFanInFiles.includes(hi))
|
|
511
|
+
highFanInFiles.push(hi);
|
|
512
|
+
}
|
|
513
|
+
if (highFanInFiles.length > 0) {
|
|
514
|
+
const w = 5;
|
|
515
|
+
score += w;
|
|
516
|
+
reasons.push({
|
|
517
|
+
code: 'high-fan-in-file',
|
|
518
|
+
message: `${highFanInFiles.length} affected file(s) have high fan-in.`,
|
|
519
|
+
weight: w,
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
if (highFanOutFiles.length > 0) {
|
|
523
|
+
const w = 3;
|
|
524
|
+
score += w;
|
|
525
|
+
reasons.push({
|
|
526
|
+
code: 'high-fan-out-file',
|
|
527
|
+
message: `${highFanOutFiles.length} affected file(s) have high fan-out.`,
|
|
528
|
+
weight: w,
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
// No-tests-in-repo escalation
|
|
532
|
+
if (arch.graphSummary.tests === 0) {
|
|
533
|
+
const w = 3;
|
|
534
|
+
score += w;
|
|
535
|
+
reasons.push({
|
|
536
|
+
code: 'repo-has-no-tests',
|
|
537
|
+
message: 'Repository has no tests; any change is harder to verify.',
|
|
538
|
+
weight: w,
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
// Public-API hint
|
|
542
|
+
const publicApiTouch = files.some((f) => f.endsWith('/index.ts') ||
|
|
543
|
+
f.includes('plugin-api/') ||
|
|
544
|
+
f.includes('public-api/'));
|
|
545
|
+
if (publicApiTouch) {
|
|
546
|
+
const w = 6;
|
|
547
|
+
score += w;
|
|
548
|
+
reasons.push({
|
|
549
|
+
code: 'public-api-touch',
|
|
550
|
+
message: 'Affected files include a public API surface.',
|
|
551
|
+
weight: w,
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
if (intent.requiredHumanReview) {
|
|
555
|
+
const w = 2;
|
|
556
|
+
score += w;
|
|
557
|
+
reasons.push({
|
|
558
|
+
code: 'intent-requires-review',
|
|
559
|
+
message: 'Intent classifier flagged this task as requiring human review.',
|
|
560
|
+
weight: w,
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
const baseScore = score;
|
|
564
|
+
const baseRiskLevel = classifyLevel(baseScore);
|
|
565
|
+
// Memory-weighted risk pass. Memory can only raise risk (never lower).
|
|
566
|
+
let memory;
|
|
567
|
+
const inferredConstructs = inferConstructsFromIntent(intent, inspection);
|
|
568
|
+
if (options.includeMemory) {
|
|
569
|
+
const index = loadRepositoryMemory(inspection.projectRoot);
|
|
570
|
+
memory = buildMemoryReport(index, {
|
|
571
|
+
taskTokens: tokens(trimmed),
|
|
572
|
+
affectedFiles: files,
|
|
573
|
+
affectedConstructs: inferredConstructs,
|
|
574
|
+
});
|
|
575
|
+
if (memory.score > 0) {
|
|
576
|
+
score += memory.score;
|
|
577
|
+
reasons.push({
|
|
578
|
+
code: 'memory-adjustment',
|
|
579
|
+
message: `Memory adjustment +${memory.score}${memory.capped ? ` (capped at ${memory.cap})` : ''}.`,
|
|
580
|
+
weight: memory.score,
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
const riskLevel = classifyLevel(score);
|
|
585
|
+
const recommendedReviewCommands = [
|
|
586
|
+
'shrk brief "' + (trimmed || '<task>') + '"',
|
|
587
|
+
'shrk impact --since main --format json',
|
|
588
|
+
'shrk architecture map --risk --signals',
|
|
589
|
+
'shrk policy run --explain-overrides',
|
|
590
|
+
];
|
|
591
|
+
if (publicApiTouch)
|
|
592
|
+
recommendedReviewCommands.push('shrk api report --all --public-only');
|
|
593
|
+
if (ownershipGaps.length > 0)
|
|
594
|
+
recommendedReviewCommands.push('shrk owners impact');
|
|
595
|
+
if (testGaps.length > 0)
|
|
596
|
+
recommendedReviewCommands.push('shrk tests missing --since main');
|
|
597
|
+
if (memory && memory.score > 0)
|
|
598
|
+
recommendedReviewCommands.push('shrk memory risk "' + (trimmed || '<task>') + '"');
|
|
599
|
+
const humanApprovalRequired = riskLevel === TaskRiskLevel.High ||
|
|
600
|
+
riskLevel === TaskRiskLevel.Critical ||
|
|
601
|
+
intent.requiredHumanReview;
|
|
602
|
+
const out = {
|
|
603
|
+
schema: TASK_RISK_SCHEMA,
|
|
604
|
+
generatedAt: new Date().toISOString(),
|
|
605
|
+
task: trimmed,
|
|
606
|
+
intent,
|
|
607
|
+
riskLevel,
|
|
608
|
+
score,
|
|
609
|
+
reasons,
|
|
610
|
+
affectedFiles: files,
|
|
611
|
+
affectedConstructs: inferredConstructs,
|
|
612
|
+
highFanInFiles,
|
|
613
|
+
highFanOutFiles,
|
|
614
|
+
ownershipGaps: [...new Set(ownershipGaps)].slice(0, 10),
|
|
615
|
+
testGaps: [...new Set(testGaps)].slice(0, 10),
|
|
616
|
+
boundaryConcerns: [...new Set(boundaryConcerns)].slice(0, 10),
|
|
617
|
+
policyConcerns: [...new Set(policyConcerns)].slice(0, 10),
|
|
618
|
+
recommendedReviewCommands,
|
|
619
|
+
humanApprovalRequired,
|
|
620
|
+
baseScore,
|
|
621
|
+
baseRiskLevel,
|
|
622
|
+
adjustedScore: score,
|
|
623
|
+
adjustedRiskLevel: riskLevel,
|
|
624
|
+
};
|
|
625
|
+
if (memory)
|
|
626
|
+
out.memory = memory;
|
|
627
|
+
return out;
|
|
628
|
+
}
|
|
629
|
+
export function renderTaskRiskText(r) {
|
|
630
|
+
const lines = [];
|
|
631
|
+
lines.push('=== Task risk ===');
|
|
632
|
+
lines.push(` task ${r.task}`);
|
|
633
|
+
lines.push(` intent ${r.intent.kind} (confidence ${r.intent.confidence})`);
|
|
634
|
+
lines.push(` risk level ${r.riskLevel}`);
|
|
635
|
+
lines.push(` score ${r.score}`);
|
|
636
|
+
if (r.memory) {
|
|
637
|
+
lines.push(` base score ${r.baseScore} (${r.baseRiskLevel})`);
|
|
638
|
+
lines.push(` memory adj +${r.memory.score}${r.memory.capped ? ` (capped at ${r.memory.cap})` : ''}${r.memory.missing ? ' — index missing' : ''}${r.memory.stale ? ' — index stale' : ''}`);
|
|
639
|
+
}
|
|
640
|
+
lines.push(` human approval ${r.humanApprovalRequired ? 'yes' : 'no'}`);
|
|
641
|
+
if (r.affectedFiles.length > 0) {
|
|
642
|
+
lines.push('Affected files:');
|
|
643
|
+
for (const f of r.affectedFiles.slice(0, 10))
|
|
644
|
+
lines.push(` • ${f}`);
|
|
645
|
+
}
|
|
646
|
+
if (r.highFanInFiles.length > 0)
|
|
647
|
+
lines.push('High fan-in: ' + r.highFanInFiles.join(', '));
|
|
648
|
+
if (r.highFanOutFiles.length > 0)
|
|
649
|
+
lines.push('High fan-out: ' + r.highFanOutFiles.join(', '));
|
|
650
|
+
if (r.boundaryConcerns.length > 0) {
|
|
651
|
+
lines.push('Boundary concerns:');
|
|
652
|
+
for (const b of r.boundaryConcerns)
|
|
653
|
+
lines.push(` • ${b}`);
|
|
654
|
+
}
|
|
655
|
+
if (r.policyConcerns.length > 0) {
|
|
656
|
+
lines.push('Policy concerns:');
|
|
657
|
+
for (const p of r.policyConcerns)
|
|
658
|
+
lines.push(` • ${p}`);
|
|
659
|
+
}
|
|
660
|
+
if (r.ownershipGaps.length > 0) {
|
|
661
|
+
lines.push('Ownership gaps:');
|
|
662
|
+
for (const o of r.ownershipGaps)
|
|
663
|
+
lines.push(` • ${o}`);
|
|
664
|
+
}
|
|
665
|
+
if (r.testGaps.length > 0) {
|
|
666
|
+
lines.push('Test gaps:');
|
|
667
|
+
for (const t of r.testGaps)
|
|
668
|
+
lines.push(` • ${t}`);
|
|
669
|
+
}
|
|
670
|
+
lines.push('Reasons:');
|
|
671
|
+
for (const reason of r.reasons)
|
|
672
|
+
lines.push(` • [${reason.code}] ${reason.message} (+${reason.weight})`);
|
|
673
|
+
lines.push('Recommended review:');
|
|
674
|
+
for (const c of r.recommendedReviewCommands)
|
|
675
|
+
lines.push(` $ ${c}`);
|
|
676
|
+
return lines.join('\n') + '\n';
|
|
677
|
+
}
|
|
678
|
+
export function renderTaskRiskMarkdown(r) {
|
|
679
|
+
const lines = [];
|
|
680
|
+
lines.push(`# Task risk — ${r.task || '(empty)'}`);
|
|
681
|
+
lines.push('');
|
|
682
|
+
lines.push(`- intent: **${r.intent.kind}** (confidence ${r.intent.confidence})`);
|
|
683
|
+
lines.push(`- risk: **${r.riskLevel}** (score ${r.score})`);
|
|
684
|
+
if (r.memory) {
|
|
685
|
+
lines.push(`- base: **${r.baseRiskLevel}** (score ${r.baseScore})`);
|
|
686
|
+
lines.push(`- memory adjustment: **+${r.memory.score}**${r.memory.capped ? ` _(capped at ${r.memory.cap})_` : ''}${r.memory.missing ? ' _(index missing)_' : ''}${r.memory.stale ? ' _(index stale)_' : ''}`);
|
|
687
|
+
}
|
|
688
|
+
lines.push(`- human approval: ${r.humanApprovalRequired ? '**yes**' : 'no'}`);
|
|
689
|
+
lines.push('');
|
|
690
|
+
if (r.memory && r.memory.signals.length > 0) {
|
|
691
|
+
lines.push('## Memory signals');
|
|
692
|
+
for (const s of r.memory.signals.slice(0, 12))
|
|
693
|
+
lines.push(`- [${s.source}] ${s.message} (+${s.weight})`);
|
|
694
|
+
lines.push('');
|
|
695
|
+
}
|
|
696
|
+
if (r.affectedFiles.length > 0) {
|
|
697
|
+
lines.push('## Affected files');
|
|
698
|
+
for (const f of r.affectedFiles)
|
|
699
|
+
lines.push(`- \`${f}\``);
|
|
700
|
+
lines.push('');
|
|
701
|
+
}
|
|
702
|
+
if (r.boundaryConcerns.length > 0) {
|
|
703
|
+
lines.push('## Boundary concerns');
|
|
704
|
+
for (const b of r.boundaryConcerns)
|
|
705
|
+
lines.push(`- ${b}`);
|
|
706
|
+
lines.push('');
|
|
707
|
+
}
|
|
708
|
+
if (r.policyConcerns.length > 0) {
|
|
709
|
+
lines.push('## Policy concerns');
|
|
710
|
+
for (const p of r.policyConcerns)
|
|
711
|
+
lines.push(`- ${p}`);
|
|
712
|
+
lines.push('');
|
|
713
|
+
}
|
|
714
|
+
lines.push('## Reasons');
|
|
715
|
+
for (const reason of r.reasons)
|
|
716
|
+
lines.push(`- **${reason.code}** (+${reason.weight}) — ${reason.message}`);
|
|
717
|
+
lines.push('');
|
|
718
|
+
lines.push('## Recommended review');
|
|
719
|
+
for (const c of r.recommendedReviewCommands)
|
|
720
|
+
lines.push(`- \`${c}\``);
|
|
721
|
+
return lines.join('\n') + '\n';
|
|
722
|
+
}
|
|
723
|
+
export function summarizeTaskRisk(r) {
|
|
724
|
+
return `task-risk=${r.riskLevel} score=${r.score} reasons=${r.reasons.length}`;
|
|
725
|
+
}
|
|
726
|
+
// Internal helper used by tests
|
|
727
|
+
export function _classifyLevel(score) {
|
|
728
|
+
return classifyLevel(score);
|
|
729
|
+
}
|
|
730
|
+
// Used to silence unused-import lint when nothing else uses statSync
|
|
731
|
+
void statSync;
|