zcf 2.3.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.ChHPmCup.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.ChHPmCup.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.3.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.3.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",
@@ -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.
@@ -70,4 +70,28 @@ grep -r "pattern" .
70
70
 
71
71
  - Use Task tool for complex searches in large projects
72
72
  - Understand project structure before searching
73
- - Use file type filters wisely for efficiency
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
@@ -11,6 +11,7 @@
11
11
  "Bash",
12
12
  "LS",
13
13
  "Read",
14
+ "Agent",
14
15
  "Write",
15
16
  "Edit",
16
17
  "MultiEdit",
@@ -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
  - **本次迭代已完成的核心任务**及其具体成果。
@@ -70,4 +70,28 @@ grep -r "pattern" .
70
70
 
71
71
  - 大型项目使用 Task 工具进行复杂搜索
72
72
  - 搜索前了解项目结构,缩小范围
73
- - 合理使用文件类型过滤提高效率
73
+ - 合理使用文件类型过滤提高效率
74
+
75
+ ## 文档更新检查
76
+
77
+ 任务完成后自动检查文档更新需求:
78
+
79
+ ### 判断标准
80
+ - **新功能**:需更新 README、CHANGELOG、使用文档
81
+ - **API变更**:需更新 API文档、类型定义、接口说明
82
+ - **配置变更**:需更新配置说明、CLAUDE.md、环境变量文档
83
+ - **Bug修复**:通常无需更新文档(除非影响使用方式)
84
+
85
+ ### 执行流程
86
+ 1. 分析代码变更类型和影响范围
87
+ 2. 自动识别项目中的文档文件
88
+ 3. 列出需更新的文档清单
89
+ 4. 向用户确认:`检测到以下文档可能需要更新:[文档列表],是否需要我帮您更新?`
90
+ 5. 获得确认后逐一更新相关文档
91
+
92
+ ### 常见文档类型
93
+ - **README.md**:功能说明、使用方法、配置说明
94
+ - **CHANGELOG.md**:版本更新记录
95
+ - **CLAUDE.md**:AI助手配置和指令
96
+ - **API文档**:接口定义、参数说明
97
+ - **配置文档**:环境变量、配置项说明