mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-04 21:23:07 +00:00
refactor: implement gemini suggestions
This commit is contained in:
@@ -1286,17 +1286,13 @@ This mock response was generated because AUTOMAKER_MOCK_AGENT=true was set.
|
|||||||
const outputPath = path.join(featureDirForOutput, "agent-output.md");
|
const outputPath = path.join(featureDirForOutput, "agent-output.md");
|
||||||
|
|
||||||
// Incremental file writing state
|
// Incremental file writing state
|
||||||
let directoryCreated = false;
|
|
||||||
let writeTimeout: ReturnType<typeof setTimeout> | null = null;
|
let writeTimeout: ReturnType<typeof setTimeout> | null = null;
|
||||||
const WRITE_DEBOUNCE_MS = 500; // Batch writes every 500ms
|
const WRITE_DEBOUNCE_MS = 500; // Batch writes every 500ms
|
||||||
|
|
||||||
// Helper to write current responseText to file
|
// Helper to write current responseText to file
|
||||||
const writeToFile = async (): Promise<void> => {
|
const writeToFile = async (): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
if (!directoryCreated) {
|
|
||||||
await fs.mkdir(path.dirname(outputPath), { recursive: true });
|
await fs.mkdir(path.dirname(outputPath), { recursive: true });
|
||||||
directoryCreated = true;
|
|
||||||
}
|
|
||||||
await fs.writeFile(outputPath, responseText);
|
await fs.writeFile(outputPath, responseText);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Log but don't crash - file write errors shouldn't stop execution
|
// Log but don't crash - file write errors shouldn't stop execution
|
||||||
@@ -1310,9 +1306,7 @@ This mock response was generated because AUTOMAKER_MOCK_AGENT=true was set.
|
|||||||
clearTimeout(writeTimeout);
|
clearTimeout(writeTimeout);
|
||||||
}
|
}
|
||||||
writeTimeout = setTimeout(() => {
|
writeTimeout = setTimeout(() => {
|
||||||
writeToFile().catch((err) => {
|
writeToFile();
|
||||||
console.error(`[AutoMode] Debounced write error:`, err);
|
|
||||||
});
|
|
||||||
}, WRITE_DEBOUNCE_MS);
|
}, WRITE_DEBOUNCE_MS);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user