codex-lens 0.1.27 → 0.1.29
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/aggregator.js +40 -2
- package/dist/public/assets/{main-d-2BqwRB.js → main-8FK9vFAz.js} +40 -38
- package/dist/public/assets/{main-DNXrKVO-.css → main-CnRUPtz5.css} +1 -1
- package/dist/public/index.html +2 -2
- package/dist/watcher.js +16 -0
- package/package.json +1 -1
- package/src/aggregator.js +43 -2
- package/src/components/App.jsx +169 -1
- package/src/components/CodeViewer.jsx +2 -2
- package/src/components/ErrorBoundary.jsx +172 -0
- package/src/components/TerminalPanel.jsx +154 -163
- package/src/git-manager.js +168 -0
- package/src/global.css +304 -0
- package/src/main.jsx +10 -2
- package/src/watcher.js +20 -0
- package/tsconfig.json +24 -0
package/dist/aggregator.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createServer } from "http";
|
|
3
|
-
import { createHash, createHash as cryptoCreateHash } from "crypto";
|
|
4
3
|
import { WebSocketServer } from "ws";
|
|
5
4
|
import express from "express";
|
|
6
5
|
import { spawn } from "child_process";
|
|
@@ -8,6 +7,7 @@ import { createProxyServer } from "./proxy.js";
|
|
|
8
7
|
import { FileWatcher, scanDirectory } from "./watcher.js";
|
|
9
8
|
import { createLogger } from "./lib/logger.js";
|
|
10
9
|
import { spawnCodex, writeToPty, resizePty, killPty, onPtyData, onPtyExit, getPtyState, getOutputBuffer } from "./pty-manager.js";
|
|
10
|
+
import { createGitManager } from "./git-manager.js";
|
|
11
11
|
import path from "path";
|
|
12
12
|
import { fileURLToPath } from "url";
|
|
13
13
|
import { readFileSync, existsSync, writeFileSync } from "fs";
|
|
@@ -50,6 +50,7 @@ class Aggregator {
|
|
|
50
50
|
this.proxyServer = null;
|
|
51
51
|
this.fileWatcher = null;
|
|
52
52
|
this.ptyProcess = null;
|
|
53
|
+
this.gitManager = null;
|
|
53
54
|
}
|
|
54
55
|
async start(proxyPort) {
|
|
55
56
|
await fetchLatestVersion();
|
|
@@ -135,6 +136,16 @@ class Aggregator {
|
|
|
135
136
|
await this.proxyServer.start();
|
|
136
137
|
this.fileWatcher = new FileWatcher(this.projectRoot, (event) => this.broadcast(event));
|
|
137
138
|
await this.fileWatcher.start();
|
|
139
|
+
this.gitManager = createGitManager(this.projectRoot, (event) => this.broadcast(event));
|
|
140
|
+
if (this.gitManager.isGitRepo()) {
|
|
141
|
+
await this.gitManager.broadcastUpdate();
|
|
142
|
+
logger.info("Git repository detected, git status broadcasting enabled");
|
|
143
|
+
this.fileWatcher.setGitStatusCallback((filePath) => {
|
|
144
|
+
if (this.gitManager?.isGitRepo()) {
|
|
145
|
+
this.gitManager.scheduleStatusUpdate();
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
138
149
|
await this.startCodex(proxyPort);
|
|
139
150
|
return { httpPort: HTTP_PORT, proxyPort };
|
|
140
151
|
}
|
|
@@ -210,7 +221,7 @@ class Aggregator {
|
|
|
210
221
|
}
|
|
211
222
|
}
|
|
212
223
|
}
|
|
213
|
-
handleClientMessage(data, ws) {
|
|
224
|
+
async handleClientMessage(data, ws) {
|
|
214
225
|
if (data.type === "user_message") {
|
|
215
226
|
writeToPty(data.data + "\r");
|
|
216
227
|
} else if (data.type === "open_file") {
|
|
@@ -228,6 +239,33 @@ class Aggregator {
|
|
|
228
239
|
}
|
|
229
240
|
}));
|
|
230
241
|
}
|
|
242
|
+
} else if (data.type === "git_status_request") {
|
|
243
|
+
if (this.gitManager?.isGitRepo()) {
|
|
244
|
+
this.gitManager.broadcastUpdate();
|
|
245
|
+
}
|
|
246
|
+
} else if (data.type === "git_stage") {
|
|
247
|
+
if (this.gitManager?.isGitRepo()) {
|
|
248
|
+
if (data.filePath) {
|
|
249
|
+
await this.gitManager.stageFile(data.filePath);
|
|
250
|
+
} else {
|
|
251
|
+
await this.gitManager.stageAll();
|
|
252
|
+
}
|
|
253
|
+
this.gitManager.broadcastUpdate();
|
|
254
|
+
}
|
|
255
|
+
} else if (data.type === "git_unstage") {
|
|
256
|
+
if (this.gitManager?.isGitRepo()) {
|
|
257
|
+
if (data.filePath) {
|
|
258
|
+
await this.gitManager.unstageFile(data.filePath);
|
|
259
|
+
} else {
|
|
260
|
+
await this.gitManager.unstageAll();
|
|
261
|
+
}
|
|
262
|
+
this.gitManager.broadcastUpdate();
|
|
263
|
+
}
|
|
264
|
+
} else if (data.type === "git_commit") {
|
|
265
|
+
if (this.gitManager?.isGitRepo()) {
|
|
266
|
+
await this.gitManager.commit(data.message);
|
|
267
|
+
this.gitManager.broadcastUpdate();
|
|
268
|
+
}
|
|
231
269
|
}
|
|
232
270
|
}
|
|
233
271
|
broadcast(event) {
|