skillgauntlet 1.3.5 → 1.3.6
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/lib/findhost.js +7 -1
- package/lib/spawn.js +5 -1
- package/package.json +1 -1
package/lib/findhost.js
CHANGED
|
@@ -23,6 +23,10 @@ function npmGlobalDir() {
|
|
|
23
23
|
} catch { return null; }
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
function isFileTarget(p) {
|
|
27
|
+
try { return fs.statSync(p).isFile(); } catch { return false; }
|
|
28
|
+
}
|
|
29
|
+
|
|
26
30
|
function listDir(dir) {
|
|
27
31
|
try { return fs.readdirSync(dir, { withFileTypes: true }); } catch { return []; }
|
|
28
32
|
}
|
|
@@ -31,7 +35,9 @@ function listDir(dir) {
|
|
|
31
35
|
function inDir(dir, bin) {
|
|
32
36
|
const out = [];
|
|
33
37
|
for (const e of listDir(dir)) {
|
|
34
|
-
|
|
38
|
+
// npm links a global package's command into <prefix>/bin as a symlink, and a Dirent for a symlink is not a file:
|
|
39
|
+
// following it is what finds a host installed with `--prefix`. A link must lead to a file.
|
|
40
|
+
if (!e.isFile() && !(e.isSymbolicLink() && isFileTarget(path.join(dir, e.name)))) continue;
|
|
35
41
|
const base = e.name.toLowerCase();
|
|
36
42
|
const exact = base === bin || base.startsWith(`${bin}.`);
|
|
37
43
|
// a Windows release asset keeps its platform suffix (codewhale-windows-x64.exe); only a real exe counts for those.
|
package/lib/spawn.js
CHANGED
|
@@ -57,9 +57,13 @@ function findJsEntry(bin, name) {
|
|
|
57
57
|
return candidates.find((p) => { try { return fs.statSync(p).isFile(); } catch { return false; } });
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
export function runnerFor(bin, name = path.basename(bin).replace(/\.(cmd|bat|exe)$/i, '')) {
|
|
60
|
+
export function runnerFor(bin, name = path.basename(bin).replace(/\.(cmd|bat|exe)$/i, ''), platform = process.platform) {
|
|
61
61
|
if (looksLikeJs(bin)) return { cmd: process.execPath, prefix: [bin], shell: false };
|
|
62
62
|
if (/\.exe$/i.test(bin)) return { cmd: bin, prefix: [], shell: false };
|
|
63
|
+
// Outside Windows a command is run directly (its shebang picks the interpreter), never through a shell: the prompt
|
|
64
|
+
// holds text from the skill under test, and the cmd.exe-style quoting below means nothing to sh, where $( ) and
|
|
65
|
+
// backticks in that text would run.
|
|
66
|
+
if (platform !== 'win32' && !/\.(cmd|bat)$/i.test(bin)) return { cmd: bin, prefix: [], shell: false };
|
|
63
67
|
const entry = findJsEntry(bin, name);
|
|
64
68
|
if (entry) return { cmd: process.execPath, prefix: [entry], shell: false };
|
|
65
69
|
return { cmd: bin, prefix: [], shell: true };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skillgauntlet",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.6",
|
|
4
4
|
"description": "Check an agent skill before you install it: context cost, permission surface, code risk, instruction hijacking, description quality, trigger rate and gain.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|