@benbenwu/zcf 3.6.4

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.
Files changed (94) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +193 -0
  3. package/bin/zcf.mjs +2 -0
  4. package/dist/chunks/api-providers.mjs +137 -0
  5. package/dist/chunks/claude-code-config-manager.mjs +731 -0
  6. package/dist/chunks/claude-code-incremental-manager.mjs +601 -0
  7. package/dist/chunks/codex-config-switch.mjs +394 -0
  8. package/dist/chunks/codex-provider-manager.mjs +197 -0
  9. package/dist/chunks/codex-uninstaller.mjs +422 -0
  10. package/dist/chunks/commands.mjs +118 -0
  11. package/dist/chunks/features.mjs +632 -0
  12. package/dist/chunks/simple-config.mjs +7904 -0
  13. package/dist/cli.d.mts +1 -0
  14. package/dist/cli.d.ts +1 -0
  15. package/dist/cli.mjs +2013 -0
  16. package/dist/i18n/locales/en/api.json +53 -0
  17. package/dist/i18n/locales/en/ccr.json +65 -0
  18. package/dist/i18n/locales/en/cli.json +55 -0
  19. package/dist/i18n/locales/en/codex.json +123 -0
  20. package/dist/i18n/locales/en/cometix.json +29 -0
  21. package/dist/i18n/locales/en/common.json +20 -0
  22. package/dist/i18n/locales/en/configuration.json +85 -0
  23. package/dist/i18n/locales/en/errors.json +26 -0
  24. package/dist/i18n/locales/en/installation.json +80 -0
  25. package/dist/i18n/locales/en/language.json +19 -0
  26. package/dist/i18n/locales/en/mcp.json +24 -0
  27. package/dist/i18n/locales/en/menu.json +51 -0
  28. package/dist/i18n/locales/en/multi-config.json +79 -0
  29. package/dist/i18n/locales/en/tools.json +15 -0
  30. package/dist/i18n/locales/en/uninstall.json +56 -0
  31. package/dist/i18n/locales/en/updater.json +25 -0
  32. package/dist/i18n/locales/en/workflow.json +23 -0
  33. package/dist/i18n/locales/zh-CN/api.json +53 -0
  34. package/dist/i18n/locales/zh-CN/ccr.json +65 -0
  35. package/dist/i18n/locales/zh-CN/cli.json +55 -0
  36. package/dist/i18n/locales/zh-CN/codex.json +123 -0
  37. package/dist/i18n/locales/zh-CN/cometix.json +29 -0
  38. package/dist/i18n/locales/zh-CN/common.json +20 -0
  39. package/dist/i18n/locales/zh-CN/configuration.json +85 -0
  40. package/dist/i18n/locales/zh-CN/errors.json +26 -0
  41. package/dist/i18n/locales/zh-CN/installation.json +80 -0
  42. package/dist/i18n/locales/zh-CN/language.json +19 -0
  43. package/dist/i18n/locales/zh-CN/mcp.json +24 -0
  44. package/dist/i18n/locales/zh-CN/menu.json +51 -0
  45. package/dist/i18n/locales/zh-CN/multi-config.json +79 -0
  46. package/dist/i18n/locales/zh-CN/tools.json +15 -0
  47. package/dist/i18n/locales/zh-CN/uninstall.json +56 -0
  48. package/dist/i18n/locales/zh-CN/updater.json +25 -0
  49. package/dist/i18n/locales/zh-CN/workflow.json +23 -0
  50. package/dist/index.d.mts +324 -0
  51. package/dist/index.d.ts +324 -0
  52. package/dist/index.mjs +19 -0
  53. package/dist/shared/zcf.DGjQxTq_.mjs +34 -0
  54. package/package.json +117 -0
  55. package/templates/CLAUDE.md +221 -0
  56. package/templates/claude-code/CLAUDE.md +250 -0
  57. package/templates/claude-code/common/settings.json +48 -0
  58. package/templates/claude-code/en/workflow/bmad/commands/bmad-init.md +275 -0
  59. package/templates/claude-code/en/workflow/common/agents/get-current-datetime.md +29 -0
  60. package/templates/claude-code/en/workflow/common/agents/init-architect.md +114 -0
  61. package/templates/claude-code/en/workflow/common/commands/init-project.md +53 -0
  62. package/templates/claude-code/en/workflow/plan/agents/planner.md +116 -0
  63. package/templates/claude-code/en/workflow/plan/agents/ui-ux-designer.md +91 -0
  64. package/templates/claude-code/en/workflow/plan/commands/feat.md +105 -0
  65. package/templates/claude-code/zh-CN/workflow/bmad/commands/bmad-init.md +275 -0
  66. package/templates/claude-code/zh-CN/workflow/common/agents/get-current-datetime.md +29 -0
  67. package/templates/claude-code/zh-CN/workflow/common/agents/init-architect.md +114 -0
  68. package/templates/claude-code/zh-CN/workflow/common/commands/init-project.md +53 -0
  69. package/templates/claude-code/zh-CN/workflow/plan/agents/planner.md +116 -0
  70. package/templates/claude-code/zh-CN/workflow/plan/agents/ui-ux-designer.md +91 -0
  71. package/templates/claude-code/zh-CN/workflow/plan/commands/feat.md +105 -0
  72. package/templates/codex/common/config.toml +0 -0
  73. package/templates/common/output-styles/en/engineer-professional.md +88 -0
  74. package/templates/common/output-styles/en/laowang-engineer.md +127 -0
  75. package/templates/common/output-styles/en/leibus-engineer.md +251 -0
  76. package/templates/common/output-styles/en/nekomata-engineer.md +120 -0
  77. package/templates/common/output-styles/en/ojousama-engineer.md +121 -0
  78. package/templates/common/output-styles/en/rem-engineer.md +173 -0
  79. package/templates/common/output-styles/zh-CN/engineer-professional.md +89 -0
  80. package/templates/common/output-styles/zh-CN/laowang-engineer.md +127 -0
  81. package/templates/common/output-styles/zh-CN/leibus-engineer.md +251 -0
  82. package/templates/common/output-styles/zh-CN/nekomata-engineer.md +120 -0
  83. package/templates/common/output-styles/zh-CN/ojousama-engineer.md +121 -0
  84. package/templates/common/output-styles/zh-CN/rem-engineer.md +179 -0
  85. package/templates/common/workflow/git/en/git-cleanBranches.md +102 -0
  86. package/templates/common/workflow/git/en/git-commit.md +205 -0
  87. package/templates/common/workflow/git/en/git-rollback.md +90 -0
  88. package/templates/common/workflow/git/en/git-worktree.md +276 -0
  89. package/templates/common/workflow/git/zh-CN/git-cleanBranches.md +102 -0
  90. package/templates/common/workflow/git/zh-CN/git-commit.md +205 -0
  91. package/templates/common/workflow/git/zh-CN/git-rollback.md +90 -0
  92. package/templates/common/workflow/git/zh-CN/git-worktree.md +276 -0
  93. package/templates/common/workflow/sixStep/en/workflow.md +251 -0
  94. package/templates/common/workflow/sixStep/zh-CN/workflow.md +215 -0
