ai-sdlc 0.2.0-alpha.6 → 0.2.0-alpha.60

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 (135) hide show
  1. package/README.md +53 -1058
  2. package/dist/agents/implementation.d.ts +36 -1
  3. package/dist/agents/implementation.d.ts.map +1 -1
  4. package/dist/agents/implementation.js +259 -30
  5. package/dist/agents/implementation.js.map +1 -1
  6. package/dist/agents/index.d.ts +2 -0
  7. package/dist/agents/index.d.ts.map +1 -1
  8. package/dist/agents/index.js +2 -0
  9. package/dist/agents/index.js.map +1 -1
  10. package/dist/agents/orchestrator.d.ts +61 -0
  11. package/dist/agents/orchestrator.d.ts.map +1 -0
  12. package/dist/agents/orchestrator.js +443 -0
  13. package/dist/agents/orchestrator.js.map +1 -0
  14. package/dist/agents/planning.d.ts +1 -1
  15. package/dist/agents/planning.d.ts.map +1 -1
  16. package/dist/agents/planning.js +55 -4
  17. package/dist/agents/planning.js.map +1 -1
  18. package/dist/agents/refinement.d.ts.map +1 -1
  19. package/dist/agents/refinement.js +22 -3
  20. package/dist/agents/refinement.js.map +1 -1
  21. package/dist/agents/research.d.ts +85 -1
  22. package/dist/agents/research.d.ts.map +1 -1
  23. package/dist/agents/research.js +506 -16
  24. package/dist/agents/research.js.map +1 -1
  25. package/dist/agents/review.d.ts +103 -2
  26. package/dist/agents/review.d.ts.map +1 -1
  27. package/dist/agents/review.js +777 -93
  28. package/dist/agents/review.js.map +1 -1
  29. package/dist/agents/rework.d.ts.map +1 -1
  30. package/dist/agents/rework.js +25 -4
  31. package/dist/agents/rework.js.map +1 -1
  32. package/dist/agents/single-task.d.ts +41 -0
  33. package/dist/agents/single-task.d.ts.map +1 -0
  34. package/dist/agents/single-task.js +357 -0
  35. package/dist/agents/single-task.js.map +1 -0
  36. package/dist/agents/state-assessor.d.ts +3 -3
  37. package/dist/agents/state-assessor.d.ts.map +1 -1
  38. package/dist/agents/state-assessor.js +6 -6
  39. package/dist/agents/state-assessor.js.map +1 -1
  40. package/dist/agents/test-pattern-detector.d.ts +49 -0
  41. package/dist/agents/test-pattern-detector.d.ts.map +1 -0
  42. package/dist/agents/test-pattern-detector.js +273 -0
  43. package/dist/agents/test-pattern-detector.js.map +1 -0
  44. package/dist/agents/verification.d.ts +11 -0
  45. package/dist/agents/verification.d.ts.map +1 -1
  46. package/dist/agents/verification.js +99 -12
  47. package/dist/agents/verification.js.map +1 -1
  48. package/dist/cli/commands/migrate.js +1 -1
  49. package/dist/cli/commands/migrate.js.map +1 -1
  50. package/dist/cli/commands.d.ts +66 -3
  51. package/dist/cli/commands.d.ts.map +1 -1
  52. package/dist/cli/commands.js +1548 -198
  53. package/dist/cli/commands.js.map +1 -1
  54. package/dist/cli/daemon.d.ts.map +1 -1
  55. package/dist/cli/daemon.js +25 -3
  56. package/dist/cli/daemon.js.map +1 -1
  57. package/dist/cli/runner.d.ts.map +1 -1
  58. package/dist/cli/runner.js +35 -12
  59. package/dist/cli/runner.js.map +1 -1
  60. package/dist/core/auth.d.ts +43 -0
  61. package/dist/core/auth.d.ts.map +1 -1
  62. package/dist/core/auth.js +105 -1
  63. package/dist/core/auth.js.map +1 -1
  64. package/dist/core/client.d.ts +25 -1
  65. package/dist/core/client.d.ts.map +1 -1
  66. package/dist/core/client.js +247 -7
  67. package/dist/core/client.js.map +1 -1
  68. package/dist/core/config.d.ts +32 -1
  69. package/dist/core/config.d.ts.map +1 -1
  70. package/dist/core/config.js +146 -3
  71. package/dist/core/config.js.map +1 -1
  72. package/dist/core/conflict-detector.d.ts +108 -0
  73. package/dist/core/conflict-detector.d.ts.map +1 -0
  74. package/dist/core/conflict-detector.js +413 -0
  75. package/dist/core/conflict-detector.js.map +1 -0
  76. package/dist/core/git-utils.d.ts +28 -0
  77. package/dist/core/git-utils.d.ts.map +1 -0
  78. package/dist/core/git-utils.js +146 -0
  79. package/dist/core/git-utils.js.map +1 -0
  80. package/dist/core/index.d.ts +19 -0
  81. package/dist/core/index.d.ts.map +1 -0
  82. package/dist/core/index.js +19 -0
  83. package/dist/core/index.js.map +1 -0
  84. package/dist/core/kanban.d.ts +1 -1
  85. package/dist/core/kanban.d.ts.map +1 -1
  86. package/dist/core/kanban.js +3 -3
  87. package/dist/core/kanban.js.map +1 -1
  88. package/dist/core/llm-utils.d.ts +103 -0
  89. package/dist/core/llm-utils.d.ts.map +1 -0
  90. package/dist/core/llm-utils.js +368 -0
  91. package/dist/core/llm-utils.js.map +1 -0
  92. package/dist/core/logger.d.ts +92 -0
  93. package/dist/core/logger.d.ts.map +1 -0
  94. package/dist/core/logger.js +221 -0
  95. package/dist/core/logger.js.map +1 -0
  96. package/dist/core/process-manager.d.ts +15 -0
  97. package/dist/core/process-manager.d.ts.map +1 -0
  98. package/dist/core/process-manager.js +132 -0
  99. package/dist/core/process-manager.js.map +1 -0
  100. package/dist/core/story-logger.d.ts +102 -0
  101. package/dist/core/story-logger.d.ts.map +1 -0
  102. package/dist/core/story-logger.js +265 -0
  103. package/dist/core/story-logger.js.map +1 -0
  104. package/dist/core/story.d.ts +113 -20
  105. package/dist/core/story.d.ts.map +1 -1
  106. package/dist/core/story.js +328 -40
  107. package/dist/core/story.js.map +1 -1
  108. package/dist/core/task-parser.d.ts +59 -0
  109. package/dist/core/task-parser.d.ts.map +1 -0
  110. package/dist/core/task-parser.js +235 -0
  111. package/dist/core/task-parser.js.map +1 -0
  112. package/dist/core/task-progress.d.ts +92 -0
  113. package/dist/core/task-progress.d.ts.map +1 -0
  114. package/dist/core/task-progress.js +280 -0
  115. package/dist/core/task-progress.js.map +1 -0
  116. package/dist/core/workflow-state.d.ts +45 -6
  117. package/dist/core/workflow-state.d.ts.map +1 -1
  118. package/dist/core/workflow-state.js +201 -12
  119. package/dist/core/workflow-state.js.map +1 -1
  120. package/dist/core/worktree.d.ts +186 -0
  121. package/dist/core/worktree.d.ts.map +1 -0
  122. package/dist/core/worktree.js +554 -0
  123. package/dist/core/worktree.js.map +1 -0
  124. package/dist/index.js +145 -5
  125. package/dist/index.js.map +1 -1
  126. package/dist/services/error-classifier.d.ts +119 -0
  127. package/dist/services/error-classifier.d.ts.map +1 -0
  128. package/dist/services/error-classifier.js +182 -0
  129. package/dist/services/error-classifier.js.map +1 -0
  130. package/dist/types/index.d.ts +381 -1
  131. package/dist/types/index.d.ts.map +1 -1
  132. package/dist/types/index.js +1 -0
  133. package/dist/types/index.js.map +1 -1
  134. package/package.json +5 -2
  135. package/templates/story.md +5 -0
