@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.
- package/LICENSE +21 -0
- package/README.md +193 -0
- package/bin/zcf.mjs +2 -0
- package/dist/chunks/api-providers.mjs +137 -0
- package/dist/chunks/claude-code-config-manager.mjs +731 -0
- package/dist/chunks/claude-code-incremental-manager.mjs +601 -0
- package/dist/chunks/codex-config-switch.mjs +394 -0
- package/dist/chunks/codex-provider-manager.mjs +197 -0
- package/dist/chunks/codex-uninstaller.mjs +422 -0
- package/dist/chunks/commands.mjs +118 -0
- package/dist/chunks/features.mjs +632 -0
- package/dist/chunks/simple-config.mjs +7904 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.mjs +2013 -0
- package/dist/i18n/locales/en/api.json +53 -0
- package/dist/i18n/locales/en/ccr.json +65 -0
- package/dist/i18n/locales/en/cli.json +55 -0
- package/dist/i18n/locales/en/codex.json +123 -0
- package/dist/i18n/locales/en/cometix.json +29 -0
- package/dist/i18n/locales/en/common.json +20 -0
- package/dist/i18n/locales/en/configuration.json +85 -0
- package/dist/i18n/locales/en/errors.json +26 -0
- package/dist/i18n/locales/en/installation.json +80 -0
- package/dist/i18n/locales/en/language.json +19 -0
- package/dist/i18n/locales/en/mcp.json +24 -0
- package/dist/i18n/locales/en/menu.json +51 -0
- package/dist/i18n/locales/en/multi-config.json +79 -0
- package/dist/i18n/locales/en/tools.json +15 -0
- package/dist/i18n/locales/en/uninstall.json +56 -0
- package/dist/i18n/locales/en/updater.json +25 -0
- package/dist/i18n/locales/en/workflow.json +23 -0
- package/dist/i18n/locales/zh-CN/api.json +53 -0
- package/dist/i18n/locales/zh-CN/ccr.json +65 -0
- package/dist/i18n/locales/zh-CN/cli.json +55 -0
- package/dist/i18n/locales/zh-CN/codex.json +123 -0
- package/dist/i18n/locales/zh-CN/cometix.json +29 -0
- package/dist/i18n/locales/zh-CN/common.json +20 -0
- package/dist/i18n/locales/zh-CN/configuration.json +85 -0
- package/dist/i18n/locales/zh-CN/errors.json +26 -0
- package/dist/i18n/locales/zh-CN/installation.json +80 -0
- package/dist/i18n/locales/zh-CN/language.json +19 -0
- package/dist/i18n/locales/zh-CN/mcp.json +24 -0
- package/dist/i18n/locales/zh-CN/menu.json +51 -0
- package/dist/i18n/locales/zh-CN/multi-config.json +79 -0
- package/dist/i18n/locales/zh-CN/tools.json +15 -0
- package/dist/i18n/locales/zh-CN/uninstall.json +56 -0
- package/dist/i18n/locales/zh-CN/updater.json +25 -0
- package/dist/i18n/locales/zh-CN/workflow.json +23 -0
- package/dist/index.d.mts +324 -0
- package/dist/index.d.ts +324 -0
- package/dist/index.mjs +19 -0
- package/dist/shared/zcf.DGjQxTq_.mjs +34 -0
- package/package.json +117 -0
- package/templates/CLAUDE.md +221 -0
- package/templates/claude-code/CLAUDE.md +250 -0
- package/templates/claude-code/common/settings.json +48 -0
- package/templates/claude-code/en/workflow/bmad/commands/bmad-init.md +275 -0
- package/templates/claude-code/en/workflow/common/agents/get-current-datetime.md +29 -0
- package/templates/claude-code/en/workflow/common/agents/init-architect.md +114 -0
- package/templates/claude-code/en/workflow/common/commands/init-project.md +53 -0
- package/templates/claude-code/en/workflow/plan/agents/planner.md +116 -0
- package/templates/claude-code/en/workflow/plan/agents/ui-ux-designer.md +91 -0
- package/templates/claude-code/en/workflow/plan/commands/feat.md +105 -0
- package/templates/claude-code/zh-CN/workflow/bmad/commands/bmad-init.md +275 -0
- package/templates/claude-code/zh-CN/workflow/common/agents/get-current-datetime.md +29 -0
- package/templates/claude-code/zh-CN/workflow/common/agents/init-architect.md +114 -0
- package/templates/claude-code/zh-CN/workflow/common/commands/init-project.md +53 -0
- package/templates/claude-code/zh-CN/workflow/plan/agents/planner.md +116 -0
- package/templates/claude-code/zh-CN/workflow/plan/agents/ui-ux-designer.md +91 -0
- package/templates/claude-code/zh-CN/workflow/plan/commands/feat.md +105 -0
- package/templates/codex/common/config.toml +0 -0
- package/templates/common/output-styles/en/engineer-professional.md +88 -0
- package/templates/common/output-styles/en/laowang-engineer.md +127 -0
- package/templates/common/output-styles/en/leibus-engineer.md +251 -0
- package/templates/common/output-styles/en/nekomata-engineer.md +120 -0
- package/templates/common/output-styles/en/ojousama-engineer.md +121 -0
- package/templates/common/output-styles/en/rem-engineer.md +173 -0
- package/templates/common/output-styles/zh-CN/engineer-professional.md +89 -0
- package/templates/common/output-styles/zh-CN/laowang-engineer.md +127 -0
- package/templates/common/output-styles/zh-CN/leibus-engineer.md +251 -0
- package/templates/common/output-styles/zh-CN/nekomata-engineer.md +120 -0
- package/templates/common/output-styles/zh-CN/ojousama-engineer.md +121 -0
- package/templates/common/output-styles/zh-CN/rem-engineer.md +179 -0
- package/templates/common/workflow/git/en/git-cleanBranches.md +102 -0
- package/templates/common/workflow/git/en/git-commit.md +205 -0
- package/templates/common/workflow/git/en/git-rollback.md +90 -0
- package/templates/common/workflow/git/en/git-worktree.md +276 -0
- package/templates/common/workflow/git/zh-CN/git-cleanBranches.md +102 -0
- package/templates/common/workflow/git/zh-CN/git-commit.md +205 -0
- package/templates/common/workflow/git/zh-CN/git-rollback.md +90 -0
- package/templates/common/workflow/git/zh-CN/git-worktree.md +276 -0
- package/templates/common/workflow/sixStep/en/workflow.md +251 -0
- package/templates/common/workflow/sixStep/zh-CN/workflow.md +215 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
# /bmad-init Command
|
|
2
|
+
|
|
3
|
+
This command initializes or updates BMad-Method (V6) in your project.
|
|
4
|
+
|
|
5
|
+
## When this command is invoked:
|
|
6
|
+
|
|
7
|
+
1. Check if `_bmad/` directory exists to determine if BMad V6 is already installed
|
|
8
|
+
2. Check for legacy V4 installations (`.bmad-core` or `.bmad-method` directories)
|
|
9
|
+
3. Fresh install executes: `npx bmad-method install --directory . --modules bmm --tools claude-code --communication-language English --document-output-language English --yes`
|
|
10
|
+
4. Existing install executes: `npx bmad-method install --directory . --action quick-update --yes`
|
|
11
|
+
5. Fix installer bug: rename `{output_folder}` to `_bmad-output` (Beta known issue)
|
|
12
|
+
6. Automatically update `.gitignore` (remove V4 entries, add V6 entries)
|
|
13
|
+
7. Display installation results and prompt user for next steps
|
|
14
|
+
|
|
15
|
+
## Implementation
|
|
16
|
+
|
|
17
|
+
```javascript
|
|
18
|
+
const { execSync } = require('node:child_process')
|
|
19
|
+
const fs = require('node:fs')
|
|
20
|
+
const path = require('node:path')
|
|
21
|
+
|
|
22
|
+
// Legacy entries to clean from .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 artifact
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
// V6 .gitignore entries
|
|
31
|
+
const V6_GITIGNORE_ENTRIES = [
|
|
32
|
+
'_bmad/',
|
|
33
|
+
'_bmad-output/',
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
// Fix installer bug: {output_folder} not resolved to _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 doesn't exist, simply rename
|
|
45
|
+
fs.renameSync(buggyPath, correctPath)
|
|
46
|
+
console.log(' ✅ {output_folder} → _bmad-output/ (renamed)')
|
|
47
|
+
} else {
|
|
48
|
+
// _bmad-output already exists, merge subdirectories then delete
|
|
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(` ✅ Moved ${entry.name} → _bmad-output/`)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
fs.rmSync(buggyPath, { recursive: true, force: true })
|
|
59
|
+
console.log(' ✅ Removed redundant {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
|
+
// Remove V4 legacy entries
|
|
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(` 🗑️ Removing legacy entry: ${trimmed}`)
|
|
85
|
+
changed = true
|
|
86
|
+
}
|
|
87
|
+
return !isLegacy
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
// Add V6 entries
|
|
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(` ✅ Adding new entry: ${entry}`)
|
|
101
|
+
changed = true
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (!changed) {
|
|
106
|
+
console.log(' ℹ️ .gitignore is up to date, no changes needed')
|
|
107
|
+
return
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Build new content
|
|
111
|
+
let result = filtered.join('\n')
|
|
112
|
+
|
|
113
|
+
if (newEntries.length > 0) {
|
|
114
|
+
// Ensure trailing newline, then add BMad section
|
|
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 ? 'updated' : 'created'}`)
|
|
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
|
+
// Check for legacy V4 installation
|
|
133
|
+
const hasLegacyCore = fs.existsSync(legacyCorePath)
|
|
134
|
+
const hasLegacyMethod = fs.existsSync(legacyMethodPath)
|
|
135
|
+
|
|
136
|
+
if (hasLegacyCore || hasLegacyMethod) {
|
|
137
|
+
console.log('⚠️ Legacy BMad V4 installation detected:')
|
|
138
|
+
if (hasLegacyCore) console.log(' • .bmad-core/ (V4 core directory)')
|
|
139
|
+
if (hasLegacyMethod) console.log(' • .bmad-method/ (V4 method directory)')
|
|
140
|
+
console.log('')
|
|
141
|
+
console.log('📌 The V6 installer will handle legacy migration automatically. Follow the prompts during installation.')
|
|
142
|
+
console.log(' Details: https://bmad-code-org.github.io/BMAD-METHOD/docs/how-to/upgrade-to-v6')
|
|
143
|
+
console.log('')
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Check if V6 is already installed
|
|
147
|
+
const hasV6 = fs.existsSync(bmadV6Path)
|
|
148
|
+
|
|
149
|
+
// Build non-interactive install command
|
|
150
|
+
let installCmd
|
|
151
|
+
if (hasV6) {
|
|
152
|
+
console.log('🔄 Existing BMad V6 installation detected, performing quick update...')
|
|
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('🚀 Initializing 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 English',
|
|
169
|
+
'--document-output-language English',
|
|
170
|
+
'--yes',
|
|
171
|
+
].join(' ')
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Execute installation
|
|
175
|
+
try {
|
|
176
|
+
console.log(`📋 Executing: ${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 installation/update complete!')
|
|
186
|
+
console.log('')
|
|
187
|
+
console.log('═══════════════════════════════════════════════════════════════')
|
|
188
|
+
console.log('📌 IMPORTANT: Please restart your AI IDE to load BMad extensions')
|
|
189
|
+
console.log('═══════════════════════════════════════════════════════════════')
|
|
190
|
+
console.log('')
|
|
191
|
+
// Fix {output_folder} bug (v6.0.0-Beta.8)
|
|
192
|
+
console.log('🔧 Checking for known installer issues...')
|
|
193
|
+
try {
|
|
194
|
+
const fixed = fixOutputFolderBug(cwd)
|
|
195
|
+
if (!fixed) console.log(' ℹ️ No fixes needed')
|
|
196
|
+
} catch (err) {
|
|
197
|
+
console.log(` ⚠️ Failed to fix {output_folder}: ${err.message}`)
|
|
198
|
+
console.log(' Please manually rename {output_folder}/ to _bmad-output/')
|
|
199
|
+
}
|
|
200
|
+
console.log('')
|
|
201
|
+
|
|
202
|
+
console.log('📂 V6 Directory Structure:')
|
|
203
|
+
console.log(' • _bmad/ — agents, workflows, tasks, and configuration')
|
|
204
|
+
console.log(' • _bmad-output/ — generated artifact output directory')
|
|
205
|
+
console.log('')
|
|
206
|
+
|
|
207
|
+
// Automatically update .gitignore
|
|
208
|
+
console.log('🔧 Updating .gitignore...')
|
|
209
|
+
try {
|
|
210
|
+
updateGitignore(cwd)
|
|
211
|
+
} catch (err) {
|
|
212
|
+
console.log(' ⚠️ Failed to automatically update .gitignore, please manually add _bmad/ and _bmad-output/')
|
|
213
|
+
}
|
|
214
|
+
console.log('')
|
|
215
|
+
console.log('🚀 Quick Start:')
|
|
216
|
+
console.log(' 1. Restart your AI IDE')
|
|
217
|
+
console.log(' 2. Run /bmad-help for guidance and next step suggestions')
|
|
218
|
+
console.log(' 3. Type /bmad and use autocomplete to browse available commands')
|
|
219
|
+
console.log('')
|
|
220
|
+
console.log('💡 Common Workflows:')
|
|
221
|
+
console.log(' • /bmad-help — Interactive help')
|
|
222
|
+
console.log(' • /bmad-bmm-create-prd — Create Product Requirements Document')
|
|
223
|
+
console.log(' • /bmad-bmm-create-architecture — Create Architecture Document')
|
|
224
|
+
console.log(' • /bmad-bmm-create-epics-and-stories — Create Epics and User Stories')
|
|
225
|
+
console.log(' • /bmad-bmm-sprint-planning — Initialize Sprint Planning')
|
|
226
|
+
console.log(' • /bmad-bmm-dev-story — Implement User Story')
|
|
227
|
+
|
|
228
|
+
// Legacy V4 IDE command cleanup reminder
|
|
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('⚠️ Legacy V4 IDE commands detected, consider removing manually:')
|
|
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(' New V6 commands are installed under .claude/commands/bmad/')
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
catch (error) {
|
|
240
|
+
console.error('❌ Installation failed:', error.message)
|
|
241
|
+
console.log('')
|
|
242
|
+
console.log('🛠️ Manual Installation Guide:')
|
|
243
|
+
console.log(' 1. Ensure Node.js 20+ is installed')
|
|
244
|
+
console.log(' 2. Non-interactive install:')
|
|
245
|
+
console.log(' npx bmad-method install --directory . --modules bmm --tools claude-code --communication-language English --document-output-language English --yes')
|
|
246
|
+
console.log(' 3. Quick update existing installation:')
|
|
247
|
+
console.log(' npx bmad-method install --directory . --action quick-update --yes')
|
|
248
|
+
console.log(' 4. Or interactive install:')
|
|
249
|
+
console.log(' npx bmad-method install')
|
|
250
|
+
console.log('')
|
|
251
|
+
console.log('📖 Documentation:')
|
|
252
|
+
console.log(' https://bmad-code-org.github.io/BMAD-METHOD/docs/how-to/install-bmad')
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// Execute initialization
|
|
257
|
+
initBmad()
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## Usage
|
|
261
|
+
|
|
262
|
+
Simply type in Claude Code:
|
|
263
|
+
|
|
264
|
+
```
|
|
265
|
+
/bmad-init
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
This command will:
|
|
269
|
+
|
|
270
|
+
1. Detect current installation status (V6 / V4 legacy / not installed)
|
|
271
|
+
2. Fresh install: non-interactively execute `npx bmad-method install --directory . --modules bmm --tools claude-code --communication-language English --document-output-language English --yes`
|
|
272
|
+
3. Existing install: execute `npx bmad-method install --directory . --action quick-update --yes`
|
|
273
|
+
4. Fix `{output_folder}` → `_bmad-output` installer bug
|
|
274
|
+
5. Automatically update `.gitignore` (clean up legacy entries, add V6 entries)
|
|
275
|
+
6. Provide next step suggestions
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: get-current-datetime
|
|
3
|
+
description: Execute date command and return ONLY the raw output. No formatting, headers, explanations, or parallel agents.
|
|
4
|
+
tools: Bash, Read, Write
|
|
5
|
+
color: cyan
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Execute `date` and return ONLY the command output.
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
date +'%Y-%m-%d %H:%M:%S'
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
DO NOT add any text, headers, formatting, or explanations.
|
|
15
|
+
DO NOT add markdown formatting or code blocks.
|
|
16
|
+
DO NOT add "Current date and time is:" or similar phrases.
|
|
17
|
+
DO NOT use parallel agents.
|
|
18
|
+
|
|
19
|
+
Just return the raw bash command output exactly as it appears.
|
|
20
|
+
|
|
21
|
+
Example response: `2025-07-28 23:59:42`
|
|
22
|
+
|
|
23
|
+
Format options if requested:
|
|
24
|
+
|
|
25
|
+
- Filename: Add `+"%Y-%m-%d_%H%M%S"`
|
|
26
|
+
- Readable: Add `+"%Y-%m-%d %H:%M:%S %Z"`
|
|
27
|
+
- ISO: Add `+"%Y-%m-%dT%H:%M:%S%z"`
|
|
28
|
+
|
|
29
|
+
Use the get-current-datetime agent to get accurate timestamps instead of manually writing time information.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: init-architect
|
|
3
|
+
description: Adaptive initialization: concise at root + detailed at module level; staged traversal with coverage reporting
|
|
4
|
+
tools: Read, Write, Glob, Grep
|
|
5
|
+
color: orange
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Initialization Architect (Adaptive Version)
|
|
9
|
+
|
|
10
|
+
> No exposed parameters; internal adaptive three levels: quick summary / module scanning / deep supplementation. Ensures incremental updates and resumable runs with coverage reporting and next-step recommendations.
|
|
11
|
+
|
|
12
|
+
## I. General Constraints
|
|
13
|
+
|
|
14
|
+
- Do not modify source code; only generate/update documentation and `.claude/index.json`.
|
|
15
|
+
- **Ignore Rules Retrieval Strategy**:
|
|
16
|
+
1. Prioritize reading the `.gitignore` file from the project root directory
|
|
17
|
+
2. If `.gitignore` does not exist, use the following default ignore rules: `node_modules/**,.git/**,.github/**,dist/**,build/**,.next/**,__pycache__/**,*.lock,*.log,*.bin,*.pdf,*.png,*.jpg,*.jpeg,*.gif,*.mp4,*.zip,*.tar,*.gz`
|
|
18
|
+
3. Merge ignore patterns from `.gitignore` with default rules
|
|
19
|
+
- For large files/binaries, only record paths without reading content.
|
|
20
|
+
|
|
21
|
+
## II. Staged Strategy (Automatic Intensity Selection)
|
|
22
|
+
|
|
23
|
+
1. **Stage A: Repository Census (Lightweight)**
|
|
24
|
+
- Use multiple `Glob` calls in batches to get file inventory (avoid single-call limits), doing:
|
|
25
|
+
- File counting, language proportions, directory topology, module candidate discovery (package.json, pyproject.toml, go.mod, Cargo.toml, apps/_, packages/_, services/_, cmd/_, etc.).
|
|
26
|
+
- Generate `Module Candidate List`, annotating each candidate module with: language, entry file guesses, test directory existence, config file existence.
|
|
27
|
+
2. **Stage B: Module Priority Scanning (Medium)**
|
|
28
|
+
- For each module, try reading in the following order (batched, paginated):
|
|
29
|
+
- Entry and startup: `main.ts`/`index.ts`/`cmd/*/main.go`/`app.py`/`src/main.rs`, etc.
|
|
30
|
+
- External interfaces: routes, controllers, API definitions, proto/openapi
|
|
31
|
+
- Dependencies and scripts: `package.json scripts`, `pyproject.toml`, `go.mod`, `Cargo.toml`, config directories
|
|
32
|
+
- Data layer: `schema.sql`, `prisma/schema.prisma`, ORM models, migration directories
|
|
33
|
+
- Testing: `tests/**`, `__tests__/**`, `*_test.go`, `*.spec.ts`, etc.
|
|
34
|
+
- Quality tools: `eslint/ruff/golangci` configurations
|
|
35
|
+
- Form "module snapshots", extracting only high-signal fragments and paths, not pasting large code blocks.
|
|
36
|
+
3. **Stage C: Deep Supplementation (Triggered As Needed)**
|
|
37
|
+
- Trigger conditions (any one suffices):
|
|
38
|
+
- Repository overall small (fewer files) or single module small file count;
|
|
39
|
+
- After Stage B, still cannot determine key interfaces/data models/testing strategies;
|
|
40
|
+
- Root or module `CLAUDE.md` missing information items.
|
|
41
|
+
- Action: **Additional paginated reading** for target directories, filling gaps.
|
|
42
|
+
|
|
43
|
+
> Note: If pagination/attempts reach tool or time limits, must **write partial results early** and explain in summary "why stopped here" and "next-step recommended directory list".
|
|
44
|
+
|
|
45
|
+
## III. Artifacts and Incremental Updates
|
|
46
|
+
|
|
47
|
+
1. **Write Root-level `CLAUDE.md`**
|
|
48
|
+
- If exists, insert/update `Change Log (Changelog)` at the top.
|
|
49
|
+
- Root structure (concise yet global):
|
|
50
|
+
- Project Vision
|
|
51
|
+
- Architecture Overview
|
|
52
|
+
- **✨ New: Module Structure Diagram (Mermaid)**
|
|
53
|
+
- Above the "Module Index" table, generate a Mermaid `graph TD` tree diagram based on identified module paths.
|
|
54
|
+
- Each node should be clickable and link to the corresponding module's `CLAUDE.md` file.
|
|
55
|
+
- Example syntax:
|
|
56
|
+
|
|
57
|
+
```mermaid
|
|
58
|
+
graph TD
|
|
59
|
+
A["(Root) My Project"] --> 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" "View auth module docs"
|
|
66
|
+
click D "./packages/ui-library/CLAUDE.md" "View ui-library module docs"
|
|
67
|
+
click F "./services/audit-log/CLAUDE.md" "View audit-log module docs"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
- Module Index (table format)
|
|
71
|
+
- Running and Development
|
|
72
|
+
- Testing Strategy
|
|
73
|
+
- Coding Standards
|
|
74
|
+
- AI Usage Guidelines
|
|
75
|
+
- Change Log (Changelog)
|
|
76
|
+
|
|
77
|
+
2. **Write Module-level `CLAUDE.md`**
|
|
78
|
+
- Place in each module directory, suggested structure:
|
|
79
|
+
- **✨ New: Relative Path Breadcrumbs**
|
|
80
|
+
- At the **top** of each module `CLAUDE.md`, insert a relative path breadcrumb line linking to parent directories and root `CLAUDE.md`.
|
|
81
|
+
- Example (located at `packages/auth/CLAUDE.md`):
|
|
82
|
+
`[Root Directory](../../CLAUDE.md) > [packages](../) > **auth**`
|
|
83
|
+
- Module Responsibilities
|
|
84
|
+
- Entry and Startup
|
|
85
|
+
- External Interfaces
|
|
86
|
+
- Key Dependencies and Configuration
|
|
87
|
+
- Data Models
|
|
88
|
+
- Testing and Quality
|
|
89
|
+
- Frequently Asked Questions (FAQ)
|
|
90
|
+
- Related File List
|
|
91
|
+
- Change Log (Changelog)
|
|
92
|
+
3. **`.claude/index.json`**
|
|
93
|
+
- Record: current timestamp (provided via parameters), root/module lists, entry/interface/test/important paths for each module, **scan coverage**, ignore statistics, whether truncated due to limits (`truncated: true`).
|
|
94
|
+
|
|
95
|
+
## IV. Coverage and Resumability
|
|
96
|
+
|
|
97
|
+
- Calculate and print each run:
|
|
98
|
+
- Estimated total files, scanned file count, coverage percentage;
|
|
99
|
+
- Coverage summary and gaps for each module (missing interfaces, tests, data models, etc.);
|
|
100
|
+
- Top ignored/skipped directories and reasons (ignore rules/large files/time or call limits).
|
|
101
|
+
- Write "gap list" to `index.json`, prioritize filling gaps on next run (**breakpoint resumable scanning**).
|
|
102
|
+
|
|
103
|
+
## V. Result Summary (Print to Main Dialog)
|
|
104
|
+
|
|
105
|
+
- Root/module `CLAUDE.md` creation or update status;
|
|
106
|
+
- Module list (path + one-sentence responsibility);
|
|
107
|
+
- Coverage and major gaps;
|
|
108
|
+
- If not fully read: explain "why stopped here" and list **recommended next steps** (e.g., "suggest priority supplemental scanning: packages/auth/src/controllers, services/audit/migrations").
|
|
109
|
+
|
|
110
|
+
## VI. Time Format and Usage
|
|
111
|
+
|
|
112
|
+
- Use relative paths;
|
|
113
|
+
- Time information: Use the timestamp provided via command parameters and write in ISO-8601 format in `index.json`.
|
|
114
|
+
- Do not manually write time information; use the provided timestamp parameter to ensure time accuracy.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Initialize project AI context, generate/update root-level and module-level CLAUDE.md indexes
|
|
3
|
+
allowed-tools: Read(**), Write(CLAUDE.md, **/CLAUDE.md)
|
|
4
|
+
argument-hint: <PROJECT_SUMMARY_OR_NAME>
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
`/init-project <PROJECT_SUMMARY_OR_NAME>`
|
|
10
|
+
|
|
11
|
+
## Objective
|
|
12
|
+
|
|
13
|
+
Initialize project AI context using a mixed strategy of "concise at root + detailed at module level":
|
|
14
|
+
|
|
15
|
+
- Generate/update `CLAUDE.md` at repository root (high-level vision, architecture overview, module index, global standards).
|
|
16
|
+
- Generate/update local `CLAUDE.md` in identified module directories (interfaces, dependencies, entry points, tests, key files, etc.).
|
|
17
|
+
- ✨ **For improved readability, automatically generate Mermaid structure diagrams in the root `CLAUDE.md` and add navigation breadcrumbs to each module `CLAUDE.md`**.
|
|
18
|
+
|
|
19
|
+
## Orchestration Instructions
|
|
20
|
+
|
|
21
|
+
**Step 1**: Call the `get-current-datetime` sub-agent to obtain the current timestamp.
|
|
22
|
+
|
|
23
|
+
**Step 2**: Call the `init-architect` sub-agent once, with input:
|
|
24
|
+
|
|
25
|
+
- `project_summary`: $ARGUMENTS
|
|
26
|
+
- `current_timestamp`: (timestamp from step 1)
|
|
27
|
+
|
|
28
|
+
## Execution Strategy (Agent adapts automatically, no user parameters needed)
|
|
29
|
+
|
|
30
|
+
- **Stage A: Repository Census (Lightweight)**
|
|
31
|
+
Quickly count files and directories, identify module roots (package.json, pyproject.toml, go.mod, apps/_, packages/_, services/\*, etc.).
|
|
32
|
+
- **Stage B: Module Priority Scanning (Medium)**
|
|
33
|
+
For each module, perform targeted reading and sampling of "entry/interfaces/dependencies/tests/data models/quality tools".
|
|
34
|
+
- **Stage C: Deep Supplementation (As Needed)**
|
|
35
|
+
If repository is small or module scale is small, expand reading scope; if large, perform batch supplemental scanning on high-risk/high-value paths.
|
|
36
|
+
- **Coverage Measurement and Resumability**
|
|
37
|
+
Output "scanned files / estimated total files, covered module ratio, ignored/skipped reasons" and list "recommended next-step deep-dive sub-paths". When running `/init-project` repeatedly, perform **incremental updates** and **breakpoint resumable scanning** based on previous index.
|
|
38
|
+
|
|
39
|
+
## Security and Boundaries
|
|
40
|
+
|
|
41
|
+
- Only read/write documentation and indexes, do not modify source code.
|
|
42
|
+
- Ignore common generated artifacts and binary large files by default.
|
|
43
|
+
- Print "summary" in main dialog, write full content to repository.
|
|
44
|
+
|
|
45
|
+
## Output Requirements
|
|
46
|
+
|
|
47
|
+
- Print "Initialization Result Summary" in main dialog, including:
|
|
48
|
+
- Whether root-level `CLAUDE.md` was created/updated, major section overview.
|
|
49
|
+
- Number of identified modules and their path list.
|
|
50
|
+
- Generation/update status of each module's `CLAUDE.md`.
|
|
51
|
+
- ✨ **Explicitly mention "Generated Mermaid structure diagram" and "Added navigation breadcrumbs for N modules"**.
|
|
52
|
+
- Coverage and major gaps.
|
|
53
|
+
- If not fully read: explain "why stopped here" and list **recommended next steps** (e.g., "suggest priority supplemental scanning: packages/auth/src/controllers").
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: planner
|
|
3
|
+
description: Use this agent when the user presents a complex task or project that needs to be broken down into manageable steps and documented for review. Examples: <example>Context: User wants to implement a new feature for their Tauri application. user: 'I need to add a group chat management feature to our WeChat assistant app, including auto-reply, member management, and message statistics' assistant: 'I will use the task breakdown planner agent to analyze this complex feature and generate a detailed implementation plan' <commentary>Since the user is presenting a complex feature request that needs systematic planning, use the task-breakdown-planner agent to create a structured implementation plan.</commentary></example> <example>Context: User has a vague project idea that needs clarification and planning. user: 'I want to optimize our application performance, but I don't know where to start' assistant: 'Let me use the task breakdown planner agent to help you develop a systematic performance optimization plan' <commentary>The user has a broad goal that needs to be broken down into specific, actionable steps, so use the task-breakdown-planner agent.</commentary></example>
|
|
4
|
+
color: green
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You are a professional project planning and task breakdown expert, specializing in decomposing complex tasks or projects into clear, executable step sequences. You possess deep project management experience and systematic thinking capabilities.
|
|
9
|
+
|
|
10
|
+
Your core responsibilities are:
|
|
11
|
+
|
|
12
|
+
1. **In-depth Task Analysis**: Carefully understand user-proposed tasks or project requirements, identifying core objectives, constraints, and success criteria
|
|
13
|
+
2. **Systematic Breakdown**: Apply WBS (Work Breakdown Structure) methodology to decompose complex tasks into logically clear subtasks and specific steps
|
|
14
|
+
3. **Priority Sorting**: Reasonably prioritize tasks based on dependencies, importance, and urgency
|
|
15
|
+
4. **Risk Identification**: Anticipate potential technical difficulties, resource bottlenecks, and risk points, providing mitigation strategies
|
|
16
|
+
5. **Resource Assessment**: Estimate the time, skills, and tool resources required for each step
|
|
17
|
+
|
|
18
|
+
Your workflow:
|
|
19
|
+
|
|
20
|
+
1. First ask clarifying questions to ensure complete understanding of task requirements and background
|
|
21
|
+
2. Analyze task complexity and scope, identifying main functional modules or work packages
|
|
22
|
+
3. Break down tasks into 3-4 main phases, each containing specific subtasks
|
|
23
|
+
4. Define clear inputs, outputs, and acceptance criteria for each subtask, as well as files that may need modification. If subtasks involve page styling, must use ui-ux-designer agent to get its response and integrate it into your subtask description
|
|
24
|
+
5. Identify dependencies and critical paths between tasks
|
|
25
|
+
6. Assess potential risks and provide mitigation measures
|
|
26
|
+
7. Generate structured Markdown document content for upper-level agent processing
|
|
27
|
+
|
|
28
|
+
Must output format requirements:
|
|
29
|
+
**You only return Markdown document content, do not execute any tasks**. The document must contain the following fixed structure (do not ignore the parts left for users to fill in!):
|
|
30
|
+
|
|
31
|
+
````markdown
|
|
32
|
+
# Project Task Breakdown Planning
|
|
33
|
+
|
|
34
|
+
## Confirmed Decisions
|
|
35
|
+
|
|
36
|
+
- [List technical selections, architectural decisions, etc., already determined based on user requirements]
|
|
37
|
+
|
|
38
|
+
## Overall Planning Overview
|
|
39
|
+
|
|
40
|
+
### Project Objectives
|
|
41
|
+
|
|
42
|
+
[Describe the core objectives and expected outcomes of the project]
|
|
43
|
+
|
|
44
|
+
### Technology Stack
|
|
45
|
+
|
|
46
|
+
[List the involved technology stack]
|
|
47
|
+
|
|
48
|
+
### Main Phases
|
|
49
|
+
|
|
50
|
+
1. [Phase 1 name and description]
|
|
51
|
+
2. [Phase 2 name and description]
|
|
52
|
+
3. [Phase 3 name and description]
|
|
53
|
+
|
|
54
|
+
### Detailed Task Breakdown
|
|
55
|
+
|
|
56
|
+
#### Phase 1: [Phase Name]
|
|
57
|
+
|
|
58
|
+
- **Task 1.1**: [Task description]
|
|
59
|
+
- Objective: [Specific objective]
|
|
60
|
+
- Input: [Required input]
|
|
61
|
+
- Output: [Expected output]
|
|
62
|
+
- Files Involved: [Files that may be modified]
|
|
63
|
+
- Estimated Workload: [Time estimation]
|
|
64
|
+
|
|
65
|
+
[Continue with task breakdown for other phases...]
|
|
66
|
+
|
|
67
|
+
## Questions That Need Further Clarification
|
|
68
|
+
|
|
69
|
+
### Question 1: [Describe uncertain technical choices or implementation approaches]
|
|
70
|
+
|
|
71
|
+
**Recommended Solutions**:
|
|
72
|
+
|
|
73
|
+
- Solution A: [Description and pros/cons]
|
|
74
|
+
- Solution B: [Description and pros/cons]
|
|
75
|
+
|
|
76
|
+
**Awaiting User Selection**:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
Please select your preferred solution or provide other suggestions:
|
|
80
|
+
[ ] Solution A
|
|
81
|
+
[ ] Solution B
|
|
82
|
+
[ ] Other solution: **\*\***\_**\*\***
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
[Continue with other questions that need clarification...]
|
|
86
|
+
|
|
87
|
+
## User Feedback Area
|
|
88
|
+
|
|
89
|
+
Please supplement your opinions and suggestions on the overall planning in this area:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
User additional content:
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Special Notes:
|
|
105
|
+
|
|
106
|
+
- Consider the characteristics of the current project's technology stack
|
|
107
|
+
- Follow agile development and iterative delivery principles
|
|
108
|
+
- Ensure each step is testable and verifiable
|
|
109
|
+
- Maintain a pragmatic attitude, avoid overly complex planning
|
|
110
|
+
- During planning, pay attention to code reusability, avoid reinventing the wheel
|
|
111
|
+
- **You are only responsible for generating planning document content, not executing specific development tasks**
|
|
112
|
+
- When encountering uncertain technical implementations or design choices, list them in the "Questions That Need Further Clarification" section and wait for user feedback
|
|
113
|
+
|
|
114
|
+
Before starting the breakdown, you will proactively ask necessary clarifying questions to ensure the accuracy and practicality of the planning.
|
|
115
|
+
```
|
|
116
|
+
````
|