@@ -0,0 +1,91 @@
1
+ ---
2
+
3
+ name: ui-ux-designer
4
+ description: Use this agent when you need UI/UX design guidance, Current Project UI Framework implementation advice, or visual design improvements for the desktop application interface. Examples: <example>Context: User wants to improve the layout of a chat interface component. user: "I want to improve the chat interface layout to make it more compliant with Current Project UI Framework standards" assistant: "I'll use the ui-ux-designer agent to provide Current Project UI Framework compliant layout recommendations for the chat interface" <commentary>Since the user is asking for UI/UX design improvements following Current Project UI Framework standards, use the ui-ux-designer agent to provide specific design guidance.</commentary></example> <example>Context: User is creating a new settings page and needs design guidance. user: "I need to design a better user experience for the settings page" assistant: "Let me use the ui-ux-designer agent to create a comprehensive UX design for the settings page" <commentary>The user needs UX design guidance for a settings page, so use the ui-ux-designer agent to provide detailed design recommendations.</commentary></example>
5
+ color: pink
6
+
7
+ ---
8
+
9
+ You are a professional UI/UX designer specializing in Current Project UI Framework principles and modern desktop application interfaces or WEB application interfaces. You have deep expertise in creating intuitive, accessible, and visually appealing user experiences for cross-platform desktop applications or WEB applications built using Current Project Technology Stack.
10
+
11
+ Your core responsibilities:
12
+
13
+ - Analyze existing UI components and pages, understand the current design system
14
+ - Provide specific design recommendations that comply with Current Project UI Framework standards
15
+ - Create detailed UI/UX specifications that developers can easily implement
16
+ - Consider the dual nature of applications (local controller + cloud node) in design
17
+ - Ensure designs work seamlessly across different screen sizes and desktop environments
18
+ - Prioritize user workflow efficiency and accessibility
19
+
20
+ When providing design guidance, you will:
21
+
22
+ 1. First analyze the current UI state and identify specific improvement opportunities
23
+ 2. Reference Current Project UI Framework components, design tokens, and patterns applicable to specific situations
24
+ 3. Provide clear, executable design specifications, including:
25
+ - Component hierarchy and layout structure
26
+ - Spacing, typography, and color recommendations using Current Project UI Framework design tokens
27
+ - Interaction states and appropriate micro-animations
28
+ - Accessibility considerations (contrast ratios, focus indicators, etc.)
29
+ 4. Create sufficiently detailed visual descriptions that developers can implement unambiguously
30
+ 5. Consider the technical constraints of Current Project Technology Stack
31
+ 6. Suggest specific Current Project UI Framework components and properties when applicable
32
+ 7. **Create ASCII layout sketches or detailed layout description diagrams** to intuitively demonstrate design solutions
33
+
34
+ Your design recommendations should always:
35
+
36
+ - Follow Current Project UI Framework principles (dynamic colors, improved accessibility, expressive themes)
37
+ - Maintain consistency with existing application patterns
38
+ - Optimize for desktop interaction modes (mouse, keyboard navigation)
39
+ - Consider WeChat integration context and user workflows
40
+ - Be implementable using Current Project Technology Stack
41
+ - Include rationale for design decisions
42
+
43
+ **Output Format Requirements:**
44
+ Your response must contain the following structure:
45
+
46
+ ```markdown
47
+ ## Design Analysis
48
+
49
+ [Analyze current state and improvement opportunities]
50
+
51
+ ## Layout Sketch
52
+ ```
53
+
54
+ ┌─────────────────────────────────────────────────┐
55
+ │ [Component Description] │
56
+ ├─────────────────────────────────────────────────┤
57
+ │ [Detailed ASCII layout diagram showing component positions and hierarchical relationships] │
58
+ │ │
59
+ └─────────────────────────────────────────────────┘
60
+
61
+ ```
62
+
63
+ ## Design Specifications
64
+
65
+ ### Component Hierarchy
66
+
67
+ [Detailed description of component nesting relationships and hierarchy]
68
+
69
+ ### Current Project UI Framework Specifications
70
+
71
+ - **Color Scheme**: [Specific color tokens and applications]
72
+ - **Typography System**: [Font sizes, line heights, font weight specifications]
73
+ - **Spacing System**: [Specific spacing values and application rules]
74
+ - **Component Specifications**: [Current Project UI Framework component selection and configuration]
75
+
76
+ ### Interaction Design
77
+
78
+ [Describe interaction states, animation effects, and user feedback]
79
+
80
+ ### Accessibility Considerations
81
+
82
+ [Contrast, focus management, keyboard navigation, etc.]
83
+
84
+ ### Responsive Design
85
+
86
+ [Layout adaptation for different window sizes]
87
+ ```
88
+
89
+ When describing UI layouts, use clear structured language and reference specific Current Project UI Framework components. Always consider light and dark theme implementation. Provide responsive behavior guidance for typical different window sizes in desktop applications.
90
+
91
+ **You are only responsible for providing design specifications and recommendations, not executing specific development tasks**. Your output will be integrated into project planning by upper-level agents.
@@ -0,0 +1,105 @@
1
+ ---
2
+ description: Add New Feature
3
+ ---
4
+
5
+ $ARGUMENTS
6
+
7
+ ## Core Workflow
8
+
9
+ ### 1. Input Analysis and Type Determination
10
+
11
+ When receiving user input, first perform type determination and clearly inform the user:
12
+
13
+ **Determination Criteria:**
14
+
15
+ - **Requirement Planning Type**: User proposes new feature requirements, project ideas, or needs to formulate plans
16
+
17
+ - **Discussion Iteration Type**: User requests to continue discussion, modify, or refine existing planning
18
+
19
+ - **Execution Implementation Type**: User confirms planning is complete and requests to start specific implementation work
20
+
21
+ ### 2. Classification Processing Mechanism
22
+
23
+ #### A. Requirement Planning Processing
24
+
25
+ **Trigger Condition**: Identified as functional requirement input
26
+
27
+ **Execution Actions**:
28
+
29
+ - Enable Planner Agent
30
+
31
+ - Generate detailed markdown planning document
32
+
33
+ - Store document in `./.claude/plan` directory, named in plan/xxx.md format
34
+
35
+ - Include: objective definition, feature breakdown, implementation steps, acceptance criteria
36
+
37
+ #### B. Discussion Iteration Processing
38
+
39
+ **Trigger Condition**: User requests to continue discussion or modify planning
40
+
41
+ **Execution Actions**:
42
+
43
+ - Retrieve and analyze previously generated planning files
44
+
45
+ - Identify user feedback and confirmation content
46
+
47
+ - Enable Planner Agent
48
+
49
+ - Generate detailed markdown planning document
50
+
51
+ - Create a new document, for example, if the last one was plan/xxx.md, then this time it's plan/xxx-1.md, if the last one was plan/xxx-1.md, then this time it's plan/xxx-2.md, and so on
52
+
53
+ - Reorganize pending implementation task priorities
54
+
55
+ #### C. Execution Implementation Processing
56
+
57
+ **Trigger Condition**: User confirms planning is complete and requests to start execution
58
+
59
+ **Execution Actions**:
60
+
61
+ - Start task execution in the order of planning documents
62
+
63
+ - Perform task type identification before each subtask begins
64
+
65
+ - **Frontend Task Special Processing**:
66
+
67
+ - Check if available UI design exists
68
+
69
+ - If no design solution exists, must use UI-UX-Designer Agent
70
+
71
+ - Complete UI design before proceeding with development implementation
72
+
73
+ ### 3. Key Execution Principles
74
+
75
+ #### Mandatory Response Requirements
76
+
77
+ - **Must first state in every interaction**: "I determine this operation type as: [specific type]"
78
+
79
+ - Type determination must be accurate and clearly communicated to users
80
+
81
+ #### Task Execution Standards
82
+
83
+ - Strictly execute according to documented planning
84
+
85
+ - Must clarify task nature and dependencies before subtask startup
86
+
87
+ - Frontend tasks must ensure UI design completeness
88
+
89
+ #### State Management Mechanism
90
+
91
+ - Maintain task completion status tracking
92
+
93
+ - Timely update planning document status
94
+
95
+ - Ensure user visibility of progress
96
+
97
+ ## Quality Assurance Points
98
+
99
+ 1. **Type Determination Accuracy**: Type identification at the beginning of each interaction must be accurate
100
+
101
+ 2. **Document Consistency**: Planning documents and actual execution remain synchronized
102
+
103
+ 3. **Dependency Management**: Pay special attention to UI design dependencies of frontend tasks
104
+
105
+ 4. **Transparent User Communication**: All judgments and actions must be clearly communicated to users
@@ -0,0 +1,275 @@
1
+ # /bmad-init 命令
2
+
3
+ 此命令在您的项目中初始化或更新 BMad-Method (V6)。
4
+
5
+ ## 当调用此命令时:
6
+
7
+ 1. 检查 `_bmad/` 目录是否存在,判断 BMad V6 是否已安装
8
+ 2. 检查是否存在旧版 V4 安装(`.bmad-core` 或 `.bmad-method` 目录)
9
+ 3. 新安装执行:`npx bmad-method install --directory . --modules bmm --tools claude-code --communication-language Chinese --document-output-language Chinese --yes`
10
+ 4. 已安装则执行:`npx bmad-method install --directory . --action quick-update --yes`
11
+ 5. 修复安装器 bug:将 `{output_folder}` 重命名为 `_bmad-output`(Beta 已知问题)
12
+ 6. 自动更新 `.gitignore`(移除 V4 条目,添加 V6 条目)
13
+ 7. 显示安装结果并提示用户后续操作
14
+
15
+ ## 实现
16
+
17
+ ```javascript
18
+ const { execSync } = require('node:child_process')
19
+ const fs = require('node:fs')
20
+ const path = require('node:path')
21
+
22
+ // 需要从 .gitignore 清理的旧条目
23
+ const LEGACY_GITIGNORE_ENTRIES = [
24
+ '.bmad-core',
25
+ '.bmad-method',
26
+ '.claude/commands/BMad',
27
+ '{output_folder}', // v6.0.0-Beta.8 bug 产物
28
+ ]
29
+
30
+ // V6 新版 .gitignore 条目
31
+ const V6_GITIGNORE_ENTRIES = [
32
+ '_bmad/',
33
+ '_bmad-output/',
34
+ ]
35
+
36
+ // 修复安装器 bug: {output_folder} 未解析为 _bmad-output (v6.0.0-Beta.8)
37
+ function fixOutputFolderBug(cwd) {
38
+ const buggyPath = path.join(cwd, '{output_folder}')
39
+ const correctPath = path.join(cwd, '_bmad-output')
40
+
41
+ if (!fs.existsSync(buggyPath)) return false
42
+
43
+ if (!fs.existsSync(correctPath)) {
44
+ // _bmad-output 不存在,直接重命名
45
+ fs.renameSync(buggyPath, correctPath)
46
+ console.log(' ✅ {output_folder} → _bmad-output/ (重命名)')
47
+ } else {
48
+ // _bmad-output 已存在,合并子目录后删除
49
+ const entries = fs.readdirSync(buggyPath, { withFileTypes: true })
50
+ for (const entry of entries) {
51
+ const src = path.join(buggyPath, entry.name)
52
+ const dest = path.join(correctPath, entry.name)
53
+ if (!fs.existsSync(dest)) {
54
+ fs.renameSync(src, dest)
55
+ console.log(` ✅ 移动 ${entry.name} → _bmad-output/`)
56
+ }
57
+ }
58
+ fs.rmSync(buggyPath, { recursive: true, force: true })
59
+ console.log(' ✅ 已删除多余的 {output_folder}/')
60
+ }
61
+ return true
62
+ }
63
+
64
+ function updateGitignore(cwd) {
65
+ const gitignorePath = path.join(cwd, '.gitignore')
66
+ let content = ''
67
+ let exists = false
68
+
69
+ if (fs.existsSync(gitignorePath)) {
70
+ content = fs.readFileSync(gitignorePath, 'utf8')
71
+ exists = true
72
+ }
73
+
74
+ const lines = content.split('\n')
75
+ let changed = false
76
+
77
+ // 移除 V4 旧条目
78
+ const filtered = lines.filter(line => {
79
+ const trimmed = line.trim()
80
+ const isLegacy = LEGACY_GITIGNORE_ENTRIES.some(entry =>
81
+ trimmed === entry || trimmed === entry + '/' || trimmed === '/' + entry
82
+ )
83
+ if (isLegacy) {
84
+ console.log(` 🗑️ 移除旧条目: ${trimmed}`)
85
+ changed = true
86
+ }
87
+ return !isLegacy
88
+ })
89
+
90
+ // 添加 V6 新条目
91
+ const newEntries = []
92
+ for (const entry of V6_GITIGNORE_ENTRIES) {
93
+ const entryBase = entry.replace(/\/$/, '')
94
+ const alreadyExists = filtered.some(line => {
95
+ const trimmed = line.trim()
96
+ return trimmed === entry || trimmed === entryBase || trimmed === '/' + entryBase
97
+ })
98
+ if (!alreadyExists) {
99
+ newEntries.push(entry)
100
+ console.log(` ✅ 添加新条目: ${entry}`)
101
+ changed = true
102
+ }
103
+ }
104
+
105
+ if (!changed) {
106
+ console.log(' ℹ️ .gitignore 已是最新,无需更新')
107
+ return
108
+ }
109
+
110
+ // 构建新内容
111
+ let result = filtered.join('\n')
112
+
113
+ if (newEntries.length > 0) {
114
+ // 确保末尾有换行,然后添加 BMad 区块
115
+ if (result.length > 0 && !result.endsWith('\n')) {
116
+ result += '\n'
117
+ }
118
+ result += '\n# BMad Method V6\n'
119
+ result += newEntries.join('\n') + '\n'
120
+ }
121
+
122
+ fs.writeFileSync(gitignorePath, result, 'utf8')
123
+ console.log(` 📝 .gitignore 已${exists ? '更新' : '创建'}`)
124
+ }
125
+
126
+ async function initBmad() {
127
+ const cwd = process.cwd()
128
+ const bmadV6Path = path.join(cwd, '_bmad')
129
+ const legacyCorePath = path.join(cwd, '.bmad-core')
130
+ const legacyMethodPath = path.join(cwd, '.bmad-method')
131
+
132
+ // 检查旧版 V4 安装
133
+ const hasLegacyCore = fs.existsSync(legacyCorePath)
134
+ const hasLegacyMethod = fs.existsSync(legacyMethodPath)
135
+
136
+ if (hasLegacyCore || hasLegacyMethod) {
137
+ console.log('⚠️ 检测到旧版 BMad V4 安装:')
138
+ if (hasLegacyCore) console.log(' • .bmad-core/ (V4 核心目录)')
139
+ if (hasLegacyMethod) console.log(' • .bmad-method/ (V4 方法目录)')
140
+ console.log('')
141
+ console.log('📌 V6 安装器会自动处理旧版迁移,请在安装过程中按提示操作。')
142
+ console.log(' 详情参考:https://bmad-code-org.github.io/BMAD-METHOD/docs/how-to/upgrade-to-v6')
143
+ console.log('')
144
+ }
145
+
146
+ // 检查 V6 是否已安装
147
+ const hasV6 = fs.existsSync(bmadV6Path)
148
+
149
+ // 构建非交互式安装命令
150
+ let installCmd
151
+ if (hasV6) {
152
+ console.log('🔄 检测到已有 BMad V6 安装,将执行快速更新...')
153
+ console.log('')
154
+ installCmd = [
155
+ 'npx bmad-method install',
156
+ '--directory .',
157
+ '--action quick-update',
158
+ '--yes',
159
+ ].join(' ')
160
+ } else {
161
+ console.log('🚀 正在初始化 BMad-Method V6...')
162
+ console.log('')
163
+ installCmd = [
164
+ 'npx bmad-method install',
165
+ '--directory .',
166
+ '--modules bmm',
167
+ '--tools claude-code',
168
+ '--communication-language Chinese',
169
+ '--document-output-language Chinese',
170
+ '--yes',
171
+ ].join(' ')
172
+ }
173
+
174
+ // 执行安装
175
+ try {
176
+ console.log(`📋 执行: ${installCmd}`)
177
+ console.log('')
178
+ execSync(installCmd, {
179
+ stdio: 'inherit',
180
+ cwd: cwd,
181
+ shell: true
182
+ })
183
+
184
+ console.log('')
185
+ console.log('✅ BMad-Method V6 安装/更新完成!')
186
+ console.log('')
187
+ console.log('═══════════════════════════════════════════════════════════════')
188
+ console.log('📌 重要提示:请重启 AI IDE 以加载 BMad 扩展')
189
+ console.log('═══════════════════════════════════════════════════════════════')
190
+ console.log('')
191
+ // 修复 {output_folder} bug (v6.0.0-Beta.8)
192
+ console.log('🔧 检查安装器已知问题...')
193
+ try {
194
+ const fixed = fixOutputFolderBug(cwd)
195
+ if (!fixed) console.log(' ℹ️ 无需修复')
196
+ } catch (err) {
197
+ console.log(` ⚠️ 修复 {output_folder} 失败: ${err.message}`)
198
+ console.log(' 请手动将 {output_folder}/ 重命名为 _bmad-output/')
199
+ }
200
+ console.log('')
201
+
202
+ console.log('📂 V6 目录结构:')
203
+ console.log(' • _bmad/ — agents、workflows、tasks 和配置')
204
+ console.log(' • _bmad-output/ — 生成的工件输出目录')
205
+ console.log('')
206
+
207
+ // 自动更新 .gitignore
208
+ console.log('🔧 更新 .gitignore...')
209
+ try {
210
+ updateGitignore(cwd)
211
+ } catch (err) {
212
+ console.log(' ⚠️ 自动更新 .gitignore 失败,请手动添加 _bmad/ 和 _bmad-output/')
213
+ }
214
+ console.log('')
215
+ console.log('🚀 快速开始:')
216
+ console.log(' 1. 重启 AI IDE')
217
+ console.log(' 2. 运行 /bmad-help 获取引导和下一步建议')
218
+ console.log(' 3. 输入 /bmad 并使用自动补全浏览可用命令')
219
+ console.log('')
220
+ console.log('💡 常用工作流:')
221
+ console.log(' • /bmad-help — 交互式帮助')
222
+ console.log(' • /bmad-bmm-create-prd — 创建产品需求文档')
223
+ console.log(' • /bmad-bmm-create-architecture — 创建架构文档')
224
+ console.log(' • /bmad-bmm-create-epics-and-stories — 创建史诗和用户故事')
225
+ console.log(' • /bmad-bmm-sprint-planning — 初始化 Sprint 计划')
226
+ console.log(' • /bmad-bmm-dev-story — 实现用户故事')
227
+
228
+ // 清理旧版 V4 IDE 命令提醒
229
+ const legacyClaudeAgents = path.join(cwd, '.claude', 'commands', 'BMad', 'agents')
230
+ const legacyClaudeTasks = path.join(cwd, '.claude', 'commands', 'BMad', 'tasks')
231
+ if (fs.existsSync(legacyClaudeAgents) || fs.existsSync(legacyClaudeTasks)) {
232
+ console.log('')
233
+ console.log('⚠️ 检测到旧版 V4 IDE 命令,建议手动删除:')
234
+ if (fs.existsSync(legacyClaudeAgents)) console.log(' • .claude/commands/BMad/agents/')
235
+ if (fs.existsSync(legacyClaudeTasks)) console.log(' • .claude/commands/BMad/tasks/')
236
+ console.log(' 新的 V6 命令已安装在 .claude/commands/bmad/ 下')
237
+ }
238
+ }
239
+ catch (error) {
240
+ console.error('❌ 安装失败:', error.message)
241
+ console.log('')
242
+ console.log('🛠️ 手动安装指南:')
243
+ console.log(' 1. 确保已安装 Node.js 20+')
244
+ console.log(' 2. 非交互式安装:')
245
+ console.log(' npx bmad-method install --directory . --modules bmm --tools claude-code --communication-language Chinese --document-output-language Chinese --yes')
246
+ console.log(' 3. 快速更新已有安装:')
247
+ console.log(' npx bmad-method install --directory . --action quick-update --yes')
248
+ console.log(' 4. 或交互式安装:')
249
+ console.log(' npx bmad-method install')
250
+ console.log('')
251
+ console.log('📖 详细文档:')
252
+ console.log(' https://bmad-code-org.github.io/BMAD-METHOD/docs/how-to/install-bmad')
253
+ }
254
+ }
255
+
256
+ // 执行初始化
257
+ initBmad()
258
+ ```
259
+
260
+ ## 用法
261
+
262
+ 只需在 Claude Code 中键入:
263
+
264
+ ```
265
+ /bmad-init
266
+ ```
267
+
268
+ 此命令将:
269
+
270
+ 1. 检测现有安装状态(V6 / V4 旧版 / 未安装)
271
+ 2. 新安装:`npx bmad-method install --directory . --modules bmm --tools claude-code --communication-language Chinese --document-output-language Chinese --yes`
272
+ 3. 已安装:`npx bmad-method install --directory . --action quick-update --yes`
273
+ 4. 修复 `{output_folder}` → `_bmad-output` 安装器 bug
274
+ 5. 自动更新 `.gitignore`(清理旧条目,添加 V6 条目)
275
+ 6. 提供后续步骤建议
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: get-current-datetime
3
+ description: 执行日期命令并仅返回原始输出。不添加格式、标题、说明或并行代理。
4
+ tools: Bash, Read, Write
5
+ color: cyan
6
+ ---
7
+
8
+ 执行 `date` 命令并仅返回原始输出。
9
+
10
+ ```bash
11
+ date +'%Y-%m-%d %H:%M:%S'
12
+ ```
13
+
14
+ 不添加任何文本、标题、格式或说明。
15
+ 不添加 markdown 格式或代码块。
16
+ 不添加"当前日期和时间是:"或类似短语。
17
+ 不使用并行代理。
18
+
19
+ 只返回原始 bash 命令输出,完全按其显示的样子。
20
+
21
+ 示例响应:`2025-07-28 23:59:42`
22
+
23
+ 如果需要特定格式选项:
24
+
25
+ - 文件名格式:添加 `+"%Y-%m-%d_%H%M%S"`
26
+ - 可读格式:添加 `+"%Y-%m-%d %H:%M:%S %Z"`
27
+ - ISO 格式:添加 `+"%Y-%m-%dT%H:%M:%S%z"`
28
+
29
+ 使用 get-current-datetime 代理来获取准确的时间戳,而不是手动编写时间信息。
@@ -0,0 +1,114 @@
1
+ ---
2
+ name: init-architect
3
+ description: 自适应初始化:根级简明 + 模块级详尽;分阶段遍历并回报覆盖率
4
+ tools: Read, Write, Glob, Grep
5
+ color: orange
6
+ ---
7
+
8
+ # 初始化架构师(自适应版)
9
+
10
+ > 不暴露参数;内部自适应三档:快速摘要 / 模块扫描 / 深度补捞。保证每次运行可增量更新、可续跑,并输出覆盖率报告与下一步建议。
11
+
12
+ ## 一、通用约束
13
+
14
+ - 不修改源代码;仅生成/更新文档与 `.claude/index.json`。
15
+ - **忽略规则获取策略**:
16
+ 1. 优先读取项目根目录的 `.gitignore` 文件
17
+ 2. 如果 `.gitignore` 不存在,则使用以下默认忽略规则:`node_modules/**,.git/**,.github/**,dist/**,build/**,.next/**,__pycache__/**,*.lock,*.log,*.bin,*.pdf,*.png,*.jpg,*.jpeg,*.gif,*.mp4,*.zip,*.tar,*.gz`
18
+ 3. 将 `.gitignore` 中的忽略模式与默认规则合并使用
19
+ - 对大文件/二进制只记录路径,不读内容。
20
+
21
+ ## 二、分阶段策略(自动选择强度)
22
+
23
+ 1. **阶段 A:全仓清点(轻量)**
24
+ - 以多次 `Glob` 分批获取文件清单(避免单次超限),做:
25
+ - 文件计数、语言占比、目录拓扑、模块候选发现(package.json、pyproject.toml、go.mod、Cargo.toml、apps/_、packages/_、services/_、cmd/_ 等)。
26
+ - 生成 `模块候选列表`,为每个候选模块标注:语言、入口文件猜测、测试目录是否存在、配置文件是否存在。
27
+ 2. **阶段 B:模块优先扫描(中等)**
28
+ - 对每个模块,按以下顺序尝试读取(分批、分页):
29
+ - 入口与启动:`main.ts`/`index.ts`/`cmd/*/main.go`/`app.py`/`src/main.rs` 等
30
+ - 对外接口:路由、控制器、API 定义、proto/openapi
31
+ - 依赖与脚本:`package.json scripts`、`pyproject.toml`、`go.mod`、`Cargo.toml`、配置目录
32
+ - 数据层:`schema.sql`、`prisma/schema.prisma`、ORM 模型、迁移目录
33
+ - 测试:`tests/**`、`__tests__/**`、`*_test.go`、`*.spec.ts` 等
34
+ - 质量工具:`eslint/ruff/golangci` 等配置
35
+ - 形成"模块快照",只抽取高信号片段与路径,不粘贴大段代码。
36
+ 3. **阶段 C:深度补捞(按需触发)**
37
+ - 触发条件(满足其一即可):
38
+ - 仓库整体较小(文件数较少)或单模块文件数较少;
39
+ - 阶段 B 后仍无法判断关键接口/数据模型/测试策略;
40
+ - 根或模块 `CLAUDE.md` 缺信息项。
41
+ - 动作:对目标目录**追加分页读取**,补齐缺项。
42
+
43
+ > 注:如果分页/次数达到工具或时间上限,必须**提前写出部分结果**并在摘要中说明"到此为止的原因"和"下一步建议扫描的目录列表"。
44
+
45
+ ## 三、产物与增量更新
46
+
47
+ 1. **写入根级 `CLAUDE.md`**
48
+ - 如果已存在,则在顶部插入/更新 `变更记录 (Changelog)`。
49
+ - 根级结构(精简而全局):
50
+ - 项目愿景
51
+ - 架构总览
52
+ - **✨ 新增:模块结构图(Mermaid)**
53
+ - 在"模块索引"表格**上方**,根据识别出的模块路径,生成一个 Mermaid `graph TD` 树形图。
54
+ - 每个节点应可点击,并链接到对应模块的 `CLAUDE.md` 文件。
55
+ - 示例语法:
56
+
57
+ ```mermaid
58
+ graph TD
59
+ A["(根) 我的项目"] --> B["packages"];
60
+ B --> C["auth"];
61
+ B --> D["ui-library"];
62
+ A --> E["services"];
63
+ E --> F["audit-log"];
64
+
65
+ click C "./packages/auth/CLAUDE.md" "查看 auth 模块文档"
66
+ click D "./packages/ui-library/CLAUDE.md" "查看 ui-library 模块文档"
67
+ click F "./services/audit-log/CLAUDE.md" "查看 audit-log 模块文档"
68
+ ```
69
+
70
+ - 模块索引(表格形式)
71
+ - 运行与开发
72
+ - 测试策略
73
+ - 编码规范
74
+ - AI 使用指引
75
+ - 变更记录 (Changelog)
76
+
77
+ 2. **写入模块级 `CLAUDE.md`**
78
+ - 放在每个模块目录下,结构建议:
79
+ - **✨ 新增:相对路径面包屑**
80
+ - 在每个模块 `CLAUDE.md` 的**最顶部**,插入一行相对路径面包屑,链接到各级父目录及根 `CLAUDE.md`。
81
+ - 示例(位于 `packages/auth/CLAUDE.md`):
82
+ `[根目录](../../CLAUDE.md) > [packages](../) > **auth**`
83
+ - 模块职责
84
+ - 入口与启动
85
+ - 对外接口
86
+ - 关键依赖与配置
87
+ - 数据模型
88
+ - 测试与质量
89
+ - 常见问题 (FAQ)
90
+ - 相关文件清单
91
+ - 变更记录 (Changelog)
92
+ 3. **`.claude/index.json`**
93
+ - 记录:当前时间戳(通过参数提供)、根/模块列表、每个模块的入口/接口/测试/重要路径、**扫描覆盖率**、忽略统计、是否因上限被截断(`truncated: true`)。
94
+
95
+ ## 四、覆盖率与可续跑
96
+
97
+ - 每次运行都计算并打印:
98
+ - 估算总文件数、已扫描文件数、覆盖百分比;
99
+ - 每个模块的覆盖摘要与缺口(缺接口、缺测试、缺数据模型等);
100
+ - 被忽略/跳过的 Top 目录与原因(忽略规则/大文件/时间或调用上限)。
101
+ - 将"缺口清单"写入 `index.json`,下次运行时优先补齐缺口(**断点续扫**)。
102
+
103
+ ## 五、结果摘要(打印到主对话)
104
+
105
+ - 根/模块 `CLAUDE.md` 新建或更新状态;
106
+ - 模块列表(路径+一句话职责);
107
+ - 覆盖率与主要缺口;
108
+ - 若未读全:说明"为何到此为止",并列出**推荐的下一步**(例如"建议优先补扫:packages/auth/src/controllers、services/audit/migrations")。
109
+
110
+ ## 六、时间格式与使用
111
+
112
+ - 路径使用相对路径;
113
+ - 时间信息:使用通过命令参数提供的时间戳,并在 `index.json` 中写入 ISO-8601 格式。
114
+ - 不要手动编写时间信息,使用提供的时间戳参数确保时间准确性。
@@ -0,0 +1,53 @@
1
+ ---
2
+ description: 初始化项目 AI 上下文,生成/更新根级与模块级 CLAUDE.md 索引
3
+ allowed-tools: Read(**), Write(CLAUDE.md, **/CLAUDE.md)
4
+ argument-hint: <项目摘要或名称>
5
+ ---
6
+
7
+ ## 用法
8
+
9
+ `/init-project <项目摘要或名称>`
10
+
11
+ ## 目标
12
+
13
+ 以"根级简明 + 模块级详尽"的混合策略初始化项目 AI 上下文:
14
+
15
+ - 在仓库根生成/更新 `CLAUDE.md`(高层愿景、架构总览、模块索引、全局规范)。
16
+ - 在识别的各模块目录生成/更新本地 `CLAUDE.md`(接口、依赖、入口、测试、关键文件等)。
17
+ - ✨ **为了提升可读性,会在根 `CLAUDE.md` 中自动生成 Mermaid 结构图,并为每个模块 `CLAUDE.md` 添加导航面包屑**。
18
+
19
+ ## 编排说明
20
+
21
+ **步骤 1**:调用 `get-current-datetime` 子智能体获取当前时间戳。
22
+
23
+ **步骤 2**:调用一次 `init-architect` 子智能体,输入:
24
+
25
+ - `project_summary`: $ARGUMENTS
26
+ - `current_timestamp`: (来自步骤1的时间戳)
27
+
28
+ ## 执行策略(由 Agent 自适应决定,不需要用户传参)
29
+
30
+ - **阶段 A:全仓清点(轻量)**
31
+ 快速统计文件与目录,识别模块根(package.json、pyproject.toml、go.mod、apps/_、packages/_、services/\* 等)。
32
+ - **阶段 B:模块优先扫描(中等)**
33
+ 对每个模块做"入口/接口/依赖/测试/数据模型/质量工具"的定点读取与样本抽取。
34
+ - **阶段 C:深度补捞(按需)**
35
+ 若仓库较小或模块规模较小,则扩大读取面;若较大,则对高风险/高价值路径分批追加扫描。
36
+ - **覆盖率度量与可续跑**
37
+ 输出"已扫描文件数 / 估算总文件数、已覆盖模块占比、被忽略/跳过原因",并列出"建议下一步深挖的子路径"。重复运行 `/init-project` 时按上次索引做**增量更新**与**断点续扫**。
38
+
39
+ ## 安全与边界
40
+
41
+ - 只读/写文档与索引,不改源代码。
42
+ - 默认忽略常见生成物与二进制大文件。
43
+ - 结果在主对话打印"摘要",全文写入仓库。
44
+
45
+ ## 输出要求
46
+
47
+ - 在主对话中打印"初始化结果摘要",包含:
48
+ - 根级 `CLAUDE.md` 是否创建/更新、主要栏目概览。
49
+ - 识别的模块数量及其路径列表。
50
+ - 每个模块 `CLAUDE.md` 的生成/更新情况。
51
+ - ✨ **明确提及"已生成 Mermaid 结构图"和"已为 N 个模块添加导航面包屑"**。
52
+ - 覆盖率与主要缺口。
53
+ - 若未读全:说明"为何到此为止",并列出**推荐的下一步**(例如"建议优先补扫:packages/auth/src/controllers")。