opencode-pixel-office 1.0.5 → 1.0.7

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
@@ -94,6 +94,12 @@ Monitor your agents from your phone or tablet!
94
94
  3. **Start OpenCode**:
95
95
  Simply open your IDE. Pixel Office will auto-launch in your browser at `http://localhost:5100`.
96
96
 
97
+ ### CLI Commands
98
+
99
+ - **Install**: `opencode-pixel-office install [--port <number>]`
100
+ - **Uninstall**: `opencode-pixel-office uninstall`
101
+ - **Stop Server**: `opencode-pixel-office stop` (Manually kills the server process on the configured port)
102
+
97
103
  ### 🛠️ For Developers
98
104
 
99
105
  If you want to modify the source code or contribute:
@@ -29,12 +29,22 @@ const printHelp = () => {
29
29
  console.log("Usage:");
30
30
  console.log(" opencode-pixel-office install [--yes] [--port <number>]");
31
31
  console.log(" opencode-pixel-office uninstall");
32
+ console.log(" opencode-pixel-office stop");
32
33
  console.log("\nOptions:");
33
34
  console.log(" --port <number> Configure the server port (default: 5100)");
34
35
  console.log(" --no-json Skip updating opencode.json");
35
36
  console.log(" --yes, -y Overwrite without prompting");
36
37
  };
37
38
 
39
+ const loadConfig = () => {
40
+ try {
41
+ if (fs.existsSync(PIXEL_OFFICE_CONFIG_PATH)) {
42
+ return JSON.parse(fs.readFileSync(PIXEL_OFFICE_CONFIG_PATH, 'utf8'));
43
+ }
44
+ } catch (e) { }
45
+ return {};
46
+ };
47
+
38
48
  const prompt = async (question) => {
39
49
  const rl = readline.createInterface({
40
50
  input: process.stdin,
@@ -106,6 +116,35 @@ const run = async () => {
106
116
  process.exit(0);
107
117
  }
108
118
 
119
+ if (args.includes("stop")) {
120
+ const config = loadConfig();
121
+ const port = config.port || 5100;
122
+
123
+ console.log(`Stopping Pixel Office server on port ${port}...`);
124
+ try {
125
+ const pidOutput = execSync(`lsof -t -i :${port}`).toString().trim();
126
+ if (pidOutput) {
127
+ const pid = parseInt(pidOutput, 10);
128
+ if (!isNaN(pid) && pid > 0) {
129
+ process.kill(pid);
130
+ console.log(`✓ Server stopped (PID: ${pid})`);
131
+ } else {
132
+ console.log(`- No server found on port ${port} (PID: ${pidOutput})`);
133
+ }
134
+ } else {
135
+ console.log(`- No server found on port ${port}`);
136
+ }
137
+ } catch (e) {
138
+ if (e.message.includes("Command failed")) {
139
+ // likely lsof failed meaning no process found
140
+ console.log(`- No server found on port ${port}`);
141
+ } else {
142
+ console.error(`! Failed to stop server: ${e.message}`);
143
+ }
144
+ }
145
+ process.exit(0);
146
+ }
147
+
109
148
  if (!shouldInstall) {
110
149
  printHelp();
111
150
  process.exit(0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-pixel-office",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "bin",