@getcoherent/cli 0.6.47 → 0.6.48
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/index.js +7 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5028,11 +5028,12 @@ async function applyModification(request, dsm, cm, pm, projectRoot, aiProvider,
|
|
|
5028
5028
|
const relPath = filePath.replace(projectRoot + "/", "").replace(projectRoot + "\\", "");
|
|
5029
5029
|
const tscErrors = runTscCheck(projectRoot).filter((e) => e.file === relPath);
|
|
5030
5030
|
if (tscErrors.length > 0) {
|
|
5031
|
-
|
|
5031
|
+
let bestSnapshot = codeToWrite;
|
|
5032
5032
|
const detResult = await applyDeterministicFixes(tscErrors, projectRoot, tscBackups);
|
|
5033
|
-
|
|
5033
|
+
const bestErrorCount = detResult.remaining.length;
|
|
5034
5034
|
if (detResult.fixed.length > 0) {
|
|
5035
5035
|
codeToWrite = await readFile(filePath);
|
|
5036
|
+
bestSnapshot = codeToWrite;
|
|
5036
5037
|
console.log(
|
|
5037
5038
|
chalk8.green(` \u2714 Fixed ${tscErrors.length - detResult.remaining.length} TypeScript error(s)`)
|
|
5038
5039
|
);
|
|
@@ -5057,9 +5058,7 @@ Keep all existing functionality intact.`,
|
|
|
5057
5058
|
if (afterErrors.length > bestErrorCount) {
|
|
5058
5059
|
await writeFile(filePath, bestSnapshot);
|
|
5059
5060
|
codeToWrite = bestSnapshot;
|
|
5060
|
-
console.log(
|
|
5061
|
-
chalk8.yellow(` \u26A0 AI fix regressed TypeScript errors. Reverted to best version.`)
|
|
5062
|
-
);
|
|
5061
|
+
console.log(chalk8.yellow(` \u26A0 AI fix regressed TypeScript errors. Reverted to best version.`));
|
|
5063
5062
|
} else {
|
|
5064
5063
|
codeToWrite = reFixed;
|
|
5065
5064
|
console.log(
|
|
@@ -5072,18 +5071,14 @@ Keep all existing functionality intact.`,
|
|
|
5072
5071
|
}
|
|
5073
5072
|
} catch (tscAiErr) {
|
|
5074
5073
|
console.log(
|
|
5075
|
-
chalk8.dim(
|
|
5076
|
-
` \u26A0 AI tsc fix skipped: ${tscAiErr instanceof Error ? tscAiErr.message : "unknown"}`
|
|
5077
|
-
)
|
|
5074
|
+
chalk8.dim(` \u26A0 AI tsc fix skipped: ${tscAiErr instanceof Error ? tscAiErr.message : "unknown"}`)
|
|
5078
5075
|
);
|
|
5079
5076
|
}
|
|
5080
5077
|
}
|
|
5081
5078
|
}
|
|
5082
5079
|
} catch (tscErr) {
|
|
5083
5080
|
console.log(
|
|
5084
|
-
chalk8.dim(
|
|
5085
|
-
` \u26A0 TypeScript check skipped: ${tscErr instanceof Error ? tscErr.message : "unknown"}`
|
|
5086
|
-
)
|
|
5081
|
+
chalk8.dim(` \u26A0 TypeScript check skipped: ${tscErr instanceof Error ? tscErr.message : "unknown"}`)
|
|
5087
5082
|
);
|
|
5088
5083
|
}
|
|
5089
5084
|
const pageIdx = dsm.getConfig().pages.findIndex((p) => p.id === page.id);
|
|
@@ -8825,9 +8820,7 @@ async function fixCommand(opts = {}) {
|
|
|
8825
8820
|
}
|
|
8826
8821
|
}
|
|
8827
8822
|
} catch (err) {
|
|
8828
|
-
console.log(
|
|
8829
|
-
chalk15.yellow(` \u26A0 TypeScript check skipped: ${err instanceof Error ? err.message : "unknown error"}`)
|
|
8830
|
-
);
|
|
8823
|
+
console.log(chalk15.yellow(` \u26A0 TypeScript check skipped: ${err instanceof Error ? err.message : "unknown error"}`));
|
|
8831
8824
|
}
|
|
8832
8825
|
if (fixes.length === 0 && totalErrors === 0 && totalWarnings === 0 && remaining.length === 0) {
|
|
8833
8826
|
console.log(chalk15.green("\n \u2705 Everything looks good \u2014 no issues found\n"));
|