vibecodingmachine-core 2026.2.26-1739 → 2026.3.9-850

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 (192) hide show
  1. package/package.json +1 -1
  2. package/src/agents/AgentCheckDiscoveryService.js +180 -0
  3. package/src/agents/AgentCheckService.js +18 -261
  4. package/src/agents/AgentCheckStatisticsService.js +195 -0
  5. package/src/agents/EnvironmentConfigurationManager.js +31 -380
  6. package/src/agents/InstallationType.js +19 -6
  7. package/src/agents/SimpleAgentCheckService.js +472 -0
  8. package/src/agents/config-managers/ConfigUtils.js +72 -0
  9. package/src/agents/config-managers/DefaultConfig.js +58 -0
  10. package/src/agents/config-managers/EnvVarLoader.js +66 -0
  11. package/src/agents/config-managers/FileConfigLoader.js +124 -0
  12. package/src/agents/config-managers/TypeConverters.js +61 -0
  13. package/src/agents/config-managers/VariableMappings.js +92 -0
  14. package/src/agents/discovery/AgentDiscoveryService-refactored.js +272 -0
  15. package/src/agents/discovery/AgentDiscoveryService.js +29 -403
  16. package/src/agents/discovery/agent-validator.js +262 -0
  17. package/src/agents/discovery/discovery-results.js +176 -0
  18. package/src/agents/discovery/discovery-scanner.js +268 -0
  19. package/src/agents/discovery/discovery-utils.js +161 -0
  20. package/src/agents/discovery/executable-analyzer.js +290 -0
  21. package/src/agents/discovery/history-manager.js +310 -0
  22. package/src/agents/verification/ResultAnalyzer-refactored.js +341 -0
  23. package/src/agents/verification/ResultAnalyzer.js +30 -431
  24. package/src/agents/verification/analysis-utils.js +310 -0
  25. package/src/agents/verification/batch-analyzer.js +440 -0
  26. package/src/agents/verification/pattern-recognizer.js +369 -0
  27. package/src/agents/verification/report-generator.js +320 -0
  28. package/src/agents/verification/test-analyzer.js +290 -0
  29. package/src/agents/windows/InstallerFactory.js +4 -0
  30. package/src/agents/windows/VSCodeExtensionInstaller.js +404 -0
  31. package/src/analysis/analysis-engine.js +314 -0
  32. package/src/analysis/ast-analyzer.js +342 -0
  33. package/src/analysis/boundary-detector-refactored.js +378 -0
  34. package/src/analysis/boundary-detector.js +200 -603
  35. package/src/analysis/boundary-scanner.js +609 -0
  36. package/src/analysis/boundary-types.js +118 -0
  37. package/src/analysis/boundary-utils.js +293 -0
  38. package/src/analysis/deadline-priority-calculator.js +18 -0
  39. package/src/analysis/detection-methods.js +347 -0
  40. package/src/analysis/importance-priority-calculator.js +18 -0
  41. package/src/analysis/priority/factor-calculators.js +204 -0
  42. package/src/analysis/priority/factor-helpers.js +71 -0
  43. package/src/analysis/priority/priority-constants.js +73 -0
  44. package/src/analysis/priority/priority-factor-calculators.js +301 -0
  45. package/src/analysis/priority/reasons-generator.js +44 -0
  46. package/src/analysis/priority-calculator.js +15 -580
  47. package/src/analysis/strategy-generator.js +16 -66
  48. package/src/analysis/type-priority-calculator.js +18 -0
  49. package/src/analysis/urgency-priority-calculator.js +18 -0
  50. package/src/auto-mode/AutoModeBusinessLogic.js +2 -40
  51. package/src/commands/disable-requirement.js +60 -0
  52. package/src/commands/disable-spec.js +60 -0
  53. package/src/commands/enable-requirement.js +60 -0
  54. package/src/commands/enable-spec.js +60 -0
  55. package/src/commands/registry.js +1 -6
  56. package/src/commands/requirements.js +8 -2
  57. package/src/ide-integration/applescript-manager.cjs +9 -24
  58. package/src/ide-integration/cdp-handlers/chat-reader.js +44 -0
  59. package/src/ide-integration/cdp-handlers/connection-handler.js +88 -0
  60. package/src/ide-integration/cdp-handlers/continuation-handler.js +314 -0
  61. package/src/ide-integration/cdp-handlers/message-submitter.js +75 -0
  62. package/src/ide-integration/cdp-handlers/text-sender.js +138 -0
  63. package/src/ide-integration/cdp-manager.js +28 -573
  64. package/src/ide-integration/claude-code-cli-manager.cjs +48 -12
  65. package/src/ide-integration/ide-openers/claude-opener.js +171 -0
  66. package/src/ide-integration/ide-openers/cursor-opener.js +53 -0
  67. package/src/ide-integration/ide-openers/other-ides-opener.js +230 -0
  68. package/src/ide-integration/ide-openers/vscode-opener.js +147 -0
  69. package/src/ide-integration/macos-ide-manager.js +20 -582
  70. package/src/ide-integration/macos-quota-checker.js +164 -0
  71. package/src/ide-integration/macos-text-sender.js +19 -38
  72. package/src/ide-integration/provider-manager.cjs +52 -7
  73. package/src/index.cjs +6 -0
  74. package/src/index.js +10 -0
  75. package/src/llm/direct-llm-manager.cjs +501 -0
  76. package/src/localization/translations/en-part1.js +363 -0
  77. package/src/localization/translations/en-part2.js +320 -0
  78. package/src/localization/translations/en.js +4 -687
  79. package/src/localization/translations/es-part1.js +363 -0
  80. package/src/localization/translations/es-part2.js +320 -0
  81. package/src/localization/translations/es.js +4 -688
  82. package/src/models/file-analysis-collection.js +139 -0
  83. package/src/models/file-analysis-metrics.js +50 -0
  84. package/src/models/file-analysis.js +15 -262
  85. package/src/models/plan-manager.js +410 -0
  86. package/src/models/refactoring-models.js +380 -0
  87. package/src/models/refactoring-plan-refactored.js +81 -0
  88. package/src/models/refactoring-plan.js +2 -663
  89. package/src/monitoring/alert-system.js +4 -45
  90. package/src/monitoring/continuous-scan-notifications.js +37 -191
  91. package/src/monitoring/notification-handlers/base-handler.js +58 -0
  92. package/src/monitoring/notification-handlers/error-handler.js +36 -0
  93. package/src/monitoring/notification-handlers/index.js +21 -0
  94. package/src/monitoring/notification-handlers/new-violation-handler.js +91 -0
  95. package/src/monitoring/notification-handlers/progress-handler.js +48 -0
  96. package/src/monitoring/notification-handlers/resolved-violation-handler.js +54 -0
  97. package/src/monitoring/notification-handlers/threshold-handler.js +36 -0
  98. package/src/provider-registry.js +8 -0
  99. package/src/refactoring/boundary/boundary-detector-refactored.js +58 -0
  100. package/src/refactoring/boundary/boundary-detector.js +26 -596
  101. package/src/refactoring/boundary/detectors/boundary-analyzers.js +281 -0
  102. package/src/refactoring/boundary/detectors/boundary-core.js +167 -0
  103. package/src/refactoring/boundary/detectors/class-detector.js +247 -0
  104. package/src/refactoring/boundary/detectors/config-detector.js +270 -0
  105. package/src/refactoring/boundary/detectors/constant-detector.js +269 -0
  106. package/src/refactoring/boundary/detectors/function-detector.js +248 -0
  107. package/src/refactoring/boundary/detectors/module-detector.js +249 -0
  108. package/src/refactoring/boundary/detectors/object-detector.js +247 -0
  109. package/src/refactoring/boundary/detectors/type-detectors.js +338 -0
  110. package/src/refactoring/boundary/detectors/utility-detector.js +270 -0
  111. package/src/refactoring/circular-dependency-resolver-original.js +16 -76
  112. package/src/refactoring/code-mover-refactored.js +309 -0
  113. package/src/refactoring/code-mover.js +48 -355
  114. package/src/refactoring/execution-status.js +18 -0
  115. package/src/refactoring/execution-strategies.js +172 -0
  116. package/src/refactoring/file-splitter-core.js +568 -0
  117. package/src/refactoring/file-splitter-types.js +136 -0
  118. package/src/refactoring/file-splitter.js +2 -682
  119. package/src/refactoring/functionality-validator.js +11 -51
  120. package/src/refactoring/import-manager-refactored.js +385 -0
  121. package/src/refactoring/import-manager.js +112 -487
  122. package/src/refactoring/import-models.js +189 -0
  123. package/src/refactoring/import-parser.js +306 -0
  124. package/src/refactoring/move-executor.js +431 -0
  125. package/src/refactoring/move-utils.js +368 -0
  126. package/src/refactoring/operation-executor.js +76 -0
  127. package/src/refactoring/plan-creator.js +36 -0
  128. package/src/refactoring/plan-executor.js +143 -0
  129. package/src/refactoring/plan-validator.js +68 -0
  130. package/src/refactoring/refactoring-executor-result.js +70 -0
  131. package/src/refactoring/refactoring-executor.js +34 -569
  132. package/src/refactoring/refactoring-operation.js +94 -0
  133. package/src/refactoring/refactoring-plan.js +69 -0
  134. package/src/refactoring/refactoring-rollback.js +22 -527
  135. package/src/refactoring/rollback-handlers/RollbackExecutor.js +107 -0
  136. package/src/refactoring/rollback-handlers/RollbackManager.js +265 -0
  137. package/src/refactoring/rollback-handlers/RollbackOperation.js +105 -0
  138. package/src/refactoring/rollback-handlers/RollbackResult.js +109 -0
  139. package/src/refactoring/rollback-handlers/RollbackStatistics.js +77 -0
  140. package/src/refactoring/test-validator.js +32 -448
  141. package/src/refactoring/validation/baseline-runner.js +71 -0
  142. package/src/refactoring/validation/report-generator.js +136 -0
  143. package/src/refactoring/validation/result-comparator.js +92 -0
  144. package/src/refactoring/validation/test-suite.js +59 -0
  145. package/src/refactoring/validation/test-validation-result.js +83 -0
  146. package/src/refactoring/validation/validation-runner.js +95 -0
  147. package/src/refactoring/validation/validation-status.js +18 -0
  148. package/src/rui/commands/AgentCommandParser.js +60 -369
  149. package/src/rui/commands/AgentResponseFormatter.js +7 -47
  150. package/src/rui/commands/parsers/CommandMapper.js +148 -0
  151. package/src/rui/commands/parsers/CommandValidator.js +228 -0
  152. package/src/rui/commands/parsers/ComponentExtractor.js +100 -0
  153. package/src/rui/commands/parsers/TokenParser.js +69 -0
  154. package/src/rui/commands/parsers/tokenizer.js +153 -0
  155. package/src/utils/current-requirement-operations.js +50 -1
  156. package/src/utils/report-generator.js +18 -514
  157. package/src/utils/report-generators/analysis-generator.js +115 -0
  158. package/src/utils/report-generators/base-generator.js +141 -0
  159. package/src/utils/report-generators/compliance-generator.js +41 -0
  160. package/src/utils/report-generators/format-handlers.js +185 -0
  161. package/src/utils/report-generators/refactoring-generator.js +46 -0
  162. package/src/utils/report-generators/validation-generator.js +63 -0
  163. package/src/utils/requirement-enable-disable.js +265 -0
  164. package/src/utils/requirement-helpers/requirement-file-ops.js +69 -1
  165. package/src/utils/requirement-helpers/requirement-mover.js +88 -1
  166. package/src/utils/requirement-helpers.js +5 -2
  167. package/src/utils/smoke-test-cli.js +45 -8
  168. package/src/utils/specification-enable-disable.js +122 -0
  169. package/src/utils/specification-helpers.js +30 -4
  170. package/src/utils/specification-migration.js +5 -5
  171. package/src/utils/test-comparator.js +118 -0
  172. package/src/utils/test-config.js +54 -0
  173. package/src/utils/test-executor.js +133 -0
  174. package/src/utils/test-parser.js +215 -0
  175. package/src/utils/test-runner-baseline.js +63 -0
  176. package/src/utils/test-runner-core.js +98 -0
  177. package/src/utils/test-runner-report.js +39 -0
  178. package/src/utils/test-runner-validation.js +71 -0
  179. package/src/utils/test-runner.js +11 -535
  180. package/src/validation/comparison-analyzer.js +333 -0
  181. package/src/validation/compliance-reporter-new.js +282 -0
  182. package/src/validation/compliance-reporter-refactored.js +344 -0
  183. package/src/validation/compliance-reporter.js +278 -591
  184. package/src/validation/compliance-utils.js +278 -0
  185. package/src/validation/html-generator.js +446 -0
  186. package/src/validation/metrics/category-calculator.js +137 -0
  187. package/src/validation/metrics/metrics-helpers.js +155 -0
  188. package/src/validation/metrics/overview-calculator.js +85 -0
  189. package/src/validation/metrics/overview-metrics.js +41 -0
  190. package/src/validation/metrics/quality-calculator.js +166 -0
  191. package/src/validation/metrics/size-calculator.js +69 -0
  192. package/src/validation/metrics-calculator.js +27 -551
