ai-sdlc 0.2.0-alpha.5 → 0.2.0-alpha.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -1058
- package/dist/agents/implementation.d.ts +6 -0
- package/dist/agents/implementation.d.ts.map +1 -1
- package/dist/agents/implementation.js +151 -13
- package/dist/agents/implementation.js.map +1 -1
- package/dist/agents/index.d.ts +2 -0
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +2 -0
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/orchestrator.d.ts +61 -0
- package/dist/agents/orchestrator.d.ts.map +1 -0
- package/dist/agents/orchestrator.js +443 -0
- package/dist/agents/orchestrator.js.map +1 -0
- package/dist/agents/planning.d.ts +1 -1
- package/dist/agents/planning.d.ts.map +1 -1
- package/dist/agents/planning.js +55 -4
- package/dist/agents/planning.js.map +1 -1
- package/dist/agents/refinement.d.ts.map +1 -1
- package/dist/agents/refinement.js +22 -3
- package/dist/agents/refinement.js.map +1 -1
- package/dist/agents/research.d.ts +85 -1
- package/dist/agents/research.d.ts.map +1 -1
- package/dist/agents/research.js +506 -16
- package/dist/agents/research.js.map +1 -1
- package/dist/agents/review.d.ts +77 -2
- package/dist/agents/review.d.ts.map +1 -1
- package/dist/agents/review.js +615 -93
- package/dist/agents/review.js.map +1 -1
- package/dist/agents/rework.d.ts.map +1 -1
- package/dist/agents/rework.js +22 -3
- package/dist/agents/rework.js.map +1 -1
- package/dist/agents/single-task.d.ts +41 -0
- package/dist/agents/single-task.d.ts.map +1 -0
- package/dist/agents/single-task.js +357 -0
- package/dist/agents/single-task.js.map +1 -0
- package/dist/agents/state-assessor.d.ts +3 -3
- package/dist/agents/state-assessor.d.ts.map +1 -1
- package/dist/agents/state-assessor.js +6 -6
- package/dist/agents/state-assessor.js.map +1 -1
- package/dist/agents/test-pattern-detector.d.ts +49 -0
- package/dist/agents/test-pattern-detector.d.ts.map +1 -0
- package/dist/agents/test-pattern-detector.js +273 -0
- package/dist/agents/test-pattern-detector.js.map +1 -0
- package/dist/agents/verification.d.ts +11 -0
- package/dist/agents/verification.d.ts.map +1 -1
- package/dist/agents/verification.js +97 -12
- package/dist/agents/verification.js.map +1 -1
- package/dist/cli/commands/migrate.js +1 -1
- package/dist/cli/commands/migrate.js.map +1 -1
- package/dist/cli/commands.d.ts +65 -3
- package/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +1108 -204
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/daemon.d.ts.map +1 -1
- package/dist/cli/daemon.js +20 -3
- package/dist/cli/daemon.js.map +1 -1
- package/dist/cli/runner.d.ts.map +1 -1
- package/dist/cli/runner.js +19 -11
- package/dist/cli/runner.js.map +1 -1
- package/dist/core/auth.d.ts +43 -0
- package/dist/core/auth.d.ts.map +1 -1
- package/dist/core/auth.js +105 -1
- package/dist/core/auth.js.map +1 -1
- package/dist/core/client.d.ts +6 -0
- package/dist/core/client.d.ts.map +1 -1
- package/dist/core/client.js +57 -3
- package/dist/core/client.js.map +1 -1
- package/dist/core/config.d.ts +24 -1
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +100 -3
- package/dist/core/config.js.map +1 -1
- package/dist/core/conflict-detector.d.ts +108 -0
- package/dist/core/conflict-detector.d.ts.map +1 -0
- package/dist/core/conflict-detector.js +413 -0
- package/dist/core/conflict-detector.js.map +1 -0
- package/dist/core/git-utils.d.ts +28 -0
- package/dist/core/git-utils.d.ts.map +1 -0
- package/dist/core/git-utils.js +146 -0
- package/dist/core/git-utils.js.map +1 -0
- package/dist/core/index.d.ts +19 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +19 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/kanban.d.ts +1 -1
- package/dist/core/kanban.d.ts.map +1 -1
- package/dist/core/kanban.js +7 -6
- package/dist/core/kanban.js.map +1 -1
- package/dist/core/llm-utils.d.ts +103 -0
- package/dist/core/llm-utils.d.ts.map +1 -0
- package/dist/core/llm-utils.js +368 -0
- package/dist/core/llm-utils.js.map +1 -0
- package/dist/core/logger.d.ts +92 -0
- package/dist/core/logger.d.ts.map +1 -0
- package/dist/core/logger.js +221 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/story-logger.d.ts +102 -0
- package/dist/core/story-logger.d.ts.map +1 -0
- package/dist/core/story-logger.js +265 -0
- package/dist/core/story-logger.js.map +1 -0
- package/dist/core/story.d.ts +89 -20
- package/dist/core/story.d.ts.map +1 -1
- package/dist/core/story.js +297 -52
- package/dist/core/story.js.map +1 -1
- package/dist/core/task-parser.d.ts +59 -0
- package/dist/core/task-parser.d.ts.map +1 -0
- package/dist/core/task-parser.js +235 -0
- package/dist/core/task-parser.js.map +1 -0
- package/dist/core/task-progress.d.ts +92 -0
- package/dist/core/task-progress.d.ts.map +1 -0
- package/dist/core/task-progress.js +280 -0
- package/dist/core/task-progress.js.map +1 -0
- package/dist/core/workflow-state.d.ts +45 -6
- package/dist/core/workflow-state.d.ts.map +1 -1
- package/dist/core/workflow-state.js +201 -12
- package/dist/core/workflow-state.js.map +1 -1
- package/dist/core/worktree.d.ts +77 -0
- package/dist/core/worktree.d.ts.map +1 -0
- package/dist/core/worktree.js +246 -0
- package/dist/core/worktree.js.map +1 -0
- package/dist/index.js +135 -5
- package/dist/index.js.map +1 -1
- package/dist/services/error-classifier.d.ts +119 -0
- package/dist/services/error-classifier.d.ts.map +1 -0
- package/dist/services/error-classifier.js +182 -0
- package/dist/services/error-classifier.js.map +1 -0
- package/dist/types/index.d.ts +336 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/package.json +4 -1
|
@@ -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;;;;;;;;;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