projscan 4.3.1 → 4.5.0
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/CONTRIBUTING.md +5 -1
- package/PRIVACY.md +1 -0
- package/README.md +278 -231
- package/THIRD-PARTY-NOTICES.md +31 -31
- package/dist/analyzers/architectureCheck.js.map +1 -1
- package/dist/analyzers/crossPackageImportCheck.js +3 -2
- package/dist/analyzers/crossPackageImportCheck.js.map +1 -1
- package/dist/analyzers/deadCodeCheck.js +10 -2
- package/dist/analyzers/deadCodeCheck.js.map +1 -1
- package/dist/analyzers/dependencyRiskCheck.js +1 -5
- package/dist/analyzers/dependencyRiskCheck.js.map +1 -1
- package/dist/analyzers/eslintCheck.js +3 -1
- package/dist/analyzers/eslintCheck.js.map +1 -1
- package/dist/analyzers/prettierCheck.js +16 -3
- package/dist/analyzers/prettierCheck.js.map +1 -1
- package/dist/analyzers/pythonDependencyRiskCheck.js +4 -17
- package/dist/analyzers/pythonDependencyRiskCheck.js.map +1 -1
- package/dist/analyzers/pythonLinterCheck.js +2 -12
- package/dist/analyzers/pythonLinterCheck.js.map +1 -1
- package/dist/analyzers/securityCheck.js +26 -9
- package/dist/analyzers/securityCheck.js.map +1 -1
- package/dist/analyzers/supplyChainCheck.js +6 -2
- package/dist/analyzers/supplyChainCheck.js.map +1 -1
- package/dist/analyzers/testCheck.js +10 -1
- package/dist/analyzers/testCheck.js.map +1 -1
- package/dist/analyzers/unusedDependencyCheck.js +8 -8
- package/dist/analyzers/unusedDependencyCheck.js.map +1 -1
- package/dist/cli/_shared.d.ts +2 -1
- package/dist/cli/_shared.js +14 -2
- package/dist/cli/_shared.js.map +1 -1
- package/dist/cli/commands/agentBrief.js +7 -1
- package/dist/cli/commands/agentBrief.js.map +1 -1
- package/dist/cli/commands/analyze.js +12 -2
- package/dist/cli/commands/analyze.js.map +1 -1
- package/dist/cli/commands/applyFix.js +1 -1
- package/dist/cli/commands/applyFix.js.map +1 -1
- package/dist/cli/commands/audit.js +4 -2
- package/dist/cli/commands/audit.js.map +1 -1
- package/dist/cli/commands/badge.js.map +1 -1
- package/dist/cli/commands/bugHunt.js +2 -2
- package/dist/cli/commands/bugHunt.js.map +1 -1
- package/dist/cli/commands/ci.js +11 -0
- package/dist/cli/commands/ci.js.map +1 -1
- package/dist/cli/commands/claim.js +3 -3
- package/dist/cli/commands/claim.js.map +1 -1
- package/dist/cli/commands/collision.js +4 -2
- package/dist/cli/commands/collision.js.map +1 -1
- package/dist/cli/commands/coordinate.js +4 -2
- package/dist/cli/commands/coordinate.js.map +1 -1
- package/dist/cli/commands/coupling.js.map +1 -1
- package/dist/cli/commands/coverage.js.map +1 -1
- package/dist/cli/commands/dataflow.js.map +1 -1
- package/dist/cli/commands/dependencies.js +1 -1
- package/dist/cli/commands/dependencies.js.map +1 -1
- package/dist/cli/commands/diff.js.map +1 -1
- package/dist/cli/commands/doctor.js +11 -0
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/dogfood.js +30 -5
- package/dist/cli/commands/dogfood.js.map +1 -1
- package/dist/cli/commands/evidencePack.js.map +1 -1
- package/dist/cli/commands/explainIssue.js +1 -1
- package/dist/cli/commands/explainIssue.js.map +1 -1
- package/dist/cli/commands/feedback.js +19 -5
- package/dist/cli/commands/feedback.js.map +1 -1
- package/dist/cli/commands/file.js +1 -1
- package/dist/cli/commands/file.js.map +1 -1
- package/dist/cli/commands/fix.js.map +1 -1
- package/dist/cli/commands/fixSuggest.js +12 -4
- package/dist/cli/commands/fixSuggest.js.map +1 -1
- package/dist/cli/commands/hotspots.js.map +1 -1
- package/dist/cli/commands/impact.js +1 -1
- package/dist/cli/commands/impact.js.map +1 -1
- package/dist/cli/commands/init.js +13 -5
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/installHook.js +2 -2
- package/dist/cli/commands/installHook.js.map +1 -1
- package/dist/cli/commands/mcp.js.map +1 -1
- package/dist/cli/commands/memory.js +5 -2
- package/dist/cli/commands/memory.js.map +1 -1
- package/dist/cli/commands/mergeRisk.js +1 -1
- package/dist/cli/commands/mergeRisk.js.map +1 -1
- package/dist/cli/commands/missionProof.js +13 -12
- package/dist/cli/commands/missionProof.js.map +1 -1
- package/dist/cli/commands/outdated.js +1 -1
- package/dist/cli/commands/outdated.js.map +1 -1
- package/dist/cli/commands/plugin.js +10 -6
- package/dist/cli/commands/plugin.js.map +1 -1
- package/dist/cli/commands/prDiff.js +1 -1
- package/dist/cli/commands/prDiff.js.map +1 -1
- package/dist/cli/commands/preflight.js +1 -5
- package/dist/cli/commands/preflight.js.map +1 -1
- package/dist/cli/commands/privacyCheck.js +3 -1
- package/dist/cli/commands/privacyCheck.js.map +1 -1
- package/dist/cli/commands/qualityScorecard.js.map +1 -1
- package/dist/cli/commands/recipes.js.map +1 -1
- package/dist/cli/commands/regressionPlan.js.map +1 -1
- package/dist/cli/commands/releaseTrain.js.map +1 -1
- package/dist/cli/commands/review.js +1 -1
- package/dist/cli/commands/review.js.map +1 -1
- package/dist/cli/commands/route.js.map +1 -1
- package/dist/cli/commands/search.js +5 -2
- package/dist/cli/commands/search.js.map +1 -1
- package/dist/cli/commands/semanticGraph.js.map +1 -1
- package/dist/cli/commands/session.js +2 -2
- package/dist/cli/commands/session.js.map +1 -1
- package/dist/cli/commands/start.js +3 -1177
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/startAction.d.ts +36 -0
- package/dist/cli/commands/startAction.js +70 -0
- package/dist/cli/commands/startAction.js.map +1 -0
- package/dist/cli/commands/startConsole.d.ts +7 -0
- package/dist/cli/commands/startConsole.js +309 -0
- package/dist/cli/commands/startConsole.js.map +1 -0
- package/dist/cli/commands/startMissionBundle.d.ts +41 -0
- package/dist/cli/commands/startMissionBundle.js +645 -0
- package/dist/cli/commands/startMissionBundle.js.map +1 -0
- package/dist/cli/commands/startOutput.d.ts +31 -0
- package/dist/cli/commands/startOutput.js +232 -0
- package/dist/cli/commands/startOutput.js.map +1 -0
- package/dist/cli/commands/startShortcuts.d.ts +26 -0
- package/dist/cli/commands/startShortcuts.js +117 -0
- package/dist/cli/commands/startShortcuts.js.map +1 -0
- package/dist/cli/commands/telemetry.js +2 -1
- package/dist/cli/commands/telemetry.js.map +1 -1
- package/dist/cli/commands/trial.js +19 -4
- package/dist/cli/commands/trial.js.map +1 -1
- package/dist/cli/commands/understand.js +3 -1
- package/dist/cli/commands/understand.js.map +1 -1
- package/dist/cli/commands/upgrade.js +1 -1
- package/dist/cli/commands/upgrade.js.map +1 -1
- package/dist/cli/commands/watch.js +1 -1
- package/dist/cli/commands/watch.js.map +1 -1
- package/dist/cli/commands/workplan.js.map +1 -1
- package/dist/cli/commands/workspace.js +1 -1
- package/dist/cli/commands/workspace.js.map +1 -1
- package/dist/cli/commands/workspaces.js +1 -1
- package/dist/cli/commands/workspaces.js.map +1 -1
- package/dist/cli/index.js +2 -117
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/registerCommands.d.ts +4 -0
- package/dist/cli/registerCommands.js +125 -0
- package/dist/cli/registerCommands.js.map +1 -0
- package/dist/core/adoption.d.ts +2 -1
- package/dist/core/adoption.js +40 -13
- package/dist/core/adoption.js.map +1 -1
- package/dist/core/agentBrief.js +19 -6
- package/dist/core/agentBrief.js.map +1 -1
- package/dist/core/applyFix.js.map +1 -1
- package/dist/core/ast.d.ts +5 -0
- package/dist/core/ast.js +38 -20
- package/dist/core/ast.js.map +1 -1
- package/dist/core/auditRunner.js.map +1 -1
- package/dist/core/bugHunt.js +119 -17
- package/dist/core/bugHunt.js.map +1 -1
- package/dist/core/claims.js +5 -2
- package/dist/core/claims.js.map +1 -1
- package/dist/core/codeGraph.js +10 -0
- package/dist/core/codeGraph.js.map +1 -1
- package/dist/core/codeGraphReexports.d.ts +9 -0
- package/dist/core/codeGraphReexports.js +59 -0
- package/dist/core/codeGraphReexports.js.map +1 -0
- package/dist/core/collisionDetector.js +14 -4
- package/dist/core/collisionDetector.js.map +1 -1
- package/dist/core/coordination.js +4 -6
- package/dist/core/coordination.js.map +1 -1
- package/dist/core/couplingAnalyzer.d.ts +2 -1
- package/dist/core/couplingAnalyzer.js.map +1 -1
- package/dist/core/coverageParser.js.map +1 -1
- package/dist/core/dataflow.js +13 -3
- package/dist/core/dataflow.js.map +1 -1
- package/dist/core/dataflowFilters.js +8 -3
- package/dist/core/dataflowFilters.js.map +1 -1
- package/dist/core/dependencyAnalyzer.js +4 -1
- package/dist/core/dependencyAnalyzer.js.map +1 -1
- package/dist/core/dogfood.d.ts +1 -1
- package/dist/core/dogfood.js +39 -5
- package/dist/core/dogfood.js.map +1 -1
- package/dist/core/embeddings.js.map +1 -1
- package/dist/core/evidenceComment.js +34 -12
- package/dist/core/evidenceComment.js.map +1 -1
- package/dist/core/explainIssue.js +1 -2
- package/dist/core/explainIssue.js.map +1 -1
- package/dist/core/feedback.d.ts +1 -1
- package/dist/core/feedback.js +15 -4
- package/dist/core/feedback.js.map +1 -1
- package/dist/core/fileInspector.js +8 -2
- package/dist/core/fileInspector.js.map +1 -1
- package/dist/core/fixFirst.d.ts +3 -1
- package/dist/core/fixFirst.js +17 -4
- package/dist/core/fixFirst.js.map +1 -1
- package/dist/core/fixSuggest.js +20 -12
- package/dist/core/fixSuggest.js.map +1 -1
- package/dist/core/frameworkDetector.js +5 -3
- package/dist/core/frameworkDetector.js.map +1 -1
- package/dist/core/frameworkSources.d.ts +1 -1
- package/dist/core/frameworkSources.js +114 -4
- package/dist/core/frameworkSources.js.map +1 -1
- package/dist/core/graphCorpus.d.ts +1 -1
- package/dist/core/graphCorpus.js +9 -1
- package/dist/core/graphCorpus.js.map +1 -1
- package/dist/core/graphQuery.js.map +1 -1
- package/dist/core/hotspotAnalyzer.js +26 -6
- package/dist/core/hotspotAnalyzer.js.map +1 -1
- package/dist/core/impact.d.ts +1 -1
- package/dist/core/impact.js.map +1 -1
- package/dist/core/importGraph.js.map +1 -1
- package/dist/core/indexCache.js +2 -1
- package/dist/core/indexCache.js.map +1 -1
- package/dist/core/intent.d.ts +1 -1
- package/dist/core/intent.js +143 -46
- package/dist/core/intent.js.map +1 -1
- package/dist/core/intentRouter.js +5467 -445
- package/dist/core/intentRouter.js.map +1 -1
- package/dist/core/issueEngine.js +1 -1
- package/dist/core/issueEngine.js.map +1 -1
- package/dist/core/languageDetector.js +1 -9
- package/dist/core/languageDetector.js.map +1 -1
- package/dist/core/languages/cppAdapter.js +3 -1
- package/dist/core/languages/cppAdapter.js.map +1 -1
- package/dist/core/languages/cppExports.js +6 -1
- package/dist/core/languages/cppExports.js.map +1 -1
- package/dist/core/languages/cppFunctions.js +3 -1
- package/dist/core/languages/cppFunctions.js.map +1 -1
- package/dist/core/languages/csharpAdapter.js.map +1 -1
- package/dist/core/languages/csharpFunctions.js +3 -1
- package/dist/core/languages/csharpFunctions.js.map +1 -1
- package/dist/core/languages/csharpImports.js +2 -1
- package/dist/core/languages/csharpImports.js.map +1 -1
- package/dist/core/languages/goAdapter.js.map +1 -1
- package/dist/core/languages/goExports.js.map +1 -1
- package/dist/core/languages/goFunctions.js +9 -3
- package/dist/core/languages/goFunctions.js.map +1 -1
- package/dist/core/languages/javaAdapter.js +1 -2
- package/dist/core/languages/javaAdapter.js.map +1 -1
- package/dist/core/languages/javaFunctions.js +6 -2
- package/dist/core/languages/javaFunctions.js.map +1 -1
- package/dist/core/languages/javascriptAdapter.js +43 -8
- package/dist/core/languages/javascriptAdapter.js.map +1 -1
- package/dist/core/languages/kotlinAdapter.js +5 -2
- package/dist/core/languages/kotlinAdapter.js.map +1 -1
- package/dist/core/languages/kotlinFunctions.js +5 -6
- package/dist/core/languages/kotlinFunctions.js.map +1 -1
- package/dist/core/languages/kotlinImports.js +3 -1
- package/dist/core/languages/kotlinImports.js.map +1 -1
- package/dist/core/languages/kotlinManifests.js +7 -1
- package/dist/core/languages/kotlinManifests.js.map +1 -1
- package/dist/core/languages/phpAdapter.js +4 -1
- package/dist/core/languages/phpAdapter.js.map +1 -1
- package/dist/core/languages/phpExports.js.map +1 -1
- package/dist/core/languages/phpFunctions.js +18 -6
- package/dist/core/languages/phpFunctions.js.map +1 -1
- package/dist/core/languages/phpManifests.js.map +1 -1
- package/dist/core/languages/pythonAdapter.js.map +1 -1
- package/dist/core/languages/pythonFunctions.js +9 -3
- package/dist/core/languages/pythonFunctions.js.map +1 -1
- package/dist/core/languages/pythonManifests.d.ts +11 -0
- package/dist/core/languages/pythonManifests.js +34 -19
- package/dist/core/languages/pythonManifests.js.map +1 -1
- package/dist/core/languages/rubyAdapter.js.map +1 -1
- package/dist/core/languages/rubyFunctions.js +6 -2
- package/dist/core/languages/rubyFunctions.js.map +1 -1
- package/dist/core/languages/rustAdapter.js.map +1 -1
- package/dist/core/languages/rustFunctions.js +6 -2
- package/dist/core/languages/rustFunctions.js.map +1 -1
- package/dist/core/languages/swiftAdapter.js +3 -1
- package/dist/core/languages/swiftAdapter.js.map +1 -1
- package/dist/core/languages/swiftCyclomatic.js.map +1 -1
- package/dist/core/languages/swiftFunctions.js +3 -1
- package/dist/core/languages/swiftFunctions.js.map +1 -1
- package/dist/core/languages/swiftImports.js.map +1 -1
- package/dist/core/mergeRisk.js +5 -1
- package/dist/core/mergeRisk.js.map +1 -1
- package/dist/core/missionOutcome.d.ts +1 -1
- package/dist/core/missionOutcome.js +9 -4
- package/dist/core/missionOutcome.js.map +1 -1
- package/dist/core/missionProof.d.ts +1 -1
- package/dist/core/missionProof.js +8 -6
- package/dist/core/missionProof.js.map +1 -1
- package/dist/core/missionProofBaseline.d.ts +1 -1
- package/dist/core/missionProofBaseline.js +8 -2
- package/dist/core/missionProofBaseline.js.map +1 -1
- package/dist/core/missionProofMarkdown.d.ts +1 -1
- package/dist/core/missionProofMarkdown.js +4 -1
- package/dist/core/missionProofMarkdown.js.map +1 -1
- package/dist/core/missionProofSummary.d.ts +1 -1
- package/dist/core/monorepo.d.ts +1 -1
- package/dist/core/monorepo.js +4 -2
- package/dist/core/monorepo.js.map +1 -1
- package/dist/core/onboarding.d.ts +2 -1
- package/dist/core/onboarding.js.map +1 -1
- package/dist/core/outdatedDetector.js +5 -1
- package/dist/core/outdatedDetector.js.map +1 -1
- package/dist/core/ownership.js +3 -1
- package/dist/core/ownership.js.map +1 -1
- package/dist/core/pathClassifiers.js.map +1 -1
- package/dist/core/pluginDx.js +2 -1
- package/dist/core/pluginDx.js.map +1 -1
- package/dist/core/pluginTrust.js +1 -3
- package/dist/core/pluginTrust.js.map +1 -1
- package/dist/core/plugins.js +5 -5
- package/dist/core/plugins.js.map +1 -1
- package/dist/core/prDiff.d.ts +1 -2
- package/dist/core/prDiff.js +5 -1
- package/dist/core/prDiff.js.map +1 -1
- package/dist/core/preflight.js +15 -6
- package/dist/core/preflight.js.map +1 -1
- package/dist/core/privacy.js.map +1 -1
- package/dist/core/qualityScorecard.d.ts +1 -1
- package/dist/core/qualityScorecard.js +43 -11
- package/dist/core/qualityScorecard.js.map +1 -1
- package/dist/core/regressionPlan.js +25 -7
- package/dist/core/regressionPlan.js.map +1 -1
- package/dist/core/releaseEvidence.js +41 -17
- package/dist/core/releaseEvidence.js.map +1 -1
- package/dist/core/releaseTrain.js +66 -38
- package/dist/core/releaseTrain.js.map +1 -1
- package/dist/core/reportScope.d.ts +17 -0
- package/dist/core/reportScope.js +143 -0
- package/dist/core/reportScope.js.map +1 -0
- package/dist/core/repositoryScanner.js +1 -3
- package/dist/core/repositoryScanner.js.map +1 -1
- package/dist/core/review.d.ts +1 -1
- package/dist/core/review.js +72 -10
- package/dist/core/review.js.map +1 -1
- package/dist/core/reviewDataflow.js +7 -1
- package/dist/core/reviewDataflow.js.map +1 -1
- package/dist/core/reviewPublicSurface.d.ts +13 -0
- package/dist/core/reviewPublicSurface.js +134 -0
- package/dist/core/reviewPublicSurface.js.map +1 -0
- package/dist/core/roadmapCatalog.d.ts +1 -0
- package/dist/core/roadmapCatalog.js +349 -30
- package/dist/core/roadmapCatalog.js.map +1 -1
- package/dist/core/searchIndex.js +124 -17
- package/dist/core/searchIndex.js.map +1 -1
- package/dist/core/semanticGraph.js.map +1 -1
- package/dist/core/semanticSearch.js +20 -4
- package/dist/core/semanticSearch.js.map +1 -1
- package/dist/core/session.js +1 -2
- package/dist/core/session.js.map +1 -1
- package/dist/core/sessionResources.js +6 -2
- package/dist/core/sessionResources.js.map +1 -1
- package/dist/core/start.d.ts +3 -9
- package/dist/core/start.js +23 -3237
- package/dist/core/start.js.map +1 -1
- package/dist/core/startAdoptionLoop.d.ts +2 -0
- package/dist/core/startAdoptionLoop.js +41 -0
- package/dist/core/startAdoptionLoop.js.map +1 -0
- package/dist/core/startEvidence.d.ts +5 -0
- package/dist/core/startEvidence.js +62 -0
- package/dist/core/startEvidence.js.map +1 -0
- package/dist/core/startExecutionPlan.d.ts +16 -0
- package/dist/core/startExecutionPlan.js +185 -0
- package/dist/core/startExecutionPlan.js.map +1 -0
- package/dist/core/startHarness.d.ts +3 -0
- package/dist/core/startHarness.js +47 -0
- package/dist/core/startHarness.js.map +1 -0
- package/dist/core/startIntentTargets.d.ts +24 -0
- package/dist/core/startIntentTargets.js +1106 -0
- package/dist/core/startIntentTargets.js.map +1 -0
- package/dist/core/startMissionControl.d.ts +16 -0
- package/dist/core/startMissionControl.js +145 -0
- package/dist/core/startMissionControl.js.map +1 -0
- package/dist/core/startMissionPolicy.d.ts +19 -0
- package/dist/core/startMissionPolicy.js +246 -0
- package/dist/core/startMissionPolicy.js.map +1 -0
- package/dist/core/startMode.d.ts +11 -0
- package/dist/core/startMode.js +139 -0
- package/dist/core/startMode.js.map +1 -0
- package/dist/core/startNextActions.d.ts +13 -0
- package/dist/core/startNextActions.js +19 -0
- package/dist/core/startNextActions.js.map +1 -0
- package/dist/core/startOptions.d.ts +18 -0
- package/dist/core/startOptions.js +29 -0
- package/dist/core/startOptions.js.map +1 -0
- package/dist/core/startResume.d.ts +7 -0
- package/dist/core/startResume.js +468 -0
- package/dist/core/startResume.js.map +1 -0
- package/dist/core/startReviewGate.d.ts +11 -0
- package/dist/core/startReviewGate.js +200 -0
- package/dist/core/startReviewGate.js.map +1 -0
- package/dist/core/startRouteActions.d.ts +7 -0
- package/dist/core/startRouteActions.js +497 -0
- package/dist/core/startRouteActions.js.map +1 -0
- package/dist/core/startRunbook.d.ts +24 -0
- package/dist/core/startRunbook.js +271 -0
- package/dist/core/startRunbook.js.map +1 -0
- package/dist/core/startSuccessCriteria.d.ts +14 -0
- package/dist/core/startSuccessCriteria.js +497 -0
- package/dist/core/startSuccessCriteria.js.map +1 -0
- package/dist/core/taint.js +22 -12
- package/dist/core/taint.js.map +1 -1
- package/dist/core/telemetry.js +19 -5
- package/dist/core/telemetry.js.map +1 -1
- package/dist/core/trial.d.ts +1 -1
- package/dist/core/trial.js +15 -6
- package/dist/core/trial.js.map +1 -1
- package/dist/core/understand.d.ts +1 -1
- package/dist/core/understand.js +165 -51
- package/dist/core/understand.js.map +1 -1
- package/dist/core/upgradePreview.js +73 -1
- package/dist/core/upgradePreview.js.map +1 -1
- package/dist/core/watcher.js +18 -3
- package/dist/core/watcher.js.map +1 -1
- package/dist/core/workplan.js +87 -17
- package/dist/core/workplan.js.map +1 -1
- package/dist/core/workspace.js.map +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/mcp/pagination.js.map +1 -1
- package/dist/mcp/prompts.js +28 -20
- package/dist/mcp/prompts.js.map +1 -1
- package/dist/mcp/server.js +6 -74
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/serverPayload.d.ts +13 -0
- package/dist/mcp/serverPayload.js +61 -0
- package/dist/mcp/serverPayload.js.map +1 -0
- package/dist/mcp/tokenBudget.js.map +1 -1
- package/dist/mcp/tools/_shared.js.map +1 -1
- package/dist/mcp/tools/agentBrief.js +7 -1
- package/dist/mcp/tools/agentBrief.js.map +1 -1
- package/dist/mcp/tools/applyFix.js +1 -1
- package/dist/mcp/tools/applyFix.js.map +1 -1
- package/dist/mcp/tools/audit.js.map +1 -1
- package/dist/mcp/tools/bugHunt.js +2 -2
- package/dist/mcp/tools/bugHunt.js.map +1 -1
- package/dist/mcp/tools/claim.js +8 -3
- package/dist/mcp/tools/claim.js.map +1 -1
- package/dist/mcp/tools/collision.js +3 -1
- package/dist/mcp/tools/collision.js.map +1 -1
- package/dist/mcp/tools/coordinate.js.map +1 -1
- package/dist/mcp/tools/coordinateWatch.js +5 -2
- package/dist/mcp/tools/coordinateWatch.js.map +1 -1
- package/dist/mcp/tools/costSummary.js.map +1 -1
- package/dist/mcp/tools/coupling.js.map +1 -1
- package/dist/mcp/tools/coverage.js.map +1 -1
- package/dist/mcp/tools/dataflow.js.map +1 -1
- package/dist/mcp/tools/dependencies.js +4 -1
- package/dist/mcp/tools/dependencies.js.map +1 -1
- package/dist/mcp/tools/doctor.js.map +1 -1
- package/dist/mcp/tools/explainIssue.js +4 -1
- package/dist/mcp/tools/explainIssue.js.map +1 -1
- package/dist/mcp/tools/fixSuggest.js +5 -2
- package/dist/mcp/tools/fixSuggest.js.map +1 -1
- package/dist/mcp/tools/hotspots.js +4 -1
- package/dist/mcp/tools/hotspots.js.map +1 -1
- package/dist/mcp/tools/impact.js +10 -3
- package/dist/mcp/tools/impact.js.map +1 -1
- package/dist/mcp/tools/mergeRisk.js.map +1 -1
- package/dist/mcp/tools/plugin.js +6 -1
- package/dist/mcp/tools/plugin.js.map +1 -1
- package/dist/mcp/tools/prDiff.js.map +1 -1
- package/dist/mcp/tools/preflight.js +1 -5
- package/dist/mcp/tools/preflight.js.map +1 -1
- package/dist/mcp/tools/review.js.map +1 -1
- package/dist/mcp/tools/reviewWatch.d.ts +1 -1
- package/dist/mcp/tools/reviewWatch.js +9 -9
- package/dist/mcp/tools/reviewWatch.js.map +1 -1
- package/dist/mcp/tools/route.js +1 -1
- package/dist/mcp/tools/route.js.map +1 -1
- package/dist/mcp/tools/search.js.map +1 -1
- package/dist/mcp/tools/semanticGraph.js +8 -2
- package/dist/mcp/tools/semanticGraph.js.map +1 -1
- package/dist/mcp/tools/start.js.map +1 -1
- package/dist/mcp/tools/structure.js +7 -1
- package/dist/mcp/tools/structure.js.map +1 -1
- package/dist/mcp/tools/understand.js.map +1 -1
- package/dist/mcp/tools/upgrade.d.ts +1 -1
- package/dist/mcp/tools/upgrade.js +2 -16
- package/dist/mcp/tools/upgrade.js.map +1 -1
- package/dist/mcp/tools/workspaceGraph.js +10 -1
- package/dist/mcp/tools/workspaceGraph.js.map +1 -1
- package/dist/mcp/tools.js +3 -1
- package/dist/mcp/tools.js.map +1 -1
- package/dist/projscan-sbom.cdx.json +2136 -904
- package/dist/reporters/consoleAnalysisReporter.d.ts +2 -0
- package/dist/reporters/consoleAnalysisReporter.js +89 -0
- package/dist/reporters/consoleAnalysisReporter.js.map +1 -0
- package/dist/reporters/consoleArchitectureReporter.d.ts +3 -0
- package/dist/reporters/consoleArchitectureReporter.js +47 -0
- package/dist/reporters/consoleArchitectureReporter.js.map +1 -0
- package/dist/reporters/consoleAuditReporter.d.ts +2 -0
- package/dist/reporters/consoleAuditReporter.js +46 -0
- package/dist/reporters/consoleAuditReporter.js.map +1 -0
- package/dist/reporters/consoleCiReporter.d.ts +2 -0
- package/dist/reporters/consoleCiReporter.js +27 -0
- package/dist/reporters/consoleCiReporter.js.map +1 -0
- package/dist/reporters/consoleCouplingReporter.d.ts +2 -0
- package/dist/reporters/consoleCouplingReporter.js +53 -0
- package/dist/reporters/consoleCouplingReporter.js.map +1 -0
- package/dist/reporters/consoleCoverageReporter.d.ts +2 -0
- package/dist/reporters/consoleCoverageReporter.js +62 -0
- package/dist/reporters/consoleCoverageReporter.js.map +1 -0
- package/dist/reporters/consoleDependencyReporter.d.ts +2 -0
- package/dist/reporters/consoleDependencyReporter.js +64 -0
- package/dist/reporters/consoleDependencyReporter.js.map +1 -0
- package/dist/reporters/consoleDiffReporter.d.ts +2 -0
- package/dist/reporters/consoleDiffReporter.js +80 -0
- package/dist/reporters/consoleDiffReporter.js.map +1 -0
- package/dist/reporters/consoleExplanationReporter.d.ts +2 -0
- package/dist/reporters/consoleExplanationReporter.js +33 -0
- package/dist/reporters/consoleExplanationReporter.js.map +1 -0
- package/dist/reporters/consoleFileReporter.d.ts +2 -0
- package/dist/reporters/consoleFileReporter.js +133 -0
- package/dist/reporters/consoleFileReporter.js.map +1 -0
- package/dist/reporters/consoleFixGuidanceReporter.d.ts +8 -0
- package/dist/reporters/consoleFixGuidanceReporter.js +135 -0
- package/dist/reporters/consoleFixGuidanceReporter.js.map +1 -0
- package/dist/reporters/consoleHealthReporter.d.ts +13 -0
- package/dist/reporters/consoleHealthReporter.js +111 -0
- package/dist/reporters/consoleHealthReporter.js.map +1 -0
- package/dist/reporters/consoleHotspotReporter.d.ts +2 -0
- package/dist/reporters/consoleHotspotReporter.js +68 -0
- package/dist/reporters/consoleHotspotReporter.js.map +1 -0
- package/dist/reporters/consoleImpactReporter.d.ts +2 -0
- package/dist/reporters/consoleImpactReporter.js +65 -0
- package/dist/reporters/consoleImpactReporter.js.map +1 -0
- package/dist/reporters/consoleOutdatedReporter.d.ts +2 -0
- package/dist/reporters/consoleOutdatedReporter.js +54 -0
- package/dist/reporters/consoleOutdatedReporter.js.map +1 -0
- package/dist/reporters/consolePrDiffReporter.d.ts +2 -0
- package/dist/reporters/consolePrDiffReporter.js +75 -0
- package/dist/reporters/consolePrDiffReporter.js.map +1 -0
- package/dist/reporters/consoleReporter.d.ts +21 -38
- package/dist/reporters/consoleReporter.js +19 -1000
- package/dist/reporters/consoleReporter.js.map +1 -1
- package/dist/reporters/consoleReviewReporter.d.ts +2 -0
- package/dist/reporters/consoleReviewReporter.js +101 -0
- package/dist/reporters/consoleReviewReporter.js.map +1 -0
- package/dist/reporters/consoleUpgradeReporter.d.ts +2 -0
- package/dist/reporters/consoleUpgradeReporter.js +89 -0
- package/dist/reporters/consoleUpgradeReporter.js.map +1 -0
- package/dist/reporters/consoleWorkspaceReporter.d.ts +2 -0
- package/dist/reporters/consoleWorkspaceReporter.js +24 -0
- package/dist/reporters/consoleWorkspaceReporter.js.map +1 -0
- package/dist/reporters/htmlReporter.d.ts +2 -1
- package/dist/reporters/htmlReporter.js +9 -3
- package/dist/reporters/htmlReporter.js.map +1 -1
- package/dist/reporters/jsonReporter.d.ts +2 -1
- package/dist/reporters/jsonReporter.js.map +1 -1
- package/dist/reporters/markdownAnalysisReporter.d.ts +2 -0
- package/dist/reporters/markdownAnalysisReporter.js +40 -0
- package/dist/reporters/markdownAnalysisReporter.js.map +1 -0
- package/dist/reporters/markdownAuditReporter.d.ts +2 -0
- package/dist/reporters/markdownAuditReporter.js +27 -0
- package/dist/reporters/markdownAuditReporter.js.map +1 -0
- package/dist/reporters/markdownDependencyReporter.d.ts +2 -0
- package/dist/reporters/markdownDependencyReporter.js +33 -0
- package/dist/reporters/markdownDependencyReporter.js.map +1 -0
- package/dist/reporters/markdownDiffReporter.d.ts +2 -0
- package/dist/reporters/markdownDiffReporter.js +65 -0
- package/dist/reporters/markdownDiffReporter.js.map +1 -0
- package/dist/reporters/markdownFileReporter.d.ts +2 -0
- package/dist/reporters/markdownFileReporter.js +92 -0
- package/dist/reporters/markdownFileReporter.js.map +1 -0
- package/dist/reporters/markdownFixGuidanceReporter.d.ts +8 -0
- package/dist/reporters/markdownFixGuidanceReporter.js +95 -0
- package/dist/reporters/markdownFixGuidanceReporter.js.map +1 -0
- package/dist/reporters/markdownImpactReporter.d.ts +2 -0
- package/dist/reporters/markdownImpactReporter.js +52 -0
- package/dist/reporters/markdownImpactReporter.js.map +1 -0
- package/dist/reporters/markdownReporter.d.ts +10 -16
- package/dist/reporters/markdownReporter.js +9 -452
- package/dist/reporters/markdownReporter.js.map +1 -1
- package/dist/reporters/markdownReviewReporter.d.ts +2 -0
- package/dist/reporters/markdownReviewReporter.js +84 -0
- package/dist/reporters/markdownReviewReporter.js.map +1 -0
- package/dist/reporters/markdownUpgradeReporter.d.ts +2 -0
- package/dist/reporters/markdownUpgradeReporter.js +62 -0
- package/dist/reporters/markdownUpgradeReporter.js.map +1 -0
- package/dist/reporters/sarifReporter.js.map +1 -1
- package/dist/tool-manifest.json +5 -5
- package/dist/types/agentBrief.d.ts +48 -0
- package/dist/types/agentBrief.js +2 -0
- package/dist/types/agentBrief.js.map +1 -0
- package/dist/types/analysis.d.ts +32 -0
- package/dist/types/analysis.js +2 -0
- package/dist/types/analysis.js.map +1 -0
- package/dist/types/baseline.d.ts +59 -0
- package/dist/types/baseline.js +2 -0
- package/dist/types/baseline.js.map +1 -0
- package/dist/types/bugHunt.d.ts +41 -0
- package/dist/types/bugHunt.js +2 -0
- package/dist/types/bugHunt.js.map +1 -0
- package/dist/types/common.d.ts +34 -0
- package/dist/types/common.js +2 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/config.d.ts +66 -0
- package/dist/types/config.js +2 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/coupling.d.ts +40 -0
- package/dist/types/coupling.js +2 -0
- package/dist/types/coupling.js.map +1 -0
- package/dist/types/coverage.d.ts +32 -0
- package/dist/types/coverage.js +2 -0
- package/dist/types/coverage.js.map +1 -0
- package/dist/types/dependencyHealth.d.ts +73 -0
- package/dist/types/dependencyHealth.js +2 -0
- package/dist/types/dependencyHealth.js.map +1 -0
- package/dist/types/dogfood.d.ts +185 -0
- package/dist/types/dogfood.js +2 -0
- package/dist/types/dogfood.js.map +1 -0
- package/dist/types/evidencePack.d.ts +76 -0
- package/dist/types/evidencePack.js +2 -0
- package/dist/types/evidencePack.js.map +1 -0
- package/dist/types/fixes.d.ts +77 -0
- package/dist/types/fixes.js +2 -0
- package/dist/types/fixes.js.map +1 -0
- package/dist/types/graph.d.ts +80 -0
- package/dist/types/graph.js +2 -0
- package/dist/types/graph.js.map +1 -0
- package/dist/types/graphCorpus.d.ts +16 -0
- package/dist/types/graphCorpus.js +2 -0
- package/dist/types/graphCorpus.js.map +1 -0
- package/dist/types/hotspots.d.ts +42 -0
- package/dist/types/hotspots.js +2 -0
- package/dist/types/hotspots.js.map +1 -0
- package/dist/types/impact.d.ts +62 -0
- package/dist/types/impact.js +2 -0
- package/dist/types/impact.js.map +1 -0
- package/dist/types/inspection.d.ts +47 -0
- package/dist/types/inspection.js +2 -0
- package/dist/types/inspection.js.map +1 -0
- package/dist/types/mcp.d.ts +39 -0
- package/dist/types/mcp.js +2 -0
- package/dist/types/mcp.js.map +1 -0
- package/dist/types/pluginDx.d.ts +42 -0
- package/dist/types/pluginDx.js +2 -0
- package/dist/types/pluginDx.js.map +1 -0
- package/dist/types/prDiff.d.ts +41 -0
- package/dist/types/prDiff.js +2 -0
- package/dist/types/prDiff.js.map +1 -0
- package/dist/types/preflight.d.ts +122 -0
- package/dist/types/preflight.js +2 -0
- package/dist/types/preflight.js.map +1 -0
- package/dist/types/qualityScorecard.d.ts +34 -0
- package/dist/types/qualityScorecard.js +2 -0
- package/dist/types/qualityScorecard.js.map +1 -0
- package/dist/types/regressionPlan.d.ts +32 -0
- package/dist/types/regressionPlan.js +2 -0
- package/dist/types/regressionPlan.js.map +1 -0
- package/dist/types/releaseTrain.d.ts +37 -0
- package/dist/types/releaseTrain.js +2 -0
- package/dist/types/releaseTrain.js.map +1 -0
- package/dist/types/review.d.ts +203 -0
- package/dist/types/review.js +2 -0
- package/dist/types/review.js.map +1 -0
- package/dist/types/reviewContract.d.ts +9 -0
- package/dist/types/reviewContract.js +2 -0
- package/dist/types/reviewContract.js.map +1 -0
- package/dist/types/scanning.d.ts +111 -0
- package/dist/types/scanning.js +2 -0
- package/dist/types/scanning.js.map +1 -0
- package/dist/types/session.d.ts +42 -0
- package/dist/types/session.js +2 -0
- package/dist/types/session.js.map +1 -0
- package/dist/types/start.d.ts +437 -0
- package/dist/types/start.js +2 -0
- package/dist/types/start.js.map +1 -0
- package/dist/types/trial.d.ts +27 -0
- package/dist/types/trial.js +2 -0
- package/dist/types/trial.js.map +1 -0
- package/dist/types/understand.d.ts +153 -0
- package/dist/types/understand.js +2 -0
- package/dist/types/understand.js.map +1 -0
- package/dist/types/workplan.d.ts +67 -0
- package/dist/types/workplan.js +2 -0
- package/dist/types/workplan.js.map +1 -0
- package/dist/types/workplanHandoff.d.ts +11 -0
- package/dist/types/workplanHandoff.js +2 -0
- package/dist/types/workplanHandoff.js.map +1 -0
- package/dist/types/workspace.d.ts +18 -0
- package/dist/types/workspace.js +2 -0
- package/dist/types/workspace.js.map +1 -0
- package/dist/types.d.ts +34 -2348
- package/dist/types.js +0 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/banner.js +15 -6
- package/dist/utils/banner.js.map +1 -1
- package/dist/utils/baseline.js +11 -9
- package/dist/utils/baseline.js.map +1 -1
- package/dist/utils/changedFiles.js +1 -1
- package/dist/utils/changedFiles.js.map +1 -1
- package/dist/utils/config.d.ts +2 -1
- package/dist/utils/config.js +32 -0
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/formatSupport.d.ts +1 -1
- package/dist/utils/formatSupport.js +7 -1
- package/dist/utils/formatSupport.js.map +1 -1
- package/dist/utils/packageJsonLocator.js.map +1 -1
- package/docs/GUIDE.md +211 -147
- package/docs/PLUGIN-GALLERY.md +9 -1
- package/docs/ROADMAP.md +120 -86
- package/docs/demos/projscan-4-1-demo.html +46 -79
- package/docs/examples/adoption-workflows.md +128 -0
- package/docs/examples/plugins/graph-context.mjs +1 -2
- package/docs/examples/plugins/security-sensitive-files.mjs +2 -1
- package/docs/examples/swarm-coordination.md +109 -0
- package/package.json +12 -5
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
|
|
2
|
+
export { reportDiagram, reportStructure } from './consoleArchitectureReporter.js';
|
|
3
|
+
export { reportAnalysis } from './consoleAnalysisReporter.js';
|
|
4
|
+
export { reportAudit } from './consoleAuditReporter.js';
|
|
5
|
+
export { reportCi } from './consoleCiReporter.js';
|
|
6
|
+
export { reportCoupling } from './consoleCouplingReporter.js';
|
|
7
|
+
export { reportDependencies } from './consoleDependencyReporter.js';
|
|
8
|
+
export { reportDiff } from './consoleDiffReporter.js';
|
|
9
|
+
export { reportExplanation } from './consoleExplanationReporter.js';
|
|
10
|
+
export { reportExplainIssue, reportFixSuggest } from './consoleFixGuidanceReporter.js';
|
|
11
|
+
export { reportFileInspection } from './consoleFileReporter.js';
|
|
12
|
+
export { reportHealth } from './consoleHealthReporter.js';
|
|
13
|
+
export { reportHotspots } from './consoleHotspotReporter.js';
|
|
14
|
+
export { reportImpact } from './consoleImpactReporter.js';
|
|
15
|
+
export { reportOutdated } from './consoleOutdatedReporter.js';
|
|
16
|
+
export { reportPrDiff } from './consolePrDiffReporter.js';
|
|
17
|
+
export { reportReview } from './consoleReviewReporter.js';
|
|
18
|
+
export { reportUpgrade } from './consoleUpgradeReporter.js';
|
|
19
|
+
export { reportCoverage } from './consoleCoverageReporter.js';
|
|
20
|
+
export { reportWorkspaces } from './consoleWorkspaceReporter.js';
|
|
3
21
|
// ── Helpers ───────────────────────────────────────────────
|
|
4
22
|
function header(title) {
|
|
5
23
|
const line = '─'.repeat(Math.max(title.length + 2, 40));
|
|
@@ -17,220 +35,6 @@ function severityIcon(severity) {
|
|
|
17
35
|
return chalk.dim('·');
|
|
18
36
|
}
|
|
19
37
|
}
|
|
20
|
-
function bar(percentage, width = 20) {
|
|
21
|
-
const filled = Math.round((percentage / 100) * width);
|
|
22
|
-
const empty = width - filled;
|
|
23
|
-
return chalk.cyan('█'.repeat(filled)) + chalk.dim('░'.repeat(empty));
|
|
24
|
-
}
|
|
25
|
-
// ── Report: analyze ───────────────────────────────────────
|
|
26
|
-
export function reportAnalysis(report) {
|
|
27
|
-
console.log(header('ProjScan Project Report'));
|
|
28
|
-
// Project info
|
|
29
|
-
console.log(header('Project'));
|
|
30
|
-
console.log(` Name: ${chalk.bold(report.projectName)}`);
|
|
31
|
-
console.log(` Language: ${chalk.bold(report.languages.primary)}`);
|
|
32
|
-
const frameworkNames = report.frameworks.frameworks.map((f) => f.name).join(', ');
|
|
33
|
-
if (frameworkNames) {
|
|
34
|
-
console.log(` Frameworks: ${chalk.bold(frameworkNames)}`);
|
|
35
|
-
}
|
|
36
|
-
if (report.frameworks.packageManager !== 'unknown') {
|
|
37
|
-
console.log(` Pkg Manager: ${report.frameworks.packageManager}`);
|
|
38
|
-
}
|
|
39
|
-
if (report.dependencies) {
|
|
40
|
-
console.log(` Dependencies: ${report.dependencies.totalDependencies} prod, ${report.dependencies.totalDevDependencies} dev`);
|
|
41
|
-
}
|
|
42
|
-
console.log(` Files: ${report.scan.totalFiles}`);
|
|
43
|
-
console.log(` Directories: ${report.scan.totalDirectories}`);
|
|
44
|
-
console.log(` Scan Time: ${report.scan.scanDurationMs.toFixed(0)}ms`);
|
|
45
|
-
// Languages
|
|
46
|
-
const langEntries = Object.values(report.languages.languages)
|
|
47
|
-
.sort((a, b) => b.fileCount - a.fileCount)
|
|
48
|
-
.slice(0, 8);
|
|
49
|
-
if (langEntries.length > 0) {
|
|
50
|
-
console.log(header('Languages'));
|
|
51
|
-
for (const lang of langEntries) {
|
|
52
|
-
const pct = lang.percentage.toFixed(1).padStart(5);
|
|
53
|
-
console.log(` ${bar(lang.percentage)} ${pct}% ${lang.name} (${lang.fileCount} files)`);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
// Structure (top-level dirs)
|
|
57
|
-
if (report.scan.directoryTree.children.length > 0) {
|
|
58
|
-
console.log(header('Structure'));
|
|
59
|
-
for (const child of report.scan.directoryTree.children.slice(0, 12)) {
|
|
60
|
-
const count = chalk.dim(`(${child.totalFileCount} files)`);
|
|
61
|
-
console.log(` ${chalk.bold(child.name + '/')} ${count}`);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
// Issues
|
|
65
|
-
if (report.issues.length > 0) {
|
|
66
|
-
console.log(header('Issues'));
|
|
67
|
-
for (const issue of report.issues) {
|
|
68
|
-
console.log(` ${severityIcon(issue.severity)} ${issue.title}`);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
// Suggestions
|
|
72
|
-
const fixableIssues = report.issues.filter((i) => i.fixAvailable);
|
|
73
|
-
if (fixableIssues.length > 0) {
|
|
74
|
-
console.log(header('Suggestions'));
|
|
75
|
-
for (const issue of fixableIssues) {
|
|
76
|
-
console.log(` ${chalk.green('•')} ${issue.description}`);
|
|
77
|
-
}
|
|
78
|
-
console.log(`\n Run ${chalk.bold.cyan('projscan fix')} to auto-fix these issues.`);
|
|
79
|
-
}
|
|
80
|
-
console.log('');
|
|
81
|
-
}
|
|
82
|
-
export function reportHealth(issues, scanTimeMsOrOptions) {
|
|
83
|
-
const opts = typeof scanTimeMsOrOptions === 'number'
|
|
84
|
-
? { scanTimeMs: scanTimeMsOrOptions }
|
|
85
|
-
: (scanTimeMsOrOptions ?? {});
|
|
86
|
-
console.log(header('Project Health Report'));
|
|
87
|
-
const { score, grade } = calculateScore(issues);
|
|
88
|
-
const gradeColor = grade === 'A'
|
|
89
|
-
? chalk.green
|
|
90
|
-
: grade === 'B'
|
|
91
|
-
? chalk.green
|
|
92
|
-
: grade === 'C'
|
|
93
|
-
? chalk.yellow
|
|
94
|
-
: grade === 'D'
|
|
95
|
-
? chalk.yellow
|
|
96
|
-
: chalk.red;
|
|
97
|
-
console.log(`\n Health Score: ${gradeColor(chalk.bold(`${grade} (${score}/100)`))}`);
|
|
98
|
-
if (issues.length === 0) {
|
|
99
|
-
console.log(` ${chalk.green('✓')} ${chalk.bold('No issues detected!')} Your project looks healthy.\n`);
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
const errors = issues.filter((i) => i.severity === 'error');
|
|
103
|
-
const warnings = issues.filter((i) => i.severity === 'warning');
|
|
104
|
-
const infos = issues.filter((i) => i.severity === 'info');
|
|
105
|
-
// Summary
|
|
106
|
-
const parts = [];
|
|
107
|
-
if (errors.length > 0)
|
|
108
|
-
parts.push(chalk.red(`${errors.length} error${errors.length > 1 ? 's' : ''}`));
|
|
109
|
-
if (warnings.length > 0)
|
|
110
|
-
parts.push(chalk.yellow(`${warnings.length} warning${warnings.length > 1 ? 's' : ''}`));
|
|
111
|
-
if (infos.length > 0)
|
|
112
|
-
parts.push(chalk.blue(`${infos.length} info`));
|
|
113
|
-
console.log(` Found ${parts.join(', ')}`);
|
|
114
|
-
if (opts.scanTimeMs !== undefined) {
|
|
115
|
-
console.log(` Scanned in ${chalk.dim(opts.scanTimeMs.toFixed(0) + 'ms')}`);
|
|
116
|
-
}
|
|
117
|
-
// Issues
|
|
118
|
-
console.log(header('Issues Detected'));
|
|
119
|
-
for (const issue of issues) {
|
|
120
|
-
console.log(` ${severityIcon(issue.severity)} ${issue.title}`);
|
|
121
|
-
console.log(` ${chalk.dim(issue.description)}`);
|
|
122
|
-
if (issue.suggestedAction) {
|
|
123
|
-
console.log(` ${chalk.cyan('→')} ${chalk.dim(issue.suggestedAction.summary)} ${chalk.dim(`(projscan fix-suggest ${issue.id})`)}`);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
// Recommendations
|
|
127
|
-
const fixable = issues.filter((i) => i.fixAvailable);
|
|
128
|
-
if (fixable.length > 0) {
|
|
129
|
-
console.log(header('Recommendations'));
|
|
130
|
-
for (let i = 0; i < fixable.length; i++) {
|
|
131
|
-
console.log(` ${chalk.bold(String(i + 1) + '.')} Fix: ${fixable[i].title}`);
|
|
132
|
-
}
|
|
133
|
-
console.log(`\n Run ${chalk.bold.cyan('projscan fix')} to auto-fix ${fixable.length} issue${fixable.length > 1 ? 's' : ''}.\n`);
|
|
134
|
-
}
|
|
135
|
-
// 1.5+ — Project Memory tip. Only fires when the user has stable
|
|
136
|
-
// rules accumulating; quiet otherwise.
|
|
137
|
-
if (opts.stableRuleCount && opts.stableRuleCount > 0) {
|
|
138
|
-
console.log(` ${chalk.cyan('▲')} ${chalk.dim(`${opts.stableRuleCount} rule${opts.stableRuleCount === 1 ? ' has' : 's have'} been open across enough runs to count as accepted. Run`)} ${chalk.bold.cyan('projscan memory stable')} ${chalk.dim('to review and silence them in .projscanrc.')}\n`);
|
|
139
|
-
}
|
|
140
|
-
console.log(header('Next best commands'));
|
|
141
|
-
console.log(` ${chalk.cyan('projscan preflight --mode before_edit --format json')} ${chalk.dim('for an agent-sized safety gate')}`);
|
|
142
|
-
console.log(` ${chalk.cyan('projscan bug-hunt --format json')} ${chalk.dim('for a ranked fix queue')}`);
|
|
143
|
-
console.log(` ${chalk.cyan('projscan recipes')} ${chalk.dim('for repeatable agent workflows')}`);
|
|
144
|
-
console.log('');
|
|
145
|
-
}
|
|
146
|
-
// ── Report: ci ────────────────────────────────────────────
|
|
147
|
-
export function reportCi(issues, threshold) {
|
|
148
|
-
const { score, grade, errors, warnings, infos } = calculateScore(issues);
|
|
149
|
-
const pass = score >= threshold;
|
|
150
|
-
const status = pass ? chalk.green('PASS') : chalk.red('FAIL');
|
|
151
|
-
const gradeColor = grade === 'A' || grade === 'B' ? chalk.green : grade === 'C' ? chalk.yellow : chalk.red;
|
|
152
|
-
console.log(`projscan: ${gradeColor(chalk.bold(`${grade} (${score}/100)`))} - ${errors} error${errors !== 1 ? 's' : ''}, ${warnings} warning${warnings !== 1 ? 's' : ''}, ${infos} info - ${status} (threshold: ${threshold})`);
|
|
153
|
-
if (!pass) {
|
|
154
|
-
for (const issue of issues) {
|
|
155
|
-
console.log(` ${severityIcon(issue.severity)} ${issue.title}`);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
// ── Report: diff ──────────────────────────────────────────
|
|
160
|
-
export function reportDiff(diff) {
|
|
161
|
-
console.log(header('Health Diff'));
|
|
162
|
-
printDiffScoreLine(diff);
|
|
163
|
-
printDiffIssueLists(diff);
|
|
164
|
-
printHotspotDiff(diff);
|
|
165
|
-
console.log(`\n Baseline: ${chalk.dim(diff.before.timestamp)}`);
|
|
166
|
-
console.log('');
|
|
167
|
-
}
|
|
168
|
-
function printDiffScoreLine(diff) {
|
|
169
|
-
const arrow = diff.scoreDelta > 0 ? chalk.green('↑') : diff.scoreDelta < 0 ? chalk.red('↓') : chalk.dim('-');
|
|
170
|
-
const delta = diff.scoreDelta > 0 ? `+${diff.scoreDelta}` : String(diff.scoreDelta);
|
|
171
|
-
console.log(`\n Score: ${diff.before.score} → ${diff.after.score} (${delta}) ${arrow}`);
|
|
172
|
-
console.log(` Grade: ${diff.before.grade} → ${diff.after.grade}`);
|
|
173
|
-
}
|
|
174
|
-
function printDiffIssueLists(diff) {
|
|
175
|
-
if (diff.resolvedIssues.length > 0) {
|
|
176
|
-
console.log(`\n ${chalk.green('✓')} Resolved (${diff.resolvedIssues.length}):`);
|
|
177
|
-
for (const title of diff.resolvedIssues)
|
|
178
|
-
console.log(` ${chalk.green('-')} ${title}`);
|
|
179
|
-
}
|
|
180
|
-
if (diff.newIssues.length > 0) {
|
|
181
|
-
console.log(`\n ${chalk.red('✗')} New (${diff.newIssues.length}):`);
|
|
182
|
-
for (const title of diff.newIssues)
|
|
183
|
-
console.log(` ${chalk.red('-')} ${title}`);
|
|
184
|
-
}
|
|
185
|
-
if (diff.resolvedIssues.length === 0 && diff.newIssues.length === 0) {
|
|
186
|
-
console.log(`\n ${chalk.dim('No change in issues.')}`);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
function printHotspotDiff(diff) {
|
|
190
|
-
if (!diff.hotspotDiff)
|
|
191
|
-
return;
|
|
192
|
-
const hd = diff.hotspotDiff;
|
|
193
|
-
const total = hd.rose.length + hd.fell.length + hd.appeared.length + hd.resolved.length;
|
|
194
|
-
if (total === 0)
|
|
195
|
-
return;
|
|
196
|
-
console.log(header('Hotspot Changes'));
|
|
197
|
-
printHotspotRose(hd.rose);
|
|
198
|
-
printHotspotAppeared(hd.appeared);
|
|
199
|
-
printHotspotFell(hd.fell);
|
|
200
|
-
printHotspotResolved(hd.resolved);
|
|
201
|
-
}
|
|
202
|
-
function printHotspotRose(rose) {
|
|
203
|
-
if (rose.length === 0)
|
|
204
|
-
return;
|
|
205
|
-
console.log(`\n ${chalk.red('▲')} Worsening (${rose.length}):`);
|
|
206
|
-
for (const delta of rose.slice(0, 10)) {
|
|
207
|
-
console.log(` ${chalk.red('+' + delta.scoreDelta.toFixed(1))} ${delta.relativePath} ${chalk.dim(`${delta.beforeScore?.toFixed(1)} → ${delta.afterScore?.toFixed(1)}`)}`);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
function printHotspotAppeared(appeared) {
|
|
211
|
-
if (appeared.length === 0)
|
|
212
|
-
return;
|
|
213
|
-
console.log(`\n ${chalk.yellow('●')} Newly risky (${appeared.length}):`);
|
|
214
|
-
for (const delta of appeared.slice(0, 10)) {
|
|
215
|
-
console.log(` ${chalk.yellow(delta.afterScore?.toFixed(1) ?? '?')} ${delta.relativePath}`);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
function printHotspotFell(fell) {
|
|
219
|
-
if (fell.length === 0)
|
|
220
|
-
return;
|
|
221
|
-
console.log(`\n ${chalk.green('▼')} Improving (${fell.length}):`);
|
|
222
|
-
for (const delta of fell.slice(0, 10)) {
|
|
223
|
-
console.log(` ${chalk.green(delta.scoreDelta.toFixed(1))} ${delta.relativePath} ${chalk.dim(`${delta.beforeScore?.toFixed(1)} → ${delta.afterScore?.toFixed(1)}`)}`);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
function printHotspotResolved(resolved) {
|
|
227
|
-
if (resolved.length === 0)
|
|
228
|
-
return;
|
|
229
|
-
console.log(`\n ${chalk.green('✓')} No longer tracked (${resolved.length}):`);
|
|
230
|
-
for (const delta of resolved.slice(0, 5)) {
|
|
231
|
-
console.log(` ${chalk.green('-')} ${delta.relativePath}`);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
38
|
// ── Report: fix ───────────────────────────────────────────
|
|
235
39
|
export function reportDetectedIssues(issues, fixes) {
|
|
236
40
|
console.log(header('Detected Issues'));
|
|
@@ -255,789 +59,4 @@ export function reportFixResults(results) {
|
|
|
255
59
|
}
|
|
256
60
|
console.log('');
|
|
257
61
|
}
|
|
258
|
-
// ── Report: explain ───────────────────────────────────────
|
|
259
|
-
export function reportExplanation(explanation) {
|
|
260
|
-
console.log(header('File Explanation'));
|
|
261
|
-
console.log(`\n ${chalk.bold('File:')} ${explanation.filePath}`);
|
|
262
|
-
console.log(` ${chalk.bold('Lines:')} ${explanation.lineCount}`);
|
|
263
|
-
console.log(` ${chalk.bold('Purpose:')} ${explanation.purpose}`);
|
|
264
|
-
if (explanation.imports.length > 0) {
|
|
265
|
-
console.log(header('Dependencies'));
|
|
266
|
-
for (const imp of explanation.imports) {
|
|
267
|
-
const prefix = imp.isRelative ? chalk.dim('(local)') : chalk.cyan('(package)');
|
|
268
|
-
console.log(` ${prefix} ${imp.source}`);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
if (explanation.exports.length > 0) {
|
|
272
|
-
console.log(header('Key Exports'));
|
|
273
|
-
for (const exp of explanation.exports) {
|
|
274
|
-
const typeLabel = chalk.dim(`[${exp.type}]`);
|
|
275
|
-
console.log(` ${chalk.green('→')} ${exp.name} ${typeLabel}`);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
if (explanation.potentialIssues.length > 0) {
|
|
279
|
-
console.log(header('Potential Issues'));
|
|
280
|
-
for (const issue of explanation.potentialIssues) {
|
|
281
|
-
console.log(` ${chalk.yellow('⚠')} ${issue}`);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
console.log('');
|
|
285
|
-
}
|
|
286
|
-
// ── Report: diagram ───────────────────────────────────────
|
|
287
|
-
export function reportDiagram(layers) {
|
|
288
|
-
console.log(header('Project Architecture'));
|
|
289
|
-
console.log('');
|
|
290
|
-
for (let i = 0; i < layers.length; i++) {
|
|
291
|
-
const layer = layers[i];
|
|
292
|
-
const isLast = i === layers.length - 1;
|
|
293
|
-
const connector = isLast ? '└' : '├';
|
|
294
|
-
const techStr = layer.technologies.length > 0 ? layer.technologies.join(' / ') : 'Unknown';
|
|
295
|
-
console.log(` ${chalk.bold(layer.name)}`);
|
|
296
|
-
console.log(` ${connector}─ ${chalk.cyan(techStr)}`);
|
|
297
|
-
if (layer.directories.length > 0) {
|
|
298
|
-
for (let j = 0; j < layer.directories.length; j++) {
|
|
299
|
-
const dirConnector = j === layer.directories.length - 1 ? '└' : '├';
|
|
300
|
-
const prefix = isLast ? ' ' : '│ ';
|
|
301
|
-
console.log(` ${prefix}${dirConnector}─ ${chalk.dim(layer.directories[j])}`);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
if (!isLast)
|
|
305
|
-
console.log(' │');
|
|
306
|
-
}
|
|
307
|
-
console.log('');
|
|
308
|
-
}
|
|
309
|
-
// ── Report: structure ─────────────────────────────────────
|
|
310
|
-
export function reportStructure(tree, projectName) {
|
|
311
|
-
console.log(header('Project Structure'));
|
|
312
|
-
console.log(`\n ${chalk.bold(projectName ?? tree.name + '/')} ${chalk.dim(`(${tree.totalFileCount} files)`)}`);
|
|
313
|
-
printTree(tree.children, ' ');
|
|
314
|
-
console.log('');
|
|
315
|
-
}
|
|
316
|
-
function printTree(nodes, indent) {
|
|
317
|
-
for (let i = 0; i < nodes.length; i++) {
|
|
318
|
-
const node = nodes[i];
|
|
319
|
-
const isLast = i === nodes.length - 1;
|
|
320
|
-
const connector = isLast ? '└── ' : '├── ';
|
|
321
|
-
const childIndent = isLast ? ' ' : '│ ';
|
|
322
|
-
const count = chalk.dim(`(${node.totalFileCount} files)`);
|
|
323
|
-
console.log(`${indent}${connector}${chalk.bold(node.name + '/')} ${count}`);
|
|
324
|
-
if (node.children.length > 0) {
|
|
325
|
-
printTree(node.children, indent + childIndent);
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
// ── Report: dependencies ──────────────────────────────────
|
|
330
|
-
export function reportDependencies(report) {
|
|
331
|
-
console.log(header('Dependency Report'));
|
|
332
|
-
console.log(`\n Production: ${chalk.bold(String(report.totalDependencies))} packages`);
|
|
333
|
-
console.log(` Development: ${chalk.bold(String(report.totalDevDependencies))} packages`);
|
|
334
|
-
console.log(` Total: ${chalk.bold(String(report.totalDependencies + report.totalDevDependencies))} packages`);
|
|
335
|
-
if (Object.keys(report.dependencies).length > 0) {
|
|
336
|
-
console.log(header('Production Dependencies'));
|
|
337
|
-
const deps = Object.entries(report.dependencies).sort(([a], [b]) => a.localeCompare(b));
|
|
338
|
-
for (const [name, version] of deps.slice(0, 25)) {
|
|
339
|
-
console.log(` ${chalk.dim('•')} ${name} ${chalk.dim(version)}`);
|
|
340
|
-
}
|
|
341
|
-
if (deps.length > 25) {
|
|
342
|
-
console.log(` ${chalk.dim(`... and ${deps.length - 25} more`)}`);
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
if (report.licenses) {
|
|
346
|
-
console.log(header('License Summary'));
|
|
347
|
-
const totalKnown = report.licenses.packages.length - report.licenses.unknown.length;
|
|
348
|
-
console.log(` Known: ${chalk.bold(String(totalKnown))}`);
|
|
349
|
-
console.log(` Unknown: ${chalk.bold(String(report.licenses.unknown.length))}`);
|
|
350
|
-
console.log(` Copyleft: ${chalk.bold(String(report.licenses.copyleft.length))}`);
|
|
351
|
-
for (const [license, count] of Object.entries(report.licenses.byLicense).slice(0, 8)) {
|
|
352
|
-
console.log(` ${chalk.dim('•')} ${license}: ${count}`);
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
if (report.sizes && report.sizes.largest.length > 0) {
|
|
356
|
-
console.log(header('Installed Package Sizes'));
|
|
357
|
-
console.log(` Total: ${chalk.bold(report.sizes.formattedTotal)}`);
|
|
358
|
-
console.log(` Missing: ${chalk.bold(String(report.sizes.missing.length))}`);
|
|
359
|
-
for (const entry of report.sizes.largest.slice(0, 8)) {
|
|
360
|
-
const scope = entry.scope === 'production' ? 'prod' : 'dev';
|
|
361
|
-
console.log(` ${chalk.dim('•')} ${entry.name} ${chalk.dim(entry.version)} ${entry.formatted} ${chalk.dim(`(${scope})`)}`);
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
if (report.risks.length > 0) {
|
|
365
|
-
console.log(header('Risks'));
|
|
366
|
-
for (const risk of report.risks) {
|
|
367
|
-
const icon = risk.severity === 'high' ? chalk.red('✗') : chalk.yellow('⚠');
|
|
368
|
-
console.log(` ${icon} ${risk.name}: ${risk.reason}`);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
console.log('');
|
|
372
|
-
}
|
|
373
|
-
// ── Report: hotspots ──────────────────────────────────────
|
|
374
|
-
export function reportHotspots(report) {
|
|
375
|
-
console.log(header('Project Hotspots'));
|
|
376
|
-
if (!report.available) {
|
|
377
|
-
console.log(`\n ${chalk.yellow('⚠')} ${report.reason ?? 'Hotspot analysis unavailable.'}\n`);
|
|
378
|
-
return;
|
|
379
|
-
}
|
|
380
|
-
if (report.hotspots.length === 0) {
|
|
381
|
-
console.log(`\n ${chalk.green('✓')} No hotspots detected.`);
|
|
382
|
-
console.log(chalk.dim(` Scanned ${report.window.commitsScanned} commit${report.window.commitsScanned === 1 ? '' : 's'} since ${report.window.since}.\n`));
|
|
383
|
-
return;
|
|
384
|
-
}
|
|
385
|
-
console.log(chalk.dim(`\n ${report.window.commitsScanned} commit${report.window.commitsScanned === 1 ? '' : 's'} since ${report.window.since} · ${report.totalFilesRanked} file${report.totalFilesRanked === 1 ? '' : 's'} ranked\n`));
|
|
386
|
-
const maxScore = report.hotspots[0]?.riskScore ?? 1;
|
|
387
|
-
let hasAccepted = false;
|
|
388
|
-
for (let i = 0; i < report.hotspots.length; i++) {
|
|
389
|
-
const h = report.hotspots[i];
|
|
390
|
-
const rank = chalk.bold(String(i + 1).padStart(2, ' ') + '.');
|
|
391
|
-
const scoreLabel = chalk.bold(h.riskScore.toFixed(1).padStart(5, ' '));
|
|
392
|
-
const barPct = Math.min(100, Math.round((h.riskScore / maxScore) * 100));
|
|
393
|
-
// 1.5+ — accepted hotspots (Project Memory marked them as
|
|
394
|
-
// implicitly-accepted load-bearing debt) get a dim [accepted] tag
|
|
395
|
-
// so users aren't repeatedly pestered about the same files.
|
|
396
|
-
const acceptedTag = h.accepted ? ` ${chalk.dim('[accepted]')}` : '';
|
|
397
|
-
if (h.accepted)
|
|
398
|
-
hasAccepted = true;
|
|
399
|
-
console.log(` ${rank} ${scoreLabel} ${bar(barPct, 14)} ${chalk.cyan(h.relativePath)}${acceptedTag}`);
|
|
400
|
-
const reasonStr = h.reasons.length > 0 ? h.reasons.join(', ') : 'ranked by risk';
|
|
401
|
-
console.log(` ${chalk.dim(reasonStr)}`);
|
|
402
|
-
}
|
|
403
|
-
if (hasAccepted) {
|
|
404
|
-
console.log(chalk.dim(`\n ${chalk.cyan('▲')} [accepted] = top-5 for ≥ 5 runs over ≥ 7 days without improving (Project Memory).`));
|
|
405
|
-
}
|
|
406
|
-
console.log(chalk.dim(`\n Tip: run ${chalk.bold.cyan('projscan file <file>')} to drill into a hotspot.\n`));
|
|
407
|
-
}
|
|
408
|
-
// ── Report: file (drill-down) ─────────────────────────────
|
|
409
|
-
export function reportFileInspection(insp) {
|
|
410
|
-
console.log(header('File Report'));
|
|
411
|
-
if (!insp.exists) {
|
|
412
|
-
console.log(`\n ${chalk.red('✗')} ${insp.reason ?? 'File unavailable.'}\n`);
|
|
413
|
-
return;
|
|
414
|
-
}
|
|
415
|
-
printFileSummary(insp);
|
|
416
|
-
printFileHotspot(insp);
|
|
417
|
-
printFileIssues(insp);
|
|
418
|
-
printFilePotentialIssues(insp);
|
|
419
|
-
printFileImports(insp);
|
|
420
|
-
printFileExports(insp);
|
|
421
|
-
printFileFunctions(insp);
|
|
422
|
-
console.log('');
|
|
423
|
-
}
|
|
424
|
-
function printFileSummary(insp) {
|
|
425
|
-
console.log(`\n ${chalk.bold('File:')} ${insp.relativePath}`);
|
|
426
|
-
console.log(` ${chalk.bold('Purpose:')} ${insp.purpose}`);
|
|
427
|
-
console.log(` ${chalk.bold('Lines:')} ${insp.lineCount}`);
|
|
428
|
-
console.log(` ${chalk.bold('Size:')} ${formatSize(insp.sizeBytes)}`);
|
|
429
|
-
if (typeof insp.cyclomaticComplexity === 'number') {
|
|
430
|
-
console.log(` ${chalk.bold('CC:')} ${insp.cyclomaticComplexity}`);
|
|
431
|
-
}
|
|
432
|
-
if (typeof insp.fanIn === 'number' || typeof insp.fanOut === 'number') {
|
|
433
|
-
console.log(` ${chalk.bold('Coupling:')} fan-in ${insp.fanIn ?? '-'}, fan-out ${insp.fanOut ?? '-'}`);
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
function printFileHotspot(insp) {
|
|
437
|
-
if (!insp.hotspot) {
|
|
438
|
-
console.log(chalk.dim('\n No hotspot data (file is untouched in git window or outside analysis scope).'));
|
|
439
|
-
return;
|
|
440
|
-
}
|
|
441
|
-
const h = insp.hotspot;
|
|
442
|
-
console.log(header('Risk'));
|
|
443
|
-
console.log(` ${chalk.bold('Risk Score:')} ${chalk.bold(h.riskScore.toFixed(1))}`);
|
|
444
|
-
console.log(` ${chalk.bold('Commits:')} ${h.churn}`);
|
|
445
|
-
const primary = h.primaryAuthor
|
|
446
|
-
? ` (primary: ${formatAuthorEmail(h.primaryAuthor)}, ${Math.round(h.primaryAuthorShare * 100)}%)`
|
|
447
|
-
: '';
|
|
448
|
-
console.log(` ${chalk.bold('Authors:')} ${h.distinctAuthors}${primary}`);
|
|
449
|
-
if (h.daysSinceLastChange !== null) {
|
|
450
|
-
console.log(` ${chalk.bold('Last change:')} ${h.daysSinceLastChange} days ago`);
|
|
451
|
-
}
|
|
452
|
-
if (h.busFactorOne) {
|
|
453
|
-
console.log(` ${chalk.red('⚠')} Bus factor 1 - only one author has touched this.`);
|
|
454
|
-
}
|
|
455
|
-
if (h.reasons.length > 0) {
|
|
456
|
-
console.log(` ${chalk.dim(h.reasons.join(', '))}`);
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
function printFileIssues(insp) {
|
|
460
|
-
if (insp.issues.length === 0)
|
|
461
|
-
return;
|
|
462
|
-
console.log(header('Related Issues'));
|
|
463
|
-
for (const issue of insp.issues) {
|
|
464
|
-
console.log(` ${severityIcon(issue.severity)} ${issue.title}`);
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
function printFilePotentialIssues(insp) {
|
|
468
|
-
if (insp.potentialIssues.length === 0)
|
|
469
|
-
return;
|
|
470
|
-
console.log(header('Potential Issues'));
|
|
471
|
-
for (const issue of insp.potentialIssues) {
|
|
472
|
-
console.log(` ${chalk.yellow('⚠')} ${issue}`);
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
function printFileImports(insp) {
|
|
476
|
-
if (insp.imports.length === 0)
|
|
477
|
-
return;
|
|
478
|
-
console.log(header('Dependencies'));
|
|
479
|
-
for (const imp of insp.imports.slice(0, 20)) {
|
|
480
|
-
const prefix = imp.isRelative ? chalk.dim('(local)') : chalk.cyan('(package)');
|
|
481
|
-
console.log(` ${prefix} ${imp.source}`);
|
|
482
|
-
}
|
|
483
|
-
if (insp.imports.length > 20) {
|
|
484
|
-
console.log(chalk.dim(` ... and ${insp.imports.length - 20} more`));
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
function printFileExports(insp) {
|
|
488
|
-
if (insp.exports.length === 0)
|
|
489
|
-
return;
|
|
490
|
-
console.log(header('Exports'));
|
|
491
|
-
for (const exp of insp.exports) {
|
|
492
|
-
console.log(` ${chalk.dim('•')} ${chalk.bold(exp.name)} ${chalk.dim(`(${exp.type})`)}`);
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
function printFileFunctions(insp) {
|
|
496
|
-
if (!insp.functions || insp.functions.length === 0)
|
|
497
|
-
return;
|
|
498
|
-
console.log(header('Functions (top by CC)'));
|
|
499
|
-
const top = insp.functions.slice(0, 10);
|
|
500
|
-
for (const fn of top) {
|
|
501
|
-
const ccColor = fn.cyclomaticComplexity >= 10
|
|
502
|
-
? chalk.red
|
|
503
|
-
: fn.cyclomaticComplexity >= 5
|
|
504
|
-
? chalk.yellow
|
|
505
|
-
: chalk.dim;
|
|
506
|
-
const fiStr = typeof fn.fanIn === 'number' ? `fan-in ${String(fn.fanIn).padStart(2)}` : ' ';
|
|
507
|
-
console.log(` ${ccColor(`CC ${String(fn.cyclomaticComplexity).padStart(3)}`)} ${chalk.dim(fiStr)} ${chalk.bold(fn.name)} ${chalk.dim(`L${fn.line}-${fn.endLine}`)}`);
|
|
508
|
-
}
|
|
509
|
-
if (insp.functions.length > 10) {
|
|
510
|
-
console.log(chalk.dim(` ... and ${insp.functions.length - 10} more`));
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
function formatSize(bytes) {
|
|
514
|
-
if (bytes < 1024)
|
|
515
|
-
return `${bytes} B`;
|
|
516
|
-
if (bytes < 1024 * 1024)
|
|
517
|
-
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
518
|
-
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
519
|
-
}
|
|
520
|
-
// ── Report: outdated ──────────────────────────────────────
|
|
521
|
-
const DRIFT_COLORS = {
|
|
522
|
-
major: chalk.red,
|
|
523
|
-
minor: chalk.yellow,
|
|
524
|
-
patch: chalk.blue,
|
|
525
|
-
same: chalk.dim,
|
|
526
|
-
unknown: chalk.dim,
|
|
527
|
-
};
|
|
528
|
-
export function reportOutdated(report) {
|
|
529
|
-
if (!report.available) {
|
|
530
|
-
console.log(chalk.yellow(`\n ${report.reason}\n`));
|
|
531
|
-
return;
|
|
532
|
-
}
|
|
533
|
-
const drifting = report.packages.filter((p) => p.drift !== 'same' && p.drift !== 'unknown');
|
|
534
|
-
const missing = report.packages.filter((p) => !p.installed);
|
|
535
|
-
console.log(header('Outdated Packages'));
|
|
536
|
-
console.log(` ${chalk.bold(report.totalPackages)} declared · ${chalk.bold(drifting.length)} drifted · ${chalk.bold(missing.length)} not installed\n`);
|
|
537
|
-
if (drifting.length === 0 && missing.length === 0) {
|
|
538
|
-
console.log(` ${chalk.green('✓')} All declared packages match installed versions.\n`);
|
|
539
|
-
return;
|
|
540
|
-
}
|
|
541
|
-
// Group by drift
|
|
542
|
-
for (const level of ['major', 'minor', 'patch']) {
|
|
543
|
-
const pkgs = drifting.filter((p) => p.drift === level);
|
|
544
|
-
if (pkgs.length === 0)
|
|
545
|
-
continue;
|
|
546
|
-
const colour = DRIFT_COLORS[level];
|
|
547
|
-
console.log(` ${colour.bold(level.toUpperCase())} (${pkgs.length})`);
|
|
548
|
-
for (const p of pkgs) {
|
|
549
|
-
const scope = p.scope === 'devDependency' ? chalk.dim(' [dev]') : '';
|
|
550
|
-
console.log(` ${chalk.bold(p.name.padEnd(30))} ${chalk.dim(p.declared)} → ${colour(p.installed ?? '?')}${scope}`);
|
|
551
|
-
}
|
|
552
|
-
console.log('');
|
|
553
|
-
}
|
|
554
|
-
if (missing.length > 0) {
|
|
555
|
-
console.log(` ${chalk.dim('Not installed')} (${missing.length})`);
|
|
556
|
-
for (const p of missing.slice(0, 10)) {
|
|
557
|
-
console.log(` ${chalk.dim(p.name)} ${chalk.dim(p.declared)}`);
|
|
558
|
-
}
|
|
559
|
-
if (missing.length > 10)
|
|
560
|
-
console.log(` ${chalk.dim(`… and ${missing.length - 10} more`)}`);
|
|
561
|
-
console.log('');
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
// ── Report: audit ─────────────────────────────────────────
|
|
565
|
-
const SEVERITY_COLORS = {
|
|
566
|
-
critical: chalk.red.bold,
|
|
567
|
-
high: chalk.red,
|
|
568
|
-
moderate: chalk.yellow,
|
|
569
|
-
low: chalk.blue,
|
|
570
|
-
info: chalk.dim,
|
|
571
|
-
};
|
|
572
|
-
export function reportAudit(report) {
|
|
573
|
-
if (!report.available) {
|
|
574
|
-
console.log(chalk.yellow(`\n ${report.reason}\n`));
|
|
575
|
-
return;
|
|
576
|
-
}
|
|
577
|
-
console.log(header('Vulnerability Audit'));
|
|
578
|
-
const { summary, findings } = report;
|
|
579
|
-
const total = summary.critical + summary.high + summary.moderate + summary.low + summary.info;
|
|
580
|
-
if (total === 0) {
|
|
581
|
-
console.log(` ${chalk.green('✓')} ${chalk.bold('No known vulnerabilities.')}\n`);
|
|
582
|
-
return;
|
|
583
|
-
}
|
|
584
|
-
console.log(` ${SEVERITY_COLORS.critical(`${summary.critical} critical`)} · ` +
|
|
585
|
-
`${SEVERITY_COLORS.high(`${summary.high} high`)} · ` +
|
|
586
|
-
`${SEVERITY_COLORS.moderate(`${summary.moderate} moderate`)} · ` +
|
|
587
|
-
`${SEVERITY_COLORS.low(`${summary.low} low`)} · ` +
|
|
588
|
-
`${SEVERITY_COLORS.info(`${summary.info} info`)}\n`);
|
|
589
|
-
for (const f of findings.slice(0, 30)) {
|
|
590
|
-
const colour = SEVERITY_COLORS[f.severity];
|
|
591
|
-
const fix = f.fixAvailable ? chalk.green(' (fix available)') : '';
|
|
592
|
-
console.log(` ${colour(`[${f.severity.toUpperCase()}]`)} ${chalk.bold(f.name)}${fix}`);
|
|
593
|
-
console.log(` ${f.title}`);
|
|
594
|
-
if (f.range)
|
|
595
|
-
console.log(` ${chalk.dim(`range: ${f.range}`)}`);
|
|
596
|
-
if (f.url)
|
|
597
|
-
console.log(` ${chalk.dim(f.url)}`);
|
|
598
|
-
console.log('');
|
|
599
|
-
}
|
|
600
|
-
if (findings.length > 30) {
|
|
601
|
-
console.log(chalk.dim(` … and ${findings.length - 30} more. Use --format json for full list.\n`));
|
|
602
|
-
}
|
|
603
|
-
console.log(chalk.dim(' Tip: run `npm audit fix` to auto-apply safe upgrades.\n'));
|
|
604
|
-
}
|
|
605
|
-
// ── Report: upgrade ───────────────────────────────────────
|
|
606
|
-
export function reportUpgrade(preview) {
|
|
607
|
-
if (!preview.available) {
|
|
608
|
-
console.log(chalk.yellow(`\n ${preview.reason ?? 'Upgrade preview unavailable'}\n`));
|
|
609
|
-
return;
|
|
610
|
-
}
|
|
611
|
-
console.log(header(`Upgrade Preview - ${preview.name}`));
|
|
612
|
-
const drift = DRIFT_COLORS[preview.drift] ?? chalk.dim;
|
|
613
|
-
console.log(` Declared: ${chalk.dim(preview.declared ?? '-')}`);
|
|
614
|
-
console.log(` Installed: ${chalk.bold(preview.installed ?? '-')}`);
|
|
615
|
-
console.log(` Drift: ${drift(preview.drift.toUpperCase())}`);
|
|
616
|
-
console.log('');
|
|
617
|
-
if (preview.breakingMarkers.length > 0) {
|
|
618
|
-
console.log(chalk.red.bold(' ⚠ Breaking-change markers detected:'));
|
|
619
|
-
for (const m of preview.breakingMarkers) {
|
|
620
|
-
console.log(` ${chalk.red('•')} ${m.slice(0, 100)}`);
|
|
621
|
-
}
|
|
622
|
-
console.log('');
|
|
623
|
-
}
|
|
624
|
-
else {
|
|
625
|
-
console.log(chalk.green(' ✓ No obvious breaking-change markers detected.\n'));
|
|
626
|
-
}
|
|
627
|
-
if (preview.importers.length > 0) {
|
|
628
|
-
console.log(chalk.bold(` Importers (${preview.importers.length}):`));
|
|
629
|
-
for (const file of preview.importers.slice(0, 15)) {
|
|
630
|
-
console.log(` ${chalk.dim('•')} ${file}`);
|
|
631
|
-
}
|
|
632
|
-
if (preview.importers.length > 15) {
|
|
633
|
-
console.log(chalk.dim(` … and ${preview.importers.length - 15} more`));
|
|
634
|
-
}
|
|
635
|
-
console.log('');
|
|
636
|
-
}
|
|
637
|
-
else {
|
|
638
|
-
console.log(chalk.dim(' No direct importers found in source.\n'));
|
|
639
|
-
}
|
|
640
|
-
if (preview.changelogExcerpt) {
|
|
641
|
-
console.log(chalk.bold(' CHANGELOG excerpt:'));
|
|
642
|
-
const lines = preview.changelogExcerpt.split('\n').slice(0, 40);
|
|
643
|
-
for (const line of lines)
|
|
644
|
-
console.log(` ${chalk.dim(line)}`);
|
|
645
|
-
console.log('');
|
|
646
|
-
}
|
|
647
|
-
else {
|
|
648
|
-
console.log(chalk.dim(' No local CHANGELOG found (node_modules/<pkg>/CHANGELOG.md).\n'));
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
// ── Report: coverage × hotspots ───────────────────────────
|
|
652
|
-
export function reportCoverage(report) {
|
|
653
|
-
if (!report.available) {
|
|
654
|
-
console.log(chalk.yellow(`\n ${report.reason ?? 'Coverage report unavailable'}\n`));
|
|
655
|
-
return;
|
|
656
|
-
}
|
|
657
|
-
console.log(header('Coverage × Hotspots - "Scariest Untested Files"'));
|
|
658
|
-
const src = report.coverageSourceFile ? ` (${report.coverageSourceFile})` : '';
|
|
659
|
-
console.log(chalk.dim(` Source: ${report.coverageSource}${src}`));
|
|
660
|
-
console.log('');
|
|
661
|
-
if (report.entries.length === 0) {
|
|
662
|
-
console.log(` ${chalk.green('✓')} No hotspots intersected with coverage data.\n`);
|
|
663
|
-
return;
|
|
664
|
-
}
|
|
665
|
-
for (const e of report.entries.slice(0, 20)) {
|
|
666
|
-
const covStr = e.coverage === null ? chalk.dim('n/a') : formatCoverage(e.coverage);
|
|
667
|
-
const pri = chalk.bold(e.priority.toFixed(1).padStart(6));
|
|
668
|
-
console.log(` ${pri} cov ${covStr} risk ${chalk.dim(e.riskScore.toFixed(1))} churn ${chalk.dim(String(e.churn))} ${chalk.bold(e.relativePath)}`);
|
|
669
|
-
if (e.reasons.length > 0) {
|
|
670
|
-
console.log(` ${chalk.dim(e.reasons.join(', '))}`);
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
if (report.entries.length > 20) {
|
|
674
|
-
console.log(chalk.dim(`\n … and ${report.entries.length - 20} more.\n`));
|
|
675
|
-
}
|
|
676
|
-
else {
|
|
677
|
-
console.log('');
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
function formatCoverage(pct) {
|
|
681
|
-
const padded = `${pct.toFixed(0)}%`.padStart(4);
|
|
682
|
-
if (pct < 40)
|
|
683
|
-
return chalk.red(padded);
|
|
684
|
-
if (pct < 70)
|
|
685
|
-
return chalk.yellow(padded);
|
|
686
|
-
if (pct < 90)
|
|
687
|
-
return chalk.blue(padded);
|
|
688
|
-
return chalk.green(padded);
|
|
689
|
-
}
|
|
690
|
-
function formatAuthorEmail(email) {
|
|
691
|
-
const at = email.indexOf('@');
|
|
692
|
-
return at > 0 ? email.slice(0, at) : email;
|
|
693
|
-
}
|
|
694
|
-
// ── Report: coupling ──────────────────────────────────────
|
|
695
|
-
export function reportCoupling(report) {
|
|
696
|
-
console.log(header('Coupling + Cycles'));
|
|
697
|
-
if (report.totalFiles === 0) {
|
|
698
|
-
console.log(`\n ${chalk.yellow('⚠')} No files in the code graph (no language adapter matched).\n`);
|
|
699
|
-
return;
|
|
700
|
-
}
|
|
701
|
-
const xpkg = report.totalCrossPackageEdges;
|
|
702
|
-
console.log(chalk.dim(`\n ${report.totalFiles} file${report.totalFiles === 1 ? '' : 's'} in graph · ${report.totalCycles} cycle${report.totalCycles === 1 ? '' : 's'}${xpkg > 0 ? ` · ${xpkg} cross-package edge${xpkg === 1 ? '' : 's'}` : ''}\n`));
|
|
703
|
-
if (report.cycles.length > 0) {
|
|
704
|
-
console.log(chalk.bold(' Import cycles:'));
|
|
705
|
-
for (const c of report.cycles) {
|
|
706
|
-
console.log(` ${chalk.red('●')} cycle of ${c.size} files: ${c.files.join(' → ')} → …`);
|
|
707
|
-
}
|
|
708
|
-
console.log('');
|
|
709
|
-
}
|
|
710
|
-
if (report.crossPackageEdges.length > 0) {
|
|
711
|
-
console.log(chalk.bold(' Cross-package edges:'));
|
|
712
|
-
for (const e of report.crossPackageEdges.slice(0, 25)) {
|
|
713
|
-
console.log(` ${chalk.yellow('→')} ${chalk.cyan(e.from.file)} ${chalk.dim(`(${e.from.package})`)} → ${chalk.cyan(e.to.file)} ${chalk.dim(`(${e.to.package})`)}`);
|
|
714
|
-
}
|
|
715
|
-
if (report.crossPackageEdges.length > 25) {
|
|
716
|
-
console.log(chalk.dim(` … and ${report.crossPackageEdges.length - 25} more`));
|
|
717
|
-
}
|
|
718
|
-
console.log('');
|
|
719
|
-
}
|
|
720
|
-
if (report.files.length > 0) {
|
|
721
|
-
console.log(chalk.bold(' Files (sorted by request):'));
|
|
722
|
-
const colHeader = ` ${'fan-in'.padStart(6)} ${'fan-out'.padStart(7)} ${'instab'.padStart(6)} file`;
|
|
723
|
-
console.log(chalk.dim(colHeader));
|
|
724
|
-
for (const f of report.files) {
|
|
725
|
-
console.log(` ${String(f.fanIn).padStart(6)} ${String(f.fanOut).padStart(7)} ${f.instability.toFixed(2).padStart(6)} ${chalk.cyan(f.relativePath)}`);
|
|
726
|
-
}
|
|
727
|
-
console.log('');
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
// ── Report: PR diff ───────────────────────────────────────
|
|
731
|
-
export function reportPrDiff(report) {
|
|
732
|
-
console.log(header('PR Structural Diff'));
|
|
733
|
-
if (!report.available) {
|
|
734
|
-
console.log(`\n ${chalk.yellow('⚠')} ${report.reason ?? 'PR diff unavailable.'}\n`);
|
|
735
|
-
return;
|
|
736
|
-
}
|
|
737
|
-
printPrDiffRefs(report);
|
|
738
|
-
printPrDiffFileTotals(report);
|
|
739
|
-
printPrDiffAdded(report);
|
|
740
|
-
printPrDiffRemoved(report);
|
|
741
|
-
printPrDiffModified(report);
|
|
742
|
-
}
|
|
743
|
-
function printPrDiffRefs(report) {
|
|
744
|
-
console.log(chalk.dim(`\n base ${report.base.ref} (${report.base.resolvedSha?.slice(0, 7) ?? '?'}) → head ${report.head.ref} (${report.head.resolvedSha?.slice(0, 7) ?? '?'})\n`));
|
|
745
|
-
}
|
|
746
|
-
function printPrDiffFileTotals(report) {
|
|
747
|
-
const fileLabel = report.totalFilesChanged === 1 ? '' : 's';
|
|
748
|
-
console.log(` ${chalk.bold(report.totalFilesChanged.toString())} file${fileLabel} changed: ${chalk.green(`+${report.filesAdded.length}`)} ${chalk.red(`-${report.filesRemoved.length}`)} ${chalk.yellow(`~${report.filesModified.length}`)}\n`);
|
|
749
|
-
}
|
|
750
|
-
function printPrDiffAdded(report) {
|
|
751
|
-
if (report.filesAdded.length === 0)
|
|
752
|
-
return;
|
|
753
|
-
console.log(chalk.bold(' Added:'));
|
|
754
|
-
for (const f of report.filesAdded)
|
|
755
|
-
console.log(` ${chalk.green('+')} ${f}`);
|
|
756
|
-
console.log('');
|
|
757
|
-
}
|
|
758
|
-
function printPrDiffRemoved(report) {
|
|
759
|
-
if (report.filesRemoved.length === 0)
|
|
760
|
-
return;
|
|
761
|
-
console.log(chalk.bold(' Removed:'));
|
|
762
|
-
for (const f of report.filesRemoved)
|
|
763
|
-
console.log(` ${chalk.red('-')} ${f}`);
|
|
764
|
-
console.log('');
|
|
765
|
-
}
|
|
766
|
-
function printPrDiffModified(report) {
|
|
767
|
-
if (report.filesModified.length === 0)
|
|
768
|
-
return;
|
|
769
|
-
console.log(chalk.bold(' Modified:'));
|
|
770
|
-
for (const m of report.filesModified)
|
|
771
|
-
printPrDiffModifiedFile(m);
|
|
772
|
-
console.log('');
|
|
773
|
-
}
|
|
774
|
-
function printPrDiffModifiedFile(m) {
|
|
775
|
-
const ccDelta = m.cyclomaticDelta;
|
|
776
|
-
const fiDelta = m.fanInDelta;
|
|
777
|
-
const ccStr = ccDelta === null ? '' : `, ΔCC ${signed(ccDelta)}`;
|
|
778
|
-
const finStr = fiDelta === null || fiDelta === 0 ? '' : `, Δfan-in ${signed(fiDelta)}`;
|
|
779
|
-
console.log(` ${chalk.yellow('~')} ${chalk.cyan(m.relativePath)}${chalk.dim(ccStr + finStr)}`);
|
|
780
|
-
if (m.exportsAdded.length > 0) {
|
|
781
|
-
console.log(` ${chalk.green('+exports:')} ${m.exportsAdded.join(', ')}`);
|
|
782
|
-
}
|
|
783
|
-
if (m.exportsRemoved.length > 0) {
|
|
784
|
-
console.log(` ${chalk.red('-exports:')} ${m.exportsRemoved.join(', ')}`);
|
|
785
|
-
}
|
|
786
|
-
if (m.exportsRenamed.length > 0) {
|
|
787
|
-
const pairs = m.exportsRenamed.map((r) => `${r.from} → ${r.to}`).join(', ');
|
|
788
|
-
console.log(` ${chalk.yellow('~exports:')} ${pairs}`);
|
|
789
|
-
}
|
|
790
|
-
if (m.importsAdded.length > 0) {
|
|
791
|
-
console.log(` ${chalk.green('+imports:')} ${m.importsAdded.join(', ')}`);
|
|
792
|
-
}
|
|
793
|
-
if (m.importsRemoved.length > 0) {
|
|
794
|
-
console.log(` ${chalk.red('-imports:')} ${m.importsRemoved.join(', ')}`);
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
function signed(n) {
|
|
798
|
-
return n >= 0 ? `+${n}` : String(n);
|
|
799
|
-
}
|
|
800
|
-
// ── Report: impact ────────────────────────────────────────
|
|
801
|
-
export function reportImpact(report) {
|
|
802
|
-
console.log(header('Impact'));
|
|
803
|
-
if (!report.available) {
|
|
804
|
-
console.log(`\n ${chalk.yellow('⚠')} ${report.reason ?? 'Impact unavailable.'}\n`);
|
|
805
|
-
return;
|
|
806
|
-
}
|
|
807
|
-
console.log(`\n ${chalk.bold(report.target.kind)}: ${chalk.cyan(report.target.value)}\n`);
|
|
808
|
-
if (report.target.kind === 'symbol') {
|
|
809
|
-
console.log(` ${chalk.dim(`definitions: ${report.definitionFiles.length} · direct callers: ${report.directCallers.length}`)}`);
|
|
810
|
-
if (report.definitionFiles.length > 0) {
|
|
811
|
-
console.log(chalk.bold('\n Defined in:'));
|
|
812
|
-
for (const f of report.definitionFiles)
|
|
813
|
-
console.log(` ${chalk.cyan(f)}`);
|
|
814
|
-
}
|
|
815
|
-
console.log('');
|
|
816
|
-
}
|
|
817
|
-
const truncatedNote = report.truncated
|
|
818
|
-
? chalk.yellow(' (truncated; more files exist beyond)')
|
|
819
|
-
: '';
|
|
820
|
-
console.log(` ${chalk.bold(report.totalReachable.toString())} file(s) reachable within distance ${report.maxDistance}${truncatedNote}\n`);
|
|
821
|
-
if (report.reachable.length === 0) {
|
|
822
|
-
console.log(chalk.dim(' No reachable files.\n'));
|
|
823
|
-
return;
|
|
824
|
-
}
|
|
825
|
-
let lastDistance = -1;
|
|
826
|
-
for (const n of report.reachable.slice(0, 50)) {
|
|
827
|
-
if (n.distance !== lastDistance) {
|
|
828
|
-
console.log(chalk.bold(` Distance ${n.distance}:`));
|
|
829
|
-
lastDistance = n.distance;
|
|
830
|
-
}
|
|
831
|
-
console.log(` ${chalk.cyan(n.file)}`);
|
|
832
|
-
}
|
|
833
|
-
if (report.reachable.length > 50) {
|
|
834
|
-
console.log(chalk.dim(` ... and ${report.reachable.length - 50} more\n`));
|
|
835
|
-
}
|
|
836
|
-
else {
|
|
837
|
-
console.log('');
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
// ── Report: fix-suggest ───────────────────────────────────
|
|
841
|
-
export function reportFixSuggest(result) {
|
|
842
|
-
console.log(header('Fix Suggestion'));
|
|
843
|
-
if (!result.matched || !result.fix) {
|
|
844
|
-
console.log(`\n ${chalk.yellow('⚠')} ${result.reason ?? 'No suggestion available.'}\n`);
|
|
845
|
-
return;
|
|
846
|
-
}
|
|
847
|
-
const fix = result.fix;
|
|
848
|
-
const sevColor = fix.severity === 'error' ? chalk.red : fix.severity === 'warning' ? chalk.yellow : chalk.dim;
|
|
849
|
-
console.log(`\n ${chalk.bold(fix.headline)}\n`);
|
|
850
|
-
console.log(chalk.dim(` ${sevColor(fix.severity)} · ${fix.category} · ${fix.issueId}${result.synthetic ? ' (synthetic)' : ''}\n`));
|
|
851
|
-
console.log(chalk.bold(' Why'));
|
|
852
|
-
for (const line of wrapLines(fix.why, 76))
|
|
853
|
-
console.log(` ${line}`);
|
|
854
|
-
if (fix.where.length > 0) {
|
|
855
|
-
console.log('\n' + chalk.bold(' Where'));
|
|
856
|
-
for (const w of fix.where) {
|
|
857
|
-
const loc = w.line ? `${w.file}:${w.line}` : w.file;
|
|
858
|
-
console.log(` ${chalk.cyan(loc)}`);
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
console.log('\n' + chalk.bold(' Action'));
|
|
862
|
-
for (const line of wrapLines(fix.instruction, 76))
|
|
863
|
-
console.log(` ${line}`);
|
|
864
|
-
if (fix.suggestedTest) {
|
|
865
|
-
console.log('\n' + chalk.bold(' Verify'));
|
|
866
|
-
for (const line of wrapLines(fix.suggestedTest, 76))
|
|
867
|
-
console.log(` ${line}`);
|
|
868
|
-
}
|
|
869
|
-
if (fix.relatedFiles && fix.relatedFiles.length > 0) {
|
|
870
|
-
console.log('\n' + chalk.bold(' Related files'));
|
|
871
|
-
for (const f of fix.relatedFiles)
|
|
872
|
-
console.log(` ${chalk.cyan(f)}`);
|
|
873
|
-
}
|
|
874
|
-
console.log('');
|
|
875
|
-
}
|
|
876
|
-
export function reportExplainIssue(e) {
|
|
877
|
-
console.log(header('Issue Explanation'));
|
|
878
|
-
console.log(`\n ${chalk.bold(e.title)} ${chalk.dim(`(${e.issueId})`)}`);
|
|
879
|
-
console.log(` ${chalk.dim(`severity: ${e.severity} · category: ${e.category}`)}\n`);
|
|
880
|
-
console.log(` ${chalk.bold(e.headline)}\n`);
|
|
881
|
-
if (e.excerpt) {
|
|
882
|
-
console.log(chalk.bold(` Code (${e.excerpt.file} L${e.excerpt.startLine}-${e.excerpt.endLine})`));
|
|
883
|
-
for (let i = 0; i < e.excerpt.lines.length; i++) {
|
|
884
|
-
const ln = e.excerpt.startLine + i;
|
|
885
|
-
console.log(` ${chalk.dim(String(ln).padStart(4))} ${e.excerpt.lines[i]}`);
|
|
886
|
-
}
|
|
887
|
-
console.log('');
|
|
888
|
-
}
|
|
889
|
-
if (e.relatedIssues.length > 0) {
|
|
890
|
-
console.log(chalk.bold(' Related issues in the same area:'));
|
|
891
|
-
for (const r of e.relatedIssues)
|
|
892
|
-
console.log(` ${chalk.dim('•')} ${r.id}: ${r.title}`);
|
|
893
|
-
console.log('');
|
|
894
|
-
}
|
|
895
|
-
if (e.similarFixes.length > 0) {
|
|
896
|
-
console.log(chalk.bold(' Past commits referencing this rule:'));
|
|
897
|
-
for (const f of e.similarFixes)
|
|
898
|
-
console.log(` ${chalk.dim(f.sha.slice(0, 7))} ${chalk.dim(`(${f.date})`)} ${f.subject}`);
|
|
899
|
-
console.log('');
|
|
900
|
-
}
|
|
901
|
-
if (e.fix) {
|
|
902
|
-
console.log(chalk.bold(' Suggested action:'));
|
|
903
|
-
for (const line of wrapLines(e.fix.instruction, 76))
|
|
904
|
-
console.log(` ${line}`);
|
|
905
|
-
if (e.fix.suggestedTest) {
|
|
906
|
-
console.log('\n ' + chalk.bold('Verify:') + ' ' + e.fix.suggestedTest);
|
|
907
|
-
}
|
|
908
|
-
console.log('');
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
function wrapLines(text, maxWidth) {
|
|
912
|
-
const out = [];
|
|
913
|
-
for (const para of text.split(/\n+/)) {
|
|
914
|
-
if (para.length <= maxWidth) {
|
|
915
|
-
out.push(para);
|
|
916
|
-
continue;
|
|
917
|
-
}
|
|
918
|
-
const words = para.split(/\s+/);
|
|
919
|
-
let cur = '';
|
|
920
|
-
for (const w of words) {
|
|
921
|
-
if ((cur + ' ' + w).trim().length > maxWidth) {
|
|
922
|
-
if (cur)
|
|
923
|
-
out.push(cur);
|
|
924
|
-
cur = w;
|
|
925
|
-
}
|
|
926
|
-
else {
|
|
927
|
-
cur = cur ? `${cur} ${w}` : w;
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
if (cur)
|
|
931
|
-
out.push(cur);
|
|
932
|
-
}
|
|
933
|
-
return out;
|
|
934
|
-
}
|
|
935
|
-
// ── Report: review ────────────────────────────────────────
|
|
936
|
-
export function reportReview(report) {
|
|
937
|
-
console.log(header('PR Review'));
|
|
938
|
-
if (!report.available) {
|
|
939
|
-
console.log(`\n ${chalk.yellow('⚠')} ${report.reason ?? 'Review unavailable.'}\n`);
|
|
940
|
-
return;
|
|
941
|
-
}
|
|
942
|
-
printReviewRefs(report);
|
|
943
|
-
printReviewVerdict(report);
|
|
944
|
-
printReviewSummary(report);
|
|
945
|
-
printReviewChangedFiles(report);
|
|
946
|
-
printReviewCycles(report);
|
|
947
|
-
printReviewRiskyFunctions(report);
|
|
948
|
-
printReviewDependencyChanges(report);
|
|
949
|
-
}
|
|
950
|
-
function printReviewRefs(report) {
|
|
951
|
-
console.log(chalk.dim(`\n base ${report.base.ref} (${report.base.resolvedSha?.slice(0, 7) ?? '?'}) → head ${report.head.ref} (${report.head.resolvedSha?.slice(0, 7) ?? '?'})\n`));
|
|
952
|
-
}
|
|
953
|
-
function printReviewVerdict(report) {
|
|
954
|
-
const verdictColor = report.verdict === 'block' ? chalk.red : report.verdict === 'review' ? chalk.yellow : chalk.green;
|
|
955
|
-
const verdictLabel = report.verdict === 'block' ? '🚫 BLOCK' : report.verdict === 'review' ? '👀 REVIEW' : '✅ OK';
|
|
956
|
-
console.log(` ${chalk.bold('Verdict:')} ${verdictColor(verdictLabel)}\n`);
|
|
957
|
-
}
|
|
958
|
-
function printReviewSummary(report) {
|
|
959
|
-
for (const s of report.summary) {
|
|
960
|
-
console.log(` ${chalk.dim('•')} ${s}`);
|
|
961
|
-
}
|
|
962
|
-
if (report.summary.length > 0)
|
|
963
|
-
console.log('');
|
|
964
|
-
}
|
|
965
|
-
function printReviewChangedFiles(report) {
|
|
966
|
-
if (report.changedFiles.length === 0)
|
|
967
|
-
return;
|
|
968
|
-
console.log(chalk.bold(' Changed files (top by risk):'));
|
|
969
|
-
for (const f of report.changedFiles.slice(0, 15)) {
|
|
970
|
-
const risk = f.riskScore !== null ? f.riskScore.toFixed(1).padStart(6) : ' - ';
|
|
971
|
-
const cc = f.cyclomaticComplexity !== null ? String(f.cyclomaticComplexity).padStart(3) : ' -';
|
|
972
|
-
const dcc = f.cyclomaticDelta === null ? ' ' : signed(f.cyclomaticDelta).padStart(3);
|
|
973
|
-
const statusColor = f.status === 'added' ? chalk.green : f.status === 'removed' ? chalk.red : chalk.yellow;
|
|
974
|
-
console.log(` ${statusColor(f.status.padEnd(8))} risk ${risk} CC ${cc} (Δ${dcc}) ${chalk.cyan(f.relativePath)}`);
|
|
975
|
-
}
|
|
976
|
-
if (report.changedFiles.length > 15) {
|
|
977
|
-
console.log(chalk.dim(` ... and ${report.changedFiles.length - 15} more`));
|
|
978
|
-
}
|
|
979
|
-
console.log('');
|
|
980
|
-
}
|
|
981
|
-
function printReviewCycles(report) {
|
|
982
|
-
if (report.newCycles.length === 0)
|
|
983
|
-
return;
|
|
984
|
-
console.log(chalk.bold(` New / expanded cycles (${report.newCycles.length}):`));
|
|
985
|
-
for (const c of report.newCycles.slice(0, 5)) {
|
|
986
|
-
const tag = c.classification === 'new' ? chalk.red('NEW') : chalk.yellow('EXP');
|
|
987
|
-
console.log(` ${tag} (${c.size}): ${c.files.join(' → ')}`);
|
|
988
|
-
}
|
|
989
|
-
if (report.newCycles.length > 5) {
|
|
990
|
-
console.log(chalk.dim(` ... and ${report.newCycles.length - 5} more`));
|
|
991
|
-
}
|
|
992
|
-
console.log('');
|
|
993
|
-
}
|
|
994
|
-
function printReviewRiskyFunctions(report) {
|
|
995
|
-
if (report.riskyFunctions.length === 0)
|
|
996
|
-
return;
|
|
997
|
-
console.log(chalk.bold(` Risky functions (${report.riskyFunctions.length}):`));
|
|
998
|
-
for (const fn of report.riskyFunctions.slice(0, 10)) {
|
|
999
|
-
const cc = fn.cyclomaticComplexity >= 15 ? chalk.red : chalk.yellow;
|
|
1000
|
-
const transition = fn.baseCc === null ? `(new)` : `(${fn.baseCc} → ${fn.cyclomaticComplexity})`;
|
|
1001
|
-
console.log(` ${cc(`CC ${String(fn.cyclomaticComplexity).padStart(3)}`)} ${chalk.bold(fn.name)} ${chalk.dim(`${fn.file}:${fn.line}`)} ${chalk.dim(`[${fn.reason}] ${transition}`)}`);
|
|
1002
|
-
}
|
|
1003
|
-
if (report.riskyFunctions.length > 10) {
|
|
1004
|
-
console.log(chalk.dim(` ... and ${report.riskyFunctions.length - 10} more`));
|
|
1005
|
-
}
|
|
1006
|
-
console.log('');
|
|
1007
|
-
}
|
|
1008
|
-
function printReviewDependencyChanges(report) {
|
|
1009
|
-
if (report.dependencyChanges.length === 0)
|
|
1010
|
-
return;
|
|
1011
|
-
console.log(chalk.bold(' Dependency changes:'));
|
|
1012
|
-
for (const d of report.dependencyChanges) {
|
|
1013
|
-
const wsLabel = d.workspace ? ` (${d.workspace})` : '';
|
|
1014
|
-
console.log(` ${chalk.cyan(d.manifestFile)}${chalk.dim(wsLabel)}`);
|
|
1015
|
-
for (const a of d.added)
|
|
1016
|
-
console.log(` ${chalk.green('+')} ${a.name}@${a.version} ${chalk.dim(`(${a.kind})`)}`);
|
|
1017
|
-
for (const r of d.removed)
|
|
1018
|
-
console.log(` ${chalk.red('-')} ${r.name}@${r.version} ${chalk.dim(`(${r.kind})`)}`);
|
|
1019
|
-
for (const b of d.bumped)
|
|
1020
|
-
console.log(` ${chalk.yellow('~')} ${b.name}: ${b.from} → ${b.to} ${chalk.dim(`(${b.kind})`)}`);
|
|
1021
|
-
}
|
|
1022
|
-
console.log('');
|
|
1023
|
-
}
|
|
1024
|
-
// ── Report: workspaces ────────────────────────────────────
|
|
1025
|
-
export function reportWorkspaces(info) {
|
|
1026
|
-
console.log(header('Workspaces'));
|
|
1027
|
-
if (info.kind === 'none') {
|
|
1028
|
-
console.log(`\n ${chalk.dim('Single-package repo (no monorepo workspaces detected).')}\n`);
|
|
1029
|
-
if (info.packages.length === 1) {
|
|
1030
|
-
const p = info.packages[0];
|
|
1031
|
-
console.log(` ${chalk.bold(p.name)} ${chalk.dim(p.version ?? '')}\n`);
|
|
1032
|
-
}
|
|
1033
|
-
return;
|
|
1034
|
-
}
|
|
1035
|
-
console.log(chalk.dim(`\n Kind: ${info.kind} · Source: ${info.source ?? '?'} · ${info.packages.length} package(s)\n`));
|
|
1036
|
-
for (const p of info.packages) {
|
|
1037
|
-
const tag = p.isRoot ? chalk.dim('(root)') : '';
|
|
1038
|
-
const ver = p.version ? chalk.dim(` v${p.version}`) : '';
|
|
1039
|
-
console.log(` ${chalk.bold(p.name)}${ver} ${chalk.cyan(p.relativePath || '.')} ${tag}`);
|
|
1040
|
-
}
|
|
1041
|
-
console.log('');
|
|
1042
|
-
}
|
|
1043
62
|
//# sourceMappingURL=consoleReporter.js.map
|