codex-supervisor-mcp 0.5.6 → 0.5.7

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.
@@ -0,0 +1,206 @@
1
+ // Is the running copy the latest published one? Asked once per MCP start and
2
+ // again every few hours, answered from the npm registry, cached on disk so a
3
+ // burst of MCP processes does not turn into a burst of registry calls.
4
+ //
5
+ // Two things are compared. The version, against the registry's `latest`
6
+ // dist-tag. And the tarball integrity: a global install records the
7
+ // integrity of what npm unpacked in node_modules/.package-lock.json, and
8
+ // the registry says what the integrity of that version should be. A
9
+ // mismatch means the files on disk are not the published build.
10
+ import { existsSync, readFileSync } from "node:fs";
11
+ import { mkdir, readFile, writeFile } from "node:fs/promises";
12
+ import { execFileSync } from "node:child_process";
13
+ import { dirname, join, resolve } from "node:path";
14
+ import { fileURLToPath } from "node:url";
15
+ import { dataDir } from "./paths.js";
16
+
17
+ const PACKAGE_NAME = "codex-supervisor-mcp";
18
+ const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
19
+ const packageJson = JSON.parse(readFileSync(join(packageRoot, "package.json"), "utf8"));
20
+
21
+ export const INSTALL_COMMAND = `npm i -g ${PACKAGE_NAME}@latest`;
22
+ const DEFAULT_REGISTRY = "https://registry.npmjs.org";
23
+ const CACHE_TTL_MS = 60 * 60 * 1000;
24
+ const cachePath = join(dataDir, "update-check.json");
25
+
26
+ function registryUrl() {
27
+ return (process.env.CODEX_SUPERVISOR_REGISTRY?.trim() || DEFAULT_REGISTRY).replace(/\/+$/, "");
28
+ }
29
+
30
+ function timeoutMs() {
31
+ const raw = Number(process.env.CODEX_SUPERVISOR_UPDATE_TIMEOUT_MS ?? 4000);
32
+ return Number.isFinite(raw) && raw > 0 ? raw : 4000;
33
+ }
34
+
35
+ export function updateCheckDisabled() {
36
+ return /^(1|true|yes)$/i.test(process.env.CODEX_SUPERVISOR_NO_UPDATE_CHECK?.trim() ?? "");
37
+ }
38
+
39
+ // "1.2.3" -> [1,2,3]; a prerelease tag sorts below the release it precedes.
40
+ export function parseVersion(text) {
41
+ const match = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?/.exec(String(text ?? "").trim());
42
+ if (!match) return null;
43
+ return { parts: [Number(match[1]), Number(match[2]), Number(match[3])], prerelease: match[4] ?? null };
44
+ }
45
+
46
+ export function compareVersions(a, b) {
47
+ const left = parseVersion(a);
48
+ const right = parseVersion(b);
49
+ if (!left || !right) return null;
50
+ for (let i = 0; i < 3; i += 1) {
51
+ if (left.parts[i] !== right.parts[i]) return left.parts[i] < right.parts[i] ? -1 : 1;
52
+ }
53
+ if (left.prerelease === right.prerelease) return 0;
54
+ if (left.prerelease === null) return 1;
55
+ if (right.prerelease === null) return -1;
56
+ return left.prerelease < right.prerelease ? -1 : 1;
57
+ }
58
+
59
+ // What is actually on disk: the version from package.json, plus whichever
60
+ // provenance is available - npm's recorded integrity for a global install,
61
+ // the HEAD commit for a git checkout.
62
+ export function installedPackage() {
63
+ const info = { name: PACKAGE_NAME, version: packageJson.version, path: packageRoot, integrity: null, commit: null, source: "unknown" };
64
+ const lockPath = join(packageRoot, "..", ".package-lock.json");
65
+ if (existsSync(lockPath)) {
66
+ try {
67
+ const lock = JSON.parse(readFileSync(lockPath, "utf8"));
68
+ const entry = lock.packages?.[`node_modules/${PACKAGE_NAME}`];
69
+ if (entry?.integrity) {
70
+ info.integrity = entry.integrity;
71
+ info.source = "npm";
72
+ }
73
+ } catch {
74
+ // unreadable lock: fall through, provenance stays unknown
75
+ }
76
+ }
77
+ if (!info.integrity && existsSync(join(packageRoot, ".git"))) {
78
+ try {
79
+ info.commit = execFileSync("git", ["-C", packageRoot, "rev-parse", "HEAD"], { encoding: "utf8", timeout: 5000, stdio: ["ignore", "pipe", "ignore"] }).trim();
80
+ info.source = "git";
81
+ } catch {
82
+ // not a usable checkout
83
+ }
84
+ }
85
+ return info;
86
+ }
87
+
88
+ async function fetchRegistry() {
89
+ const controller = new AbortController();
90
+ const timer = setTimeout(() => controller.abort(), timeoutMs());
91
+ try {
92
+ const response = await fetch(`${registryUrl()}/${PACKAGE_NAME}`, {
93
+ signal: controller.signal,
94
+ headers: { accept: "application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8" }
95
+ });
96
+ if (!response.ok) throw new Error(`registry answered ${response.status}`);
97
+ const body = await response.json();
98
+ const latestVersion = body?.["dist-tags"]?.latest;
99
+ if (!latestVersion || !parseVersion(latestVersion)) throw new Error("registry reply has no usable dist-tags.latest");
100
+ const dist = body.versions?.[latestVersion]?.dist ?? {};
101
+ return {
102
+ latest: {
103
+ version: latestVersion,
104
+ integrity: dist.integrity ?? null,
105
+ shasum: dist.shasum ?? null,
106
+ published_at: body.time?.[latestVersion] ?? null
107
+ },
108
+ versions: Object.fromEntries(
109
+ Object.entries(body.versions ?? {}).map(([version, meta]) => [version, { integrity: meta?.dist?.integrity ?? null }])
110
+ )
111
+ };
112
+ } finally {
113
+ clearTimeout(timer);
114
+ }
115
+ }
116
+
117
+ async function readCache() {
118
+ try {
119
+ return JSON.parse(await readFile(cachePath, "utf8"));
120
+ } catch {
121
+ return null;
122
+ }
123
+ }
124
+
125
+ async function writeCache(payload) {
126
+ try {
127
+ await mkdir(dataDir, { recursive: true });
128
+ await writeFile(cachePath, JSON.stringify(payload));
129
+ } catch {
130
+ // a cache that cannot be written only costs a registry call next time
131
+ }
132
+ }
133
+
134
+ // Pure: given what is installed and what the registry said, what to tell.
135
+ export function evaluateUpdate(installed, registry, { source, error }) {
136
+ const cmp = registry ? compareVersions(installed.version, registry.latest.version) : null;
137
+ const updateAvailable = cmp !== null && cmp < 0;
138
+ const expected = registry?.versions?.[installed.version]?.integrity ?? null;
139
+ const integrityMatches = installed.integrity && expected ? installed.integrity === expected : null;
140
+ let notice = null;
141
+ if (updateAvailable) {
142
+ notice = `codex-supervisor-mcp ${installed.version} is installed but ${registry.latest.version} is published. Run \`${INSTALL_COMMAND}\` and restart the MCP client.`;
143
+ } else if (integrityMatches === false) {
144
+ notice = `The installed codex-supervisor-mcp ${installed.version} does not match the published tarball (integrity differs). Reinstall with \`${INSTALL_COMMAND}\`.`;
145
+ }
146
+ return {
147
+ checked_at: new Date().toISOString(),
148
+ source,
149
+ error: error ?? null,
150
+ installed: { version: installed.version, integrity: installed.integrity, commit: installed.commit, source: installed.source, path: installed.path },
151
+ latest: registry?.latest ?? null,
152
+ update_available: updateAvailable,
153
+ integrity_matches: integrityMatches,
154
+ install_command: INSTALL_COMMAND,
155
+ notice
156
+ };
157
+ }
158
+
159
+ let inflight = null;
160
+
161
+ // The full answer. `force` skips the on-disk cache. Never throws: a registry
162
+ // that is down yields source: "offline" with the reason in `error`.
163
+ export async function checkForUpdate({ force = false } = {}) {
164
+ if (updateCheckDisabled()) {
165
+ return { ...evaluateUpdate(installedPackage(), null, { source: "disabled", error: null }), disabled: true };
166
+ }
167
+ if (inflight) return inflight;
168
+ inflight = (async () => {
169
+ const installed = installedPackage();
170
+ if (!force) {
171
+ const cached = await readCache();
172
+ const age = cached?.checked_at ? Date.now() - Date.parse(cached.checked_at) : Number.POSITIVE_INFINITY;
173
+ if (cached?.registry && age >= 0 && age < CACHE_TTL_MS && cached.registry_url === registryUrl()) {
174
+ return evaluateUpdate(installed, cached.registry, { source: "cache", error: null });
175
+ }
176
+ }
177
+ try {
178
+ const registry = await fetchRegistry();
179
+ await writeCache({ checked_at: new Date().toISOString(), registry_url: registryUrl(), registry });
180
+ return evaluateUpdate(installed, registry, { source: "registry", error: null });
181
+ } catch (error) {
182
+ const cached = await readCache();
183
+ if (cached?.registry && cached.registry_url === registryUrl()) {
184
+ return evaluateUpdate(installed, cached.registry, { source: "stale-cache", error: error.message });
185
+ }
186
+ return evaluateUpdate(installed, null, { source: "offline", error: error.message });
187
+ }
188
+ })().finally(() => {
189
+ inflight = null;
190
+ });
191
+ return inflight;
192
+ }
193
+
194
+ // The small object that rides along in tool results. Null when there is
195
+ // nothing to say, so the common case costs no bytes.
196
+ export function updateNotice(result) {
197
+ if (!result || !result.notice) return null;
198
+ return {
199
+ update_available: result.update_available,
200
+ installed_version: result.installed.version,
201
+ latest_version: result.latest?.version ?? null,
202
+ integrity_matches: result.integrity_matches,
203
+ install_command: result.install_command,
204
+ notice: result.notice
205
+ };
206
+ }
@@ -0,0 +1,302 @@
1
+ #!/usr/bin/env node
2
+ // A thin read-only web view over the supervisor store: which sessions exist,
3
+ // what each one is doing right now, and what every Codex thread under a
4
+ // session has done. It reads the same SQLite file the MCP server writes and
5
+ // never writes to it, apart from the same orphan reconcile every read does.
6
+ //
7
+ // codex-supervisor-web # http://127.0.0.1:7877
8
+ // SUPERVISOR_WEB_PORT=8080 codex-supervisor-web
9
+ import { createServer } from "node:http";
10
+ import { createReadStream, existsSync, statSync } from "node:fs";
11
+ import { extname, join, normalize, resolve } from "node:path";
12
+ import { fileURLToPath } from "node:url";
13
+ import {
14
+ getTask,
15
+ listTaskEventKinds,
16
+ readAgentMessages,
17
+ readSessions,
18
+ readTaskEvents,
19
+ readTasks,
20
+ reconcileDetachedActiveTasks
21
+ } from "./task-store.js";
22
+ import { readNativeGoal } from "./goal-store.js";
23
+ import { readTaskChanges } from "./worktree.js";
24
+ import { ACTIVE_STATUSES } from "./status.js";
25
+ import { supervisorRoot } from "./paths.js";
26
+ import { checkForUpdate } from "./update-check.js";
27
+
28
+ const here = fileURLToPath(new URL(".", import.meta.url));
29
+ const distDir = resolve(here, "..", "web", "dist");
30
+ const port = Number(process.env.SUPERVISOR_WEB_PORT ?? 7877);
31
+ const host = process.env.SUPERVISOR_WEB_HOST ?? "127.0.0.1";
32
+ const NO_SESSION = "none";
33
+
34
+ const MIME = {
35
+ ".html": "text/html; charset=utf-8",
36
+ ".js": "text/javascript; charset=utf-8",
37
+ ".css": "text/css; charset=utf-8",
38
+ ".json": "application/json; charset=utf-8",
39
+ ".svg": "image/svg+xml",
40
+ ".woff2": "font/woff2",
41
+ ".woff": "font/woff",
42
+ ".png": "image/png",
43
+ ".ico": "image/x-icon"
44
+ };
45
+
46
+ function clip(value, maxChars) {
47
+ if (value === null || value === undefined) return null;
48
+ const text = String(value);
49
+ return text.length <= maxChars ? text : `${text.slice(0, maxChars)}…`;
50
+ }
51
+
52
+ function durationMs(task) {
53
+ const start = Date.parse(task.started_at ?? task.created_at ?? "");
54
+ if (Number.isNaN(start)) return null;
55
+ const end = Date.parse(task.completed_at ?? "");
56
+ const stop = Number.isNaN(end) ? Date.now() : end;
57
+ return Math.max(0, stop - start);
58
+ }
59
+
60
+ // The row every list shows. No prompt, no raw events: those are per-worker
61
+ // reads, so a session with forty threads stays one cheap request.
62
+ function workerRow(task) {
63
+ return {
64
+ id: task.id,
65
+ title: task.title,
66
+ status: task.status,
67
+ phase: task.phase ?? null,
68
+ session_id: task.session_id ?? null,
69
+ thread_id: task.thread_id ?? null,
70
+ goal: task.goal_objective ?? null,
71
+ goal_status: task.goal_status ?? null,
72
+ model: task.model ?? null,
73
+ sandbox: task.sandbox,
74
+ project_root: task.project_root,
75
+ worktree_path: task.worktree_path ?? null,
76
+ branch: task.worktree_path ? `codex/${task.id}` : null,
77
+ base_commit: task.base_commit ?? null,
78
+ owned_paths: task.owned_paths ?? [],
79
+ depends_on: task.depends_on ?? [],
80
+ followup_of: task.followup_of ?? null,
81
+ resumed_from: task.resumed_from ?? null,
82
+ run_count: task.run_count ?? 0,
83
+ current_action: clip(task.current_action, 300),
84
+ last_message: clip(task.last_message, 400),
85
+ changed_file_count: liveChangeCount(task),
86
+ command_count: (task.commands ?? []).length,
87
+ error: task.error ?? null,
88
+ exit_code: task.exit_code ?? null,
89
+ pid: task.pid ?? null,
90
+ created_at: task.created_at || null,
91
+ started_at: task.started_at || null,
92
+ updated_at: task.updated_at || null,
93
+ completed_at: task.completed_at || null,
94
+ duration_ms: durationMs(task)
95
+ };
96
+ }
97
+
98
+ // Changed-file counts for the list. The stored changed_files on a row only
99
+ // knows about file_change events; the truth is the worktree diff, which costs
100
+ // two git calls per worker. Terminal rows never change again, so their count
101
+ // is memoised on (id, updated_at); running rows are re-read every time.
102
+ const changeCountCache = new Map();
103
+ function liveChangeCount(task) {
104
+ const key = `${task.id}:${task.updated_at}:${task.status}`;
105
+ const cached = changeCountCache.get(key);
106
+ if (cached !== undefined && !ACTIVE_STATUSES.has(task.status)) return cached;
107
+ const count = readTaskChanges(task).length;
108
+ changeCountCache.set(key, count);
109
+ if (changeCountCache.size > 2000) changeCountCache.delete(changeCountCache.keys().next().value);
110
+ return count;
111
+ }
112
+
113
+ function sessionKey(task) {
114
+ return task.session_id || NO_SESSION;
115
+ }
116
+
117
+ function latest(values) {
118
+ return values.filter(Boolean).sort().at(-1) ?? null;
119
+ }
120
+
121
+ // What a session is about. The title the main thread recorded wins; without
122
+ // one, the goals of its workers are the next best description.
123
+ function aboutSession(meta, tasks) {
124
+ if (meta?.title) return { title: meta.title, note: meta.note ?? null, derived: false };
125
+ const goals = Array.from(new Set(tasks.map((task) => task.goal_objective).filter(Boolean)));
126
+ const summary = goals.slice(0, 3).map((goal) => clip(goal, 60)).join(";");
127
+ return { title: summary || null, note: null, derived: true };
128
+ }
129
+
130
+ function sessionRow(key, tasks, meta = null) {
131
+ const counts = {};
132
+ for (const task of tasks) counts[task.status] = (counts[task.status] ?? 0) + 1;
133
+ const active = tasks.filter((task) => ACTIVE_STATUSES.has(task.status));
134
+ const byActivity = [...tasks].sort((a, b) => String(b.updated_at ?? "").localeCompare(String(a.updated_at ?? "")));
135
+ const lastReport = byActivity.find((task) => task.last_message);
136
+ const about = aboutSession(meta, tasks);
137
+ return {
138
+ id: key,
139
+ unsessioned: key === NO_SESSION,
140
+ title: about.title,
141
+ note: about.note,
142
+ title_derived: about.derived,
143
+ worker_count: tasks.length,
144
+ active_count: active.length,
145
+ counts,
146
+ project_roots: Array.from(new Set(tasks.map((task) => task.project_root).filter(Boolean))),
147
+ first_created_at: tasks.map((task) => task.created_at).filter(Boolean).sort()[0] ?? null,
148
+ last_activity_at: latest(tasks.map((task) => task.updated_at)),
149
+ // What the session is doing right now: one line per running thread.
150
+ now: active.map((task) => ({
151
+ id: task.id,
152
+ title: task.title,
153
+ phase: task.phase ?? null,
154
+ current_action: clip(task.current_action, 160)
155
+ })),
156
+ last_report: lastReport
157
+ ? { id: lastReport.id, title: lastReport.title, text: clip(lastReport.last_message, 240), at: lastReport.updated_at }
158
+ : null
159
+ };
160
+ }
161
+
162
+ async function overview() {
163
+ await reconcileDetachedActiveTasks();
164
+ const tasks = await readTasks();
165
+ const metas = new Map((await readSessions()).map((row) => [row.id, row]));
166
+ const groups = new Map();
167
+ for (const task of tasks) {
168
+ const key = sessionKey(task);
169
+ if (!groups.has(key)) groups.set(key, []);
170
+ groups.get(key).push(task);
171
+ }
172
+ const sessions = Array.from(groups, ([key, group]) => sessionRow(key, group, metas.get(key) ?? null)).sort((a, b) => {
173
+ if (a.active_count !== b.active_count) return b.active_count - a.active_count;
174
+ return String(b.last_activity_at ?? "").localeCompare(String(a.last_activity_at ?? ""));
175
+ });
176
+ return {
177
+ generated_at: new Date().toISOString(),
178
+ store: supervisorRoot,
179
+ total_workers: tasks.length,
180
+ active_workers: tasks.filter((task) => ACTIVE_STATUSES.has(task.status)).length,
181
+ sessions
182
+ };
183
+ }
184
+
185
+ async function session(key) {
186
+ await reconcileDetachedActiveTasks();
187
+ const tasks = (await readTasks()).filter((task) => sessionKey(task) === key);
188
+ if (tasks.length === 0) return null;
189
+ const meta = (await readSessions()).find((row) => row.id === key) ?? null;
190
+ return {
191
+ ...sessionRow(key, tasks, meta),
192
+ workers: tasks.map(workerRow)
193
+ };
194
+ }
195
+
196
+ async function worker(taskId) {
197
+ const task = await getTask(taskId);
198
+ if (!task) return null;
199
+ const reports = await readAgentMessages(taskId, 10);
200
+ // Token spend comes from Codex's own turn.completed usage blocks; one per
201
+ // run, so a resumed worker sums its runs.
202
+ const usage = { input_tokens: 0, cached_input_tokens: 0, output_tokens: 0, reasoning_output_tokens: 0, turns: 0 };
203
+ for (const event of await readTaskEvents(taskId, 50, ["turn.completed"])) {
204
+ const block = event?.usage ?? {};
205
+ usage.turns += 1;
206
+ for (const key of ["input_tokens", "cached_input_tokens", "output_tokens", "reasoning_output_tokens"]) {
207
+ usage[key] += Number(block[key] ?? 0) || 0;
208
+ }
209
+ }
210
+ const commands = (task.commands ?? []).slice(-40).map((entry) => ({
211
+ ...entry,
212
+ command: clip(entry.command, 600)
213
+ }));
214
+ return {
215
+ ...workerRow(task),
216
+ prompt: task.prompt ?? null,
217
+ changed_files: readTaskChanges(task),
218
+ commands,
219
+ reports: reports.length > 0 ? reports : task.last_message ? [task.last_message] : [],
220
+ native_goal: readNativeGoal(task.thread_id),
221
+ usage,
222
+ notices: task.notices ?? null,
223
+ run_log: task.run_log ?? null,
224
+ event_kinds: await listTaskEventKinds(taskId)
225
+ };
226
+ }
227
+
228
+ async function events(taskId, url) {
229
+ const limit = Math.min(1000, Math.max(1, Number(url.searchParams.get("limit") ?? 150)));
230
+ const kinds = url.searchParams.get("kinds")?.split(",").filter(Boolean) ?? null;
231
+ return { task_id: taskId, events: await readTaskEvents(taskId, limit, kinds) };
232
+ }
233
+
234
+ function json(res, status, body) {
235
+ const text = JSON.stringify(body);
236
+ res.writeHead(status, {
237
+ "content-type": "application/json; charset=utf-8",
238
+ "cache-control": "no-store",
239
+ "content-length": Buffer.byteLength(text)
240
+ });
241
+ res.end(text);
242
+ }
243
+
244
+ function serveStatic(res, pathname) {
245
+ if (!existsSync(distDir)) {
246
+ res.writeHead(503, { "content-type": "text/plain; charset=utf-8" });
247
+ res.end("web/dist is missing. Run `npm run web:build` first.\n");
248
+ return;
249
+ }
250
+ const safe = normalize(pathname).replace(/^(\.\.[/\\])+/, "");
251
+ let file = join(distDir, safe);
252
+ if (!file.startsWith(distDir)) {
253
+ res.writeHead(403);
254
+ res.end();
255
+ return;
256
+ }
257
+ if (!existsSync(file) || statSync(file).isDirectory()) file = join(distDir, "index.html");
258
+ const type = MIME[extname(file)] ?? "application/octet-stream";
259
+ res.writeHead(200, {
260
+ "content-type": type,
261
+ "cache-control": file.endsWith("index.html") ? "no-store" : "public, max-age=31536000, immutable"
262
+ });
263
+ createReadStream(file).pipe(res);
264
+ }
265
+
266
+ async function route(req, res) {
267
+ const url = new URL(req.url ?? "/", `http://${host}`);
268
+ const parts = url.pathname.split("/").filter(Boolean);
269
+ if (parts[0] !== "api") return serveStatic(res, url.pathname);
270
+ if (req.method !== "GET") return json(res, 405, { error: "method_not_allowed" });
271
+
272
+ if (parts[1] === "overview" && parts.length === 2) return json(res, 200, await overview());
273
+ if (parts[1] === "version" && parts.length === 2) {
274
+ return json(res, 200, await checkForUpdate({ force: url.searchParams.get("force") === "1" }));
275
+ }
276
+ if (parts[1] === "sessions" && parts.length === 3) {
277
+ const body = await session(decodeURIComponent(parts[2]));
278
+ return body ? json(res, 200, body) : json(res, 404, { error: "session_not_found" });
279
+ }
280
+ if (parts[1] === "workers" && parts.length === 3) {
281
+ const body = await worker(decodeURIComponent(parts[2]));
282
+ return body ? json(res, 200, body) : json(res, 404, { error: "task_not_found" });
283
+ }
284
+ if (parts[1] === "workers" && parts.length === 4 && parts[3] === "events") {
285
+ const taskId = decodeURIComponent(parts[2]);
286
+ if (!(await getTask(taskId))) return json(res, 404, { error: "task_not_found" });
287
+ return json(res, 200, await events(taskId, url));
288
+ }
289
+ return json(res, 404, { error: "not_found" });
290
+ }
291
+
292
+ const server = createServer((req, res) => {
293
+ route(req, res).catch((error) => {
294
+ process.stderr.write(`[codex-supervisor-web] ${error.stack ?? error.message}\n`);
295
+ if (!res.headersSent) json(res, 500, { error: "internal", message: error.message });
296
+ else res.end();
297
+ });
298
+ });
299
+
300
+ server.listen(port, host, () => {
301
+ process.stdout.write(`codex-supervisor web view on http://${host}:${port} (store: ${supervisorRoot})\n`);
302
+ });
package/src/worktree.js CHANGED
@@ -16,8 +16,12 @@ import { join } from "node:path";
16
16
 
17
17
  const defaultGitBin = process.env.GIT_BIN?.trim() || "git";
18
18
 
19
+ // core.quotePath is on by default and turns every non-ASCII path into an
20
+ // octal-escaped, double-quoted string ("\344\270\255..."). The projects
21
+ // this runs against have Chinese directory names, so it is switched off for
22
+ // every read here and paths come back as written.
19
23
  function git(worktreePath, args) {
20
- return execFileSync(defaultGitBin, ["-C", worktreePath, ...args], {
24
+ return execFileSync(defaultGitBin, ["-C", worktreePath, "-c", "core.quotePath=false", ...args], {
21
25
  encoding: "utf8",
22
26
  timeout: 15000,
23
27
  stdio: ["ignore", "pipe", "ignore"]