aixlab-skills 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 -1
- package/package.json +1 -1
- package/src/index.js +27 -3
package/README.md
CHANGED
|
@@ -6,4 +6,7 @@ AixLab 自有数字资产平台的 Agent Skill 安装器。它通过浏览器设
|
|
|
6
6
|
npx aixlab-skills add xhs-creator -g -y
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
本地联调可设置 `AIXLAB_SKILLS_HOST=http://localhost:8180`。生产环境默认连接 `https://www.aixc4d.com
|
|
9
|
+
本地联调可设置 `AIXLAB_SKILLS_HOST=http://localhost:8180`。生产环境默认连接 `https://www.aixc4d.com`。
|
|
10
|
+
|
|
11
|
+
该安装器已作为公开 npm 包发布。账户、版本、发布、验证和交接流程见
|
|
12
|
+
[`docs/agent/runbooks/AixLab-Skills-npm发布与交接手册.md`](../../../docs/agent/runbooks/AixLab-Skills-npm发布与交接手册.md)。
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
import { createWriteStream } from "node:fs";
|
|
3
3
|
import { chmod, mkdir, mkdtemp, readFile, readdir, rename, rm, writeFile } from "node:fs/promises";
|
|
4
4
|
import { homedir, platform, tmpdir } from "node:os";
|
|
5
|
-
import { dirname, join } from "node:path";
|
|
5
|
+
import { dirname, join, win32 as win32Path } from "node:path";
|
|
6
6
|
import { pipeline } from "node:stream/promises";
|
|
7
7
|
import { spawn } from "node:child_process";
|
|
8
8
|
import yauzl from "yauzl";
|
|
@@ -383,9 +383,33 @@ export function installerArguments(skillRoot) {
|
|
|
383
383
|
];
|
|
384
384
|
}
|
|
385
385
|
|
|
386
|
+
export function installerCommand(skillRoot, {
|
|
387
|
+
platformName = platform(),
|
|
388
|
+
nodeExecutable = process.execPath,
|
|
389
|
+
npmExecutable = process.env.npm_execpath,
|
|
390
|
+
} = {}) {
|
|
391
|
+
const arguments_ = installerArguments(skillRoot);
|
|
392
|
+
|
|
393
|
+
if (platformName !== "win32") {
|
|
394
|
+
return { executable: "npx", arguments: arguments_ };
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
if (typeof npmExecutable !== "string" || npmExecutable.trim() === "") {
|
|
398
|
+
throw new Error("Windows 安装需要通过 npm 或 npx 启动 aixlab-skills。");
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
return {
|
|
402
|
+
executable: nodeExecutable,
|
|
403
|
+
arguments: [
|
|
404
|
+
win32Path.join(win32Path.dirname(npmExecutable), "npx-cli.js"),
|
|
405
|
+
...arguments_,
|
|
406
|
+
],
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
|
|
386
410
|
async function installSkill(skillRoot) {
|
|
387
|
-
const
|
|
388
|
-
const child = spawn(executable,
|
|
411
|
+
const command = installerCommand(skillRoot);
|
|
412
|
+
const child = spawn(command.executable, command.arguments, {
|
|
389
413
|
stdio: ["inherit", "pipe", "pipe"],
|
|
390
414
|
windowsHide: true,
|
|
391
415
|
});
|