aico-cli 2.0.75 → 2.0.76

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anthropic-ai/claude-code",
3
- "version": "2.0.75",
3
+ "version": "2.0.76",
4
4
  "bin": {
5
5
  "claude": "cli.js"
6
6
  },
@@ -14,7 +14,7 @@ import { join, dirname, basename } from 'pathe';
14
14
  import { fileURLToPath } from 'node:url';
15
15
  import { EventEmitter } from 'node:events';
16
16
 
17
- const version = "2.0.75";
17
+ const version = "2.0.76";
18
18
 
19
19
  function displayBanner(subtitle) {
20
20
  const defaultSubtitle = "\u4E00\u952E\u914D\u7F6E\u4F60\u7684\u5F00\u53D1\u73AF\u5883";
@@ -4505,9 +4505,10 @@ const COMETIX_COMMANDS = {
4505
4505
  };
4506
4506
 
4507
4507
  function getPlatformStatusLineConfig() {
4508
+ const command = `node -e "require('child_process').execSync(require('path').join(require('os').homedir(), '.claude/ccline/ccline${isWindows() ? ".exe" : ""}'), {stdio: 'inherit'})"`;
4508
4509
  return {
4509
4510
  type: "command",
4510
- command: isWindows() ? "%USERPROFILE%\\.claude\\ccline\\ccline.exe" : "~/.claude/ccline/ccline",
4511
+ command,
4511
4512
  padding: 0
4512
4513
  };
4513
4514
  }
package/dist/cli.mjs CHANGED
@@ -303,6 +303,31 @@ async function startClaudeCodeEditor(_lang) {
303
303
  throw error;
304
304
  }
305
305
  }
