vibecodingmachine-cli 2026.3.14-1537 → 2026.6.17-1956

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.
Files changed (162) hide show
  1. package/bin/auth/auth-compliance.js +7 -7
  2. package/bin/commands/agent-commands.js +15 -15
  3. package/bin/commands/auto-commands.js +3 -3
  4. package/bin/commands/command-aliases.js +13 -4
  5. package/bin/config/cli-config.js +15 -5
  6. package/bin/update/update-checker.js +5 -5
  7. package/bin/vibecodingmachine.js +2 -2
  8. package/package.json +2 -2
  9. package/src/commands/agents/add.js +5 -5
  10. package/src/commands/agents/check.js +19 -19
  11. package/src/commands/agents/list.js +24 -24
  12. package/src/commands/agents/remove.js +4 -4
  13. package/src/commands/agents-check.js +1 -1
  14. package/src/commands/analyze-file-sizes.js +43 -43
  15. package/src/commands/auto-direct/auto-provider-manager.js +19 -19
  16. package/src/commands/auto-direct/auto-start-phases.js +493 -0
  17. package/src/commands/auto-direct/auto-status-display.js +35 -35
  18. package/src/commands/auto-direct/auto-utils.js +50 -50
  19. package/src/commands/auto-direct/cline-installer.js +56 -0
  20. package/src/commands/auto-direct/code-processor.js +27 -27
  21. package/src/commands/auto-direct/file-scanner.js +19 -19
  22. package/src/commands/auto-direct/ide-completion-waiter.js +485 -0
  23. package/src/commands/auto-direct/ide-fallback-runner.js +226 -0
  24. package/src/commands/auto-direct/ide-provider-runner.js +103 -0
  25. package/src/commands/auto-direct/iteration-handlers.js +189 -0
  26. package/src/commands/auto-direct/iteration-runner.js +485 -0
  27. package/src/commands/auto-direct/provider-config.js +38 -7
  28. package/src/commands/auto-direct/provider-manager.js +132 -6
  29. package/src/commands/auto-direct/requirement-manager.js +169 -104
  30. package/src/commands/auto-direct/requirement-mover.js +350 -0
  31. package/src/commands/auto-direct/spec-handlers.js +155 -0
  32. package/src/commands/auto-direct/spec-ide-runner.js +318 -0
  33. package/src/commands/auto-direct/spec-processing.js +203 -0
  34. package/src/commands/auto-direct/status-display.js +9 -9
  35. package/src/commands/auto-direct/utils.js +83 -1
  36. package/src/commands/auto-direct-refactored.js +1 -413
  37. package/src/commands/auto-direct.js +127 -4119
  38. package/src/commands/auto-execution.js +21 -21
  39. package/src/commands/auto-status-helpers.js +0 -2
  40. package/src/commands/auto.js +22 -22
  41. package/src/commands/check-compliance.js +65 -65
  42. package/src/commands/computers.js +39 -39
  43. package/src/commands/continuous-scan.js +19 -19
  44. package/src/commands/ide.js +4 -4
  45. package/src/commands/locale.js +7 -7
  46. package/src/commands/refactor-file.js +59 -59
  47. package/src/commands/requirements/commands.js +17 -17
  48. package/src/commands/requirements/default-handlers.js +30 -30
  49. package/src/commands/requirements/disable.js +3 -3
  50. package/src/commands/requirements/enable.js +3 -3
  51. package/src/commands/requirements/utils.js +6 -6
  52. package/src/commands/requirements-refactored.js +3 -3
  53. package/src/commands/requirements-remote.js +38 -38
  54. package/src/commands/requirements.js +3 -3
  55. package/src/commands/settings.js +111 -0
  56. package/src/commands/specs/count.js +60 -0
  57. package/src/commands/specs/disable.js +3 -3
  58. package/src/commands/specs/enable.js +3 -3
  59. package/src/commands/status.js +10 -10
  60. package/src/commands/sync.js +25 -25
  61. package/src/commands/timeout.js +35 -35
  62. package/src/trui/TruiInterface.js +2 -2
  63. package/src/trui/agents/AgentInterface.js +4 -4
  64. package/src/trui/agents/handlers/CommandHandler.js +4 -4
  65. package/src/trui/agents/handlers/ContextManager.js +1 -1
  66. package/src/trui/agents/handlers/DisplayHandler.js +11 -11
  67. package/src/trui/agents/handlers/HelpHandler.js +1 -1
  68. package/src/utils/agent-selector.js +6 -6
  69. package/src/utils/antigravity-installer.js +4 -4
  70. package/src/utils/asset-cleanup.js +1 -1
  71. package/src/utils/auth.js +9 -12
  72. package/src/utils/clarification-actions.js +4 -4
  73. package/src/utils/cline-js-handler.js +5 -5
  74. package/src/utils/compliance-check.js +6 -6
  75. package/src/utils/config.js +12 -12
  76. package/src/utils/display-formatters-complete.js +2 -2
  77. package/src/utils/display-formatters-extracted.js +2 -2
  78. package/src/utils/display-formatters.js +2 -2
  79. package/src/utils/feedback-handler.js +2 -2
  80. package/src/utils/first-run.js +7 -7
  81. package/src/utils/ide-detection.js +1 -1
  82. package/src/utils/ide-handlers.js +6 -6
  83. package/src/utils/interactive/clarification-actions.js +3 -3
  84. package/src/utils/interactive/core-ui.js +7 -7
  85. package/src/utils/interactive/file-backup.js +6 -6
  86. package/src/utils/interactive/file-import-export.js +49 -49
  87. package/src/utils/interactive/file-operations.js +3 -3
  88. package/src/utils/interactive/file-validation.js +41 -41
  89. package/src/utils/interactive/interactive-prompts.js +41 -41
  90. package/src/utils/interactive/requirement-actions.js +5 -5
  91. package/src/utils/interactive/requirement-crud.js +4 -4
  92. package/src/utils/interactive/requirements-navigation.js +10 -10
  93. package/src/utils/interactive-broken.js +6 -6
  94. package/src/utils/interactive.js +37 -37
  95. package/src/utils/keyboard-handler.js +4 -4
  96. package/src/utils/prompt-helper.js +6 -6
  97. package/src/utils/provider-checker/agent-checker.js +1 -1
  98. package/src/utils/provider-checker/agent-runner.js +203 -314
  99. package/src/utils/provider-checker/agents-file-lock.js +134 -0
  100. package/src/utils/provider-checker/agents-manager.js +224 -36
  101. package/src/utils/provider-checker/cli-installer.js +28 -28
  102. package/src/utils/provider-checker/cli-utils.js +2 -2
  103. package/src/utils/provider-checker/cursor-approval-clicker.js +108 -0
  104. package/src/utils/provider-checker/format-utils.js +4 -4
  105. package/src/utils/provider-checker/ide-installer-helper.js +96 -0
  106. package/src/utils/provider-checker/ide-manager.js +19 -8
  107. package/src/utils/provider-checker/ide-quota-checker.js +120 -0
  108. package/src/utils/provider-checker/ide-utils.js +2 -2
  109. package/src/utils/provider-checker/node-detector.js +4 -4
  110. package/src/utils/provider-checker/node-utils.js +5 -5
  111. package/src/utils/provider-checker/opencode-checker.js +107 -73
  112. package/src/utils/provider-checker/process-utils.js +1 -1
  113. package/src/utils/provider-checker/provider-validator.js +11 -11
  114. package/src/utils/provider-checker/quota-checker.js +5 -5
  115. package/src/utils/provider-checker/quota-detector.js +5 -5
  116. package/src/utils/provider-checker/requirements-manager.js +6 -6
  117. package/src/utils/provider-checker/test-requirements.js +1 -1
  118. package/src/utils/provider-checker/vscode-approval-clicker.js +328 -0
  119. package/src/utils/provider-checker-new.js +6 -6
  120. package/src/utils/provider-checker.js +6 -6
  121. package/src/utils/provider-checkers/ide-manager.js +13 -13
  122. package/src/utils/provider-checkers/node-executable-finder.js +4 -4
  123. package/src/utils/provider-checkers/provider-checker-core.js +5 -5
  124. package/src/utils/provider-checkers/provider-checker-main.js +17 -17
  125. package/src/utils/provider-registry.js +5 -6
  126. package/src/utils/provider-utils.js +12 -12
  127. package/src/utils/quota-detectors.js +32 -32
  128. package/src/utils/requirement-action-handlers.js +12 -12
  129. package/src/utils/requirement-actions/requirement-operations.js +3 -3
  130. package/src/utils/requirement-actions.js +1 -1
  131. package/src/utils/requirement-file-operations.js +5 -5
  132. package/src/utils/requirement-helpers.js +1 -1
  133. package/src/utils/requirement-management.js +5 -5
  134. package/src/utils/requirement-navigation.js +2 -2
  135. package/src/utils/requirement-organization.js +3 -3
  136. package/src/utils/rui-trui-adapter.js +14 -14
  137. package/src/utils/simple-trui.js +3 -3
  138. package/src/utils/status-helpers-extracted.js +3 -3
  139. package/src/utils/trui-clarifications.js +11 -11
  140. package/src/utils/trui-debug.js +3 -2
  141. package/src/utils/trui-devin.js +217 -0
  142. package/src/utils/trui-feedback.js +7 -7
  143. package/src/utils/trui-kiro-integration.js +34 -34
  144. package/src/utils/trui-main-handlers.js +20 -21
  145. package/src/utils/trui-main-menu.js +19 -19
  146. package/src/utils/trui-nav-agents.js +59 -8
  147. package/src/utils/trui-nav-requirements.js +3 -3
  148. package/src/utils/trui-nav-settings.js +10 -10
  149. package/src/utils/trui-nav-specifications.js +1 -1
  150. package/src/utils/trui-navigation-backup.js +11 -11
  151. package/src/utils/trui-navigation.js +9 -9
  152. package/src/utils/trui-provider-health.js +25 -25
  153. package/src/utils/trui-provider-manager.js +28 -28
  154. package/src/utils/trui-quick-menu.js +2 -2
  155. package/src/utils/trui-req-actions-backup.js +21 -21
  156. package/src/utils/trui-req-actions.js +20 -20
  157. package/src/utils/trui-req-editor.js +10 -10
  158. package/src/utils/trui-req-file-ops.js +3 -3
  159. package/src/utils/trui-req-tree.js +7 -7
  160. package/src/utils/trui-windsurf.js +103 -103
  161. package/src/utils/user-tracking.js +15 -15
  162. package/src/utils/trui-req-tree-old.js +0 -719
