@alphafox/cli 0.3.2 → 0.3.3

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.
@@ -13,16 +13,16 @@ const node_crypto_1 = require("node:crypto");
13
13
  const node_http_1 = __importDefault(require("node:http"));
14
14
  exports.LOOPBACK_CALLBACK_PATH = "/callback";
15
15
  const SUCCESS_HTML = `<!DOCTYPE html>
16
- <html lang="en"><head><meta charset="utf-8"><title>Alphafox CLI</title></head>
17
- <body><p>Signed in. You can close this window and return to the CLI.</p></body></html>
16
+ <html lang="zh-CN"><head><meta charset="utf-8"><title>Alphafox CLI</title></head>
17
+ <body><p>已登录。可以关闭此窗口,回到终端继续。</p></body></html>
18
18
  `;
19
19
  const FAILURE_HTML = `<!DOCTYPE html>
20
- <html lang="en"><head><meta charset="utf-8"><title>Alphafox CLI</title></head>
21
- <body><p>Authorization failed. You can close this window and return to the CLI.</p></body></html>
20
+ <html lang="zh-CN"><head><meta charset="utf-8"><title>Alphafox CLI</title></head>
21
+ <body><p>授权失败。可以关闭此窗口,回到终端查看原因。</p></body></html>
22
22
  `;
23
23
  const DUPLICATE_HTML = `<!DOCTYPE html>
24
- <html lang="en"><head><meta charset="utf-8"><title>Alphafox CLI</title></head>
25
- <body><p>This login callback was already used. You can close this window.</p></body></html>
24
+ <html lang="zh-CN"><head><meta charset="utf-8"><title>Alphafox CLI</title></head>
25
+ <body><p>此登录回调已使用过。可以关闭此窗口。</p></body></html>
26
26
  `;
