@foxden-app/foxclaw 0.3.0 → 0.3.1

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
@@ -139,6 +139,14 @@ systemctl --user status foxclaw.service
139
139
  journalctl --user -u foxclaw.service -f
140
140
  ```
141
141
 
142
+ 也可以直接用包装命令:
143
+
144
+ ```bash
145
+ foxclaw status
146
+ foxclaw restart
147
+ foxclaw stop
148
+ ```
149
+
142
150
  需要前台调试时:
143
151
 
144
152
  ```bash
@@ -292,6 +300,8 @@ foxclaw weixin-login
292
300
  foxclaw doctor
293
301
  foxclaw status
294
302
  foxclaw start
303
+ foxclaw restart
304
+ foxclaw stop
295
305
  foxclaw uninstall-systemd
296
306
  ```
297
307
 
package/README_EN.md CHANGED
@@ -139,6 +139,14 @@ systemctl --user status foxclaw.service
139
139
  journalctl --user -u foxclaw.service -f
140
140
  ```
141
141
 
142
+ You can also use the wrapper commands:
143
+
144
+ ```bash
145
+ foxclaw status
146
+ foxclaw restart
147
+ foxclaw stop
148
+ ```
149
+
142
150
  For foreground debugging:
143
151
 
144
152
  ```bash
@@ -292,6 +300,8 @@ See [Troubleshooting](./docs/troubleshooting.md) for `doctor` failures, Telegram
292
300
  foxclaw doctor
293
301
  foxclaw status
294
302
  foxclaw start
303
+ foxclaw restart
304
+ foxclaw stop
295
305
  foxclaw uninstall-systemd
296
306
  ```
297
307
 
package/dist/main.js CHANGED
@@ -23,7 +23,16 @@ async function main() {
23
23
  }
24
24
  if (command === 'start') {
25
25
  requireNode24(command);
26
- startService();
26
+ startService('start');
27
+ return;
28
+ }
29
+ if (command === 'restart') {
30
+ requireNode24(command);
31
+ startService('restart');
32
+ return;
33
+ }
34
+ if (command === 'stop') {
35
+ stopService();
27
36
  return;
28
37
  }
