opencode-pixel-office 1.0.3 → 1.0.5
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 +1 -1
- package/bin/opencode-pixel-office.js +43 -0
- package/package.json +1 -1
- package/plugin/pixel-office.js +7 -0
package/README.md
CHANGED
|
@@ -89,7 +89,7 @@ Monitor your agents from your phone or tablet!
|
|
|
89
89
|
```bash
|
|
90
90
|
opencode-pixel-office install
|
|
91
91
|
```
|
|
92
|
-
This sets up the standalone app in `~/.opencode/pixel-office` and
|
|
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
95
|
Simply open your IDE. Pixel Office will auto-launch in your browser at `http://localhost:5100`.
|
|
@@ -18,6 +18,7 @@ const PIXEL_OFFICE_CONFIG_PATH = path.join(DEFAULT_APP_DIR, "config.json");
|
|
|
18
18
|
|
|
19
19
|
const args = process.argv.slice(2);
|
|
20
20
|
const shouldInstall = args.includes("install");
|
|
21
|
+
const shouldUninstall = args.includes("uninstall");
|
|
21
22
|
const yesFlag = args.includes("--yes") || args.includes("-y");
|
|
22
23
|
const skipJson = args.includes("--no-json");
|
|
23
24
|
const portIndex = args.findIndex((arg) => arg === "--port");
|
|
@@ -27,6 +28,7 @@ const printHelp = () => {
|
|
|
27
28
|
console.log("opencode-pixel-office installer\n");
|
|
28
29
|
console.log("Usage:");
|
|
29
30
|
console.log(" opencode-pixel-office install [--yes] [--port <number>]");
|
|
31
|
+
console.log(" opencode-pixel-office uninstall");
|
|
30
32
|
console.log("\nOptions:");
|
|
31
33
|
console.log(" --port <number> Configure the server port (default: 5100)");
|
|
32
34
|
console.log(" --no-json Skip updating opencode.json");
|
|
@@ -63,6 +65,47 @@ const copyRecursiveSync = (src, dest) => {
|
|
|
63
65
|
};
|
|
64
66
|
|
|
65
67
|
const run = async () => {
|
|
68
|
+
if (shouldUninstall) {
|
|
69
|
+
const targetPluginPath = path.join(DEFAULT_PLUGIN_DIR, PLUGIN_NAME);
|
|
70
|
+
|
|
71
|
+
// Remove Plugin
|
|
72
|
+
if (fs.existsSync(targetPluginPath)) {
|
|
73
|
+
fs.unlinkSync(targetPluginPath);
|
|
74
|
+
console.log(`✓ Removed plugin: ${targetPluginPath}`);
|
|
75
|
+
} else {
|
|
76
|
+
console.log(`- Plugin not found at ${targetPluginPath}`);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Remove App
|
|
80
|
+
if (fs.existsSync(DEFAULT_APP_DIR)) {
|
|
81
|
+
fs.rmSync(DEFAULT_APP_DIR, { recursive: true, force: true });
|
|
82
|
+
console.log(`✓ Removed app directory: ${DEFAULT_APP_DIR}`);
|
|
83
|
+
} else {
|
|
84
|
+
console.log(`- App directory not found at ${DEFAULT_APP_DIR}`);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Clean up Config (Legacy)
|
|
88
|
+
if (fs.existsSync(DEFAULT_CONFIG_PATH) && !skipJson) {
|
|
89
|
+
try {
|
|
90
|
+
const raw = fs.readFileSync(DEFAULT_CONFIG_PATH, "utf8");
|
|
91
|
+
const data = JSON.parse(raw);
|
|
92
|
+
if (Array.isArray(data.plugin)) {
|
|
93
|
+
const initialLength = data.plugin.length;
|
|
94
|
+
data.plugin = data.plugin.filter(p => p !== PLUGIN_ID);
|
|
95
|
+
if (data.plugin.length !== initialLength) {
|
|
96
|
+
fs.writeFileSync(DEFAULT_CONFIG_PATH, `${JSON.stringify(data, null, 2)}\n`, "utf8");
|
|
97
|
+
console.log(`✓ Removed ${PLUGIN_ID} from opencode.json`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
} catch (e) {
|
|
101
|
+
// ignore config errors on uninstall
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
console.log("\nUninstallation complete.");
|
|
106
|
+
process.exit(0);
|
|
107
|
+
}
|
|
108
|
+
|
|
66
109
|
if (!shouldInstall) {
|
|
67
110
|
printHelp();
|
|
68
111
|
process.exit(0);
|
package/package.json
CHANGED
package/plugin/pixel-office.js
CHANGED
|
@@ -170,5 +170,12 @@ export const PixelOfficePlugin = async ({ directory, worktree, client }) => {
|
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
},
|
|
173
|
+
dispose: async () => {
|
|
174
|
+
if (serverProcess) {
|
|
175
|
+
// console.log("[Pixel Office] Killing server process...");
|
|
176
|
+
serverProcess.kill();
|
|
177
|
+
serverProcess = null;
|
|
178
|
+
}
|
|
179
|
+
},
|
|
173
180
|
};
|
|
174
181
|
};
|