zcf 2.2.0 → 2.4.0

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/README.md CHANGED
@@ -86,9 +86,11 @@ npx zcf → 选择 2 # 通过菜单执行工作流更新
86
86
 
87
87
  - 自动检测 Claude Code 安装状态
88
88
  - 使用 npm 进行自动安装(确保兼容性)
89
- - 跨平台支持(Windows/macOS/Linux)
89
+ - 跨平台支持(Windows/macOS/Linux/Termux
90
90
  - 自动配置 MCP 服务
91
91
  - 智能配置合并和部分修改支持(v2.0 新增)
92
+ - 增强的命令检测机制(v2.1 新增)
93
+ - 危险操作确认机制(v2.3 新增)
92
94
 
93
95
  ### 📦 完整配置
94
96
 
@@ -123,7 +125,7 @@ npx zcf → 选择 2 # 通过菜单执行工作流更新
123
125
  ```bash
124
126
  $ npx zcf
125
127
 
126
- ZCF - Zero-Config Claude-Code Flow v2.0.0
128
+ ZCF - Zero-Config Claude-Code Flow v2.3.0
127
129
 
128
130
  ? Select ZCF display language / 选择ZCF显示语言:
129
131
  ❯ 简体中文
@@ -137,6 +139,7 @@ $ npx zcf
137
139
  4. 配置 MCP 服务 - 管理 MCP 集成
138
140
  5. 配置默认模型 - 设置默认 AI 模型
139
141
  6. 配置 AI 个性 - 设置 AI 助手人格
142
+ 7. 配置 AI 记忆 - 管理 AI 记忆设置
140
143
 
141
144
  ------------ ZCF ------------
142
145
  0. 更改语言 - 切换界面语言
@@ -353,8 +356,12 @@ node bin/zcf.mjs
353
356
  1. 重新运行 `npx zcf` 重新配置
354
357
  2. 检查 `~/.claude/` 目录下的配置文件
355
358
  3. 确保 Claude Code 已正确安装
359
+ 4. 如果路径包含空格,ZCF 会自动处理引号包裹
360
+ 5. 优先使用 ripgrep (`rg`) 进行文件搜索以获得更好性能
356
361
 
357
- ### Windows 平台支持
362
+ ### 跨平台支持
363
+
364
+ #### Windows 平台
358
365
 
359
366
  ZCF 已完全支持 Windows 平台:
360
367
 
@@ -364,6 +371,27 @@ ZCF 已完全支持 Windows 平台:
364
371
 
365
372
  如果在 Windows 上遇到 MCP 连接问题,运行 `npx zcf` 会自动修复配置格式。
366
373
 
374
+ #### Termux 支持(v2.1 新增)
375
+
376
+ ZCF 现已支持在 Android Termux 环境中运行:
377
+
378
+ - **自动适配**:自动检测 Termux 环境并使用兼容配置
379
+ - **增强检测**:智能识别可用命令,确保在受限环境中正常工作
380
+ - **完整功能**:在 Termux 中享受与桌面系统相同的完整功能
381
+
382
+ ### 安全特性(v2.3 新增)
383
+
384
+ #### 危险操作确认机制
385
+
386
+ 为保护用户数据安全,以下操作需要明确确认:
387
+
388
+ - **文件系统**:删除文件/目录、批量修改、移动系统文件
389
+ - **代码提交**:`git commit`、`git push`、`git reset --hard`
390
+ - **系统配置**:修改环境变量、系统设置、权限变更
391
+ - **数据操作**:数据库删除、模式更改、批量更新
392
+ - **网络请求**:发送敏感数据、调用生产环境 API
393
+ - **包管理**:全局安装/卸载、更新核心依赖
394
+
367
395
  ## 🙏 鸣谢
368
396
 
369
397
  本项目的部分 Prompt 参考了以下优秀作品:
package/dist/cli.mjs CHANGED
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import ansis from 'ansis';
3
3
  import cac from 'cac';
4
- import { d as SUPPORTED_LANGS, I as I18N, L as LANG_LABELS, z as updateZcfConfig, Z as ZCF_CONFIG_FILE, B as readZcfConfig, D as resolveAiOutputLanguage, p as applyAiLanguageDirective, E as configureAiPersonality, u as updateDefaultModel, F as isWindows, r as readMcpConfig, x as fixWindowsMcpConfig, w as writeMcpConfig, G as selectMcpServices, s as backupMcpConfig, M as MCP_SERVICES, v as buildMcpServerConfig, t as mergeMcpServers, o as getExistingApiConfig, H as formatApiKeyDisplay, J as modifyApiConfigPartially, K as validateApiKey, l as configureApi, N as displayBanner, O as selectScriptLanguage, S as SETTINGS_FILE, P as updatePromptOnly, Q as version, R as handleExitPromptError, T as handleGeneralError, U as displayBannerWithInfo, i as init } from './shared/zcf.BES32wHt.mjs';
4
+ import { f as SUPPORTED_LANGS, I as I18N, L as LANG_LABELS, E as updateZcfConfig, Z as ZCF_CONFIG_FILE, o as openSettingsJson, b as importRecommendedPermissions, a as importRecommendedEnv, F as readZcfConfig, G as resolveAiOutputLanguage, s as applyAiLanguageDirective, H as configureAiPersonality, u as updateDefaultModel, J as isWindows, v as readMcpConfig, B as fixWindowsMcpConfig, w as writeMcpConfig, K as selectMcpServices, x as backupMcpConfig, M as MCP_SERVICES, z as buildMcpServerConfig, y as mergeMcpServers, r as getExistingApiConfig, N as formatApiKeyDisplay, O as modifyApiConfigPartially, P as validateApiKey, n as configureApi, Q as displayBanner, R as selectScriptLanguage, S as SETTINGS_FILE, T as updatePromptOnly, U as version, V as handleExitPromptError, W as handleGeneralError, X as displayBannerWithInfo, i as init } from './shared/zcf.BvmvOF3q.mjs';
5
5
  import inquirer from 'inquirer';
6
6
  import { existsSync, unlinkSync } from 'node:fs';
7
- import 'node:os';
8
7
  import 'pathe';
9
8
  import 'dayjs';
10
9
  import 'node:url';
11
10
  import 'tinyexec';
11
+ import 'node:os';
12
12
 
13
13
  function handleCancellation(scriptLang) {
14
14
  console.log(ansis.yellow(I18N[scriptLang].cancelled));
@@ -249,6 +249,50 @@ async function changeScriptLanguageFeature(currentLang) {
249
249
  console.log(ansis.green(`\u2714 ${I18N[lang].languageChanged || "Language changed"}`));
250
250
  return lang;
251
251
  }
252
+ async function configureEnvPermissionFeature(scriptLang) {
253
+ const i18n = I18N[scriptLang];
254
+ const { choice } = await inquirer.prompt({
255
+ type: "list",
256
+ name: "choice",
257
+ message: i18n.selectEnvPermissionOption,
258
+ choices: [
259
+ {
260
+ name: `${i18n.importRecommendedEnv} ${ansis.gray("- " + i18n.importRecommendedEnvDesc)}`,
261
+ value: "env"
262
+ },
263
+ {
264
+ name: `${i18n.importRecommendedPermissions} ${ansis.gray("- " + i18n.importRecommendedPermissionsDesc)}`,
265
+ value: "permissions"
266
+ },
267
+ {
268
+ name: `${i18n.openSettingsJson} ${ansis.gray("- " + i18n.openSettingsJsonDesc)}`,
269
+ value: "open"
270
+ }
271
+ ]
272
+ });
273
+ if (!choice) {
274
+ handleCancellation(scriptLang);
275
+ return;
276
+ }
277
+ try {
278
+ switch (choice) {
279
+ case "env":
280
+ await importRecommendedEnv();
281
+ console.log(ansis.green(`\u2705 ${i18n.envImportSuccess}`));
282
+ break;
283
+ case "permissions":
284
+ await importRecommendedPermissions();
285
+ console.log(ansis.green(`\u2705 ${i18n.permissionsImportSuccess}`));
286
+ break;
287
+ case "open":
288
+ console.log(ansis.cyan(i18n.openingSettingsJson));
289
+ await openSettingsJson();
290
+ break;
291
+ }
292
+ } catch (error) {
293
+ console.error(ansis.red(`${i18n.error}: ${error.message}`));
294
+ }
295
+ }
252
296
 
253
297
  async function update(options = {}) {
254
298
  try {
@@ -334,6 +378,11 @@ async function showMainMenu() {
334
378
  "- " + i18n.menuDescriptions.configureAiMemory
335
379
  )}`
336
380
  );
