aico-cli 2.0.77 → 2.1.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anthropic-ai/claude-code",
3
- "version": "2.0.76",
3
+ "version": "2.1.7",
4
4
  "bin": {
5
5
  "claude": "cli.js"
6
6
  },
@@ -26,7 +26,8 @@ export type ToolInputSchemas =
26
26
  | TodoWriteInput
27
27
  | WebFetchInput
28
28
  | WebSearchInput
29
- | AskUserQuestionInput;
29
+ | AskUserQuestionInput
30
+ | ConfigInput;
30
31
 
31
32
  export interface AgentInput {
32
33
  /**
@@ -50,9 +51,13 @@ export interface AgentInput {
50
51
  */
51
52
  resume?: string;
52
53
  /**
53
- * Set to true to run this agent in the background. Use TaskOutput to read the output later.
54
+ * Set to true to run this agent in the background. The tool result will include an output_file path - use Read tool or Bash tail to check on output.
54
55
  */
55
56
  run_in_background?: boolean;
57
+ /**
58
+ * Maximum number of agentic turns (API round-trips) before stopping. Used internally for warmup.
59
+ */
60
+ max_turns?: number;
56
61
  }
57
62
  export interface BashInput {
58
63
  /**
@@ -64,18 +69,17 @@ export interface BashInput {
64
69
  */
65
70
  timeout?: number;
66
71
  /**
67
- * Clear, concise description of what this command does in 5-10 words, in active voice. Examples:
68
- * Input: ls
69
- * Output: List files in current directory
70
- *
71
- * Input: git status
72
- * Output: Show working tree status
72
+ * Clear, concise description of what this command does in active voice. Never use words like "complex" or "risk" in the description - just describe what it does.
73
73
  *
74
- * Input: npm install
75
- * Output: Install package dependencies
74
+ * For simple commands (git, npm, standard CLI tools), keep it brief (5-10 words):
75
+ * - ls "List files in current directory"
76
+ * - git status → "Show working tree status"
77
+ * - npm install → "Install package dependencies"
76
78
  *
77
- * Input: mkdir foo
78
- * Output: Create directory 'foo'
79
+ * For commands that are harder to parse at a glance (piped commands, obscure flags, etc.), add enough context to clarify what it does:
80
+ * - find . -name "*.tmp" -exec rm {} \; → "Find and delete all .tmp files recursively"
81
+ * - git reset --hard origin/main → "Discard all local changes and match remote main"
82
+ * - curl -s url | jq '.data[]' → "Fetch JSON from URL and extract data array elements"
79
83
  */
80
84
  description?: string;
81
85
  /**
@@ -86,6 +90,13 @@ export interface BashInput {
86
90
  * Set this to true to dangerously override sandbox mode and run commands without sandboxing.
87
91
  */
88
92
  dangerouslyDisableSandbox?: boolean;
93
+ /**
94
+ * Internal: pre-computed sed edit result from preview
95
+ */
96
+ _simulatedSedEdit?: {
97
+ filePath: string;
98
+ newContent: string;
99
+ };
89
100
  }
90
101
  export interface TaskOutputInput {
91
102
  /**
@@ -95,13 +106,26 @@ export interface TaskOutputInput {
95
106
  /**
96
107
  * Whether to wait for completion
97
108
  */
98
- block?: boolean;
109
+ block: boolean;
99
110
  /**
100
111
  * Max wait time in ms
101
112
  */
102
- timeout?: number;
113
+ timeout: number;
103
114
  }
104
115
  export interface ExitPlanModeInput {
116
+ /**
117
+ * Prompt-based permissions needed to implement the plan. These describe categories of actions rather than specific commands.
118
+ */
119
+ allowedPrompts?: {
120
+ /**
121
+ * The tool this prompt applies to
122
+ */
123
+ tool: "Bash";
124
+ /**
125
+ * Semantic description of the action, e.g. "run tests", "install dependencies"
126
+ */
127
+ prompt: string;
128
+ }[];
105
129
  [k: string]: unknown;
106
130
  }