package/dist/index.js CHANGED
@@ -1,9 +1,18 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command } from 'commander';
3
- import { init, status, add, run, details, unblock, migrate } from './cli/commands.js';
3
+ import { createRequire } from 'module';
4
+ import { init, status, add, run, details, unblock, migrate, listWorktrees, addWorktree, removeWorktree } from './cli/commands.js';
4
5
  import { hasApiKey } from './core/auth.js';
5
- import { loadConfig, saveConfig } from './core/config.js';
6
+ import { loadConfig, saveConfig, DEFAULT_LOGGING_CONFIG, getSdlcRoot } from './core/config.js';
6
7
  import { getThemedChalk } from './core/theme.js';
8
+ import { initLogger, getLogger } from './core/logger.js';
9
+ import { getLatestLogPath, readLastLines, tailLog } from './core/story-logger.js';
10
+ import { setupGlobalCleanupHandlers } from './core/process-manager.js';
11
+ import fs from 'fs';
12
+ import path from 'path';
13
+ setupGlobalCleanupHandlers();
14
+ const require = createRequire(import.meta.url);
15
+ const packageJson = require('../package.json');
7
16
  // Check for API key when running commands that need it
8
17
  function checkApiKey() {
9
18
  if (!hasApiKey()) {
@@ -24,7 +33,7 @@ const program = new Command();
24
33
  program
25
34
  .name('ai-sdlc')
26
35
  .description('Agent-first SDLC workflow manager')
27
- .version('0.1.0');
36
+ .version(packageJson.version);
28
37
  program
29
38
  .command('init')
30
39
  .description('Initialize .ai-sdlc folder structure')
@@ -35,9 +44,10 @@ program
35
44
  .option('--active', 'Hide done stories from output')
36
45
  .action((options) => status(options));
37
46
  program
38
- .command('add <title>')
47
+ .command('add [title]')
39
48
  .description('Add a new story to the backlog')
40
- .action(add);
49
+ .option('-f, --file <path>', 'Create story from file (supports .md, .txt, .markdown)')
50
+ .action((title, options) => add(title, options));
41
51
  program
42
52
  .command('details <id>')
43
53
  .alias('d')
@@ -66,10 +76,62 @@ program
66
76
  .option('--max-iterations <number>', 'Maximum retry iterations (default: infinite)')
67
77
  .option('--watch', 'Run in daemon mode, continuously processing backlog')
68
78
  .option('-v, --verbose', 'Show detailed daemon output (use with --watch)')
79
+ .option('--force', 'Skip git validation and conflict checks (use with caution)')
80
+ .option('--worktree', 'Create isolated git worktree for story execution (requires --story)')
81
+ .option('--no-worktree', 'Disable worktree even when enabled in config')
82
+ .option('--clean', 'Clean existing worktree and restart from scratch (requires --story)')
83
+ .option('--log-level <level>', 'Set log verbosity (debug, info, warn, error)', 'info')
69
84
  .action((options) => {
70
85
  if (!options.dryRun && !options.watch) {
71
86
  checkApiKey();
72
87
  }
88
+ // Initialize logger with config and CLI override
89
+ const config = loadConfig();
90
+ const logConfig = {
91
+ ...DEFAULT_LOGGING_CONFIG,
92
+ ...config.logging,
93
+ };
94
+ // CLI --log-level overrides config
95
+ if (options.logLevel) {
96
+ const validLevels = ['debug', 'info', 'warn', 'error'];
97
+ if (validLevels.includes(options.logLevel)) {
98
+ logConfig.level = options.logLevel;
99
+ }
100
+ else {
101
+ const c = getThemedChalk(config);
102
+ console.log(c.warning(`Invalid log level "${options.logLevel}", using "${logConfig.level}"`));
103
+ }
104
+ }
105
+ initLogger(process.cwd(), logConfig);
106
+ // Log startup information
107
+ const logger = getLogger();
108
+ logger.info('cli', 'ai-sdlc started', {
109
+ version: packageJson.version,
110
+ command: 'run',
111
+ options: {
112
+ auto: options.auto,
113
+ dryRun: options.dryRun,
114
+ continue: options.continue,
115
+ story: options.story,
116
+ step: options.step,
117
+ worktree: options.worktree,
118
+ clean: options.clean,
119
+ watch: options.watch,
120
+ logLevel: logConfig.level,
121
+ },
122
+ });
123
+ // Validate --worktree requires --story
124
+ if (options.worktree && !options.story) {
125
+ const c = getThemedChalk(config);
126
+ console.log(c.error('Error: --worktree requires --story flag'));
127
+ process.exit(1);
128
+ }
129
+ // Validate --clean requires --story
130
+ if (options.clean && !options.story) {
131
+ const c = getThemedChalk(config);
132
+ console.log(c.error('Error: --clean requires --story flag'));
133
+ process.exit(1);
134
+ }
73
135
  return run(options);
74
136
  });
75
137
  program
@@ -113,5 +175,83 @@ program
113
175
  console.log(c.dim('Available keys: theme'));
114
176
  }
115
177
  });
