zcf 2.10.2 → 2.11.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.
Files changed (33) hide show
  1. package/README.md +29 -24
  2. package/bin/zcf.mjs +1 -1
  3. package/dist/chunks/simple-config.mjs +938 -897
  4. package/dist/cli.mjs +286 -256
  5. package/dist/index.d.mts +13 -13
  6. package/dist/index.d.ts +13 -13
  7. package/dist/index.mjs +3 -4
  8. package/package.json +20 -15
  9. package/templates/CLAUDE.md +249 -5
  10. package/templates/common/CLAUDE.md +5 -0
  11. package/templates/en/memory/mcp.md +4 -1
  12. package/templates/en/memory/personality.md +1 -1
  13. package/templates/en/memory/rules.md +1 -4
  14. package/templates/en/workflow/bmad/commands/bmad-init.md +58 -56
  15. package/templates/en/workflow/common/agents/get-current-datetime.md +29 -0
  16. package/templates/en/workflow/common/agents/init-architect.md +114 -0
  17. package/templates/en/workflow/common/commands/init-project.md +53 -0
  18. package/templates/en/workflow/git/commands/git-cleanBranches.md +2 -1
  19. package/templates/en/workflow/git/commands/git-commit.md +36 -31
  20. package/templates/en/workflow/git/commands/git-rollback.md +27 -26
  21. package/templates/en/workflow/git/commands/git-worktree.md +145 -221
  22. package/templates/zh-CN/memory/mcp.md +4 -1
  23. package/templates/zh-CN/memory/personality.md +1 -1
  24. package/templates/zh-CN/memory/rules.md +1 -4
  25. package/templates/zh-CN/workflow/bmad/commands/bmad-init.md +58 -55
  26. package/templates/zh-CN/workflow/common/agents/get-current-datetime.md +29 -0
  27. package/templates/zh-CN/workflow/common/agents/init-architect.md +114 -0
  28. package/templates/zh-CN/workflow/common/commands/init-project.md +53 -0
  29. package/templates/zh-CN/workflow/git/commands/git-cleanBranches.md +2 -1
  30. package/templates/zh-CN/workflow/git/commands/git-commit.md +0 -5
  31. package/templates/zh-CN/workflow/git/commands/git-rollback.md +1 -1
  32. package/templates/zh-CN/workflow/git/commands/git-worktree.md +145 -221
  33. /package/templates/{settings.json → common/settings.json} +0 -0
@@ -12,87 +12,89 @@ This command initializes BMad Method in your project.
12
12
  ## Implementation
13
13
 