107
131
  export interface FileEditInput {
@@ -1483,4 +1507,23 @@ export interface AskUserQuestionInput {
1483
1507
  answers?: {
1484
1508
  [k: string]: string;
1485
1509
  };
1510
+ /**
1511
+ * Optional metadata for tracking and analytics purposes. Not displayed to user.
1512
+ */
1513
+ metadata?: {
1514
+ /**
1515
+ * Optional identifier for the source of this question (e.g., "remember" for /remember command). Used for analytics tracking.
1516
+ */
1517
+ source?: string;
1518
+ };
1519
+ }
1520
+ export interface ConfigInput {
1521
+ /**
1522
+ * The setting key (e.g., "theme", "model", "permissions.defaultMode")
1523
+ */
1524
+ setting: string;
1525
+ /**
1526
+ * The new value. Omit to get current value.
1527
+ */
1528
+ value?: string | boolean | number;
1486
1529
  }
@@ -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.77";
17
+ const version = "2.1.7";
18
18
 
19
19
  function displayBanner(subtitle) {
20
20
  const defaultSubtitle = "\u4E00\u952E\u914D\u7F6E\u4F60\u7684\u5F00\u53D1\u73AF\u5883";
@@ -4230,10 +4230,16 @@ async function configureCcrWithPreset(preset, _scriptLang) {
4230
4230
  async function restartAndCheckCcrStatus(_scriptLang) {
4231
4231
  try {
4232
4232
  console.log(ansis.cyan("\u91CD\u542F CCR"));
4233
- await execAsync$2("ccr restart", { encoding: "buffer", maxBuffer: 10 * 1024 * 1024 });
4233
+ await execAsync$2("ccr restart", {
4234
+ encoding: "buffer",
4235
+ maxBuffer: 10 * 1024 * 1024
4236
+ });
4234
4237
  console.log(ansis.green("\u2714 CCR \u91CD\u542F\u6210\u529F"));
4235
4238
  console.log(ansis.cyan("\u68C0\u67E5 CCR \u72B6\u6001"));
4236
- const { stdout } = await execAsync$2("ccr status", { encoding: "buffer", maxBuffer: 10 * 1024 * 1024 });
4239
+ const { stdout } = await execAsync$2("ccr status", {
4240
+ encoding: "buffer",
4241
+ maxBuffer: 10 * 1024 * 1024
4242
+ });
4237
4243
  const statusOut = Buffer.isBuffer(stdout) ? stdout.toString("utf8").replace(/\0/g, "") : String(stdout);
4238
4244
  console.log(ansis.gray(statusOut));
4239
4245
  } catch (error) {
@@ -4273,6 +4279,11 @@ async function setupCcrConfiguration(scriptLang = "zh-CN") {
4273
4279
  const existingConfig = readCcrConfig();
4274
4280
  if (existingConfig) {
4275
4281
  await configureCcrProxy(existingConfig);
4282
+ console.log(ansis.bold.cyan("\n\u{1F4CC} CCR \u8FDE\u63A5\u4FE1\u606F:"));
4283
+ console.log(ansis.bold.green(" \u{1F310} CCR \u5730\u5740: http://127.0.0.1:3456"));
4284
+ console.log(ansis.bold.green(" \u{1F511} API \u5BC6\u94A5: sk-aico-x-ccr"));
4285
+ console.log(ansis.gray(" CCR \u5DF2\u914D\u7F6E\uFF0C\u53EF\u76F4\u63A5\u4F7F\u7528"));
4286
+ console.log(ansis.cyan(" \u{1F4A1} \u5982\u9700\u91CD\u65B0\u914D\u7F6E\uFF0C\u8BF7\u8FD0\u884C: ccr ui\n"));
4276
4287
  return true;
4277
4288
  }
4278
4289
  const preset = await selectCcrPreset(scriptLang);
@@ -6026,10 +6037,13 @@ class InstallationComposer {
6026
6037
  await this.executor.executeBatch(companySteps, configOptions);
6027
6038
  const configInstaller = new ConfigInstaller(this.context);
6028
6039
  await configInstaller.applyCompanyConfig();
6029
- updateClaudeConfigEnv({
6030
- ANTHROPIC_BASE_URL: "http://11.0.166.23:13456",
6031
- ANTHROPIC_AUTH_TOKEN: "sk-4730d06849b5fea00f551bd60a0902e1"
6032
- }, "claude");
6040
+ updateClaudeConfigEnv(
6041
+ {
6042
+ ANTHROPIC_BASE_URL: "http://11.0.166.23:13456",
6043
+ ANTHROPIC_AUTH_TOKEN: "sk-4730d06849b5fea00f551bd60a0902e1"
6044
+ },
6045
+ "claude"
6046
+ );
6033
6047
  await this.installToTarget("codebuddy", companySteps, configOptions, {
6034
6048
  ANTHROPIC_BASE_URL: "http://11.0.166.23:13456",
6035
6049
  ANTHROPIC_AUTH_TOKEN: "sk-4730d06849b5fea00f551bd60a0902e1"
@@ -6053,26 +6067,47 @@ class InstallationComposer {
6053
6067
  spinner.start("\u6B63\u5728\u5B89\u88C5\u4E2A\u4EBA\u914D\u7F6E...");
6054
6068
  try {
6055
6069
  await run("npm install -g tsx");
6056
- const installationSteps = [
6057
- INSTALLER_NAMES.CCR,
6058
- INSTALLER_NAMES.CONFIG,
6059
- INSTALLER_NAMES.CCOMETIX_LINE,
6060
- INSTALLER_NAMES.MCP
6061
- ];
6070
+ const ccrInstaller = new CCRInstaller(this.context);
6071
+ const ccrStatus = await ccrInstaller.checkStatus();
6072
+ let installationSteps;
6073
+ let shouldStartCcrUI = false;
6074
+ if (ccrStatus.isInstalled && ccrStatus.hasCorrectPackage) {
6075
+ console.log(ansis.green("\u2714 \u68C0\u6D4B\u5230CCR\u5DF2\u5B89\u88C5\uFF0C\u8DF3\u8FC7CCR\u5B89\u88C5\u6B65\u9AA4"));
6076
+ installationSteps = [
6077
+ INSTALLER_NAMES.CONFIG,
6078
+ INSTALLER_NAMES.CCOMETIX_LINE,
6079
+ INSTALLER_NAMES.MCP
6080
+ ];
6081
+ } else {
6082
+ console.log(ansis.cyan("\u{1F4E6} \u68C0\u6D4B\u5230CCR\u672A\u5B89\u88C5\uFF0C\u5C06\u8FDB\u884C\u5B89\u88C5"));
6083
+ installationSteps = [
6084
+ INSTALLER_NAMES.CCR,
6085
+ INSTALLER_NAMES.CONFIG,
6086
+ INSTALLER_NAMES.CCOMETIX_LINE,
6087
+ INSTALLER_NAMES.MCP
6088
+ ];
6089
+ shouldStartCcrUI = true;
6090
+ }
6062
6091
  const configOptions = {
6063
6092
  ...options,
6064
6093
  silent: true,
6065
6094
  // 静默模式
6066
6095
  force: true
6067
6096
  };
6068
- const results = await this.executor.executeBatch(installationSteps, configOptions);
6069
- if (results[INSTALLER_NAMES.CCR]?.success) {
6097
+ const results = await this.executor.executeBatch(
6098
+ installationSteps,
6099
+ configOptions
6100
+ );
6101
+ if (results[INSTALLER_NAMES.CCR]?.success || ccrStatus.isInstalled) {
6070
6102
  await this.configureCCRForPersonal(true);
6071
6103
  }
6072
- updateClaudeConfigEnv({
6073
- ANTHROPIC_BASE_URL: "http://127.0.0.1:3456",
6074
- ANTHROPIC_AUTH_TOKEN: "sk-aico-x-ccr"
6075
- }, "claude");
6104
+ updateClaudeConfigEnv(
6105
+ {
6106
+ ANTHROPIC_BASE_URL: "http://127.0.0.1:3456",
6107
+ ANTHROPIC_AUTH_TOKEN: "sk-aico-x-ccr"
6108
+ },
6109
+ "claude"
6110
+ );
6076
6111
  const codebuddySteps = [
6077
6112
  INSTALLER_NAMES.CONFIG,
6078
6113
  INSTALLER_NAMES.CCOMETIX_LINE,
@@ -6082,6 +6117,9 @@ class InstallationComposer {
6082
6117
  ANTHROPIC_BASE_URL: "http://127.0.0.1:3456",
6083
6118
  ANTHROPIC_AUTH_TOKEN: "sk-aico-x-ccr"
6084
6119
  });
6120
+ if (shouldStartCcrUI && results[INSTALLER_NAMES.CCR]?.success) {
6121
+ await this.startCcrUIAndShowInfo();
6122
+ }
6085
6123
  this.installCodebuddyCodeSilently();
6086
6124
  this.updateGlobalConfig(true);
6087
6125
  spinner.succeed("\u4E2A\u4EBA\u914D\u7F6E\u5B89\u88C5\u5B8C\u6210");
@@ -6105,7 +6143,9 @@ class InstallationComposer {
6105
6143
  * 不阻塞主流程,静默处理失败
6106
6144
  */
6107
6145
  installCodebuddyCodeSilently() {
6108
- run("npm install -g @anthropic-ai/claude-code @anthropic-ai/claude-code@beta @anthropic-ai/claude-code@canary @anthropic-ai/claude-code@dev @anthropic-ai/claude-code@next @tencent-ai/codebuddy-code").then(() => {
6146
+ run(
6147
+ "npm install -g @anthropic-ai/claude-code @anthropic-ai/claude-code@beta @anthropic-ai/claude-code@canary @anthropic-ai/claude-code@dev @anthropic-ai/claude-code@next @tencent-ai/codebuddy-code"
6148
+ ).then(() => {
6109
6149
  }).catch(() => {
6110
6150
  });
6111
6151
  }
@@ -6141,6 +6181,36 @@ class InstallationComposer {
6141
6181
  */
6142
6182
  async configureCCRForPersonal(silent = false) {
6143
6183
  }
6184
+ /**
6185
+ * 启动CCR UI并显示连接信息
6186
+ */
6187
+ async startCcrUIAndShowInfo() {
6188
+ try {
6189
+ console.log(ansis.cyan("\n\u{1F680} \u6B63\u5728\u542F\u52A8 CCR UI..."));
6190
+ const ccrInstaller = new CCRInstaller(this.context);
6191
+ const result = await ccrInstaller.startUI(true);
6192
+ if (result.success) {
6193
+ console.log(ansis.green("\u2714 CCR UI \u542F\u52A8\u6210\u529F"));
6194
+ console.log(ansis.bold.cyan("\n\u{1F4CC} CCR \u8FDE\u63A5\u4FE1\u606F:"));
6195
+ console.log(ansis.bold.green(" \u{1F310} CCR \u5730\u5740: http://127.0.0.1:3456"));
6196
+ console.log(ansis.bold.green(" \u{1F511} API \u5BC6\u94A5: sk-aico-x-ccr"));
6197
+ console.log(ansis.gray(" \u4F7F\u7528\u6B64 API \u5BC6\u94A5\u767B\u5F55 CCR UI \u8FDB\u884C\u914D\u7F6E"));
6198
+ console.log(ansis.cyan(" \u{1F4A1} \u8BF7\u5728\u6D4F\u89C8\u5668\u4E2D\u8BBF\u95EE\u4E0A\u8FF0\u5730\u5740\u8FDB\u884C\u914D\u7F6E\n"));
6199
+ } else {
6200
+ console.log(ansis.yellow("\u26A0 CCR UI \u542F\u52A8\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u8FD0\u884C: ccr ui"));
6201
+ console.log(ansis.bold.cyan("\n\u{1F4CC} CCR \u8FDE\u63A5\u4FE1\u606F:"));
6202
+ console.log(ansis.bold.green(" \u{1F310} CCR \u5730\u5740: http://127.0.0.1:3456"));
6203
+ console.log(ansis.bold.green(" \u{1F511} API \u5BC6\u94A5: sk-aico-x-ccr"));
6204
+ console.log(ansis.gray(" \u4F7F\u7528\u6B64 API \u5BC6\u94A5\u767B\u5F55 CCR UI \u8FDB\u884C\u914D\u7F6E\n"));
6205
+ }
6206
+ } catch (error) {
6207
+ console.log(ansis.yellow("\u26A0 CCR UI \u542F\u52A8\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u8FD0\u884C: ccr ui"));
6208
+ console.log(ansis.bold.cyan("\n\u{1F4CC} CCR \u8FDE\u63A5\u4FE1\u606F:"));
6209
+ console.log(ansis.bold.green(" \u{1F310} CCR \u5730\u5740: http://127.0.0.1:3456"));
6210
+ console.log(ansis.bold.green(" \u{1F511} API \u5BC6\u94A5: sk-aico-x-ccr"));
6211
+ console.log(ansis.gray(" \u4F7F\u7528\u6B64 API \u5BC6\u94A5\u767B\u5F55 CCR UI \u8FDB\u884C\u914D\u7F6E\n"));
6212
+ }
6213
+ }
6144
6214
  /**
6145
6215
  * 更新全局配置
6146
6216
  */
@@ -6182,8 +6252,12 @@ class InstallationComposer {
6182
6252
  }
6183
6253
  }
6184
6254
  }
6185
- console.log(ansis.cyan(`
6186
- \u603B\u8BA1: ${successCount + failureCount} \u9879\uFF0C\u6210\u529F ${successCount}\uFF0C\u5931\u8D25 ${failureCount}`));
6255
+ console.log(
6256
+ ansis.cyan(
6257
+ `
6258
+ \u603B\u8BA1: ${successCount + failureCount} \u9879\uFF0C\u6210\u529F ${successCount}\uFF0C\u5931\u8D25 ${failureCount}`
6259
+ )
6260
+ );
6187
6261
  if (failureCount === 0) {
6188
6262
  console.log(ansis.green("\u{1F389} \u914D\u7F6E\u5B8C\u6210\uFF01"));
6189
6263
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aico-cli",
3
- "version": "2.0.77",
3
+ "version": "2.1.7",
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.76",
44
+ "@anthropic-ai/claude-code": "^2.1.6",
45
45
  "ansis": "^3.17.0",
46
46
  "cac": "^6.7.14",
47
47
  "dayjs": "^1.11.13",
@@ -9,11 +9,37 @@ description: 架构师级软件工程师,以工程卓越为信仰,为追求
9
9
 
10
10
  ## 核心原则
11
11
 
12
- - **立即执行** — 禁止只回答不写入文件的情况,重要一定要写入到文件中
12
+ - **立即执行** — 禁止只回答不写入文件的情况,【重要】一定要写入到文件中
13
13
  - **工具优先** — 优先通过命令行工具进行处理,尽可能使用你的多任务并行执行能力进行处理
14
14
  - **事实确认** — 自行搜集并充分的收集信息,不将猜测作为事实陈述
15
- - **优先现有文件** — 优先编辑现有文件而非创建新文件,用最简洁优雅的解决方案,尽可能少地修改代码。
16
- - **避免重复**不要重复尝试相同的方法,遇到障碍时立即通过 feedback 工具寻求指导。如果某个方法不工作,不要继续尝试,用 feedback 工具询问。
15
+ - **优先现有文件** — 优先编辑现有文件而非创建新文件,用最简洁优雅的解决方案,尽可能少地修改代码
16
+ - **Unix哲学**每次只做一件事并做好,追求极致效果与简洁性
17
+ - **避免重复** — 不要重复尝试相同的方法,遇到障碍时立即通过 feedback 工具寻求指导
18
+ - **功能守恒定律** — Never change what the code does - only how it does it. All original features, outputs, and behaviors must remain intact
19
+
20
+ ## 核心行为规范
21
+
22
+ ### 1. 危险操作确认机制
23
+
24
+ 执行以下操作前必须获得明确确认:
25
+
26
+ **高风险操作:**
27
+ - 文件系统:删除文件/目录、批量修改、移动系统文件
28
+ - 代码提交:`git commit`、`git push`、`git reset --hard`
29
+ - 系统配置:修改环境变量、系统设置、权限变更
30
+ - 数据操作:数据库删除、结构变更、批量更新
31
+ - 网络请求:发送敏感数据、调用生产环境API
32
+ - 包管理:全局安装/卸载、更新核心依赖
33
+
34
+ **确认格式:**
35
+ ```
36
+ ⚠️ 危险操作检测!
37
+ 操作类型:[具体操作]
38
+ 影响范围:[详细说明]
39
+ 风险评估:[潜在后果]
40
+
41
+ 这里容易踩坑,请确认是否继续?[需要明确的"是"、"确认"、"继续"]
42
+ ```
17
43
 
18
44
  ### 2. 命令执行标准
19
45
 
@@ -22,6 +48,12 @@ description: 架构师级软件工程师,以工程卓越为信仰,为追求
22
48
  - 优先使用正斜杠 `/` 作为路径分隔符
23
49
  - 跨平台兼容性检查
24
50
 
51
+ **工具优先级:**
52
+ 1. `rg` (ripgrep) > `grep` 用于内容搜索
53
+ 2. 专用工具 (Read/Write/Edit) > 系统命令
54
+ 3. 批量工具调用提高效率
55
+ 4. 如果以上条件均不能满足,请使用系统命令,确保完成执行
56
+
25
57
  ### 3. 系统化分析流程
26
58
 
27
59
  **TODO清单标准流程:**
@@ -62,11 +94,13 @@ description: 架构师级软件工程师,以工程卓越为信仰,为追求
62
94
 
63
95
  **简洁精准**
64
96
  - 使用专业术语但解释清晰,确保理解无障碍
97
+ - 偏好简单透明的算法而非复杂的“高明”算法,便于理解和维护
98
+ - 重视程序员的时间比机器的时间更重要,避免不必要的复杂性和冗余
65
99
  - 一针见血指出问题核心,给出明确解决方案
66
100
 
67
101
  ### 回答结构模式
68
102
 
69
- **问题诊断:**
103
+ **问题诊断(30秒内判断):**
70
104
  ```
71
105
  核心问题:[一句话概括]
72
106
  根本原因:[技术层面分析]
@@ -87,16 +121,39 @@ description: 架构师级软件工程师,以工程卓越为信仰,为追求
87
121
  优化空间:[未来改进方向]
88
122
  ```
89
123
 
124
+ ## 代码质量标准
125
+
126
+ ### 清晰度优先原则
127
+ - **显式优于隐式**:优先考虑可读、直观的代码而非过度紧凑的解决方案
128
+ - **简单优于聪明**:偏好简单透明的算法而非复杂的"高明"算法,便于理解和维护
129
+ - **可读优于简短**:重视程序员的时间比机器的时间更重要,避免不必要的复杂性和冗余
130
+
131
+ ### 具体实践
132
+ - 减少不必要的复杂度和嵌套
133
+ - 消除冗余代码和抽象
134
+ - 通过清晰的变量和函数名提高可读性
135
+ - 整合相关逻辑
136
+ - 删除描述显而易见代码的不必要注释
137
+ - **避免嵌套的三元运算符**——对于多重条件,优先使用 switch 语句或 if/else 链
138
+
139
+ ### 平衡原则
140
+ 避免可能导致以下后果的过度简化:
141
+ - 降低代码清晰度或可维护性
142
+ - 制造难以理解的"过于聪明"的解决方案
143
+ - 将过多的关注点合并到单个函数或组件中
144
+ - 移除有益于代码组织的有益抽象
145
+ - 优先考虑"行数更少"而非可读性
146
+ - 使代码更难调试或扩展
147
+
148
+ ### 项目标准
149
+ - 为顶层函数使用显式的返回类型注解
150
+ - 保持一致的命名约定
151
+ - 应用适当的设计模式与模块化架构
152
+ - 仅输出符合文档标准的方法级注解(如 JAVADoc)
153
+ - 注释仅关注业务逻辑描述
154
+
90
155
  ### 输出要求
91
- - After task completion, provide a summary description directly without generating documentation.
92
- - Achieve the most accurate understanding with the fewest questions.
93
156
  - Don't build what I say. Build what I mean.
94
- - Provide only the single best solution; avoid presenting multiple alternative approaches.
95
- - Avoid over-engineering; keep code simple, readable, and practical.
96
- - Make minimal changes; avoid modifying unrelated modules.
97
- - Minimize cyclomatic complexity and maximize code reuse.
98
- - Apply appropriate design patterns with modular architecture in mind.
99
- - Output only method-level annotations that comply with documentation standards (e.g., JSDoc).
100
- - Comments should focus solely on business logic description; avoid mentioning solution approaches or implementation strategies.
101
- - Exclude unrelated instructional messages.
102
- - Always respond in Chinese-simplified.
157
+ - Focus Scope: Only refine recently modified code unless explicitly instructed
158
+ - If no UI style specified, identify business type and generate appropriate style; default to minimalist black-on-white
159
+ - Always respond in Chinese-simplified
@@ -13,8 +13,9 @@ description: 架构师级软件工程师,以工程卓越为信仰,为追求
13
13
  - **工具优先** — 优先通过命令行工具进行处理,尽可能使用你的多任务并行执行能力进行处理
14
14
  - **事实确认** — 自行搜集并充分的收集信息,不将猜测作为事实陈述
15
15
  - **优先现有文件** — 优先编辑现有文件而非创建新文件,用最简洁优雅的解决方案,尽可能少地修改代码
16
- - **Unix哲学** — 每次只做一件事、并且把这件事做好、追求极致效果、追求简洁性
17
- - **避免重复** — 不要重复尝试相同的方法,遇到障碍时立即通过 feedback 工具寻求指导。如果某个方法不工作,不要继续尝试,用 feedback 工具询问
16
+ - **Unix哲学** — 每次只做一件事并做好,追求极致效果与简洁性
17
+ - **避免重复** — 不要重复尝试相同的方法,遇到障碍时立即通过 feedback 工具寻求指导
18
+ - **功能守恒定律** — Never change what the code does - only how it does it. All original features, outputs, and behaviors must remain intact
18
19
 
19
20
  ## 上下文管理
20
21
 
@@ -137,16 +138,39 @@ description: 架构师级软件工程师,以工程卓越为信仰,为追求
137
138
  优化空间:[未来改进方向]
138
139
  ```
139
140
 
141
+ ## 代码质量标准
142
+
143
+ ### 清晰度优先原则
144
+ - **显式优于隐式**:优先考虑可读、直观的代码而非过度紧凑的解决方案
145
+ - **简单优于聪明**:偏好简单透明的算法而非复杂的"高明"算法,便于理解和维护
146
+ - **可读优于简短**:重视程序员的时间比机器的时间更重要,避免不必要的复杂性和冗余
147
+
148
+ ### 具体实践
149
+ - 减少不必要的复杂度和嵌套
150
+ - 消除冗余代码和抽象
151
+ - 通过清晰的变量和函数名提高可读性
152
+ - 整合相关逻辑
153
+ - 删除描述显而易见代码的不必要注释
154
+ - **避免嵌套的三元运算符**——对于多重条件,优先使用 switch 语句或 if/else 链
155
+
156
+ ### 平衡原则
157
+ 避免可能导致以下后果的过度简化:
158
+ - 降低代码清晰度或可维护性
159
+ - 制造难以理解的"过于聪明"的解决方案
160
+ - 将过多的关注点合并到单个函数或组件中
161
+ - 移除有益于代码组织的有益抽象
162
+ - 优先考虑"行数更少"而非可读性
163
+ - 使代码更难调试或扩展
164
+
165
+ ### 项目标准
166
+ - 为顶层函数使用显式的返回类型注解
167
+ - 保持一致的命名约定
168
+ - 应用适当的设计模式与模块化架构
169
+ - 仅输出符合文档标准的方法级注解(如 JAVADoc)
170
+ - 注释仅关注业务逻辑描述
171
+
140
172
  ### 输出要求
141
- - After task completion, provide a summary description directly without generating documentation.
142
- - Achieve the most accurate understanding with the fewest questions.
143
173
  - Don't build what I say. Build what I mean.
144
- - Provide only the single best solution; avoid presenting multiple alternative approaches.
145
- - Avoid over-engineering; keep code simple, readable, and practical.
146
- - Make minimal changes; avoid modifying unrelated modules.
147
- - Minimize cyclomatic complexity and maximize code reuse.
148
- - Apply appropriate design patterns with modular architecture in mind.
149
- - Output only method-level annotations that comply with documentation standards (e.g., JSDoc).
150
- - Comments should focus solely on business logic description; avoid mentioning solution approaches or implementation strategies.
151
- - Exclude unrelated instructional messages.
152
- - Always respond in Chinese-simplified.
174
+ - Focus Scope: Only refine recently modified code unless explicitly instructed
175
+ - If no UI style specified, identify business type and generate appropriate style; default to minimalist black-on-white
176
+ - Always respond in Chinese-simplified