178
+ // Logs command
179
+ program
180
+ .command('logs <storyId>')
181
+ .description('View logs for a story')
182
+ .option('-t, --tail', 'Follow log output (like tail -f)')
183
+ .option('-n, --lines <n>', 'Number of lines to show', '50')
184
+ .option('-f, --file <timestamp>', 'View specific log file by timestamp (e.g., 2026-01-15T10-30-00)')
185
+ .action(async (storyId, options) => {
186
+ try {
187
+ const config = loadConfig();
188
+ const c = getThemedChalk(config);
189
+ const sdlcRoot = getSdlcRoot();
190
+ // Determine which log file to view
191
+ let logPath;
192
+ if (options.file) {
193
+ // View specific log file by timestamp
194
+ const sanitizedStoryId = storyId; // Will be sanitized by getLatestLogPath
195
+ const logDir = path.join(sdlcRoot, 'stories', sanitizedStoryId, 'logs');
196
+ logPath = path.join(logDir, `${options.file}.log`);
197
+ if (!fs.existsSync(logPath)) {
198
+ console.log(c.error(`Log file not found: ${options.file}.log`));
199
+ console.log(c.dim(` Story: ${storyId}`));
200
+ console.log(c.dim(` Expected path: ${logPath}`));
201
+ process.exit(1);
202
+ }
203
+ }
204
+ else {
205
+ // Get latest log file
206
+ logPath = getLatestLogPath(sdlcRoot, storyId);
207
+ if (!logPath) {
208
+ console.log(c.error(`No logs found for story: ${storyId}`));
209
+ console.log(c.dim(' Logs are created when running actions with `ai-sdlc run`'));
210
+ process.exit(1);
211
+ }
212
+ }
213
+ // Display logs
214
+ if (options.tail) {
215
+ // Follow mode (tail -f)
216
+ console.log(c.dim(`Following log: ${path.basename(logPath)}`));
217
+ console.log(c.dim(`Press Ctrl+C to exit\n`));
218
+ tailLog(logPath);
219
+ }
220
+ else {
221
+ // Show last N lines
222
+ const numLines = parseInt(options.lines || '50', 10);
223
+ const content = await readLastLines(logPath, numLines);
224
+ console.log(c.dim(`Log file: ${path.basename(logPath)}`));
225
+ console.log(c.dim(`Showing last ${numLines} lines\n`));
226
+ console.log(content);
227
+ }
228
+ }
229
+ catch (error) {
230
+ const config = loadConfig();
231
+ const c = getThemedChalk(config);
232
+ if (error instanceof Error && error.message.includes('Invalid story ID')) {
233
+ console.log(c.error(`Invalid story ID: ${storyId}`));
234
+ console.log(c.dim(' Story IDs cannot contain path traversal sequences or separators'));
235
+ }
236
+ else {
237
+ console.log(c.error(`Error viewing logs: ${error instanceof Error ? error.message : String(error)}`));
238
+ }
239
+ process.exit(1);
240
+ }
241
+ });
242
+ // Worktree management commands
243
+ program
244
+ .command('worktrees')
245
+ .description('List managed worktrees')
246
+ .action(listWorktrees);
247
+ program
248
+ .command('worktrees:add <story-id>')
249
+ .description('Create a worktree for a story')
250
+ .action(addWorktree);
251
+ program
252
+ .command('worktrees:remove <story-id>')
253
+ .description('Remove a worktree for a story')
254
+ .option('--force', 'Skip confirmation prompt')
255
+ .action((storyId, options) => removeWorktree(storyId, options));
116
256
  program.parse();
