specrails-hub 1.1.1 → 1.2.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
@@ -28,10 +28,10 @@ npm install -g specrails-hub
28
28
 
29
29
  ```bash
30
30
  # Start the hub server
31
- specrails-hub hub start
31
+ specrails-hub start
32
32
 
33
33
  # Register a project
34
- specrails-hub hub add /path/to/your/project
34
+ specrails-hub add /path/to/your/project
35
35
 
36
36
  # Open in browser
37
37
  open http://localhost:4200
@@ -96,12 +96,12 @@ A single Express process (port 4200) manages all projects. Each project gets its
96
96
 
97
97
  | Command | Description |
98
98
  |---------|-------------|
99
- | `specrails-hub hub start [--port N]` | Start the hub server (default port 4200) |
100
- | `specrails-hub hub stop` | Stop the hub server |
99
+ | `specrails-hub start [--port N]` | Start the hub server (default port 4200) |
100
+ | `specrails-hub stop` | Stop the hub server |
101
101
  | `specrails-hub hub status` | Show hub state and registered projects |
102
- | `specrails-hub hub list` | List all registered projects |
103
- | `specrails-hub hub add <path>` | Register a project |
104
- | `specrails-hub hub remove <id>` | Unregister a project |
102
+ | `specrails-hub list` | List all registered projects |
103
+ | `specrails-hub add <path>` | Register a project |
104
+ | `specrails-hub remove <id>` | Unregister a project |
105
105
 
106
106
  ### Running commands
107
107
 
@@ -99,6 +99,15 @@ function parseArgs(argv) {
99
99
  if (args[0] === 'hub') {
100
100
  return { mode: 'hub', subArgs: args.slice(1), port };
101
101
  }
102
+ // Allow hub subcommands directly without the 'hub' prefix:
103
+ // specrails-hub start → specrails-hub hub start
104
+ // specrails-hub stop → specrails-hub hub stop
105
+ // specrails-hub add → specrails-hub hub add
106
+ // etc.
107
+ const HUB_SUBCOMMANDS = new Set(['start', 'stop', 'add', 'remove', 'list']);
108
+ if (HUB_SUBCOMMANDS.has(args[0])) {
109
+ return { mode: 'hub', subArgs: args, port };
110
+ }
102
111
  const first = args[0];
103
112
  // Slash-prefixed command: pass through unchanged
104
113
  if (first.startsWith('/')) {
@@ -124,7 +133,8 @@ ${bold('Usage:')}
124
133
  specrails-hub "any raw prompt" Pass a raw prompt directly to claude
125
134
  specrails-hub --status Print manager status and exit
126
135
  specrails-hub --jobs Print recent job history and exit
127
- specrails-hub hub <subcommand> Manage the hub (multi-project mode)
136
+ specrails-hub start|stop|add|list Manage the hub (shorthand, no 'hub' prefix needed)
137
+ specrails-hub hub <subcommand> Same, with explicit 'hub' prefix
128
138
  specrails-hub --port <n> Override default port (${DEFAULT_PORT})
129
139
  specrails-hub --help Show this help text
130
140
 
@@ -617,17 +627,20 @@ function isProcessRunning(pid) {
617
627
  }
618
628
  }
619
629
  function hubServerPath() {
620
- // CLI lives at cli/dist/specrails-hub.js; server is at server/dist/index.js (built)
621
- // In dev mode with tsx, we resolve from __filename
622
- const base = path_1.default.resolve(__dirname, '..');
623
- // Try compiled JS first, then fall back to tsx dev path
624
- const compiled = path_1.default.join(base, 'server', 'dist', 'index.js');
625
- const devTs = path_1.default.join(base, 'server', 'index.ts');
626
- if (fs_1.default.existsSync(compiled))
627
- return compiled;
630
+ // __dirname differs by runtime:
631
+ // compiled (npm install): <root>/cli/dist/ → need ../../server/dist/index.js
632
+ // tsx dev: <root>/cli/ → need ../server/dist/index.js
633
+ // Try both, compiled path first.
634
+ const fromDist = path_1.default.resolve(__dirname, '..', '..', 'server', 'dist', 'index.js');
635
+ const fromSrc = path_1.default.resolve(__dirname, '..', 'server', 'dist', 'index.js');
636
+ const devTs = path_1.default.resolve(__dirname, '..', 'server', 'index.ts');
637
+ if (fs_1.default.existsSync(fromDist))
638
+ return fromDist;
639
+ if (fs_1.default.existsSync(fromSrc))
640
+ return fromSrc;
628
641
  if (fs_1.default.existsSync(devTs))
629
642
  return devTs;
630
- return compiled;
643
+ return fromDist;
631
644
  }
632
645
  async function hubStart(port) {
633
646
  const pid = readPid();
@@ -707,7 +720,7 @@ async function hubStatus(port) {
707
720
  async function hubAdd(projectPath, port) {
708
721
  const detection = await detectWebManager(port);
709
722
  if (!detection.running) {
710
- cliError('hub is not running. Start it first with: specrails-hub hub start');
723
+ cliError('hub is not running. Start it first with: specrails-hub start');
711
724
  return 1;
712
725
  }
713
726
  try {
@@ -805,15 +818,15 @@ async function handleHub(subArgs, port) {
805
818
  const sub = subArgs[0];
806
819
  if (!sub || sub === 'help' || sub === '--help' || sub === '-h') {
807
820
  process.stdout.write(`
808
- ${bold('specrails-hub hub')} — manage the specrails hub (multi-project mode)
821
+ ${bold('specrails-hub')} — hub management
809
822
 
810
823
  ${bold('Usage:')}
811
- specrails-hub hub start Start the hub server
812
- specrails-hub hub stop Stop the hub server
824
+ specrails-hub start Start the hub server
825
+ specrails-hub stop Stop the hub server
813
826
  specrails-hub hub status Show hub status and registered projects
814
- specrails-hub hub add <path> Register a project by path
815
- specrails-hub hub remove <id> Unregister a project by ID
816
- specrails-hub hub list List all registered projects
827
+ specrails-hub add <path> Register a project by path
828
+ specrails-hub remove <id> Unregister a project by ID
829
+ specrails-hub list List all registered projects
817
830
  `.trimStart());
818
831
  return 0;
819
832
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specrails-hub",
3
- "version": "1.1.1",
3
+ "version": "1.2.1",
4
4
  "bin": {
5
5
  "specrails-hub": "cli/dist/specrails-hub.js"
6
6
  },