14
14
  ```javascript
15
- const fs = require('fs');
16
- const path = require('path');
17
- const { execSync } = require('child_process');
15
+ const { execSync } = require('node:child_process')
16
+ const fs = require('node:fs')
17
+ const path = require('node:path')
18
18
 
19
19
  async function initBmad() {
20
20
  // Check if already installed and get version
21
- const manifestPath = path.join(process.cwd(), '.bmad-core', 'install-manifest.yaml');
22
- let needsInstall = true;
23
- let currentVersion = null;
24
-
21
+ const manifestPath = path.join(process.cwd(), '.bmad-core', 'install-manifest.yaml')
22
+ let needsInstall = true
23
+ let currentVersion = null
24
+
25
25
  if (fs.existsSync(manifestPath)) {
26
26
  try {
27
27
  // Simple version check - just check if file exists
28
28
  // Full YAML parsing would require js-yaml package
29
- const manifestContent = fs.readFileSync(manifestPath, 'utf8');
30
- const versionMatch = manifestContent.match(/version:\s*(.+)/);
29
+ const manifestContent = fs.readFileSync(manifestPath, 'utf8')
30
+ const versionMatch = manifestContent.match(/version:\s*(.+)/)
31
31
  if (versionMatch) {
32
- currentVersion = versionMatch[1].trim();
32
+ currentVersion = versionMatch[1].trim()
33
33
  }
34
-
34
+
35
35
  // Get latest version from npm
36
- const latestVersion = execSync('npm view bmad-method version', { encoding: 'utf8' }).trim();
37
-
36
+ const latestVersion = execSync('npm view bmad-method version', { encoding: 'utf8' }).trim()
37
+
38
38
  if (currentVersion === latestVersion) {
39
- console.log(`✅ BMad Method is up to date (v${currentVersion})`);
40
- console.log('You can use BMad commands to begin your workflow');
41
- needsInstall = false;
42
- } else {
43
- console.log(`🔄 BMad Method update available: v${currentVersion} → v${latestVersion}`);
39
+ console.log(`✅ BMad Method is up to date (v${currentVersion})`)
40
+ console.log('You can use BMad commands to begin your workflow')
41
+ needsInstall = false
44
42
  }
45
- } catch (error) {
46
- console.log('⚠️ Could not verify BMad version, will reinstall');
43
+ else {
44
+ console.log(`🔄 BMad Method update available: v${currentVersion} → v${latestVersion}`)
45
+ }
46
+ }
47
+ catch (error) {
48
+ console.log('⚠️ Could not verify BMad version, will reinstall')
47
49
  }
48
50
  }
49
-
51
+
50
52
  if (needsInstall === false) {
51
- return;
53
+ return
52
54
  }
53
-
55
+
54
56
  // Install BMad
55
- console.log('🚀 Installing BMad Method...');
57
+ console.log('🚀 Installing BMad Method...')
56
58
  try {
57
59
  execSync('echo -e "1\\n" | npx bmad-method@latest install -f -d . -i claude-code', {
58
60
  stdio: 'inherit',
59
61
  cwd: process.cwd(),
60
62
  shell: true
61
- });
62
-
63
- console.log('✅ BMad Method installed successfully!');
64
- console.log('');
65
- console.log('═══════════════════════════════════════════════════════════════');
66
- console.log('📌 IMPORTANT: Please restart Claude Code to load BMad agents');
67
- console.log('═══════════════════════════════════════════════════════════════');
68
- console.log('');
69
- console.log('📂 Installation Details:');
70
- console.log(' • All agents and task commands are installed in:');
71
- console.log(' .claude/commands/BMad/');
72
- console.log('');
73
- console.log('🔧 Git Configuration (Optional):');
74
- console.log(' If you prefer not to commit BMad workflow files, add these to .gitignore:');
75
- console.log(' • .bmad-core');
76
- console.log(' • .claude/commands/BMad');
77
- console.log(' • docs/');
78
- console.log('');
79
- console.log('🚀 Getting Started:');
80
- console.log(' 1. Restart Claude Code');
81
- console.log(' 2. For first-time users, run:');
82
- console.log(' /BMad:agents:bmad-orchestrator *help');
83
- console.log(' This will start the BMad workflow guidance system');
84
- console.log('');
85
- console.log('💡 Tip: The BMad Orchestrator will help you choose the right workflow');
86
- console.log(' and guide you through the entire development process.');
87
-
88
- } catch (error) {
89
- console.error('❌ Failed to install BMad:', error.message);
90
- process.exit(1);
63
+ })
64
+
65
+ console.log('✅ BMad Method installed successfully!')
66
+ console.log('')
67
+ console.log('═══════════════════════════════════════════════════════════════')
68
+ console.log('📌 IMPORTANT: Please restart Claude Code to load BMad agents')
69
+ console.log('═══════════════════════════════════════════════════════════════')
70
+ console.log('')
71
+ console.log('📂 Installation Details:')
72
+ console.log(' • All agents and task commands are installed in:')
73
+ console.log(' .claude/commands/BMad/')
74
+ console.log('')
75
+ console.log('🔧 Git Configuration (Optional):')
76
+ console.log(' If you prefer not to commit BMad workflow files, add these to .gitignore:')
77
+ console.log(' • .bmad-core')
78
+ console.log(' • .claude/commands/BMad')
79
+ console.log(' • docs/')
80
+ console.log('')
81
+ console.log('🚀 Getting Started:')
82
+ console.log(' 1. Restart Claude Code')
83
+ console.log(' 2. For first-time users, run:')
84
+ console.log(' /BMad:agents:bmad-orchestrator *help')
85
+ console.log(' This will start the BMad workflow guidance system')
86
+ console.log('')
87
+ console.log('💡 Tip: The BMad Orchestrator will help you choose the right workflow')
88
+ console.log(' and guide you through the entire development process.')
89
+ }
90
+ catch (error) {
91
+ console.error('❌ Failed to install BMad:', error.message)
92
+ process.exit(1)
91
93
  }
92
94
  }
93
95
 
94
96
  // Execute
95
- initBmad();
97
+ initBmad()
96
98
  ```