117
257
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjD,uDAAuD;A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KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC;YACzE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,qBAAqB,OAAO,EAAE,CAAC,CAAC,CAAC;YACrD,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,mEAAmE,CAAC,CAAC,CAAC;QAC1F,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,uBAAuB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;QACxG,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,+BAA+B;AAC/B,OAAO;KACJ,OAAO,CAAC,WAAW,CAAC;KACpB,WAAW,CAAC,wBAAwB,CAAC;KACrC,MAAM,CAAC,aAAa,CAAC,CAAC;AAEzB,OAAO;KACJ,OAAO,CAAC,0BAA0B,CAAC;KACnC,WAAW,CAAC,+BAA+B,CAAC;KAC5C,MAAM,CAAC,WAAW,CAAC,CAAC;AAEvB,OAAO;KACJ,OAAO,CAAC,6BAA6B,CAAC;KACtC,WAAW,CAAC,+BAA+B,CAAC;KAC5C,MAAM,CAAC,SAAS,EAAE,0BAA0B,CAAC;KAC7C,MAAM,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAElE,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -0,0 +1,119 @@
1
+ /**
2
+ * TypeScript Error Classification Service
3
+ *
4
+ * Classifies TypeScript compiler errors into two categories:
5
+ * - Source errors: Root causes in production code (e.g., missing type definitions)
6
+ * - Cascading errors: Downstream effects caused by source errors (e.g., test file imports failing)
7
+ *
8
+ * This enables the implementation agent to prioritize fixing root causes first,
9
+ * which often resolves multiple cascading errors automatically.
10
+ */
11
+ /**
12
+ * Structured representation of a TypeScript compiler error
13
+ */
14
+ export interface TypeScriptError {
15
+ /** The file path where the error occurred */
16
+ filePath: string;
17
+ /** The line number (1-indexed) where the error occurred */
18
+ line?: number;
19
+ /** The column number (1-indexed) where the error occurred */
20
+ column?: number;
21
+ /** The TypeScript error code (e.g., "TS2322") */
22
+ code: string;
23
+ /** The error message text */
24
+ message: string;
25
+ }
26
+ /**
27
+ * Result of classifying and sorting TypeScript errors
28
+ */
29
+ export interface ClassifiedErrors {
30
+ /** Source errors that are root causes and should be fixed first */
31
+ source: TypeScriptError[];
32
+ /** Cascading errors that may resolve automatically when source errors are fixed */
33
+ cascading: TypeScriptError[];
34
+ }
35
+ /**
36
+ * Error classification type
37
+ */
38
+ export type ErrorClassification = 'source' | 'cascading';
39
+ /**
40
+ * Parses TypeScript compiler output and extracts structured error information.
41
+ *
42
+ * Expected format: `<filePath>(<line>,<col>): error <code>: <message>`
43
+ * Example: `src/app.tsx(59,12): error TS2322: Type 'string' is not assignable to type 'number'.`
44
+ *
45
+ * @param buildOutput - Raw output from TypeScript compiler (tsc)
46
+ * @returns Array of structured TypeScript errors
47
+ *
48
+ * @example
49
+ * ```typescript
50
+ * const output = "src/app.tsx(59,12): error TS2322: Type 'string' is not assignable to type 'number'.";
51
+ * const errors = parseTypeScriptErrors(output);
52
+ * // errors[0] = { filePath: 'src/app.tsx', line: 59, column: 12, code: 'TS2322', message: '...' }
53
+ * ```
54
+ */
55
+ export declare function parseTypeScriptErrors(buildOutput: string): TypeScriptError[];
56
+ /**
57
+ * Determines if a file path points to a test file.
58
+ *
59
+ * Test files are identified by:
60
+ * - File extension: .test.ts, .test.tsx, .spec.ts, .spec.tsx, .test.js, .test.jsx, .spec.js, .spec.jsx
61
+ * - Directory patterns: tests/, __tests__/
62
+ *
63
+ * @param filePath - The file path to check
64
+ * @returns true if the file is a test file, false otherwise
65
+ */
66
+ export declare function isTestFile(filePath: string): boolean;
67
+ /**
68
+ * Determines if a file path points to a type definition file.
69
+ *
70
+ * Type definition files are identified by:
71
+ * - File extension: .d.ts
72
+ * - Directory patterns: types/, @types/
73
+ *
74
+ * @param filePath - The file path to check
75
+ * @returns true if the file is a type definition file, false otherwise
76
+ */
77
+ export declare function isTypeDefinitionFile(filePath: string): boolean;
78
+ /**
79
+ * Classifies a single TypeScript error as either a source error (root cause)
80
+ * or a cascading error (downstream effect).
81
+ *
82
+ * Classification logic:
83
+ * 1. Known cascading-only codes (TS2345) → cascading
84
+ * 2. Known source codes (TS2304, TS2339) in non-test files → source
85
+ * 3. Context-dependent codes (TS2307, TS2322) → analyze file path
86
+ * 4. Conservative default → cascading
87
+ *
88
+ * @param error - The TypeScript error to classify
89
+ * @returns 'source' if root cause, 'cascading' if downstream effect
90
+ *
91
+ * @example
92
+ * ```typescript
93
+ * const error = { code: 'TS2304', filePath: 'src/app.ts', message: 'Cannot find name Foo' };
94
+ * const classification = classifyError(error); // 'source'
95
+ * ```
96
+ */
97
+ export declare function classifyError(error: TypeScriptError): ErrorClassification;
98
+ /**
99
+ * Classifies and sorts multiple TypeScript errors into source and cascading categories.
100
+ *
101
+ * Source errors are prioritized for fixing as they may automatically resolve
102
+ * multiple cascading errors.
103
+ *
104
+ * @param errors - Array of TypeScript errors to classify
105
+ * @returns Object with separated source and cascading error arrays
106
+ *
107
+ * @example
108
+ * ```typescript
109
+ * const errors = [
110
+ * { code: 'TS2304', filePath: 'src/app.ts', message: '...' },
111
+ * { code: 'TS2307', filePath: 'tests/app.test.ts', message: '...' }
112
+ * ];
113
+ * const classified = classifyAndSortErrors(errors);
114
+ * // classified.source = [{ code: 'TS2304', ... }]
115
+ * // classified.cascading = [{ code: 'TS2307', ... }]
116
+ * ```
117
+ */
118
+ export declare function classifyAndSortErrors(errors: TypeScriptError[]): ClassifiedErrors;
119
+ //# sourceMappingURL=error-classifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-classifier.d.ts","sourceRoot":"","sources":["../../src/services/error-classifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,2DAA2D;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,mEAAmE;IACnE,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,mFAAmF;IACnF,SAAS,EAAE,eAAe,EAAE,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEzD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,EAAE,CAyB5E;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAmBpD;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAmB9D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,eAAe,GAAG,mBAAmB,CAgCzE;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,gBAAgB,CAcjF"}
@@ -0,0 +1,182 @@
1
+ /**
2
+ * TypeScript Error Classification Service
3
+ *
4
+ * Classifies TypeScript compiler errors into two categories:
5
+ * - Source errors: Root causes in production code (e.g., missing type definitions)
6
+ * - Cascading errors: Downstream effects caused by source errors (e.g., test file imports failing)
7
+ *
8
+ * This enables the implementation agent to prioritize fixing root causes first,
9
+ * which often resolves multiple cascading errors automatically.
10
+ */
11
+ /**
12
+ * Parses TypeScript compiler output and extracts structured error information.
13
+ *
14
+ * Expected format: `<filePath>(<line>,<col>): error <code>: <message>`
15
+ * Example: `src/app.tsx(59,12): error TS2322: Type 'string' is not assignable to type 'number'.`
16
+ *
17
+ * @param buildOutput - Raw output from TypeScript compiler (tsc)
18
+ * @returns Array of structured TypeScript errors
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * const output = "src/app.tsx(59,12): error TS2322: Type 'string' is not assignable to type 'number'.";
23
+ * const errors = parseTypeScriptErrors(output);
24
+ * // errors[0] = { filePath: 'src/app.tsx', line: 59, column: 12, code: 'TS2322', message: '...' }
25
+ * ```
26
+ */
27
+ export function parseTypeScriptErrors(buildOutput) {
28
+ if (!buildOutput || buildOutput.trim() === '') {
29
+ return [];
30
+ }
31
+ const errors = [];
32
+ // Regex pattern to match TypeScript error format:
33
+ // <filePath>(<line>,<col>): error <code>: <message>
34
+ // Supports both Windows (C:\...) and Unix (/...) paths
35
+ const tsErrorPattern = /^(.+?)\((\d+),(\d+)\):\s*error\s+(TS\d+):\s*(.+)$/gm;
36
+ let match;
37
+ while ((match = tsErrorPattern.exec(buildOutput)) !== null) {
38
+ const [, filePath, lineStr, colStr, code, message] = match;
39
+ errors.push({
40
+ filePath: filePath.trim(),
41
+ line: parseInt(lineStr, 10),
42
+ column: parseInt(colStr, 10),
43
+ code: code.trim(),
44
+ message: message.trim(),
45
+ });
46
+ }
47
+ return errors;
48
+ }
49
+ /**
50
+ * Determines if a file path points to a test file.
51
+ *
52
+ * Test files are identified by:
53
+ * - File extension: .test.ts, .test.tsx, .spec.ts, .spec.tsx, .test.js, .test.jsx, .spec.js, .spec.jsx
54
+ * - Directory patterns: tests/, __tests__/
55
+ *
56
+ * @param filePath - The file path to check
57
+ * @returns true if the file is a test file, false otherwise
58
+ */
59
+ export function isTestFile(filePath) {
60
+ // Check for test file extensions
61
+ if (/\.(test|spec)\.(ts|tsx|js|jsx)$/.test(filePath)) {
62
+ return true;
63
+ }
64
+ // Check for test directories (handle both Windows and Unix path separators)
65
+ // Also handle paths that start with the directory name (e.g., "tests/app.ts")
66
+ if (/(^|[\\/])tests?[\\/]/.test(filePath)) {
67
+ return true;
68
+ }
69
+ // Check for __tests__ directory
70
+ // Also handle paths that start with __tests__ (e.g., "__tests__/app.ts")
71
+ if (/(^|[\\/])__tests__[\\/]/.test(filePath)) {
72
+ return true;
73
+ }
74
+ return false;
75
+ }
76
+ /**
77
+ * Determines if a file path points to a type definition file.
78
+ *
79
+ * Type definition files are identified by:
80
+ * - File extension: .d.ts
81
+ * - Directory patterns: types/, @types/
82
+ *
83
+ * @param filePath - The file path to check
84
+ * @returns true if the file is a type definition file, false otherwise
85
+ */
86
+ export function isTypeDefinitionFile(filePath) {
87
+ // Check for .d.ts extension
88
+ if (filePath.endsWith('.d.ts')) {
89
+ return true;
90
+ }
91
+ // Check for types/ directory (handle both Windows and Unix path separators)
92
+ // Also handle paths that start with types/ (e.g., "types/global.ts")
93
+ if (/(^|[\\/])types[\\/]/.test(filePath)) {
94
+ return true;
95
+ }
96
+ // Check for @types/ directory
97
+ // Also handle paths that start with @types/ (e.g., "@types/custom/foo.ts")
98
+ if (/(^|[\\/])@types[\\/]/.test(filePath)) {
99
+ return true;
100
+ }
101
+ return false;
102
+ }
103
+ /**
104
+ * Classifies a single TypeScript error as either a source error (root cause)
105
+ * or a cascading error (downstream effect).
106
+ *
107
+ * Classification logic:
108
+ * 1. Known cascading-only codes (TS2345) → cascading
109
+ * 2. Known source codes (TS2304, TS2339) in non-test files → source
110
+ * 3. Context-dependent codes (TS2307, TS2322) → analyze file path
111
+ * 4. Conservative default → cascading
112
+ *
113
+ * @param error - The TypeScript error to classify
114
+ * @returns 'source' if root cause, 'cascading' if downstream effect
115
+ *
116
+ * @example
117
+ * ```typescript
118
+ * const error = { code: 'TS2304', filePath: 'src/app.ts', message: 'Cannot find name Foo' };
119
+ * const classification = classifyError(error); // 'source'
120
+ * ```
121
+ */
122
+ export function classifyError(error) {
123
+ const { code, filePath } = error;
124
+ // Known cascading-only error codes
125
+ const CASCADING_ONLY_CODES = ['TS2345']; // Argument type mismatch
126
+ // Known source error codes (when in non-test files)
127
+ const SOURCE_ERROR_CODES = ['TS2304', 'TS2339']; // Cannot find name, Property does not exist
128
+ // Priority 1: Known cascading-only codes
129
+ if (CASCADING_ONLY_CODES.includes(code)) {
130
+ return 'cascading';
131
+ }
132
+ // Priority 2: Known source codes in non-test files
133
+ if (SOURCE_ERROR_CODES.includes(code) && !isTestFile(filePath)) {
134
+ return 'source';
135
+ }
136
+ // Priority 3: Context-dependent codes need path analysis
137
+ if (code === 'TS2307') {
138
+ // Module not found: source in src, cascading in tests
139
+ return isTestFile(filePath) ? 'cascading' : 'source';
140
+ }
141
+ if (code === 'TS2322') {
142
+ // Type mismatch: source in type definitions, cascading elsewhere
143
+ return isTypeDefinitionFile(filePath) ? 'source' : 'cascading';
144
+ }
145
+ // Priority 4: Conservative default (when uncertain)
146
+ return 'cascading';
147
+ }
148
+ /**
149
+ * Classifies and sorts multiple TypeScript errors into source and cascading categories.
150
+ *
151
+ * Source errors are prioritized for fixing as they may automatically resolve
152
+ * multiple cascading errors.
153
+ *
154
+ * @param errors - Array of TypeScript errors to classify
155
+ * @returns Object with separated source and cascading error arrays
156
+ *
157
+ * @example
158
+ * ```typescript
159
+ * const errors = [
160
+ * { code: 'TS2304', filePath: 'src/app.ts', message: '...' },
161
+ * { code: 'TS2307', filePath: 'tests/app.test.ts', message: '...' }
162
+ * ];
163
+ * const classified = classifyAndSortErrors(errors);
164
+ * // classified.source = [{ code: 'TS2304', ... }]
165
+ * // classified.cascading = [{ code: 'TS2307', ... }]
166
+ * ```
167
+ */
168
+ export function classifyAndSortErrors(errors) {
169
+ const source = [];
170
+ const cascading = [];
171
+ for (const error of errors) {
172
+ const classification = classifyError(error);
173
+ if (classification === 'source') {
174
+ source.push(error);
175
+ }
176
+ else {
177
+ cascading.push(error);
178
+ }
179
+ }
180
+ return { source, cascading };
181
+ }
182
+ //# sourceMappingURL=error-classifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-classifier.js","sourceRoot":"","sources":["../../src/services/error-classifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAiCH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,qBAAqB,CAAC,WAAmB;IACvD,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QAC9C,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,MAAM,GAAsB,EAAE,CAAC;IACrC,kDAAkD;IAClD,oDAAoD;IACpD,uDAAuD;IACvD,MAAM,cAAc,GAAG,qDAAqD,CAAC;IAE7E,IAAI,KAAK,CAAC;IACV,OAAO,CAAC,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAC3D,MAAM,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC;QAE3D,MAAM,CAAC,IAAI,CAAC;YACV,QAAQ,EAAE,QAAQ,CAAC,IAAI,EAAE;YACzB,IAAI,EAAE,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC;YAC3B,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;YAC5B,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE;YACjB,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE;SACxB,CAAC,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CAAC,QAAgB;IACzC,iCAAiC;IACjC,IAAI,iCAAiC,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE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