skill-atlas-cli 0.2.9 → 0.3.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/bin/cli.js +3 -2
- package/lib/index.d.ts +4 -0
- package/lib/index.js +9 -7
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -41,11 +41,12 @@ async function main() {
|
|
|
41
41
|
}
|
|
42
42
|
await runSearch({ keyword: keyword.trim() });
|
|
43
43
|
});
|
|
44
|
-
cli.command("update", "快速升级 CLI 到最新版本").option("-y, --yes", "非交互模式,跳过确认直接升级").action(async (options) => {
|
|
44
|
+
cli.command("update", "快速升级 CLI 到最新版本").option("-y, --yes", "非交互模式,跳过确认直接升级").option("-p, --plugin", "使用官方安装脚本,同步更新 agent 插件与 CLI(推荐: skill-atlas update -y -p)").action(async (options) => {
|
|
45
45
|
await runUpdate({
|
|
46
46
|
pkgName: PKG.name,
|
|
47
47
|
currentVersion: PKG.version,
|
|
48
|
-
yes: options.yes
|
|
48
|
+
yes: options.yes,
|
|
49
|
+
plugin: options.plugin
|
|
49
50
|
});
|
|
50
51
|
});
|
|
51
52
|
cli.command("install [name]", "安装 skill(支持 skill 名称)").option("-y, --yes", "非交互模式,默认安装到全局").option("-g, --global", "安装到全局目录").option("-p, --path <dir>", "安装到自定义路径(目录),如 -p /path/to/skills 或 -p .qoder/skills").option("-a, --agent <agent...>", "非 TTY 模式下指定目标 agent(如 cursor、openclaw),可传多个").action(async (name, options) => {
|
package/lib/index.d.ts
CHANGED
|
@@ -51,6 +51,10 @@ interface UpdateOptions {
|
|
|
51
51
|
currentVersion: string;
|
|
52
52
|
/** 非交互模式,跳过确认 */
|
|
53
53
|
yes?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* 使用官方 install 脚本升级(同步 IDE 插件与 CLI),非交互下可与 -y 合用
|
|
56
|
+
*/
|
|
57
|
+
plugin?: boolean;
|
|
54
58
|
}
|
|
55
59
|
declare function runUpdate(options: UpdateOptions): Promise<void>;
|
|
56
60
|
//#endregion
|
package/lib/index.js
CHANGED
|
@@ -1659,7 +1659,7 @@ async function fetchLatestVersion(pkgName) {
|
|
|
1659
1659
|
return (await res.json()).latest || "0.0.0";
|
|
1660
1660
|
}
|
|
1661
1661
|
async function runUpdate(options) {
|
|
1662
|
-
const { pkgName, currentVersion, yes } = options;
|
|
1662
|
+
const { pkgName, currentVersion, yes, plugin } = options;
|
|
1663
1663
|
const spinner = p.spinner();
|
|
1664
1664
|
spinner.start("检查最新版本...");
|
|
1665
1665
|
try {
|
|
@@ -1673,7 +1673,7 @@ async function runUpdate(options) {
|
|
|
1673
1673
|
p.log.success(`已是最新版本 ${chalk.cyan(currentVersion)}`);
|
|
1674
1674
|
return;
|
|
1675
1675
|
}
|
|
1676
|
-
p.log.message(`发现新版本: ${chalk.red(currentVersion)} → ${chalk.green(latest)}`);
|
|
1676
|
+
p.log.message(`发现新版本: ${chalk.red(currentVersion)} → ${chalk.green(latest)}` + (plugin ? chalk.dim("(将使用官方安装脚本更新 CLI 与插件)") : ""));
|
|
1677
1677
|
const proceed = yes || !process.stdin.isTTY ? true : await p.confirm({
|
|
1678
1678
|
message: "是否立即升级?",
|
|
1679
1679
|
initialValue: true
|
|
@@ -1682,18 +1682,20 @@ async function runUpdate(options) {
|
|
|
1682
1682
|
p.cancel("已取消升级");
|
|
1683
1683
|
return;
|
|
1684
1684
|
}
|
|
1685
|
-
spinner.start("正在升级...");
|
|
1686
|
-
const code = await runNpmInstallGlobalLatest(pkgName);
|
|
1685
|
+
spinner.start(plugin ? "正在通过官方脚本升级(CLI + 插件)…" : "正在升级...");
|
|
1686
|
+
const code = plugin ? await runOfficialInstallScriptUpdate() : await runNpmInstallGlobalLatest(pkgName);
|
|
1687
1687
|
spinner.stop(code === 0 ? "升级完成" : "升级失败");
|
|
1688
1688
|
if (code !== 0) {
|
|
1689
|
-
logger_default.error("升级失败,可手动执行:
|
|
1689
|
+
if (plugin) logger_default.error("升级失败,可手动执行: " + officialInstallManualForPlatform());
|
|
1690
|
+
else logger_default.error("升级失败,可手动执行: npm install -g " + pkgName + "@latest");
|
|
1690
1691
|
process.exit(1);
|
|
1691
1692
|
}
|
|
1692
|
-
p.log.success(`已升级到 ${chalk.green(latest)}`);
|
|
1693
|
+
p.log.success(plugin ? `已通过官方脚本更新(目标版本 ${chalk.green(latest)})` : `已升级到 ${chalk.green(latest)}`);
|
|
1693
1694
|
} catch (err) {
|
|
1694
1695
|
spinner.stop("检查失败");
|
|
1695
1696
|
p.log.error(err.message);
|
|
1696
|
-
logger_default.info("可手动执行:
|
|
1697
|
+
if (plugin) logger_default.info("可手动执行: " + officialInstallManualForPlatform());
|
|
1698
|
+
else logger_default.info("可手动执行: npm install -g " + pkgName + "@latest");
|
|
1697
1699
|
process.exit(1);
|
|
1698
1700
|
}
|
|
1699
1701
|
}
|