@@ -12,10 +12,10 @@ const { getProviderDefinitions, getProviderPreferences } = require('../utils/pro
12
12
 
13
13
  // Import our modular components
14
14
  const { getAvailableProviders } = require('./auto-provider-management');
15
- const {
16
- isRequirementDone,
17
- moveRequirementBackToTodo,
18
- moveRequirementToFeedback,
15
+ const {
16
+ isRequirementDone,
17
+ moveRequirementBackToTodo,
18
+ moveRequirementToFeedback,
19
19
  moveCompletedRequirement,
20
20
  getCurrentRequirementDetails,
21
21
  getRequirementCounts
@@ -45,12 +45,12 @@ async function start(options) {
45
45
  }
46
46
 
47
47
  const repoPath = await getEffectiveRepoPath();
48
-
48
+
49
49
  if (!repoPath) {
50
50
  console.error(chalk.red('❌ Unable to determine repository path'));
51
51
  process.exit(1);
52
52
  }
53
-
53
+
54
54
  const config = getAutoConfig(repoPath);
55
55
  const stages = getStages(repoPath);
56
56
 
@@ -170,7 +170,7 @@ async function runAutoModeLoop(repoPath, config, stages) {
170
170
  try {
171
171
  // Get current requirement details
172
172
  const { title: currentTitle, status: currentStatus } = await getCurrentRequirementDetails(repoPath);
173
-
173
+
174
174
  // Display status card
175
175
  printStatusCard(currentTitle, currentStatus);
176
176
 
@@ -178,7 +178,7 @@ async function runAutoModeLoop(repoPath, config, stages) {
178
178
  const requirementStatus = await isRequirementDone(repoPath);
179
179
  if (requirementStatus.isDone && requirementStatus.actuallyComplete) {
180
180
  console.log(chalk.green(`✅ Requirement completed: ${currentTitle}`));
181
-
181
+
182
182
  // Move to next requirement
183
183
  await moveToNextRequirement(repoPath);
184
184
  chatCount++;
@@ -255,7 +255,7 @@ async function executeCurrentStage(repoPath, currentStatus, currentTitle) {
255
255
  */
256
256
  async function executePrepareStage(repoPath, currentTitle) {
257
257
  console.log(chalk.cyan(`[${getTimestamp()}] 🔨 PREPARE: ${currentTitle}`));
258
-
258
+
259
259
  // Update status to CREATE
260
260
  const updateResult = await updateRequirementsStatus(repoPath, 'CREATE', `Starting implementation of: ${currentTitle}`);
261
261
  if (!updateResult.success) {
@@ -315,7 +315,7 @@ async function executeCreateStage(repoPath, currentTitle) {
315
315
  try {
316
316
  const { WindowsAutomationManager } = require('vibecodingmachine-core');
317
317
  const manager = new WindowsAutomationManager();
318
- const result = await manager.sendTextToWindsurf(requirementText.trim());
318
+ const result = await manager.sendTextToDevin(requirementText.trim());
319
319
 
320
320
  // Check for rate limit
321
321
  if (result.rateLimited) {
@@ -326,7 +326,7 @@ async function executeCreateStage(repoPath, currentTitle) {
326
326
  success: false,
327
327
  rateLimited: true,
328
328
  resetTime: result.resetTime,
329
- error: `Windsurf Cascade rate limit reached. Resets in: ${result.resetTime}`
329
+ error: `Devin rate limit reached. Resets in: ${result.resetTime}`
330
330
  };
331
331
  }
332
332
 
@@ -370,13 +370,13 @@ async function executeCreateStage(repoPath, currentTitle) {
370
370
  */
371
371
  async function executeCleanUpStage(repoPath, currentTitle) {
372
372
  console.log(chalk.cyan(`[${getTimestamp()}] 🧹 CLEAN_UP: ${currentTitle}`));
373
-
373
+
374
374
  // Run linting, cleanup, etc.
375
375
  console.log(chalk.blue('🧹 Running code cleanup...'));
376
-
376
+
377
377
  // Simulate cleanup work
378
378
  await new Promise(resolve => setTimeout(resolve, 2000));
379
-
379
+
380
380
  // Update status to VERIFY
381
381
  const updateResult = await updateRequirementsStatus(repoPath, 'VERIFY', `Cleanup complete for: ${currentTitle}`);
382
382
  if (!updateResult.success) {
@@ -395,13 +395,13 @@ async function executeCleanUpStage(repoPath, currentTitle) {
395
395
  */
396
396
  async function executeVerifyStage(repoPath, currentTitle) {
397
397
  console.log(chalk.cyan(`[${getTimestamp()}] ✅ VERIFY: ${currentTitle}`));
398
-
398
+
399
399
  // Run tests, verification, etc.
400
400
  console.log(chalk.blue('🔍 Running verification...'));
401
-
401
+
402
402
  // Simulate verification work
403
403
  await new Promise(resolve => setTimeout(resolve, 2000));
404
-
404
+
405
405
  // Update status to DONE
406
406
  const updateResult = await updateRequirementsStatus(repoPath, 'DONE', `Verification complete for: ${currentTitle}`);
407
407
  if (!updateResult.success) {
@@ -420,14 +420,14 @@ async function executeVerifyStage(repoPath, currentTitle) {
420
420
  */
421
421
  async function executeNotWorkingStage(repoPath, currentTitle) {
422
422
  console.log(chalk.red(`\n[${getTimestamp()}] ❌ NOT_WORKING: ${currentTitle}`));
423
-
423
+
424
424
  // Move requirement to feedback section
425
425
  const moveResult = await moveRequirementToFeedback(
426
- repoPath,
427
- currentTitle,
426
+ repoPath,
427
+ currentTitle,
428
428
  'Requirement marked as not working during auto mode execution'
429
429
  );
430
-
430
+
431
431
  if (!moveResult.success) {
432
432
  return moveResult;
433
433
  }
@@ -35,7 +35,6 @@ function printStatusCard(currentTitle, currentStatus) {
35
35
  const statusIcons = {
36
36
  'PREPARE': '🔨',
37
37
  'ACT': '⏳',
38
- 'CREATE': '🛠️',
39
38
  'CLEAN_UP': '🧹',
40
39
  'VERIFY': '✅',
41
40
  'DONE': '✅',
@@ -47,7 +46,6 @@ function printStatusCard(currentTitle, currentStatus) {
47
46
  const statusColor = {
48
47
  'PREPARE': chalk.yellow,
49
48
  'ACT': chalk.blue,
50
- 'CREATE': chalk.blue,
51
49
  'CLEAN_UP': chalk.cyan,
52
50
  'VERIFY': chalk.green,
53
51
  'DONE': chalk.green.bold,
@@ -3,11 +3,11 @@ const chalk = require('chalk');
3
3
  // Import modularized components
4
4
  const { start: startAutoMode } = require('./auto-execution');
5
5
  const { getAvailableProviders, listAgents } = require('./auto-provider-management');
6
- const {
7
- isRequirementDone,
8
- moveRequirementBackToTodo,
9
- moveRequirementToFeedback,
10
- moveCompletedRequirement
6
+ const {
7
+ isRequirementDone,
8
+ moveRequirementBackToTodo,
9
+ moveRequirementToFeedback,
10
+ moveCompletedRequirement
11
11
  } = require('./auto-requirement-management');
12
12
  const { getProviderDefinitions } = require('../utils/provider-registry');
13
13
 
@@ -15,10 +15,10 @@ const PROVIDER_DEFINITIONS = getProviderDefinitions();
15
15
 
16
16
  /**
17
17
  * Auto Command - Refactored Version
18
- *
18
+ *
19
19
  * This file has been refactored from 4,796 lines to ~100 lines by extracting
20
20
  * functionality into focused modules:
21
- *
21
+ *
22
22
  * - auto-execution.js: Main auto-mode execution logic
23
23
  * - auto-provider-management.js: LLM provider operations
24
24
  * - auto-requirement-management.js: Requirement operations
@@ -40,9 +40,9 @@ async function start(options) {
40
40
  async function stop(options) {
41
41
  const { getRepoPath } = require('../utils/config');
42
42
  const { stopAutoMode } = require('../utils/auto-mode');
43
-
43
+
44
44
  const repoPath = getRepoPath();
45
-
45
+
46
46
  try {
47
47
  await stopAutoMode(repoPath);
48
48
  console.log(chalk.green('✅ Auto mode stopped'));
@@ -59,10 +59,10 @@ async function stop(options) {
59
59
  async function status(options) {
60
60
  const { getRepoPath } = require('../utils/config');
61
61
  const { checkAutoModeStatus } = require('../utils/auto-mode');
62
-
62
+
63
63
  const repoPath = getRepoPath();
64
64
  const autoStatus = checkAutoModeStatus(repoPath);
65
-
65
+
66
66
  if (autoStatus.isRunning) {
67
67
  console.log(chalk.green('✅ Auto mode is running'));
68
68
  console.log(chalk.gray(' Started:'), chalk.white(autoStatus.startTime));
@@ -78,12 +78,12 @@ async function status(options) {
78
78
  */
79
79
  async function config(options) {
80
80
  const { getRepoPath, getAutoConfig, setAutoConfig } = require('../utils/config');
81
-
81
+
82
82
  const repoPath = getRepoPath();
83
83
  const currentConfig = getAutoConfig(repoPath);
84
-
84
+
85
85
  console.log(chalk.blue('⚙️ Auto Mode Configuration:\n'));
86
-
86
+
87
87
  // Display current config
88
88
  console.log(chalk.cyan('Current configuration:'));
89
89
  if (currentConfig.providers && currentConfig.providers.length > 0) {
@@ -91,11 +91,11 @@ async function config(options) {
91
91
  } else {
92
92
  console.log(chalk.gray(' Providers:'), chalk.red('None configured'));
93
93
  }
94
-
94
+
95
95
  if (currentConfig.maxChats) {
96
96
  console.log(chalk.gray(' Max chats:'), chalk.white(currentConfig.maxChats));
97
97
  }
98
-
98
+
99
99
  if (currentConfig.neverStop) {
100
100
  console.log(chalk.gray(' Mode:'), chalk.cyan('Never stop'));
101
101
  }
@@ -103,23 +103,23 @@ async function config(options) {
103
103
  // Apply new configuration if provided
104
104
  if (options.provider || options.model || options.maxChats || options.neverStop !== undefined) {
105
105
  const newConfig = { ...currentConfig };
106
-
106
+
107
107
  if (options.provider && options.model) {
108
108
  newConfig.providers = [{ provider: options.provider, model: options.model }];
109
109
  }
110
-
110
+
111
111
  if (options.maxChats) {
112
112
  newConfig.maxChats = parseInt(options.maxChats);
113
113
  }
114
-
114
+
115
115
  if (options.neverStop !== undefined) {
116
116
  newConfig.neverStop = options.neverStop;
117
117
  }
118
-
118
+
119
119
  setAutoConfig(repoPath, newConfig);
120
-
120
+
121
121
  console.log(chalk.green('\n✅ Configuration updated'));
122
-
122
+
123
123
  // Display new configuration
124
124
  if (newConfig.neverStop) {
125
125
  console.log(chalk.gray(' Mode:'), chalk.cyan('Never stop'));
@@ -2,7 +2,7 @@
2
2
 
3
3
  /**
4
4
  * CLI Command for Checking Compliance
5
- *
5
+ *
6
6
  * Provides command-line interface for checking file size compliance
7
7
  * and constitutional adherence across the codebase.
8
8
  */
@@ -23,7 +23,7 @@ const DEFAULT_CONFIG = {
23
23
  maxFileSize: 555,
24
24
  warningThreshold: 500,
25
25
  criticalThreshold: 800,
26
- allowedFileTypes: ['js', 'jsx', 'ts', 'tsx', 'md', 'json'],
26
+ allowedFileTypes: ['js', 'jsx', 'ts', 'tsx', 'json'], // Source code files only - not .md (docs are exempt from line limits)
27
27
  excludedPaths: [
28
28
  'node_modules',
29
29
  '.git',
@@ -33,7 +33,7 @@ const DEFAULT_CONFIG = {
33
33
  '.vscode',
34
34
  '.idea',
35
35
  '.cursor',
36
- '.windsurf',
36
+ '.devin',
37
37
  'vendor',
38
38
  'bower_components'
39
39
  ]
@@ -85,14 +85,14 @@ function formatDuration(ms) {
85
85
  */
86
86
  async function getAllFiles(dirPath, options = {}) {
87
87
  const files = [];
88
-
88
+
89
89
  const scanDir = (dir) => {
90
90
  try {
91
91
  const entries = fs.readdirSync(dir, { withFileTypes: true });
92
-
92
+
93
93
  for (const entry of entries) {
94
94
  const fullPath = path.join(dir, entry.name);
95
-
95
+
96
96
  if (entry.isDirectory()) {
97
97
  // Skip excluded directories
98
98
  if (!options.excludedPaths?.some(pattern => fullPath.includes(pattern))) {
@@ -112,7 +112,7 @@ async function getAllFiles(dirPath, options = {}) {
112
112
  }
113
113
  }
114
114
  };
115
-
115
+
116
116
  scanDir(dirPath);
117
117
  return files;
118
118
  }
@@ -130,41 +130,41 @@ async function validateFile(filePath, validators, options) {
130
130
  hasViolations: false,
131
131
  hasWarnings: false
132
132
  };
133
-
133
+
134
134
  try {
135
135
  if (!fs.existsSync(filePath)) {
136
136
  return results;
137
137
  }
138
-
138
+
139
139
  // Get file stats
140
140
  const fileStats = fs.statSync(filePath);
141
141
  results.fileSize = fileStats.size;
142
-
142
+
143
143
  // Read file content
144
144
  const content = fs.readFileSync(filePath, 'utf8');
145
145
  results.lineCount = content.split('\n').length;
146
-
146
+
147
147
  // Line limit validation
148
148
  if (validators.lineLimit) {
149
149
  results.lineLimitValidation = validators.lineLimit.validateFile(filePath);
150
150
  }
151
-
151
+
152
152
  // Constitutional validation
153
153
  if (validators.constitution && options.enableConstitutional) {
154
154
  results.constitutionalValidation = validators.constitution.validateFile(filePath);
155
155
  }
156
-
156
+
157
157
  // Determine violation/warning status
158
- results.hasViolations = !results.lineLimitValidation?.isValid ||
158
+ results.hasViolations = !results.lineLimitValidation?.isValid ||
159
159
  (results.constitutionalValidation?.some(r => r.severity === 'critical' || r.severity === 'error'));
160
-
160
+
161
161
  results.hasWarnings = results.lineLimitValidation?.violation?.type === 'warning' ||
162
162
  (results.constitutionalValidation?.some(r => r.severity === 'warning'));
163
-
163
+
164
164
  } catch (error) {
165
165
  results.error = error.message;
166
166
  }
167
-
167
+
168
168
  return results;
169
169
  }
170
170
 
@@ -174,12 +174,12 @@ async function validateFile(filePath, validators, options) {
174
174
  async function validateFiles(filePaths, validators, options) {
175
175
  const results = [];
176
176
  const startTime = Date.now();
177
-
177
+
178
178
  if (options.parallel) {
179
179
  // Process files in parallel
180
180
  const promises = filePaths.map(filePath => validateFile(filePath, validators, options));
181
181
  const settled = await Promise.allSettled(promises);
182
-
182
+
183
183
  for (const result of settled) {
184
184
  if (result.status === 'fulfilled') {
185
185
  results.push(result.value);
@@ -195,7 +195,7 @@ async function validateFiles(filePaths, validators, options) {
195
195
  try {
196
196
  const result = await validateFile(filePath, validators, options);
197
197
  results.push(result);
198
-
198
+
199
199
  if (options.progress && filePaths.length > 10) {
200
200
  const progress = (results.length / filePaths.length * 100).toFixed(1);
201
201
  process.stdout.write(`\rProgress: ${progress}% (${results.length}/${filePaths.length})`);
@@ -206,12 +206,12 @@ async function validateFiles(filePaths, validators, options) {
206
206
  }
207
207
  }
208
208
  }
209
-
209
+
210
210
  if (options.progress && filePaths.length > 10) {
211
211
  console.log(''); // New line after progress
212
212
  }
213
213
  }
214
-
214
+
215
215
  const duration = Date.now() - startTime;
216
216
  return { results, duration };
217
217
  }
@@ -224,29 +224,29 @@ function printSummary(results, duration, options) {
224
224
  const compliantFiles = results.filter(r => !r.hasViolations && !r.hasWarnings).length;
225
225
  const warningFiles = results.filter(r => r.hasWarnings && !r.hasViolations).length;
226
226
  const violationFiles = results.filter(r => r.hasViolations).length;
227
-
227
+
228
228
  const totalLines = results.reduce((sum, r) => sum + r.lineCount, 0);
229
229
  const totalSize = results.reduce((sum, r) => sum + r.fileSize, 0);
230
-
230
+
231
231
  console.log('\n' + COLORS.bold + 'Compliance Summary' + COLORS.reset);
232
232
  console.log('─'.repeat(50));
233
-
233
+
234
234
  // Basic stats
235
235
  console.log(`📁 Files analyzed: ${COLORS.cyan}${totalFiles}${COLORS.reset}`);
236
236
  console.log(`✅ Compliant files: ${COLORS.green}${compliantFiles}${COLORS.reset}`);
237
237
  console.log(`⚠️ Warning files: ${COLORS.yellow}${warningFiles}${COLORS.reset}`);
238
238
  console.log(`❌ Violation files: ${COLORS.red}${violationFiles}${COLORS.reset}`);
239
-
239
+
240
240
  // Compliance rate
241
241
  const complianceRate = totalFiles > 0 ? (compliantFiles / totalFiles * 100) : 100;
242
242
  const complianceColor = complianceRate >= 90 ? 'green' : complianceRate >= 70 ? 'yellow' : 'red';
243
243
  console.log(`📊 Compliance rate: ${COLORS[complianceColor]}${complianceRate.toFixed(1)}%${COLORS.reset}`);
244
-
244
+
245
245
  // File stats
246
246
  console.log(`📏 Total lines: ${COLORS.cyan}${totalLines.toLocaleString()}${COLORS.reset}`);
247
247
  console.log(`💾 Total size: ${COLORS.cyan}${formatBytes(totalSize)}${COLORS.reset}`);
248
248
  console.log(`⏱️ Analysis time: ${COLORS.blue}${formatDuration(duration)}${COLORS.reset}`);
249
-
249
+
250
250
  // Average stats
251
251
  if (totalFiles > 0) {
252
252
  const avgLines = Math.round(totalLines / totalFiles);
@@ -254,7 +254,7 @@ function printSummary(results, duration, options) {
254
254
  console.log(`📈 Average lines/file: ${COLORS.cyan}${avgLines}${COLORS.reset}`);
255
255
  console.log(`📈 Average size/file: ${COLORS.cyan}${formatBytes(avgSize)}${COLORS.reset}`);
256
256
  }
257
-
257
+
258
258
  return {
259
259
  totalFiles,
260
260
  compliantFiles,
@@ -272,19 +272,19 @@ function printSummary(results, duration, options) {
272
272
  */
273
273
  function printViolations(results, options) {
274
274
  const violatingFiles = results.filter(r => r.hasViolations);
275
-
275
+
276
276
  if (violatingFiles.length === 0) {
277
277
  colorLog('green', '\n🎉 No violations found!');
278
278
  return;
279
279
  }
280
-
280
+
281
281
  console.log('\n' + COLORS.bold + 'Violations' + COLORS.reset);
282
282
  console.log('─'.repeat(50));
283
-
283
+
284
284
  for (const file of violatingFiles.sort((a, b) => b.lineCount - a.lineCount)) {
285
285
  console.log(`\n${COLORS.red}❌ ${file.filePath}${COLORS.reset}`);
286
286
  console.log(` Lines: ${file.lineCount}`);
287
-
287
+
288
288
  // Line limit violations
289
289
  if (file.lineLimitValidation && !file.lineLimitValidation.isValid) {
290
290
  const violation = file.lineLimitValidation.violation;
@@ -295,16 +295,16 @@ function printViolations(results, options) {
295
295
  console.log(` ${COLORS.red}Line limit violation: File exceeds size limit${COLORS.reset}`);
296
296
  }
297
297
  }
298
-
298
+
299
299
  // Constitutional violations
300
300
  if (file.constitutionalValidation) {
301
301
  const criticalIssues = file.constitutionalValidation.filter(r => r.severity === 'critical');
302
302
  const errorIssues = file.constitutionalValidation.filter(r => r.severity === 'error');
303
-
303
+
304
304
  for (const issue of criticalIssues) {
305
305
  console.log(` ${COLORS.red}🚨 Critical (${issue.category}): ${issue.message}${COLORS.reset}`);
306
306
  }
307
-
307
+
308
308
  for (const issue of errorIssues) {
309
309
  console.log(` ${COLORS.red}❌ Error (${issue.category}): ${issue.message}${COLORS.reset}`);
310
310
  }
@@ -317,27 +317,27 @@ function printViolations(results, options) {
317
317
  */
318
318
  function printWarnings(results, options) {
319
319
  const warningFiles = results.filter(r => r.hasWarnings && !r.hasViolations);
320
-
320
+
321
321
  if (warningFiles.length === 0) {
322
322
  return;
323
323
  }
324
-
324
+
325
325
  console.log('\n' + COLORS.bold + 'Warnings' + COLORS.reset);
326
326
  console.log('─'.repeat(50));
327
-
327
+
328
328
  for (const file of warningFiles.sort((a, b) => b.lineCount - a.lineCount)) {
329
329
  console.log(`\n${COLORS.yellow}⚠️ ${file.filePath}${COLORS.reset}`);
330
330
  console.log(` Lines: ${file.lineCount}`);
331
-
331
+
332
332
  // Line limit warnings
333
333
  if (file.lineLimitValidation?.violation?.type === 'warning') {
334
334
  console.log(` ${COLORS.yellow}Approaching limit: ${file.lineLimitValidation.violation.message}${COLORS.reset}`);
335
335
  }
336
-
336
+
337
337
  // Constitutional warnings
338
338
  if (file.constitutionalValidation) {
339
339
  const warningIssues = file.constitutionalValidation.filter(r => r.severity === 'warning');
340
-
340
+
341
341
  for (const issue of warningIssues) {
342
342
  console.log(` ${COLORS.yellow}⚠️ Warning (${issue.category}): ${issue.message}${COLORS.reset}`);
343
343
  }
@@ -352,15 +352,15 @@ function printTopFiles(results, options) {
352
352
  const topFiles = results
353
353
  .sort((a, b) => b.lineCount - a.lineCount)
354
354
  .slice(0, options.top || 10);
355
-
355
+
356
356
  console.log('\n' + COLORS.bold + `Top ${topFiles.length} Files by Size` + COLORS.reset);
357
357
  console.log('─'.repeat(50));
358
-
358
+
359
359
  for (let i = 0; i < topFiles.length; i++) {
360
360
  const file = topFiles[i];
361
361
  const status = file.hasViolations ? '❌' : file.hasWarnings ? '⚠️' : '✅';
362
362
  const statusColor = file.hasViolations ? 'red' : file.hasWarnings ? 'yellow' : 'green';
363
-
363
+
364
364
  console.log(`${i + 1}. ${COLORS[statusColor]}${status}${COLORS.reset} ${file.filePath}`);
365
365
  console.log(` ${file.lineCount} lines • ${formatBytes(file.fileSize)}`);
366
366
  }
@@ -373,21 +373,21 @@ async function generateReport(results, options) {
373
373
  if (!options.report) {
374
374
  return;
375
375
  }
376
-
376
+
377
377
  try {
378
378
  const reporter = new ComplianceReporter({
379
379
  outputDir: path.dirname(options.report),
380
380
  formats: [path.extname(options.report).slice(1) || 'json']
381
381
  });
382
-
382
+
383
383
  const reportResult = await reporter.generateReport(results, {
384
384
  title: 'CLI Compliance Report',
385
385
  includeMetrics: true,
386
386
  includeRecommendations: true
387
387
  });
388
-
388
+
389
389
  colorLog('green', `\n📄 Report saved to: ${reportResult.files[0].filePath}`);
390
-
390
+
391
391
  } catch (error) {
392
392
  colorLog('red', `❌ Failed to generate report: ${error.message}`);
393
393
  }
@@ -398,7 +398,7 @@ async function generateReport(results, options) {
398
398
  */
399
399
  async function checkCompliance(options) {
400
400
  const startTime = Date.now();
401
-
401
+
402
402
  try {
403
403
  // Initialize validators
404
404
  const validators = {
@@ -408,11 +408,11 @@ async function checkCompliance(options) {
408
408
  criticalThreshold: options.criticalThreshold
409
409
  })
410
410
  };
411
-
411
+
412
412
  if (options.enableConstitutional) {
413
413
  validators.constitution = new ConstitutionValidator();
414
414
  }
415
-
415
+
416
416
  // Get files to validate
417
417
  colorLog('cyan', `🔍 Scanning ${options.path || 'current directory'} for files...`);
418
418
  const files = await getAllFiles(options.path || process.cwd(), {
@@ -420,35 +420,35 @@ async function checkCompliance(options) {
420
420
  excludedPaths: options.excludedPaths,
421
421
  quiet: options.quiet
422
422
  });
423
-
423
+
424
424
  if (files.length === 0) {
425
425
  colorLog('yellow', '⚠️ No files found to validate');
426
426
  return;
427
427
  }
428
-
428
+
429
429
  colorLog('cyan', `📁 Found ${files.length} files to validate`);
430
-
430
+
431
431
  // Validate files
432
432
  const { results, duration } = await validateFiles(files, validators, options);
433
-
433
+
434
434
  // Print results
435
435
  const summary = printSummary(results, duration, options);
436
-
436
+
437
437
  if (options.violations || options.verbose) {
438
438
  printViolations(results, options);
439
439
  }
440
-
440
+
441
441
  if (options.warnings || options.verbose) {
442
442
  printWarnings(results, options);
443
443
  }
444
-
444
+
445
445
  if (options.top) {
446
446
  printTopFiles(results, options);
447
447
  }
448
-
448
+
449
449
  // Generate report if requested
450
450
  await generateReport(results, options);
451
-
451
+
452
452
  // Exit with appropriate code
453
453
  if (summary.violationFiles > 0) {
454
454
  if (!options.quiet) {
@@ -466,7 +466,7 @@ async function checkCompliance(options) {
466
466
  }
467
467
  process.exit(0);
468
468
  }
469
-
469
+
470
470
  } catch (error) {
471
471
  colorLog('red', `❌ Compliance check failed: ${error.message}`);
472
472
  if (options.verbose) {
@@ -484,7 +484,7 @@ function setupProgram() {
484
484
  .name('check-compliance')
485
485
  .description('Check file size compliance and constitutional adherence')
486
486
  .version('1.0.0');
487
-
487
+
488
488
  program
489
489
  .argument('[path]', 'Path to check (default: current directory)')
490
490
  .option('-m, --max-file-size <number>', 'Maximum file size in lines', String(DEFAULT_CONFIG.maxFileSize))
@@ -511,10 +511,10 @@ function setupProgram() {
511
511
  options.fileTypes = options.fileTypes.split(',').map(t => t.trim());
512
512
  options.excludedPaths = options.exclude.split(',').map(p => p.trim());
513
513
  options.top = parseInt(options.top);
514
-
514
+
515
515
  await checkCompliance(options);
516
516
  });
517
-
517
+
518
518
  program.parse();
519
519
  }
520
520