opencode-pixel-office 1.0.7 → 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 +134 -0
- package/bin/opencode-pixel-office.js +143 -11
- 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 +24 -2
- package/server/index.ts +1 -1
package/client/dist/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
6
|
<link rel="icon" type="image/png" href="/favicon.png" />
|
|
7
7
|
<title>OpenCode Pixel Office</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-BYMX3DUt.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-CocJhp5H.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
package/package.json
CHANGED
package/plugin/pixel-office.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
|
|
4
|
-
const DEFAULT_PORT =
|
|
4
|
+
const DEFAULT_PORT = 3000;
|
|
5
5
|
|
|
6
6
|
// Helper to get configured port
|
|
7
7
|
const getConfiguredPort = (globalDistDir) => {
|
|
@@ -28,6 +28,22 @@ const homeDir = process.env.HOME || process.env.USERPROFILE || "/";
|
|
|
28
28
|
const globalDistDir = path.join(homeDir, ".opencode", "pixel-office");
|
|
29
29
|
const configuredPort = getConfiguredPort(globalDistDir);
|
|
30
30
|
|
|
31
|
+
const readMode = () => {
|
|
32
|
+
try {
|
|
33
|
+
const configPath = path.join(globalDistDir, "config.json");
|
|
34
|
+
if (fs.existsSync(configPath)) {
|
|
35
|
+
const raw = fs.readFileSync(configPath, "utf8");
|
|
36
|
+
const data = JSON.parse(raw);
|
|
37
|
+
if (data && typeof data.mode === "string") {
|
|
38
|
+
return data.mode;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
} catch (e) {
|
|
42
|
+
return "opencode";
|
|
43
|
+
}
|
|
44
|
+
return "opencode";
|
|
45
|
+
};
|
|
46
|
+
|
|
31
47
|
const resolveEndpoint = () => {
|
|
32
48
|
const port = process.env.PIXEL_OFFICE_PORT || configuredPort;
|
|
33
49
|
const raw =
|
|
@@ -63,13 +79,19 @@ const resolveOpenCommand = (url) => {
|
|
|
63
79
|
};
|
|
64
80
|
|
|
65
81
|
export const PixelOfficePlugin = async ({ directory, worktree, client }) => {
|
|
82
|
+
if (readMode() !== "opencode") {
|
|
83
|
+
return {
|
|
84
|
+
event: async () => { },
|
|
85
|
+
dispose: async () => { },
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
66
89
|
const endpoint = resolveEndpoint();
|
|
67
90
|
const serverUrl = resolveServerUrl(endpoint);
|
|
68
91
|
const rootDir = worktree || directory;
|
|
69
92
|
const endpointInfo = resolveEndpointInfo(endpoint, configuredPort);
|
|
70
93
|
const openCommand = resolveOpenCommand(serverUrl);
|
|
71
94
|
|
|
72
|
-
// Path Resolution
|
|
73
95
|
const localServerPath = path.join(rootDir, "server", "index.ts");
|
|
74
96
|
const globalServerPath = path.join(globalDistDir, "server", "index.ts");
|
|
75
97
|
|
package/server/index.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { WebSocketServer } from "ws";
|
|
|
9
9
|
const __filename = fileURLToPath(import.meta.url);
|
|
10
10
|
const __dirname = path.dirname(__filename);
|
|
11
11
|
|
|
12
|
-
const PORT = Number.parseInt(process.env.PORT || "
|
|
12
|
+
const PORT = Number.parseInt(process.env.PORT || "3000", 10);
|
|
13
13
|
const CLIENT_DIST_DIR = path.join(__dirname, "..", "client", "dist");
|
|
14
14
|
const CLIENT_DIR = fs.existsSync(CLIENT_DIST_DIR)
|
|
15
15
|
? CLIENT_DIST_DIR
|