zcf 2.1.2 → 2.2.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/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.
|
|
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';
|
|
5
5
|
import inquirer from 'inquirer';
|
|
6
6
|
import { existsSync, unlinkSync } from 'node:fs';
|
|
7
7
|
import 'node:os';
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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.
|
|
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';
|
|
2
2
|
import 'inquirer';
|
|
3
3
|
import 'ansis';
|
|
4
4
|
import 'node:fs';
|
|
@@ -7,7 +7,7 @@ import dayjs from 'dayjs';
|
|
|
7
7
|
import { fileURLToPath } from 'node:url';
|
|
8
8
|
import { exec } from 'tinyexec';
|
|
9
9
|
|
|
10
|
-
const version = "2.
|
|
10
|
+
const version = "2.2.0";
|
|
11
11
|
const homepage = "https://github.com/UfoMiao/zcf";
|
|
12
12
|
|
|
13
13
|
const CLAUDE_DIR = join(homedir(), ".claude");
|
package/package.json
CHANGED
package/templates/CLAUDE.md
CHANGED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Technical Execution Guidelines
|
|
2
|
+
|
|
3
|
+
This document provides best practices that Claude Code should follow when executing specific technical tasks.
|
|
4
|
+
|
|
5
|
+
## Command Execution Best Practices
|
|
6
|
+
|
|
7
|
+
### Path Handling Standards
|
|
8
|
+
|
|
9
|
+
**Important**: Always use double quotes to wrap file paths when executing commands on all operating systems, especially on Windows.
|
|
10
|
+
|
|
11
|
+
#### Correct Examples
|
|
12
|
+
```bash
|
|
13
|
+
# ✅ Correct: Paths wrapped in double quotes
|
|
14
|
+
cd "C:\Users\name\My Documents"
|
|
15
|
+
python "C:\Program Files\MyApp\script.py"
|
|
16
|
+
node "/path/with spaces/app.js"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
#### Incorrect Examples
|
|
20
|
+
```bash
|
|
21
|
+
# ❌ Incorrect: No quotes, backslashes will be swallowed on Windows
|
|
22
|
+
cd C:\Users\name\My Documents
|
|
23
|
+
python C:\Program Files\MyApp\script.py
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Cross-Platform Compatibility
|
|
27
|
+
|
|
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
|
|
31
|
+
|
|
32
|
+
## Search Tool Usage Guidelines
|
|
33
|
+
|
|
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
|
+
```bash
|
|
50
|
+
# ✅ Prefer rg
|
|
51
|
+
rg "search pattern" .
|
|
52
|
+
rg -i "case insensitive" src/
|
|
53
|
+
rg -t js "console.log" .
|
|
54
|
+
|
|
55
|
+
# ⚠️ Only use grep when rg is unavailable
|
|
56
|
+
grep -r "pattern" .
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### File Finding
|
|
60
|
+
- Use Glob tool for filename pattern matching
|
|
61
|
+
- Use LS tool for directory listings
|
|
62
|
+
- Avoid using `find` command (specialized tools are more efficient)
|
|
63
|
+
|
|
64
|
+
## Tool Usage Principles
|
|
65
|
+
|
|
66
|
+
1. **Prefer Specialized Tools**: Use Read, Write, Edit tools instead of cat, echo commands
|
|
67
|
+
2. **Batch Operations**: Call multiple tools simultaneously for efficiency
|
|
68
|
+
3. **Error Handling**: Check for path quoting issues first when commands fail
|
|
69
|
+
|
|
70
|
+
## Performance Optimization Tips
|
|
71
|
+
|
|
72
|
+
- 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
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# 技术执行指南
|
|
2
|
+
|
|
3
|
+
本文档提供 Claude Code 在执行具体技术任务时应遵循的最佳实践。
|
|
4
|
+
|
|
5
|
+
## 命令执行最佳实践
|
|
6
|
+
|
|
7
|
+
### 路径处理规范
|
|
8
|
+
|
|
9
|
+
**重要**:在所有操作系统上执行命令时,**始终使用双引号包裹文件路径**,特别是在 Windows 系统上。
|
|
10
|
+
|
|
11
|
+
#### 正确示例
|
|
12
|
+
```bash
|
|
13
|
+
# ✅ 正确:路径使用双引号
|
|
14
|
+
cd "C:\Users\name\My Documents"
|
|
15
|
+
python "C:\Program Files\MyApp\script.py"
|
|
16
|
+
node "/path/with spaces/app.js"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
#### 错误示例
|
|
20
|
+
```bash
|
|
21
|
+
# ❌ 错误:未使用引号,Windows 下反斜杠会被吞掉
|
|
22
|
+
cd C:\Users\name\My Documents
|
|
23
|
+
python C:\Program Files\MyApp\script.py
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 跨平台兼容性
|
|
27
|
+
|
|
28
|
+
- 优先使用正斜杠 `/` 作为路径分隔符(大多数工具都支持)
|
|
29
|
+
- 当必须使用反斜杠时,确保路径被双引号包裹
|
|
30
|
+
- 使用相对路径时也要注意空格和特殊字符
|
|
31
|
+
|
|
32
|
+
## 搜索工具使用指南
|
|
33
|
+
|
|
34
|
+
### 内容搜索优先级
|
|
35
|
+
|
|
36
|
+
**始终优先使用 `rg` (ripgrep) 进行文件内容搜索**,而不是 `grep`。
|
|
37
|
+
|
|
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
|
+
```bash
|
|
50
|
+
# ✅ 优先使用 rg
|
|
51
|
+
rg "search pattern" .
|
|
52
|
+
rg -i "case insensitive" src/
|
|
53
|
+
rg -t js "console.log" .
|
|
54
|
+
|
|
55
|
+
# ⚠️ 仅在 rg 不可用时才使用 grep
|
|
56
|
+
grep -r "pattern" .
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 文件查找
|
|
60
|
+
- 使用 Glob 工具查找文件名模式
|
|
61
|
+
- 使用 LS 工具列出目录内容
|
|
62
|
+
- 避免使用 `find` 命令(使用专门的工具更高效)
|
|
63
|
+
|
|
64
|
+
## 工具使用原则
|
|
65
|
+
|
|
66
|
+
1. **优先使用专门的工具**:使用 Read、Write、Edit 等专门工具,而不是 cat、echo 等命令
|
|
67
|
+
2. **批量操作**:可以同时调用多个工具以提高效率
|
|
68
|
+
3. **错误处理**:命令失败后,先检查路径引号问题再重试
|
|
69
|
+
|
|
70
|
+
## 性能优化建议
|
|
71
|
+
|
|
72
|
+
- 对于大型项目,使用 Task 工具进行复杂搜索
|
|
73
|
+
- 搜索前先了解项目结构,缩小搜索范围
|
|
74
|
+
- 合理使用搜索参数(如文件类型过滤)以提高效率
|