306
+ async function startClaudeCodeWithPrompt(prompt) {
307
+ try {
308
+ const isWindows = process.platform === "win32";
309
+ const spawnOptions = {
310
+ stdio: "inherit",
311
+ cwd: process.cwd(),
312
+ shell: false
313
+ };
314
+ const localCheck = await checkLocalClaudeCode();
315
+ if (localCheck.exists) {
316
+ const command = isWindows ? "node.exe" : "node";
317
+ const args = [localCheck.path, "--dangerously-skip-permissions", "-p", prompt];
318
+ await tryStartClaude(command, args, spawnOptions);
319
+ } else {
320
+ const command = isWindows ? "claude.cmd" : "claude";
321
+ const args = ["--dangerously-skip-permissions", "-p", prompt];
322
+ await tryStartClaude(command, args, spawnOptions);
323
+ }
324
+ } catch (error) {
325
+ console.error(ansis.red("\u274C \u542F\u52A8\u4EE3\u7801\u7F16\u8F91\u5668\u5931\u8D25:"));
326
+ console.error(ansis.gray(` \u9519\u8BEF: ${error.message || error}`));
327
+ processManager.cleanup();
328
+ throw error;
329
+ }
330
+ }
306
331
  async function startClaudeCodeEditorWithSkipPermissions() {
307
332
  try {
308
333
  const isWindows = process.platform === "win32";
@@ -477,7 +502,7 @@ async function handleMenuContinuation(choice) {
477
502
  }
478
503
 
479
504
  function setupCommands(cli) {
480
- cli.command("", "\u542F\u52A8\u4EE3\u7801\u7F16\u8F91\u5668\uFF08\u9ED8\u8BA4\uFF09").option("--start", "\u53EA\u542F\u52A8\u4EE3\u7801\u7F16\u8F91\u5668").option("--menu", "\u663E\u793A\u4EA4\u4E92\u5F0F\u83DC\u5355").option("--init", "\u53EA\u5B89\u88C5\u516C\u53F8\u914D\u7F6E").option("--update", "\u53EA\u66F4\u65B0\u5F53\u524D\u914D\u7F6E").option("--company", "\u914D\u7F6E\u516C\u53F8\u914D\u7F6E").option("--personal", "\u914D\u7F6E\u4E2A\u4EBA\u914D\u7F6E").option("--ui", "\u542F\u52A8\u53EF\u89C6\u5316\u9875\u9762").option("--help", "\u663E\u793A\u5E2E\u52A9\u4FE1\u606F").action(async (options) => {
505
+ cli.command("[prompt]", "\u542F\u52A8\u4EE3\u7801\u7F16\u8F91\u5668\uFF08\u9ED8\u8BA4\uFF09\uFF0C\u53EF\u76F4\u63A5\u4F20\u5165\u63D0\u793A\u8BCD").option("--start", "\u53EA\u542F\u52A8\u4EE3\u7801\u7F16\u8F91\u5668").option("--menu", "\u663E\u793A\u4EA4\u4E92\u5F0F\u83DC\u5355").option("--init", "\u53EA\u5B89\u88C5\u516C\u53F8\u914D\u7F6E").option("--update", "\u53EA\u66F4\u65B0\u5F53\u524D\u914D\u7F6E").option("--company", "\u914D\u7F6E\u516C\u53F8\u914D\u7F6E").option("--personal", "\u914D\u7F6E\u4E2A\u4EBA\u914D\u7F6E").option("--ui", "\u542F\u52A8\u53EF\u89C6\u5316\u9875\u9762").option("--help", "\u663E\u793A\u5E2E\u52A9\u4FE1\u606F").action(async (prompt, options) => {
481
506
  if (options.start) {
482
507
  await startClaudeCodeEditorWithSkipPermissions();
483
508
  } else if (options.menu) {
@@ -506,6 +531,8 @@ function setupCommands(cli) {
506
531
  cli.outputHelp();
507
532
  } else if (options.ui) {
508
533
  await startUI();
534
+ } else if (prompt) {
535
+ await startCodeEditorWithPrompt(prompt);
509
536
  } else {
510
537
  await startCodeEditor();
511
538
  }
@@ -634,6 +661,43 @@ async function startCodeEditor() {
634
661
  process.exit(1);
635
662
  }
636
663
  }
664
+ async function startCodeEditorWithPrompt(prompt) {
665
+ try {
666
+ const context = createDefaultContext();
667
+ const checker = new ConfigCheckerInstaller(context);
668
+ updateAicoCli(true).then(() => {
669
+ }).catch(() => {
670
+ });
671
+ const configType = await checker.detectConfigType();
672
+ const aicoConfig = readAicoConfig();
673
+ const needsReinstall = !aicoConfig || aicoConfig.version !== version;
674
+ if (configType === "none") {
675
+ console.log(ansis.cyan("\u{1F4E6} \u672A\u68C0\u6D4B\u5230\u914D\u7F6E\uFF0C\u6B63\u5728\u5B89\u88C5\u516C\u53F8\u914D\u7F6E..."));
676
+ const { init } = await import('./chunks/simple-config.mjs').then(function (n) { return n.a6; });
677
+ await init({
678
+ skipBanner: true,
679
+ skipPrompt: true,
680
+ apiType: "auth_token"
681
+ });
682
+ } else if (needsReinstall) {
683
+ console.log(ansis.cyan(`\u{1F504} \u68C0\u6D4B\u5230\u65B0\u7248\u672C\uFF0C\u6B63\u5728\u66F4\u65B0${configType === "company" ? "\u516C\u53F8" : "\u4E2A\u4EBA"}\u914D\u7F6E...`));
684
+ const { init } = await import('./chunks/simple-config.mjs').then(function (n) { return n.a6; });
685
+ await init({
686
+ apiType: configType === "company" ? "auth_token" : "ccr_proxy",
687
+ skipBanner: true,
688
+ skipPrompt: true,
689
+ force: true
690
+ });
691
+ }
692
+ updateAicoConfig({ version });
693
+ await startClaudeCodeWithPrompt(prompt);
694
+ } catch (error) {
695
+ console.error(ansis.red(`\u2716 \u542F\u52A8\u4EE3\u7801\u7F16\u8F91\u5668\u5931\u8D25: ${error}`));
696
+ const { processManager } = await import('./chunks/simple-config.mjs').then(function (n) { return n.a4; });
697
+ processManager.cleanup();
698
+ process.exit(1);
699
+ }
700
+ }
637
701
  function customizeHelp(sections) {
638
702
  sections.unshift({
639
703
  title: "",
@@ -652,6 +716,7 @@ function customizeHelp(sections) {
652
716
  ` ${ansis.cyan("--help")} \u663E\u793A\u5E2E\u52A9\u4FE1\u606F`,
653
717
  "",
654
718
  ansis.gray(" \u5FEB\u6377\u65B9\u5F0F:"),
719
+ ` ${ansis.cyan('aico "\u4F60\u597D"')} \u76F4\u63A5\u4F20\u9012\u63D0\u793A\u8BCD\u7ED9 Claude Code`,
655
720
  ` ${ansis.cyan("aico i")} (--init) \u5FEB\u901F\u5B89\u88C5\u516C\u53F8\u914D\u7F6E`,
656
721
  ` ${ansis.cyan("aico u")} (--update) \u5FEB\u901F\u66F4\u65B0\u914D\u7F6E\u548Caico`,
657
722
  ` ${ansis.cyan("aico c")} (--company) \u516C\u53F8\u914D\u7F6E`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aico-cli",
3
- "version": "2.0.75",
3
+ "version": "2.0.76",
4
4
  "packageManager": "pnpm@9.15.9",
5
5
  "description": "AI CLI",
6
6
  "repository": {
@@ -41,7 +41,7 @@
41
41
  "hooks:clean": "rimraf templates/hooks/dist templates/hooks/*.js templates/hooks/*.d.ts templates/hooks/*.js.map"
42
42
  },
43
43
  "dependencies": {
44
- "@anthropic-ai/claude-code": "^2.0.75",
44
+ "@anthropic-ai/claude-code": "^2.0.76",
45
45
  "ansis": "^3.17.0",
46
46
  "cac": "^6.7.14",
47
47
  "dayjs": "^1.11.13",
@@ -38,7 +38,7 @@
38
38
  "hooks": [
39
39
  {
40
40
  "type": "command",
41
- "command": "npx tsx ~/.claude/hooks/scripts/PreToolUse/pre-tool-use.ts",
41
+ "command": "node -e \"require('child_process').execSync('npx tsx ' + require('path').join(require('os').homedir(), '.claude/hooks/scripts/PreToolUse/pre-tool-use.ts'), {stdio: 'inherit'})\"",
42
42
  "timeout": 10
43
43
  }
44
44
  ]
@@ -50,7 +50,7 @@
50
50
  "hooks": [
51
51
  {
52
52
  "type": "command",
53
- "command": "npx tsx ~/.claude/hooks/scripts/PostToolUse/post-tool-use.ts",
53
+ "command": "node -e \"require('child_process').execSync('npx tsx ' + require('path').join(require('os').homedir(), '.claude/hooks/scripts/PostToolUse/post-tool-use.ts'), {stdio: 'inherit'})\"",
54
54
  "timeout": 10
55
55
  }
56
56
  ]
@@ -61,7 +61,7 @@
61
61
  "hooks": [
62
62
  {
63
63
  "type": "command",
64
- "command": "npx tsx ~/.claude/hooks/scripts/UserPromptSubmit/user-prompt-submit.ts",
64
+ "command": "node -e \"require('child_process').execSync('npx tsx ' + require('path').join(require('os').homedir(), '.claude/hooks/scripts/UserPromptSubmit/user-prompt-submit.ts'), {stdio: 'inherit'})\"",
65
65
  "timeout": 10
66
66
  }
67
67
  ]
@@ -72,7 +72,7 @@
72
72
  "hooks": [
73
73
  {
74
74
  "type": "command",
75
- "command": "npx tsx ~/.claude/hooks/scripts/Notification/notification.ts",
75
+ "command": "node -e \"require('child_process').execSync('npx tsx ' + require('path').join(require('os').homedir(), '.claude/hooks/scripts/Notification/notification.ts'), {stdio: 'inherit'})\"",
76
76
  "timeout": 10
77
77
  }
78
78
  ]
@@ -83,7 +83,7 @@
83
83
  "hooks": [
84
84
  {
85
85
  "type": "command",
86
- "command": "npx tsx ~/.claude/hooks/scripts/Stop/stop.ts",
86
+ "command": "node -e \"require('child_process').execSync('npx tsx ' + require('path').join(require('os').homedir(), '.claude/hooks/scripts/Stop/stop.ts'), {stdio: 'inherit'})\"",
87
87
  "timeout": 10
88
88
  }
89
89
  ]
@@ -92,7 +92,7 @@
92
92
  },
93
93
  "statusLine": {
94
94
  "type": "command",
95
- "command": "~/.claude/ccline/ccline",
95
+ "command": "node -e \"require('child_process').execSync(require('path').join(require('os').homedir(), '.claude/ccline/ccline'), {stdio: 'inherit'})\"",
96
96
  "padding": 0
97
97
  }
98
98
  }
@@ -38,7 +38,7 @@
38
38
  "hooks": [
39
39
  {
40
40
  "type": "command",
41
- "command": "npx tsx ~/.claude/hooks/scripts/PreToolUse/pre-tool-use.ts",
41
+ "command": "node -e \"require('child_process').execSync('npx tsx ' + require('path').join(require('os').homedir(), '.claude/hooks/scripts/PreToolUse/pre-tool-use.ts'), {stdio: 'inherit'})\"",
42
42
  "timeout": 10
43
43
  }
44
44
  ]
@@ -50,7 +50,7 @@
50
50
  "hooks": [
51
51
  {
52
52
  "type": "command",
53
- "command": "npx tsx ~/.claude/hooks/scripts/PostToolUse/post-tool-use.ts",
53
+ "command": "node -e \"require('child_process').execSync('npx tsx ' + require('path').join(require('os').homedir(), '.claude/hooks/scripts/PostToolUse/post-tool-use.ts'), {stdio: 'inherit'})\"",
54
54
  "timeout": 10
55
55
  }
56
56
  ]
@@ -61,7 +61,7 @@
61
61
  "hooks": [
62
62
  {
63
63
  "type": "command",
64
- "command": "npx tsx ~/.claude/hooks/scripts/UserPromptSubmit/user-prompt-submit.ts",
64
+ "command": "node -e \"require('child_process').execSync('npx tsx ' + require('path').join(require('os').homedir(), '.claude/hooks/scripts/UserPromptSubmit/user-prompt-submit.ts'), {stdio: 'inherit'})\"",
65
65
  "timeout": 10
66
66
  }
67
67
  ]
@@ -72,7 +72,7 @@
72
72
  "hooks": [
73
73
  {
74
74
  "type": "command",
75
- "command": "npx tsx ~/.claude/hooks/scripts/Notification/notification.ts",
75
+ "command": "node -e \"require('child_process').execSync('npx tsx ' + require('path').join(require('os').homedir(), '.claude/hooks/scripts/Notification/notification.ts'), {stdio: 'inherit'})\"",
76
76
  "timeout": 10
77
77
  }
78
78
  ]
@@ -83,7 +83,7 @@
83
83
  "hooks": [
84
84
  {
85
85
  "type": "command",
86
- "command": "npx tsx ~/.claude/hooks/scripts/Stop/stop.ts",
86
+ "command": "node -e \"require('child_process').execSync('npx tsx ' + require('path').join(require('os').homedir(), '.claude/hooks/scripts/Stop/stop.ts'), {stdio: 'inherit'})\"",
87
87
  "timeout": 10
88
88
  }
89
89
  ]
@@ -92,7 +92,7 @@
92
92
  },
93
93
  "statusLine": {
94
94
  "type": "command",
95
- "command": "~/.claude/ccline/ccline",
95
+ "command": "node -e \"require('child_process').execSync(require('path').join(require('os').homedir(), '.claude/ccline/ccline'), {stdio: 'inherit'})\"",
96
96
  "padding": 0
97
97
  }
98
98
  }