@skillgate-io/cli 1.0.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.
- package/README.md +72 -0
- package/bin/skillgate.js +74 -0
- package/package.json +24 -0
package/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# @skillgate-io/cli
|
|
2
|
+
|
|
3
|
+
Optional npm/npx wrapper for the Python-native SkillGate CLI.
|
|
4
|
+
|
|
5
|
+
Important:
|
|
6
|
+
- Canonical runtime is Python package distribution (`pipx`/PyPI).
|
|
7
|
+
- This wrapper does not embed the scanning engine.
|
|
8
|
+
- This wrapper does not auto-install Python or SkillGate.
|
|
9
|
+
|
|
10
|
+
This means:
|
|
11
|
+
- Use Python install path for the simplest setup.
|
|
12
|
+
- Use this npm package only if you prefer Node-based command entrypoint.
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
Global install:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install -g @skillgate-io/cli
|
|
20
|
+
skillgate version
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Direct run:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npx @skillgate-io/cli version
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Recommended direct Python path (no npm required):
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pipx install skillgate
|
|
33
|
+
skillgate version
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Prerequisites
|
|
37
|
+
|
|
38
|
+
Install Python runtime first (required):
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pipx install skillgate
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
or
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
python -m pip install --upgrade skillgate
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Required environment variables
|
|
51
|
+
|
|
52
|
+
At minimum, set an API key before entitlement-resolved CLI commands:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
export SKILLGATE_API_KEY="sg_free_or_paid_key_here"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Optional (only when needed):
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
export SKILLGATE_API_URL="https://api.skillgate.io"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Full variable reference: `../.env.example` in the repository.
|
|
65
|
+
|
|
66
|
+
## Python override
|
|
67
|
+
|
|
68
|
+
If needed, force a Python executable:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
SKILLGATE_PYTHON=/path/to/python skillgate version
|
|
72
|
+
```
|
package/bin/skillgate.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const { spawnSync } = require('node:child_process');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Optional npm wrapper for the Python-native SkillGate CLI.
|
|
8
|
+
*
|
|
9
|
+
* Fail-closed behavior:
|
|
10
|
+
* - Do not auto-install Python or SkillGate.
|
|
11
|
+
* - Exit with actionable guidance if prerequisites are missing.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const userArgs = process.argv.slice(2);
|
|
15
|
+
const envPython = process.env.SKILLGATE_PYTHON;
|
|
16
|
+
|
|
17
|
+
const candidates = [];
|
|
18
|
+
if (envPython && envPython.trim()) {
|
|
19
|
+
candidates.push({ cmd: envPython.trim(), prefix: [] });
|
|
20
|
+
}
|
|
21
|
+
candidates.push({ cmd: 'python3', prefix: [] });
|
|
22
|
+
candidates.push({ cmd: 'python', prefix: [] });
|
|
23
|
+
if (process.platform === 'win32') {
|
|
24
|
+
candidates.push({ cmd: 'py', prefix: ['-3'] });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function probePythonWithSkillgate(candidate) {
|
|
28
|
+
const probeArgs = [...candidate.prefix, '-c', 'import skillgate'];
|
|
29
|
+
const result = spawnSync(candidate.cmd, probeArgs, {
|
|
30
|
+
stdio: 'ignore',
|
|
31
|
+
env: process.env,
|
|
32
|
+
});
|
|
33
|
+
if (result.error) return false;
|
|
34
|
+
return result.status === 0;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const selected = candidates.find(probePythonWithSkillgate);
|
|
38
|
+
|
|
39
|
+
if (!selected) {
|
|
40
|
+
process.stderr.write(
|
|
41
|
+
[
|
|
42
|
+
'[skillgate-npm-shim] SkillGate Python runtime not found.',
|
|
43
|
+
'Install canonical runtime first:',
|
|
44
|
+
' pipx install skillgate',
|
|
45
|
+
'or',
|
|
46
|
+
' python -m pip install --upgrade skillgate',
|
|
47
|
+
'Then re-run: skillgate <args>',
|
|
48
|
+
'',
|
|
49
|
+
'Optional override:',
|
|
50
|
+
' SKILLGATE_PYTHON=/path/to/python skillgate <args>',
|
|
51
|
+
'',
|
|
52
|
+
].join('\n'),
|
|
53
|
+
);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const runArgs = [...selected.prefix, '-m', 'skillgate.cli.app', ...userArgs];
|
|
58
|
+
const runResult = spawnSync(selected.cmd, runArgs, {
|
|
59
|
+
stdio: 'inherit',
|
|
60
|
+
env: process.env,
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
if (runResult.error) {
|
|
64
|
+
process.stderr.write(
|
|
65
|
+
`[skillgate-npm-shim] Failed to execute Python runtime: ${runResult.error.message}\n`,
|
|
66
|
+
);
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (typeof runResult.status === 'number') {
|
|
71
|
+
process.exit(runResult.status);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
process.exit(1);
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@skillgate-io/cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Optional npm/npx wrapper for SkillGate CLI (Python core runtime)",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"private": false,
|
|
7
|
+
"bin": {
|
|
8
|
+
"skillgate": "bin/skillgate.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bin/skillgate.js",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=18"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"skillgate",
|
|
19
|
+
"security",
|
|
20
|
+
"cli",
|
|
21
|
+
"governance",
|
|
22
|
+
"agent-security"
|
|
23
|
+
]
|
|
24
|
+
}
|