codex-lens 0.1.28 → 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 -1
- package/dist/public/assets/{main-BRIK-RhC.js → main-8FK9vFAz.js} +37 -37
- 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 -1
- package/src/components/App.jsx +169 -1
- package/src/git-manager.js +168 -0
- package/src/global.css +304 -0
- package/src/watcher.js +20 -0
package/dist/aggregator.js
CHANGED
|
@@ -7,6 +7,7 @@ import { createProxyServer } from "./proxy.js";
|
|
|
7
7
|
import { FileWatcher, scanDirectory } from "./watcher.js";
|
|
8
8
|
import { createLogger } from "./lib/logger.js";
|
|
9
9
|
import { spawnCodex, writeToPty, resizePty, killPty, onPtyData, onPtyExit, getPtyState, getOutputBuffer } from "./pty-manager.js";
|
|
10
|
+
import { createGitManager } from "./git-manager.js";
|
|
10
11
|
import path from "path";
|
|
11
12
|
import { fileURLToPath } from "url";
|
|
12
13
|
import { readFileSync, existsSync, writeFileSync } from "fs";
|
|
@@ -49,6 +50,7 @@ class Aggregator {
|
|
|
49
50
|
this.proxyServer = null;
|
|
50
51
|
this.fileWatcher = null;
|
|
51
52
|
this.ptyProcess = null;
|
|
53
|
+
this.gitManager = null;
|
|
52
54
|
}
|
|
53
55
|
async start(proxyPort) {
|
|
54
56
|
await fetchLatestVersion();
|
|
@@ -134,6 +136,16 @@ class Aggregator {
|
|
|
134
136
|
await this.proxyServer.start();
|
|
135
137
|
this.fileWatcher = new FileWatcher(this.projectRoot, (event) => this.broadcast(event));
|
|
136
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
|
+
}
|
|
137
149
|
await this.startCodex(proxyPort);
|
|
138
150
|
return { httpPort: HTTP_PORT, proxyPort };
|
|
139
151
|
}
|
|
@@ -209,7 +221,7 @@ class Aggregator {
|
|
|
209
221
|
}
|
|
210
222
|
}
|
|
211
223
|
}
|
|
212
|
-
handleClientMessage(data, ws) {
|
|
224
|
+
async handleClientMessage(data, ws) {
|
|
213
225
|
if (data.type === "user_message") {
|
|
214
226
|
writeToPty(data.data + "\r");
|
|
215
227
|
} else if (data.type === "open_file") {
|
|
@@ -227,6 +239,33 @@ class Aggregator {
|
|
|
227
239
|
}
|
|
228
240
|
}));
|
|
229
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
|
+
}
|
|
230
269
|
}
|
|
231
270
|
}
|
|
232
271
|
broadcast(event) {
|