29
38
  if (command === 'uninstall-systemd') {
@@ -146,10 +155,10 @@ function initConfig() {
146
155
  console.log(`Created ${envPath}`);
147
156
  console.log('Edit it, then run: foxclaw doctor');
148
157
  }
149
- function startService() {
158
+ function startService(action) {
150
159
  if (!runDoctorChecks()) {
151
160
  console.error('');
152
- console.error('Fix the failed checks above, then run: foxclaw start');
161
+ console.error(`Fix the failed checks above, then run: foxclaw ${action}`);
153
162
  process.exit(1);
154
163
  }
155
164
  if (process.platform === 'darwin') {
@@ -158,6 +167,13 @@ function startService() {
158
167
  }
159
168
  installSystemd();
160
169
  }
170
+ function stopService() {
171
+ if (process.platform === 'darwin') {
172
+ stopLaunchd();
173
+ return;
174
+ }
175
+ stopSystemd();
176
+ }
161
177
  function runDoctorChecks() {
162
178
  const configuredCodexBin = process.env.CODEX_CLI_BIN;
163
179
  const checks = [
@@ -263,6 +279,15 @@ function uninstallSystemd() {
263
279
  spawnChecked('systemctl', ['--user', 'daemon-reload']);
264
280
  console.log(`Removed ${unitPath}`);
265
281
  }
282
+ function stopSystemd() {
283
+ if (!hasCommand('systemctl')) {
284
+ console.error('systemctl not found');
285
+ process.exit(1);
286
+ }
287
+ const unitName = 'foxclaw.service';
288
+ spawnChecked('systemctl', ['--user', 'stop', unitName]);
289
+ console.log(`Stopped ${unitName}`);
290
+ }
266
291
  function installLaunchd() {
267
292
  if (process.platform !== 'darwin') {
268
293
  console.error('launchd install is only available on macOS');
@@ -320,6 +345,19 @@ ${foxclawEnvXml}
320
345
  spawnChecked('launchctl', ['load', plist]);
321
346
  console.log(`Installed ${plist}`);
322
347
  }
348
+ function stopLaunchd() {
349
+ if (process.platform !== 'darwin') {
350
+ console.error('launchd stop is only available on macOS');
351
+ process.exit(1);
352
+ }
353
+ const plist = path.join(process.env.HOME || '', 'Library', 'LaunchAgents', 'app.foxden.foxclaw.plist');
354
+ if (!fs.existsSync(plist)) {
355
+ console.error(`launchd plist not found: ${plist}`);
356
+ process.exit(1);
357
+ }
358
+ spawnChecked('launchctl', ['unload', plist]);
359
+ console.log(`Stopped ${plist}`);
360
+ }
323
361
  function buildServicePath(nodeDir) {
324
362
  const parts = [
325
363
  path.join(process.env.HOME || '', '.local', 'bin'),
@@ -259,13 +259,13 @@ foxclaw status
259
259
  Restart Linux service after changing `.env`:
260
260
 
261
261
  ```bash
262
- foxclaw start
262
+ foxclaw restart
263
263
  ```
264
264
 
265
- Stop Linux service:
265
+ Stop the service:
266
266
 
267
267
  ```bash
268
- systemctl --user stop foxclaw.service
268
+ foxclaw stop
269
269
  ```
270
270
 
271
271
  Uninstall Linux service:
@@ -93,7 +93,7 @@ Check these in order:
93
93
  5. Restart after changing `.env`:
94
94
 
95
95
  ```bash
96
- foxclaw start
96
+ foxclaw restart
97
97
  ```
98
98
 
99
99
  If running foreground mode, stop with `Ctrl+C` and run `foxclaw serve` again.
@@ -145,7 +145,7 @@ systemctl --user disable --now telegram-codex-app-bridge.service
145
145
  Then restart FoxClaw:
146
146
 
147
147
  ```bash
148
- foxclaw start
148
+ foxclaw restart
149
149
  ```
150
150
 
151
151
  ## Codex Or App-Server Fails
@@ -146,6 +146,7 @@ journalctl --user -u foxclaw.service -f
146
146
  On macOS, `foxclaw start` manages launchd. For foreground debugging, stop the background service and run:
147
147
 
148
148
  ```bash
149
+ foxclaw stop
149
150
  foxclaw serve
150
151
  ```
151
152
 
@@ -257,13 +257,13 @@ foxclaw status
257
257
  修改 `.env` 后重启:
258
258
 
259
259
  ```bash
260
- foxclaw start
260
+ foxclaw restart
261
261
  ```
262
262
 
263
- 停止 Linux 服务:
263
+ 停止服务:
264
264
 
265
265
  ```bash
266
- systemctl --user stop foxclaw.service
266
+ foxclaw stop
267
267
  ```
268
268
 
269
269
  卸载 Linux 服务:
@@ -94,7 +94,7 @@ CODEX_CLI_BIN=/absolute/path/to/codex
94
94
  5. 修改 `.env` 后重启:
95
95
 
96
96
  ```bash
97
- foxclaw start
97
+ foxclaw restart
98
98
  ```
99
99
 
100
100
  如果正在前台运行,先 `Ctrl+C` 停止,再重新运行 `foxclaw serve`。
@@ -146,7 +146,7 @@ systemctl --user disable --now telegram-codex-app-bridge.service
146
146
  然后重启 FoxClaw:
147
147
 
148
148
  ```bash
149
- foxclaw start
149
+ foxclaw restart
150
150
  ```
151
151
 
152
152
  ## Codex 或 app-server 异常
@@ -146,6 +146,7 @@ journalctl --user -u foxclaw.service -f
146
146
  macOS 上 `foxclaw start` 会管理 launchd。前台排障时,先停后台服务,再运行:
147
147
 
148
148
  ```bash
149
+ foxclaw stop
149
150
  foxclaw serve
150
151
  ```
151
152
 
package/package.json CHANGED
@@ -1,65 +1,67 @@
1
- {
2
- "name": "@foxden-app/foxclaw",
3
- "version": "0.3.0",
4
- "description": "Foxden local execution claw for controlling Codex from trusted chat interfaces.",
5
- "type": "module",
6
- "main": "dist/main.js",
7
- "bin": {
8
- "foxclaw": "dist/main.js"
9
- },
10
- "files": [
11
- "dist",
12
- "docs",
13
- "scripts",
14
- "skills",
15
- ".env.example",
16
- "README.md",
17
- "README_EN.md",
18
- "LICENSE"
19
- ],
20
- "private": false,
21
- "repository": {
22
- "type": "git",
23
- "url": "git+https://github.com/foxden-app/foxclaw.git"
24
- },
25
- "homepage": "https://github.com/foxden-app/foxclaw#readme",
26
- "bugs": {
27
- "url": "https://github.com/foxden-app/foxclaw/issues"
28
- },
29
- "publishConfig": {
30
- "access": "public"
31
- },
32
- "engines": {
33
- "node": ">=24"
34
- },
35
- "scripts": {
36
- "clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
37
- "build": "npm run clean && tsc -p tsconfig.build.json",
38
- "dev": "tsx src/main.ts serve",
39
- "serve": "node dist/main.js serve",
40
- "start-service": "node dist/main.js start",
41
- "weixin-login": "node dist/main.js weixin-login",
42
- "status": "node dist/main.js status",
43
- "doctor": "node dist/main.js doctor",
44
- "init": "node dist/main.js init",
45
- "install-systemd": "node dist/main.js install-systemd",
46
- "uninstall-systemd": "node dist/main.js uninstall-systemd",
47
- "install-launchd": "node dist/main.js install-launchd",
48
- "typecheck": "tsc --noEmit",
49
- "lint": "eslint .",
50
- "test": "node --test --import tsx \"src/**/*.test.ts\"",
51
- "prepack": "npm run build"
52
- },
53
- "dependencies": {
54
- "dotenv": "^16.6.1",
55
- "qrcode-terminal": "^0.12.0"
56
- },
57
- "devDependencies": {
58
- "@eslint/js": "^9.39.0",
59
- "@types/node": "^24.12.0",
60
- "eslint": "^9.39.0",
61
- "tsx": "^4.19.3",
62
- "typescript": "5.9.3",
63
- "typescript-eslint": "^8.58.0"
64
- }
65
- }
1
+ {
2
+ "name": "@foxden-app/foxclaw",
3
+ "version": "0.3.1",
4
+ "description": "Foxden local execution claw for controlling Codex from trusted chat interfaces.",
5
+ "type": "module",
6
+ "main": "dist/main.js",
7
+ "bin": {
8
+ "foxclaw": "dist/main.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "docs",
13
+ "scripts",
14
+ "skills",
15
+ ".env.example",
16
+ "README.md",
17
+ "README_EN.md",
18
+ "LICENSE"
19
+ ],
20
+ "private": false,
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/foxden-app/foxclaw.git"
24
+ },
25
+ "homepage": "https://github.com/foxden-app/foxclaw#readme",
26
+ "bugs": {
27
+ "url": "https://github.com/foxden-app/foxclaw/issues"
28
+ },
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "engines": {
33
+ "node": ">=24"
34
+ },
35
+ "scripts": {
36
+ "clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
37
+ "build": "npm run clean && tsc -p tsconfig.build.json",
38
+ "dev": "tsx src/main.ts serve",
39
+ "serve": "node dist/main.js serve",
40
+ "start-service": "node dist/main.js start",
41
+ "stop-service": "node dist/main.js stop",
42
+ "restart-service": "node dist/main.js restart",
43
+ "weixin-login": "node dist/main.js weixin-login",
44
+ "status": "node dist/main.js status",
45
+ "doctor": "node dist/main.js doctor",
46
+ "init": "node dist/main.js init",
47
+ "install-systemd": "node dist/main.js install-systemd",
48
+ "uninstall-systemd": "node dist/main.js uninstall-systemd",
49
+ "install-launchd": "node dist/main.js install-launchd",
50
+ "typecheck": "tsc --noEmit",
51
+ "lint": "eslint .",
52
+ "test": "node --test --import tsx \"src/**/*.test.ts\"",
53
+ "prepack": "npm run build"
54
+ },
55
+ "dependencies": {
56
+ "dotenv": "^16.6.1",
57
+ "qrcode-terminal": "^0.12.0"
58
+ },
59
+ "devDependencies": {
60
+ "@eslint/js": "^9.39.0",
61
+ "@types/node": "^24.12.0",
62
+ "eslint": "^9.39.0",
63
+ "tsx": "^4.19.3",
64
+ "typescript": "5.9.3",
65
+ "typescript-eslint": "^8.58.0"
66
+ }
67
+ }