97
99
 
98
100
  ## Notes
@@ -100,4 +102,4 @@ initBmad();
100
102
  - This command requires npm/npx to be available
101
103
  - The installation will download the latest BMad Method package
102
104
  - User must restart Claude Code after installation for agents to load properly
103
- - BMad Method includes its own built-in state tracking system
105
+ - BMad Method includes its own built-in state tracking system
@@ -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
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: `Mon 28 Jul 2025 23:59:42 CST`
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").
@@ -32,6 +32,7 @@ Runs in **read-only preview (`--dry-run`)** mode by default, requiring explicit
32
32
  ```
33
33
 
34
34
  ### Options
35
+
35
36
  - `--base <branch>`: Specify the base branch for cleanup (defaults to repository's `main`/`master`).
36
37
  - `--stale <days>`: Clean branches with no commits for specified days (disabled by default).
37
38
  - `--remote`: Also clean remote merged/stale branches.
@@ -98,4 +99,4 @@ git config --get-all branch.cleanup.protected
98
99
  - ✅ **More Flexible**: Supports custom base branches, perfectly fits `release` / `develop` workflows.
99
100
  - ✅ **More Compatible**: Avoids commands with inconsistent behavior across systems like `date -d`.
100
101
  - ✅ **More Intuitive**: Condenses complex 16-step checklist into a single command with safety options.
101
- - ✅ **Consistent Style**: Shares similar parameter design and documentation structure with `/commit` command.
102
+ - ✅ **Consistent Style**: Shares similar parameter design and documentation structure with `/commit` command.
@@ -14,6 +14,7 @@ argument-hint: [--no-verify] [--all] [--amend] [--signoff] [--emoji] [--scope <s
14
14
  # Claude Command: Commit (Git-only)
15
15
 
16
16
  This command works **without any package manager/build tools**, using only **Git** to:
17
+
17
18
  - Read changes (staged/unstaged)
18
19
  - Determine if changes should be **split into multiple commits**
19
20
  - Generate **Conventional Commits** style messages with optional emoji for each commit
@@ -33,6 +34,7 @@ This command works **without any package manager/build tools**, using only **Git
33
34
  ```
34
35
 
35
36
  ### Options
37
+
36
38
  - `--no-verify`: Skip local Git hooks (`pre-commit`/`commit-msg` etc.).
37
39
  - `--all`: When staging area is empty, automatically `git add -A` to include all changes in the commit.
38
40
  - `--amend`: **Amend** the last commit without creating a new one (preserves author and timestamp unless local Git config specifies otherwise).
@@ -88,16 +90,16 @@ This command works **without any package manager/build tools**, using only **Git
88
90
 
89
91
  ## Type to Emoji Mapping (When --emoji is Used)
90
92
 