@@ -8,30 +8,13 @@
8
8
  const path = require('path');
9
9
  const RefactoringConfig = require('../config/refactoring-config');
10
10
 
11
- /**
12
- * Strategy types
13
- */
14
11
  const STRATEGY_TYPES = {
15
- SPLIT_FILE: 'split_file',
16
- EXTRACT_FUNCTIONS: 'extract_functions',
17
- EXTRACT_CLASSES: 'extract_classes',
18
- EXTRACT_UTILITIES: 'extract_utilities',
19
- EXTRACT_CONSTANTS: 'extract_constants',
20
- REORGANIZE_IMPORTS: 'reorganize_imports',
21
- MERGE_SMALL_FILES: 'merge_small_files',
22
- RESTRUCTURE_DIRECTORIES: 'restructure_directories',
23
- OPTIMIZE_DEPENDENCIES: 'optimize_dependencies'
12
+ SPLIT_FILE: 'split_file', EXTRACT_FUNCTIONS: 'extract_functions', EXTRACT_CLASSES: 'extract_classes',
13
+ EXTRACT_UTILITIES: 'extract_utilities', EXTRACT_CONSTANTS: 'extract_constants', REORGANIZE_IMPORTS: 'reorganize_imports',
14
+ MERGE_SMALL_FILES: 'merge_small_files', RESTRUCTURE_DIRECTORIES: 'restructure_directories', OPTIMIZE_DEPENDENCIES: 'optimize_dependencies'
24
15
  };