27
27
  async function startLoopbackCallbackServer(options) {
28
28
  const callbackPath = options.path ?? exports.LOOPBACK_CALLBACK_PATH;
@@ -174,8 +174,8 @@ async function cmdInstall(args, flags, env) {
174
174
  (0, envelope_1.writeError)({
175
175
  type: "usage",
176
176
  subtype: "unknown_install_flag",
177
- message: `Unknown install flag: ${parsed.unknown.join(" ")}`,
178
- hint: "Usage: alphafox install [--no-auth] [--dry-run]",
177
+ message: `未知的 install 参数:${parsed.unknown.join(" ")}`,
178
+ hint: "用法:alphafox install [--no-auth] [--dry-run]",
179
179
  });
180
180
  }
181
181
  if (parsed.help) {
@@ -50,7 +50,11 @@ async function confirmTty(message) {
50
50
  try {
51
51
  const answer = await rl.question(`${message} [Y/n] `);
52
52
  const token = answer.trim().toLowerCase();
53
- return token === "" || token === "y" || token === "yes";
53
+ return (token === "" ||
54
+ token === "y" ||
55
+ token === "yes" ||
56
+ token === "是" ||
57
+ token === "好");
54
58
  }
55
59
  finally {
56
60
  rl.close();
@@ -53,20 +53,18 @@ function skillsListHasAlphafox(output) {
53
53
  return new RegExp(`(^|\\s)${prefix}[\\w-]+`, "m").test(output);
54
54
  }
55
55
  function nextSteps(input) {
56
- const steps = [
57
- "Restart the AI tool so newly installed Skills are loaded.",
58
- ];
56
+ const steps = ["请重启 AI 工具,以便加载刚安装的 Skills。"];
59
57
  if (input.auth.action === "skipped" || input.auth.action === "planned") {
60
58
  steps.push("alphafox auth login --browser --format json --no-input", "alphafox auth login --no-wait --format json --no-input");
61
59
  }
62
- steps.push("alphafox doctor --format json --no-input", `Agent install guide: ${types_1.AGENT_INSTALL_GUIDE_BLOB_URL}`);
60
+ steps.push("alphafox doctor --format json --no-input", `Agent 安装指南:${types_1.AGENT_INSTALL_GUIDE_BLOB_URL}`);
63
61
  if (input.dryRun) {
64
- steps.unshift("This was --dry-run; re-run without it to apply changes.");
62
+ steps.unshift("这是 --dry-run,去掉该参数再运行才会真正安装。");
65
63
  }
66
64
  return steps;
67
65
  }
68
66
  async function runInstallWizard(flags, env = process.env, runner = (0, exec_1.createDefaultInstallRunner)(env, defaultSearchDirs())) {
69
- runner.log("Setting up Alphafox CLI...");
67
+ runner.log("正在安装 Alphafox CLI");
70
68
  const installedVer = await readGloballyInstalledVersion(runner);
71
69
  const latestVer = await readLatestVersion(runner);
72
70
  const needsUpgrade = Boolean(installedVer) &&
@@ -140,7 +138,7 @@ async function npmPrefixGlobal(runner) {
140
138
  async function stepInstallCli(flags, runner, versions) {
141
139
  const { installedVer, latestVer, needsUpgrade } = versions;
142
140
  if (installedVer && !needsUpgrade) {
143
- runner.log(`Already installed (${installedVer}). Skipped`);
141
+ runner.log(`已安装(${installedVer}),已跳过`);
144
142
  return {
145
143
  action: flags.dryRun ? "planned" : "skipped",
146
144
  version: installedVer,
@@ -149,8 +147,8 @@ async function stepInstallCli(flags, runner, versions) {
149
147
  }
150
148
  if (flags.dryRun) {
151
149
  runner.log(needsUpgrade
152
- ? `Would upgrade ${version_1.CLI_PACKAGE} (${installedVer} → ${latestVer ?? "latest"})`
153
- : `Would install ${version_1.CLI_PACKAGE} globally`);
150
+ ? `将升级 ${version_1.CLI_PACKAGE}(${installedVer} → ${latestVer ?? "latest"})`
151
+ : `将全局安装 ${version_1.CLI_PACKAGE}`);
154
152
  return {
155
153
  action: "planned",
156
154
  previousVersion: installedVer ?? undefined,
@@ -158,8 +156,8 @@ async function stepInstallCli(flags, runner, versions) {
158
156
  };
159
157
  }
160
158
  runner.log(needsUpgrade
161
- ? `Upgrading ${version_1.CLI_PACKAGE} (${installedVer} → ${latestVer})...`
162
- : `Installing ${version_1.CLI_PACKAGE} globally...`);
159
+ ? `正在升级 ${version_1.CLI_PACKAGE}(${installedVer} → ${latestVer})…`
160
+ : `正在全局安装 ${version_1.CLI_PACKAGE}…`);
163
161
  try {
164
162
  await runner.exec("npm", ["install", "-g", version_1.CLI_PACKAGE], {
165
163
  timeoutMs: NPM_TIMEOUT_MS,
@@ -169,13 +167,13 @@ async function stepInstallCli(flags, runner, versions) {
169
167
  throw new types_1.InstallError({
170
168
  type: "install",
171
169
  subtype: "npm_global_failed",
172
- message: `Failed to install ${version_1.CLI_PACKAGE} globally.`,
170
+ message: `全局安装 ${version_1.CLI_PACKAGE} 失败。`,
173
171
  hint: `npm install -g ${version_1.CLI_PACKAGE}`,
174
172
  details: err instanceof Error ? err.message : String(err),
175
173
  });
176
174
  }
177
175
  const after = (await readGloballyInstalledVersion(runner)) ?? latestVer ?? version_1.CLI_VERSION;
178
- runner.log(needsUpgrade ? `Upgraded to ${after}` : "Installed globally");
176
+ runner.log(needsUpgrade ? `已升级到 ${after}` : "已全局安装");
179
177
  return {
180
178
  action: needsUpgrade ? "upgraded" : "installed",
181
179
  version: after,
@@ -214,7 +212,7 @@ async function stepInstallSkills(flags, runner) {
214
212
  const sources = await resolveSkillsSources(runner);
215
213
  const already = flags.dryRun ? false : await skillsAlreadyInstalled(runner);
216
214
  if (already) {
217
- runner.log("Skills already installed. Skipped");
215
+ runner.log("Skills 已安装,已跳过");
218
216
  return {
219
217
  action: "skipped",
220
218
  source: sources[0],
@@ -223,19 +221,19 @@ async function stepInstallSkills(flags, runner) {
223
221
  };
224
222
  }
225
223
  if (flags.dryRun) {
226
- runner.log(`Would install Skills from ${sources[0] ?? types_1.SKILLS_GITHUB_SOURCE}`);
224
+ runner.log(`将从 ${sources[0] ?? types_1.SKILLS_GITHUB_SOURCE} 安装 Skills`);
227
225
  return {
228
226
  action: "planned",
229
227
  source: sources[0] ?? types_1.SKILLS_GITHUB_SOURCE,
230
228
  scope: "global",
231
229
  };
232
230
  }
233
- runner.log("Installing AI Skills...");
231
+ runner.log("正在安装 AI Skills");
234
232
  let lastError;
235
233
  for (const source of sources) {
236
234
  try {
237
235
  await runner.exec("npx", ["-y", "skills", "add", source, "-y", "-g"], { timeoutMs: SKILLS_TIMEOUT_MS });
238
- runner.log(`Skills installed (${source})`);
236
+ runner.log(`Skills 已安装(${source})`);
239
237
  return { action: "installed", source, scope: "global" };
240
238
  }
241
239
  catch (err) {
@@ -245,7 +243,7 @@ async function stepInstallSkills(flags, runner) {
245
243
  throw new types_1.InstallError({
246
244
  type: "install",
247
245
  subtype: "skills_add_failed",
248
- message: "Failed to install Agent Skills.",
246
+ message: "安装 Agent Skills 失败。",
249
247
  hint: `npx skills add ${types_1.SKILLS_GITHUB_SOURCE} -y -g`,
250
248
  details: lastError instanceof Error ? lastError.message : String(lastError),
251
249
  });
@@ -274,16 +272,16 @@ async function stepAuth(flags, runner) {
274
272
  if (flags.dryRun) {
275
273
  return { action: "planned", reason: "non-interactive" };
276
274
  }
277
- runner.log("To finish setup, run:\n alphafox auth login --browser\n alphafox auth login --no-wait --format json --no-input");
275
+ runner.log("要完成安装,请运行:\n alphafox auth login --browser\n alphafox auth login --no-wait --format json --no-input");
278
276
  return { action: "skipped", reason: "non-interactive" };
279
277
  }
280
278
  if (flags.dryRun) {
281
- runner.log("Would prompt for alphafox auth login --browser");
279
+ runner.log("将提示运行 alphafox auth login --browser");
282
280
  return { action: "planned", reason: "tty" };
283
281
  }
284
- const yes = await runner.confirm("Log in now so Agents can call the public Application API?");
282
+ const yes = await runner.confirm("现在登录,以便 Agent 可以调用公开 Application API");
285
283
  if (!yes) {
286
- runner.log("Skipped login. Run alphafox auth login later.");
284
+ runner.log("已跳过登录。之后可运行 alphafox auth login");
287
285
  return { action: "skipped", reason: "declined" };
288
286
  }
289
287
  const bin = await resolveAlphafoxBin(runner);
@@ -291,19 +289,19 @@ async function stepAuth(flags, runner) {
291
289
  throw new types_1.InstallError({
292
290
  type: "install",
293
291
  subtype: "cli_bin_missing",
294
- message: "alphafox binary not found after install.",
295
- hint: "Ensure the npm global bin directory is on PATH, then run alphafox auth login --browser.",
292
+ message: "安装完成后找不到 alphafox 可执行文件。",
293
+ hint: "请确认 npm 全局 bin 目录在 PATH 中,然后运行 alphafox auth login --browser",
296
294
  });
297
295
  }
298
296
  try {
299
297
  await runner.execInherit(bin, ["auth", "login", "--browser"], {
300
298
  timeoutMs: 10 * 60_000,
301
299
  });
302
- runner.log("Login complete");
300
+ runner.log("登录完成");
303
301
  return { action: "completed" };
304
302
  }
305
303
  catch (err) {
306
- runner.log("Login failed. Run alphafox auth login --browser to retry.");
304
+ runner.log("登录失败。请运行 alphafox auth login --browser 重试。");
307
305
  return {
308
306
  action: "failed",
309
307
  reason: err instanceof Error ? err.message : String(err),
@@ -319,7 +317,7 @@ function installHelpData() {
319
317
  "alphafox install --no-auth",
320
318
  "alphafox install --dry-run",
321
319
  ],
322
- description: "Install @alphafox/cli globally and copy co-versioned Agent Skills into detected agents (Cursor, Claude Code, Codex, …) via npx skills add.",
320
+ description: "全局安装 @alphafox/cli,并通过 npx skills add 把同版本 Agent Skills 写入本机已检测到的 Agent(CursorClaude CodeCodex 等)的用户级目录。",
323
321
  agentGuide: types_1.AGENT_INSTALL_GUIDE_BLOB_URL,
324
322
  };
325
323
  }
package/dist/version.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export declare const CLI_NAME = "alphafox";
2
2
  export declare const CLI_PACKAGE = "@alphafox/cli";
3
- export declare const CLI_VERSION = "0.3.2";
3
+ export declare const CLI_VERSION = "0.3.3";
4
4
  export { CATALOG_VERSION as CLI_CONTRACT_VERSION } from "./catalog/operations";
package/dist/version.js CHANGED
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CLI_CONTRACT_VERSION = exports.CLI_VERSION = exports.CLI_PACKAGE = exports.CLI_NAME = void 0;
4
4
  exports.CLI_NAME = "alphafox";
5
5
  exports.CLI_PACKAGE = "@alphafox/cli";
6
- exports.CLI_VERSION = "0.3.2";
6
+ exports.CLI_VERSION = "0.3.3";
7
7
  var operations_1 = require("./catalog/operations");
8
8
  Object.defineProperty(exports, "CLI_CONTRACT_VERSION", { enumerable: true, get: function () { return operations_1.CATALOG_VERSION; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alphafox/cli",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "Alphafox CLI — Agent/Human entry for the public Application API.",
5
5
  "type": "commonjs",
6
6
  "bin": {
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: alphafox-account
3
3
  description: Account, wallet, and subscription read paths.
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  ---
6
6
 
7
7
  # Account / wallet
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: alphafox-admin
3
3
  description: Admin-only operations reusing Web role authorization.
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  ---
6
6
 
7
7
  # Admin
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: alphafox-shared
3
3
  description: Shared Alphafox CLI rules for Agents — auth, profiles, envelopes, risk gates, and public operationIds only.
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  ---
6
6
 
7
7
  # Alphafox shared Agent contract
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: alphafox-auth
3
3
  description: Login, status, logout, whoami, and environment isolation for Alphafox CLI.
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  ---
6
6
 
7
7
  # Auth Skill
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: alphafox-engine-backtest
3
3
  description: Local Engine WASM backtest (alphafox engine-backtest run) vs catalog experiment CRUD vs chat backtests stub.
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  ---
6
6
 
7
7
  # Engine Backtest
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: alphafox-exchange
3
3
  description: Exchange connectors list and connection management via Public API.
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  ---
6
6
 
7
7
  # Exchange connectors
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: alphafox-market
3
3
  description: Market data and spread-radar readonly queries.
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  ---
6
6
 
7
7
  # Market
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: alphafox-notification
3
3
  description: Notification channels and subscriptions.
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  ---
6
6
 
7
7
  # Notification
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: alphafox-strategy
3
3
  description: Strategy definitions, chats, and backtests via public operationIds.
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  ---
6
6
 
7
7
  # Strategy / Chat / Backtest
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: alphafox-trading
3
3
  description: Traders list and high-risk start/stop with confirmation gates.
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  ---
6
6
 
7
7
  # Trading