opencode-pixel-office 1.0.8 → 1.0.9
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/README.md +3 -3
- package/bin/claude-code-hook.js +1 -1
- package/bin/opencode-pixel-office.js +64 -2
- package/client/dist/assets/{index-Cfnbdbzw.js → index-BYMX3DUt.js} +73 -73
- package/client/dist/index.html +1 -1
- package/package.json +1 -1
- package/plugin/pixel-office.js +8 -5
- package/server/index.ts +1 -1
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ The system consists of three main parts:
|
|
|
15
15
|
|
|
16
16
|
```mermaid
|
|
17
17
|
graph TD
|
|
18
|
-
A[OpenCode IDE] -->|Plugin Events via HTTP| B(Pixel Office Server :
|
|
18
|
+
A[OpenCode IDE] -->|Plugin Events via HTTP| B(Pixel Office Server :3000)
|
|
19
19
|
B -->|Broadcast State via WebSocket| C[React Client]
|
|
20
20
|
C -->|Render| D[PixiJS Scene]
|
|
21
21
|
C -->|Render| E[HUD / Sidebar]
|
|
@@ -92,7 +92,7 @@ Monitor your agents from your phone or tablet!
|
|
|
92
92
|
This sets up the standalone app in `~/.opencode/pixel-office` and installs the `pixel-office.js` plugin script to `~/.opencode/plugins/`.
|
|
93
93
|
|
|
94
94
|
3. **Start OpenCode**:
|
|
95
|
-
Simply open your IDE. Pixel Office will auto-launch in your browser at `http://localhost:
|
|
95
|
+
Simply open your IDE. Pixel Office will auto-launch in your browser at `http://localhost:3000`.
|
|
96
96
|
|
|
97
97
|
### CLI Commands
|
|
98
98
|
|
|
@@ -114,7 +114,7 @@ npm install
|
|
|
114
114
|
#### 2. Start the Server (Dev Mode)
|
|
115
115
|
```bash
|
|
116
116
|
npm start
|
|
117
|
-
# Server runs on http://localhost:
|
|
117
|
+
# Server runs on http://localhost:3000, watching for changes
|
|
118
118
|
```
|
|
119
119
|
|
|
120
120
|
#### 3. Start the Client (Dev Mode)
|
package/bin/claude-code-hook.js
CHANGED
|
@@ -119,7 +119,7 @@ const main = async () => {
|
|
|
119
119
|
process.exit(0);
|
|
120
120
|
}
|
|
121
121
|
const input = JSON.parse(raw);
|
|
122
|
-
const endpoint = process.env.PIXEL_OFFICE_URL || "http://localhost:
|
|
122
|
+
const endpoint = process.env.PIXEL_OFFICE_URL || "http://localhost:3000/events";
|
|
123
123
|
if (readMode() !== "claude-code") {
|
|
124
124
|
process.exit(0);
|
|
125
125
|
}
|
|
@@ -22,6 +22,7 @@ const shouldInstallClaude = args[0] === "claude-code" && args[1] === "install";
|
|
|
22
22
|
const shouldSwitch = args[0] === "switch";
|
|
23
23
|
const switchTarget = shouldSwitch ? args[1] : null;
|
|
24
24
|
const shouldUninstall = args.includes("uninstall");
|
|
25
|
+
const shouldStart = args[0] === "start";
|
|
25
26
|
const yesFlag = args.includes("--yes") || args.includes("-y");
|
|
26
27
|
const skipJson = args.includes("--no-json");
|
|
27
28
|
const portIndex = args.findIndex((arg) => arg === "--port");
|
|
@@ -33,10 +34,11 @@ const printHelp = () => {
|
|
|
33
34
|
console.log(" opencode-pixel-office install [--yes] [--port <number>]");
|
|
34
35
|
console.log(" opencode-pixel-office claude-code install");
|
|
35
36
|
console.log(" opencode-pixel-office switch <opencode|claude-code>");
|
|
37
|
+
console.log(" opencode-pixel-office start");
|
|
36
38
|
console.log(" opencode-pixel-office uninstall");
|
|
37
39
|
console.log(" opencode-pixel-office stop");
|
|
38
40
|
console.log("\nOptions:");
|
|
39
|
-
console.log(" --port <number> Configure the server port (default:
|
|
41
|
+
console.log(" --port <number> Configure the server port (default: 3000)");
|
|
40
42
|
console.log(" --no-json Skip updating opencode.json");
|
|
41
43
|
console.log(" --yes, -y Overwrite without prompting");
|
|
42
44
|
};
|
|
@@ -188,9 +190,69 @@ const run = async () => {
|
|
|
188
190
|
process.exit(0);
|
|
189
191
|
}
|
|
190
192
|
|
|
193
|
+
if (shouldStart) {
|
|
194
|
+
const config = loadConfig();
|
|
195
|
+
const port = portArg ? parseInt(portArg, 10) : (config.port || 3000);
|
|
196
|
+
const serverScript = "server/index.ts";
|
|
197
|
+
|
|
198
|
+
const rootSource = path.resolve(__dirname, "..");
|
|
199
|
+
const localServerPath = path.join(rootSource, "server", "index.ts");
|
|
200
|
+
const globalServerPath = path.join(DEFAULT_APP_DIR, "server", "index.ts");
|
|
201
|
+
|
|
202
|
+
let serverCwd;
|
|
203
|
+
let useGlobal = false;
|
|
204
|
+
if (fs.existsSync(localServerPath)) {
|
|
205
|
+
serverCwd = rootSource;
|
|
206
|
+
} else if (fs.existsSync(globalServerPath)) {
|
|
207
|
+
serverCwd = DEFAULT_APP_DIR;
|
|
208
|
+
useGlobal = true;
|
|
209
|
+
} else {
|
|
210
|
+
console.error("Server not found. Run 'opencode-pixel-office install' first.");
|
|
211
|
+
process.exit(1);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
try {
|
|
215
|
+
const pidOutput = execSync(`lsof -t -i :${port} 2>/dev/null`).toString().trim();
|
|
216
|
+
if (pidOutput) {
|
|
217
|
+
console.log(`Pixel Office is already running on port ${port} (PID: ${pidOutput})`);
|
|
218
|
+
const url = `http://localhost:${port}`;
|
|
219
|
+
const openCmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
|
|
220
|
+
try { execSync(`${openCmd} ${url}`); } catch { }
|
|
221
|
+
console.log(`Opened ${url}`);
|
|
222
|
+
process.exit(0);
|
|
223
|
+
}
|
|
224
|
+
} catch { }
|
|
225
|
+
|
|
226
|
+
let tsxBin = "tsx";
|
|
227
|
+
if (useGlobal) {
|
|
228
|
+
const globalTsx = path.join(serverCwd, "node_modules", ".bin", "tsx");
|
|
229
|
+
if (fs.existsSync(globalTsx)) {
|
|
230
|
+
tsxBin = globalTsx;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const { spawn } = await import("node:child_process");
|
|
235
|
+
const child = spawn(tsxBin, [serverScript], {
|
|
236
|
+
cwd: serverCwd,
|
|
237
|
+
env: { ...process.env, PORT: String(port) },
|
|
238
|
+
detached: true,
|
|
239
|
+
stdio: "ignore",
|
|
240
|
+
});
|
|
241
|
+
child.unref();
|
|
242
|
+
|
|
243
|
+
console.log(`Pixel Office server started on port ${port} (PID: ${child.pid})`);
|
|
244
|
+
|
|
245
|
+
await new Promise((r) => setTimeout(r, 1500));
|
|
246
|
+
const url = `http://localhost:${port}`;
|
|
247
|
+
const openCmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
|
|
248
|
+
try { execSync(`${openCmd} ${url}`); } catch { }
|
|
249
|
+
console.log(`Opened ${url}`);
|
|
250
|
+
process.exit(0);
|
|
251
|
+
}
|
|
252
|
+
|
|
191
253
|
if (args.includes("stop")) {
|
|
192
254
|
const config = loadConfig();
|
|
193
|
-
const port = config.port ||
|
|
255
|
+
const port = config.port || 3000;
|
|
194
256
|
|
|
195
257
|
console.log(`Stopping Pixel Office server on port ${port}...`);
|
|
196
258
|
try {
|