91
- - ✨ `feat`: New feature
92
- - 🐛 `fix`: Bug fix (includes 🔥 remove code/files, 🚑️ hotfix, 👽️ adapt to external API changes, 🔒️ security fix, 🚨 fix warnings, 💚 fix CI)
93
- - 📝 `docs`: Documentation and comments
94
- - 🎨 `style`: Code style/formatting (no semantic changes)
95
- - ♻️ `refactor`: Refactoring (no new features, no bug fixes)
96
- - ⚡️ `perf`: Performance improvements
97
- - ✅ `test`: Add/fix tests, snapshots
98
- - 🔧 `chore`: Build/tools/misc tasks (merge branches, update configs, release tags, pin dependencies, .gitignore, etc.)
99
- - 👷 `ci`: CI/CD configuration and scripts
100
- - ⏪️ `revert`: Revert commits
93
+ - ✨ `feat`: New feature
94
+ - 🐛 `fix`: Bug fix (includes 🔥 remove code/files, 🚑️ hotfix, 👽️ adapt to external API changes, 🔒️ security fix, 🚨 fix warnings, 💚 fix CI)
95
+ - 📝 `docs`: Documentation and comments
96
+ - 🎨 `style`: Code style/formatting (no semantic changes)
97
+ - ♻️ `refactor`: Refactoring (no new features, no bug fixes)
98
+ - ⚡️ `perf`: Performance improvements
99
+ - ✅ `test`: Add/fix tests, snapshots
100
+ - 🔧 `chore`: Build/tools/misc tasks (merge branches, update configs, release tags, pin dependencies, .gitignore, etc.)
101
+ - 👷 `ci`: CI/CD configuration and scripts
102
+ - ⏪️ `revert`: Revert commits
101
103
  - 💥 `feat`: Breaking changes (explained in `BREAKING CHANGE:` section)
102
104
 
103
105
  > If `--type`/`--scope` is passed, it will **override** auto-detection.
@@ -107,10 +109,10 @@ This command works **without any package manager/build tools**, using only **Git
107
109
 
108
110
  ## Guidelines for Splitting Commits
109
111
 
110
- 1. **Different concerns**: Unrelated feature/module changes should be split.
111
- 2. **Different types**: Don't mix `feat`, `fix`, `refactor` in the same commit.
112
- 3. **File modes**: Source code vs docs/tests/configs should be grouped separately.
113
- 4. **Size threshold**: Large diffs (e.g., >300 lines or across multiple top-level directories) should be split.
112
+ 1. **Different concerns**: Unrelated feature/module changes should be split.
113
+ 2. **Different types**: Don't mix `feat`, `fix`, `refactor` in the same commit.
114
+ 3. **File modes**: Source code vs docs/tests/configs should be grouped separately.
115
+ 4. **Size threshold**: Large diffs (e.g., >300 lines or across multiple top-level directories) should be split.
114
116
  5. **Revertability**: Ensure each commit can be independently reverted.
115
117
 
116
118
  ---
@@ -118,24 +120,27 @@ This command works **without any package manager/build tools**, using only **Git
118
120
  ## Examples
119
121
 
120
122
  **Good (with --emoji)**
121
- - ✨ feat(ui): add user authentication flow
122
- - 🐛 fix(api): handle token refresh race condition
123
- - 📝 docs: update API usage examples
124
- - ♻️ refactor(core): extract retry logic into helper
125
- - test: add unit tests for rate limiter
126
- - 🔧 chore: update git hooks and repository settings
123
+
124
+ - feat(ui): add user authentication flow
125
+ - 🐛 fix(api): handle token refresh race condition
126
+ - 📝 docs: update API usage examples
127
+ - ♻️ refactor(core): extract retry logic into helper
128
+ - test: add unit tests for rate limiter
129
+ - 🔧 chore: update git hooks and repository settings
127
130
  - ⏪️ revert: revert "feat(core): introduce streaming API"
128
131
 
129
132
  **Good (without --emoji)**
130
- - feat(ui): add user authentication flow
131
- - fix(api): handle token refresh race condition
132
- - docs: update API usage examples
133
- - refactor(core): extract retry logic into helper
134
- - test: add unit tests for rate limiter
135
- - chore: update git hooks and repository settings
133
+
134
+ - feat(ui): add user authentication flow
135
+ - fix(api): handle token refresh race condition
136
+ - docs: update API usage examples
137
+ - refactor(core): extract retry logic into helper
138
+ - test: add unit tests for rate limiter
139
+ - chore: update git hooks and repository settings
136
140
  - revert: revert "feat(core): introduce streaming API"
