-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcli.js
More file actions
31 lines (25 loc) · 703 Bytes
/
Copy pathcli.js
File metadata and controls
31 lines (25 loc) · 703 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env node
/**
* CLI shim for api-contract-guardian
* Delegates to the Python implementation
*/
const { spawn } = require('child_process');
const path = require('path');
// Find the Python package directory
const packageDir = path.join(__dirname, 'src', 'api_contract_guardian');
// Run the Python CLI
const python = spawn('python', ['-m', 'api_contract_guardian', ...process.argv.slice(2)], {
cwd: __dirname,
stdio: 'inherit',
env: {
...process.env,
PYTHONPATH: path.join(__dirname, 'src')
}
});
python.on('close', (code) => {
process.exit(code || 0);
});
python.on('error', (err) => {
console.error('Failed to start Python:', err.message);
process.exit(1);
});