@boshu2/vibe-check 1.8.1 → 2.2.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/.agents/plans/2025-12-27-vibe-check-evolution-plan.md +383 -0
- package/.agents/research/2025-12-27-vibe-check-evolution.md +352 -0
- package/.claude/settings.local.json +9 -3
- package/CHANGELOG.md +43 -0
- package/CLAUDE.md +201 -26
- package/Makefile +4 -4
- package/README.md +95 -0
- package/bin/vibe-check.js +1 -1
- package/claude-progress.json +18 -0
- package/dist/analysis/cross-session-analysis.d.ts +1 -1
- package/dist/analysis/cross-session-analysis.d.ts.map +1 -1
- package/dist/analysis/cross-session-analysis.js +9 -18
- package/dist/analysis/cross-session-analysis.js.map +1 -1
- package/dist/analysis/index.d.ts +1 -1
- package/dist/analysis/index.d.ts.map +1 -1
- package/dist/analysis/index.js +1 -11
- package/dist/analysis/index.js.map +1 -1
- package/dist/analyzers/audit.d.ts +28 -0
- package/dist/analyzers/audit.d.ts.map +1 -0
- package/dist/analyzers/audit.js +86 -0
- package/dist/analyzers/audit.js.map +1 -0
- package/dist/analyzers/eldritch.d.ts +40 -0
- package/dist/analyzers/eldritch.d.ts.map +1 -0
- package/dist/analyzers/eldritch.js +202 -0
- package/dist/analyzers/eldritch.js.map +1 -0
- package/dist/analyzers/modularity.d.ts +67 -0
- package/dist/analyzers/modularity.d.ts.map +1 -0
- package/dist/analyzers/modularity.js +254 -0
- package/dist/analyzers/modularity.js.map +1 -0
- package/dist/analyzers/patterns.d.ts +1 -1
- package/dist/analyzers/patterns.d.ts.map +1 -1
- package/dist/analyzers/patterns.js +4 -10
- package/dist/analyzers/patterns.js.map +1 -1
- package/dist/analyzers/quality.d.ts +1 -1
- package/dist/analyzers/quality.d.ts.map +1 -1
- package/dist/analyzers/quality.js +5 -12
- package/dist/analyzers/quality.js.map +1 -1
- package/dist/analyzers/sessions.d.ts +1 -1
- package/dist/analyzers/sessions.d.ts.map +1 -1
- package/dist/analyzers/sessions.js +1 -4
- package/dist/analyzers/sessions.js.map +1 -1
- package/dist/cli.js +21 -20
- package/dist/cli.js.map +1 -1
- package/dist/commands/analyze.d.ts.map +1 -1
- package/dist/commands/analyze.js +124 -149
- package/dist/commands/analyze.js.map +1 -1
- package/dist/commands/audit.d.ts +3 -0
- package/dist/commands/audit.d.ts.map +1 -0
- package/dist/commands/audit.js +102 -0
- package/dist/commands/audit.js.map +1 -0
- package/dist/commands/cache.js +31 -70
- package/dist/commands/cache.js.map +1 -1
- package/dist/commands/dashboard.d.ts.map +1 -1
- package/dist/commands/dashboard.js +22 -58
- package/dist/commands/dashboard.js.map +1 -1
- package/dist/commands/forensics.d.ts +10 -2
- package/dist/commands/forensics.d.ts.map +1 -1
- package/dist/commands/forensics.js +91 -51
- package/dist/commands/forensics.js.map +1 -1
- package/dist/commands/index.d.ts +15 -13
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +15 -33
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/init-hook.js +26 -32
- package/dist/commands/init-hook.js.map +1 -1
- package/dist/commands/insights.js +39 -45
- package/dist/commands/insights.js.map +1 -1
- package/dist/commands/modularity.d.ts +27 -0
- package/dist/commands/modularity.d.ts.map +1 -0
- package/dist/commands/modularity.js +182 -0
- package/dist/commands/modularity.js.map +1 -0
- package/dist/commands/pipeline.js +39 -78
- package/dist/commands/pipeline.js.map +1 -1
- package/dist/commands/profile.js +68 -74
- package/dist/commands/profile.js.map +1 -1
- package/dist/commands/session.js +88 -129
- package/dist/commands/session.js.map +1 -1
- package/dist/commands/sessions.d.ts +1 -1
- package/dist/commands/sessions.d.ts.map +1 -1
- package/dist/commands/sessions.js +42 -49
- package/dist/commands/sessions.js.map +1 -1
- package/dist/commands/start.js +22 -67
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/timeline.js +74 -81
- package/dist/commands/timeline.js.map +1 -1
- package/dist/commands/watch.js +54 -60
- package/dist/commands/watch.js.map +1 -1
- package/dist/gamification/achievements.d.ts +1 -1
- package/dist/gamification/achievements.d.ts.map +1 -1
- package/dist/gamification/achievements.js +7 -13
- package/dist/gamification/achievements.js.map +1 -1
- package/dist/gamification/index.d.ts +8 -8
- package/dist/gamification/index.d.ts.map +1 -1
- package/dist/gamification/index.js +8 -28
- package/dist/gamification/index.js.map +1 -1
- package/dist/gamification/profile.d.ts +2 -2
- package/dist/gamification/profile.d.ts.map +1 -1
- package/dist/gamification/profile.js +21 -64
- package/dist/gamification/profile.js.map +1 -1
- package/dist/gamification/stats.d.ts +1 -1
- package/dist/gamification/stats.d.ts.map +1 -1
- package/dist/gamification/stats.js +4 -10
- package/dist/gamification/stats.js.map +1 -1
- package/dist/gamification/streaks.d.ts +1 -1
- package/dist/gamification/streaks.d.ts.map +1 -1
- package/dist/gamification/streaks.js +8 -18
- package/dist/gamification/streaks.js.map +1 -1
- package/dist/gamification/types.js +3 -6
- package/dist/gamification/types.js.map +1 -1
- package/dist/gamification/xp.d.ts +1 -1
- package/dist/gamification/xp.d.ts.map +1 -1
- package/dist/gamification/xp.js +29 -38
- package/dist/gamification/xp.js.map +1 -1
- package/dist/git.d.ts +1 -1
- package/dist/git.d.ts.map +1 -1
- package/dist/git.js +23 -29
- package/dist/git.js.map +1 -1
- package/dist/inner-loop/context-amnesia.d.ts +2 -2
- package/dist/inner-loop/context-amnesia.d.ts.map +1 -1
- package/dist/inner-loop/context-amnesia.js +7 -10
- package/dist/inner-loop/context-amnesia.js.map +1 -1
- package/dist/inner-loop/index.d.ts +7 -7
- package/dist/inner-loop/index.d.ts.map +1 -1
- package/dist/inner-loop/index.js +18 -45
- package/dist/inner-loop/index.js.map +1 -1
- package/dist/inner-loop/instruction-drift.d.ts +2 -2
- package/dist/inner-loop/instruction-drift.d.ts.map +1 -1
- package/dist/inner-loop/instruction-drift.js +5 -10
- package/dist/inner-loop/instruction-drift.js.map +1 -1
- package/dist/inner-loop/logging-only.d.ts +2 -2
- package/dist/inner-loop/logging-only.d.ts.map +1 -1
- package/dist/inner-loop/logging-only.js +9 -17
- package/dist/inner-loop/logging-only.js.map +1 -1
- package/dist/inner-loop/tests-passing-lie.d.ts +2 -2
- package/dist/inner-loop/tests-passing-lie.d.ts.map +1 -1
- package/dist/inner-loop/tests-passing-lie.js +12 -17
- package/dist/inner-loop/tests-passing-lie.js.map +1 -1
- package/dist/inner-loop/types.js +1 -4
- package/dist/inner-loop/types.js.map +1 -1
- package/dist/insights/generators.d.ts +4 -4
- package/dist/insights/generators.d.ts.map +1 -1
- package/dist/insights/generators.js +9 -20
- package/dist/insights/generators.js.map +1 -1
- package/dist/insights/index.d.ts +4 -4
- package/dist/insights/index.d.ts.map +1 -1
- package/dist/insights/index.js +23 -27
- package/dist/insights/index.js.map +1 -1
- package/dist/insights/types.js +1 -2
- package/dist/insights/types.js.map +1 -1
- package/dist/metrics/code-stability.d.ts +1 -1
- package/dist/metrics/code-stability.d.ts.map +1 -1
- package/dist/metrics/code-stability.js +1 -4
- package/dist/metrics/code-stability.js.map +1 -1
- package/dist/metrics/cohesion.d.ts +27 -0
- package/dist/metrics/cohesion.d.ts.map +1 -0
- package/dist/metrics/cohesion.js +134 -0
- package/dist/metrics/cohesion.js.map +1 -0
- package/dist/metrics/file-churn.d.ts +1 -1
- package/dist/metrics/file-churn.d.ts.map +1 -1
- package/dist/metrics/file-churn.js +1 -4
- package/dist/metrics/file-churn.js.map +1 -1
- package/dist/metrics/flow.d.ts +1 -1
- package/dist/metrics/flow.d.ts.map +1 -1
- package/dist/metrics/flow.js +1 -4
- package/dist/metrics/flow.js.map +1 -1
- package/dist/metrics/index.d.ts +10 -2
- package/dist/metrics/index.d.ts.map +1 -1
- package/dist/metrics/index.js +51 -20
- package/dist/metrics/index.js.map +1 -1
- package/dist/metrics/investigation.d.ts +25 -0
- package/dist/metrics/investigation.d.ts.map +1 -0
- package/dist/metrics/investigation.js +115 -0
- package/dist/metrics/investigation.js.map +1 -0
- package/dist/metrics/rework.d.ts +1 -1
- package/dist/metrics/rework.d.ts.map +1 -1
- package/dist/metrics/rework.js +1 -4
- package/dist/metrics/rework.js.map +1 -1
- package/dist/metrics/spirals.d.ts +1 -1
- package/dist/metrics/spirals.d.ts.map +1 -1
- package/dist/metrics/spirals.js +5 -10
- package/dist/metrics/spirals.js.map +1 -1
- package/dist/metrics/time-spiral.d.ts +1 -1
- package/dist/metrics/time-spiral.d.ts.map +1 -1
- package/dist/metrics/time-spiral.js +1 -4
- package/dist/metrics/time-spiral.js.map +1 -1
- package/dist/metrics/tracers.d.ts +28 -0
- package/dist/metrics/tracers.d.ts.map +1 -0
- package/dist/metrics/tracers.js +117 -0
- package/dist/metrics/tracers.js.map +1 -0
- package/dist/metrics/trust.d.ts +1 -1
- package/dist/metrics/trust.d.ts.map +1 -1
- package/dist/metrics/trust.js +3 -6
- package/dist/metrics/trust.js.map +1 -1
- package/dist/metrics/velocity-anomaly.d.ts +1 -1
- package/dist/metrics/velocity-anomaly.d.ts.map +1 -1
- package/dist/metrics/velocity-anomaly.js +3 -6
- package/dist/metrics/velocity-anomaly.js.map +1 -1
- package/dist/metrics/velocity.d.ts +1 -1
- package/dist/metrics/velocity.d.ts.map +1 -1
- package/dist/metrics/velocity.js +6 -10
- package/dist/metrics/velocity.js.map +1 -1
- package/dist/output/index.d.ts +4 -4
- package/dist/output/index.d.ts.map +1 -1
- package/dist/output/index.js +10 -18
- package/dist/output/index.js.map +1 -1
- package/dist/output/json.d.ts +1 -1
- package/dist/output/json.d.ts.map +1 -1
- package/dist/output/json.js +1 -4
- package/dist/output/json.js.map +1 -1
- package/dist/output/markdown.d.ts +1 -1
- package/dist/output/markdown.d.ts.map +1 -1
- package/dist/output/markdown.js +5 -8
- package/dist/output/markdown.js.map +1 -1
- package/dist/output/terminal.d.ts +1 -1
- package/dist/output/terminal.d.ts.map +1 -1
- package/dist/output/terminal.js +88 -62
- package/dist/output/terminal.js.map +1 -1
- package/dist/output/timeline-html.d.ts +1 -1
- package/dist/output/timeline-html.d.ts.map +1 -1
- package/dist/output/timeline-html.js +5 -8
- package/dist/output/timeline-html.js.map +1 -1
- package/dist/output/timeline-markdown.d.ts +1 -1
- package/dist/output/timeline-markdown.d.ts.map +1 -1
- package/dist/output/timeline-markdown.js +5 -8
- package/dist/output/timeline-markdown.js.map +1 -1
- package/dist/output/timeline.d.ts +1 -1
- package/dist/output/timeline.d.ts.map +1 -1
- package/dist/output/timeline.js +46 -52
- package/dist/output/timeline.js.map +1 -1
- package/dist/patterns/detour.d.ts +1 -1
- package/dist/patterns/detour.d.ts.map +1 -1
- package/dist/patterns/detour.js +1 -4
- package/dist/patterns/detour.js.map +1 -1
- package/dist/patterns/flow-state.d.ts +1 -1
- package/dist/patterns/flow-state.d.ts.map +1 -1
- package/dist/patterns/flow-state.js +1 -4
- package/dist/patterns/flow-state.js.map +1 -1
- package/dist/patterns/index.d.ts +7 -7
- package/dist/patterns/index.d.ts.map +1 -1
- package/dist/patterns/index.js +7 -21
- package/dist/patterns/index.js.map +1 -1
- package/dist/patterns/intervention-effectiveness.d.ts +1 -1
- package/dist/patterns/intervention-effectiveness.d.ts.map +1 -1
- package/dist/patterns/intervention-effectiveness.js +3 -8
- package/dist/patterns/intervention-effectiveness.js.map +1 -1
- package/dist/patterns/late-night.d.ts +1 -1
- package/dist/patterns/late-night.d.ts.map +1 -1
- package/dist/patterns/late-night.js +1 -4
- package/dist/patterns/late-night.js.map +1 -1
- package/dist/patterns/post-delete-sprint.d.ts +1 -1
- package/dist/patterns/post-delete-sprint.d.ts.map +1 -1
- package/dist/patterns/post-delete-sprint.js +1 -4
- package/dist/patterns/post-delete-sprint.js.map +1 -1
- package/dist/patterns/spiral-regression.d.ts +1 -1
- package/dist/patterns/spiral-regression.d.ts.map +1 -1
- package/dist/patterns/spiral-regression.js +3 -8
- package/dist/patterns/spiral-regression.js.map +1 -1
- package/dist/patterns/thrashing.d.ts +1 -1
- package/dist/patterns/thrashing.d.ts.map +1 -1
- package/dist/patterns/thrashing.js +3 -6
- package/dist/patterns/thrashing.js.map +1 -1
- package/dist/score/index.d.ts +3 -3
- package/dist/score/index.d.ts.map +1 -1
- package/dist/score/index.js +4 -10
- package/dist/score/index.js.map +1 -1
- package/dist/score/weights.js +2 -6
- package/dist/score/weights.js.map +1 -1
- package/dist/sessions/index.js +9 -51
- package/dist/sessions/index.js.map +1 -1
- package/dist/storage/atomic.js +10 -51
- package/dist/storage/atomic.js.map +1 -1
- package/dist/storage/commit-log.d.ts +1 -1
- package/dist/storage/commit-log.d.ts.map +1 -1
- package/dist/storage/commit-log.js +11 -51
- package/dist/storage/commit-log.js.map +1 -1
- package/dist/storage/index.d.ts +5 -5
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +5 -37
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/schema.js +4 -9
- package/dist/storage/schema.js.map +1 -1
- package/dist/storage/spiral-history.js +14 -57
- package/dist/storage/spiral-history.js.map +1 -1
- package/dist/storage/timeline-store.d.ts +2 -2
- package/dist/storage/timeline-store.d.ts.map +1 -1
- package/dist/storage/timeline-store.js +17 -61
- package/dist/storage/timeline-store.js.map +1 -1
- package/dist/types.d.ts +36 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -2
- package/docs/ENHANCEMENT-PLAN.md +379 -0
- package/feature-list.json +6 -0
- package/package.json +8 -7
- package/.claude/skills/typescript-review.md +0 -152
- package/dist/calibration/ece.d.ts +0 -26
- package/dist/calibration/ece.d.ts.map +0 -1
- package/dist/calibration/ece.js +0 -93
- package/dist/calibration/ece.js.map +0 -1
- package/dist/calibration/index.d.ts +0 -3
- package/dist/calibration/index.d.ts.map +0 -1
- package/dist/calibration/index.js +0 -15
- package/dist/calibration/index.js.map +0 -1
- package/dist/calibration/storage.d.ts +0 -34
- package/dist/calibration/storage.d.ts.map +0 -1
- package/dist/calibration/storage.js +0 -188
- package/dist/calibration/storage.js.map +0 -1
- package/dist/commands/intervene.d.ts +0 -15
- package/dist/commands/intervene.d.ts.map +0 -1
- package/dist/commands/intervene.js +0 -183
- package/dist/commands/intervene.js.map +0 -1
- package/dist/commands/learn.d.ts +0 -3
- package/dist/commands/learn.d.ts.map +0 -1
- package/dist/commands/learn.js +0 -161
- package/dist/commands/learn.js.map +0 -1
- package/dist/commands/lesson.d.ts +0 -8
- package/dist/commands/lesson.d.ts.map +0 -1
- package/dist/commands/lesson.js +0 -206
- package/dist/commands/lesson.js.map +0 -1
- package/dist/commands/level.d.ts +0 -3
- package/dist/commands/level.d.ts.map +0 -1
- package/dist/commands/level.js +0 -277
- package/dist/commands/level.js.map +0 -1
- package/dist/gamification/badges.d.ts +0 -29
- package/dist/gamification/badges.d.ts.map +0 -1
- package/dist/gamification/badges.js +0 -114
- package/dist/gamification/badges.js.map +0 -1
- package/dist/gamification/challenges.d.ts +0 -42
- package/dist/gamification/challenges.d.ts.map +0 -1
- package/dist/gamification/challenges.js +0 -184
- package/dist/gamification/challenges.js.map +0 -1
- package/dist/gamification/hall-of-fame.d.ts +0 -17
- package/dist/gamification/hall-of-fame.d.ts.map +0 -1
- package/dist/gamification/hall-of-fame.js +0 -64
- package/dist/gamification/hall-of-fame.js.map +0 -1
- package/dist/gamification/intervention-memory.d.ts +0 -61
- package/dist/gamification/intervention-memory.d.ts.map +0 -1
- package/dist/gamification/intervention-memory.js +0 -229
- package/dist/gamification/intervention-memory.js.map +0 -1
- package/dist/gamification/leaderboards.d.ts +0 -49
- package/dist/gamification/leaderboards.d.ts.map +0 -1
- package/dist/gamification/leaderboards.js +0 -179
- package/dist/gamification/leaderboards.js.map +0 -1
- package/dist/gamification/pattern-memory.d.ts +0 -45
- package/dist/gamification/pattern-memory.d.ts.map +0 -1
- package/dist/gamification/pattern-memory.js +0 -188
- package/dist/gamification/pattern-memory.js.map +0 -1
- package/dist/gamification/share.d.ts +0 -29
- package/dist/gamification/share.d.ts.map +0 -1
- package/dist/gamification/share.js +0 -57
- package/dist/gamification/share.js.map +0 -1
- package/dist/learning/cadence.d.ts +0 -15
- package/dist/learning/cadence.d.ts.map +0 -1
- package/dist/learning/cadence.js +0 -130
- package/dist/learning/cadence.js.map +0 -1
- package/dist/learning/index.d.ts +0 -19
- package/dist/learning/index.d.ts.map +0 -1
- package/dist/learning/index.js +0 -35
- package/dist/learning/index.js.map +0 -1
- package/dist/learning/lessons-storage.d.ts +0 -48
- package/dist/learning/lessons-storage.d.ts.map +0 -1
- package/dist/learning/lessons-storage.js +0 -266
- package/dist/learning/lessons-storage.js.map +0 -1
- package/dist/learning/lessons-types.d.ts +0 -83
- package/dist/learning/lessons-types.d.ts.map +0 -1
- package/dist/learning/lessons-types.js +0 -15
- package/dist/learning/lessons-types.js.map +0 -1
- package/dist/learning/nudges.d.ts +0 -20
- package/dist/learning/nudges.d.ts.map +0 -1
- package/dist/learning/nudges.js +0 -68
- package/dist/learning/nudges.js.map +0 -1
- package/dist/learning/retrospective.d.ts +0 -27
- package/dist/learning/retrospective.d.ts.map +0 -1
- package/dist/learning/retrospective.js +0 -184
- package/dist/learning/retrospective.js.map +0 -1
- package/dist/learning/storage.d.ts +0 -44
- package/dist/learning/storage.d.ts.map +0 -1
- package/dist/learning/storage.js +0 -194
- package/dist/learning/storage.js.map +0 -1
- package/dist/learning/surfacing.d.ts +0 -36
- package/dist/learning/surfacing.d.ts.map +0 -1
- package/dist/learning/surfacing.js +0 -255
- package/dist/learning/surfacing.js.map +0 -1
- package/dist/learning/synthesis.d.ts +0 -17
- package/dist/learning/synthesis.d.ts.map +0 -1
- package/dist/learning/synthesis.js +0 -293
- package/dist/learning/synthesis.js.map +0 -1
- package/dist/learning/types.d.ts +0 -60
- package/dist/learning/types.d.ts.map +0 -1
- package/dist/learning/types.js +0 -17
- package/dist/learning/types.js.map +0 -1
- package/dist/recommend/index.d.ts +0 -3
- package/dist/recommend/index.d.ts.map +0 -1
- package/dist/recommend/index.js +0 -14
- package/dist/recommend/index.js.map +0 -1
- package/dist/recommend/ordered-logistic.d.ts +0 -49
- package/dist/recommend/ordered-logistic.d.ts.map +0 -1
- package/dist/recommend/ordered-logistic.js +0 -153
- package/dist/recommend/ordered-logistic.js.map +0 -1
- package/dist/recommend/questions.d.ts +0 -19
- package/dist/recommend/questions.d.ts.map +0 -1
- package/dist/recommend/questions.js +0 -73
- package/dist/recommend/questions.js.map +0 -1
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.createInsightsCommand = createInsightsCommand;
|
|
7
|
-
const commander_1 = require("commander");
|
|
8
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
-
const spiral_history_1 = require("../storage/spiral-history");
|
|
10
|
-
function createInsightsCommand() {
|
|
11
|
-
const cmd = new commander_1.Command('insights')
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { getPatternStats, getPatternDisplayName, getResolutionDisplayName, readSpiralHistory, } from '../storage/spiral-history.js';
|
|
4
|
+
export function createInsightsCommand() {
|
|
5
|
+
const cmd = new Command('insights')
|
|
12
6
|
.description('Show your spiral patterns and what works for you')
|
|
13
7
|
.option('-d, --days <number>', 'Days to analyze (default: 30)', '30')
|
|
14
8
|
.option('-f, --format <type>', 'Output format: terminal, json', 'terminal')
|
|
@@ -20,15 +14,15 @@ function createInsightsCommand() {
|
|
|
20
14
|
async function runInsights(options) {
|
|
21
15
|
const days = parseInt(options.days, 10) || 30;
|
|
22
16
|
const format = options.format;
|
|
23
|
-
const stats =
|
|
24
|
-
const allHistory =
|
|
17
|
+
const stats = getPatternStats(days);
|
|
18
|
+
const allHistory = readSpiralHistory();
|
|
25
19
|
if (format === 'json') {
|
|
26
20
|
console.log(JSON.stringify({
|
|
27
21
|
period_days: days,
|
|
28
22
|
total_spirals: allHistory.length,
|
|
29
23
|
patterns: stats.map(s => ({
|
|
30
24
|
pattern: s.pattern,
|
|
31
|
-
display_name:
|
|
25
|
+
display_name: getPatternDisplayName(s.pattern),
|
|
32
26
|
times: s.times,
|
|
33
27
|
avg_duration_min: s.avgDuration,
|
|
34
28
|
best_fix: s.bestFix,
|
|
@@ -39,82 +33,82 @@ async function runInsights(options) {
|
|
|
39
33
|
}
|
|
40
34
|
// Terminal output
|
|
41
35
|
console.log('');
|
|
42
|
-
console.log(
|
|
43
|
-
console.log(
|
|
44
|
-
console.log(
|
|
36
|
+
console.log(chalk.bold.cyan('═'.repeat(64)));
|
|
37
|
+
console.log(chalk.bold.cyan(' YOUR SPIRAL PATTERNS'));
|
|
38
|
+
console.log(chalk.bold.cyan('═'.repeat(64)));
|
|
45
39
|
console.log('');
|
|
46
40
|
if (stats.length === 0) {
|
|
47
|
-
console.log(
|
|
48
|
-
console.log(
|
|
41
|
+
console.log(chalk.gray(' No spirals recorded in the last ' + days + ' days.'));
|
|
42
|
+
console.log(chalk.gray(' Run vibe-check analyze or session end to start tracking.'));
|
|
49
43
|
console.log('');
|
|
50
44
|
return;
|
|
51
45
|
}
|
|
52
46
|
// Summary stats
|
|
53
47
|
const totalSpirals = stats.reduce((sum, s) => sum + s.times, 0);
|
|
54
48
|
const avgDuration = stats.reduce((sum, s) => sum + s.avgDuration * s.times, 0) / totalSpirals;
|
|
55
|
-
console.log(
|
|
56
|
-
console.log(
|
|
57
|
-
console.log(
|
|
49
|
+
console.log(chalk.white(` Period: Last ${days} days`));
|
|
50
|
+
console.log(chalk.white(` Total spirals: ${totalSpirals}`));
|
|
51
|
+
console.log(chalk.white(` Avg duration: ${Math.round(avgDuration)} min`));
|
|
58
52
|
console.log('');
|
|
59
53
|
// Pattern breakdown
|
|
60
|
-
console.log(
|
|
54
|
+
console.log(chalk.bold.white(' PATTERNS BY FREQUENCY'));
|
|
61
55
|
console.log('');
|
|
62
56
|
for (const stat of stats) {
|
|
63
|
-
const patternName =
|
|
57
|
+
const patternName = getPatternDisplayName(stat.pattern);
|
|
64
58
|
const bar = '█'.repeat(Math.min(stat.times * 2, 20));
|
|
65
59
|
const fixText = stat.bestFix
|
|
66
|
-
?
|
|
60
|
+
? getResolutionDisplayName(stat.bestFix).toLowerCase()
|
|
67
61
|
: 'no resolution data';
|
|
68
|
-
console.log(
|
|
69
|
-
console.log(` ${
|
|
70
|
-
console.log(
|
|
71
|
-
console.log(
|
|
62
|
+
console.log(chalk.yellow(` ${patternName}`));
|
|
63
|
+
console.log(` ${chalk.cyan(bar)} ${stat.times}x, avg ${stat.avgDuration} min`);
|
|
64
|
+
console.log(chalk.gray(` Best fix: ${fixText}`));
|
|
65
|
+
console.log(chalk.gray(` Components: ${stat.components.slice(0, 3).join(', ')}${stat.components.length > 3 ? '...' : ''}`));
|
|
72
66
|
console.log('');
|
|
73
67
|
}
|
|
74
68
|
// Top trigger identification
|
|
75
69
|
if (stats.length > 0) {
|
|
76
70
|
const topPattern = stats[0];
|
|
77
|
-
const topPatternName =
|
|
71
|
+
const topPatternName = getPatternDisplayName(topPattern.pattern);
|
|
78
72
|
const topComponents = topPattern.components.slice(0, 2).join(', ');
|
|
79
|
-
console.log(
|
|
73
|
+
console.log(chalk.bold.white(' TOP TRIGGER'));
|
|
80
74
|
console.log('');
|
|
81
|
-
console.log(
|
|
75
|
+
console.log(chalk.yellow(` ${topPatternName} in ${topComponents}`));
|
|
82
76
|
console.log('');
|
|
83
77
|
// Generate recommendation
|
|
84
78
|
if (topPattern.bestFix) {
|
|
85
|
-
const fixName =
|
|
86
|
-
console.log(
|
|
79
|
+
const fixName = getResolutionDisplayName(topPattern.bestFix).toLowerCase();
|
|
80
|
+
console.log(chalk.bold.cyan(' RECOMMENDATION'));
|
|
87
81
|
console.log('');
|
|
88
|
-
console.log(
|
|
82
|
+
console.log(chalk.white(` Your go-to fix for ${topPatternName} is ${fixName}.`));
|
|
89
83
|
// Specific recommendations by fix type
|
|
90
84
|
switch (topPattern.bestFix) {
|
|
91
85
|
case 'TEST':
|
|
92
|
-
console.log(
|
|
86
|
+
console.log(chalk.gray(` Consider adding a tracer test for ${topComponents} before starting.`));
|
|
93
87
|
break;
|
|
94
88
|
case 'BREAK':
|
|
95
|
-
console.log(
|
|
89
|
+
console.log(chalk.gray(` Set a timer to take breaks when working on ${topComponents}.`));
|
|
96
90
|
break;
|
|
97
91
|
case 'DOCS':
|
|
98
|
-
console.log(
|
|
92
|
+
console.log(chalk.gray(` Bookmark the docs for ${topComponents} for quick reference.`));
|
|
99
93
|
break;
|
|
100
94
|
case 'HELP':
|
|
101
|
-
console.log(
|
|
95
|
+
console.log(chalk.gray(` Consider pairing on ${topComponents} tasks.`));
|
|
102
96
|
break;
|
|
103
97
|
case 'ROLLBACK':
|
|
104
|
-
console.log(
|
|
98
|
+
console.log(chalk.gray(` Make smaller commits when working on ${topComponents}.`));
|
|
105
99
|
break;
|
|
106
100
|
}
|
|
107
101
|
}
|
|
108
102
|
else {
|
|
109
|
-
console.log(
|
|
103
|
+
console.log(chalk.bold.cyan(' RECOMMENDATION'));
|
|
110
104
|
console.log('');
|
|
111
|
-
console.log(
|
|
112
|
-
console.log(
|
|
105
|
+
console.log(chalk.white(` No resolution data yet for ${topPatternName}.`));
|
|
106
|
+
console.log(chalk.gray(` After your next spiral, try: test, break, docs, or ask for help.`));
|
|
113
107
|
}
|
|
114
108
|
console.log('');
|
|
115
109
|
}
|
|
116
|
-
console.log(
|
|
117
|
-
console.log(
|
|
110
|
+
console.log(chalk.cyan('═'.repeat(64)));
|
|
111
|
+
console.log(chalk.gray(` Run with --days 90 for longer history, --format json for export`));
|
|
118
112
|
console.log('');
|
|
119
113
|
}
|
|
120
114
|
//# sourceMappingURL=insights.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insights.js","sourceRoot":"","sources":["../../src/commands/insights.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"insights.js","sourceRoot":"","sources":["../../src/commands/insights.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,wBAAwB,EAC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AC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,mEAAmE,CAAC,CAAC,CAAC;IAC7F,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modularity Command
|
|
3
|
+
*
|
|
4
|
+
* Analyze code modularity with pattern-aware scoring.
|
|
5
|
+
* Goes beyond simple LOC counting to assess whether large files
|
|
6
|
+
* are well-organized or problematic.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* vibe-check modularity # Analyze current directory
|
|
10
|
+
* vibe-check modularity -r /path/to/repo # Analyze specific repo
|
|
11
|
+
* vibe-check modularity --all # Include small files too
|
|
12
|
+
* vibe-check modularity --pattern store # Filter to specific pattern
|
|
13
|
+
* vibe-check modularity -f json # JSON output
|
|
14
|
+
*/
|
|
15
|
+
import { Command } from 'commander';
|
|
16
|
+
export interface ModularityCommandOptions {
|
|
17
|
+
repo: string;
|
|
18
|
+
format: 'terminal' | 'json';
|
|
19
|
+
verbose: boolean;
|
|
20
|
+
all: boolean;
|
|
21
|
+
minLines: number;
|
|
22
|
+
pattern?: string;
|
|
23
|
+
top: number;
|
|
24
|
+
}
|
|
25
|
+
export declare function createModularityCommand(): Command;
|
|
26
|
+
export declare function runModularity(options: ModularityCommandOptions): Promise<void>;
|
|
27
|
+
//# sourceMappingURL=modularity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modularity.d.ts","sourceRoot":"","sources":["../../src/commands/modularity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYpC,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,OAAO,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,wBAAgB,uBAAuB,IAAI,OAAO,CAejD;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BpF"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modularity Command
|
|
3
|
+
*
|
|
4
|
+
* Analyze code modularity with pattern-aware scoring.
|
|
5
|
+
* Goes beyond simple LOC counting to assess whether large files
|
|
6
|
+
* are well-organized or problematic.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* vibe-check modularity # Analyze current directory
|
|
10
|
+
* vibe-check modularity -r /path/to/repo # Analyze specific repo
|
|
11
|
+
* vibe-check modularity --all # Include small files too
|
|
12
|
+
* vibe-check modularity --pattern store # Filter to specific pattern
|
|
13
|
+
* vibe-check modularity -f json # JSON output
|
|
14
|
+
*/
|
|
15
|
+
import { Command } from 'commander';
|
|
16
|
+
import chalk from 'chalk';
|
|
17
|
+
import * as path from 'path';
|
|
18
|
+
import { analyzeModularity, } from '../analyzers/modularity.js';
|
|
19
|
+
export function createModularityCommand() {
|
|
20
|
+
const cmd = new Command('modularity')
|
|
21
|
+
.description('Analyze code modularity with pattern-aware scoring')
|
|
22
|
+
.option('-r, --repo <path>', 'Repository path', process.cwd())
|
|
23
|
+
.option('-f, --format <type>', 'Output format: terminal, json', 'terminal')
|
|
24
|
+
.option('-v, --verbose', 'Show verbose output with details', false)
|
|
25
|
+
.option('-a, --all', 'Include all files (not just large ones)', false)
|
|
26
|
+
.option('-m, --min-lines <n>', 'Minimum lines to analyze', '100')
|
|
27
|
+
.option('-p, --pattern <type>', 'Filter by pattern: controller, store, routes, types, etc.')
|
|
28
|
+
.option('-t, --top <n>', 'Show top N files (default: 10)', '10')
|
|
29
|
+
.action(async (options) => {
|
|
30
|
+
await runModularity(options);
|
|
31
|
+
});
|
|
32
|
+
return cmd;
|
|
33
|
+
}
|
|
34
|
+
export async function runModularity(options) {
|
|
35
|
+
const rootDir = path.resolve(options.repo);
|
|
36
|
+
const minLines = parseInt(options.minLines, 10) || 100;
|
|
37
|
+
const top = parseInt(options.top, 10) || 10;
|
|
38
|
+
const analysisOptions = {
|
|
39
|
+
minLines,
|
|
40
|
+
includeAll: options.all,
|
|
41
|
+
patterns: options.pattern ? [options.pattern] : undefined,
|
|
42
|
+
};
|
|
43
|
+
try {
|
|
44
|
+
const result = analyzeModularity(rootDir, analysisOptions);
|
|
45
|
+
if (options.format === 'json') {
|
|
46
|
+
console.log(JSON.stringify(result, null, 2));
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
// Terminal output
|
|
50
|
+
printTerminalOutput(result, rootDir, options.verbose, top);
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
if (error instanceof Error) {
|
|
54
|
+
console.error(chalk.red(`Error: ${error.message}`));
|
|
55
|
+
}
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function printTerminalOutput(result, rootDir, verbose, top) {
|
|
60
|
+
console.log('');
|
|
61
|
+
console.log(chalk.bold.cyan('📐 Modularity Analysis'));
|
|
62
|
+
console.log(chalk.gray('─'.repeat(60)));
|
|
63
|
+
console.log('');
|
|
64
|
+
// Summary stats
|
|
65
|
+
const { summary } = result;
|
|
66
|
+
console.log(`Analyzed ${chalk.white(summary.totalFiles)} files ` +
|
|
67
|
+
`(${chalk.white(summary.totalLines.toLocaleString())} lines)`);
|
|
68
|
+
console.log(`Average modularity score: ${formatScore(summary.avgScore)}`);
|
|
69
|
+
console.log('');
|
|
70
|
+
// Distribution
|
|
71
|
+
console.log(chalk.bold('Score Distribution:'));
|
|
72
|
+
const dist = summary.distribution;
|
|
73
|
+
const total = dist.elite + dist.good + dist.acceptable + dist.needsWork + dist.poor;
|
|
74
|
+
const bar = (count, colorFn) => {
|
|
75
|
+
const pct = total > 0 ? Math.round((count / total) * 100) : 0;
|
|
76
|
+
const width = Math.round(pct / 5);
|
|
77
|
+
return colorFn('█'.repeat(width)) + chalk.gray('░'.repeat(20 - width)) + ` ${pct}%`;
|
|
78
|
+
};
|
|
79
|
+
console.log(` Elite (9-10): ${bar(dist.elite, (s) => chalk.green(s))}`);
|
|
80
|
+
console.log(` Good (7-8): ${bar(dist.good, (s) => chalk.blue(s))}`);
|
|
81
|
+
console.log(` Acceptable (5-6): ${bar(dist.acceptable, (s) => chalk.yellow(s))}`);
|
|
82
|
+
console.log(` Needs Work (3-4): ${bar(dist.needsWork, (s) => chalk.hex('#FFA500')(s))}`);
|
|
83
|
+
console.log(` Poor (0-2): ${bar(dist.poor, (s) => chalk.red(s))}`);
|
|
84
|
+
console.log('');
|
|
85
|
+
// Files needing attention (worst scores first)
|
|
86
|
+
const needsAttention = result.files.filter(f => f.score < 7);
|
|
87
|
+
if (needsAttention.length > 0) {
|
|
88
|
+
console.log(chalk.bold.yellow(`⚠️ Files Needing Attention (${needsAttention.length}):`));
|
|
89
|
+
console.log('');
|
|
90
|
+
needsAttention.slice(0, top).forEach(file => {
|
|
91
|
+
printFileResult(file, verbose);
|
|
92
|
+
});
|
|
93
|
+
if (needsAttention.length > top) {
|
|
94
|
+
console.log(chalk.gray(` ...and ${needsAttention.length - top} more`));
|
|
95
|
+
}
|
|
96
|
+
console.log('');
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
console.log(chalk.green('✅ All analyzed files have good modularity!'));
|
|
100
|
+
console.log('');
|
|
101
|
+
}
|
|
102
|
+
// Largest files (for context)
|
|
103
|
+
if (verbose && summary.largestFiles.length > 0) {
|
|
104
|
+
console.log(chalk.bold('📊 Largest Files:'));
|
|
105
|
+
summary.largestFiles.forEach(f => {
|
|
106
|
+
console.log(` ${chalk.white(f.file)}: ` +
|
|
107
|
+
`${chalk.cyan(f.lines + ' lines')} ` +
|
|
108
|
+
`(score: ${formatScore(f.score)})`);
|
|
109
|
+
});
|
|
110
|
+
console.log('');
|
|
111
|
+
}
|
|
112
|
+
// Exempted files summary
|
|
113
|
+
if (verbose && result.exempted.length > 0) {
|
|
114
|
+
console.log(chalk.gray(`ℹ️ ${result.exempted.length} files exempted (tests, generated)`));
|
|
115
|
+
console.log('');
|
|
116
|
+
}
|
|
117
|
+
// Overall verdict
|
|
118
|
+
printVerdict(summary.avgScore, needsAttention.length);
|
|
119
|
+
}
|
|
120
|
+
function printFileResult(file, verbose) {
|
|
121
|
+
const scoreStr = getScoreStr(file.score);
|
|
122
|
+
const patternLabel = file.pattern ? chalk.gray(`[${file.pattern}]`) : '';
|
|
123
|
+
console.log(` ${scoreStr} ` +
|
|
124
|
+
`${chalk.white(file.file)} ` +
|
|
125
|
+
`${chalk.gray(file.lines + ' lines')} ` +
|
|
126
|
+
patternLabel);
|
|
127
|
+
if (file.flags.length > 0) {
|
|
128
|
+
const flagStr = file.flags.map(f => chalk.dim(formatFlag(f))).join(', ');
|
|
129
|
+
console.log(` ${flagStr}`);
|
|
130
|
+
}
|
|
131
|
+
if (verbose) {
|
|
132
|
+
const d = file.details;
|
|
133
|
+
console.log(chalk.gray(` sections: ${d.sectionCount}, `) +
|
|
134
|
+
chalk.gray(`exports: ${d.exportCount}, `) +
|
|
135
|
+
chalk.gray(`imports: ${d.importCount}`));
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function formatFlag(flag) {
|
|
139
|
+
const labels = {
|
|
140
|
+
'no-single-responsibility': '⚠ multiple responsibilities',
|
|
141
|
+
'no-internal-structure': '⚠ no sections/organization',
|
|
142
|
+
'high-coupling': '⚠ high coupling (many imports)',
|
|
143
|
+
'low-cohesion': '⚠ low cohesion (bloated API)',
|
|
144
|
+
'missing-tests': '⚠ missing tests',
|
|
145
|
+
'god-class': '⚠ god class',
|
|
146
|
+
'utility-grab-bag': '⚠ utility grab-bag',
|
|
147
|
+
};
|
|
148
|
+
return labels[flag] || flag;
|
|
149
|
+
}
|
|
150
|
+
function formatScore(score) {
|
|
151
|
+
return getScoreStr(score);
|
|
152
|
+
}
|
|
153
|
+
function getScoreStr(score) {
|
|
154
|
+
const text = `${score}/10`;
|
|
155
|
+
if (score >= 9)
|
|
156
|
+
return chalk.green(text);
|
|
157
|
+
if (score >= 7)
|
|
158
|
+
return chalk.blue(text);
|
|
159
|
+
if (score >= 5)
|
|
160
|
+
return chalk.yellow(text);
|
|
161
|
+
if (score >= 3)
|
|
162
|
+
return chalk.hex('#FFA500')(text);
|
|
163
|
+
return chalk.red(text);
|
|
164
|
+
}
|
|
165
|
+
function printVerdict(avgScore, problemCount) {
|
|
166
|
+
console.log(chalk.gray('─'.repeat(60)));
|
|
167
|
+
if (avgScore >= 8 && problemCount === 0) {
|
|
168
|
+
console.log(chalk.green.bold('✨ Excellent modularity! Your codebase is well-organized.'));
|
|
169
|
+
}
|
|
170
|
+
else if (avgScore >= 7) {
|
|
171
|
+
console.log(chalk.blue.bold('👍 Good modularity. Minor improvements possible.'));
|
|
172
|
+
}
|
|
173
|
+
else if (avgScore >= 5) {
|
|
174
|
+
console.log(chalk.yellow.bold('⚠️ Acceptable modularity. Consider refactoring flagged files.'));
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
console.log(chalk.red.bold('🚨 Modularity needs attention. Several files require refactoring.'));
|
|
178
|
+
}
|
|
179
|
+
console.log('');
|
|
180
|
+
console.log(chalk.gray('Tip: Use --verbose for detailed analysis, --pattern to filter'));
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=modularity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modularity.js","sourceRoot":"","sources":["../../src/commands/modularity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;A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,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,kDAAkD,CAAC,CAAC,CAAC;IACnF,CAAC;SAAM,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,gEAAgE,CAAC,CAAC,CAAC;IACnG,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,mEAAmE,CAAC,CAAC,CAAC;IACnG,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,+DAA+D,CAAC,CAAC,CAAC;AAC3F,CAAC"}
|
|
@@ -1,46 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.createPipelineCommand = createPipelineCommand;
|
|
40
|
-
const commander_1 = require("commander");
|
|
41
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
42
|
-
const fs = __importStar(require("fs"));
|
|
43
|
-
const path = __importStar(require("path"));
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import * as fs from 'fs';
|
|
4
|
+
import * as path from 'path';
|
|
44
5
|
const GATE_CHECKS = [
|
|
45
6
|
{ name: 'Type checking', patterns: ['type-check', 'tsc', 'typescript', 'mypy', 'pyright'] },
|
|
46
7
|
{ name: 'Linting', patterns: ['lint', 'eslint', 'prettier', 'ruff', 'flake8', 'pylint', 'golangci-lint'] },
|
|
@@ -49,8 +10,8 @@ const GATE_CHECKS = [
|
|
|
49
10
|
{ name: 'Security scan', patterns: ['security', 'snyk', 'dependabot', 'trivy', 'codeql'] },
|
|
50
11
|
{ name: 'Build verification', patterns: ['build', 'compile', 'next build', 'vite build'] },
|
|
51
12
|
];
|
|
52
|
-
function createPipelineCommand() {
|
|
53
|
-
const cmd = new
|
|
13
|
+
export function createPipelineCommand() {
|
|
14
|
+
const cmd = new Command('pipeline')
|
|
54
15
|
.description('Audit CI/CD pipeline for deployment safety')
|
|
55
16
|
.option('-r, --repo <path>', 'Repository path', process.cwd())
|
|
56
17
|
.option('-f, --format <type>', 'Output format: terminal, json', 'terminal')
|
|
@@ -75,15 +36,15 @@ async function runPipelineAudit(options) {
|
|
|
75
36
|
}
|
|
76
37
|
// Terminal output
|
|
77
38
|
console.log('');
|
|
78
|
-
console.log(
|
|
79
|
-
console.log(
|
|
80
|
-
console.log(
|
|
39
|
+
console.log(chalk.bold.cyan('═'.repeat(64)));
|
|
40
|
+
console.log(chalk.bold.cyan(' PIPELINE AUDIT'));
|
|
41
|
+
console.log(chalk.bold.cyan('═'.repeat(64)));
|
|
81
42
|
console.log('');
|
|
82
43
|
if (configs.length === 0) {
|
|
83
|
-
console.log(
|
|
44
|
+
console.log(chalk.red.bold(' ⚠️ NO CI/CD PIPELINE DETECTED'));
|
|
84
45
|
console.log('');
|
|
85
|
-
console.log(
|
|
86
|
-
console.log(
|
|
46
|
+
console.log(chalk.gray(' Your deployments have no safety gates.'));
|
|
47
|
+
console.log(chalk.gray(' Broken code goes straight to production.'));
|
|
87
48
|
console.log('');
|
|
88
49
|
printNoPipelineSuggestions(repoPath, options.fix);
|
|
89
50
|
return;
|
|
@@ -95,11 +56,11 @@ async function runPipelineAudit(options) {
|
|
|
95
56
|
const avgScore = Math.round(configs.reduce((sum, c) => sum + c.score, 0) / configs.length);
|
|
96
57
|
const rating = getScoreRating(avgScore);
|
|
97
58
|
console.log('');
|
|
98
|
-
console.log(
|
|
59
|
+
console.log(chalk.bold.white(' OVERALL PIPELINE HEALTH'));
|
|
99
60
|
console.log('');
|
|
100
61
|
console.log(` Score: ${colorScore(avgScore)} ${rating}`);
|
|
101
62
|
console.log('');
|
|
102
|
-
console.log(
|
|
63
|
+
console.log(chalk.cyan('═'.repeat(64)));
|
|
103
64
|
console.log('');
|
|
104
65
|
}
|
|
105
66
|
function detectPipelines(repoPath) {
|
|
@@ -370,53 +331,53 @@ function calculateScore(config) {
|
|
|
370
331
|
}
|
|
371
332
|
function getScoreRating(score) {
|
|
372
333
|
if (score >= 80)
|
|
373
|
-
return
|
|
334
|
+
return chalk.green.bold('SOLID');
|
|
374
335
|
if (score >= 60)
|
|
375
|
-
return
|
|
336
|
+
return chalk.yellow.bold('DECENT');
|
|
376
337
|
if (score >= 40)
|
|
377
|
-
return
|
|
378
|
-
return
|
|
338
|
+
return chalk.yellow('WEAK');
|
|
339
|
+
return chalk.red.bold('YOLO');
|
|
379
340
|
}
|
|
380
341
|
function colorScore(score) {
|
|
381
342
|
if (score >= 80)
|
|
382
|
-
return
|
|
343
|
+
return chalk.green.bold(`${score}/100`);
|
|
383
344
|
if (score >= 60)
|
|
384
|
-
return
|
|
345
|
+
return chalk.yellow.bold(`${score}/100`);
|
|
385
346
|
if (score >= 40)
|
|
386
|
-
return
|
|
387
|
-
return
|
|
347
|
+
return chalk.yellow(`${score}/100`);
|
|
348
|
+
return chalk.red.bold(`${score}/100`);
|
|
388
349
|
}
|
|
389
350
|
function printPipelineConfig(config, showFix) {
|
|
390
351
|
const typeLabel = config.type.toUpperCase();
|
|
391
|
-
const typeColor = config.type === 'github' ?
|
|
352
|
+
const typeColor = config.type === 'github' ? chalk.white : chalk.gray;
|
|
392
353
|
console.log(typeColor(` ${typeLabel}: ${config.file}`));
|
|
393
354
|
console.log('');
|
|
394
355
|
// Gates
|
|
395
|
-
console.log(
|
|
356
|
+
console.log(chalk.bold.white(' Gates:'));
|
|
396
357
|
for (const gate of config.gates) {
|
|
397
358
|
const status = gate.present
|
|
398
|
-
? (gate.blocking ?
|
|
399
|
-
:
|
|
359
|
+
? (gate.blocking ? chalk.green('✓ blocking') : chalk.yellow('✓ non-blocking'))
|
|
360
|
+
: chalk.red('✗ missing');
|
|
400
361
|
console.log(` ${gate.name}: ${status}`);
|
|
401
362
|
}
|
|
402
363
|
console.log('');
|
|
403
364
|
// Triggers
|
|
404
|
-
console.log(
|
|
365
|
+
console.log(chalk.bold.white(' Triggers:'));
|
|
405
366
|
for (const trigger of config.triggers) {
|
|
406
|
-
const triggerColor = trigger === 'pull_request' ?
|
|
367
|
+
const triggerColor = trigger === 'pull_request' ? chalk.green : chalk.yellow;
|
|
407
368
|
console.log(` ${triggerColor(trigger)}`);
|
|
408
369
|
}
|
|
409
370
|
console.log('');
|
|
410
371
|
// Issues
|
|
411
372
|
if (config.issues.length > 0) {
|
|
412
|
-
console.log(
|
|
373
|
+
console.log(chalk.bold.white(' Issues:'));
|
|
413
374
|
for (const issue of config.issues) {
|
|
414
|
-
const severityColor = issue.severity === 'critical' ?
|
|
415
|
-
: issue.severity === 'warning' ?
|
|
416
|
-
:
|
|
375
|
+
const severityColor = issue.severity === 'critical' ? chalk.red
|
|
376
|
+
: issue.severity === 'warning' ? chalk.yellow
|
|
377
|
+
: chalk.gray;
|
|
417
378
|
console.log(` ${severityColor(`[${issue.severity.toUpperCase()}]`)} ${issue.message}`);
|
|
418
379
|
if (showFix && issue.fix) {
|
|
419
|
-
console.log(
|
|
380
|
+
console.log(chalk.gray(` Fix: ${issue.fix}`));
|
|
420
381
|
}
|
|
421
382
|
}
|
|
422
383
|
console.log('');
|
|
@@ -443,13 +404,13 @@ function printNoPipelineSuggestions(repoPath, showFix) {
|
|
|
443
404
|
}
|
|
444
405
|
catch { /* ignore */ }
|
|
445
406
|
}
|
|
446
|
-
console.log(
|
|
407
|
+
console.log(chalk.bold.white(' SUGGESTIONS:'));
|
|
447
408
|
console.log('');
|
|
448
409
|
if (showFix) {
|
|
449
|
-
console.log(
|
|
410
|
+
console.log(chalk.cyan(' Create .github/workflows/ci.yml with:'));
|
|
450
411
|
console.log('');
|
|
451
412
|
if (projectType === 'nextjs') {
|
|
452
|
-
console.log(
|
|
413
|
+
console.log(chalk.gray(` name: CI
|
|
453
414
|
on: [push, pull_request]
|
|
454
415
|
jobs:
|
|
455
416
|
validate:
|
|
@@ -464,7 +425,7 @@ function printNoPipelineSuggestions(repoPath, showFix) {
|
|
|
464
425
|
- run: npm run build`));
|
|
465
426
|
}
|
|
466
427
|
else {
|
|
467
|
-
console.log(
|
|
428
|
+
console.log(chalk.gray(` name: CI
|
|
468
429
|
on: [push, pull_request]
|
|
469
430
|
jobs:
|
|
470
431
|
test:
|
|
@@ -477,9 +438,9 @@ function printNoPipelineSuggestions(repoPath, showFix) {
|
|
|
477
438
|
console.log('');
|
|
478
439
|
}
|
|
479
440
|
else {
|
|
480
|
-
console.log(
|
|
441
|
+
console.log(chalk.gray(' Run with --fix to see suggested workflow'));
|
|
481
442
|
}
|
|
482
|
-
console.log(
|
|
443
|
+
console.log(chalk.cyan('═'.repeat(64)));
|
|
483
444
|
console.log('');
|
|
484
445
|
}
|
|
485
446
|
//# sourceMappingURL=pipeline.js.map
|