skilltotal 0.62.0 → 0.64.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 +2 -0
- package/bin/skilltotal.js +13 -2
- package/lib/runner.js +50 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,6 +21,8 @@ The scanner itself is the `skilltotal` Python package (Python 3.10+). This npm p
|
|
|
21
21
|
2. `pipx run`, which runs the same release, also isolated.
|
|
22
22
|
3. An installed Python 3.11 or later that already has `skilltotal`, run as `python -P -m skilltotal`. This uses whatever version is installed. The `-P` flag, added in Python 3.11, keeps the current directory off the import path, so a `skilltotal/` or `json.py` in the folder you run it from (such as a repository you are scanning) cannot run in place of the engine.
|
|
23
23
|
|
|
24
|
+
On Windows, the package looks for `uvx`, `pipx` and Python only in the directories on PATH, never in the current directory, so a `uvx.exe` or `python.exe` committed to a repository you scan cannot run in place of the real one.
|
|
25
|
+
|
|
24
26
|
The package does not install anything itself, and it has no install scripts or dependencies. If none of the three is available, it exits with code 127 and prints how to install uv, pipx or the Python package.
|
|
25
27
|
|
|
26
28
|
## Links
|
package/bin/skilltotal.js
CHANGED
|
@@ -2,9 +2,19 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
const { spawn } = require("node:child_process");
|
|
5
|
-
const {
|
|
5
|
+
const {
|
|
6
|
+
choose,
|
|
7
|
+
isAvailable,
|
|
8
|
+
helpText,
|
|
9
|
+
noCurrentDirectoryLookup,
|
|
10
|
+
resolveCommand,
|
|
11
|
+
} = require("../lib/runner");
|
|
6
12
|
const { version } = require("../package.json");
|
|
7
13
|
|
|
14
|
+
// Before anything is started: on Windows a program in the current directory (often the repository
|
|
15
|
+
// being scanned) must never stand in for uvx, pipx or Python, here or in what the engine starts.
|
|
16
|
+
noCurrentDirectoryLookup();
|
|
17
|
+
|
|
8
18
|
const runner = choose(version, isAvailable);
|
|
9
19
|
if (!runner) {
|
|
10
20
|
process.stderr.write(helpText(version));
|
|
@@ -13,7 +23,8 @@ if (!runner) {
|
|
|
13
23
|
|
|
14
24
|
// stdio is inherited untouched, so `npx -y skilltotal mcp` speaks MCP over this process's
|
|
15
25
|
// stdin/stdout and the exit code (e.g. --fail-on-high in CI) passes through.
|
|
16
|
-
const
|
|
26
|
+
const program = resolveCommand(runner.cmd) || runner.cmd;
|
|
27
|
+
const child = spawn(program, [...runner.args, ...process.argv.slice(2)], {
|
|
17
28
|
stdio: "inherit",
|
|
18
29
|
windowsHide: true,
|
|
19
30
|
});
|
package/lib/runner.js
CHANGED
|
@@ -4,10 +4,48 @@
|
|
|
4
4
|
// package and hands it the arguments. One engine, one version, one test suite. Nothing is ever
|
|
5
5
|
// installed implicitly, and the package has no install scripts.
|
|
6
6
|
|
|
7
|
+
const fs = require("node:fs");
|
|
8
|
+
const path = require("node:path");
|
|
7
9
|
const { spawnSync } = require("node:child_process");
|
|
8
10
|
|
|
9
11
|
const PACKAGE = "skilltotal";
|
|
10
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Windows looks for a bare program name in the current directory before PATH, so
|
|
15
|
+
* `npx skilltotal scan .` inside a cloned repository would run a `uvx.exe` or `py.exe` committed
|
|
16
|
+
* to it. This variable turns that lookup off for this process and everything it starts (Windows
|
|
17
|
+
* itself and the libuv of Node 22+ honour it).
|
|
18
|
+
*/
|
|
19
|
+
function noCurrentDirectoryLookup(env = process.env, platform = process.platform) {
|
|
20
|
+
if (platform === "win32") env.NoDefaultCurrentDirectoryInExePath = "1";
|
|
21
|
+
return env;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The file a bare command name runs: on Windows, the first `.com` or `.exe` in PATH's absolute
|
|
26
|
+
* directories (as libuv looks), never the current directory, which the libuv of Node before 22
|
|
27
|
+
* searches whatever the variable says. Null when there is none. Elsewhere the name is returned
|
|
28
|
+
* as is: a POSIX shell never searches the current directory unless PATH asks it to.
|
|
29
|
+
*/
|
|
30
|
+
function resolveCommand(cmd, env = process.env, platform = process.platform) {
|
|
31
|
+
if (platform !== "win32") return cmd;
|
|
32
|
+
for (const entry of String(env.PATH ?? env.Path ?? "").split(";")) {
|
|
33
|
+
const dir = entry.trim().replace(/^"(.*)"$/, "$1");
|
|
34
|
+
if (!/^(?:[A-Za-z]:[\\/]|[\\/]{2})/.test(dir)) continue; // not absolute: relative to the cwd
|
|
35
|
+
for (const ext of [".com", ".exe"]) {
|
|
36
|
+
const file = path.win32.join(dir, cmd + ext);
|
|
37
|
+
try {
|
|
38
|
+
const stat = fs.lstatSync(file);
|
|
39
|
+
// A Store app alias (python3.exe in WindowsApps) is a reparse point, not a plain file.
|
|
40
|
+
if (stat.isFile() || stat.isSymbolicLink()) return file;
|
|
41
|
+
} catch {
|
|
42
|
+
// not there
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
|
|
11
49
|
/**
|
|
12
50
|
* Ways to run the engine, best first. uvx and pipx run the release that matches this npm
|
|
13
51
|
* version in an isolated environment; an installed Python runs whatever skilltotal it has.
|
|
@@ -45,7 +83,9 @@ function choose(version, available, platform = process.platform) {
|
|
|
45
83
|
|
|
46
84
|
/** True when the candidate's probe command runs and exits 0. */
|
|
47
85
|
function isAvailable(candidate) {
|
|
48
|
-
const
|
|
86
|
+
const cmd = resolveCommand(candidate.cmd);
|
|
87
|
+
if (!cmd) return false;
|
|
88
|
+
const r = spawnSync(cmd, candidate.probe, {
|
|
49
89
|
stdio: "ignore",
|
|
50
90
|
windowsHide: true,
|
|
51
91
|
timeout: 20000,
|
|
@@ -64,4 +104,12 @@ function helpText(version) {
|
|
|
64
104
|
].join("\n");
|
|
65
105
|
}
|
|
66
106
|
|
|
67
|
-
module.exports = {
|
|
107
|
+
module.exports = {
|
|
108
|
+
PACKAGE,
|
|
109
|
+
candidates,
|
|
110
|
+
choose,
|
|
111
|
+
isAvailable,
|
|
112
|
+
helpText,
|
|
113
|
+
noCurrentDirectoryLookup,
|
|
114
|
+
resolveCommand,
|
|
115
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skilltotal",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.64.0",
|
|
4
4
|
"description": "Static security scanner for MCP servers, agent skills and npm/PyPI packages. Runs the skilltotal Python engine through uvx, pipx or an installed Python.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|