zcf 2.3.0 → 2.4.1
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 +31 -3
- package/dist/cli.mjs +55 -3
- package/dist/index.d.mts +51 -1
- package/dist/index.d.ts +51 -1
- package/dist/index.mjs +2 -2
- package/dist/shared/{zcf.ChHPmCup.mjs → zcf.CYdvtE_u.mjs} +147 -13
- package/package.json +1 -1
- package/templates/en/rules.md +2 -0
- package/templates/en/technical-guides.md +25 -1
- package/templates/settings.json +1 -0
- package/templates/zh-CN/rules.md +2 -0
- package/templates/zh-CN/technical-guides.md +25 -1
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.
|
|
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
|
-
###
|
|
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 {
|
|
4
|
+
import { h as SUPPORTED_LANGS, I as I18N, L as LANG_LABELS, G as updateZcfConfig, Z as ZCF_CONFIG_FILE, o as openSettingsJson, b as importRecommendedPermissions, a as importRecommendedEnv, H as readZcfConfig, J as resolveAiOutputLanguage, v as applyAiLanguageDirective, K as configureAiPersonality, u as updateDefaultModel, N as isWindows, x as readMcpConfig, E as fixWindowsMcpConfig, y as writeMcpConfig, O as selectMcpServices, z as backupMcpConfig, M as MCP_SERVICES, D as buildMcpServerConfig, B as mergeMcpServers, t as getExistingApiConfig, P as formatApiKeyDisplay, Q as modifyApiConfigPartially, R as validateApiKey, q as configureApi, T as displayBanner, U as selectScriptLanguage, S as SETTINGS_FILE, V as updatePromptOnly, W as version, X as handleExitPromptError, Y as handleGeneralError, _ as displayBannerWithInfo, i as init } from './shared/zcf.CYdvtE_u.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,7 +213,18 @@ 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;
|
|
227
|
+
windowsDetected: string;
|
|
215
228
|
};
|
|
216
229
|
en: {
|
|
217
230
|
selectScriptLang: string;
|
|
@@ -300,6 +313,7 @@ declare const I18N: {
|
|
|
300
313
|
configureMcp: string;
|
|
301
314
|
configureModel: string;
|
|
302
315
|
configureAiMemory: string;
|
|
316
|
+
configureEnvPermission: string;
|
|
303
317
|
clearCache: string;
|
|
304
318
|
changeLanguage: string;
|
|
305
319
|
exit: string;
|
|
@@ -311,6 +325,7 @@ declare const I18N: {
|
|
|
311
325
|
configureMcp: string;
|
|
312
326
|
configureModel: string;
|
|
313
327
|
configureAiMemory: string;
|
|
328
|
+
configureEnvPermission: string;
|
|
314
329
|
clearCache: string;
|
|
315
330
|
changeLanguage: string;
|
|
316
331
|
};
|
|
@@ -369,7 +384,18 @@ declare const I18N: {
|
|
|
369
384
|
forceOverwrite: string;
|
|
370
385
|
initClaudeConfig: string;
|
|
371
386
|
updatePromptsOnly: string;
|
|
387
|
+
selectEnvPermissionOption: string;
|
|
388
|
+
importRecommendedEnv: string;
|
|
389
|
+
importRecommendedEnvDesc: string;
|
|
390
|
+
importRecommendedPermissions: string;
|
|
391
|
+
importRecommendedPermissionsDesc: string;
|
|
392
|
+
openSettingsJson: string;
|
|
393
|
+
openSettingsJsonDesc: string;
|
|
394
|
+
envImportSuccess: string;
|
|
395
|
+
permissionsImportSuccess: string;
|
|
396
|
+
openingSettingsJson: string;
|
|
372
397
|
spaceToSelectReturn: string;
|
|
398
|
+
windowsDetected: string;
|
|
373
399
|
};
|
|
374
400
|
};
|
|
375
401
|
declare const MCP_SERVICES: McpService[];
|
|
@@ -424,5 +450,29 @@ declare function buildMcpServerConfig(baseConfig: McpServerConfig, apiKey?: stri
|
|
|
424
450
|
declare function fixWindowsMcpConfig(config: ClaudeConfiguration): ClaudeConfiguration;
|
|
425
451
|
declare function addCompletedOnboarding(): void;
|
|
426
452
|
|
|
427
|
-
|
|
453
|
+
declare function importRecommendedEnv(): Promise<void>;
|
|
454
|
+
declare function importRecommendedPermissions(): Promise<void>;
|
|
455
|
+
declare function openSettingsJson(): Promise<void>;
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Clean up and deduplicate permissions array
|
|
459
|
+
* Removes invalid and redundant permissions based on template
|
|
460
|
+
*/
|
|
461
|
+
/**
|
|
462
|
+
* Clean up permissions array by removing invalid and redundant entries
|
|
463
|
+
* @param templatePermissions - Permissions from template (source of truth)
|
|
464
|
+
* @param userPermissions - User's existing permissions
|
|
465
|
+
* @returns Cleaned permissions array
|
|
466
|
+
*/
|
|
467
|
+
declare function cleanupPermissions(templatePermissions: string[], userPermissions: string[]): string[];
|
|
468
|
+
/**
|
|
469
|
+
* Merge and clean permissions arrays
|
|
470
|
+
* Combines template and user permissions while removing invalid/redundant entries
|
|
471
|
+
* @param templatePermissions - Permissions from template
|
|
472
|
+
* @param userPermissions - User's existing permissions
|
|
473
|
+
* @returns Merged and cleaned permissions array
|
|
474
|
+
*/
|
|
475
|
+
declare function mergeAndCleanPermissions(templatePermissions: string[] | undefined, userPermissions: string[] | undefined): string[];
|
|
476
|
+
|
|
477
|
+
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, cleanupPermissions, commandExists, configureApi, copyConfigFiles, ensureClaudeDir, fixWindowsMcpConfig, getExistingApiConfig, getMcpConfigPath, getPlatform, importRecommendedEnv, importRecommendedPermissions, init, installClaudeCode, isClaudeCodeInstalled, mergeAndCleanPermissions, mergeConfigs, mergeMcpServers, mergeSettingsFile, openSettingsJson, readMcpConfig, updateDefaultModel, writeMcpConfig };
|
|
428
478
|
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,7 +213,18 @@ 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;
|
|
227
|
+
windowsDetected: string;
|
|
215
228
|
};
|
|
216
229
|
en: {
|
|
217
230
|
selectScriptLang: string;
|
|
@@ -300,6 +313,7 @@ declare const I18N: {
|
|
|
300
313
|
configureMcp: string;
|
|
301
314
|
configureModel: string;
|
|
302
315
|
configureAiMemory: string;
|
|
316
|
+
configureEnvPermission: string;
|
|
303
317
|
clearCache: string;
|
|
304
318
|
changeLanguage: string;
|
|
305
319
|
exit: string;
|
|
@@ -311,6 +325,7 @@ declare const I18N: {
|
|
|
311
325
|
configureMcp: string;
|
|
312
326
|
configureModel: string;
|
|
313
327
|
configureAiMemory: string;
|
|
328
|
+
configureEnvPermission: string;
|
|
314
329
|
clearCache: string;
|
|
315
330
|
changeLanguage: string;
|
|
316
331
|
};
|
|
@@ -369,7 +384,18 @@ declare const I18N: {
|
|
|
369
384
|
forceOverwrite: string;
|
|
370
385
|
initClaudeConfig: string;
|
|
371
386
|
updatePromptsOnly: string;
|
|
387
|
+
selectEnvPermissionOption: string;
|
|
388
|
+
importRecommendedEnv: string;
|
|
389
|
+
importRecommendedEnvDesc: string;
|
|
390
|
+
importRecommendedPermissions: string;
|
|
391
|
+
importRecommendedPermissionsDesc: string;
|
|
392
|
+
openSettingsJson: string;
|
|
393
|
+
openSettingsJsonDesc: string;
|
|
394
|
+
envImportSuccess: string;
|
|
395
|
+
permissionsImportSuccess: string;
|
|
396
|
+
openingSettingsJson: string;
|
|
372
397
|
spaceToSelectReturn: string;
|
|
398
|
+
windowsDetected: string;
|
|
373
399
|
};
|
|
374
400
|
};
|
|
375
401
|
declare const MCP_SERVICES: McpService[];
|
|
@@ -424,5 +450,29 @@ declare function buildMcpServerConfig(baseConfig: McpServerConfig, apiKey?: stri
|
|
|
424
450
|
declare function fixWindowsMcpConfig(config: ClaudeConfiguration): ClaudeConfiguration;
|
|
425
451
|
declare function addCompletedOnboarding(): void;
|
|
426
452
|
|
|
427
|
-
|
|
453
|
+
declare function importRecommendedEnv(): Promise<void>;
|
|
454
|
+
declare function importRecommendedPermissions(): Promise<void>;
|
|
455
|
+
declare function openSettingsJson(): Promise<void>;
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Clean up and deduplicate permissions array
|
|
459
|
+
* Removes invalid and redundant permissions based on template
|
|
460
|
+
*/
|
|
461
|
+
/**
|
|
462
|
+
* Clean up permissions array by removing invalid and redundant entries
|
|
463
|
+
* @param templatePermissions - Permissions from template (source of truth)
|
|
464
|
+
* @param userPermissions - User's existing permissions
|
|
465
|
+
* @returns Cleaned permissions array
|
|
466
|
+
*/
|
|
467
|
+
declare function cleanupPermissions(templatePermissions: string[], userPermissions: string[]): string[];
|
|
468
|
+
/**
|
|
469
|
+
* Merge and clean permissions arrays
|
|
470
|
+
* Combines template and user permissions while removing invalid/redundant entries
|
|
471
|
+
* @param templatePermissions - Permissions from template
|
|
472
|
+
* @param userPermissions - User's existing permissions
|
|
473
|
+
* @returns Merged and cleaned permissions array
|
|
474
|
+
*/
|
|
475
|
+
declare function mergeAndCleanPermissions(templatePermissions: string[] | undefined, userPermissions: string[] | undefined): string[];
|
|
476
|
+
|
|
477
|
+
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, cleanupPermissions, commandExists, configureApi, copyConfigFiles, ensureClaudeDir, fixWindowsMcpConfig, getExistingApiConfig, getMcpConfigPath, getPlatform, importRecommendedEnv, importRecommendedPermissions, init, installClaudeCode, isClaudeCodeInstalled, mergeAndCleanPermissions, mergeConfigs, mergeMcpServers, mergeSettingsFile, openSettingsJson, readMcpConfig, updateDefaultModel, writeMcpConfig };
|
|
428
478
|
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,
|
|
1
|
+
export { A as AI_OUTPUT_LANGUAGES, C as CLAUDE_DIR, e as CLAUDE_MD_FILE, f as ClAUDE_CONFIG_FILE, I as I18N, L as LANG_LABELS, M as MCP_SERVICES, S as SETTINGS_FILE, h as SUPPORTED_LANGS, Z as ZCF_CONFIG_FILE, F as addCompletedOnboarding, v as applyAiLanguageDirective, n as backupExistingConfig, z as backupMcpConfig, D as buildMcpServerConfig, d as cleanupPermissions, c as commandExists, q as configureApi, p as copyConfigFiles, l as ensureClaudeDir, E as fixWindowsMcpConfig, t as getExistingApiConfig, w as getMcpConfigPath, g as getPlatform, a as importRecommendedEnv, b as importRecommendedPermissions, i as init, k as installClaudeCode, j as isClaudeCodeInstalled, m as mergeAndCleanPermissions, r as mergeConfigs, B as mergeMcpServers, s as mergeSettingsFile, o as openSettingsJson, x as readMcpConfig, u as updateDefaultModel, y as writeMcpConfig } from './shared/zcf.CYdvtE_u.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.
|
|
10
|
+
const version = "2.4.1";
|
|
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,8 +200,21 @@ 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
|
-
spaceToSelectReturn: "- \u7A7A\u683C\u9009\u62E9\uFF0C\u56DE\u8F66\u63D0\u4EA4"
|
|
215
|
+
spaceToSelectReturn: "- \u7A7A\u683C\u9009\u62E9\uFF0C\u56DE\u8F66\u63D0\u4EA4",
|
|
216
|
+
// Windows detection
|
|
217
|
+
windowsDetected: "\u68C0\u6D4B\u5230 Windows \u7CFB\u7EDF\uFF0C\u5C06\u81EA\u52A8\u914D\u7F6E\u517C\u5BB9\u683C\u5F0F"
|
|
203
218
|
},
|
|
204
219
|
en: {
|
|
205
220
|
selectScriptLang: "Select ZCF display language",
|
|
@@ -290,6 +305,7 @@ const I18N = {
|
|
|
290
305
|
configureMcp: "Configure MCP",
|
|
291
306
|
configureModel: "Configure default model",
|
|
292
307
|
configureAiMemory: "Configure Claude global memory",
|
|
308
|
+
configureEnvPermission: "Import recommended environment variables and permissions",
|
|
293
309
|
clearCache: "Clear preference cache",
|
|
294
310
|
changeLanguage: "Select display language / \u66F4\u6539\u663E\u793A\u8BED\u8A00",
|
|
295
311
|
exit: "Exit"
|
|
@@ -301,6 +317,7 @@ const I18N = {
|
|
|
301
317
|
configureMcp: "Configure MCP services (includes Windows fix)",
|
|
302
318
|
configureModel: "Set default model (opus/sonnet)",
|
|
303
319
|
configureAiMemory: "Configure AI output language and personality",
|
|
320
|
+
configureEnvPermission: "Import privacy protection environment variables and system permissions",
|
|
304
321
|
clearCache: "Clear preference language and other caches",
|
|
305
322
|
changeLanguage: "Change ZCF interface language"
|
|
306
323
|
},
|
|
@@ -373,8 +390,21 @@ const I18N = {
|
|
|
373
390
|
forceOverwrite: "Force overwrite existing configuration",
|
|
374
391
|
initClaudeConfig: "Initialize Claude Code configuration",
|
|
375
392
|
updatePromptsOnly: "Update Claude Code prompts only",
|
|
393
|
+
// Environment variables and permissions
|
|
394
|
+
selectEnvPermissionOption: "Select configuration option",
|
|
395
|
+
importRecommendedEnv: "Import ZCF recommended environment variables",
|
|
396
|
+
importRecommendedEnvDesc: "Privacy protection variables, etc.",
|
|
397
|
+
importRecommendedPermissions: "Import ZCF recommended permissions",
|
|
398
|
+
importRecommendedPermissionsDesc: "Almost all permissions, reduce frequent permission requests, dangerous ops limited by rules",
|
|
399
|
+
openSettingsJson: "Open settings.json for manual configuration",
|
|
400
|
+
openSettingsJsonDesc: "Advanced user customization",
|
|
401
|
+
envImportSuccess: "Environment variables imported",
|
|
402
|
+
permissionsImportSuccess: "Permissions imported",
|
|
403
|
+
openingSettingsJson: "Opening settings.json...",
|
|
376
404
|
// Misc
|
|
377
|
-
spaceToSelectReturn: "- Space to select. Return to submit"
|
|
405
|
+
spaceToSelectReturn: "- Space to select. Return to submit",
|
|
406
|
+
// Windows detection
|
|
407
|
+
windowsDetected: "Windows detected, will configure compatible format"
|
|
378
408
|
}
|
|
379
409
|
};
|
|
380
410
|
const MCP_SERVICES = [
|
|
@@ -842,6 +872,36 @@ function deepClone(obj) {
|
|
|
842
872
|
return obj;
|
|
843
873
|
}
|
|
844
874
|
|
|
875
|
+
function cleanupPermissions(templatePermissions, userPermissions) {
|
|
876
|
+
const templateSet = new Set(templatePermissions);
|
|
877
|
+
const cleanedPermissions = userPermissions.filter((permission) => {
|
|
878
|
+
if (["mcp__.*", "mcp__*", "mcp__(*)"].includes(permission)) {
|
|
879
|
+
return false;
|
|
880
|
+
}
|
|
881
|
+
for (const templatePerm of templatePermissions) {
|
|
882
|
+
if (permission === templatePerm) {
|
|
883
|
+
continue;
|
|
884
|
+
}
|
|
885
|
+
if (permission.startsWith(templatePerm)) {
|
|
886
|
+
return false;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
return true;
|
|
890
|
+
});
|
|
891
|
+
const merged = [...templateSet];
|
|
892
|
+
for (const permission of cleanedPermissions) {
|
|
893
|
+
if (!templateSet.has(permission)) {
|
|
894
|
+
merged.push(permission);
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
return merged;
|
|
898
|
+
}
|
|
899
|
+
function mergeAndCleanPermissions(templatePermissions, userPermissions) {
|
|
900
|
+
const template = templatePermissions || [];
|
|
901
|
+
const user = userPermissions || [];
|
|
902
|
+
return cleanupPermissions(template, user);
|
|
903
|
+
}
|
|
904
|
+
|
|
845
905
|
function ensureClaudeDir() {
|
|
846
906
|
ensureDir(CLAUDE_DIR);
|
|
847
907
|
}
|
|
@@ -965,9 +1025,9 @@ function mergeSettingsFile(templatePath, targetPath) {
|
|
|
965
1025
|
});
|
|
966
1026
|
mergedSettings.env = mergedEnv;
|
|
967
1027
|
if (mergedSettings.permissions && mergedSettings.permissions.allow) {
|
|
968
|
-
mergedSettings.permissions.allow =
|
|
969
|
-
templateSettings.permissions?.allow
|
|
970
|
-
existingSettings.permissions?.allow
|
|
1028
|
+
mergedSettings.permissions.allow = mergeAndCleanPermissions(
|
|
1029
|
+
templateSettings.permissions?.allow,
|
|
1030
|
+
existingSettings.permissions?.allow
|
|
971
1031
|
);
|
|
972
1032
|
}
|
|
973
1033
|
writeJsonConfig(targetPath, mergedSettings);
|
|
@@ -1654,11 +1714,7 @@ async function init(options = {}) {
|
|
|
1654
1714
|
}
|
|
1655
1715
|
if (shouldConfigureMcp) {
|
|
1656
1716
|
if (isWindows()) {
|
|
1657
|
-
console.log(
|
|
1658
|
-
ansis.blue(
|
|
1659
|
-
`\u2139 ${scriptLang === "zh-CN" ? "\u68C0\u6D4B\u5230 Windows \u7CFB\u7EDF\uFF0C\u5C06\u81EA\u52A8\u914D\u7F6E\u517C\u5BB9\u683C\u5F0F" : "Windows detected, will configure compatible format"}`
|
|
1660
|
-
)
|
|
1661
|
-
);
|
|
1717
|
+
console.log(ansis.blue(`\u2139 ${I18N[scriptLang].windowsDetected}`));
|
|
1662
1718
|
}
|
|
1663
1719
|
const selectedServices = await selectMcpServices(scriptLang);
|
|
1664
1720
|
if (selectedServices === void 0) {
|
|
@@ -1719,4 +1775,82 @@ async function init(options = {}) {
|
|
|
1719
1775
|
}
|
|
1720
1776
|
}
|
|
1721
1777
|
|
|
1722
|
-
|
|
1778
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
1779
|
+
function getTemplateSettings() {
|
|
1780
|
+
const templatePath = join(__dirname, "../../templates/settings.json");
|
|
1781
|
+
const content = readFileSync(templatePath, "utf-8");
|
|
1782
|
+
return JSON.parse(content);
|
|
1783
|
+
}
|
|
1784
|
+
function loadCurrentSettings() {
|
|
1785
|
+
if (!existsSync(SETTINGS_FILE)) {
|
|
1786
|
+
return {};
|
|
1787
|
+
}
|
|
1788
|
+
try {
|
|
1789
|
+
const content = readFileSync(SETTINGS_FILE, "utf-8");
|
|
1790
|
+
return JSON.parse(content);
|
|
1791
|
+
} catch {
|
|
1792
|
+
return {};
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
function saveSettings(settings) {
|
|
1796
|
+
ensureDir(CLAUDE_DIR);
|
|
1797
|
+
writeFileSync(SETTINGS_FILE, JSON.stringify(settings, null, 2));
|
|
1798
|
+
}
|
|
1799
|
+
async function importRecommendedEnv() {
|
|
1800
|
+
const templateSettings = getTemplateSettings();
|
|
1801
|
+
const currentSettings = loadCurrentSettings();
|
|
1802
|
+
currentSettings.env = {
|
|
1803
|
+
...currentSettings.env,
|
|
1804
|
+
...templateSettings.env
|
|
1805
|
+
};
|
|
1806
|
+
saveSettings(currentSettings);
|
|
1807
|
+
}
|
|
1808
|
+
async function importRecommendedPermissions() {
|
|
1809
|
+
const templateSettings = getTemplateSettings();
|
|
1810
|
+
const currentSettings = loadCurrentSettings();
|
|
1811
|
+
if (templateSettings.permissions && templateSettings.permissions.allow) {
|
|
1812
|
+
currentSettings.permissions = {
|
|
1813
|
+
...templateSettings.permissions,
|
|
1814
|
+
allow: mergeAndCleanPermissions(
|
|
1815
|
+
templateSettings.permissions.allow,
|
|
1816
|
+
currentSettings.permissions?.allow
|
|
1817
|
+
)
|
|
1818
|
+
};
|
|
1819
|
+
} else {
|
|
1820
|
+
currentSettings.permissions = templateSettings.permissions;
|
|
1821
|
+
}
|
|
1822
|
+
saveSettings(currentSettings);
|
|
1823
|
+
}
|
|
1824
|
+
async function openSettingsJson() {
|
|
1825
|
+
ensureDir(CLAUDE_DIR);
|
|
1826
|
+
if (!existsSync(SETTINGS_FILE)) {
|
|
1827
|
+
saveSettings({});
|
|
1828
|
+
}
|
|
1829
|
+
const platform = getPlatform();
|
|
1830
|
+
let command;
|
|
1831
|
+
switch (platform) {
|
|
1832
|
+
case "macos":
|
|
1833
|
+
command = "open";
|
|
1834
|
+
break;
|
|
1835
|
+
case "windows":
|
|
1836
|
+
command = "start";
|
|
1837
|
+
break;
|
|
1838
|
+
default:
|
|
1839
|
+
command = "xdg-open";
|
|
1840
|
+
}
|
|
1841
|
+
try {
|
|
1842
|
+
await exec(command, [SETTINGS_FILE]);
|
|
1843
|
+
} catch (error) {
|
|
1844
|
+
try {
|
|
1845
|
+
await exec("code", [SETTINGS_FILE]);
|
|
1846
|
+
} catch {
|
|
1847
|
+
try {
|
|
1848
|
+
await exec("vim", [SETTINGS_FILE]);
|
|
1849
|
+
} catch {
|
|
1850
|
+
await exec("nano", [SETTINGS_FILE]);
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
export { AI_OUTPUT_LANGUAGES as A, mergeMcpServers as B, CLAUDE_DIR as C, buildMcpServerConfig as D, fixWindowsMcpConfig as E, addCompletedOnboarding as F, updateZcfConfig as G, readZcfConfig as H, I18N as I, resolveAiOutputLanguage as J, configureAiPersonality as K, LANG_LABELS as L, MCP_SERVICES as M, isWindows as N, selectMcpServices as O, formatApiKeyDisplay as P, modifyApiConfigPartially as Q, validateApiKey as R, SETTINGS_FILE as S, displayBanner as T, selectScriptLanguage as U, updatePromptOnly as V, version as W, handleExitPromptError as X, handleGeneralError as Y, ZCF_CONFIG_FILE as Z, displayBannerWithInfo as _, importRecommendedEnv as a, importRecommendedPermissions as b, commandExists as c, cleanupPermissions as d, CLAUDE_MD_FILE as e, ClAUDE_CONFIG_FILE as f, getPlatform as g, SUPPORTED_LANGS as h, init as i, isClaudeCodeInstalled as j, installClaudeCode as k, ensureClaudeDir as l, mergeAndCleanPermissions as m, backupExistingConfig as n, openSettingsJson as o, copyConfigFiles as p, configureApi as q, mergeConfigs as r, mergeSettingsFile as s, getExistingApiConfig as t, updateDefaultModel as u, applyAiLanguageDirective as v, getMcpConfigPath as w, readMcpConfig as x, writeMcpConfig as y, backupMcpConfig as z };
|
package/package.json
CHANGED
package/templates/en/rules.md
CHANGED
|
@@ -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
|
package/templates/settings.json
CHANGED
package/templates/zh-CN/rules.md
CHANGED
|
@@ -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
|
+
- **配置文档**:环境变量、配置项说明
|