fix(coding-agent): speed up external editor launch (#6903)
* fix(coding-agent): speed up external editor launch Fixes #6774 * refactor(coding-agent): clarify external editor handling * refactor(coding-agent): simplify external editor result * refactor(coding-agent): model external editor lifecycle * fix(coding-agent): rename external editor test fake * fix(coding-agent): secure external editor temp files * fix(coding-agent): simplify external editor temp path * fix(coding-agent): restore system temp editor files
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { readdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
||||
import { dirname } from "node:path";
|
||||
|
||||
const capturePath = process.argv[2];
|
||||
const filePath = process.argv.at(-1);
|
||||
if (!capturePath || !filePath) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const directory = dirname(filePath);
|
||||
writeFileSync(
|
||||
capturePath,
|
||||
JSON.stringify({
|
||||
filePath,
|
||||
content: readFileSync(filePath, "utf-8"),
|
||||
entries: readdirSync(directory),
|
||||
directoryMode: statSync(directory).mode & 0o777,
|
||||
}),
|
||||
"utf-8",
|
||||
);
|
||||
|
||||
if (process.argv.includes("--fail")) {
|
||||
process.exit(1);
|
||||
}
|
||||
writeFileSync(filePath, process.argv.includes("--empty") ? "" : "edited\n", "utf-8");
|
||||
Reference in New Issue
Block a user