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 +7 -7
- package/cli/dist/specrails-hub.js +30 -17
- package/package.json +1 -1
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
|
|
31
|
+
specrails-hub start
|
|
32
32
|
|
|
33
33
|
# Register a project
|
|
34
|
-
specrails-hub
|
|
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
|
|
100
|
-
| `specrails-hub
|
|
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
|
|
103
|
-
| `specrails-hub
|
|
104
|
-
| `specrails-hub
|
|
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
|
|
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
|
-
//
|
|
621
|
-
//
|
|
622
|
-
|
|
623
|
-
// Try compiled
|
|
624
|
-
const
|
|
625
|
-
const
|
|
626
|
-
|
|
627
|
-
|
|
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
|
|
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
|
|
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
|
|
821
|
+
${bold('specrails-hub')} — hub management
|
|
809
822
|
|
|
810
823
|
${bold('Usage:')}
|
|
811
|
-
specrails-hub
|
|
812
|
-
specrails-hub
|
|
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
|
|
815
|
-
specrails-hub
|
|
816
|
-
specrails-hub
|
|
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
|
}
|