@specsage/cli 0.1.0

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.
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * SpecSage CLI - AI-powered end-to-end testing automation
5
+ *
6
+ * This Node wrapper spawns the Ruby CLI bundled in the package.
7
+ */
8
+
9
+ import { spawn } from 'child_process';
10
+ import { dirname, join } from 'path';
11
+ import { fileURLToPath } from 'url';
12
+
13
+ const __dirname = dirname(fileURLToPath(import.meta.url));
14
+ const LIB_DIR = join(__dirname, '..', 'lib');
15
+
16
+ // Pass all arguments through to Ruby CLI
17
+ const args = process.argv.slice(2);
18
+
19
+ const child = spawn('ruby', [join(LIB_DIR, 'cli.rb'), ...args], {
20
+ stdio: 'inherit',
21
+ env: process.env
22
+ });
23
+
24
+ child.on('error', (err) => {
25
+ if (err.code === 'ENOENT') {
26
+ console.error('Error: Ruby is required but not found in PATH');
27
+ console.error('Please install Ruby: https://www.ruby-lang.org/en/documentation/installation/');
28
+ process.exit(1);
29
+ }
30
+ console.error(`Error: ${err.message}`);
31
+ process.exit(1);
32
+ });
33
+
34
+ child.on('close', (code) => {
35
+ process.exit(code ?? 1);
36
+ });