specrails-hub 1.2.1 → 1.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/LICENSE +21 -0
- package/cli/dist/specrails-hub.js +48 -4
- package/client/dist/assets/index-2t4LgLNj.js +519 -0
- package/client/dist/assets/index-C9KbDq4H.css +1 -0
- package/client/dist/index.html +2 -2
- package/docs/engineering/engineering-standards.md +67 -0
- package/docs/general/getting-started.md +58 -0
- package/docs/operations/runbook.md +84 -0
- package/docs/product/roadmap.md +38 -0
- package/package.json +11 -2
- package/server/dist/docs-router.js +113 -0
- package/server/dist/index.js +3 -0
- package/client/dist/assets/index-CTAak2By.js +0 -498
- package/client/dist/assets/index-DYWmjovO.css +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Javier Pulido
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -24,6 +24,7 @@ exports.formatDuration = formatDuration;
|
|
|
24
24
|
exports.formatTokens = formatTokens;
|
|
25
25
|
exports.printSummary = printSummary;
|
|
26
26
|
const http_1 = __importDefault(require("http"));
|
|
27
|
+
const net_1 = __importDefault(require("net"));
|
|
27
28
|
const child_process_1 = require("child_process");
|
|
28
29
|
const child_process_2 = require("child_process");
|
|
29
30
|
const readline_1 = require("readline");
|
|
@@ -607,6 +608,20 @@ async function handleJobs(port) {
|
|
|
607
608
|
// Hub subcommand group
|
|
608
609
|
// ---------------------------------------------------------------------------
|
|
609
610
|
const HUB_PID_FILE = path_1.default.join(os_1.default.homedir(), '.specrails', 'manager.pid');
|
|
611
|
+
const HUB_LOG_FILE = path_1.default.join(os_1.default.homedir(), '.specrails', 'hub.log');
|
|
612
|
+
function isPortInUse(port) {
|
|
613
|
+
return new Promise((resolve) => {
|
|
614
|
+
const srv = net_1.default.createServer();
|
|
615
|
+
srv.once('error', (err) => {
|
|
616
|
+
resolve(err.code === 'EADDRINUSE');
|
|
617
|
+
});
|
|
618
|
+
srv.once('listening', () => {
|
|
619
|
+
srv.close();
|
|
620
|
+
resolve(false);
|
|
621
|
+
});
|
|
622
|
+
srv.listen(port, '127.0.0.1');
|
|
623
|
+
});
|
|
624
|
+
}
|
|
610
625
|
function readPid() {
|
|
611
626
|
try {
|
|
612
627
|
const raw = fs_1.default.readFileSync(HUB_PID_FILE, 'utf-8').trim();
|
|
@@ -648,25 +663,54 @@ async function hubStart(port) {
|
|
|
648
663
|
cliLog(`hub already running (pid ${pid}) on port ${port}`);
|
|
649
664
|
return 0;
|
|
650
665
|
}
|
|
666
|
+
// Check if port is already in use by another process
|
|
667
|
+
const portBusy = await isPortInUse(port);
|
|
668
|
+
if (portBusy) {
|
|
669
|
+
cliError(`port ${port} is already in use by another process`);
|
|
670
|
+
cliError(`if a previous hub is stale, run: specrails-hub stop`);
|
|
671
|
+
cliError(`or use a different port: specrails-hub --port <port> start`);
|
|
672
|
+
return 1;
|
|
673
|
+
}
|
|
651
674
|
const serverPath = hubServerPath();
|
|
652
675
|
const isTs = serverPath.endsWith('.ts');
|
|
653
676
|
const args = isTs
|
|
654
677
|
? ['tsx', serverPath, '--port', String(port)]
|
|
655
678
|
: ['node', serverPath, '--port', String(port)];
|
|
679
|
+
// Ensure log dir exists and open log file for server output
|
|
680
|
+
try {
|
|
681
|
+
fs_1.default.mkdirSync(path_1.default.dirname(HUB_LOG_FILE), { recursive: true });
|
|
682
|
+
}
|
|
683
|
+
catch { /* ignore */ }
|
|
684
|
+
let logFd;
|
|
685
|
+
try {
|
|
686
|
+
logFd = fs_1.default.openSync(HUB_LOG_FILE, 'a');
|
|
687
|
+
}
|
|
688
|
+
catch { /* ignore — fall back to silent */ }
|
|
689
|
+
const stdio = [
|
|
690
|
+
'ignore',
|
|
691
|
+
logFd ?? 'ignore',
|
|
692
|
+
logFd ?? 'ignore',
|
|
693
|
+
];
|
|
656
694
|
const child = (0, child_process_2.spawn)(args[0], args.slice(1), {
|
|
657
695
|
detached: true,
|
|
658
|
-
stdio
|
|
696
|
+
stdio,
|
|
659
697
|
env: { ...process.env },
|
|
660
698
|
});
|
|
699
|
+
if (logFd !== undefined) {
|
|
700
|
+
try {
|
|
701
|
+
fs_1.default.closeSync(logFd);
|
|
702
|
+
}
|
|
703
|
+
catch { /* ignore */ }
|
|
704
|
+
}
|
|
661
705
|
child.unref();
|
|
662
|
-
// Wait
|
|
663
|
-
await new Promise((resolve) => setTimeout(resolve,
|
|
706
|
+
// Wait for server to be ready (longer window for slow machines)
|
|
707
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
664
708
|
const detection = await detectWebManager(port);
|
|
665
709
|
if (detection.running) {
|
|
666
710
|
cliLog(`hub started on http://127.0.0.1:${port}`);
|
|
667
711
|
return 0;
|
|
668
712
|
}
|
|
669
|
-
cliError(
|
|
713
|
+
cliError(`hub failed to start — logs: ${HUB_LOG_FILE}`);
|
|
670
714
|
return 1;
|
|
671
715
|
}
|
|
672
716
|
async function hubStop() {
|