itiger 0.1.0 → 0.1.1
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 +4 -2
- package/package.json +1 -1
- package/src/process.js +18 -5
- package/src/skills-adapter.js +7 -3
package/README.md
CHANGED
|
@@ -18,8 +18,10 @@ When installing an `@tiger/*` package, `itiger` adds
|
|
|
18
18
|
explicit `--@tiger:registry` option is already present. Non-Tiger packages are
|
|
19
19
|
delegated without registry changes.
|
|
20
20
|
|
|
21
|
-
Requirements: Node.js 18 or newer, plus
|
|
22
|
-
commands
|
|
21
|
+
Requirements: Node.js 18 or newer, plus npm for package installation. For
|
|
22
|
+
`skills` commands, the locally installed `skills` CLI is used when available;
|
|
23
|
+
otherwise `npx --yes skills` downloads and runs the public CLI without
|
|
24
|
+
persisting credentials or changing the user's global installation.
|
|
23
25
|
|
|
24
26
|
## Development
|
|
25
27
|
|
package/package.json
CHANGED
package/src/process.js
CHANGED
|
@@ -1,21 +1,34 @@
|
|
|
1
1
|
const { spawn } = require('node:child_process');
|
|
2
2
|
|
|
3
|
-
function runCommand(command, args) {
|
|
3
|
+
function runCommand(command, args, fallback) {
|
|
4
4
|
return new Promise((resolve) => {
|
|
5
5
|
let child;
|
|
6
|
+
let settled = false;
|
|
6
7
|
try {
|
|
7
8
|
child = spawn(command, args, { stdio: 'inherit' });
|
|
8
9
|
} catch (error) {
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
if (fallback) {
|
|
11
|
+
runCommand(fallback.command, fallback.args).then(resolve);
|
|
12
|
+
} else {
|
|
13
|
+
process.stderr.write(`itiger: unable to start ${command}: ${error.message}\n`);
|
|
14
|
+
resolve(1);
|
|
15
|
+
}
|
|
11
16
|
return;
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
child.on('error', (error) => {
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
if (settled) return;
|
|
21
|
+
settled = true;
|
|
22
|
+
if (fallback && error.code === 'ENOENT') {
|
|
23
|
+
runCommand(fallback.command, fallback.args).then(resolve);
|
|
24
|
+
} else {
|
|
25
|
+
process.stderr.write(`itiger: unable to start ${command}: ${error.message}\n`);
|
|
26
|
+
resolve(1);
|
|
27
|
+
}
|
|
17
28
|
});
|
|
18
29
|
child.on('exit', (code, signal) => {
|
|
30
|
+
if (settled) return;
|
|
31
|
+
settled = true;
|
|
19
32
|
resolve(code === null ? 128 + signalNumber(signal) : code);
|
|
20
33
|
});
|
|
21
34
|
});
|
package/src/skills-adapter.js
CHANGED
|
@@ -8,9 +8,9 @@ function mapRepository(repository) {
|
|
|
8
8
|
return `https://${INTERNAL_GIT_HOST}/${githubUrl[1]}/${githubUrl[2]}.git`;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
const shorthand = repository.match(/^([^/]
|
|
11
|
+
const shorthand = repository.match(/^([^/]+\/.+?)(?:\.git)?$/);
|
|
12
12
|
if (shorthand) {
|
|
13
|
-
return `https://${INTERNAL_GIT_HOST}/${shorthand[1]}
|
|
13
|
+
return `https://${INTERNAL_GIT_HOST}/${shorthand[1]}.git`;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
return repository;
|
|
@@ -32,7 +32,11 @@ function runSkills(args) {
|
|
|
32
32
|
process.stderr.write('itiger: only "skills add" is supported through this adapter\n');
|
|
33
33
|
return Promise.resolve(2);
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
const transformedArgs = transformArgs(args);
|
|
36
|
+
return runCommand('skills', transformedArgs, {
|
|
37
|
+
command: 'npx',
|
|
38
|
+
args: ['--yes', 'skills', ...transformedArgs],
|
|
39
|
+
});
|
|
36
40
|
}
|
|
37
41
|
|
|
38
42
|
module.exports = { INTERNAL_GIT_HOST, mapRepository, transformArgs, runSkills };
|