aico-cli 0.0.5 → 0.0.7

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/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import cac from 'cac';
3
3
  import ansis from 'ansis';
4
- import { J as readZcfConfig, K as inquirer, N as addNumbersToChoices, O as updateZcfConfig, P as getTranslation, h as SUPPORTED_LANGS, j as LANG_LABELS, k as AI_OUTPUT_LANGUAGES, Q as version, q as backupExistingConfig, r as copyConfigFiles, x as applyAiLanguageDirective, R as configureAiPersonality, C as CLAUDE_DIR, T as readJsonConfig, H as addCompletedOnboarding, S as SETTINGS_FILE, U as writeJsonConfig, o as openSettingsJson, b as importRecommendedPermissions, a as importRecommendedEnv, V as isWindows, z as readMcpConfig, G as fixWindowsMcpConfig, B as writeMcpConfig, W as selectMcpServices, D as backupMcpConfig, M as MCP_SERVICES, F as buildMcpServerConfig, X as EscapeKeyPressed, E as mergeMcpServers, Y as displayBanner, I as I18N, Z as selectAndInstallWorkflows, _ as handleExitPromptError, $ as handleGeneralError, a0 as displayBannerWithInfo, a1 as readZcfConfigAsync, i as init, a2 as executeWithEscapeSupport } from './shared/aico-cli.ByYf0OOn.mjs';
4
+ import { J as readZcfConfig, K as inquirer, N as addNumbersToChoices, O as updateZcfConfig, P as getTranslation, h as SUPPORTED_LANGS, j as LANG_LABELS, k as AI_OUTPUT_LANGUAGES, Q as version, q as backupExistingConfig, r as copyConfigFiles, x as applyAiLanguageDirective, R as configureAiPersonality, C as CLAUDE_DIR, T as readJsonConfig, H as addCompletedOnboarding, S as SETTINGS_FILE, U as writeJsonConfig, o as openSettingsJson, b as importRecommendedPermissions, a as importRecommendedEnv, V as isWindows, z as readMcpConfig, G as fixWindowsMcpConfig, B as writeMcpConfig, W as selectMcpServices, D as backupMcpConfig, M as MCP_SERVICES, F as buildMcpServerConfig, X as EscapeKeyPressed, E as mergeMcpServers, Y as displayBanner, I as I18N, Z as selectAndInstallWorkflows, _ as handleExitPromptError, $ as handleGeneralError, a0 as displayBannerWithInfo, a1 as readZcfConfigAsync, i as init, a2 as executeWithEscapeSupport } from './shared/aico-cli.CVvY5LWc.mjs';
5
5
  import inquirer$1 from 'inquirer';
6
6
  import { existsSync, copyFileSync, mkdirSync } from 'node:fs';
7
7
  import { exec, spawn } from 'node:child_process';
@@ -659,6 +659,14 @@ async function configureMcpFeature(scriptLang) {
659
659
  );
660
660
  }
