claude-home 1.2.0 → 1.2.2

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.
Files changed (3) hide show
  1. package/README.md +1 -0
  2. package/bin/cli.js +25 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -86,6 +86,7 @@ claude-home [options]
86
86
  Commands:
87
87
  setup-hook Add SessionStart hook + /claude-home slash command
88
88
  remove-hook Remove SessionStart hook + /claude-home slash command
89
+ stop Stop the running claude-home server
89
90
  ```
90
91
 
91
92
  ---
package/bin/cli.js CHANGED
@@ -9,6 +9,17 @@ const os = require('os');
9
9
 
10
10
  const pkg = require('../package.json');
11
11
 
12
+ // ─── Ensure data dir exists (always, before any subcommand) ──────────────────
13
+ const DATA_DIR = path.join(os.homedir(), '.claude', 'claude-home');
14
+ try {
15
+ if (!fs.existsSync(DATA_DIR)) fs.mkdirSync(DATA_DIR, { recursive: true });
16
+ const marketplaceDest = path.join(DATA_DIR, 'marketplace.json');
17
+ if (!fs.existsSync(marketplaceDest)) {
18
+ const defaultSrc = path.join(__dirname, '..', 'marketplace.default.json');
19
+ if (fs.existsSync(defaultSrc)) fs.copyFileSync(defaultSrc, marketplaceDest);
20
+ }
21
+ } catch { /* ignore */ }
22
+
12
23
  // ─── Arg parsing ─────────────────────────────────────────────────────────────
13
24
 
14
25
  const args = process.argv.slice(2);
@@ -45,10 +56,24 @@ if (args.includes('--help') || args.includes('-h')) {
45
56
  Commands:
46
57
  setup-hook Add SessionStart hook and /claude-home slash command
47
58
  remove-hook Remove SessionStart hook and /claude-home slash command
59
+ stop Stop the running claude-home server
48
60
  `);
49
61
  process.exit(0);
50
62
  }
51
63
 
64
+ // ─── Stop subcommand ─────────────────────────────────────────────────────────
65
+
66
+ if (subcommand === 'stop') {
67
+ const { execSync } = require('child_process');
68
+ try {
69
+ const pid = execSync(`lsof -ti:${port}`, { encoding: 'utf8' }).trim();
70
+ if (!pid) { console.log(`No claude-home process found on port ${port}`); process.exit(0); }
71
+ execSync(`kill ${pid}`);
72
+ console.log(`✓ claude-home stopped (pid ${pid})`);
73
+ } catch { console.log(`No claude-home process found on port ${port}`); }
74
+ process.exit(0);
75
+ }
76
+
52
77
  // ─── Setup-hook / remove-hook subcommands ────────────────────────────────────
53
78
 
54
79
  if (subcommand === 'setup-hook') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-home",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Web dashboard for Claude Code — browse sessions, manage skills, hooks, commands, and agents",
5
5
  "main": "server.js",
6
6
  "bin": {