25
16
 
26
- /**
27
- * Priority levels
28
- */
29
- const PRIORITY_LEVELS = {
30
- CRITICAL: 'critical',
31
- HIGH: 'high',
32
- MEDIUM: 'medium',
33
- LOW: 'low'
34
- };
17
+ const PRIORITY_LEVELS = { CRITICAL: 'critical', HIGH: 'high', MEDIUM: 'medium', LOW: 'low' };
35
18
 
36
19
  /**
37
20
  * Refactoring strategy class
@@ -58,29 +41,12 @@ class RefactoringStrategy {
58
41
  };
59
42
  }
60
43
 
61
- generateId() {
62
- return `strategy_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
63
- }
64
-
65
- addStep(step) {
66
- this.steps.push(step);
67
- }
68
-
69
- addDependency(dependency) {
70
- this.dependencies.push(dependency);
71
- }
72
-
73
- setEstimatedEffort(effort) {
74
- this.estimatedEffort = effort;
75
- }
76
-
77
- setRiskLevel(risk) {
78
- this.riskLevel = risk;
79
- }
80
-
81
- setImpact(impact) {
82
- this.impact = { ...this.impact, ...impact };
83
- }
44
+ generateId() { return `strategy_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; }
45
+ addStep(step) { this.steps.push(step); }
46
+ addDependency(dependency) { this.dependencies.push(dependency); }
47
+ setEstimatedEffort(effort) { this.estimatedEffort = effort; }
48
+ setRiskLevel(risk) { this.riskLevel = risk; }
49
+ setImpact(impact) { this.impact = { ...this.impact, ...impact }; }
84
50
  }
85
51
 
86
52
  /**
@@ -677,10 +643,9 @@ class StrategyGenerator {
677
643
  * Estimate effort for file splitting
678
644
  */