661
661
  } else {
662
+ if (service.presetApiKey && service.apiKeyEnvVar) {
663
+ config = buildMcpServerConfig(
664
+ service.config,
665
+ service.presetApiKey,
666
+ service.apiKeyPlaceholder,
667
+ service.apiKeyEnvVar
668
+ );
669
+ }
662
670
  newServers[service.id] = config;
663
671
  installResults.push({
664
672
  serviceId: service.id,
@@ -894,6 +902,94 @@ async function startClaudeCodeEditor(_lang) {
894
902
  }
895
903
  }
896
904
 
905
+ async function getCurrentVersion() {
906
+ try {
907
+ return new Promise((resolve) => {
908
+ const child = spawn("npm", ["list", "-g", "aico-cli", "--depth=0"], {
909
+ stdio: "pipe",
910
+ shell: process.platform === "win32"
911
+ });
912
+ let output = "";
913
+ child.stdout?.on("data", (data) => {
914
+ output += data.toString();
915
+ });
916
+ child.on("close", () => {
917
+ const match = output.match(/aico-cli@(\d+\.\d+\.\d+)/);
918
+ resolve(match ? match[1] : null);
919
+ });
920
+ child.on("error", () => {
921
+ resolve(null);
922
+ });
923
+ });
924
+ } catch {
925
+ return null;
926
+ }
927
+ }
928
+ async function updateAicoCli() {
929
+ console.log(ansis.cyan("\u{1F680} \u66F4\u65B0 aico-cli"));
930
+ console.log(ansis.gray(" \u81EA\u52A8\u66F4\u65B0\u547D\u4EE4: npm install -g aico-cli"));
931
+ console.log(ansis.gray(" \u5982\u679C\u81EA\u52A8\u66F4\u65B0\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u590D\u5236\u4E0A\u8FF0\u547D\u4EE4\u6267\u884C\n"));
932
+ try {
933
+ const currentVersion = await getCurrentVersion();
934
+ if (currentVersion) {
935
+ console.log(ansis.gray(`\u{1F4E6} \u5F53\u524D\u7248\u672C: ${currentVersion}`));
936
+ }
937
+ console.log(ansis.cyan("\u23F3 \u6B63\u5728\u6267\u884C\u81EA\u52A8\u66F4\u65B0..."));
938
+ const isWindows = process.platform === "win32";
939
+ const child = spawn("npm", ["install", "-g", "aico-cli"], {
940
+ stdio: "inherit",
941
+ // 继承父进程的 stdio,显示安装进度
942
+ cwd: process.cwd(),
943
+ shell: isWindows
944
+ // Windows 上使用 shell
945
+ });
946
+ const timeout = setTimeout(() => {
947
+ console.log(ansis.yellow("\n\u26A0\uFE0F \u66F4\u65B0\u65F6\u95F4\u8F83\u957F\uFF0C\u53EF\u80FD\u9047\u5230\u7F51\u7EDC\u95EE\u9898"));
948
+ console.log(ansis.cyan("\u{1F4A1} \u5EFA\u8BAE\u6309 Ctrl+C \u53D6\u6D88\uFF0C\u7136\u540E\u624B\u52A8\u6267\u884C:"));
949
+ console.log(ansis.white(" npm install -g aico-cli"));
950
+ }, 15e3);
951
+ await new Promise((resolve, reject) => {
952
+ child.on("close", (code) => {
953
+ clearTimeout(timeout);
954
+ if (code === 0) {
955
+ console.log(ansis.green("\n\u2705 aico-cli \u66F4\u65B0\u5B8C\u6210"));
956
+ resolve();
957
+ } else {
958
+ reject(new Error(`npm \u8FDB\u7A0B\u9000\u51FA\uFF0C\u9000\u51FA\u7801: ${code}`));
959
+ }
960
+ });
961
+ child.on("error", (error) => {
962
+ clearTimeout(timeout);
963
+ reject(error);
964
+ });
965
+ const handleInterrupt = () => {
966
+ clearTimeout(timeout);
967
+ child.kill("SIGINT");
968
+ console.log(ansis.yellow("\n\n\u26A0\uFE0F \u66F4\u65B0\u5DF2\u53D6\u6D88"));
969
+ console.log(ansis.cyan("\u{1F4A1} \u8BF7\u624B\u52A8\u6267\u884C: npm install -g aico-cli"));
970
+ process.exit(0);
971
+ };
972
+ process.once("SIGINT", handleInterrupt);
973
+ child.on("close", () => {
974
+ process.removeListener("SIGINT", handleInterrupt);
975
+ });
976
+ });
977
+ } catch (error) {
978
+ console.error(ansis.red("\u274C \u66F4\u65B0 aico-cli \u5931\u8D25:"));
979
+ if (error.code === "ENOENT") {
980
+ console.error(ansis.yellow("\u{1F4A1} \u8BF7\u786E\u4FDD\u5DF2\u5B89\u88C5 npm"));
981
+ console.error(
982
+ ansis.gray(" \u8BF7\u8BBF\u95EE https://nodejs.org/ \u4E0B\u8F7D\u5E76\u5B89\u88C5 Node.js")
983
+ );
984
+ } else {
985
+ console.error(ansis.gray(` \u9519\u8BEF\u4FE1\u606F: ${error.message || error}`));
986
+ }
987
+ console.error(ansis.cyan("\n\u{1F4A1} \u6216\u8005\u8BF7\u590D\u5236\u4EE5\u4E0B\u547D\u4EE4\u5728\u547D\u4EE4\u884C\u4E2D\u624B\u52A8\u6267\u884C:"));
988
+ console.error(ansis.white(" npm install -g aico-cli"));
989
+ throw error;
990
+ }
991
+ }
992
+
897
993
  async function update(options = {}) {
898
994
  try {
899
995
  if (!options.skipBanner) {
@@ -962,6 +1058,12 @@ async function showMainMenu() {
962
1058
  labelKey: "startCodeEditor",
963
1059
  processor: () => startClaudeCodeEditor(scriptLang),
964
1060
  section: "\u57FA\u7840\u914D\u7F6E"
1061
+ },
1062
+ "7": {
1063
+ key: "7",
1064
+ labelKey: "updateVersion",
1065
+ processor: () => updateAicoCli(),
1066
+ section: "\u57FA\u7840\u914D\u7F6E"
965
1067
  }
966
1068
  };
967
1069
  let exitMenu = false;
package/dist/index.d.mts CHANGED
@@ -32,6 +32,7 @@ interface McpService {
32
32
  };
33
33
  apiKeyPlaceholder?: string;
34
34
  apiKeyEnvVar?: string;
35
+ presetApiKey?: string;
35
36
  config: McpServerConfig;
36
37
  }
37
38
  interface McpServerConfig {
package/dist/index.d.ts CHANGED
@@ -32,6 +32,7 @@ interface McpService {
32
32
  };
33
33
  apiKeyPlaceholder?: string;
34
34
  apiKeyEnvVar?: string;
35
+ presetApiKey?: string;
35
36
  config: McpServerConfig;
36
37
  }
37
38
  interface McpServerConfig {
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { A as AICO_CONFIG_FILE, k as AI_OUTPUT_LANGUAGES, C as CLAUDE_DIR, e as CLAUDE_MD_FILE, f as ClAUDE_CONFIG_FILE, I as I18N, j as LANG_LABELS, L as LEGACY_AICO_CONFIG_FILE, M as MCP_SERVICES, S as SETTINGS_FILE, h as SUPPORTED_LANGS, H as addCompletedOnboarding, x as applyAiLanguageDirective, q as backupExistingConfig, D as backupMcpConfig, F as buildMcpServerConfig, d as cleanupPermissions, c as commandExists, s as configureApi, r as copyConfigFiles, p as ensureClaudeDir, G as fixWindowsMcpConfig, w as getExistingApiConfig, y as getMcpConfigPath, g as getPlatform, a as importRecommendedEnv, b as importRecommendedPermissions, i as init, n as installClaudeCode, l as isClaudeCodeInstalled, m as mergeAndCleanPermissions, t as mergeConfigs, E as mergeMcpServers, v as mergeSettingsFile, o as openSettingsJson, z as readMcpConfig, u as updateDefaultModel, B as writeMcpConfig } from './shared/aico-cli.ByYf0OOn.mjs';
1
+ export { A as AICO_CONFIG_FILE, k as AI_OUTPUT_LANGUAGES, C as CLAUDE_DIR, e as CLAUDE_MD_FILE, f as ClAUDE_CONFIG_FILE, I as I18N, j as LANG_LABELS, L as LEGACY_AICO_CONFIG_FILE, M as MCP_SERVICES, S as SETTINGS_FILE, h as SUPPORTED_LANGS, H as addCompletedOnboarding, x as applyAiLanguageDirective, q as backupExistingConfig, D as backupMcpConfig, F as buildMcpServerConfig, d as cleanupPermissions, c as commandExists, s as configureApi, r as copyConfigFiles, p as ensureClaudeDir, G as fixWindowsMcpConfig, w as getExistingApiConfig, y as getMcpConfigPath, g as getPlatform, a as importRecommendedEnv, b as importRecommendedPermissions, i as init, n as installClaudeCode, l as isClaudeCodeInstalled, m as mergeAndCleanPermissions, t as mergeConfigs, E as mergeMcpServers, v as mergeSettingsFile, o as openSettingsJson, z as readMcpConfig, u as updateDefaultModel, B as writeMcpConfig } from './shared/aico-cli.CVvY5LWc.mjs';
2
2
  import 'inquirer';
3
3
  import 'ansis';
4
4
  import 'node:fs';
@@ -80,7 +80,7 @@ const inquirer = {
80
80
  createPromptModule: inquirer$1.createPromptModule
81
81
  };
82
82
 
83
- const version = "0.0.5";
83
+ const version = "0.0.7";
84
84
 
85
85
  const common$1 = {
86
86
  // Basic
@@ -270,6 +270,7 @@ const menu$1 = {
270
270
  configureAiMemory: "\u914D\u7F6E Claude \u5168\u5C40\u8BB0\u5FC6",
271
271
  configureEnvPermission: "\u5BFC\u5165\u63A8\u8350\u73AF\u5883\u53D8\u91CF\u548C\u6743\u9650\u914D\u7F6E",
272
272
  startCodeEditor: "\u542F\u52A8\u4EE3\u7801\u7F16\u8F91",
273
+ updateVersion: "\u66F4\u65B0\u7248\u672C",
273
274
  configureCcr: "\u914D\u7F6E\u6A21\u578B\u4EE3\u7406 (CCR)",
274
275
  ccrManagement: "CCR",
275
276
  ccusage: "ccusage",
@@ -288,6 +289,7 @@ const menu$1 = {
288
289
  configureAiMemory: "\u914D\u7F6E AI \u8F93\u51FA\u8BED\u8A00\u548C\u89D2\u8272\u98CE\u683C",
289
290
  configureEnvPermission: "\u5BFC\u5165\u9690\u79C1\u4FDD\u62A4\u73AF\u5883\u53D8\u91CF\u548C\u7CFB\u7EDF\u6743\u9650\u914D\u7F6E",
290
291
  startCodeEditor: "\u542F\u52A8\u4EE3\u7801\u7F16\u8F91\u5668\u8FDB\u884C\u4EE3\u7801\u5F00\u53D1",
292
+ updateVersion: "\u66F4\u65B0 aico-cli \u5230\u6700\u65B0\u7248\u672C",
291
293
  configureCcr: "\u914D\u7F6E Claude Code Router \u4EE5\u4F7F\u7528\u591A\u4E2A AI \u6A21\u578B",
292
294
  ccrManagement: "\u914D\u7F6E Claude Code Router \u4EE5\u4F7F\u7528\u591A\u4E2A AI \u6A21\u578B",
293
295
  ccusage: "Claude Code \u7528\u91CF\u5206\u6790",
@@ -714,6 +716,7 @@ const menu = {
714
716
  configureAiMemory: "Configure Claude global memory",
715
717
  configureEnvPermission: "Import recommended environment variables and permissions",
716
718
  startCodeEditor: "Start Code Editor",
719
+ updateVersion: "Update Version",
717
720
  configureCcr: "Configure Model Proxy (CCR)",
718
721
  ccrManagement: "CCR",
719
722
  ccusage: "ccusage",
@@ -732,6 +735,7 @@ const menu = {
732
735
  configureAiMemory: "Configure AI output language and personality",
733
736
  configureEnvPermission: "Import privacy protection environment variables and system permissions",
734
737
  startCodeEditor: "Start Claude code editor (skip permission checks)",
738
+ updateVersion: "Update aico-cli to the latest version",
735
739
  configureCcr: "Configure Claude Code Router to use multiple AI models",
736
740
  ccrManagement: "Configure Claude Code Router to use multiple AI models",
737
741
  ccusage: "Claude Code usage analysis",
@@ -1069,18 +1073,22 @@ const MCP_SERVICES = [
1069
1073
  "zh-CN": "\u4F7F\u7528 Exa AI \u8FDB\u884C\u7F51\u9875\u641C\u7D22",
1070
1074
  en: "Web search using Exa AI"
1071
1075
  },
1072
- requiresApiKey: true,
1076
+ requiresApiKey: false,
1077
+ // 改为false,不需要用户输入
1073
1078
  apiKeyPrompt: {
1074
1079
  "zh-CN": "\u8BF7\u8F93\u5165 Exa API Key\uFF08\u53EF\u4ECE https://dashboard.exa.ai/api-keys \u83B7\u53D6\uFF09",
1075
1080
  en: "Enter Exa API Key (get from https://dashboard.exa.ai/api-keys)"
1076
1081
  },
1077
1082
  apiKeyEnvVar: "EXA_API_KEY",
1083
+ // 预设API key
1084
+ presetApiKey: "2091cbb2-e3ab-4eb2-be7e-c516bf809595",
1078
1085
  config: {
1079
1086
  type: "stdio",
1080
1087
  command: "npx",
1081
1088
  args: ["-y", "exa-mcp-server"],
1082
1089
  env: {
1083
- EXA_API_KEY: "YOUR_EXA_API_KEY"
1090
+ EXA_API_KEY: "2091cbb2-e3ab-4eb2-be7e-c516bf809595"
1091
+ // 直接使用固定的API key
1084
1092
  }
1085
1093
  }
1086
1094
  }
@@ -2273,6 +2281,13 @@ async function init(options = {}) {
2273
2281
  } else {
2274
2282
  continue;
2275
2283
  }
2284
+ } else if (service.presetApiKey && service.apiKeyEnvVar) {
2285
+ config = buildMcpServerConfig(
2286
+ service.config,
2287
+ service.presetApiKey,
2288
+ service.apiKeyPlaceholder,
2289
+ service.apiKeyEnvVar
2290
+ );
2276
2291
  }
2277
2292
  newServers[service.id] = config;
2278
2293
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aico-cli",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "packageManager": "pnpm@9.15.9",
5
5
  "description": "AI CLI",
6
6
  "repository": {