yingmi-skill-cli 0.0.7 → 0.0.9
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 -2
- package/bin/index.js +27 -30
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -133,7 +133,7 @@ yingmi-skill-cli remote-skill exec --script-file ./scripts/run.sh
|
|
|
133
133
|
- `enter <skillName>`:会先基于当前可见 skill 列表做校验;通过后再调用远端 `/api/get-skill-by-name` 获取压缩包地址,下载并解压到 `~/.yingmi-skill-cli/skills/<skillName>` 后输出目录树,并把当前 skill 上下文写入本地配置
|
|
134
134
|
- `exec --script/--script-file`:只能在最近一次成功 `enter` 后使用,建议先执行 `cat SKILL.md` 理解 skill 约定,再在当前 skill 目录执行入口脚本;执行结果输出状态、退出码、stdout 和 stderr,不额外回传本地工作目录路径
|
|
135
135
|
- `remote-skill` 适合基金分析、组合诊断、财富规划、市场简报等场景任务;skill 内部可以继续调用多个 `mcp`
|
|
136
|
-
|
|
136
|
+
|
|
137
137
|
|
|
138
138
|
### `help`
|
|
139
139
|
|
|
@@ -166,7 +166,7 @@ yingmi-skill-cli upgrade --check-only
|
|
|
166
166
|
|
|
167
167
|
约束:
|
|
168
168
|
|
|
169
|
-
- `--check-only`
|
|
169
|
+
- `--check-only` 只检查版本,不执行安装;发现新版本时会在 stderr 输出可直接复制的 `npm install -g` 安装命令,并使用阿里云镜像
|
|
170
170
|
- 真正执行升级前,应明确告知副作用
|
|
171
171
|
- 非 TTY 场景下不能依赖确认交互
|
|
172
172
|
|
package/bin/index.js
CHANGED
|
@@ -11,7 +11,7 @@ var crypto = require('crypto');
|
|
|
11
11
|
var child_process = require('child_process');
|
|
12
12
|
|
|
13
13
|
var name = "yingmi-skill-cli";
|
|
14
|
-
var version = "0.0.
|
|
14
|
+
var version = "0.0.9";
|
|
15
15
|
|
|
16
16
|
function fail(message) {
|
|
17
17
|
console.error(message);
|
|
@@ -85,7 +85,7 @@ const CONFIG_DIR = path.join(os.homedir(), ".yingmi-skill-cli");
|
|
|
85
85
|
const CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
|
|
86
86
|
const SKILLS_DIR = path.join(CONFIG_DIR, "skills");
|
|
87
87
|
const DEFAULT_QIEMAN_BASE_URL = "https://qieman.com";
|
|
88
|
-
const DEFAULT_STARGATE_BASE_URL = "https://stargate
|
|
88
|
+
const DEFAULT_STARGATE_BASE_URL = "https://stargate.yingmi.com";
|
|
89
89
|
function ensureConfigDir() {
|
|
90
90
|
fs.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
91
91
|
}
|
|
@@ -1484,10 +1484,10 @@ function registerRemoteSkillCommand(program) {
|
|
|
1484
1484
|
});
|
|
1485
1485
|
}
|
|
1486
1486
|
|
|
1487
|
-
const REGISTRY_URL
|
|
1487
|
+
const REGISTRY_URL = "https://registry.npmmirror.com";
|
|
1488
1488
|
async function fetchLatestVersion() {
|
|
1489
1489
|
const response = await axios.get(
|
|
1490
|
-
`${REGISTRY_URL
|
|
1490
|
+
`${REGISTRY_URL}/${encodeURIComponent(name)}`,
|
|
1491
1491
|
{
|
|
1492
1492
|
timeout: 1e4
|
|
1493
1493
|
}
|
|
@@ -1499,26 +1499,26 @@ async function fetchLatestVersion() {
|
|
|
1499
1499
|
return latestVersion;
|
|
1500
1500
|
}
|
|
1501
1501
|
|
|
1502
|
+
const UPGRADE_REGISTRY_URL = "https://registry.npmmirror.com";
|
|
1503
|
+
const UPGRADE_INSTALL_ARGS = [
|
|
1504
|
+
"install",
|
|
1505
|
+
"-g",
|
|
1506
|
+
`${name}@latest`,
|
|
1507
|
+
`--registry=${UPGRADE_REGISTRY_URL}`,
|
|
1508
|
+
"--prefer-online"
|
|
1509
|
+
];
|
|
1510
|
+
const UPGRADE_INSTALL_HINT_COMMAND = `npm ${UPGRADE_INSTALL_ARGS.join(" ")}`;
|
|
1511
|
+
|
|
1502
1512
|
async function installLatestVersion() {
|
|
1503
1513
|
const npmCommand = process.platform === "win32" ? "npm.cmd" : "npm";
|
|
1504
1514
|
await new Promise((resolve, reject) => {
|
|
1505
|
-
const child = child_process.spawn(
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
"
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
"--prefer-online"
|
|
1513
|
-
],
|
|
1514
|
-
{
|
|
1515
|
-
env: {
|
|
1516
|
-
...process.env,
|
|
1517
|
-
PUPPETEER_SKIP_DOWNLOAD: "true"
|
|
1518
|
-
},
|
|
1519
|
-
stdio: "inherit"
|
|
1520
|
-
}
|
|
1521
|
-
);
|
|
1515
|
+
const child = child_process.spawn(npmCommand, [...UPGRADE_INSTALL_ARGS], {
|
|
1516
|
+
env: {
|
|
1517
|
+
...process.env,
|
|
1518
|
+
PUPPETEER_SKIP_DOWNLOAD: "true"
|
|
1519
|
+
},
|
|
1520
|
+
stdio: "inherit"
|
|
1521
|
+
});
|
|
1522
1522
|
child.on("error", reject);
|
|
1523
1523
|
child.on("exit", (code) => {
|
|
1524
1524
|
if (code === 0) {
|
|
@@ -1555,23 +1555,20 @@ function isNewerVersion(latestVersion, currentVersion) {
|
|
|
1555
1555
|
return false;
|
|
1556
1556
|
}
|
|
1557
1557
|
|
|
1558
|
-
const REGISTRY_URL = "https://registry.npmmirror.com";
|
|
1559
1558
|
async function checkAndUpdate(checkOnly = false) {
|
|
1560
|
-
console.
|
|
1559
|
+
console.error("\u6B63\u5728\u68C0\u67E5\u66F4\u65B0...");
|
|
1561
1560
|
const latestVersion = await fetchLatestVersion();
|
|
1562
1561
|
if (!isNewerVersion(latestVersion, version)) {
|
|
1563
|
-
console.
|
|
1562
|
+
console.error(`\u5F53\u524D\u5DF2\u662F\u6700\u65B0\u7248\u672C: ${version}`);
|
|
1564
1563
|
return;
|
|
1565
1564
|
}
|
|
1566
|
-
console.
|
|
1565
|
+
console.error(`\u53D1\u73B0\u65B0\u7248\u672C: ${version} -> ${latestVersion}`);
|
|
1567
1566
|
if (checkOnly) {
|
|
1568
|
-
console.
|
|
1569
|
-
`\u53EF\u6267\u884C PUPPETEER_SKIP_DOWNLOAD=true npm install -g ${name}@latest --registry=${REGISTRY_URL} --prefer-online \u8FDB\u884C\u5347\u7EA7`
|
|
1570
|
-
);
|
|
1567
|
+
console.error(`\u53EF\u6267\u884C ${UPGRADE_INSTALL_HINT_COMMAND} \u8FDB\u884C\u5347\u7EA7`);
|
|
1571
1568
|
return;
|
|
1572
1569
|
}
|
|
1573
1570
|
await installLatestVersion();
|
|
1574
|
-
console.
|
|
1571
|
+
console.error(`\u5347\u7EA7\u5B8C\u6210\uFF0C\u5F53\u524D\u6700\u65B0\u7248\u672C: ${latestVersion}`);
|
|
1575
1572
|
}
|
|
1576
1573
|
|
|
1577
1574
|
function registerUpgradeCommand(program) {
|
|
@@ -1586,7 +1583,7 @@ function registerUpgradeCommand(program) {
|
|
|
1586
1583
|
yingmi-skill-cli upgrade
|
|
1587
1584
|
|
|
1588
1585
|
\u8BF4\u660E:
|
|
1589
|
-
- --check-only \u53EA\u68C0\u67E5\u7248\u672C\uFF0C\u4E0D\u6267\u884C\u5B89\u88C5
|
|
1586
|
+
- --check-only \u53EA\u68C0\u67E5\u7248\u672C\uFF0C\u4E0D\u6267\u884C\u5B89\u88C5\uFF1B\u53D1\u73B0\u65B0\u7248\u672C\u65F6\u4F1A\u8F93\u51FA\u53EF\u590D\u5236\u7684 npm \u5B89\u88C5\u547D\u4EE4
|
|
1590
1587
|
- \u771F\u6B63\u5347\u7EA7\u524D\u5E94\u660E\u786E\u4E86\u89E3\u526F\u4F5C\u7528
|
|
1591
1588
|
- \u975E\u4EA4\u4E92\u73AF\u5883\u4E0B\u4E0D\u5E94\u4F9D\u8D56\u786E\u8BA4\u8F93\u5165
|
|
1592
1589
|
`
|