aico-cli 2.0.37 → 2.0.38

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.
@@ -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.37";
17
+ const version = "2.0.38";
18
18
 
19
19
  function displayBanner(subtitle) {
20
20
  const defaultSubtitle = "\u4E00\u952E\u914D\u7F6E\u4F60\u7684\u5F00\u53D1\u73AF\u5883";
@@ -4703,7 +4703,7 @@ const DEFAULT_FILE_COPY_CONFIGS = [
4703
4703
  destination: join(CLAUDE_DIR, "personality.md"),
4704
4704
  type: "file",
4705
4705
  options: {
4706
- mergeStrategy: "merge",
4706
+ mergeStrategy: "copy",
4707
4707
  backupBeforeCopy: true,
4708
4708
  deleteBeforeCopy: true
4709
4709
  }
@@ -4713,7 +4713,7 @@ const DEFAULT_FILE_COPY_CONFIGS = [
4713
4713
  destination: join(CLAUDE_DIR, "language.md"),
4714
4714
  type: "file",
4715
4715
  options: {
4716
- mergeStrategy: "merge",
4716
+ mergeStrategy: "copy",
4717
4717
  backupBeforeCopy: true,
4718
4718
  deleteBeforeCopy: true
4719
4719
  }
@@ -4723,7 +4723,7 @@ const DEFAULT_FILE_COPY_CONFIGS = [
4723
4723
  destination: join(CLAUDE_DIR, "CLAUDE.md"),
4724
4724
  type: "file",
4725
4725
  options: {
4726
- mergeStrategy: "merge",
4726
+ mergeStrategy: "copy",
4727
4727
  backupBeforeCopy: true,
4728
4728
  deleteBeforeCopy: true
4729
4729
  }
@@ -4733,7 +4733,7 @@ const DEFAULT_FILE_COPY_CONFIGS = [
4733
4733
  destination: join(CLAUDE_DIR, "settings.json"),
4734
4734
  type: "file",
4735
4735
  options: {
4736
- mergeStrategy: "merge",
4736
+ mergeStrategy: "copy",
4737
4737
  backupBeforeCopy: true,
4738
4738
  deleteBeforeCopy: true
4739
4739
  }
@@ -4742,10 +4742,7 @@ const DEFAULT_FILE_COPY_CONFIGS = [
4742
4742
  function getFileCopyConfigsForTarget(target = "claude") {
4743
4743
  const targetDir = getTargetDir(target);
4744
4744
  const targetConfig = TARGET_CONFIGS[target];
4745
- const fileRenames = targetConfig.fileRenames || {};
4746
- const getDestFileName = (sourceFileName) => {
4747
- return fileRenames[sourceFileName] || sourceFileName;
4748
- };
4745
+ const templateSubDir = target;
4749
4746
  return [
4750
4747
  {
4751
4748
  source: "templates/agents",
@@ -4792,7 +4789,7 @@ function getFileCopyConfigsForTarget(target = "claude") {
4792
4789
  destination: join(targetDir, "personality.md"),
4793
4790
  type: "file",
4794
4791
  options: {
4795
- mergeStrategy: "merge",
4792
+ mergeStrategy: "copy",
4796
4793
  backupBeforeCopy: true,
4797
4794
  deleteBeforeCopy: true
4798
4795
  }
@@ -4802,27 +4799,29 @@ function getFileCopyConfigsForTarget(target = "claude") {
4802
4799
  destination: join(targetDir, "language.md"),
4803
4800
  type: "file",
4804
4801
  options: {
4805
- mergeStrategy: "merge",
4802
+ mergeStrategy: "copy",
4806
4803
  backupBeforeCopy: true,
4807
4804
  deleteBeforeCopy: true
4808
4805
  }
4809
4806
  },
4807
+ // 使用目标特定的主配置文件 (CLAUDE.md 或 CODEBUDDY.md)
4810
4808
  {
4811
- source: "templates/CLAUDE.md",
4812
- destination: join(targetDir, getDestFileName("CLAUDE.md")),
4809
+ source: `templates/${templateSubDir}/${targetConfig.mainConfigFile}`,
4810
+ destination: join(targetDir, targetConfig.mainConfigFile),
4813
4811
  type: "file",
4814
4812
  options: {
4815
- mergeStrategy: "merge",
4813
+ mergeStrategy: "copy",
4816
4814
  backupBeforeCopy: true,
4817
4815
  deleteBeforeCopy: true
4818
4816
  }
4819
4817
  },
4818
+ // 使用目标特定的 settings.json,直接替换而不是合并
4820
4819
  {
4821
- source: "templates/settings.json",
4820
+ source: `templates/${templateSubDir}/settings.json`,
4822
4821
  destination: join(targetDir, "settings.json"),
4823
4822
  type: "file",
4824
4823
  options: {
4825
- mergeStrategy: "merge",
4824
+ mergeStrategy: "copy",
4826
4825
  backupBeforeCopy: true,
4827
4826
  deleteBeforeCopy: true
4828
4827
  }
@@ -5004,6 +5003,12 @@ function mergeSettingsFile(templatePath, targetPath) {
5004
5003
  existingSettings.permissions?.allow
5005
5004
  );
5006
5005
  }
5006
+ if (templateSettings.hooks) {
5007
+ mergedSettings.hooks = templateSettings.hooks;
5008
+ }
5009
+ if (templateSettings.statusLine) {
5010
+ mergedSettings.statusLine = templateSettings.statusLine;
5011
+ }
5007
5012
  writeJsonConfig(targetPath, mergedSettings);
5008
5013
  } catch (error) {
5009
5014
  console.error("\u5408\u5E76\u8BBE\u7F6E\u5931\u8D25", error);
@@ -5099,7 +5104,7 @@ class ConfigInstaller extends AbstractInstaller {
5099
5104
  }
5100
5105
  this.copyConfigFilesWithOptions(options);
5101
5106
  const apiConfig = options.configData?.apiConfig;
5102
- if (apiConfig) {
5107
+ if (apiConfig && target !== "codebuddy") {
5103
5108
  configureApi(apiConfig, target);
5104
5109
  }
5105
5110
  const targetName = TARGET_CONFIGS[target].dirName;
@@ -5113,29 +5118,19 @@ class ConfigInstaller extends AbstractInstaller {
5113
5118
  }
5114
5119
  /**
5115
5120
  * 使用可配置的文件复制机制
5121
+ * 注意:目标特定的文件(如 settings.json, CODEBUDDY.md)已经在 getFileCopyConfigs 中配置
5122
+ * 不再复制整个 templates 目录,避免覆盖目标特定文件
5116
5123
  */
5117
5124
  copyConfigFilesWithOptions(options) {
5118
5125
  const target = this.getTarget();
5119
- const targetDir = this.getTargetDirectory();
5120
- const customConfigs = [
5121
- ...this.getFileCopyConfigs(),
5122
- {
5123
- source: "templates",
5124
- destination: targetDir,
5125
- type: "directory",
5126
- options: {
5127
- filter: (path) => !path.includes("/backup"),
5128
- mergeStrategy: "copy"
5129
- }
5130
- }
5131
- ];
5126
+ const configs = this.getFileCopyConfigs();
5132
5127
  if (options.onlyMdFiles) {
5133
- const filteredConfigs = customConfigs.filter(
5128
+ const filteredConfigs = configs.filter(
5134
5129
  (config) => config.source.endsWith(".md") || config.type === "directory"
5135
5130
  );
5136
5131
  copyConfigFilesWithConfig(filteredConfigs, target);
5137
5132
  } else {
5138
- copyConfigFilesWithConfig(customConfigs, target);
5133
+ copyConfigFilesWithConfig(configs, target);
5139
5134
  }
5140
5135
  }
5141
5136
  /**
@@ -6040,7 +6035,7 @@ class InstallationComposer {
6040
6035
  });
6041
6036
  this.installCodebuddyCodeSilently();
6042
6037
  this.updateGlobalConfig(true);
6043
- spinner.succeed("\u516C\u53F8\u914D\u7F6E\u5B89\u88C5\u5B8C\u6210 (claude + codebuddy)");
6038
+ spinner.succeed("\u516C\u53F8\u914D\u7F6E\u5B89\u88C5\u5B8C\u6210");
6044
6039
  } catch (error) {
6045
6040
  spinner.fail("\u516C\u53F8\u914D\u7F6E\u5B89\u88C5\u5931\u8D25");
6046
6041
  throw error;
@@ -6088,7 +6083,7 @@ class InstallationComposer {
6088
6083
  });
6089
6084
  this.installCodebuddyCodeSilently();
6090
6085
  this.updateGlobalConfig(true);
6091
- spinner.succeed("\u4E2A\u4EBA\u914D\u7F6E\u5B89\u88C5\u5B8C\u6210 (claude + codebuddy)");
6086
+ spinner.succeed("\u4E2A\u4EBA\u914D\u7F6E\u5B89\u88C5\u5B8C\u6210");
6092
6087
  } catch (error) {
6093
6088
  spinner.fail("\u4E2A\u4EBA\u914D\u7F6E\u5B89\u88C5\u5931\u8D25");
6094
6089
  throw error;
@@ -6136,7 +6131,9 @@ class InstallationComposer {
6136
6131
  () => new MCPInstaller(targetContext)
6137
6132
  );
6138
6133
  await targetExecutor.executeBatch(steps, options);
6139
- updateClaudeConfigEnv(envVars, target);
6134
+ if (target !== "codebuddy") {
6135
+ updateClaudeConfigEnv(envVars, target);
6136
+ }
6140
6137
  }
6141
6138
  /**
6142
6139
  * 配置 CCR 用于个人设置
package/dist/index.d.mts CHANGED
@@ -113,7 +113,7 @@ interface FileCopyConfig {
113
113
  declare const DEFAULT_FILE_COPY_CONFIGS: FileCopyConfig[];
114
114
  /**
115
115
  * 根据目标生成文件复制配置
116
- * 支持文件重命名(如 CLAUDE.md -> CODEBUDDY.md)
116
+ * 使用目标特定的模板目录 (templates/claude templates/codebuddy)
117
117
  */
118
118
  declare function getFileCopyConfigsForTarget(target?: InstallationTarget): FileCopyConfig[];
119
119
  declare function copyConfigFilesWithConfig(configs?: FileCopyConfig[], target?: InstallationTarget): void;
@@ -123,6 +123,7 @@ declare function updateDefaultModel(model: 'opus' | 'sonnet'): void;
123
123
  /**
124
124
  * Merge settings.json intelligently
125
125
  * Preserves user's environment variables and custom configurations
126
+ * Always uses template's hooks and statusLine to ensure correct paths
126
127
  */
127
128
  declare function mergeSettingsFile(templatePath: string, targetPath: string): void;
128
129
  /**
package/dist/index.d.ts CHANGED
@@ -113,7 +113,7 @@ interface FileCopyConfig {
113
113
  declare const DEFAULT_FILE_COPY_CONFIGS: FileCopyConfig[];
114
114
  /**
115
115
  * 根据目标生成文件复制配置
116
- * 支持文件重命名(如 CLAUDE.md -> CODEBUDDY.md)
116
+ * 使用目标特定的模板目录 (templates/claude templates/codebuddy)
117
117
  */
118
118
  declare function getFileCopyConfigsForTarget(target?: InstallationTarget): FileCopyConfig[];
119
119
  declare function copyConfigFilesWithConfig(configs?: FileCopyConfig[], target?: InstallationTarget): void;
@@ -123,6 +123,7 @@ declare function updateDefaultModel(model: 'opus' | 'sonnet'): void;
123
123
  /**
124
124
  * Merge settings.json intelligently
125
125
  * Preserves user's environment variables and custom configurations
126
+ * Always uses template's hooks and statusLine to ensure correct paths
126
127
  */
127
128
  declare function mergeSettingsFile(templatePath: string, targetPath: string): void;
128
129
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aico-cli",
3
- "version": "2.0.37",
3
+ "version": "2.0.38",
4
4
  "packageManager": "pnpm@9.15.9",
5
5
  "description": "AI CLI",
6
6
  "repository": {
@@ -0,0 +1,2 @@
1
+ @language.md
2
+ @personality.md
@@ -0,0 +1,98 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/claude-code-settings.json",
3
+ "env": {
4
+ "DISABLE_TELEMETRY": "1",
5
+ "DISABLE_ERROR_REPORTING": "1",
6
+ "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
7
+ "ANTHROPIC_BASE_URL": "http://127.0.0.1:3456",
8
+ "ANTHROPIC_AUTH_TOKEN": "sk-aico-x-ccr"
9
+ },
10
+ "includeCoAuthoredBy": false,
11
+ "permissions": {
12
+ "allow": [
13
+ "Bash",
14
+ "LS",
15
+ "Read",
16
+ "Agent",
17
+ "Write",
18
+ "Edit",
19
+ "MultiEdit",
20
+ "Glob",
21
+ "Grep",
22
+ "WebFetch",
23
+ "WebSearch",
24
+ "TodoWrite",
25
+ "NotebookRead",
26
+ "NotebookEdit",
27
+ "mcp__intention-coding",
28
+ "mcp__context7",
29
+ "mcp__open-websearch",
30
+ "mcp__chrome-devtools"
31
+ ],
32
+ "deny": []
33
+ },
34
+ "hooks": {
35
+ "PreToolUse": [
36
+ {
37
+ "matcher": "Edit|Write",
38
+ "hooks": [
39
+ {
40
+ "type": "command",
41
+ "command": "npx tsx ~/.claude/hooks/scripts/PreToolUse/pre-tool-use.ts",
42
+ "timeout": 10
43
+ }
44
+ ]
45
+ }
46
+ ],
47
+ "PostToolUse": [
48
+ {
49
+ "matcher": "Edit|Write",
50
+ "hooks": [
51
+ {
52
+ "type": "command",
53
+ "command": "npx tsx ~/.claude/hooks/scripts/PostToolUse/post-tool-use.ts",
54
+ "timeout": 10
55
+ }
56
+ ]
57
+ }
58
+ ],
59
+ "UserPromptSubmit": [
60
+ {
61
+ "hooks": [
62
+ {
63
+ "type": "command",
64
+ "command": "npx tsx ~/.claude/hooks/scripts/UserPromptSubmit/user-prompt-submit.ts",
65
+ "timeout": 10
66
+ }
67
+ ]
68
+ }
69
+ ],
70
+ "Notification": [
71
+ {
72
+ "hooks": [
73
+ {
74
+ "type": "command",
75
+ "command": "npx tsx ~/.claude/hooks/scripts/Notification/notification.ts",
76
+ "timeout": 10
77
+ }
78
+ ]
79
+ }
80
+ ],
81
+ "Stop": [
82
+ {
83
+ "hooks": [
84
+ {
85
+ "type": "command",
86
+ "command": "npx tsx ~/.claude/hooks/scripts/Stop/stop.ts",
87
+ "timeout": 10
88
+ }
89
+ ]
90
+ }
91
+ ]
92
+ },
93
+ "statusLine": {
94
+ "type": "command",
95
+ "command": "~/.claude/ccline/ccline",
96
+ "padding": 0
97
+ }
98
+ }
@@ -0,0 +1,2 @@
1
+ @language.md
2
+ @personality.md
@@ -0,0 +1,128 @@
1
+ {
2
+ "sandbox": {
3
+ "enabled": true,
4
+ "autoAllowBashIfSandboxed": true,
5
+ "network": {
6
+ "allowedDomains": [],
7
+ "deniedDomains": [],
8
+ "allowLocalBinding": false,
9
+ "allowUnixSockets": [],
10
+ "allowAllUnixSockets": false
11
+ },
12
+ "filesystem": {
13
+ "denyRead": [
14
+ "~/.ssh",
15
+ "~/.aws",
16
+ "~/.gcp"
17
+ ],
18
+ "allowWrite": [
19
+ ".",
20
+ "/dev/stdout",
21
+ "/dev/stderr",
22
+ "/dev/null",
23
+ "/dev/tty",
24
+ "/dev/dtracehelper",
25
+ "/dev/autofs_nowait",
26
+ "/tmp/codebuddy",
27
+ "/private/tmp/codebuddy",
28
+ "~/.npm/_logs",
29
+ "~/.codebuddy/debug",
30
+ "~/.codebuddy/statsig"
31
+ ],
32
+ "denyWrite": []
33
+ },
34
+ "excludedCommands": [],
35
+ "allowUnsandboxedCommands": true,
36
+ "enableWeakerNestedSandbox": false
37
+ },
38
+ "$schema": "https://json.schemastore.org/claude-code-settings.json",
39
+ "includeCoAuthoredBy": false,
40
+ "permissions": {
41
+ "allow": [
42
+ "Bash",
43
+ "LS",
44
+ "Read",
45
+ "Agent",
46
+ "Write",
47
+ "Edit",
48
+ "MultiEdit",
49
+ "Glob",
50
+ "Grep",
51
+ "WebFetch",
52
+ "WebSearch",
53
+ "TodoWrite",
54
+ "NotebookRead",
55
+ "NotebookEdit",
56
+ "mcp__intention-coding",
57
+ "mcp__context7",
58
+ "mcp__open-websearch",
59
+ "mcp__chrome-devtools"
60
+ ],
61
+ "deny": []
62
+ },
63
+ "hooks": {
64
+ "PreToolUse": [
65
+ {
66
+ "matcher": "Edit|Write",
67
+ "hooks": [
68
+ {
69
+ "type": "command",
70
+ "command": "npx tsx ~/.codebuddy/hooks/scripts/PreToolUse/pre-tool-use.ts",
71
+ "timeout": 10
72
+ }
73
+ ]
74
+ }
75
+ ],
76
+ "PostToolUse": [
77
+ {
78
+ "matcher": "Edit|Write",
79
+ "hooks": [
80
+ {
81
+ "type": "command",
82
+ "command": "npx tsx ~/.codebuddy/hooks/scripts/PostToolUse/post-tool-use.ts",
83
+ "timeout": 10
84
+ }
85
+ ]
86
+ }
87
+ ],
88
+ "UserPromptSubmit": [
89
+ {
90
+ "hooks": [
91
+ {
92
+ "type": "command",
93
+ "command": "npx tsx ~/.codebuddy/hooks/scripts/UserPromptSubmit/user-prompt-submit.ts",
94
+ "timeout": 10
95
+ }
96
+ ]
97
+ }
98
+ ],
99
+ "Notification": [
100
+ {
101
+ "hooks": [
102
+ {
103
+ "type": "command",
104
+ "command": "npx tsx ~/.codebuddy/hooks/scripts/Notification/notification.ts",
105
+ "timeout": 10
106
+ }
107
+ ]
108
+ }
109
+ ],
110
+ "Stop": [
111
+ {
112
+ "hooks": [
113
+ {
114
+ "type": "command",
115
+ "command": "npx tsx ~/.codebuddy/hooks/scripts/Stop/stop.ts",
116
+ "timeout": 10
117
+ }
118
+ ]
119
+ }
120
+ ]
121
+ },
122
+ "statusLine": {
123
+ "type": "command",
124
+ "command": "~/.codebuddy/ccline/ccline",
125
+ "padding": 0
126
+ },
127
+ "enterpriseEndpoint": "https://e.cnpc.com.cn/"
128
+ }
@@ -38,19 +38,19 @@
38
38
  "hooks": [
39
39
  {
40
40
  "type": "command",
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'})\"",
41
+ "command": "npx tsx ~/.claude/hooks/scripts/PreToolUse/pre-tool-use.ts",
42
42
  "timeout": 10
43
43
  }
44
44
  ]
45
45
  }
46
46
  ],
47
- "PostToolUse":[
47
+ "PostToolUse": [
48
48
  {
49
49
  "matcher": "Edit|Write",
50
50
  "hooks": [
51
51
  {
52
52
  "type": "command",
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'})\"",
53
+ "command": "npx tsx ~/.claude/hooks/scripts/PostToolUse/post-tool-use.ts",
54
54
  "timeout": 10
55
55
  }
56
56
  ]
@@ -61,7 +61,7 @@
61
61
  "hooks": [
62
62
  {
63
63
  "type": "command",
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'})\"",
64
+ "command": "npx tsx ~/.claude/hooks/scripts/UserPromptSubmit/user-prompt-submit.ts",
65
65
  "timeout": 10
66
66
  }
67
67
  ]
@@ -72,7 +72,7 @@
72
72
  "hooks": [
73
73
  {
74
74
  "type": "command",
75
- "command": "node -e \"require('child_process').execSync('npx tsx ' + require('path').join(require('os').homedir(), '.claude/hooks/scripts/Notification/notification.ts'), {stdio: 'inherit'})\"",
75
+ "command": "npx tsx ~/.claude/hooks/scripts/Notification/notification.ts",
76
76
  "timeout": 10
77
77
  }
78
78
  ]
@@ -83,7 +83,7 @@
83
83
  "hooks": [
84
84
  {
85
85
  "type": "command",
86
- "command": "node -e \"require('child_process').execSync('npx tsx ' + require('path').join(require('os').homedir(), '.claude/hooks/scripts/Stop/stop.ts'), {stdio: 'inherit'})\"",
86
+ "command": "npx tsx ~/.claude/hooks/scripts/Stop/stop.ts",
87
87
  "timeout": 10
88
88
  }
89
89
  ]
@@ -95,4 +95,4 @@
95
95
  "command": "~/.claude/ccline/ccline",
96
96
  "padding": 0
97
97
  }
98
- }
98
+ }