@neuralnomads/codenomad 0.14.0 → 0.16.0
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/cli-upgrade.js +53 -0
- package/dist/cli-upgrade.test.js +31 -0
- package/dist/filesystem/__tests__/browser.test.js +65 -0
- package/dist/filesystem/__tests__/search-cache.test.js +2 -2
- package/dist/filesystem/browser.js +40 -5
- package/dist/index.js +27 -6
- package/dist/opencode-plugin/codenomad-opencode-plugin.tgz +0 -0
- package/dist/opencode-plugin.js +146 -0
- package/dist/opencode-plugin.test.js +28 -0
- package/dist/previews/manager.js +63 -0
- package/dist/server/__tests__/remote-proxy.test.js +204 -0
- package/dist/server/http-server.js +380 -46
- package/dist/server/remote-proxy.js +466 -0
- package/dist/server/routes/filesystem.js +13 -0
- package/dist/server/routes/previews.js +25 -0
- package/dist/server/routes/remote-proxy.js +42 -0
- package/dist/server/routes/settings.js +1 -1
- package/dist/server/routes/workspaces.js +141 -1
- package/dist/workspaces/__tests__/git-clone.test.js +141 -0
- package/dist/workspaces/__tests__/git-worktrees.test.js +43 -0
- package/dist/workspaces/__tests__/spawn.test.js +158 -0
- package/dist/workspaces/git-clone.js +148 -0
- package/dist/workspaces/git-mutations.js +98 -0
- package/dist/workspaces/git-status.js +323 -0
- package/dist/workspaces/git-worktrees.js +18 -1
- package/dist/workspaces/manager.js +17 -9
- package/dist/workspaces/opencode-auth.js +18 -0
- package/dist/workspaces/opencode-auth.test.js +34 -0
- package/dist/workspaces/runtime.js +54 -77
- package/dist/workspaces/spawn.js +245 -0
- package/dist/workspaces/worktree-directory.js +74 -0
- package/package.json +3 -3
- package/public/assets/ChangesTab-CxrJwz2Z.js +2 -0
- package/public/assets/DiffToolbar-CqJttTgx.js +1 -0
- package/public/assets/FilesTab-tBrdrLID.js +2 -0
- package/public/assets/GitChangesTab-DUUJn4Va.js +2 -0
- package/public/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/public/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/public/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/public/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/public/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/public/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/public/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/public/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/public/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/public/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/public/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/public/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/public/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/public/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/public/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/public/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/public/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/public/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/public/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/public/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/public/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/public/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/public/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/public/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/public/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/public/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/public/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/public/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/public/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/public/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/public/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/public/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/public/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/public/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/public/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/public/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/public/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/public/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/public/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/public/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/public/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/public/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/public/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/public/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/public/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/public/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/public/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/public/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/public/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/public/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/public/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/public/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/public/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/public/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/public/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/public/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/public/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/public/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/public/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/public/assets/{SplitFilePanel-CupweEA5.js → SplitFilePanel-CiZrHI3o.js} +1 -1
- package/public/assets/StatusTab-DN31GijL.js +1 -0
- package/public/assets/align-justify-CKbOni6U.js +1 -0
- package/public/assets/{bundle-full-B-5u6Iv3.js → bundle-full-B_MbXXHv.js} +1 -1
- package/public/assets/{diff-viewer-_ehhYA-Z.js → diff-viewer-CersJruo.js} +1 -1
- package/public/assets/index-BTenW4sL.js +1 -0
- package/public/assets/index-BsYORY4z.js +1 -0
- package/public/assets/index-BvfQjuig.js +1 -0
- package/public/assets/{index-BqiNjV6R.js → index-CK51N0B7.js} +1 -1
- package/public/assets/index-Chghci_R.js +1 -0
- package/public/assets/{index-CxQr-wOF.js → index-DYa3o0_M.js} +1 -1
- package/public/assets/index-DskBWxXS.js +2 -0
- package/public/assets/index-DslkXxdb.js +1 -0
- package/public/assets/index-UCZ7MxNK.js +1 -0
- package/public/assets/index-i5UooSrU.css +1 -0
- package/public/assets/{loading-Dck2H3XH.js → loading-hkCubi3k.js} +1 -1
- package/public/assets/main-CXJTHRp1.js +62 -0
- package/public/assets/markdown-Cy9tCAXp.js +315 -0
- package/public/assets/monaco-viewer-B3iAKbO0.js +26 -0
- package/public/assets/tool-call-DhWimeRu.js +59 -0
- package/public/assets/{unified-picker-Dw0kTXoT.js → unified-picker-C47f5lFi.js} +1 -1
- package/public/assets/wrap-text-hwXbREuU.js +1 -0
- package/public/index.html +4 -4
- package/public/loading.html +4 -4
- package/public/sw.js +1 -1
- package/public/ui-version.json +1 -1
- package/dist/opencode-config/README.md +0 -32
- package/dist/opencode-config/opencode.jsonc +0 -3
- package/dist/opencode-config/package.json +0 -9
- package/dist/opencode-config/plugin/codenomad.ts +0 -62
- package/dist/opencode-config/plugin/lib/background-process.ts +0 -265
- package/dist/opencode-config/plugin/lib/client.ts +0 -133
- package/dist/opencode-config/plugin/lib/request.ts +0 -214
- package/dist/opencode-config.js +0 -26
- package/public/assets/ChangesTab-CFkk3tAp.js +0 -2
- package/public/assets/DiffToolbar-CQQLR1mp.js +0 -1
- package/public/assets/FilesTab-CXgucPtN.js +0 -2
- package/public/assets/GitChangesTab-BidSb28_.js +0 -2
- package/public/assets/StatusTab-C2Pl_Vce.js +0 -1
- package/public/assets/index-BnfDkr8C.js +0 -1
- package/public/assets/index-BntAaLZs.js +0 -1
- package/public/assets/index-BwCEJ4BE.css +0 -1
- package/public/assets/index-DXaitXVC.js +0 -1
- package/public/assets/index-DzRzoTK8.js +0 -2
- package/public/assets/index-ShHad48G.js +0 -1
- package/public/assets/index-_EaXFUIj.js +0 -1
- package/public/assets/index-mMh5TJvW.js +0 -1
- package/public/assets/main-BsIf5lOY.js +0 -50
- package/public/assets/markdown-CFV9kR80.js +0 -58
- package/public/assets/monaco-viewer-CMM6n0T3.js +0 -25
- package/public/assets/todo-Ghwirj-b.js +0 -1
- package/public/assets/tool-call-BC2Pv3uG.js +0 -60
- package/public/assets/wrap-text-D2MJk2ad.js +0 -1
|
@@ -1,77 +1,9 @@
|
|
|
1
1
|
import { spawn, spawnSync } from "child_process";
|
|
2
2
|
import { existsSync, statSync } from "fs";
|
|
3
3
|
import path from "path";
|
|
4
|
-
|
|
5
|
-
export const WINDOWS_POWERSHELL_EXTENSIONS = new Set([".ps1"]);
|
|
6
|
-
const VERSION_REGEX = /([0-9]+\.[0-9]+\.[0-9A-Za-z.-]+)/;
|
|
7
|
-
export function buildSpawnSpec(binaryPath, args) {
|
|
8
|
-
if (process.platform !== "win32") {
|
|
9
|
-
return { command: binaryPath, args, options: {} };
|
|
10
|
-
}
|
|
11
|
-
const extension = path.extname(binaryPath).toLowerCase();
|
|
12
|
-
if (WINDOWS_CMD_EXTENSIONS.has(extension)) {
|
|
13
|
-
const comspec = process.env.ComSpec || "cmd.exe";
|
|
14
|
-
// cmd.exe requires the full command as a single string.
|
|
15
|
-
// Using the ""<script> <args>"" pattern ensures paths with spaces are handled.
|
|
16
|
-
const commandLine = `""${binaryPath}" ${args.join(" ")}"`;
|
|
17
|
-
return {
|
|
18
|
-
command: comspec,
|
|
19
|
-
args: ["/d", "/s", "/c", commandLine],
|
|
20
|
-
options: { windowsVerbatimArguments: true },
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
if (WINDOWS_POWERSHELL_EXTENSIONS.has(extension)) {
|
|
24
|
-
// powershell.exe ships with Windows. (pwsh may not.)
|
|
25
|
-
return {
|
|
26
|
-
command: "powershell.exe",
|
|
27
|
-
args: ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", binaryPath, ...args],
|
|
28
|
-
options: {},
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
return { command: binaryPath, args, options: {} };
|
|
32
|
-
}
|
|
33
|
-
export function probeBinaryVersion(binaryPath) {
|
|
34
|
-
if (!binaryPath) {
|
|
35
|
-
return { valid: false, error: "Missing binary path" };
|
|
36
|
-
}
|
|
37
|
-
const spec = buildSpawnSpec(binaryPath, ["--version"]);
|
|
38
|
-
try {
|
|
39
|
-
const result = spawnSync(spec.command, spec.args, {
|
|
40
|
-
encoding: "utf8",
|
|
41
|
-
windowsVerbatimArguments: Boolean(spec.options.windowsVerbatimArguments),
|
|
42
|
-
});
|
|
43
|
-
if (result.error) {
|
|
44
|
-
return { valid: false, error: result.error.message };
|
|
45
|
-
}
|
|
46
|
-
if (result.status !== 0) {
|
|
47
|
-
const stderr = result.stderr?.trim();
|
|
48
|
-
const stdout = result.stdout?.trim();
|
|
49
|
-
const combined = stderr || stdout;
|
|
50
|
-
const error = combined ? `Exited with code ${result.status}: ${combined}` : `Exited with code ${result.status}`;
|
|
51
|
-
return { valid: false, error };
|
|
52
|
-
}
|
|
53
|
-
const stdoutLines = String(result.stdout ?? "")
|
|
54
|
-
.split(/\r?\n/)
|
|
55
|
-
.map((line) => line.trim())
|
|
56
|
-
.filter((line) => line.length > 0);
|
|
57
|
-
const stderrLines = String(result.stderr ?? "")
|
|
58
|
-
.split(/\r?\n/)
|
|
59
|
-
.map((line) => line.trim())
|
|
60
|
-
.filter((line) => line.length > 0);
|
|
61
|
-
// Prefer stdout; fall back to stderr (some tools report version there).
|
|
62
|
-
const reported = stdoutLines[0] ?? stderrLines[0];
|
|
63
|
-
if (!reported) {
|
|
64
|
-
return { valid: true };
|
|
65
|
-
}
|
|
66
|
-
const versionMatch = reported.match(VERSION_REGEX);
|
|
67
|
-
const version = versionMatch?.[1];
|
|
68
|
-
return { valid: true, version, reported };
|
|
69
|
-
}
|
|
70
|
-
catch (error) {
|
|
71
|
-
return { valid: false, error: error instanceof Error ? error.message : String(error) };
|
|
72
|
-
}
|
|
73
|
-
}
|
|
4
|
+
import { buildSpawnSpec, buildWslSignalSpec } from "./spawn";
|
|
74
5
|
const SENSITIVE_ENV_KEY = /(PASSWORD|TOKEN|SECRET)/i;
|
|
6
|
+
const WSL_PID_MARKER = "__CODENOMAD_WSL_PID__:";
|
|
75
7
|
function redactEnvironment(env) {
|
|
76
8
|
const redacted = {};
|
|
77
9
|
for (const [key, value] of Object.entries(env)) {
|
|
@@ -115,7 +47,13 @@ export class WorkspaceRuntime {
|
|
|
115
47
|
return combined.join("\n");
|
|
116
48
|
};
|
|
117
49
|
return new Promise((resolve, reject) => {
|
|
118
|
-
const
|
|
50
|
+
const propagatedEnvKeys = Object.keys(options.environment ?? {});
|
|
51
|
+
const spec = buildSpawnSpec(options.binaryPath, args, {
|
|
52
|
+
cwd: options.folder,
|
|
53
|
+
env,
|
|
54
|
+
propagateEnvKeys: propagatedEnvKeys,
|
|
55
|
+
wslPidMarker: WSL_PID_MARKER,
|
|
56
|
+
});
|
|
119
57
|
const commandLine = [spec.command, ...spec.args].join(" ");
|
|
120
58
|
this.logger.info({
|
|
121
59
|
workspaceId: options.workspaceId,
|
|
@@ -134,13 +72,17 @@ export class WorkspaceRuntime {
|
|
|
134
72
|
}, "OpenCode spawn environment");
|
|
135
73
|
const detached = process.platform !== "win32";
|
|
136
74
|
const child = spawn(spec.command, spec.args, {
|
|
137
|
-
cwd:
|
|
138
|
-
env,
|
|
75
|
+
cwd: spec.cwd,
|
|
76
|
+
env: spec.env,
|
|
139
77
|
stdio: ["ignore", "pipe", "pipe"],
|
|
140
78
|
detached,
|
|
141
79
|
...spec.options,
|
|
142
80
|
});
|
|
143
|
-
const managed = {
|
|
81
|
+
const managed = {
|
|
82
|
+
child,
|
|
83
|
+
requestedStop: false,
|
|
84
|
+
...(spec.wsl ? { wsl: { distro: spec.wsl.distro, linuxPid: null } } : {}),
|
|
85
|
+
};
|
|
144
86
|
this.processes.set(options.workspaceId, managed);
|
|
145
87
|
let stdoutBuffer = "";
|
|
146
88
|
let stderrBuffer = "";
|
|
@@ -210,6 +152,14 @@ export class WorkspaceRuntime {
|
|
|
210
152
|
const trimmed = line.trim();
|
|
211
153
|
if (!trimmed)
|
|
212
154
|
continue;
|
|
155
|
+
if (managed.wsl && trimmed.startsWith(WSL_PID_MARKER)) {
|
|
156
|
+
const linuxPid = Number.parseInt(trimmed.slice(WSL_PID_MARKER.length), 10);
|
|
157
|
+
if (Number.isFinite(linuxPid) && linuxPid > 0) {
|
|
158
|
+
managed.wsl.linuxPid = linuxPid;
|
|
159
|
+
this.logger.debug({ workspaceId: options.workspaceId, linuxPid }, "Captured WSL OpenCode PID");
|
|
160
|
+
}
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
213
163
|
recentStdout.push(trimmed);
|
|
214
164
|
if (recentStdout.length > MAX_OUTPUT_LINES) {
|
|
215
165
|
recentStdout.shift();
|
|
@@ -314,11 +264,38 @@ export class WorkspaceRuntime {
|
|
|
314
264
|
return false;
|
|
315
265
|
}
|
|
316
266
|
};
|
|
267
|
+
const trySignalWslProcess = (signal) => {
|
|
268
|
+
if (process.platform !== "win32" || !managed.wsl?.linuxPid) {
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
try {
|
|
272
|
+
const spec = buildWslSignalSpec(managed.wsl.distro, managed.wsl.linuxPid, signal);
|
|
273
|
+
const result = spawnSync(spec.command, spec.args, { encoding: "utf8" });
|
|
274
|
+
const exitCode = result.status;
|
|
275
|
+
if (exitCode === 0) {
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
const stderr = (result.stderr ?? "").toString().toLowerCase();
|
|
279
|
+
const stdout = (result.stdout ?? "").toString().toLowerCase();
|
|
280
|
+
const combined = `${stdout}\n${stderr}`;
|
|
281
|
+
if (combined.includes("no such process") || combined.includes("not found")) {
|
|
282
|
+
return true;
|
|
283
|
+
}
|
|
284
|
+
this.logger.debug({ workspaceId, pid, linuxPid: managed.wsl.linuxPid, distro: managed.wsl.distro, exitCode, stderr: result.stderr, stdout: result.stdout }, "WSL kill failed");
|
|
285
|
+
return false;
|
|
286
|
+
}
|
|
287
|
+
catch (error) {
|
|
288
|
+
this.logger.debug({ workspaceId, pid, linuxPid: managed.wsl.linuxPid, distro: managed.wsl.distro, err: error }, "WSL kill failed to execute");
|
|
289
|
+
return false;
|
|
290
|
+
}
|
|
291
|
+
};
|
|
317
292
|
const sendStopSignal = (signal) => {
|
|
318
293
|
if (process.platform === "win32") {
|
|
319
|
-
//
|
|
320
|
-
|
|
321
|
-
|
|
294
|
+
// WSL-backed launches need a Linux signal first because the tracked Windows PID belongs to wsl.exe.
|
|
295
|
+
if (!trySignalWslProcess(signal)) {
|
|
296
|
+
// Fallback to the Windows process tree rooted at pid. Use /F only for escalation.
|
|
297
|
+
tryTaskkill(signal === "SIGKILL");
|
|
298
|
+
}
|
|
322
299
|
return;
|
|
323
300
|
}
|
|
324
301
|
// Prefer process-group signaling so wrapper launchers (bun/node) don't orphan the real server.
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { spawnSync } from "child_process";
|
|
2
|
+
import path from "path";
|
|
3
|
+
export const WINDOWS_CMD_EXTENSIONS = new Set([".cmd", ".bat"]);
|
|
4
|
+
export const WINDOWS_POWERSHELL_EXTENSIONS = new Set([".ps1"]);
|
|
5
|
+
const VERSION_REGEX = /([0-9]+\.[0-9]+\.[0-9A-Za-z.-]+)/;
|
|
6
|
+
const WSL_UNC_PATH_REGEX = /^\\\\wsl(?:\.localhost|\$)\\([^\\/]+)(?:[\\/](.*))?$/i;
|
|
7
|
+
const CODENOMAD_PLUGIN_PACKAGE_NAME = "@codenomad/codenomad-opencode-plugin";
|
|
8
|
+
const WSL_PLUGIN_PATH_ENV = "CODENOMAD_OPENCODE_PLUGIN_WSL_PATH";
|
|
9
|
+
const WSL_PLUGIN_PATH_PLACEHOLDER = "__CODENOMAD_OPENCODE_PLUGIN_WSL_PATH__";
|
|
10
|
+
const CODENOMAD_PLUGIN_FILE_SPEC_REGEX = new RegExp(`(${escapeRegex(CODENOMAD_PLUGIN_PACKAGE_NAME)}@file:)([A-Za-z]:[^"\\r\\n]+?\\.tgz)`);
|
|
11
|
+
const WSL_PATH_ENV_KEYS = new Set(["NODE_EXTRA_CA_CERTS", WSL_PLUGIN_PATH_ENV]);
|
|
12
|
+
export function parseWslUncPath(input) {
|
|
13
|
+
const normalized = input.trim().replace(/\//g, "\\");
|
|
14
|
+
const match = normalized.match(WSL_UNC_PATH_REGEX);
|
|
15
|
+
if (!match) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const distro = match[1] ?? "";
|
|
19
|
+
const remainder = match[2] ?? "";
|
|
20
|
+
const segments = remainder.split(/\\+/).filter((segment) => segment.length > 0);
|
|
21
|
+
return {
|
|
22
|
+
distro,
|
|
23
|
+
linuxPath: segments.length > 0 ? `/${segments.join("/")}` : "/",
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export function resolveWslWorkingDirectory(folder, distro) {
|
|
27
|
+
const wslFolder = parseWslUncPath(folder);
|
|
28
|
+
if (wslFolder) {
|
|
29
|
+
return wslFolder.distro.toLowerCase() === distro.toLowerCase() ? { kind: "linux", path: wslFolder.linuxPath } : null;
|
|
30
|
+
}
|
|
31
|
+
const windowsFolder = normalizeWindowsPath(folder);
|
|
32
|
+
return windowsFolder ? { kind: "windows", path: windowsFolder } : null;
|
|
33
|
+
}
|
|
34
|
+
export function buildWindowsSpawnSpec(binaryPath, args, options = {}) {
|
|
35
|
+
const wslPath = parseWslUncPath(binaryPath);
|
|
36
|
+
if (wslPath) {
|
|
37
|
+
return buildWslSpawnSpec(wslPath, args, options);
|
|
38
|
+
}
|
|
39
|
+
const extension = path.extname(binaryPath).toLowerCase();
|
|
40
|
+
if (WINDOWS_CMD_EXTENSIONS.has(extension)) {
|
|
41
|
+
const comspec = process.env.ComSpec || "cmd.exe";
|
|
42
|
+
// cmd.exe requires the full command as a single string.
|
|
43
|
+
// Using the ""<script> <args>"" pattern ensures paths with spaces are handled.
|
|
44
|
+
const commandLine = `""${binaryPath}" ${args.join(" ")}"`;
|
|
45
|
+
return {
|
|
46
|
+
command: comspec,
|
|
47
|
+
args: ["/d", "/s", "/c", commandLine],
|
|
48
|
+
options: { windowsVerbatimArguments: true },
|
|
49
|
+
cwd: options.cwd,
|
|
50
|
+
env: options.env,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
if (WINDOWS_POWERSHELL_EXTENSIONS.has(extension)) {
|
|
54
|
+
// powershell.exe ships with Windows. (pwsh may not.)
|
|
55
|
+
return {
|
|
56
|
+
command: "powershell.exe",
|
|
57
|
+
args: ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", binaryPath, ...args],
|
|
58
|
+
options: {},
|
|
59
|
+
cwd: options.cwd,
|
|
60
|
+
env: options.env,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
command: binaryPath,
|
|
65
|
+
args,
|
|
66
|
+
options: {},
|
|
67
|
+
cwd: options.cwd,
|
|
68
|
+
env: options.env,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export function buildSpawnSpec(binaryPath, args, options = {}) {
|
|
72
|
+
if (process.platform !== "win32") {
|
|
73
|
+
return {
|
|
74
|
+
command: binaryPath,
|
|
75
|
+
args,
|
|
76
|
+
options: {},
|
|
77
|
+
cwd: options.cwd,
|
|
78
|
+
env: options.env,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
return buildWindowsSpawnSpec(binaryPath, args, options);
|
|
82
|
+
}
|
|
83
|
+
export function buildWslSignalSpec(distro, linuxPid, signal) {
|
|
84
|
+
return {
|
|
85
|
+
command: "wsl.exe",
|
|
86
|
+
args: ["--distribution", distro, "--exec", "kill", signal === "SIGKILL" ? "-KILL" : "-TERM", String(linuxPid)],
|
|
87
|
+
options: {},
|
|
88
|
+
wsl: { distro },
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
export function probeBinaryVersion(binaryPath) {
|
|
92
|
+
if (!binaryPath) {
|
|
93
|
+
return { valid: false, error: "Missing binary path" };
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
const spec = buildSpawnSpec(binaryPath, ["--version"]);
|
|
97
|
+
const result = spawnSync(spec.command, spec.args, {
|
|
98
|
+
encoding: "utf8",
|
|
99
|
+
cwd: spec.cwd,
|
|
100
|
+
env: spec.env,
|
|
101
|
+
windowsVerbatimArguments: Boolean(spec.options.windowsVerbatimArguments),
|
|
102
|
+
});
|
|
103
|
+
if (result.error) {
|
|
104
|
+
return { valid: false, error: result.error.message };
|
|
105
|
+
}
|
|
106
|
+
if (result.status !== 0) {
|
|
107
|
+
const stderr = result.stderr?.trim();
|
|
108
|
+
const stdout = result.stdout?.trim();
|
|
109
|
+
const combined = stderr || stdout;
|
|
110
|
+
const error = combined ? `Exited with code ${result.status}: ${combined}` : `Exited with code ${result.status}`;
|
|
111
|
+
return { valid: false, error };
|
|
112
|
+
}
|
|
113
|
+
const stdoutLines = String(result.stdout ?? "")
|
|
114
|
+
.split(/\r?\n/)
|
|
115
|
+
.map((line) => line.trim())
|
|
116
|
+
.filter((line) => line.length > 0);
|
|
117
|
+
const stderrLines = String(result.stderr ?? "")
|
|
118
|
+
.split(/\r?\n/)
|
|
119
|
+
.map((line) => line.trim())
|
|
120
|
+
.filter((line) => line.length > 0);
|
|
121
|
+
// Prefer stdout; fall back to stderr (some tools report version there).
|
|
122
|
+
const reported = stdoutLines[0] ?? stderrLines[0];
|
|
123
|
+
if (!reported) {
|
|
124
|
+
return { valid: true };
|
|
125
|
+
}
|
|
126
|
+
const versionMatch = reported.match(VERSION_REGEX);
|
|
127
|
+
const version = versionMatch?.[1];
|
|
128
|
+
return { valid: true, version, reported };
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
return { valid: false, error: error instanceof Error ? error.message : String(error) };
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function buildWslSpawnSpec(wslPath, args, options) {
|
|
135
|
+
const workingDirectory = options.cwd ? resolveWslWorkingDirectory(options.cwd, wslPath.distro) : undefined;
|
|
136
|
+
const env = buildWslEnvironment(options.env, options.propagateEnvKeys);
|
|
137
|
+
const shouldTranslatePluginPath = Boolean(env?.[WSL_PLUGIN_PATH_ENV]);
|
|
138
|
+
if (options.cwd && !workingDirectory) {
|
|
139
|
+
throw new Error(`Unable to translate workspace folder for WSL binary in distro "${wslPath.distro}": ${options.cwd}`);
|
|
140
|
+
}
|
|
141
|
+
const wslArgs = ["--distribution", wslPath.distro];
|
|
142
|
+
const shouldWrapWithShell = Boolean(options.wslPidMarker) || workingDirectory?.kind === "windows" || shouldTranslatePluginPath;
|
|
143
|
+
if (!shouldWrapWithShell && workingDirectory?.kind === "linux") {
|
|
144
|
+
wslArgs.push("--cd", workingDirectory.path);
|
|
145
|
+
}
|
|
146
|
+
if (shouldWrapWithShell) {
|
|
147
|
+
const launchScript = buildWslLaunchScript(workingDirectory ?? undefined, options.wslPidMarker, shouldTranslatePluginPath);
|
|
148
|
+
wslArgs.push("--exec", "sh", "-lc", launchScript, "codenomad-wsl-launch");
|
|
149
|
+
if (workingDirectory) {
|
|
150
|
+
wslArgs.push(workingDirectory.path);
|
|
151
|
+
}
|
|
152
|
+
wslArgs.push(wslPath.linuxPath, ...args);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
wslArgs.push("--exec", wslPath.linuxPath, ...args);
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
command: "wsl.exe",
|
|
159
|
+
args: wslArgs,
|
|
160
|
+
options: {},
|
|
161
|
+
env,
|
|
162
|
+
wsl: { distro: wslPath.distro, pidMarker: options.wslPidMarker },
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
function buildWslLaunchScript(workingDirectory, pidMarker, translatePluginPath) {
|
|
166
|
+
const steps = [];
|
|
167
|
+
if (pidMarker) {
|
|
168
|
+
steps.push(`printf '%s%s\\n' '${pidMarker}' "$$"`);
|
|
169
|
+
}
|
|
170
|
+
if (workingDirectory?.kind === "linux") {
|
|
171
|
+
steps.push('cd "$1"');
|
|
172
|
+
steps.push("shift");
|
|
173
|
+
}
|
|
174
|
+
else if (workingDirectory?.kind === "windows") {
|
|
175
|
+
steps.push('cd "$(wslpath -au "$1")"');
|
|
176
|
+
steps.push("shift");
|
|
177
|
+
}
|
|
178
|
+
if (translatePluginPath) {
|
|
179
|
+
steps.push(`if [ -n "$${WSL_PLUGIN_PATH_ENV}" ] && [ -n "$OPENCODE_CONFIG_CONTENT" ]; then escaped_plugin_path=$(printf '%s' "$${WSL_PLUGIN_PATH_ENV}" | sed 's/[\\&|]/\\\\&/g'); OPENCODE_CONFIG_CONTENT=$(printf '%s' "$OPENCODE_CONFIG_CONTENT" | sed "s|${WSL_PLUGIN_PATH_PLACEHOLDER}|$escaped_plugin_path|g"); export OPENCODE_CONFIG_CONTENT; unset ${WSL_PLUGIN_PATH_ENV}; fi`);
|
|
180
|
+
}
|
|
181
|
+
steps.push('exec "$@"');
|
|
182
|
+
return steps.join(" && ");
|
|
183
|
+
}
|
|
184
|
+
function normalizeWindowsPath(input) {
|
|
185
|
+
const normalized = path.win32.normalize(input.trim().replace(/\//g, "\\"));
|
|
186
|
+
if (!normalized) {
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
if (/^[A-Za-z]:/.test(normalized) || normalized.startsWith("\\\\")) {
|
|
190
|
+
return normalized;
|
|
191
|
+
}
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
function buildWslEnvironment(env, propagateEnvKeys) {
|
|
195
|
+
if (!env) {
|
|
196
|
+
return env;
|
|
197
|
+
}
|
|
198
|
+
const next = { ...env };
|
|
199
|
+
rewriteOpencodePluginPathForWsl(next);
|
|
200
|
+
const keysToPropagate = Array.from(new Set([
|
|
201
|
+
...(propagateEnvKeys ?? []).filter((key) => next[key] !== undefined),
|
|
202
|
+
...Array.from(WSL_PATH_ENV_KEYS).filter((key) => next[key] !== undefined),
|
|
203
|
+
]));
|
|
204
|
+
if (keysToPropagate.length === 0) {
|
|
205
|
+
return next;
|
|
206
|
+
}
|
|
207
|
+
const entries = (next.WSLENV ?? "").split(":").filter((entry) => entry.length > 0);
|
|
208
|
+
const byName = new Map(entries.map((entry) => [entry.split("/")[0] ?? entry, entry]));
|
|
209
|
+
for (const key of keysToPropagate) {
|
|
210
|
+
const existingEntry = byName.get(key);
|
|
211
|
+
if (existingEntry) {
|
|
212
|
+
byName.set(key, ensureWslenvEntry(existingEntry, WSL_PATH_ENV_KEYS.has(key)));
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
byName.set(key, WSL_PATH_ENV_KEYS.has(key) ? `${key}/p` : key);
|
|
216
|
+
}
|
|
217
|
+
next.WSLENV = Array.from(byName.values()).join(":");
|
|
218
|
+
return next;
|
|
219
|
+
}
|
|
220
|
+
function rewriteOpencodePluginPathForWsl(env) {
|
|
221
|
+
const content = env.OPENCODE_CONFIG_CONTENT;
|
|
222
|
+
if (!content) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
const match = content.match(CODENOMAD_PLUGIN_FILE_SPEC_REGEX);
|
|
226
|
+
const hostPath = match?.[2];
|
|
227
|
+
if (!hostPath) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
env.OPENCODE_CONFIG_CONTENT = content.replace(hostPath, WSL_PLUGIN_PATH_PLACEHOLDER);
|
|
231
|
+
env[WSL_PLUGIN_PATH_ENV] = path.win32.normalize(hostPath);
|
|
232
|
+
}
|
|
233
|
+
function ensureWslenvEntry(entry, requiresPathTranslation) {
|
|
234
|
+
if (!requiresPathTranslation) {
|
|
235
|
+
return entry;
|
|
236
|
+
}
|
|
237
|
+
const [name, rawFlags = ""] = entry.split("/");
|
|
238
|
+
if (rawFlags.includes("p")) {
|
|
239
|
+
return entry;
|
|
240
|
+
}
|
|
241
|
+
return rawFlags.length > 0 ? `${name}/${rawFlags}p` : `${name}/p`;
|
|
242
|
+
}
|
|
243
|
+
function escapeRegex(input) {
|
|
244
|
+
return input.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
245
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { realpath } from "fs/promises";
|
|
2
|
+
import { listWorktrees, resolveRepoRoot } from "./git-worktrees";
|
|
3
|
+
const WORKTREE_CACHE_TTL_MS = 2000;
|
|
4
|
+
const worktreeCache = new Map();
|
|
5
|
+
async function normalizeDirectoryPath(directory) {
|
|
6
|
+
const trimmed = (directory ?? "").trim();
|
|
7
|
+
if (!trimmed)
|
|
8
|
+
return "";
|
|
9
|
+
try {
|
|
10
|
+
return await realpath(trimmed);
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return trimmed;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
async function getCachedWorktrees(params) {
|
|
17
|
+
const cached = worktreeCache.get(params.workspaceId);
|
|
18
|
+
const now = Date.now();
|
|
19
|
+
if (cached && cached.expiresAt > now) {
|
|
20
|
+
return cached;
|
|
21
|
+
}
|
|
22
|
+
const { repoRoot } = await resolveRepoRoot(params.workspacePath, params.logger);
|
|
23
|
+
const worktrees = await listWorktrees({ repoRoot, workspaceFolder: params.workspacePath, logger: params.logger });
|
|
24
|
+
const entry = {
|
|
25
|
+
expiresAt: now + WORKTREE_CACHE_TTL_MS,
|
|
26
|
+
repoRoot,
|
|
27
|
+
worktrees: await Promise.all(worktrees.map(async (wt) => ({
|
|
28
|
+
slug: wt.slug,
|
|
29
|
+
directory: wt.directory,
|
|
30
|
+
normalizedDirectory: await normalizeDirectoryPath(wt.directory),
|
|
31
|
+
}))),
|
|
32
|
+
};
|
|
33
|
+
worktreeCache.set(params.workspaceId, entry);
|
|
34
|
+
return entry;
|
|
35
|
+
}
|
|
36
|
+
export async function resolveWorktreeDirectory(params) {
|
|
37
|
+
const cached = await getCachedWorktrees({
|
|
38
|
+
workspaceId: params.workspaceId,
|
|
39
|
+
workspacePath: params.workspacePath,
|
|
40
|
+
logger: params.logger,
|
|
41
|
+
});
|
|
42
|
+
const match = cached.worktrees.find((wt) => wt.slug === params.worktreeSlug);
|
|
43
|
+
if (match) {
|
|
44
|
+
return match.directory;
|
|
45
|
+
}
|
|
46
|
+
worktreeCache.delete(params.workspaceId);
|
|
47
|
+
const refreshed = await getCachedWorktrees({
|
|
48
|
+
workspaceId: params.workspaceId,
|
|
49
|
+
workspacePath: params.workspacePath,
|
|
50
|
+
logger: params.logger,
|
|
51
|
+
});
|
|
52
|
+
return refreshed.worktrees.find((wt) => wt.slug === params.worktreeSlug)?.directory ?? null;
|
|
53
|
+
}
|
|
54
|
+
export async function resolveWorktreeSlugForDirectory(params) {
|
|
55
|
+
const target = await normalizeDirectoryPath(params.directory ?? "");
|
|
56
|
+
if (!target)
|
|
57
|
+
return null;
|
|
58
|
+
const cached = await getCachedWorktrees({
|
|
59
|
+
workspaceId: params.workspaceId,
|
|
60
|
+
workspacePath: params.workspacePath,
|
|
61
|
+
logger: params.logger,
|
|
62
|
+
});
|
|
63
|
+
const match = cached.worktrees.find((wt) => wt.normalizedDirectory === target);
|
|
64
|
+
if (match) {
|
|
65
|
+
return match.slug;
|
|
66
|
+
}
|
|
67
|
+
worktreeCache.delete(params.workspaceId);
|
|
68
|
+
const refreshed = await getCachedWorktrees({
|
|
69
|
+
workspaceId: params.workspaceId,
|
|
70
|
+
workspacePath: params.workspacePath,
|
|
71
|
+
logger: params.logger,
|
|
72
|
+
});
|
|
73
|
+
return refreshed.worktrees.find((wt) => wt.normalizedDirectory === target)?.slug ?? null;
|
|
74
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neuralnomads/codenomad",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "CodeNomad Server",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
"codenomad": "dist/bin.js"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
|
-
"build": "npm run build:ui && npm run prepare-ui && tsc -p tsconfig.json && node ./scripts/copy-auth-pages.mjs && npm run prepare-
|
|
20
|
+
"build": "npm run build:ui && npm run prepare-ui && tsc -p tsconfig.json && node ./scripts/copy-auth-pages.mjs && npm run prepare-plugin",
|
|
21
21
|
"build:ui": "npm run build --prefix ../ui",
|
|
22
22
|
"prepare-ui": "node ./scripts/copy-ui-dist.mjs",
|
|
23
|
-
"prepare-
|
|
23
|
+
"prepare-plugin": "node ./scripts/package-opencode-plugin.mjs",
|
|
24
24
|
"dev": "cross-env CODENOMAD_DEV=1 CODENOMAD_SERVER_PASSWORD=codenomad-dev CLI_UI_DEV_SERVER=http://localhost:3000 CLI_HTTPS=false CLI_HTTP=true tsx src/index.ts",
|
|
25
25
|
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
26
26
|
},
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-viewer-B3iAKbO0.js","assets/git-diff-vendor-CSgooKT_.js","assets/fast-diff-vendor-DgdwVvTQ.js","assets/highlight-vendor-8FKMu9os.js","assets/git-diff-vendor-HAZkIolJ.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as K}from"./index-DskBWxXS.js";import{m as B,t as g,i as a,d as w,a as z,f as N}from"./monaco-viewer-B3iAKbO0.js";import{c as f,n as c,a as L,F,S as W,z as j,A as q}from"./git-diff-vendor-CSgooKT_.js";import{D as G}from"./DiffToolbar-CqJttTgx.js";import{S as H}from"./SplitFilePanel-CiZrHI3o.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";import"./main-CXJTHRp1.js";import"./align-justify-CKbOni6U.js";import"./wrap-text-hwXbREuU.js";var J=g('<div class="file-viewer-panel flex-1"><div class="file-viewer-content file-viewer-content--monaco">'),T=g("<div class=file-viewer-empty><span class=file-viewer-empty-text>"),Q=g('<div class="p-3 text-xs text-secondary">'),E=g("<div><div class=file-list-item-content><div class=file-list-item-path><span class=file-path-text></span></div><div class=file-list-item-stats><span class=file-list-item-additions>+</span><span class=file-list-item-deletions>-"),U=g("<span class=files-tab-selected-path><span class=file-path-text>"),X=g('<div class=files-tab-stats style="flex:0 0 auto"><span class="files-tab-stat files-tab-stat-additions"><span class=files-tab-stat-value>+</span></span><span class="files-tab-stat files-tab-stat-deletions"><span class=files-tab-stat-value>-'),Y=g("<div style=margin-left:auto>");const Z=q(()=>K(()=>import("./monaco-viewer-B3iAKbO0.js").then(e=>e.ad),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.MonacoDiffViewer}))),ce=e=>{const M=f(()=>e.activeSessionId()),S=f(()=>!!(M()&&M()!=="info")),D=f(()=>S()?e.activeSessionDiffs():null),m=f(()=>{const n=D();return Array.isArray(n)?[...n].sort((i,l)=>String(i.file||"").localeCompare(String(l.file||""))):[]}),R=f(()=>m().reduce((n,i)=>(n.additions+=typeof i.additions=="number"?i.additions:0,n.deletions+=typeof i.deletions=="number"?i.deletions:0,n),{additions:0,deletions:0})),I=f(()=>{const n=m();return n.length===0?null:n.reduce((i,l)=>{const v=typeof(i==null?void 0:i.additions)=="number"?i.additions:0,y=typeof(i==null?void 0:i.deletions)=="number"?i.deletions:0,x=v+y,k=typeof(l==null?void 0:l.additions)=="number"?l.additions:0,t=typeof(l==null?void 0:l.deletions)=="number"?l.deletions:0,r=k+t;return r>x?l:r<x?i:String(l.file||"").localeCompare(String((i==null?void 0:i.file)||""))<0?l:i},n[0])}),P=f(()=>{const n=e.selectedFile(),i=m();if(n){const l=i.find(v=>v.file===n);if(l)return l}return I()}),O=f(()=>`${e.instanceId}:${S()?M():"no-session"}`),V=f(()=>{if(!S())return e.t("instanceShell.sessionChanges.noSessionSelected");const n=D();return n===void 0?e.t("instanceShell.sessionChanges.loading"):!Array.isArray(n)||n.length===0?e.t("instanceShell.sessionChanges.empty"):e.t("instanceShell.filesShell.viewerEmpty")}),A=f(()=>{const n=P();return n!=null&&n.file?String(n.file):e.t("instanceShell.rightPanel.tabs.changes")});return B(()=>{const n=m(),i=R(),l=P(),v=()=>(()=>{var t=J(),r=t.firstChild;return a(r,c(W,{get when(){return l&&S()&&n.length>0?l:null},get fallback(){return(()=>{var d=T(),s=d.firstChild;return a(s,V),d})()},children:d=>c(j,{get fallback(){return(()=>{var s=T(),u=s.firstChild;return a(u,()=>e.t("instanceInfo.loading")),s})()},get children(){return c(Z,{get scopeKey(){return O()},get path(){return String(d().file||"")},get patch(){return String(d().patch||"")},get viewMode(){return e.diffViewMode()},get contextMode(){return e.diffContextMode()},get wordWrap(){return e.diffWordWrapMode()}})}})})),t})(),y=()=>(()=>{var t=Q();return a(t,V),t})();return c(H,{get header(){return[(()=>{var t=U(),r=t.firstChild;return a(r,A),L(()=>w(t,"title",A())),t})(),(()=>{var t=X(),r=t.firstChild,d=r.firstChild;d.firstChild;var s=r.nextSibling,u=s.firstChild;return u.firstChild,a(d,()=>i.additions,null),a(u,()=>i.deletions,null),t})(),(()=>{var t=Y();return a(t,c(G,{get viewMode(){return e.diffViewMode()},get contextMode(){return e.diffContextMode()},get wordWrapMode(){return e.diffWordWrapMode()},get onViewModeChange(){return e.onViewModeChange},get onContextModeChange(){return e.onContextModeChange},get onWordWrapModeChange(){return e.onWordWrapModeChange}})),t})()]},list:{panel:()=>c(W,{get when(){return n.length>0},get fallback(){return y()},get children(){return c(F,{each:n,children:t=>(()=>{var r=E(),d=r.firstChild,s=d.firstChild,u=s.firstChild,b=s.nextSibling,h=b.firstChild;h.firstChild;var C=h.nextSibling;return C.firstChild,r.$$click=()=>{e.onSelectFile(t.file,e.isPhoneLayout())},a(u,()=>t.file),a(h,()=>t.additions,null),a(C,()=>t.deletions,null),L(o=>{var _=`file-list-item ${(l==null?void 0:l.file)===t.file?"file-list-item-active":""}`,$=t.file;return _!==o.e&&z(r,o.e=_),$!==o.t&&w(s,"title",o.t=$),o},{e:void 0,t:void 0}),r})()})}}),overlay:()=>c(W,{get when(){return n.length>0},get fallback(){return y()},get children(){return c(F,{each:n,children:t=>(()=>{var r=E(),d=r.firstChild,s=d.firstChild,u=s.firstChild,b=s.nextSibling,h=b.firstChild;h.firstChild;var C=h.nextSibling;return C.firstChild,r.$$click=()=>{e.onSelectFile(t.file,!0)},a(u,()=>t.file),a(h,()=>t.additions,null),a(C,()=>t.deletions,null),L(o=>{var _=`file-list-item ${(l==null?void 0:l.file)===t.file?"file-list-item-active":""}`,$=t.file,p=t.file;return _!==o.e&&z(r,o.e=_),$!==o.t&&w(r,"title",o.t=$),p!==o.a&&w(s,"title",o.a=p),o},{e:void 0,t:void 0,a:void 0}),r})()})}})},get viewer(){return v()},get listOpen(){return e.listOpen()},get onToggleList(){return e.onToggleList},get splitWidth(){return e.splitWidth()},get onResizeMouseDown(){return e.onResizeMouseDown},get onResizeTouchStart(){return e.onResizeTouchStart},get isPhoneLayout(){return e.isPhoneLayout()},get overlayAriaLabel(){return e.t("instanceShell.rightPanel.tabs.changes")}})})};N(["click"]);export{ce as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as g,i as c,m as W,d as i,a as S,f as C}from"./monaco-viewer-B3iAKbO0.js";import{u as T}from"./index-DskBWxXS.js";import{n as o,m as $,a as V}from"./git-diff-vendor-CSgooKT_.js";import{I as U,S as A,O as I}from"./main-CXJTHRp1.js";import{A as D}from"./align-justify-CKbOni6U.js";import{W as E}from"./wrap-text-hwXbREuU.js";const F=[["path",{d:"M12 22v-6",key:"6o8u61"}],["path",{d:"M12 8V2",key:"1wkif3"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m15 5-3-3-3 3",key:"itvq4r"}]],H=t=>o(U,$(t,{name:"UnfoldVertical",iconNode:F}));var N=g("<div class=file-viewer-toolbar><button type=button class=file-viewer-toolbar-icon-button></button><button type=button class=file-viewer-toolbar-icon-button></button><button type=button>");const z=t=>{const{t:a}=T(),d=()=>t.viewMode==="split"?"unified":"split",s=()=>t.contextMode==="collapsed"?"expanded":"collapsed",f=()=>t.wordWrapMode==="on"?"off":"on",h=()=>d()==="split"?a("instanceShell.diff.switchToSplit"):a("instanceShell.diff.switchToUnified"),v=()=>s()==="collapsed"?a("instanceShell.diff.hideUnchanged"):a("instanceShell.diff.showFull"),u=()=>f()==="on"?a("instanceShell.diff.enableWordWrap"):a("instanceShell.diff.disableWordWrap");return(()=>{var b=N(),n=b.firstChild,l=n.nextSibling,r=l.nextSibling;return n.$$click=()=>t.onViewModeChange(d()),c(n,(()=>{var e=W(()=>d()==="split");return()=>e()?o(A,{class:"h-4 w-4","aria-hidden":"true"}):o(D,{class:"h-4 w-4","aria-hidden":"true"})})()),l.$$click=()=>t.onContextModeChange(s()),c(l,(()=>{var e=W(()=>s()==="collapsed");return()=>e()?o(I,{class:"h-4 w-4","aria-hidden":"true"}):o(H,{class:"h-4 w-4","aria-hidden":"true"})})()),r.$$click=()=>t.onWordWrapModeChange(f()),c(r,o(E,{class:"h-4 w-4","aria-hidden":"true"})),V(e=>{var m=h(),w=h(),M=v(),p=v(),x=`file-viewer-toolbar-icon-button${t.wordWrapMode==="on"?" active":""}`,k=u(),y=u();return m!==e.e&&i(n,"aria-label",e.e=m),w!==e.t&&i(n,"title",e.t=w),M!==e.a&&i(l,"aria-label",e.a=M),p!==e.o&&i(l,"title",e.o=p),x!==e.i&&S(r,e.i=x),k!==e.n&&i(r,"aria-label",e.n=k),y!==e.s&&i(r,"title",e.s=y),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),b})()};C(["click"]);export{z as D};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-viewer-B3iAKbO0.js","assets/git-diff-vendor-CSgooKT_.js","assets/fast-diff-vendor-DgdwVvTQ.js","assets/highlight-vendor-8FKMu9os.js","assets/git-diff-vendor-HAZkIolJ.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as G}from"./index-DskBWxXS.js";import{Z as J,m,t as h,i as s,d as u,a as C,u as U,f as X}from"./monaco-viewer-B3iAKbO0.js";import{n as o,m as Y,d as A,b as P,c as $,S as g,a as w,z as p,A as ee,F as te}from"./git-diff-vendor-CSgooKT_.js";import{S as le}from"./SplitFilePanel-CiZrHI3o.js";import{I as ne,R as K,M as re,P as ae,C as ie,e as se,Q as oe}from"./main-CXJTHRp1.js";import{W as ce}from"./wrap-text-hwXbREuU.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";const de=[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]],he=e=>o(ne,Y(e,{name:"Save",iconNode:de}));var ue=h('<div class="px-2 py-2 border-b border-base"><div class=selector-input-group><div class="flex items-center gap-2 px-3 text-muted"></div><input type=text class=selector-input>'),ve=h("<div class=file-list-header><span class=file-list-title></span><span class=file-list-count>"),q=h('<div class="p-3 text-xs text-secondary">'),fe=h("<div class=file-list-item><div class=file-list-item-content><div class=file-list-item-path><span class=file-path-text>.."),ge=h('<div class="p-3 text-xs text-error">'),we=h('<div><div class=file-list-item-content><div class=file-list-item-path><span class=file-path-text></span></div><div class="flex items-center gap-2 shrink-0"><div class=file-list-item-stats><span class="text-[10px] text-secondary"></span></div><button type=button class=git-change-row-action>'),k=h("<div class=file-viewer-empty><span class=file-viewer-empty-text>"),Se=h('<div class="file-viewer-panel flex-1"><div>'),be=h('<div class="h-full outline-none"tabindex=0>'),me=h("<span>"),$e=h("<div class=files-tab-stats><span class=files-tab-stat><span class=files-tab-selected-path><span class=file-path-text>"),ye=h("<button type=button style=margin-inline-start:auto>"),_e=h("<button type=button>"),O=h("<button type=button class=files-header-icon-button>"),Ce=h("<span class=text-error>");const ke=ee(()=>G(()=>import("./monaco-viewer-B3iAKbO0.js").then(e=>e.ae),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.MonacoFileViewer})));function xe(e){return e?/\.(md|markdown|mdown|mkdn)$/i.test(e):!1}const Ie=e=>{const[E,L]=A(""),{isDark:Q}=J(),[N,M]=A(!1);let S;P(()=>{e.browserPath(),L("")});const H=$(()=>[...e.browserEntries()||[]].sort((i,d)=>{const l=i.type==="directory"?0:1,t=d.type==="directory"?0:1;return l!==t?l-t:String(i.name||"").localeCompare(String(d.name||""))})),W=$(()=>E().trim().toLowerCase()),x=$(()=>{const n=W(),i=H();return n?i.filter(d=>String(d.name||"").toLowerCase().includes(n)):i}),y=()=>e.browserLoading()&&e.browserEntries()===null,Z=()=>W()?e.t("instanceShell.filesShell.search.empty"):e.t("instanceShell.filesShell.listEmpty"),_=$(()=>xe(e.browserSelectedPath())),b=$(()=>_()&&N());P(()=>{_()||M(!1)});const D=()=>{const n=e.browserSelectedContent();n!=null&&e.onSave(n)},j=async(n,i)=>{i==null||i.stopPropagation();const d=await se(n);oe({message:d?e.t("instanceShell.filesShell.toast.copyPathSuccess"):e.t("instanceShell.filesShell.toast.copyPathError"),variant:d?"success":"error"})};P(()=>{b()&&requestAnimationFrame(()=>S==null?void 0:S.focus())});const T=()=>[(()=>{var n=ue(),i=n.firstChild,d=i.firstChild,l=d.nextSibling;return s(d,o(ae,{class:"w-4 h-4"})),l.$$input=t=>L(t.currentTarget.value),w(t=>{var a=e.t("instanceShell.filesShell.search.placeholder"),r=e.t("instanceShell.filesShell.search.ariaLabel");return a!==t.e&&u(l,"placeholder",t.e=a),r!==t.t&&u(l,"aria-label",t.t=r),t},{e:void 0,t:void 0}),w(()=>l.value=E()),n})(),(()=>{var n=ve(),i=n.firstChild,d=i.nextSibling;return s(i,()=>e.t("instanceShell.filesShell.fileListTitle")),s(d,()=>x().length),n})(),o(g,{get when(){return e.parentPath()},children:n=>(()=>{var i=fe(),d=i.firstChild,l=d.firstChild;return i.$$click=()=>e.onLoadEntries(n()),w(()=>u(l,"title",n())),i})()}),o(g,{get when(){return y()},get children(){var n=q();return s(n,()=>e.t("instanceInfo.loading")),n}}),o(g,{get when(){return m(()=>!e.browserError()&&!y())()&&x().length>0},get fallback(){return m(()=>!y())()?m(()=>!!e.browserError())()?(()=>{var n=ge();return s(n,()=>e.browserError()),n})():(()=>{var n=q();return s(n,Z),n})():void 0},get children(){return o(te,{get each(){return x()},children:n=>(()=>{var i=we(),d=i.firstChild,l=d.firstChild,t=l.firstChild,a=l.nextSibling,r=a.firstChild,c=r.firstChild,f=r.nextSibling;return i.$$click=()=>{if(n.type==="directory"){e.onLoadEntries(n.path);return}e.onRequestOpenFile(n.path)},s(t,()=>n.name),s(c,()=>n.type),f.$$click=v=>void j(n.path,v),s(f,o(ie,{class:"w-3 h-3"})),w(v=>{var F=`file-list-item ${e.browserSelectedPath()===n.path?"file-list-item-active":""}`,z=n.path,I=n.path,R=e.t("instanceShell.filesShell.actions.copyPath"),V=e.t("instanceShell.filesShell.actions.copyPath");return F!==v.e&&C(i,v.e=F),z!==v.t&&u(i,"title",v.t=z),I!==v.a&&u(l,"title",v.a=I),R!==v.o&&u(f,"title",v.o=R),V!==v.i&&u(f,"aria-label",v.i=V),v},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),i})()})}})],B=n=>{!(n.ctrlKey||n.metaKey)||n.key.toLowerCase()!=="s"||e.browserSelectedSaving()||!e.browserSelectedDirty()||(n.preventDefault(),D())};return m(()=>{const n=()=>e.browserSelectedPath()||e.browserPath(),i=()=>y()?e.t("instanceInfo.loading"):e.t("instanceShell.filesShell.viewerEmpty"),d=()=>(()=>{var l=Se(),t=l.firstChild;return s(t,o(g,{get when(){return e.browserSelectedLoading()},get fallback(){return o(g,{get when(){return e.browserSelectedError()},get fallback(){return o(g,{get when(){return m(()=>!!(e.browserSelectedPath()&&e.browserSelectedContent()!==null))()?{path:e.browserSelectedPath(),content:e.browserSelectedContent()}:null},get fallback(){return(()=>{var a=k(),r=a.firstChild;return s(r,i),a})()},children:a=>o(g,{get when(){return b()},get fallback(){return o(p,{get fallback(){return(()=>{var r=k(),c=r.firstChild;return s(c,()=>e.t("instanceInfo.loading")),r})()},get children(){return o(ke,{get scopeKey(){return e.scopeKey()},get path(){return a().path},get content(){return a().content},get wordWrap(){return e.wordWrapMode()},get onSave(){return e.onSave},get onContentChange(){return e.onContentChange}})}})},get children(){var r=be();r.$$mousedown=()=>S==null?void 0:S.focus(),r.$$keydown=B;var c=S;return typeof c=="function"?U(c,r):S=r,s(r,o(re,{get part(){return{type:"text",text:a().content}},get isDark(){return Q()},escapeRawHtml:!0})),r}})})},children:a=>(()=>{var r=k(),c=r.firstChild;return s(c,a),r})()})},get children(){var a=k(),r=a.firstChild;return s(r,()=>e.t("instanceInfo.loading")),a}})),w(()=>C(t,b()?"file-viewer-content":"file-viewer-content file-viewer-content--monaco")),l})();return o(le,{get header(){return[(()=>{var l=$e(),t=l.firstChild,a=t.firstChild,r=a.firstChild;return s(r,n),s(l,o(g,{get when(){return e.browserLoading()},get children(){var c=me();return s(c,()=>e.t("instanceInfo.loading")),c}}),null),s(l,o(g,{get when(){return e.browserError()},children:c=>(()=>{var f=Ce();return s(f,c),f})()}),null),w(()=>u(a,"title",n())),l})(),(()=>{var l=ye();return l.$$click=()=>_()&&M(t=>!t),s(l,(()=>{var t=m(()=>!!b());return()=>t()?e.t("instanceShell.filesShell.showSource"):e.t("instanceShell.filesShell.previewMarkdown")})()),w(t=>{var a=`file-viewer-toolbar-button${b()?" active":""}`,r=!_();return a!==t.e&&C(l,t.e=a),r!==t.t&&(l.disabled=t.t=r),t},{e:void 0,t:void 0}),l})(),(()=>{var l=_e();return l.$$click=()=>e.onWordWrapModeChange(e.wordWrapMode()==="on"?"off":"on"),s(l,o(ce,{class:"h-4 w-4"})),w(t=>{var a=`file-viewer-toolbar-icon-button${e.wordWrapMode()==="on"?" active":""}`,r=e.wordWrapMode()==="on"?e.t("instanceShell.filesShell.disableWordWrap"):e.t("instanceShell.filesShell.enableWordWrap"),c=e.wordWrapMode()==="on"?e.t("instanceShell.filesShell.disableWordWrap"):e.t("instanceShell.filesShell.enableWordWrap"),f=b();return a!==t.e&&C(l,t.e=a),r!==t.t&&u(l,"title",t.t=r),c!==t.a&&u(l,"aria-label",t.a=c),f!==t.o&&(l.disabled=t.o=f),t},{e:void 0,t:void 0,a:void 0,o:void 0}),l})(),(()=>{var l=O();return l.$$click=D,s(l,o(g,{get when(){return e.browserSelectedSaving()},get fallback(){return o(he,{class:"h-4 w-4"})},get children(){return o(K,{class:"h-4 w-4 animate-spin"})}})),w(t=>{var a=e.t("instanceShell.rightPanel.actions.save")||"Save (Ctrl+S)",r=e.t("instanceShell.rightPanel.actions.save")||"Save",c=e.browserSelectedSaving()||!e.browserSelectedDirty();return a!==t.e&&u(l,"title",t.e=a),r!==t.t&&u(l,"aria-label",t.t=r),c!==t.a&&(l.disabled=t.a=c),t},{e:void 0,t:void 0,a:void 0}),l})(),(()=>{var l=O();return l.$$click=()=>e.onRefresh(),s(l,o(K,{get class(){return`h-4 w-4${e.browserLoading()?" animate-spin":""}`}})),w(t=>{var a=e.t("instanceShell.rightPanel.actions.refresh"),r=e.t("instanceShell.rightPanel.actions.refresh"),c=e.browserLoading();return a!==t.e&&u(l,"title",t.e=a),r!==t.t&&u(l,"aria-label",t.t=r),c!==t.a&&(l.disabled=t.a=c),t},{e:void 0,t:void 0,a:void 0}),l})()]},list:{panel:()=>o(T,{}),overlay:()=>o(T,{})},get viewer(){return d()},get listOpen(){return e.listOpen()},get onToggleList(){return e.onToggleList},get splitWidth(){return e.splitWidth()},get onResizeMouseDown(){return e.onResizeMouseDown},get onResizeTouchStart(){return e.onResizeTouchStart},get isPhoneLayout(){return e.isPhoneLayout()},get overlayAriaLabel(){return e.t("instanceShell.rightPanel.tabs.files")}})})};X(["input","click","keydown","mousedown"]);export{Ie as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-viewer-B3iAKbO0.js","assets/git-diff-vendor-CSgooKT_.js","assets/fast-diff-vendor-DgdwVvTQ.js","assets/highlight-vendor-8FKMu9os.js","assets/git-diff-vendor-HAZkIolJ.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as se}from"./index-DskBWxXS.js";import{m as V,t as h,i as n,d as b,h as q,a as H,f as le}from"./monaco-viewer-B3iAKbO0.js";import{c as m,n as r,a as k,S as w,F as J,z as re,A as ce}from"./git-diff-vendor-CSgooKT_.js";import{D as oe}from"./DiffToolbar-CqJttTgx.js";import{S as de}from"./SplitFilePanel-CiZrHI3o.js";import{H as ge,R as he,J as j,K as Q,N as ue}from"./main-CXJTHRp1.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";import"./align-justify-CKbOni6U.js";import"./wrap-text-hwXbREuU.js";var W=h("<div class=file-viewer-empty><span class=file-viewer-empty-text>"),fe=h('<div class="file-viewer-panel flex-1"><div class="file-viewer-content file-viewer-content--monaco">'),me=h('<div class="p-3 text-xs text-secondary">'),ve=h('<span class="git-change-row-action-bar git-change-row-action-bar-vertical">'),Ce=h('<div><div class=file-list-item-content><div class=file-list-item-path><span class=file-path-text></span></div><div class=git-change-list-item-right><div class=file-list-item-stats><span class=file-list-item-additions>+</span><span class=file-list-item-deletions>-</span></div></div></div><div class=git-change-list-item-actions-zone><div class=git-change-list-item-actions><button type=button class=git-change-row-action><span aria-hidden=true><span class="git-change-row-action-bar git-change-row-action-bar-horizontal">'),$e=h("<div class=git-change-section-items>"),be=h("<div class=git-change-section><button type=button class=git-change-section-header><span class=git-change-section-header-main><span class=git-change-section-chevron></span><span class=git-change-section-title></span></span><span class=git-change-section-count>"),_e=h('<div class=git-change-section-items><div class=git-change-commit-box><div class=git-change-commit-input-wrap><textarea class=git-change-commit-input rows=1></textarea><button type=button class="git-change-commit-button git-change-commit-button-overlay">'),we=h("<div class=git-change-sections><div class=git-change-section><button type=button class=git-change-section-header><span class=git-change-section-header-main><span class=git-change-section-chevron></span><span class=git-change-section-title-row><span class=git-change-section-title></span></span></span><span class=git-change-section-count>"),Se=h('<span class="status-indicator session-status-list worktree-indicator git-change-section-badge"><span class=worktree-indicator-label>'),ye=h("<span class=files-tab-selected-path><span class=file-path-text>"),xe=h('<div class=files-tab-stats style="flex:0 0 auto"><span class="files-tab-stat files-tab-stat-additions"><span class=files-tab-stat-value>+</span></span><span class="files-tab-stat files-tab-stat-deletions"><span class=files-tab-stat-value>-'),Ie=h("<button type=button class=files-header-icon-button style=margin-left:auto>"),Me=h("<span class=text-error>");const Le=ce(()=>se(()=>import("./monaco-viewer-B3iAKbO0.js").then(e=>e.ad),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.MonacoDiffViewer}))),Oe=e=>{const T=m(()=>e.activeSessionId()),P=m(()=>!!(T()&&T()!=="info")),A=m(()=>P()?e.entries():null),X=m(()=>{const o=A();return Array.isArray(o)?[...o].sort((d,x)=>String(d.path||"").localeCompare(String(x.path||""))):[]}),S=m(()=>ge(X())),Y=m(()=>S().reduce((o,d)=>(o.additions+=typeof d.additions=="number"?d.additions:0,o.deletions+=typeof d.deletions=="number"?d.deletions:0,o),{additions:0,deletions:0})),z=m(()=>S().filter(o=>o.section==="staged")),Z=m(()=>S().filter(o=>o.section==="unstaged")),p=m(()=>z().length>0&&e.commitMessage().trim().length>0&&!e.commitSubmitting()),ee=m(()=>{const o=S(),d=e.selectedItemId(),x=e.mostChangedItemId(),I=o.find(E=>E.id===d)||(x?o.find(E=>E.id===x):void 0);return(I==null?void 0:I.entry)??null}),D=m(()=>P()?A()===null?e.t("instanceShell.gitChanges.loading"):S().length===0?e.t("instanceShell.gitChanges.empty"):e.t("instanceShell.filesShell.viewerEmpty"):e.t("instanceShell.gitChanges.noSessionSelected")),te=m(()=>e.selectedError()===e.t("instanceShell.gitChanges.binaryViewer"));return V(()=>{const o=Y(),d=ee(),x=S(),I=z(),E=Z(),ne=()=>(()=>{var t=fe(),l=t.firstChild;return n(l,r(w,{get when(){return e.selectedLoading()},get fallback(){return r(w,{get when(){return e.selectedError()},get fallback(){return r(w,{get when(){return V(()=>!!(d&&e.selectedBefore()!==null&&e.selectedAfter()!==null))()?{path:d.path,before:e.selectedBefore(),after:e.selectedAfter()}:null},get fallback(){return(()=>{var i=W(),s=i.firstChild;return n(s,D),i})()},children:i=>r(re,{get fallback(){return(()=>{var s=W(),a=s.firstChild;return n(a,()=>e.t("instanceInfo.loading")),s})()},get children(){return r(Le,{get scopeKey(){return e.scopeKey()},get path(){return String(i().path||"")},get before(){return String(i().before||"")},get after(){return String(i().after||"")},get viewMode(){return e.diffViewMode()},get contextMode(){return e.diffContextMode()},get wordWrap(){return e.diffWordWrapMode()},get insertContextLabel(){return e.t("instanceShell.gitChanges.actions.insertContext")},get onRequestInsertContext(){return te()?void 0:s=>{const a=e.selectedItemId();if(!a)return;const g=S().find(u=>u.id===a);g&&e.onInsertContext(g,s)}}})}})})},children:i=>(()=>{var s=W(),a=s.firstChild;return n(a,i),s})()})},get children(){var i=W(),s=i.firstChild;return n(s,()=>e.t("instanceInfo.loading")),i}})),t})(),ie=()=>(()=>{var t=me();return n(t,D),t})(),B=t=>{const l=m(()=>e.selectedBulkItemIds().has(t.id)),i=t.section==="staged"?e.t("instanceShell.gitChanges.actions.unstage"):e.t("instanceShell.gitChanges.actions.stage"),s=()=>{t.section==="staged"?e.onUnstageFile(t):e.onStageFile(t)};return(()=>{var a=Ce(),g=a.firstChild,u=g.firstChild,M=u.firstChild,v=u.nextSibling,$=v.firstChild,C=$.firstChild;C.firstChild;var _=C.nextSibling;_.firstChild;var R=g.nextSibling,f=R.firstChild,y=f.firstChild,L=y.firstChild;return L.firstChild,a.$$click=c=>e.onRowClick(t,c),a.$$mousedown=c=>{(c.shiftKey||c.ctrlKey||c.metaKey)&&c.preventDefault()},n(M,()=>t.path),n(C,()=>t.additions,null),n(_,()=>t.deletions,null),y.$$click=c=>{c.stopPropagation(),s()},b(y,"title",i),b(y,"aria-label",i),n(L,r(w,{get when(){return t.section!=="staged"},get children(){return ve()}}),null),k(c=>{var K=`file-list-item git-change-list-item ${e.selectedItemId()===t.id?"file-list-item-active":""} ${l()?"git-change-list-item-bulk-selected":""}`,F=t.path,G=t.path,N=t.path,U=`git-change-row-action-glyph ${t.section==="staged"?"git-change-row-action-glyph-minus":"git-change-row-action-glyph-plus"}`;return K!==c.e&&H(a,c.e=K),F!==c.t&&b(a,"title",c.t=F),G!==c.a&&b(g,"title",c.a=G),N!==c.o&&b(u,"title",c.o=N),U!==c.i&&H(L,c.i=U),c},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),a})()},ae=(t,l,i,s)=>(()=>{var a=be(),g=a.firstChild,u=g.firstChild,M=u.firstChild,v=M.nextSibling,$=u.nextSibling;return q(g,"click",s,!0),n(M,i?r(j,{class:"h-3.5 w-3.5"}):r(Q,{class:"h-3.5 w-3.5"})),n(v,t),n($,()=>l.length),n(a,r(w,{when:i,get children(){var C=$e();return n(C,r(J,{each:l,children:_=>B(_)})),C}}),null),a})(),O=()=>r(w,{get when(){return x.length>0},get fallback(){return ie()},get children(){var t=we(),l=t.firstChild,i=l.firstChild,s=i.firstChild,a=s.firstChild,g=a.nextSibling,u=g.firstChild,M=s.nextSibling;return q(i,"click",e.onToggleStagedOpen,!0),n(a,(()=>{var v=V(()=>!!e.stagedOpen());return()=>v()?r(j,{class:"h-3.5 w-3.5"}):r(Q,{class:"h-3.5 w-3.5"})})()),n(u,()=>e.t("instanceShell.gitChanges.sections.staged")),n(g,r(w,{get when(){return e.branchLabel()},children:v=>(()=>{var $=Se(),C=$.firstChild;return n($,r(ue,{class:"w-3.5 h-3.5","aria-hidden":"true"}),C),n(C,v),k(()=>b($,"title",`Branch: ${v()}`)),$})()}),null),n(M,()=>I.length),n(l,r(w,{get when(){return e.stagedOpen()},get children(){var v=_e(),$=v.firstChild,C=$.firstChild,_=C.firstChild,R=_.nextSibling;return _.$$input=f=>e.onCommitMessageInput(f.currentTarget.value),R.$$click=()=>e.onSubmitCommit(),n(R,(()=>{var f=V(()=>!!e.commitSubmitting());return()=>f()?e.t("instanceShell.gitChanges.commit.submitting"):e.t("instanceShell.gitChanges.commit.submit")})()),n(v,r(J,{each:I,children:f=>B(f)}),null),k(f=>{var y=e.t("instanceShell.gitChanges.commit.placeholder"),L=!p();return y!==f.e&&b(_,"placeholder",f.e=y),L!==f.t&&(R.disabled=f.t=L),f},{e:void 0,t:void 0}),k(()=>_.value=e.commitMessage()),v}}),null),n(t,()=>ae(e.t("instanceShell.gitChanges.sections.unstaged"),E,e.unstagedOpen(),e.onToggleUnstagedOpen),null),t}});return r(de,{get header(){return[(()=>{var t=ye(),l=t.firstChild;return n(l,()=>(d==null?void 0:d.path)||e.t("instanceShell.rightPanel.tabs.gitChanges")),k(()=>b(t,"title",(d==null?void 0:d.path)||e.t("instanceShell.rightPanel.tabs.gitChanges"))),t})(),(()=>{var t=xe(),l=t.firstChild,i=l.firstChild;i.firstChild;var s=l.nextSibling,a=s.firstChild;return a.firstChild,n(i,()=>o.additions,null),n(a,()=>o.deletions,null),n(t,r(w,{get when(){return e.statusError()},children:g=>(()=>{var u=Me();return n(u,g),u})()}),null),t})(),(()=>{var t=Ie();return t.$$click=()=>e.onRefresh(),n(t,r(he,{get class(){return`h-4 w-4${e.statusLoading()?" animate-spin":""}`}})),k(l=>{var i=e.t("instanceShell.rightPanel.actions.refresh"),s=e.t("instanceShell.rightPanel.actions.refresh"),a=!P()||e.statusLoading()||A()===null;return i!==l.e&&b(t,"title",l.e=i),s!==l.t&&b(t,"aria-label",l.t=s),a!==l.a&&(t.disabled=l.a=a),l},{e:void 0,t:void 0,a:void 0}),t})(),r(oe,{get viewMode(){return e.diffViewMode()},get contextMode(){return e.diffContextMode()},get wordWrapMode(){return e.diffWordWrapMode()},get onViewModeChange(){return e.onViewModeChange},get onContextModeChange(){return e.onContextModeChange},get onWordWrapModeChange(){return e.onWordWrapModeChange}})]},list:{panel:O,overlay:O},get viewer(){return ne()},get listOpen(){return e.listOpen()},get onToggleList(){return e.onToggleList},get splitWidth(){return e.splitWidth()},get onResizeMouseDown(){return e.onResizeMouseDown},get onResizeTouchStart(){return e.onResizeTouchStart},get isPhoneLayout(){return e.isPhoneLayout()},get overlayAriaLabel(){return e.t("instanceShell.rightPanel.tabs.gitChanges")}})})};le(["mousedown","click","input"]);export{Oe as default};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|