381
+ console.log(
382
+ ` ${ansis.cyan("7.")} ${i18n.menuOptions.configureEnvPermission} ${ansis.gray(
383
+ "- " + i18n.menuDescriptions.configureEnvPermission
384
+ )}`
385
+ );
337
386
  console.log("");
338
387
  console.log(" ------------ ZCF ------------");
339
388
  console.log(
@@ -351,7 +400,7 @@ async function showMainMenu() {
351
400
  name: "choice",
352
401
  message: i18n.enterChoice || "Enter your choice",
353
402
  validate: (value) => {
354
- const valid = ["1", "2", "3", "4", "5", "6", "0", "-", "q", "Q"];
403
+ const valid = ["1", "2", "3", "4", "5", "6", "7", "0", "-", "q", "Q"];
355
404
  return valid.includes(value) || i18n.invalidChoice;
356
405
  }
357
406
  });
@@ -379,6 +428,9 @@ async function showMainMenu() {
379
428
  case "6":
380
429
  await configureAiMemoryFeature(scriptLang);
381
430
  break;
431
+ case "7":
432
+ await configureEnvPermissionFeature(scriptLang);
433
+ break;
382
434
  case "-":
383
435
  await clearZcfCacheFeature(scriptLang);
384
436
  break;
package/dist/index.d.mts CHANGED
@@ -142,6 +142,7 @@ declare const I18N: {
142
142
  configureMcp: string;
143
143
  configureModel: string;
144
144
  configureAiMemory: string;
145
+ configureEnvPermission: string;
145
146
  clearCache: string;
146
147
  changeLanguage: string;
147
148
  exit: string;
@@ -153,6 +154,7 @@ declare const I18N: {
153
154
  configureMcp: string;
154
155
  configureModel: string;
155
156
  configureAiMemory: string;
157
+ configureEnvPermission: string;
156
158
  clearCache: string;
157
159
  changeLanguage: string;
158
160
  };
@@ -211,6 +213,16 @@ declare const I18N: {
211
213
  forceOverwrite: string;
212
214
  initClaudeConfig: string;
213
215
  updatePromptsOnly: string;
216
+ selectEnvPermissionOption: string;
217
+ importRecommendedEnv: string;
218
+ importRecommendedEnvDesc: string;
219
+ importRecommendedPermissions: string;
220
+ importRecommendedPermissionsDesc: string;
221
+ openSettingsJson: string;
222
+ openSettingsJsonDesc: string;
223
+ envImportSuccess: string;
224
+ permissionsImportSuccess: string;
225
+ openingSettingsJson: string;
214
226
  spaceToSelectReturn: string;
215
227
  };
216
228
  en: {
@@ -300,6 +312,7 @@ declare const I18N: {
300
312
  configureMcp: string;
301
313
  configureModel: string;
302
314
  configureAiMemory: string;
315
+ configureEnvPermission: string;
303
316
  clearCache: string;
304
317
  changeLanguage: string;
305
318
  exit: string;
@@ -311,6 +324,7 @@ declare const I18N: {
311
324
  configureMcp: string;
312
325
  configureModel: string;
313
326
  configureAiMemory: string;
327
+ configureEnvPermission: string;
314
328
  clearCache: string;
315
329
  changeLanguage: string;
316
330
  };
@@ -369,6 +383,16 @@ declare const I18N: {
369
383
  forceOverwrite: string;
370
384
  initClaudeConfig: string;
371
385
  updatePromptsOnly: string;
386
+ selectEnvPermissionOption: string;
387
+ importRecommendedEnv: string;
388
+ importRecommendedEnvDesc: string;
389
+ importRecommendedPermissions: string;
390
+ importRecommendedPermissionsDesc: string;
391
+ openSettingsJson: string;
392
+ openSettingsJsonDesc: string;
393
+ envImportSuccess: string;
394
+ permissionsImportSuccess: string;
395
+ openingSettingsJson: string;
372
396
  spaceToSelectReturn: string;
373
397
  };
374
398
  };
@@ -424,5 +448,9 @@ declare function buildMcpServerConfig(baseConfig: McpServerConfig, apiKey?: stri
424
448
  declare function fixWindowsMcpConfig(config: ClaudeConfiguration): ClaudeConfiguration;
425
449
  declare function addCompletedOnboarding(): void;
426
450
 
427
- export { AI_OUTPUT_LANGUAGES, CLAUDE_DIR, CLAUDE_MD_FILE, ClAUDE_CONFIG_FILE, I18N, LANG_LABELS, MCP_SERVICES, SETTINGS_FILE, SUPPORTED_LANGS, ZCF_CONFIG_FILE, addCompletedOnboarding, applyAiLanguageDirective, backupExistingConfig, backupMcpConfig, buildMcpServerConfig, commandExists, configureApi, copyConfigFiles, ensureClaudeDir, fixWindowsMcpConfig, getExistingApiConfig, getMcpConfigPath, getPlatform, init, installClaudeCode, isClaudeCodeInstalled, mergeConfigs, mergeMcpServers, mergeSettingsFile, readMcpConfig, updateDefaultModel, writeMcpConfig };
451
+ declare function importRecommendedEnv(): Promise<void>;
452
+ declare function importRecommendedPermissions(): Promise<void>;
453
+ declare function openSettingsJson(): Promise<void>;
454
+
455
+ export { AI_OUTPUT_LANGUAGES, CLAUDE_DIR, CLAUDE_MD_FILE, ClAUDE_CONFIG_FILE, I18N, LANG_LABELS, MCP_SERVICES, SETTINGS_FILE, SUPPORTED_LANGS, ZCF_CONFIG_FILE, addCompletedOnboarding, applyAiLanguageDirective, backupExistingConfig, backupMcpConfig, buildMcpServerConfig, commandExists, configureApi, copyConfigFiles, ensureClaudeDir, fixWindowsMcpConfig, getExistingApiConfig, getMcpConfigPath, getPlatform, importRecommendedEnv, importRecommendedPermissions, init, installClaudeCode, isClaudeCodeInstalled, mergeConfigs, mergeMcpServers, mergeSettingsFile, openSettingsJson, readMcpConfig, updateDefaultModel, writeMcpConfig };
428
456
  export type { AiOutputLanguage, ApiConfig, ClaudeConfiguration, McpServerConfig, McpService, SupportedLang };
package/dist/index.d.ts CHANGED
@@ -142,6 +142,7 @@ declare const I18N: {
142
142
  configureMcp: string;
143
143
  configureModel: string;
144
144
  configureAiMemory: string;
145
+ configureEnvPermission: string;
145
146
  clearCache: string;
146
147
  changeLanguage: string;
147
148
  exit: string;
@@ -153,6 +154,7 @@ declare const I18N: {
153
154
  configureMcp: string;
154
155
  configureModel: string;
155
156
  configureAiMemory: string;
157
+ configureEnvPermission: string;
156
158
  clearCache: string;
157
159
  changeLanguage: string;
158
160
  };
@@ -211,6 +213,16 @@ declare const I18N: {
211
213
  forceOverwrite: string;
212
214
  initClaudeConfig: string;
213
215
  updatePromptsOnly: string;
216
+ selectEnvPermissionOption: string;
217
+ importRecommendedEnv: string;
218
+ importRecommendedEnvDesc: string;
219
+ importRecommendedPermissions: string;
220
+ importRecommendedPermissionsDesc: string;
221
+ openSettingsJson: string;
222
+ openSettingsJsonDesc: string;
223
+ envImportSuccess: string;
224
+ permissionsImportSuccess: string;
225
+ openingSettingsJson: string;
214
226
  spaceToSelectReturn: string;
215
227
  };
216
228
  en: {
@@ -300,6 +312,7 @@ declare const I18N: {
300
312
  configureMcp: string;
301
313
  configureModel: string;
302
314
  configureAiMemory: string;
315
+ configureEnvPermission: string;
303
316
  clearCache: string;
304
317
  changeLanguage: string;
305
318
  exit: string;
@@ -311,6 +324,7 @@ declare const I18N: {
311
324
  configureMcp: string;
312
325
  configureModel: string;
313
326
  configureAiMemory: string;
327
+ configureEnvPermission: string;
314
328
  clearCache: string;
315
329
  changeLanguage: string;
316
330
  };
@@ -369,6 +383,16 @@ declare const I18N: {
369
383
  forceOverwrite: string;
370
384
  initClaudeConfig: string;
371
385
  updatePromptsOnly: string;
386
+ selectEnvPermissionOption: string;
387
+ importRecommendedEnv: string;
388
+ importRecommendedEnvDesc: string;
389
+ importRecommendedPermissions: string;
390
+ importRecommendedPermissionsDesc: string;
391
+ openSettingsJson: string;
392
+ openSettingsJsonDesc: string;
393
+ envImportSuccess: string;
394
+ permissionsImportSuccess: string;
395
+ openingSettingsJson: string;
372
396
  spaceToSelectReturn: string;
373
397
  };
374
398
  };
@@ -424,5 +448,9 @@ declare function buildMcpServerConfig(baseConfig: McpServerConfig, apiKey?: stri
424
448
  declare function fixWindowsMcpConfig(config: ClaudeConfiguration): ClaudeConfiguration;
425
449
  declare function addCompletedOnboarding(): void;
426
450
 
427
- export { AI_OUTPUT_LANGUAGES, CLAUDE_DIR, CLAUDE_MD_FILE, ClAUDE_CONFIG_FILE, I18N, LANG_LABELS, MCP_SERVICES, SETTINGS_FILE, SUPPORTED_LANGS, ZCF_CONFIG_FILE, addCompletedOnboarding, applyAiLanguageDirective, backupExistingConfig, backupMcpConfig, buildMcpServerConfig, commandExists, configureApi, copyConfigFiles, ensureClaudeDir, fixWindowsMcpConfig, getExistingApiConfig, getMcpConfigPath, getPlatform, init, installClaudeCode, isClaudeCodeInstalled, mergeConfigs, mergeMcpServers, mergeSettingsFile, readMcpConfig, updateDefaultModel, writeMcpConfig };
451
+ declare function importRecommendedEnv(): Promise<void>;
452
+ declare function importRecommendedPermissions(): Promise<void>;
453
+ declare function openSettingsJson(): Promise<void>;
454
+
455
+ export { AI_OUTPUT_LANGUAGES, CLAUDE_DIR, CLAUDE_MD_FILE, ClAUDE_CONFIG_FILE, I18N, LANG_LABELS, MCP_SERVICES, SETTINGS_FILE, SUPPORTED_LANGS, ZCF_CONFIG_FILE, addCompletedOnboarding, applyAiLanguageDirective, backupExistingConfig, backupMcpConfig, buildMcpServerConfig, commandExists, configureApi, copyConfigFiles, ensureClaudeDir, fixWindowsMcpConfig, getExistingApiConfig, getMcpConfigPath, getPlatform, importRecommendedEnv, importRecommendedPermissions, init, installClaudeCode, isClaudeCodeInstalled, mergeConfigs, mergeMcpServers, mergeSettingsFile, openSettingsJson, readMcpConfig, updateDefaultModel, writeMcpConfig };
428
456
  export type { AiOutputLanguage, ApiConfig, ClaudeConfiguration, McpServerConfig, McpService, SupportedLang };
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
- export { A as AI_OUTPUT_LANGUAGES, C as CLAUDE_DIR, a as CLAUDE_MD_FILE, b as ClAUDE_CONFIG_FILE, I as I18N, L as LANG_LABELS, M as MCP_SERVICES, S as SETTINGS_FILE, d as SUPPORTED_LANGS, Z as ZCF_CONFIG_FILE, y as addCompletedOnboarding, p as applyAiLanguageDirective, j as backupExistingConfig, s as backupMcpConfig, v as buildMcpServerConfig, c as commandExists, l as configureApi, k as copyConfigFiles, h as ensureClaudeDir, x as fixWindowsMcpConfig, o as getExistingApiConfig, q as getMcpConfigPath, g as getPlatform, i as init, f as installClaudeCode, e as isClaudeCodeInstalled, m as mergeConfigs, t as mergeMcpServers, n as mergeSettingsFile, r as readMcpConfig, u as updateDefaultModel, w as writeMcpConfig } from './shared/zcf.BES32wHt.mjs';
1
+ export { A as AI_OUTPUT_LANGUAGES, C as CLAUDE_DIR, d as CLAUDE_MD_FILE, e as ClAUDE_CONFIG_FILE, I as I18N, L as LANG_LABELS, M as MCP_SERVICES, S as SETTINGS_FILE, f as SUPPORTED_LANGS, Z as ZCF_CONFIG_FILE, D as addCompletedOnboarding, s as applyAiLanguageDirective, l as backupExistingConfig, x as backupMcpConfig, z as buildMcpServerConfig, c as commandExists, n as configureApi, m as copyConfigFiles, k as ensureClaudeDir, B as fixWindowsMcpConfig, r as getExistingApiConfig, t as getMcpConfigPath, g as getPlatform, a as importRecommendedEnv, b as importRecommendedPermissions, i as init, j as installClaudeCode, h as isClaudeCodeInstalled, p as mergeConfigs, y as mergeMcpServers, q as mergeSettingsFile, o as openSettingsJson, v as readMcpConfig, u as updateDefaultModel, w as writeMcpConfig } from './shared/zcf.BvmvOF3q.mjs';
2
2
  import 'inquirer';
3
3
  import 'ansis';
4
4
  import 'node:fs';
5
- import 'node:os';
6
5
  import 'pathe';
7
6
  import 'dayjs';
8
7
  import 'node:url';
9
8
  import 'tinyexec';
9
+ import 'node:os';
@@ -1,13 +1,13 @@
1
1
  import inquirer from 'inquirer';
2
2
  import ansis from 'ansis';
3
3
  import { existsSync, mkdirSync, copyFileSync, writeFileSync, readFileSync, readdirSync, statSync } from 'node:fs';
4
- import { homedir, platform } from 'node:os';
5
4
  import { join, dirname } from 'pathe';
6
5
  import dayjs from 'dayjs';
7
6
  import { fileURLToPath } from 'node:url';
8
7
  import { exec } from 'tinyexec';
8
+ import { homedir, platform } from 'node:os';
9
9
 
10
- const version = "2.2.0";
10
+ const version = "2.4.0";
11
11
  const homepage = "https://github.com/UfoMiao/zcf";
12
12
 
13
13
  const CLAUDE_DIR = join(homedir(), ".claude");
@@ -115,6 +115,7 @@ const I18N = {
115
115
  configureMcp: "\u914D\u7F6E MCP",
116
116
  configureModel: "\u914D\u7F6E\u9ED8\u8BA4\u6A21\u578B",
117
117
  configureAiMemory: "\u914D\u7F6E Claude \u5168\u5C40\u8BB0\u5FC6",
118
+ configureEnvPermission: "\u5BFC\u5165\u63A8\u8350\u73AF\u5883\u53D8\u91CF\u548C\u6743\u9650\u914D\u7F6E",
118
119
  clearCache: "\u6E05\u9664\u504F\u597D\u7F13\u5B58",
119
120
  changeLanguage: "\u66F4\u6539\u663E\u793A\u8BED\u8A00 / Select display language",
120
121
  exit: "\u9000\u51FA"
@@ -126,6 +127,7 @@ const I18N = {
126
127
  configureMcp: "\u914D\u7F6E MCP \u670D\u52A1\uFF08\u542B Windows \u4FEE\u590D\uFF09",
127
128
  configureModel: "\u8BBE\u7F6E\u9ED8\u8BA4\u6A21\u578B\uFF08opus/sonnet\uFF09",
128
129
  configureAiMemory: "\u914D\u7F6E AI \u8F93\u51FA\u8BED\u8A00\u548C\u89D2\u8272\u98CE\u683C",
130
+ configureEnvPermission: "\u5BFC\u5165\u9690\u79C1\u4FDD\u62A4\u73AF\u5883\u53D8\u91CF\u548C\u7CFB\u7EDF\u6743\u9650\u914D\u7F6E",
129
131
  clearCache: "\u6E05\u9664\u504F\u597D\u8BED\u8A00\u7B49\u7F13\u5B58",
130
132
  changeLanguage: "\u66F4\u6539 ZCF \u754C\u9762\u8BED\u8A00"
131
133
  },
@@ -198,6 +200,17 @@ const I18N = {
198
200
  forceOverwrite: "\u5F3A\u5236\u8986\u76D6\u73B0\u6709\u914D\u7F6E",
199
201
  initClaudeConfig: "\u521D\u59CB\u5316 Claude Code \u914D\u7F6E",
200
202
  updatePromptsOnly: "\u4EC5\u66F4\u65B0 Claude Code \u63D0\u793A",
203
+ // Environment variables and permissions
204
+ selectEnvPermissionOption: "\u8BF7\u9009\u62E9\u914D\u7F6E\u9009\u9879",
205
+ importRecommendedEnv: "\u5BFC\u5165 ZCF \u63A8\u8350\u73AF\u5883\u53D8\u91CF",
206
+ importRecommendedEnvDesc: "\u9690\u79C1\u4FDD\u62A4\u53D8\u91CF\u7B49",
207
+ importRecommendedPermissions: "\u5BFC\u5165 ZCF \u63A8\u8350\u6743\u9650\u914D\u7F6E",
208
+ importRecommendedPermissionsDesc: "\u51E0\u4E4E\u5168\u90E8\u6743\u9650\uFF0C\u51CF\u5C11\u9891\u7E41\u8BF7\u6C42\u6743\u9650\uFF0C\u5371\u9669\u64CD\u4F5C\u7531\u89C4\u5219\u9650\u5236",
209
+ openSettingsJson: "\u6253\u5F00 settings.json \u624B\u52A8\u914D\u7F6E",
210
+ openSettingsJsonDesc: "\u9AD8\u7EA7\u7528\u6237\u81EA\u5B9A\u4E49",
211
+ envImportSuccess: "\u73AF\u5883\u53D8\u91CF\u5DF2\u5BFC\u5165",
212
+ permissionsImportSuccess: "\u6743\u9650\u914D\u7F6E\u5DF2\u5BFC\u5165",
213
+ openingSettingsJson: "\u6B63\u5728\u6253\u5F00 settings.json...",
201
214
  // Misc
202
215
  spaceToSelectReturn: "- \u7A7A\u683C\u9009\u62E9\uFF0C\u56DE\u8F66\u63D0\u4EA4"
203
216
  },
@@ -290,6 +303,7 @@ const I18N = {
290
303
  configureMcp: "Configure MCP",
291
304
  configureModel: "Configure default model",
292
305
  configureAiMemory: "Configure Claude global memory",
306
+ configureEnvPermission: "Import recommended environment variables and permissions",
293
307
  clearCache: "Clear preference cache",
294
308
  changeLanguage: "Select display language / \u66F4\u6539\u663E\u793A\u8BED\u8A00",
295
309
  exit: "Exit"
@@ -301,6 +315,7 @@ const I18N = {
301
315
  configureMcp: "Configure MCP services (includes Windows fix)",
302
316
  configureModel: "Set default model (opus/sonnet)",
303
317
  configureAiMemory: "Configure AI output language and personality",
318
+ configureEnvPermission: "Import privacy protection environment variables and system permissions",
304
319
  clearCache: "Clear preference language and other caches",
305
320
  changeLanguage: "Change ZCF interface language"
306
321
  },
@@ -373,6 +388,17 @@ const I18N = {
373
388
  forceOverwrite: "Force overwrite existing configuration",
374
389
  initClaudeConfig: "Initialize Claude Code configuration",
375
390
  updatePromptsOnly: "Update Claude Code prompts only",
391
+ // Environment variables and permissions
392
+ selectEnvPermissionOption: "Select configuration option",
393
+ importRecommendedEnv: "Import ZCF recommended environment variables",
394
+ importRecommendedEnvDesc: "Privacy protection variables, etc.",
395
+ importRecommendedPermissions: "Import ZCF recommended permissions",
396
+ importRecommendedPermissionsDesc: "Almost all permissions, reduce frequent permission requests, dangerous ops limited by rules",
397
+ openSettingsJson: "Open settings.json for manual configuration",
398
+ openSettingsJsonDesc: "Advanced user customization",
399
+ envImportSuccess: "Environment variables imported",
400
+ permissionsImportSuccess: "Permissions imported",
401
+ openingSettingsJson: "Opening settings.json...",
376
402
  // Misc
377
403
  spaceToSelectReturn: "- Space to select. Return to submit"
378
404
  }
@@ -1719,4 +1745,72 @@ async function init(options = {}) {
1719
1745
  }
1720
1746
  }
1721
1747
 
1722
- export { AI_OUTPUT_LANGUAGES as A, readZcfConfig as B, CLAUDE_DIR as C, resolveAiOutputLanguage as D, configureAiPersonality as E, isWindows as F, selectMcpServices as G, formatApiKeyDisplay as H, I18N as I, modifyApiConfigPartially as J, validateApiKey as K, LANG_LABELS as L, MCP_SERVICES as M, displayBanner as N, selectScriptLanguage as O, updatePromptOnly as P, version as Q, handleExitPromptError as R, SETTINGS_FILE as S, handleGeneralError as T, displayBannerWithInfo as U, ZCF_CONFIG_FILE as Z, CLAUDE_MD_FILE as a, ClAUDE_CONFIG_FILE as b, commandExists as c, SUPPORTED_LANGS as d, isClaudeCodeInstalled as e, installClaudeCode as f, getPlatform as g, ensureClaudeDir as h, init as i, backupExistingConfig as j, copyConfigFiles as k, configureApi as l, mergeConfigs as m, mergeSettingsFile as n, getExistingApiConfig as o, applyAiLanguageDirective as p, getMcpConfigPath as q, readMcpConfig as r, backupMcpConfig as s, mergeMcpServers as t, updateDefaultModel as u, buildMcpServerConfig as v, writeMcpConfig as w, fixWindowsMcpConfig as x, addCompletedOnboarding as y, updateZcfConfig as z };
1748
+ const __dirname = dirname(fileURLToPath(import.meta.url));
1749
+ function getTemplateSettings() {
1750
+ const templatePath = join(__dirname, "../../templates/settings.json");
1751
+ const content = readFileSync(templatePath, "utf-8");
1752
+ return JSON.parse(content);
1753
+ }
1754
+ function loadCurrentSettings() {
1755
+ if (!existsSync(SETTINGS_FILE)) {
1756
+ return {};
1757
+ }
1758
+ try {
1759
+ const content = readFileSync(SETTINGS_FILE, "utf-8");
1760
+ return JSON.parse(content);
1761
+ } catch {
1762
+ return {};
1763
+ }
1764
+ }
1765
+ function saveSettings(settings) {
1766
+ ensureDir(CLAUDE_DIR);
1767
+ writeFileSync(SETTINGS_FILE, JSON.stringify(settings, null, 2));
1768
+ }
1769
+ async function importRecommendedEnv() {
1770
+ const templateSettings = getTemplateSettings();
1771
+ const currentSettings = loadCurrentSettings();
1772
+ currentSettings.env = {
1773
+ ...currentSettings.env,
1774
+ ...templateSettings.env
1775
+ };
1776
+ saveSettings(currentSettings);
1777
+ }
1778
+ async function importRecommendedPermissions() {
1779
+ const templateSettings = getTemplateSettings();
1780
+ const currentSettings = loadCurrentSettings();
1781
+ currentSettings.permissions = templateSettings.permissions;
1782
+ saveSettings(currentSettings);
1783
+ }
1784
+ async function openSettingsJson() {
1785
+ ensureDir(CLAUDE_DIR);
1786
+ if (!existsSync(SETTINGS_FILE)) {
1787
+ saveSettings({});
1788
+ }
1789
+ const platform = getPlatform();
1790
+ let command;
1791
+ switch (platform) {
1792
+ case "macos":
1793
+ command = "open";
1794
+ break;
1795
+ case "windows":
1796
+ command = "start";
1797
+ break;
1798
+ default:
1799
+ command = "xdg-open";
1800
+ }
1801
+ try {
1802
+ await exec(command, [SETTINGS_FILE]);
1803
+ } catch (error) {
1804
+ try {
1805
+ await exec("code", [SETTINGS_FILE]);
1806
+ } catch {
1807
+ try {
1808
+ await exec("vim", [SETTINGS_FILE]);
1809
+ } catch {
1810
+ await exec("nano", [SETTINGS_FILE]);
1811
+ }
1812
+ }
1813
+ }
1814
+ }
1815
+
1816
+ export { AI_OUTPUT_LANGUAGES as A, fixWindowsMcpConfig as B, CLAUDE_DIR as C, addCompletedOnboarding as D, updateZcfConfig as E, readZcfConfig as F, resolveAiOutputLanguage as G, configureAiPersonality as H, I18N as I, isWindows as J, selectMcpServices as K, LANG_LABELS as L, MCP_SERVICES as M, formatApiKeyDisplay as N, modifyApiConfigPartially as O, validateApiKey as P, displayBanner as Q, selectScriptLanguage as R, SETTINGS_FILE as S, updatePromptOnly as T, version as U, handleExitPromptError as V, handleGeneralError as W, displayBannerWithInfo as X, ZCF_CONFIG_FILE as Z, importRecommendedEnv as a, importRecommendedPermissions as b, commandExists as c, CLAUDE_MD_FILE as d, ClAUDE_CONFIG_FILE as e, SUPPORTED_LANGS as f, getPlatform as g, isClaudeCodeInstalled as h, init as i, installClaudeCode as j, ensureClaudeDir as k, backupExistingConfig as l, copyConfigFiles as m, configureApi as n, openSettingsJson as o, mergeConfigs as p, mergeSettingsFile as q, getExistingApiConfig as r, applyAiLanguageDirective as s, getMcpConfigPath as t, updateDefaultModel as u, readMcpConfig as v, writeMcpConfig as w, backupMcpConfig as x, mergeMcpServers as y, buildMcpServerConfig as z };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zcf",
3
3
  "type": "module",
4
- "version": "2.2.0",
4
+ "version": "2.4.0",
5
5
  "description": "Zero-Config Claude-Code Flow - One-click configuration tool for Claude Code",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/UfoMiao/zcf",
@@ -1,23 +1,5 @@
1
1
  ---
2
2
  description: Add New Feature
3
-
4
- allowed-tools:
5
- - Task
6
- - Bash
7
- - Glob
8
- - Grep
9
- - Read
10
- - Edit
11
- - MultiEdit
12
- - Write
13
- - WebFetch
14
- - WebSearch
15
- - Notebook.*
16
- - Edit|Write
17
- - mcp__.*
18
- - mcp__memory__.*
19
- - mcp__filesystem__.*
20
- - mcp__github__.*
21
3
  ---
22
4
 
23
5
  $ARGUMENTS
@@ -1,22 +1,5 @@
1
1
  ---
2
2
  description: 'Professional AI programming assistant with structured workflow (Research -> Ideate -> Plan -> Execute -> Optimize -> Review) for developers'
3
- allowed-tools:
4
- - Task
5
- - Bash
6
- - Glob
7
- - Grep
8
- - Read
9
- - Edit
10
- - MultiEdit
11
- - Write
12
- - WebFetch
13
- - WebSearch
14
- - Notebook.*
15
- - Edit|Write
16
- - mcp__.*
17
- - mcp__memory__.*
18
- - mcp__filesystem__.*
19
- - mcp__github__.*
20
3
  ---
21
4
 
22
5
  # Workflow - Professional Development Assistant
@@ -11,6 +11,7 @@ Throughout the entire workflow, you must internalize and strictly adhere to the
11
11
  - **I (Interface Segregation Principle):** Interfaces should be specific and focused, avoiding "fat interfaces."
12
12
  - **D (Dependency Inversion Principle):** Depend on abstractions, not concrete implementations.
13
13
  - **Don't Repeat Yourself (DRY):** Identify and eliminate repetitive patterns in code or logic to improve reusability.
14
+ - **Documentation Sync:** Code changes must be synchronized with relevant documentation updates.
14
15
 
15
16
  **Please strictly follow the workflow and output requirements below:**
16
17
 
@@ -35,6 +36,7 @@ Throughout the entire workflow, you must internalize and strictly adhere to the
35
36
  - Focus on specific implementation details for [project type, e.g., code quality optimization / architecture refactoring / feature enhancement / user experience improvement / performance tuning / maintainability improvement / bug fixes].
36
37
 
37
38
  4. **Summary, Reflection, and Outlook (Reporting Phase):**
39
+ - Check if documentation needs updating (README, CHANGELOG, API docs, etc.).
38
40
  - Provide a clear, structured summary report that includes **actual code/design change recommendations (if applicable)**.
39
41
  - The report must include:
40
42
  - **Core tasks completed in this iteration** and their specific outcomes.
@@ -1,74 +1,97 @@
1
1
  # Technical Execution Guidelines
2
2
 
3
- This document provides best practices that Claude Code should follow when executing specific technical tasks.
3
+ This document provides best practices for Claude Code when executing technical tasks.
4
+
5
+ ## Dangerous Operations Confirmation
6
+
7
+ **Important**: The following operations require explicit user confirmation before execution:
8
+
9
+ ### Operations Requiring Confirmation
10
+ - **File System**: Delete files/directories, bulk modifications, move system files
11
+ - **Code Commits**: `git commit`, `git push`, `git reset --hard`
12
+ - **System Config**: Modify environment variables, system settings, permissions
13
+ - **Data Operations**: Database deletions, schema changes, bulk updates
14
+ - **Network Requests**: Send sensitive data, call production APIs
15
+ - **Package Management**: Global install/uninstall, update core dependencies
16
+
17
+ ### Confirmation Process
18
+ Before executing dangerous operations:
19
+ 1. Clearly explain the operation and its impacts
20
+ 2. Wait for explicit user confirmation (e.g., "yes", "confirm", "proceed")
21
+ 3. If user hesitates or declines, provide more information or alternatives
4
22
 
5
23
  ## Command Execution Best Practices
6
24
 
7
25
  ### Path Handling Standards
8
26
 
9
- **Important**: Always use double quotes to wrap file paths when executing commands on all operating systems, especially on Windows.
27
+ **Important**: Always use double quotes to wrap file paths when executing commands.
10
28
 
11
- #### Correct Examples
12
29
  ```bash
13
- # ✅ Correct: Paths wrapped in double quotes
30
+ # ✅ Correct
14
31
  cd "C:\Users\name\My Documents"
15
- python "C:\Program Files\MyApp\script.py"
16
32
  node "/path/with spaces/app.js"
17
- ```
18
33
 
19
- #### Incorrect Examples
20
- ```bash
21
- # ❌ Incorrect: No quotes, backslashes will be swallowed on Windows
34
+ # Incorrect
22
35
  cd C:\Users\name\My Documents
23
- python C:\Program Files\MyApp\script.py
24
36
  ```
25
37
 
26
38
  ### Cross-Platform Compatibility
39
+ - Prefer forward slashes `/` as path separators
40
+ - When using backslashes, ensure paths are double-quoted
27
41
 
28
- - Prefer forward slashes `/` as path separators (supported by most tools)
29
- - When backslashes must be used, ensure paths are wrapped in double quotes
30
- - Be mindful of spaces and special characters even with relative paths
42
+ ## Search Tool Usage
31
43
 
32
- ## Search Tool Usage Guidelines
44
+ ### Content Search
45
+ **Always prioritize `rg` (ripgrep)** - faster and won't timeout.
33
46
 
34
- ### Content Search Priority
35
-
36
- **Always prioritize `rg` (ripgrep) for file content searches** over `grep`.
37
-
38
- > **Note**: ripgrep requires user installation. Most developers already have this tool installed. If `rg` command is not found, remind users to install:
39
- > - macOS: `brew install ripgrep`
40
- > - Windows: `scoop install ripgrep` or `choco install ripgrep`
41
- > - Linux: `sudo apt-get install ripgrep` or see [official installation guide](https://github.com/BurntSushi/ripgrep#installation)
42
-
43
- #### Reasons
44
- 1. **Superior Performance**: rg won't timeout in large codebases (e.g., Chromium, Emacs)
45
- 2. **Faster Execution**: rg is significantly faster than grep
46
- 3. **Smarter Defaults**: Automatically respects .gitignore files
47
-
48
- #### Usage Examples
49
47
  ```bash
50
- # ✅ Prefer rg
51
- rg "search pattern" .
52
- rg -i "case insensitive" src/
48
+ # ✅ Preferred
49
+ rg "pattern" .
53
50
  rg -t js "console.log" .
54
51
 
55
- # ⚠️ Only use grep when rg is unavailable
52
+ # ⚠️ Fallback
56
53
  grep -r "pattern" .
57
54
  ```
58
55
 
56
+ > Note: If `rg` unavailable, remind user to install: `brew/scoop/apt install ripgrep`
57
+
59
58
  ### File Finding
60
- - Use Glob tool for filename pattern matching
59
+ - Use Glob tool for pattern matching
61
60
  - Use LS tool for directory listings
62
- - Avoid using `find` command (specialized tools are more efficient)
61
+ - Avoid using `find` command
63
62
 
64
63
  ## Tool Usage Principles
65
64
 
66
- 1. **Prefer Specialized Tools**: Use Read, Write, Edit tools instead of cat, echo commands
65
+ 1. **Prefer Specialized Tools**: Use Read, Write, Edit instead of cat, echo
67
66
  2. **Batch Operations**: Call multiple tools simultaneously for efficiency
68
- 3. **Error Handling**: Check for path quoting issues first when commands fail
67
+ 3. **Error Handling**: Check path quoting first when commands fail
69
68
 
70
- ## Performance Optimization Tips
69
+ ## Performance Optimization
71
70
 
72
71
  - Use Task tool for complex searches in large projects
73
- - Understand project structure before searching to narrow scope
74
- - Use search parameters wisely (e.g., file type filters) for efficiency
72
+ - Understand project structure before searching
73
+ - Use file type filters wisely for efficiency
74
+
75
+ ## Documentation Update Check
76
+
77
+ Automatically check documentation update needs after task completion:
78
+
79
+ ### Criteria
80
+ - **New Features**: Update README, CHANGELOG, usage docs
81
+ - **API Changes**: Update API docs, type definitions, interface specs
82
+ - **Config Changes**: Update config guides, CLAUDE.md, env var docs
83
+ - **Bug Fixes**: Usually no doc updates needed (unless usage affected)
84
+
85
+ ### Process
86
+ 1. Analyze code change type and impact scope
87
+ 2. Auto-identify documentation files in project
88
+ 3. List documents needing updates
89
+ 4. Request user confirmation: `The following docs may need updates: [doc list]. Would you like me to update them?`
90
+ 5. Update relevant docs after confirmation
91
+
92
+ ### Common Document Types
93
+ - **README.md**: Features, usage, configuration
94
+ - **CHANGELOG.md**: Version history
95
+ - **CLAUDE.md**: AI assistant config and instructions
96
+ - **API Docs**: Interface definitions, parameters
97
+ - **Config Docs**: Environment variables, settings
@@ -8,19 +8,24 @@
8
8
  "includeCoAuthoredBy": false,
9
9
  "permissions": {
10
10
  "allow": [
11
- "Bash(*)",
12
- "LS(*)",
13
- "Read(*)",
14
- "Write(*)",
15
- "Edit(*)",
16
- "MultiEdit(*)",
17
- "Glob(*)",
18
- "Grep(*)",
19
- "WebFetch(*)",
20
- "WebSearch(*)",
21
- "TodoWrite(*)",
22
- "NotebookRead(*)",
23
- "NotebookEdit(*)"
11
+ "Bash",
12
+ "LS",
13
+ "Read",
14
+ "Agent",
15
+ "Write",
16
+ "Edit",
17
+ "MultiEdit",
18
+ "Glob",
19
+ "Grep",
20
+ "WebFetch",
21
+ "WebSearch",
22
+ "TodoWrite",
23
+ "NotebookRead",
24
+ "NotebookEdit",
25
+ "mcp__exa",
26
+ "mcp__context7",
27
+ "mcp__mcp-deepwiki",
28
+ "mcp__Playwright"
24
29
  ],
25
30
  "deny": []
26
31
  },
@@ -1,23 +1,5 @@
1
1
  ---
2
2
  description: '用于新增功能开发的命令,支持完整的开发流程和工具集成'
3
-
4
- allowed-tools:
5
- - Task
6
- - Bash
7
- - Glob
8
- - Grep
9
- - Read
10
- - Edit
11
- - MultiEdit
12
- - Write
13
- - WebFetch
14
- - WebSearch
15
- - Notebook.*
16
- - Edit|Write
17
- - mcp__.*
18
- - mcp__memory__.*
19
- - mcp__filesystem__.*
20
- - mcp__github__.*
21
3
  ---
22
4
 
23
5
  $ARGUMENTS
@@ -1,22 +1,5 @@
1
1
  ---
2
2
  description: '专业AI编程助手,提供结构化六阶段开发工作流(研究→构思→计划→执行→优化→评审),适用于专业开发者'
3
- allowed-tools:
4
- - Task
5
- - Bash
6
- - Glob
7
- - Grep
8
- - Read
9
- - Edit
10
- - MultiEdit
11
- - Write
12
- - WebFetch
13
- - WebSearch
14
- - Notebook.*
15
- - Edit|Write
16
- - mcp__.*
17
- - mcp__memory__.*
18
- - mcp__filesystem__.*
19
- - mcp__github__.*
20
3
  ---
21
4
 
22
5
  # Workflow - 专业开发助手
@@ -11,6 +11,7 @@
11
11
  - **I (接口隔离):** 接口应专一,避免"胖接口"。
12
12
  - **D (依赖倒置):** 依赖抽象而非具体实现。
13
13
  - **杜绝重复 (DRY):** 识别并消除代码或逻辑中的重复模式,提升复用性。
14
+ - **文档同步 (Doc Sync):** 代码变更必须同步更新相关文档,保持一致性。
14
15
 
15
16
  **请严格遵循以下工作流程和输出要求:**
16
17
 
@@ -35,6 +36,7 @@
35
36
  - 重点关注[项目类型,例如:代码质量优化 / 架构重构 / 功能增强 / 用户体验提升 / 性能调优 / 可维护性改善 / Bug 修复]的具体实现细节。
36
37
 
37
38
  4. **总结、反思与展望(汇报阶段):**
39
+ - 检查是否需要更新文档(README、CHANGELOG、API文档等)。
38
40
  - 提供一个清晰、结构化且包含**实际代码/设计变动建议(如果适用)**的总结报告。
39
41
  - 报告中必须包含:
40
42
  - **本次迭代已完成的核心任务**及其具体成果。
@@ -1,74 +1,97 @@
1
1
  # 技术执行指南
2
2
 
3
- 本文档提供 Claude Code 在执行具体技术任务时应遵循的最佳实践。
3
+ 本文档提供 Claude Code 执行技术任务时的最佳实践。
4
+
5
+ ## 危险操作确认机制
6
+
7
+ **重要**:以下操作需要明确的用户确认后才能执行:
8
+
9
+ ### 需确认的操作类型
10
+ - **文件系统**:删除文件/目录、批量修改、移动系统文件
11
+ - **代码提交**:`git commit`、`git push`、`git reset --hard`
12
+ - **系统配置**:修改环境变量、系统设置、权限变更
13
+ - **数据操作**:数据库删除、结构变更、批量更新
14
+ - **网络请求**:发送敏感数据、调用生产环境API
15
+ - **包管理**:全局安装/卸载、更新核心依赖
16
+
17
+ ### 确认方式
18
+ 执行危险操作前,必须:
19
+ 1. 明确说明即将执行的操作及其影响
20
+ 2. 等待用户明确确认(如"是"、"确认"、"继续")
21
+ 3. 用户未确认或表示犹豫时,提供更多信息或替代方案
4
22
 
5
23
  ## 命令执行最佳实践
6
24
 
7
25
  ### 路径处理规范
8
26
 
9
- **重要**:在所有操作系统上执行命令时,**始终使用双引号包裹文件路径**,特别是在 Windows 系统上。
27
+ **重要**:执行命令时**始终使用双引号包裹文件路径**。
10
28
 
11
- #### 正确示例
12
29
  ```bash
13
- # ✅ 正确:路径使用双引号
30
+ # ✅ 正确
14
31
  cd "C:\Users\name\My Documents"
15
- python "C:\Program Files\MyApp\script.py"
16
32
  node "/path/with spaces/app.js"
17
- ```
18
33
 
19
- #### 错误示例
20
- ```bash
21
- # ❌ 错误:未使用引号,Windows 下反斜杠会被吞掉
34
+ # ❌ 错误
22
35
  cd C:\Users\name\My Documents
23
- python C:\Program Files\MyApp\script.py
24
36
  ```
25
37
 
26
38
  ### 跨平台兼容性
39
+ - 优先使用正斜杠 `/` 作为路径分隔符
40
+ - 使用反斜杠时确保路径被双引号包裹
27
41
 
28
- - 优先使用正斜杠 `/` 作为路径分隔符(大多数工具都支持)
29
- - 当必须使用反斜杠时,确保路径被双引号包裹
30
- - 使用相对路径时也要注意空格和特殊字符
31
-
32
- ## 搜索工具使用指南
33
-
34
- ### 内容搜索优先级
42
+ ## 搜索工具使用
35
43
 
36
- **始终优先使用 `rg` (ripgrep) 进行文件内容搜索**,而不是 `grep`。
44
+ ### 内容搜索
45
+ **始终优先使用 `rg` (ripgrep)**,速度更快且不会超时。
37
46
 
38
- > **注意**:ripgrep 需要用户自行安装。大多数开发者已经安装了此工具,如果遇到 `rg` 命令不存在,请提醒用户安装:
39
- > - macOS: `brew install ripgrep`
40
- > - Windows: `scoop install ripgrep` 或 `choco install ripgrep`
41
- > - Linux: `sudo apt-get install ripgrep` 或查看 [官方安装指南](https://github.com/BurntSushi/ripgrep#installation)
42
-
43
- #### 原因
44
- 1. **性能优越**:在大型代码库(如 Chromium、Emacs)中,rg 不会超时
45
- 2. **速度更快**:rg 的执行速度显著快于 grep
46
- 3. **默认配置更智能**:自动忽略 .gitignore 中的文件
47
-
48
- #### 使用示例
49
47
  ```bash
50
- # ✅ 优先使用 rg
51
- rg "search pattern" .
52
- rg -i "case insensitive" src/
48
+ # ✅ 优先使用
49
+ rg "pattern" .
53
50
  rg -t js "console.log" .
54
51
 
55
- # ⚠️ 仅在 rg 不可用时才使用 grep
52
+ # ⚠️ 备选方案
56
53
  grep -r "pattern" .
57
54
  ```
58
55
 
56
+ > 提示:如 `rg` 不可用,提醒用户安装:`brew/scoop/apt install ripgrep`
57
+
59
58
  ### 文件查找
60
- - 使用 Glob 工具查找文件名模式
61
- - 使用 LS 工具列出目录内容
62
- - 避免使用 `find` 命令(使用专门的工具更高效)
59
+ - 使用 Glob 工具进行模式匹配
60
+ - 使用 LS 工具列出目录
61
+ - 避免使用 `find` 命令
63
62
 
64
63
  ## 工具使用原则
65
64
 
66
- 1. **优先使用专门的工具**:使用 Read、Write、Edit 等专门工具,而不是 cat、echo 等命令
67
- 2. **批量操作**:可以同时调用多个工具以提高效率
68
- 3. **错误处理**:命令失败后,先检查路径引号问题再重试
65
+ 1. **优先专用工具**:使用 Read、Write、Edit 而非 cat、echo
66
+ 2. **批量操作**:同时调用多个工具以提高效率
67
+ 3. **错误处理**:命令失败时先检查路径引号问题
68
+
69
+ ## 性能优化
70
+
71
+ - 大型项目使用 Task 工具进行复杂搜索
72
+ - 搜索前了解项目结构,缩小范围
73
+ - 合理使用文件类型过滤提高效率
74
+
75
+ ## 文档更新检查
76
+
77
+ 任务完成后自动检查文档更新需求:
78
+
79
+ ### 判断标准
80
+ - **新功能**:需更新 README、CHANGELOG、使用文档
81
+ - **API变更**:需更新 API文档、类型定义、接口说明
82
+ - **配置变更**:需更新配置说明、CLAUDE.md、环境变量文档
83
+ - **Bug修复**:通常无需更新文档(除非影响使用方式)
69
84
 
70
- ## 性能优化建议
85
+ ### 执行流程
86
+ 1. 分析代码变更类型和影响范围
87
+ 2. 自动识别项目中的文档文件
88
+ 3. 列出需更新的文档清单
89
+ 4. 向用户确认:`检测到以下文档可能需要更新:[文档列表],是否需要我帮您更新?`
90
+ 5. 获得确认后逐一更新相关文档
71
91
 
72
- - 对于大型项目,使用 Task 工具进行复杂搜索
73
- - 搜索前先了解项目结构,缩小搜索范围
74
- - 合理使用搜索参数(如文件类型过滤)以提高效率
92
+ ### 常见文档类型
93
+ - **README.md**:功能说明、使用方法、配置说明
94
+ - **CHANGELOG.md**:版本更新记录
95
+ - **CLAUDE.md**:AI助手配置和指令
96
+ - **API文档**:接口定义、参数说明
97
+ - **配置文档**:环境变量、配置项说明