supacloud 0.16.12 → 0.16.13

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.
Files changed (3) hide show
  1. package/README.md +4 -0
  2. package/dist/index.js +29 -28
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -9,6 +9,10 @@ supacloudctl admin → @supacloud/admin (platform operations: install / SSH / t
9
9
 
10
10
  ## 安装
11
11
 
12
+ The executable requires Bun on `PATH`, including when installed with npm or run
13
+ through npx. `supacloudctl` starts both installed child CLIs with that same Bun
14
+ runtime; installing npm packages alone does not install Bun.
15
+
12
16
  ```bash
13
17
  npm install -g supacloud
14
18
  supacloudctl --help
package/dist/index.js CHANGED
@@ -1,14 +1,15 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env bun
2
+ // @bun
2
3
 
3
4
  // src/index.ts
4
- import { existsSync, readFileSync, realpathSync } from "node:fs";
5
- import { createRequire } from "node:module";
6
- import { dirname, join, parse } from "node:path";
7
- import { fileURLToPath } from "node:url";
5
+ import { existsSync, readFileSync, realpathSync } from "fs";
6
+ import { createRequire } from "module";
7
+ import { dirname, join, parse } from "path";
8
+ import { fileURLToPath } from "url";
8
9
  var require2 = createRequire(import.meta.url);
9
10
  var SUBCOMMANDS = {
10
- cli: { pkg: "@supacloud/cli", bin: "supacloud", desc: "@supacloud/cli 项目级开发工具" },
11
- admin: { pkg: "@supacloud/admin", bin: "supacloud-admin", desc: "@supacloud/admin 平台运维工具" }
11
+ cli: { pkg: "@supacloud/cli", bin: "supacloud", desc: "@supacloud/cli \u9879\u76EE\u7EA7\u5F00\u53D1\u5DE5\u5177" },
12
+ admin: { pkg: "@supacloud/admin", bin: "supacloud-admin", desc: "@supacloud/admin \u5E73\u53F0\u8FD0\u7EF4\u5DE5\u5177" }
12
13
  };
13
14
  function resolveSubpackageEntry(pkgName) {
14
15
  try {
@@ -149,7 +150,7 @@ async function updateNoticeForLaunch(target, installed, env, fetchLatest) {
149
150
  const latestVersion = await fetchLatest(target.pkg, env);
150
151
  if (!latestVersion || !isNewerVersion(latestVersion, installed.version))
151
152
  return;
152
- return installed.version ? `${target.pkg} ${latestVersion} 可用;当前固定使用已安装版本 ${installed.version}。请显式运行包管理器更新。` : `${target.pkg} ${latestVersion} 可用;已安装版本无法识别,请通过包管理器检查锁定版本。`;
153
+ return installed.version ? `${target.pkg} ${latestVersion} \u53EF\u7528\uFF1B\u5F53\u524D\u56FA\u5B9A\u4F7F\u7528\u5DF2\u5B89\u88C5\u7248\u672C ${installed.version}\u3002\u8BF7\u663E\u5F0F\u8FD0\u884C\u5305\u7BA1\u7406\u5668\u66F4\u65B0\u3002` : `${target.pkg} ${latestVersion} \u53EF\u7528\uFF1B\u5DF2\u5B89\u88C5\u7248\u672C\u65E0\u6CD5\u8BC6\u522B\uFF0C\u8BF7\u901A\u8FC7\u5305\u7BA1\u7406\u5668\u68C0\u67E5\u9501\u5B9A\u7248\u672C\u3002`;
153
154
  }
154
155
  async function createLaunchPlan(target, forwardedArgs, options = {}) {
155
156
  const env = options.env ?? process.env;
@@ -157,7 +158,7 @@ async function createLaunchPlan(target, forwardedArgs, options = {}) {
157
158
  const fetchLatest = options.fetchLatest ?? fetchLatestVersion;
158
159
  const installed = resolveInstalled(target.pkg);
159
160
  if (!installed) {
160
- throw new Error(`${target.pkg} 未安装。请先通过包管理器显式安装固定版本。`);
161
+ throw new Error(`${target.pkg} \u672A\u5B89\u88C5\u3002\u8BF7\u5148\u901A\u8FC7\u5305\u7BA1\u7406\u5668\u663E\u5F0F\u5B89\u88C5\u56FA\u5B9A\u7248\u672C\u3002`);
161
162
  }
162
163
  const updateNotice = await updateNoticeForLaunch(target, installed, env, fetchLatest);
163
164
  return {
@@ -193,35 +194,35 @@ function completedUpdateCheck(packageName, currentVersion, latestVersion) {
193
194
  function formatUpdateCheck(check) {
194
195
  switch (check.status) {
195
196
  case "update_available":
196
- return `${check.packageName}: ${check.latestVersion} 可用(当前 ${check.currentVersion ?? "未知"})`;
197
+ return `${check.packageName}: ${check.latestVersion} \u53EF\u7528\uFF08\u5F53\u524D ${check.currentVersion ?? "\u672A\u77E5"}\uFF09`;
197
198
  case "up_to_date":
198
- return `${check.packageName}: 已是最新版本 ${check.currentVersion ?? check.latestVersion ?? "未知"}`;
199
+ return `${check.packageName}: \u5DF2\u662F\u6700\u65B0\u7248\u672C ${check.currentVersion ?? check.latestVersion ?? "\u672A\u77E5"}`;
199
200
  case "not_installed":
200
- return `${check.packageName}: 未安装`;
201
+ return `${check.packageName}: \u672A\u5B89\u88C5`;
201
202
  case "registry_unavailable":
202
- return `${check.packageName}: 无法从 npm registry 获取版本信息`;
203
+ return `${check.packageName}: \u65E0\u6CD5\u4ECE npm registry \u83B7\u53D6\u7248\u672C\u4FE1\u606F`;
203
204
  }
204
205
  }
205
206
  function buildHelp() {
206
207
  const subcommandHelp = Object.entries(SUBCOMMANDS).map(([name, sub]) => ` ${name.padEnd(6)} ${sub.desc}`).join(`
207
208
  `);
208
209
  return `
209
- ╔═══════════════════════════════════════════════════════════╗
210
- ║ supacloudctl ║
211
- ║ 统一入口 · 路由到项目级 CLI 与平台运维 CLI ║
212
- ╚═══════════════════════════════════════════════════════════╝
210
+ \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
211
+ \u2551 supacloudctl \u2551
212
+ \u2551 \u7EDF\u4E00\u5165\u53E3 \xB7 \u8DEF\u7531\u5230\u9879\u76EE\u7EA7 CLI \u4E0E\u5E73\u53F0\u8FD0\u7EF4 CLI \u2551
213
+ \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
213
214
 
214
- 用法
215
+ \u7528\u6CD5
215
216
 
216
- ${COMMAND} <子命令> [args...]
217
+ ${COMMAND} <\u5B50\u547D\u4EE4> [args...]
217
218
  ${COMMAND} check-update [cli|admin]
218
219
  ${COMMAND} --help
219
220
 
220
- 子命令
221
+ \u5B50\u547D\u4EE4
221
222
 
222
223
  ${subcommandHelp}
223
224
 
224
- 示例
225
+ \u793A\u4F8B
225
226
 
226
227
  ${COMMAND} cli status
227
228
  ${COMMAND} cli project get
@@ -232,14 +233,14 @@ ${subcommandHelp}
232
233
  ${COMMAND} check-update
233
234
  ${COMMAND} check-update cli
234
235
 
235
- 普通分发默认不访问 npm,始终运行已安装的固定版本。
236
- 使用 check-update 显式查询更新;SUPACLOUD_AUTO_UPDATE=1 可选择恢复分发前提示。
236
+ \u666E\u901A\u5206\u53D1\u9ED8\u8BA4\u4E0D\u8BBF\u95EE npm\uFF0C\u59CB\u7EC8\u8FD0\u884C\u5DF2\u5B89\u88C5\u7684\u56FA\u5B9A\u7248\u672C\u3002
237
+ \u4F7F\u7528 check-update \u663E\u5F0F\u67E5\u8BE2\u66F4\u65B0\uFF1BSUPACLOUD_AUTO_UPDATE=1 \u53EF\u9009\u62E9\u6062\u590D\u5206\u53D1\u524D\u63D0\u793A\u3002
237
238
  `;
238
239
  }
239
240
  async function runUpdateCheckCommand(args) {
240
241
  const targetName = args[1];
241
242
  if (args.length > 2 || targetName && !SUBCOMMANDS[targetName]) {
242
- console.error(`❌ 未知更新检查目标: ${targetName ?? ""}`);
243
+ console.error(`\u274C \u672A\u77E5\u66F4\u65B0\u68C0\u67E5\u76EE\u6807: ${targetName ?? ""}`);
243
244
  process.exit(1);
244
245
  }
245
246
  const targets = targetName ? [SUBCOMMANDS[targetName]] : Object.values(SUBCOMMANDS);
@@ -252,7 +253,7 @@ async function runUpdateCheckCommand(args) {
252
253
  async function dispatchSubcommand(target, forwardedArgs) {
253
254
  const launchPlan = await createLaunchPlan(target, forwardedArgs);
254
255
  if (launchPlan.updateNotice)
255
- console.error(`ℹ️ ${launchPlan.updateNotice}`);
256
+ console.error(`\u2139\uFE0F ${launchPlan.updateNotice}`);
256
257
  try {
257
258
  const childProcess = Bun.spawn([launchPlan.command, ...launchPlan.args], {
258
259
  stdio: ["inherit", "inherit", "inherit"]
@@ -260,7 +261,7 @@ async function dispatchSubcommand(target, forwardedArgs) {
260
261
  const exitCode = await childProcess.exited;
261
262
  process.exit(exitCode ?? 1);
262
263
  } catch (error) {
263
- console.error(`❌ 启动 ${target.pkg} 失败: ${error instanceof Error ? error.message : String(error)}`);
264
+ console.error(`\u274C \u542F\u52A8 ${target.pkg} \u5931\u8D25: ${error instanceof Error ? error.message : String(error)}`);
264
265
  process.exit(1);
265
266
  }
266
267
  }
@@ -274,7 +275,7 @@ async function run(args) {
274
275
  await runUpdateCheckCommand(args);
275
276
  const target = SUBCOMMANDS[subcommandName];
276
277
  if (!target) {
277
- console.error(`❌ 未知子命令: ${subcommandName}
278
+ console.error(`\u274C \u672A\u77E5\u5B50\u547D\u4EE4: ${subcommandName}
278
279
  `);
279
280
  console.error(buildHelp());
280
281
  process.exit(1);
@@ -293,7 +294,7 @@ function isMainModule(moduleUrl, argvEntry = process.argv[1]) {
293
294
  if (isMainModule(import.meta.url)) {
294
295
  run(process.argv.slice(2)).catch((err) => {
295
296
  const message = err instanceof Error ? err.message : String(err);
296
- console.error(`❌ supacloudctl 启动失败: ${message}`);
297
+ console.error(`\u274C supacloudctl \u542F\u52A8\u5931\u8D25: ${message}`);
297
298
  process.exit(1);
298
299
  });
299
300
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supacloud",
3
- "version": "0.16.12",
3
+ "version": "0.16.13",
4
4
  "description": "Unified entrypoint: `supacloudctl cli` and `supacloudctl admin` in one command",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",