@yasserkhanorg/impact-gate 2.1.4 → 2.1.5
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.
|
@@ -159,6 +159,18 @@ export function executeFixTool(ctx, name, input) {
|
|
|
159
159
|
if (!isPathSafe(ctx.projectRoot, filePath)) {
|
|
160
160
|
return { output: `Blocked: "${filePath}" is outside the project or a restricted path.` };
|
|
161
161
|
}
|
|
162
|
+
// Refuse to overwrite files that already have uncommitted user changes
|
|
163
|
+
if (!ctx.pendingWrittenFiles.has(filePath)) {
|
|
164
|
+
try {
|
|
165
|
+
const status = execFileSync('git', ['status', '--porcelain', '--', filePath], { cwd: ctx.projectRoot, encoding: 'utf-8' }).trim();
|
|
166
|
+
if (status.length > 0) {
|
|
167
|
+
return { output: `Blocked: "${filePath}" has uncommitted user changes. Choose a different file or skip this fix.` };
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
catch {
|
|
171
|
+
// git status failed — allow the write (file may be new/untracked)
|
|
172
|
+
}
|
|
173
|
+
}
|
|
162
174
|
const fullPath = resolve(ctx.projectRoot, filePath);
|
|
163
175
|
writeFileSync(fullPath, String(input.content), 'utf-8');
|
|
164
176
|
ctx.pendingWrittenFiles.add(filePath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fix_tools.d.ts","sourceRoot":"","sources":["../../../src/qa-agent/phase25/fix_tools.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,SAAS,MAAM,mBAAmB,CAAC;AAE/C,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,4BAA4B,CAAC;AAM7D,eAAO,MAAM,oBAAoB,EAAE,SAAS,CAAC,IAAI,EAgGhD,CAAC;AAMF,MAAM,WAAW,cAAc;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,YAAY,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,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pB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,0DAA0D;IAC1D,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AA2CD,wBAAgB,cAAc,CAC1B,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,aAAa,CAmLf"}
|
|
@@ -163,6 +163,18 @@ function executeFixTool(ctx, name, input) {
|
|
|
163
163
|
if (!isPathSafe(ctx.projectRoot, filePath)) {
|
|
164
164
|
return { output: `Blocked: "${filePath}" is outside the project or a restricted path.` };
|
|
165
165
|
}
|
|
166
|
+
// Refuse to overwrite files that already have uncommitted user changes
|
|
167
|
+
if (!ctx.pendingWrittenFiles.has(filePath)) {
|
|
168
|
+
try {
|
|
169
|
+
const status = (0, child_process_1.execFileSync)('git', ['status', '--porcelain', '--', filePath], { cwd: ctx.projectRoot, encoding: 'utf-8' }).trim();
|
|
170
|
+
if (status.length > 0) {
|
|
171
|
+
return { output: `Blocked: "${filePath}" has uncommitted user changes. Choose a different file or skip this fix.` };
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
// git status failed — allow the write (file may be new/untracked)
|
|
176
|
+
}
|
|
177
|
+
}
|
|
166
178
|
const fullPath = (0, path_1.resolve)(ctx.projectRoot, filePath);
|
|
167
179
|
(0, fs_1.writeFileSync)(fullPath, String(input.content), 'utf-8');
|
|
168
180
|
ctx.pendingWrittenFiles.add(filePath);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yasserkhanorg/impact-gate",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
4
4
|
"description": "Diff-aware E2E impact analysis and coverage gating for Playwright/Cypress teams. Optional AI features can suggest, generate, and heal tests once your project has a route-families.json manifest.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|