679
645
  estimateSplitEffort(fileAnalysis, splitPoints) {
680
- const baseEffort = 5; // Base effort for any split
681
- const splitEffort = splitPoints.length * 2; // 2 effort per split point
682
- const sizeEffort = Math.ceil(fileAnalysis.lineCount / 100); // 1 effort per 100 lines
683
-
646
+ const baseEffort = 5;
647
+ const splitEffort = splitPoints.length * 2;
648
+ const sizeEffort = Math.ceil(fileAnalysis.lineCount / 100);
684
649
  return baseEffort + splitEffort + sizeEffort;
685
650
  }
686
651
 
@@ -689,20 +654,16 @@ class StrategyGenerator {
689
654
  */
690
655
  assessSplitRisk(fileAnalysis) {
691
656
  let risk = 'medium';
692
-
693
657
  if (fileAnalysis.lineCount > 1000) {
694
658
  risk = 'high';
695
659
  } else if (fileAnalysis.lineCount < 300) {
696
660
  risk = 'low';
697
661
  }
698
-
699
- // Consider complexity
700
662
  if (fileAnalysis.categorization && fileAnalysis.categorization.complexity === 'VERY_COMPLEX') {
701
663
  risk = 'high';
702
664
  } else if (fileAnalysis.categorization && fileAnalysis.categorization.complexity === 'SIMPLE') {
703
665
  risk = 'low';
704
666
  }
705
-
706
667
  return risk;
707
668
  }
708
669
 
@@ -724,18 +685,15 @@ class StrategyGenerator {
724
685
  */
725
686
  groupSmallFiles(smallFiles) {
726
687
  const groups = {};
727
-
728
688
  for (const file of smallFiles) {
729
689
  const pkg = this.extractPackage(file.path);
730
690
  const type = this.extractFileType(file.path);
731
691
  const key = `${pkg}/${type}`;
732
-
733
692
  if (!groups[key]) {
734
693
  groups[key] = [];
735
694
  }
736
695
  groups[key].push(file);
737
696
  }
738
-
739
697
  return groups;
740
698
  }
741
699
 
@@ -756,20 +714,12 @@ class StrategyGenerator {
756
714
  basename.includes('util') ? 'utility' : 'main';
757
715
  }
758
716
 
759
- /**
760
- * Prioritize strategies
761
- */
762
717
  prioritizeStrategies() {
763
718
  const priorityOrder = {
764
- [PRIORITY_LEVELS.CRITICAL]: 0,
765
- [PRIORITY_LEVELS.HIGH]: 1,
766
- [PRIORITY_LEVELS.MEDIUM]: 2,
767
- [PRIORITY_LEVELS.LOW]: 3
719
+ [PRIORITY_LEVELS.CRITICAL]: 0, [PRIORITY_LEVELS.HIGH]: 1,
720
+ [PRIORITY_LEVELS.MEDIUM]: 2, [PRIORITY_LEVELS.LOW]: 3
768
721
  };
769
-
770
- this.strategies.sort((a, b) => {
771
- return priorityOrder[a.priority] - priorityOrder[b.priority];
772
- });
722
+ this.strategies.sort((a, b) => priorityOrder[a.priority] - priorityOrder[b.priority]);
773
723
  }
774
724
 
775
725
  /**
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Type Priority Calculator
3
+ */
4
+
5
+ function calculateTypePriority(data) {
6
+ // Calculate type priority
7
+ const typePriority = 0;
8
+ if (data.type === 'high') {
9
+ typePriority += 10;
10
+ } else if (data.type === 'medium') {
11
+ typePriority += 5;
12
+ } else {
13
+ typePriority += 1;
14
+ }
15
+ return typePriority;
16
+ }
17
+
18
+ export { calculateTypePriority };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Urgency Priority Calculator
3
+ */
4
+
5
+ function calculateUrgencyPriority(data) {
6
+ // Calculate urgency priority
7
+ const urgencyPriority = 0;
8
+ if (data.urgency === 'high') {
9
+ urgencyPriority += 20;
10
+ } else if (data.urgency === 'medium') {
11
+ urgencyPriority += 10;
12
+ } else {
13
+ urgencyPriority += 2;
14
+ }
15
+ return urgencyPriority;
16
+ }
17
+
18
+ export { calculateUrgencyPriority };
@@ -70,8 +70,6 @@ class AutoModeBusinessLogic {
70
70
  */
71
71
  getAvailableProviders(savedConfig) {
72
72
  const providers = [];
73
-
74
- // Check for Groq (current primary)
75
73
  const groqApiKey = process.env.GROQ_API_KEY || savedConfig.groqApiKey;
76
74
  if (groqApiKey && groqApiKey.trim()) {
77
75
  providers.push({
@@ -80,8 +78,6 @@ class AutoModeBusinessLogic {
80
78
  apiKey: groqApiKey
81
79
  });
82
80
  }
83
-
84
- // Check for Anthropic (Claude)
85
81
  const anthropicApiKey = process.env.ANTHROPIC_API_KEY || savedConfig.anthropicApiKey;
86
82
  if (anthropicApiKey && anthropicApiKey.trim()) {
87
83
  providers.push({
@@ -90,8 +86,6 @@ class AutoModeBusinessLogic {
90
86
  apiKey: anthropicApiKey
91
87
  });
92
88
  }
93
-
94
- // Check for OpenAI
95
89
  const openaiApiKey = process.env.OPENAI_API_KEY || savedConfig.openaiApiKey;
96
90
  if (openaiApiKey && openaiApiKey.trim()) {
97
91
  providers.push({
@@ -100,13 +94,10 @@ class AutoModeBusinessLogic {
100
94
  apiKey: openaiApiKey
101
95
  });
102
96
  }
103
-
104
- // Always add Ollama as fallback (local, no API key needed)
105
97
  providers.push({
106
98
  provider: 'ollama',
107
99
  model: 'qwen2.5-coder:32b'
108
100
  });
109
-
110
101
  return providers;
111
102
  }
112
103
 
@@ -119,11 +110,9 @@ class AutoModeBusinessLogic {
119
110
  try {
120
111
  const { getRequirementsPath } = require('../index');
121
112
  const reqPath = await getRequirementsPath(repoPath);
122
-
123
113
  if (!reqPath || !await fs.pathExists(reqPath)) {
124
114
  return { isDone: false, actuallyComplete: false };
125
115
  }
126
-
127
116
  const content = await fs.readFile(reqPath, 'utf8');
128
117
  const lines = content.split('\n');
129
118
 
@@ -236,30 +225,21 @@ class AutoModeBusinessLogic {
236
225
  updatedLines.push(line);
237
226
  continue;
238
227
  }
239
-
240
- // Find not yet completed section
241
228
  if (line.includes('## ⏳ Requirements not yet completed')) {
242
229
  inNotYetCompleted = true;
243
230
  inVerifiedSection = false;
244
231
  updatedLines.push(line);
245
232
  continue;
246
233
  }
247
-
248
- // Check if we're in verified section and this is requirement to move
249
234
  if (inVerifiedSection && trimmed.startsWith('- ')) {
250
235
  const lineRequirement = line.substring(2).trim();
251
- // Remove date prefix if present (format: "2025-11-05: **requirement**")
252
236
  const cleanRequirement = lineRequirement.replace(/^\d{4}-\d{2}-\d{2}:\s*\*\*/, '').replace(/\*\*$/, '').trim();
253
237
  const cleanRequirementText = requirementText.replace(/\*\*/g, '').trim();
254
-
255
238
  if (lineRequirement.includes(requirementText) || cleanRequirement === cleanRequirementText) {
256
- // Skip this line (don't add it to updatedLines)
257
239
  requirementFound = true;
258
240
  continue;
259
241
  }
260
242
  }
261
-
262
- // If we're in not yet completed section and haven't added requirement yet, add it at the top
263
243
  if (inNotYetCompleted && !requirementFound && trimmed.startsWith('- ')) {
264
244
  // Add the requirement before the first existing requirement
265
245
  const newUpdatedLines = lines.slice(0, i);
@@ -269,17 +249,12 @@ class AutoModeBusinessLogic {
269
249
  await fs.writeFile(reqPath, newUpdatedLines.join('\n'));
270
250
  return { success: true };
271
251
  }
272
-
273
- // Reset section flags when hitting new sections
274
252
  if (trimmed.startsWith('##')) {
275
253
  inVerifiedSection = false;
276
254
  inNotYetCompleted = false;
277
255
  }
278
-
279
256
  updatedLines.push(line);
280
257
  }
281
-
282
- // If requirement wasn't found in verified section, try to add it to not yet completed anyway
283
258
  if (!requirementFound) {
284
259
  // Find the not yet completed section and add requirement at the top
285
260
  const newUpdatedLines = lines.slice();
@@ -797,21 +772,8 @@ class AutoModeBusinessLogic {
797
772
  }
798
773
  }
799
774
 
800
- /**
801
- * Update auto mode state
802
- * @param {Object} newState - New state to merge
803
- */
804
- updateState(newState) {
805
- Object.assign(this.state, newState);
806
- }
807
-
808
- /**
809
- * Get current auto mode state
810
- * @returns {Object} Current state
811
- */
812
- getState() {
813
- return { ...this.state };
814
- }
775
+ updateState(newState) { Object.assign(this.state, newState); }
776
+ getState() { return { ...this.state }; }
815
777
 
816
778
  /**
817
779
  * Reset auto mode state
@@ -0,0 +1,60 @@
1
+ const RUICommand = require('./base');
2
+ const { disableRequirement } = require('../utils/requirement-enable-disable');
3
+
4
+ /**
5
+ * RUI Command: Disable Requirement
6
+ * Implements requirement disable action following RUI pattern
7
+ */
8
+
9
+ class DisableRequirementCommand extends RUICommand {
10
+ constructor() {
11
+ super({
12
+ verb: 'PUT',
13
+ resource: 'requirements',
14
+ description: 'Disable a specific requirement',
15
+ shortcuts: ['rd', 'disable req', 'put req disable'],
16
+ synonyms: ['disable', 'deactivate'],
17
+ parameters: [
18
+ {
19
+ name: 'requirementText',
20
+ type: 'string',
21
+ required: true,
22
+ description: 'Exact text of the requirement to disable'
23
+ }
24
+ ],
25
+ examples: [
26
+ 'app disable requirement "Add user authentication"',
27
+ 'app rd "Add user authentication"',
28
+ 'app put requirements "Add user authentication" --status disabled'
29
+ ]
30
+ });
31
+ }
32
+
33
+ async execute(params = {}) {
34
+ // Validate required parameters
35
+ if (!params.requirementText) {
36
+ throw new Error('Required parameter missing: requirementText');
37
+ }
38
+
39
+ // Call the core disable function
40
+ const result = await disableRequirement(params.requirementText);
41
+
42
+ if (!result.success) {
43
+ throw new Error(result.message);
44
+ }
45
+
46
+ return {
47
+ success: true,
48
+ data: {
49
+ requirement: {
50
+ text: params.requirementText,
51
+ status: 'disabled',
52
+ disabledAt: new Date().toISOString()
53
+ }
54
+ },
55
+ message: result.message
56
+ };
57
+ }
58
+ }
59
+
60
+ module.exports = DisableRequirementCommand;
@@ -0,0 +1,60 @@
1
+ const RUICommand = require('./base');
2
+ const { disableSpec } = require('../utils/specification-enable-disable');
3
+
4
+ /**
5
+ * RUI Command: Disable Spec
6
+ * Implements spec disable action following RUI pattern
7
+ */
8
+
9
+ class DisableSpecCommand extends RUICommand {
10
+ constructor() {
11
+ super({
12
+ verb: 'PUT',
13
+ resource: 'specs',
14
+ description: 'Disable a specific specification',
15
+ shortcuts: ['sd', 'disable sp', 'put sp disable'],
16
+ synonyms: ['disable', 'deactivate'],
17
+ parameters: [
18
+ {
19
+ name: 'specId',
20
+ type: 'string',
21
+ required: true,
22
+ description: 'ID of the specification to disable (e.g., "001-agent-defaults")'
23
+ }
24
+ ],
25
+ examples: [
26
+ 'app disable spec 001-agent-defaults',
27
+ 'app sd 001-agent-defaults',
28
+ 'app put specs 001-agent-defaults --status disabled'
29
+ ]
30
+ });
31
+ }
32
+
33
+ async execute(params = {}) {
34
+ // Validate required parameters
35
+ if (!params.specId) {
36
+ throw new Error('Required parameter missing: specId');
37
+ }
38
+
39
+ // Call the core disable function
40
+ const result = await disableSpec(params.specId);
41
+
42
+ if (!result.success) {
43
+ throw new Error(result.message);
44
+ }
45
+
46
+ return {
47
+ success: true,
48
+ data: {
49
+ spec: {
50
+ id: params.specId,
51
+ status: 'disabled',
52
+ disabledAt: new Date().toISOString()
53
+ }
54
+ },
55
+ message: result.message
56
+ };
57
+ }
58
+ }
59
+
60
+ module.exports = DisableSpecCommand;
@@ -0,0 +1,60 @@
1
+ const RUICommand = require('./base');
2
+ const { enableRequirement } = require('../utils/requirement-enable-disable');
3
+
4
+ /**
5
+ * RUI Command: Enable Requirement
6
+ * Implements requirement enable action following RUI pattern
7
+ */
8
+
9
+ class EnableRequirementCommand extends RUICommand {
10
+ constructor() {
11
+ super({
12
+ verb: 'PUT',
13
+ resource: 'requirements',
14
+ description: 'Enable a specific requirement',
15
+ shortcuts: ['re', 'enable req', 'put req enable'],
16
+ synonyms: ['enable', 'activate'],
17
+ parameters: [
18
+ {
19
+ name: 'requirementText',
20
+ type: 'string',
21
+ required: true,
22
+ description: 'Exact text of the requirement to enable'
23
+ }
24
+ ],
25
+ examples: [
26
+ 'app enable requirement "Add user authentication"',
27
+ 'app re "Add user authentication"',
28
+ 'app put requirements "Add user authentication" --status enabled'
29
+ ]
30
+ });
31
+ }
32
+
33
+ async execute(params = {}) {
34
+ // Validate required parameters
35
+ if (!params.requirementText) {
36
+ throw new Error('Required parameter missing: requirementText');
37
+ }
38
+
39
+ // Call the core enable function
40
+ const result = await enableRequirement(params.requirementText);
41
+
42
+ if (!result.success) {
43
+ throw new Error(result.message);
44
+ }
45
+
46
+ return {
47
+ success: true,
48
+ data: {
49
+ requirement: {
50
+ text: params.requirementText,
51
+ status: 'enabled',
52
+ enabledAt: new Date().toISOString()
53
+ }
54
+ },
55
+ message: result.message
56
+ };
57
+ }
58
+ }
59
+
60
+ module.exports = EnableRequirementCommand;
@@ -0,0 +1,60 @@
1
+ const RUICommand = require('./base');
2
+ const { enableSpec } = require('../utils/specification-enable-disable');
3
+
4
+ /**
5
+ * RUI Command: Enable Spec
6
+ * Implements spec enable action following RUI pattern
7
+ */
8
+
9
+ class EnableSpecCommand extends RUICommand {
10
+ constructor() {
11
+ super({
12
+ verb: 'PUT',
13
+ resource: 'specs',
14
+ description: 'Enable a specific specification',
15
+ shortcuts: ['se', 'enable sp', 'put sp enable'],
16
+ synonyms: ['enable', 'activate'],
17
+ parameters: [
18
+ {
19
+ name: 'specId',
20
+ type: 'string',
21
+ required: true,
22
+ description: 'ID of the specification to enable (e.g., "001-agent-defaults")'
23
+ }
24
+ ],
25
+ examples: [
26
+ 'app enable spec 001-agent-defaults',
27
+ 'app se 001-agent-defaults',
28
+ 'app put specs 001-agent-defaults --status enabled'
29
+ ]
30
+ });
31
+ }
32
+
33
+ async execute(params = {}) {
34
+ // Validate required parameters
35
+ if (!params.specId) {
36
+ throw new Error('Required parameter missing: specId');
37
+ }
38
+
39
+ // Call the core enable function
40
+ const result = await enableSpec(params.specId);
41
+
42
+ if (!result.success) {
43
+ throw new Error(result.message);
44
+ }
45
+
46
+ return {
47
+ success: true,
48
+ data: {
49
+ spec: {
50
+ id: params.specId,
51
+ status: 'enabled',
52
+ enabledAt: new Date().toISOString()
53
+ }
54
+ },
55
+ message: result.message || `Specification ${params.specId} enabled successfully`
56
+ };
57
+ }
58
+ }
59
+
60
+ module.exports = EnableSpecCommand;
@@ -24,12 +24,7 @@ class RUICommandRegistry {
24
24
  // Validate command structure
25
25
  this.validateCommand(command);
26
26
 
27
- this.commands.set(key, {
28
- ...command,
29
- shortcuts: command.shortcuts || [],
30
- synonyms: command.synonyms || [],
31
- registeredAt: new Date()
32
- });
27
+ this.commands.set(key, command);
33
28
  }
34
29
 
35
30
  /**
@@ -16,7 +16,7 @@ class ListRequirementsCommand extends RUICommand {
16
16
  handler: async (params = {}) => {
17
17
  // Import requirements parser to get real requirements data
18
18
  const { parseRequirementsFile } = require('../utils/requirements-parser');
19
- const { getOrCreateRequirementsFilePath } = require('../utils/requirement-helpers');
19
+ const { getRequirementsFilePath, createRequirementsFile, requirementsFileExists } = require('../utils/requirement-helpers');
20
20
  const { getTodoSpecifications } = require('../utils/specification-helpers');
21
21
  const fs = require('fs-extra');
22
22
 
@@ -24,7 +24,13 @@ class ListRequirementsCommand extends RUICommand {
24
24
 
25
25
  try {
26
26
  // Get the requirements file path
27
- const reqPath = await getOrCreateRequirementsFilePath(repoPath);
27
+ let reqPath = await getRequirementsFilePath(repoPath);
28
+
29
+ // Create file if it doesn't exist
30
+ if (!await requirementsFileExists(repoPath)) {
31
+ await createRequirementsFile(repoPath);
32
+ reqPath = await getRequirementsFilePath(repoPath);
33
+ }
28
34
 
29
35
  // Load todo specifications in parallel with requirements check
30
36
  const todoSpecifications = await getTodoSpecifications(repoPath);
@@ -1784,34 +1784,19 @@ class AppleScriptManager {
1784
1784
  key code 53
1785
1785
  delay 0.5
1786
1786
 
1787
- -- Try multiple approaches to focus Cascade chat input
1788
- -- Approach 1: Cmd+Shift+L (original)
1789
- keystroke "l" using {command down, shift down}
1790
- delay 1.0
1787
+ -- Sequential approach with proper delays for reliability
1788
+ -- Step 1: Select Windsurf and wait
1789
+ delay 3
1791
1790
 
1792
- -- Approach 2: Cmd+L (alternative)
1791
+ -- Step 2: Command+L (first attempt)
1793
1792
  keystroke "l" using {command down}
1794
- delay 1.0
1793
+ delay 3
1795
1794
 
1796
- -- Approach 3: Click on chat area
1797
- try
1798
- set textAreas to text areas of window 1
1799
- if (count of textAreas) > 0 then
1800
- click first text area
1801
- delay 0.5
1802
- end if
1803
- on error
1804
- -- Continue if click fails
1805
- end try
1795
+ -- Step 3: Command+Shift+L (second attempt)
1796
+ keystroke "l" using {command down, shift down}
1797
+ delay 3
1806
1798
 
1807
- -- Approach 4: Tab navigation to find chat input
1808
- repeat 5 times
1809
- key code 48 -- Tab key
1810
- delay 0.2
1811
- end repeat
1812
- delay 0.5
1813
-
1814
- -- Clear any auto-inserted context (e.g. @terminal:zsh)
1799
+ -- Step 4: Clear any auto-inserted context and send text
1815
1800
  keystroke "a" using {command down}
1816
1801
  delay 0.3
1817
1802
  key code 51
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Handles reading chat text from IDEs
3
+ */
4
+ export class ChatReader {
5
+ constructor(connectionHandler) {
6
+ this.connectionHandler = connectionHandler;
7
+ }
8
+
9
+ /**
10
+ * Read chat text from an IDE
11
+ * @param {string} ide - The IDE name
12
+ * @returns {Promise<string>} The chat text
13
+ */
14
+ async readChatText(ide) {
15
+ try {
16
+ const { Runtime } = await this.connectionHandler.connectToIDE(ide);
17
+
18
+ const expression = `(() => {
19
+ try {
20
+ // Look for chat messages in various possible locations
21
+ const chatMessages = document.querySelectorAll('[class*="message"], [class*="chat"], [class*="conversation"]');
22
+ const messages = [];
23
+
24
+ chatMessages.forEach(msg => {
25
+ const text = msg.textContent || msg.innerText;
26
+ if (text && text.trim()) {
27
+ messages.push(text.trim());
28
+ }
29
+ });
30
+
31
+ return messages.join('\\n\\n');
32
+ } catch (error) {
33
+ return 'Error reading chat: ' + error.message;
34
+ }
35
+ })()`;
36
+
37
+ const { result } = await Runtime.evaluate({ expression, returnByValue: true });
38
+ return result.value || '[]';
39
+ } catch (error) {
40
+ console.error(`Error reading chat from ${ide}:`, error);
41
+ return `Error: ${error.message}`;
42
+ }
43
+ }
44
+ }