137
141
 
138
142
  **Split Example**
143
+
139
144
  - `feat(types): add new type defs for payment method`
140
145
  - `docs: update API docs for new types`
141
146
  - `test: add unit tests for payment types`
@@ -145,8 +150,8 @@ This command works **without any package manager/build tools**, using only **Git
145
150
 
146
151
  ## Important Notes
147
152
 
148
- - **Git only**: No package manager/build commands (`pnpm`/`npm`/`yarn` etc.).
149
- - **Respects hooks**: Executes local Git hooks by default; use `--no-verify` to skip.
150
- - **No source code changes**: Command only reads/writes `.git/COMMIT_EDITMSG` and staging area; doesn't directly edit working directory files.
151
- - **Safety prompts**: In rebase/merge conflicts, detached HEAD states, prompts to handle/confirm before continuing.
152
- - **Auditable and controllable**: If `confirm: true` is enabled, each actual `git add`/`git commit` step requires confirmation.
153
+ - **Git only**: No package manager/build commands (`pnpm`/`npm`/`yarn` etc.).
154
+ - **Respects hooks**: Executes local Git hooks by default; use `--no-verify` to skip.
155
+ - **No source code changes**: Command only reads/writes `.git/COMMIT_EDITMSG` and staging area; doesn't directly edit working directory files.
156
+ - **Safety prompts**: In rebase/merge conflicts, detached HEAD states, prompts to handle/confirm before continuing.
157
+ - **Auditable and controllable**: If `confirm: true` is enabled, each actual `git add`/`git commit` step requires confirmation.
@@ -7,9 +7,10 @@ argument-hint: [--branch <branch>] [--target <rev>] [--mode reset|revert] [--dep
7
7
  # - /git-rollback --branch dev # Select dev directly, other interactive
8
8
  # - /git-rollback --branch dev --target v1.2.0 --mode reset --yes
9
9
  ---
10
+
10
11
  # Claude Command: Git Rollback
11
12
 
12
- **Purpose**: Safely and visually rollback a specified branch to an older version.
13
+ **Purpose**: Safely and visually rollback a specified branch to an older version.
13
14
  Defaults to **read-only preview (`--dry-run`)**; actual execution requires `--yes` or interactive confirmation.
14
15
 
15
16
  ---
@@ -32,14 +33,14 @@ Defaults to **read-only preview (`--dry-run`)**; actual execution requires `--ye
32
33
 
33
34
  ### Options
34
35
 
35
- | Option | Description |
36
- |------|------|
37
- | `--branch <branch>` | Branch to rollback; interactively selected if omitted. |
38
- | `--target <rev>` | Target version (commit hash, tag, or reflog reference); interactively selects recent `--depth` entries if omitted. |
39
- | `--mode reset\|revert` | `reset`: Hard rollback history; `revert`: Generate reverse commits keeping history intact. Prompts by default. |
40
- | `--depth <n>` | List recent n versions in interactive mode (default 20). |
41
- | `--dry-run` | **Enabled by default**, only preview commands to be executed. |
42
- | `--yes` | Skip all confirmations and execute directly, suitable for CI/CD scripts. |
36
+ | Option | Description |
37
+ | ---------------------- | ------------------------------------------------------------------------------------------------------------------ |
38
+ | `--branch <branch>` | Branch to rollback; interactively selected if omitted. |
39
+ | `--target <rev>` | Target version (commit hash, tag, or reflog reference); interactively selects recent `--depth` entries if omitted. |
40
+ | `--mode reset\|revert` | `reset`: Hard rollback history; `revert`: Generate reverse commits keeping history intact. Prompts by default. |
41
+ | `--depth <n>` | List recent n versions in interactive mode (default 20). |
42
+ | `--dry-run` | **Enabled by default**, only preview commands to be executed. |
43
+ | `--yes` | Skip all confirmations and execute directly, suitable for CI/CD scripts. |
43
44
 
44
45
  ---
45
46
 
@@ -52,38 +53,38 @@ Defaults to **read-only preview (`--dry-run`)**; actual execution requires `--ye
52
53
  5. **Select target** → User inputs commit hash / tag
53
54
  6. **Select mode** → `reset` or `revert`
54
55
  7. **Final confirmation** (unless `--yes`)
55
- 8. **Execute rollback**
56
- * `reset`: `git switch <branch> && git reset --hard <target>`
57
- * `revert`: `git switch <branch> && git revert --no-edit <target>..HEAD`
56
+ 8. **Execute rollback**
57
+ - `reset`: `git switch <branch> && git reset --hard <target>`
58
+ - `revert`: `git switch <branch> && git revert --no-edit <target>..HEAD`
58
59
  9. **Push suggestion** → Prompt whether to `git push --force-with-lease` (reset) or regular `git push` (revert)
59
60
 
60
61
  ---
61
62
 
62
63
  ## Safety Guards
63
64
 
64
- * **Backup**: Automatically records current HEAD in reflog before execution, recoverable with `git switch -c backup/<timestamp>`.
65
- * **Protected branches**: If protected branches like `main` / `master` / `production` are detected with `reset` mode enabled, requires additional confirmation.
66
- * **--dry-run enabled by default**: Prevents accidental operations.
67
- * **--force prohibited**: No `--force` provided; if force push needed, manually enter `git push --force-with-lease`.
65
+ - **Backup**: Automatically records current HEAD in reflog before execution, recoverable with `git switch -c backup/<timestamp>`.
66
+ - **Protected branches**: If protected branches like `main` / `master` / `production` are detected with `reset` mode enabled, requires additional confirmation.
67
+ - **--dry-run enabled by default**: Prevents accidental operations.
68
+ - **--force prohibited**: No `--force` provided; if force push needed, manually enter `git push --force-with-lease`.
68
69
 
69
70
  ---
70
71
 
71
72
  ## Use Case Examples
72
73
 
73
- | Scenario | Command Example |
74
- |------|---------|
75
- | Hotfix patch deployed with bug, need to rollback to tag `v1.2.0` | `/git-rollback --branch release/v1 --target v1.2.0 --mode reset` |
76
- | Ops colleague pushed debug logs by mistake, need to generate reverse commit | `/git-rollback --branch main --target 3f2e7c9 --mode revert` |
77
- | Research historical bugs, guide newcomers through branch history | `/git-rollback` (full interactive, dry-run) |
74
+ | Scenario | Command Example |
75
+ | --------------------------------------------------------------------------- | ---------------------------------------------------------------- |
76
+ | Hotfix patch deployed with bug, need to rollback to tag `v1.2.0` | `/git-rollback --branch release/v1 --target v1.2.0 --mode reset` |
77
+ | Ops colleague pushed debug logs by mistake, need to generate reverse commit | `/git-rollback --branch main --target 3f2e7c9 --mode revert` |
78
+ | Research historical bugs, guide newcomers through branch history | `/git-rollback` (full interactive, dry-run) |
78
79
 
79
80
  ---
80
81
 
81
82
  ## Notes
82
83
 
83
- 1. **reset vs revert**
84
- * **reset** changes history, requires force push and may affect other collaborators, use with caution.
85
- * **revert** is safer, generates new commits preserving history, but adds one more record.
86
- 2. **Embedded repositories** often have large binary files; ensure LFS/submodule state consistency before rollback.
84
+ 1. **reset vs revert**
85
+ - **reset** changes history, requires force push and may affect other collaborators, use with caution.
86
+ - **revert** is safer, generates new commits preserving history, but adds one more record.
87
+ 2. **Embedded repositories** often have large binary files; ensure LFS/submodule state consistency before rollback.
87
88
  3. If repository has CI forced validation, rollback may trigger pipelines automatically; confirm control policies to avoid accidental deployment of old versions.
88
89
 
89
- ---
90
+ ---