opencode-pixel-office 1.0.2 → 1.0.4

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 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 enables the plugin in your `opencode.json`.
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");
@@ -62,28 +64,48 @@ const copyRecursiveSync = (src, dest) => {
62
64
  }
63
65
  };
64
66
 
65
- const updateConfig = async () => {
66
- if (skipJson) {
67
- return;
68
- }
69
- if (!fs.existsSync(DEFAULT_CONFIG_PATH)) {
70
- return;
71
- }
72
- try {
73
- const raw = fs.readFileSync(DEFAULT_CONFIG_PATH, "utf8");
74
- const data = JSON.parse(raw);
75
- const list = Array.isArray(data.plugin) ? data.plugin : [];
76
- if (!list.includes(PLUGIN_ID)) {
77
- data.plugin = [...list, PLUGIN_ID];
78
- fs.writeFileSync(DEFAULT_CONFIG_PATH, `${JSON.stringify(data, null, 2)}\n`, "utf8");
79
- console.log(`✓ Added ${PLUGIN_ID} to opencode.json`);
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}`);
80
77
  }
81
- } catch (error) {
82
- console.warn(`Failed to update ${DEFAULT_CONFIG_PATH}:`, error);
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);
83
107
  }
84
- };
85
108
 
86
- const run = async () => {
87
109
  if (!shouldInstall) {
88
110
  printHelp();
89
111
  process.exit(0);
@@ -164,7 +186,6 @@ const run = async () => {
164
186
 
165
187
  console.log(`✓ Standalone app installed to ${DEFAULT_APP_DIR}`);
166
188
 
167
- await updateConfig();
168
189
  console.log("\nSuccess! Restart OpenCode to launch Pixel Office.");
169
190
  };
170
191
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-pixel-office",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "bin",