forge-cc 0.1.7 → 0.1.9
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/dist/cli.js +2 -1
- package/dist/cli.js.map +1 -1
- package/dist/config/schema.d.ts +22 -2
- package/dist/config/schema.js +4 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/gates/index.d.ts +2 -1
- package/dist/gates/index.js +8 -1
- package/dist/gates/index.js.map +1 -1
- package/dist/gates/lint-gate.js +5 -0
- package/dist/gates/lint-gate.js.map +1 -1
- package/dist/gates/remediation.d.ts +38 -0
- package/dist/gates/remediation.js +390 -0
- package/dist/gates/remediation.js.map +1 -0
- package/dist/gates/review-gate.d.ts +16 -0
- package/dist/gates/review-gate.js +479 -0
- package/dist/gates/review-gate.js.map +1 -0
- package/dist/gates/tests-gate.js +5 -0
- package/dist/gates/tests-gate.js.map +1 -1
- package/dist/gates/types-gate.js +5 -0
- package/dist/gates/types-gate.js.map +1 -1
- package/dist/gates/visual-capture.d.ts +24 -0
- package/dist/gates/visual-capture.js +144 -0
- package/dist/gates/visual-capture.js.map +1 -0
- package/dist/gates/visual-gate.d.ts +12 -0
- package/dist/gates/visual-gate.js +92 -13
- package/dist/gates/visual-gate.js.map +1 -1
- package/dist/gates/visual-reviewer.d.ts +11 -0
- package/dist/gates/visual-reviewer.js +211 -0
- package/dist/gates/visual-reviewer.js.map +1 -0
- package/dist/go/verify-loop.js +2 -1
- package/dist/go/verify-loop.js.map +1 -1
- package/dist/types.d.ts +51 -0
- package/package.json +3 -1
- package/scripts/postinstall.mjs +15 -0
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// TypeScript Error Remediation
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
/** Known TS error codes mapped to actionable fix instructions */
|
|
5
|
+
const TS_ERROR_MAP = {
|
|
6
|
+
// Assignment & type mismatch
|
|
7
|
+
TS2322: "Type is not assignable — change the target type, cast with `as`, or fix the source value.",
|
|
8
|
+
TS2345: "Argument type mismatch — update the argument to match the parameter type or widen the parameter.",
|
|
9
|
+
TS2352: "Conversion may be a mistake — use `unknown` as an intermediate cast if the conversion is intentional.",
|
|
10
|
+
TS2741: "Property is missing in type — add the missing property to the object literal or mark it optional in the interface.",
|
|
11
|
+
// Property access
|
|
12
|
+
TS2339: "Property does not exist on type — add the property to the type definition, use a type assertion, or check for a typo.",
|
|
13
|
+
TS2551: "Property does not exist (did you mean?) — check the suggested spelling correction and fix the property name.",
|
|
14
|
+
// Missing / extra arguments
|
|
15
|
+
TS2554: "Wrong number of arguments — add missing arguments or remove extras to match the function signature.",
|
|
16
|
+
TS2555: "Expected at least N arguments — provide the required arguments to the function call.",
|
|
17
|
+
TS2556: "Spread argument must have a tuple type — type the spread array as a tuple or use individual arguments.",
|
|
18
|
+
// Module / import resolution
|
|
19
|
+
TS2307: "Cannot find module — verify the import path, ensure the file exists, and check that the .js extension is included for ES modules.",
|
|
20
|
+
TS2305: "Module has no exported member — check the export name for typos or update the module's exports.",
|
|
21
|
+
TS2614: "Module has no default export — use a named import instead, or add a default export to the module.",
|
|
22
|
+
TS1259: "Module can only be default-imported with esModuleInterop — enable esModuleInterop in tsconfig or use `import * as` syntax.",
|
|
23
|
+
// Null / undefined safety
|
|
24
|
+
TS2531: "Object is possibly null — add a null check, use optional chaining (?.), or apply the non-null assertion (!) if you are certain.",
|
|
25
|
+
TS2532: "Object is possibly undefined — add an undefined check, use optional chaining (?.), or provide a fallback with ??.",
|
|
26
|
+
TS2533: "Object is possibly null or undefined — guard with a truthiness check or use optional chaining.",
|
|
27
|
+
TS18047: "Value is possibly null — add a null guard before accessing properties.",
|
|
28
|
+
TS18048: "Value is possibly undefined — add an undefined guard before accessing properties.",
|
|
29
|
+
// Declarations & identifiers
|
|
30
|
+
TS2304: "Cannot find name — check for typos, add the missing import, or declare the variable/type.",
|
|
31
|
+
TS2451: "Cannot redeclare block-scoped variable — rename one of the declarations or move it to a different scope.",
|
|
32
|
+
TS2440: "Import declaration conflicts with local value — rename the local variable or the import alias.",
|
|
33
|
+
// Return types & control flow
|
|
34
|
+
TS2355: "Function must return a value — add a return statement for all code paths.",
|
|
35
|
+
TS7030: "Not all code paths return a value — ensure every branch in the function returns or add an explicit return at the end.",
|
|
36
|
+
TS2366: "Function lacks ending return — add a return statement at the end of the function.",
|
|
37
|
+
// Generics & type parameters
|
|
38
|
+
TS2314: "Generic type requires type arguments — provide explicit type parameters (e.g., Array<string>).",
|
|
39
|
+
TS2344: "Type does not satisfy constraint — change the type argument to one that extends the required constraint.",
|
|
40
|
+
TS2558: "Expected type arguments — supply the required generic parameters.",
|
|
41
|
+
// Overloads & signatures
|
|
42
|
+
TS2769: "No overload matches this call — check argument types against all overload signatures and fix the mismatch.",
|
|
43
|
+
// Strict mode
|
|
44
|
+
TS7006: "Parameter implicitly has an 'any' type — add an explicit type annotation to the parameter.",
|
|
45
|
+
TS7031: "Binding element implicitly has an 'any' type — add a type annotation to the destructured parameter.",
|
|
46
|
+
TS7053: "Element implicitly has an 'any' type — add an index signature to the type or use a Map instead.",
|
|
47
|
+
};
|
|
48
|
+
/** Regex to extract TS error code from a gate error message */
|
|
49
|
+
const TS_CODE_RE = /\bTS(\d+)\b/;
|
|
50
|
+
/**
|
|
51
|
+
* Build actionable remediation text for a TypeScript compilation error.
|
|
52
|
+
*
|
|
53
|
+
* Parses the TS error code from the message and returns a targeted fix
|
|
54
|
+
* instruction. Falls back to a generic hint when the code is unrecognized.
|
|
55
|
+
*/
|
|
56
|
+
export function buildTypeRemediation(error) {
|
|
57
|
+
const match = TS_CODE_RE.exec(error.message);
|
|
58
|
+
if (match) {
|
|
59
|
+
const code = `TS${match[1]}`;
|
|
60
|
+
const hint = TS_ERROR_MAP[code];
|
|
61
|
+
if (hint) {
|
|
62
|
+
const location = formatLocation(error);
|
|
63
|
+
return `${location}${code}: ${hint}`;
|
|
64
|
+
}
|
|
65
|
+
// Known code pattern but not in our map — still include the code
|
|
66
|
+
const location = formatLocation(error);
|
|
67
|
+
return `${location}${code}: Review the TypeScript documentation for this error code and fix the type mismatch.`;
|
|
68
|
+
}
|
|
69
|
+
// No TS code found — return a generic remediation
|
|
70
|
+
const location = formatLocation(error);
|
|
71
|
+
return `${location}Fix the TypeScript error: ${error.message}`;
|
|
72
|
+
}
|
|
73
|
+
// ---------------------------------------------------------------------------
|
|
74
|
+
// Lint Error Remediation
|
|
75
|
+
// ---------------------------------------------------------------------------
|
|
76
|
+
/** Common ESLint / Biome rule names mapped to fix instructions */
|
|
77
|
+
const LINT_RULE_MAP = {
|
|
78
|
+
// Unused code
|
|
79
|
+
"no-unused-vars": "Remove the unused variable or import, or prefix it with _ to indicate intentional non-use.",
|
|
80
|
+
"noUnusedVariables": "Remove the unused variable or import, or prefix it with _ to indicate intentional non-use.",
|
|
81
|
+
"@typescript-eslint/no-unused-vars": "Remove the unused variable or import, or prefix it with _ to indicate intentional non-use.",
|
|
82
|
+
"noUnusedImports": "Remove the unused import statement.",
|
|
83
|
+
// Consistency & style
|
|
84
|
+
"no-console": "Remove the console statement or replace it with a proper logger.",
|
|
85
|
+
"eqeqeq": "Use strict equality (=== / !==) instead of loose equality (== / !=).",
|
|
86
|
+
"prefer-const": "Change `let` to `const` since the variable is never reassigned.",
|
|
87
|
+
"no-var": "Replace `var` with `let` or `const`.",
|
|
88
|
+
"useConst": "Change `let` to `const` since the variable is never reassigned.",
|
|
89
|
+
// Type safety
|
|
90
|
+
"no-explicit-any": "Replace `any` with a specific type or `unknown`.",
|
|
91
|
+
"@typescript-eslint/no-explicit-any": "Replace `any` with a specific type or `unknown`.",
|
|
92
|
+
"noExplicitAny": "Replace `any` with a specific type or `unknown`.",
|
|
93
|
+
"no-non-null-assertion": "Remove the non-null assertion (!) and add a proper null check.",
|
|
94
|
+
"@typescript-eslint/no-non-null-assertion": "Remove the non-null assertion (!) and add a proper null check.",
|
|
95
|
+
"noNonNullAssertion": "Remove the non-null assertion (!) and add a proper null check.",
|
|
96
|
+
// Import rules
|
|
97
|
+
"no-duplicate-imports": "Merge duplicate imports from the same module into a single import statement.",
|
|
98
|
+
"noDuplicateImports": "Merge duplicate imports from the same module into a single import statement.",
|
|
99
|
+
"import/order": "Reorder imports to follow the project convention (builtins, externals, internals).",
|
|
100
|
+
"import/no-unresolved": "Fix the import path — the module cannot be resolved. Check for typos or missing packages.",
|
|
101
|
+
"noUndeclaredDependencies": "Add the dependency to package.json or fix the import path.",
|
|
102
|
+
// Code quality
|
|
103
|
+
"no-shadow": "Rename the inner variable to avoid shadowing the outer declaration.",
|
|
104
|
+
"noShadowRestrictedNames": "Rename the variable — it shadows a restricted global name.",
|
|
105
|
+
"no-redeclare": "Remove the duplicate declaration or rename one of the variables.",
|
|
106
|
+
"no-unreachable": "Remove the unreachable code after the return/throw/break/continue statement.",
|
|
107
|
+
"noUnreachable": "Remove the unreachable code after the return/throw/break/continue statement.",
|
|
108
|
+
"complexity": "Reduce function complexity by extracting logic into smaller helper functions.",
|
|
109
|
+
"useExhaustiveDependencies": "Add the missing dependencies to the hook dependency array, or wrap the value with useCallback/useMemo.",
|
|
110
|
+
// Biome-specific formatting / organization
|
|
111
|
+
"useImportType": "Change to `import type` since this import is only used as a type.",
|
|
112
|
+
"noUnsafeDeclarationMerging": "Avoid declaration merging — rename the interface or class to prevent unsafe overlap.",
|
|
113
|
+
"useOptionalChain": "Use optional chaining (?.) instead of manual null checks.",
|
|
114
|
+
"noParameterAssign": "Do not reassign function parameters — use a local variable instead.",
|
|
115
|
+
// Async / promises
|
|
116
|
+
"no-floating-promises": "Await the promise or explicitly handle it with .catch().",
|
|
117
|
+
"@typescript-eslint/no-floating-promises": "Await the promise or explicitly handle it with .catch().",
|
|
118
|
+
"require-await": "Remove the async keyword if the function does not use await, or add an await expression.",
|
|
119
|
+
"no-return-await": "Remove the redundant `return await` — just return the promise directly.",
|
|
120
|
+
"noAsyncPromiseExecutor": "Do not pass an async function to new Promise() — handle async logic outside the constructor.",
|
|
121
|
+
};
|
|
122
|
+
/** Regex to extract a lint rule name from a Biome or ESLint error message */
|
|
123
|
+
const LINT_RULE_RE = /\b(?:lint\/|@[\w-]+\/)?(?:[\w-]+\/)?(\w[\w-]*)\b/;
|
|
124
|
+
/** Regex matching Biome-style rule names like lint/style/useConst */
|
|
125
|
+
const BIOME_RULE_RE = /lint\/[\w-]+\/([\w-]+)/;
|
|
126
|
+
/**
|
|
127
|
+
* Build actionable remediation text for a lint error (ESLint or Biome).
|
|
128
|
+
*
|
|
129
|
+
* Extracts the rule name from the error message and returns a targeted fix
|
|
130
|
+
* instruction. Falls back to a generic hint when the rule is unrecognized.
|
|
131
|
+
*/
|
|
132
|
+
export function buildLintRemediation(error) {
|
|
133
|
+
const location = formatLocation(error);
|
|
134
|
+
// Try Biome-style rule path first (e.g., lint/style/useConst)
|
|
135
|
+
const biomeMatch = BIOME_RULE_RE.exec(error.message);
|
|
136
|
+
if (biomeMatch) {
|
|
137
|
+
const ruleName = biomeMatch[1];
|
|
138
|
+
const hint = LINT_RULE_MAP[ruleName];
|
|
139
|
+
if (hint) {
|
|
140
|
+
return `${location}[${ruleName}] ${hint}`;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
// Try generic rule name extraction
|
|
144
|
+
const genericMatch = LINT_RULE_RE.exec(error.message);
|
|
145
|
+
if (genericMatch) {
|
|
146
|
+
const ruleName = genericMatch[1];
|
|
147
|
+
const hint = LINT_RULE_MAP[ruleName];
|
|
148
|
+
if (hint) {
|
|
149
|
+
return `${location}[${ruleName}] ${hint}`;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
// Check if any known rule name appears literally in the message
|
|
153
|
+
for (const [rule, hint] of Object.entries(LINT_RULE_MAP)) {
|
|
154
|
+
if (error.message.includes(rule)) {
|
|
155
|
+
return `${location}[${rule}] ${hint}`;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
// Fall back to generic lint remediation
|
|
159
|
+
return `${location}Fix the lint issue: ${error.message}`;
|
|
160
|
+
}
|
|
161
|
+
// ---------------------------------------------------------------------------
|
|
162
|
+
// Test Error Remediation
|
|
163
|
+
// ---------------------------------------------------------------------------
|
|
164
|
+
/** Patterns in test failure messages mapped to actionable fix instructions */
|
|
165
|
+
const TEST_PATTERNS = [
|
|
166
|
+
{
|
|
167
|
+
pattern: /Expected.*Received|toBe|toEqual|toStrictEqual/i,
|
|
168
|
+
hint: "Assertion mismatch — compare the expected and received values, then fix the implementation to produce the correct output or update the test expectation.",
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
pattern: /AssertionError|AssertionError/i,
|
|
172
|
+
hint: "Assertion failed — review the test's expected vs actual values and fix the underlying code or update the test.",
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
pattern: /TypeError:\s*Cannot read propert/i,
|
|
176
|
+
hint: "Runtime TypeError — a value is null or undefined when a property is accessed. Add a null check or ensure proper initialization.",
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
pattern: /TypeError:\s*.*is not a function/i,
|
|
180
|
+
hint: "Function call on non-function — check that the import is correct and the value is actually a function.",
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
pattern: /ReferenceError/i,
|
|
184
|
+
hint: "Variable is not defined — check for typos, missing imports, or variables used before declaration.",
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
pattern: /SyntaxError/i,
|
|
188
|
+
hint: "Syntax error in source or test file — check for missing brackets, invalid syntax, or broken imports.",
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
pattern: /timeout|timed?\s*out/i,
|
|
192
|
+
hint: "Test timed out — check for infinite loops, unresolved promises, or missing async/await. Consider increasing the test timeout if the operation is legitimately slow.",
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
pattern: /ENOENT|no such file/i,
|
|
196
|
+
hint: "File not found — check that the file path is correct and the file exists. Fixtures or test data may need to be created.",
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
pattern: /ECONNREFUSED|ECONNRESET/i,
|
|
200
|
+
hint: "Connection refused — the test expects a server to be running. Check that test setup starts the required service or use a mock.",
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
pattern: /snapshot.*mismatch|snapshot.*updated/i,
|
|
204
|
+
hint: "Snapshot mismatch — if the change is intentional, run `npm test -- -u` to update snapshots. Otherwise, fix the component to match the existing snapshot.",
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
pattern: /mock.*not.*called|not.*been.*called/i,
|
|
208
|
+
hint: "Mock was not called as expected — verify the code path actually invokes the mocked function. Check that the mock is set up before the code under test runs.",
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
pattern: /mock.*called.*times|called.*\d+.*times/i,
|
|
212
|
+
hint: "Mock call count mismatch — the function was called a different number of times than expected. Review the logic to ensure the correct number of invocations.",
|
|
213
|
+
},
|
|
214
|
+
];
|
|
215
|
+
/**
|
|
216
|
+
* Build actionable remediation text for a test failure.
|
|
217
|
+
*
|
|
218
|
+
* Scans the error message for common failure patterns (assertion mismatches,
|
|
219
|
+
* runtime errors, timeouts) and returns targeted fix instructions. Falls
|
|
220
|
+
* back to a generic test-fix hint when no patterns match.
|
|
221
|
+
*/
|
|
222
|
+
export function buildTestRemediation(error) {
|
|
223
|
+
const location = formatLocation(error);
|
|
224
|
+
for (const { pattern, hint } of TEST_PATTERNS) {
|
|
225
|
+
if (pattern.test(error.message)) {
|
|
226
|
+
return `${location}${hint}`;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
// Fallback for FAIL lines and generic test errors
|
|
230
|
+
if (/FAIL/i.test(error.message)) {
|
|
231
|
+
return `${location}Test suite failed — open the test file, review failing assertions, and fix the underlying code or update the test expectations.`;
|
|
232
|
+
}
|
|
233
|
+
return `${location}Test failure — open the failing test file, review the error details, and fix the implementation or update the test expectation.`;
|
|
234
|
+
}
|
|
235
|
+
// ---------------------------------------------------------------------------
|
|
236
|
+
// Visual Error Remediation
|
|
237
|
+
// ---------------------------------------------------------------------------
|
|
238
|
+
/** Keywords in visual error messages mapped to CSS/layout fix hints */
|
|
239
|
+
const VISUAL_PATTERNS = [
|
|
240
|
+
{
|
|
241
|
+
pattern: /overflow/i,
|
|
242
|
+
hint: (_m, _e) => "Element overflows its container — add `overflow-x: hidden` or `max-width: 100%` to the offending element. Check for fixed-width children inside a responsive container.",
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
pattern: /\bmobile\b/i,
|
|
246
|
+
hint: (_m, _e) => "Issue on mobile viewport — review responsive breakpoints and ensure the layout adapts below 480px. Check for `min-width` or fixed `width` values that prevent shrinking.",
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
pattern: /\btablet\b/i,
|
|
250
|
+
hint: (_m, _e) => "Issue on tablet viewport — check layout between 768px and 1024px. Consider adding a breakpoint for medium-sized screens.",
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
pattern: /\bdesktop\b/i,
|
|
254
|
+
hint: (_m, _e) => "Issue on desktop viewport — verify the element at 1280px+ width. Check for max-width constraints or centering issues.",
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
pattern: /element count (increase|decrease)/i,
|
|
258
|
+
hint: (m, _e) => {
|
|
259
|
+
const direction = m[1].toLowerCase();
|
|
260
|
+
return direction === "increase"
|
|
261
|
+
? "Significant increase in DOM elements — check for unintended list rendering, duplicated components, or missing conditional guards."
|
|
262
|
+
: "Significant decrease in DOM elements — verify that components are not accidentally removed. Check conditional rendering and route guards.";
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
pattern: /missing element/i,
|
|
267
|
+
hint: (_m, _e) => "Element is missing from the DOM — check if responsive CSS hides it (display: none in a media query) or if conditional rendering logic excludes it at this viewport size.",
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
pattern: /added element/i,
|
|
271
|
+
hint: (_m, _e) => "Unexpected element appeared — verify the addition is intentional. If it is a responsive element, ensure it is hidden on viewports where it should not appear.",
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
pattern: /became hidden/i,
|
|
275
|
+
hint: (_m, _e) => "Element visibility changed to hidden — check CSS display, visibility, and opacity rules. Look for media queries that toggle element visibility.",
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
pattern: /became visible/i,
|
|
279
|
+
hint: (_m, _e) => "Element became visible — verify this is intentional. Check CSS media queries and conditional rendering that controls visibility.",
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
pattern: /layout shift/i,
|
|
283
|
+
hint: (_m, _e) => "Significant layout shift detected — review CSS changes that affect position, width, or height. Look for missing explicit dimensions on images/containers or changed flex/grid properties.",
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
pattern: /console.*error|error.*console/i,
|
|
287
|
+
hint: (_m, _e) => "Browser console error detected — open the dev server in a browser, check the console, and fix the JavaScript runtime error.",
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
pattern: /navigation.*(?:fail|error|timeout)/i,
|
|
291
|
+
hint: (_m, _e) => "Page navigation failed — verify the route exists, the dev server is running, and the page does not redirect to an error page.",
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
pattern: /dev server/i,
|
|
295
|
+
hint: (_m, _e) => "Dev server issue — ensure the dev server command in .forge.json is correct and the port is not already in use. Try running the dev server manually to check for startup errors.",
|
|
296
|
+
},
|
|
297
|
+
];
|
|
298
|
+
/**
|
|
299
|
+
* Build actionable remediation text for a visual validation error.
|
|
300
|
+
*
|
|
301
|
+
* Scans the error message for viewport and layout keywords, then returns
|
|
302
|
+
* CSS/layout-specific fix hints. Falls back to generic visual advice when
|
|
303
|
+
* no patterns match.
|
|
304
|
+
*/
|
|
305
|
+
export function buildVisualRemediation(error) {
|
|
306
|
+
const hints = [];
|
|
307
|
+
// Collect all matching pattern hints (a visual error can match multiple)
|
|
308
|
+
for (const { pattern, hint } of VISUAL_PATTERNS) {
|
|
309
|
+
const match = error.message.match(pattern);
|
|
310
|
+
if (match) {
|
|
311
|
+
hints.push(hint(match, error));
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
if (hints.length > 0) {
|
|
315
|
+
// Deduplicate and join
|
|
316
|
+
const unique = [...new Set(hints)];
|
|
317
|
+
return unique.join(" ");
|
|
318
|
+
}
|
|
319
|
+
// Fallback
|
|
320
|
+
return `Visual issue: ${error.message} — inspect the page in a browser at the failing viewport size and fix the layout.`;
|
|
321
|
+
}
|
|
322
|
+
// ---------------------------------------------------------------------------
|
|
323
|
+
// Review Error Remediation
|
|
324
|
+
// ---------------------------------------------------------------------------
|
|
325
|
+
/** Regex to extract PRD section references from review error messages */
|
|
326
|
+
const PRD_SECTION_RE = /PRD\s+(?:section\s+)?[""]?([^""]+)[""]?/i;
|
|
327
|
+
/** Regex to extract CLAUDE.md rule references */
|
|
328
|
+
const CLAUDE_RULE_RE = /CLAUDE\.md:\s*(\[[^\]]+\]|[^,.\n]+)/i;
|
|
329
|
+
/**
|
|
330
|
+
* Build actionable remediation text for a code review finding.
|
|
331
|
+
*
|
|
332
|
+
* Adds PRD section references, CLAUDE.md rule citations, and concrete
|
|
333
|
+
* next-step guidance so fix agents know exactly where to look.
|
|
334
|
+
*/
|
|
335
|
+
export function buildReviewRemediation(error) {
|
|
336
|
+
const parts = [];
|
|
337
|
+
const location = formatLocation(error);
|
|
338
|
+
// If the error already has remediation text, use it as the base
|
|
339
|
+
if (error.remediation) {
|
|
340
|
+
parts.push(error.remediation);
|
|
341
|
+
}
|
|
342
|
+
// Add PRD section reference if found in the message
|
|
343
|
+
const prdMatch = PRD_SECTION_RE.exec(error.message);
|
|
344
|
+
if (prdMatch) {
|
|
345
|
+
const section = prdMatch[1].trim();
|
|
346
|
+
parts.push(`Refer to PRD section "${section}" for the full acceptance criteria.`);
|
|
347
|
+
}
|
|
348
|
+
// Add CLAUDE.md rule reference if found
|
|
349
|
+
const claudeMatch = CLAUDE_RULE_RE.exec(error.message);
|
|
350
|
+
if (claudeMatch) {
|
|
351
|
+
const rule = claudeMatch[1].trim();
|
|
352
|
+
parts.push(`See CLAUDE.md rule ${rule} for the exact coding standard.`);
|
|
353
|
+
}
|
|
354
|
+
// Classify the finding type from message content
|
|
355
|
+
if (/prd.*criterion|criterion.*not.*addressed/i.test(error.message)) {
|
|
356
|
+
parts.push("Check that the current changes fulfill the acceptance criterion. If the criterion is out of scope for this milestone, note it for a future milestone.");
|
|
357
|
+
}
|
|
358
|
+
if (/rule.*violation|violation.*rule/i.test(error.message)) {
|
|
359
|
+
parts.push("Fix the rule violation in the flagged file/line, then re-run the review gate to confirm compliance.");
|
|
360
|
+
}
|
|
361
|
+
if (/style/i.test(error.message) && /\bany\b/i.test(error.message)) {
|
|
362
|
+
parts.push("Replace the `any` type with a specific type or `unknown` to satisfy strict TypeScript conventions.");
|
|
363
|
+
}
|
|
364
|
+
if (/TODO|FIXME|HACK/i.test(error.message)) {
|
|
365
|
+
parts.push("Resolve or remove the TODO/FIXME/HACK marker before merging, or create a tracked issue for it.");
|
|
366
|
+
}
|
|
367
|
+
if (parts.length > 0) {
|
|
368
|
+
const unique = [...new Set(parts)];
|
|
369
|
+
return `${location}${unique.join(" ")}`;
|
|
370
|
+
}
|
|
371
|
+
// Fallback
|
|
372
|
+
return `${location}Review finding: ${error.message} — address the issue and re-run the review gate.`;
|
|
373
|
+
}
|
|
374
|
+
// ---------------------------------------------------------------------------
|
|
375
|
+
// Shared Utilities
|
|
376
|
+
// ---------------------------------------------------------------------------
|
|
377
|
+
/**
|
|
378
|
+
* Format a file:line location prefix from a GateError.
|
|
379
|
+
* Returns empty string if no file info is available.
|
|
380
|
+
*/
|
|
381
|
+
function formatLocation(error) {
|
|
382
|
+
if (error.file && error.line) {
|
|
383
|
+
return `${error.file}:${error.line} — `;
|
|
384
|
+
}
|
|
385
|
+
if (error.file) {
|
|
386
|
+
return `${error.file} — `;
|
|
387
|
+
}
|
|
388
|
+
return "";
|
|
389
|
+
}
|
|
390
|
+
//# sourceMappingURL=remediation.js.map
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QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IAC1C,CAAC;IAED,WAAW;IACX,OAAO,GAAG,QAAQ,mBAAmB,KAAK,CAAC,OAAO,kDAAkD,CAAC;AACvG,CAAC;AAED,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E;;;GAGG;AACH,SAAS,cAAc,CAAC,KAAgB;IACtC,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;QAC7B,OAAO,GAAG,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,CAAC;IAC1C,CAAC;IACD,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;QACf,OAAO,GAAG,KAAK,CAAC,IAAI,KAAK,CAAC;IAC5B,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ReviewResult } from "../types.js";
|
|
2
|
+
/** Options for the review gate */
|
|
3
|
+
export interface ReviewOptions {
|
|
4
|
+
prdPath?: string;
|
|
5
|
+
claudeMdPath?: string;
|
|
6
|
+
baseBranch?: string;
|
|
7
|
+
blocking?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Code review gate: evaluates the current diff against PRD acceptance criteria
|
|
11
|
+
* and CLAUDE.md coding rules to produce structured review findings.
|
|
12
|
+
*
|
|
13
|
+
* Non-blocking by default (returns passed: true with warnings).
|
|
14
|
+
* Set blocking: true to fail the gate when findings exist.
|
|
15
|
+
*/
|
|
16
|
+
export declare function verifyReview(projectDir: string, options?: ReviewOptions): Promise<ReviewResult>;
|