cc-devflow 4.1.6 → 4.3.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 (128) hide show
  1. package/.claude/commands/core/architecture.md +30 -0
  2. package/.claude/commands/core/guidelines.md +25 -0
  3. package/.claude/commands/core/roadmap.md +29 -0
  4. package/.claude/commands/core/style.md +18 -0
  5. package/.claude/commands/flow/CLAUDE.md +0 -4
  6. package/.claude/docs/examples/design-inspiration-pool.md +59 -0
  7. package/.claude/docs/examples/ui-prototype-constitution-checklist.md +75 -0
  8. package/.claude/docs/implementation-summary-v7.md +449 -0
  9. package/.claude/docs/spec-format-guide.md +349 -0
  10. package/.claude/docs/state-consolidation-design.md +323 -0
  11. package/.claude/docs/templates/ARCHITECTURE_TEMPLATE.md +85 -386
  12. package/.claude/docs/templates/DESIGN_TEMPLATE.md +157 -0
  13. package/.claude/docs/templates/PROPOSAL_TEMPLATE.md +91 -0
  14. package/.claude/docs/templates/SPEC_TEMPLATE_DELTA.md +139 -0
  15. package/.claude/docs/templates/SPEC_TEMPLATE_PROJECT.md +93 -0
  16. package/.claude/docs/templates/STYLE_TEMPLATE.md +114 -901
  17. package/.claude/docs/templates/UI_PROTOTYPE_TEMPLATE.md +143 -1205
  18. package/.claude/hooks/inject-agent-context.ts +9 -9
  19. package/.claude/scripts/.claude/commands/flow/export-openspec.md +221 -0
  20. package/.claude/scripts/.claude/commands/flow/import-openspec.md +171 -0
  21. package/.claude/scripts/__tests__/openspec.test.js +212 -0
  22. package/.claude/scripts/delta-parser.ts +112 -2
  23. package/.claude/scripts/export-openspec.js +222 -0
  24. package/.claude/scripts/import-openspec.js +272 -0
  25. package/.claude/scripts/validate-scope.sh +200 -0
  26. package/.claude/skills/cc-devflow-orchestrator/SKILL.md +25 -0
  27. package/.claude/skills/flow-dev/SKILL.md +94 -0
  28. package/.claude/skills/flow-init/SKILL.md +105 -0
  29. package/.claude/skills/{workflow/flow-release → flow-release}/SKILL.md +14 -3
  30. package/.claude/skills/flow-spec/SKILL.md +102 -0
  31. package/.claude/skills/utility/npm-release/CLAUDE.md +55 -0
  32. package/.claude/skills/utility/npm-release/SKILL.md +111 -46
  33. package/.claude/skills/utility/npm-release/references/version-decision-guide.md +134 -0
  34. package/.claude/skills/utility/npm-release/scripts/atomic-version-bump.sh +95 -0
  35. package/.claude/skills/utility/npm-release/scripts/validate-version-sync.sh +82 -0
  36. package/.claude/skills/utility/npm-release/scripts/version-decision-tree.sh +44 -0
  37. package/.claude/tsc-cache/70d2fc6d-2936-429b-b529-429f1aae8c88/affected-repos.txt +1 -0
  38. package/.claude/tsc-cache/70d2fc6d-2936-429b-b529-429f1aae8c88/edited-files.log +2 -0
  39. package/CHANGELOG.md +81 -0
  40. package/README.md +7 -1
  41. package/README.zh-CN.md +7 -1
  42. package/bin/cc-devflow-cli.js +154 -0
  43. package/docs/v4.3.0-migration-guide.md +276 -0
  44. package/lib/harness/CLAUDE.md +5 -4
  45. package/lib/harness/__tests__/planner.tdd.test.js +125 -0
  46. package/lib/harness/index.js +4 -2
  47. package/lib/harness/operations/dispatch.js +13 -0
  48. package/lib/harness/operations/plan.js +55 -1
  49. package/lib/harness/operations/release.js +87 -0
  50. package/lib/harness/operations/verify.js +14 -0
  51. package/lib/harness/planner.js +131 -0
  52. package/lib/harness/query.js +126 -0
  53. package/lib/harness/schemas.js +22 -1
  54. package/package.json +1 -1
  55. package/.claude/commands/flow/checklist.md +0 -18
  56. package/.claude/commands/flow/clarify.md +0 -18
  57. package/.claude/commands/flow/new.md +0 -23
  58. package/.claude/commands/flow/quality.md +0 -21
  59. package/.claude/docs/templates/EPIC_TEMPLATE.md +0 -805
  60. package/.claude/docs/templates/PRD_TEMPLATE.md +0 -562
  61. package/.claude/docs/templates/TASKS_TEMPLATE.md +0 -523
  62. package/.claude/docs/templates/TECH_DESIGN_TEMPLATE.md +0 -1019
  63. package/.claude/skills/workflow/CLAUDE.md +0 -24
  64. package/.claude/skills/workflow/flow-dev/SKILL.md +0 -58
  65. package/.claude/skills/workflow/flow-init/SKILL.md +0 -55
  66. package/.claude/skills/workflow/flow-spec/SKILL.md +0 -42
  67. /package/.claude/skills/{domain/attention-refresh → attention-refresh}/SKILL.md +0 -0
  68. /package/.claude/skills/{domain/brainstorming → brainstorming}/SKILL.md +0 -0
  69. /package/.claude/skills/{guardrail/constitution-guardian → constitution-guardian}/SKILL.md +0 -0
  70. /package/.claude/skills/{utility/constitution-quick-ref → constitution-quick-ref}/SKILL.md +0 -0
  71. /package/.claude/skills/{domain/debugging → debugging}/SKILL.md +0 -0
  72. /package/.claude/skills/{utility/file-standards → file-standards}/SKILL.md +0 -0
  73. /package/.claude/skills/{domain/finishing-branch → finishing-branch}/SKILL.md +0 -0
  74. /package/.claude/skills/{workflow/flow-dev → flow-dev}/CLAUDE.md +0 -0
  75. /package/.claude/skills/{workflow/flow-dev → flow-dev}/assets/IMPLEMENTATION_PLAN_TEMPLATE.md +0 -0
  76. /package/.claude/skills/{workflow/flow-dev → flow-dev}/context.jsonl +0 -0
  77. /package/.claude/skills/{workflow/flow-dev → flow-dev}/dev-implementer.jsonl +0 -0
  78. /package/.claude/skills/{workflow/flow-dev → flow-dev}/scripts/entry-gate.sh +0 -0
  79. /package/.claude/skills/{workflow/flow-dev → flow-dev}/scripts/exit-gate.sh +0 -0
  80. /package/.claude/skills/{workflow/flow-dev → flow-dev}/scripts/task-orchestrator.sh +0 -0
  81. /package/.claude/skills/{workflow/flow-fix → flow-fix}/SKILL.md +0 -0
  82. /package/.claude/skills/{workflow/flow-fix → flow-fix}/context.jsonl +0 -0
  83. /package/.claude/skills/{workflow/flow-fix → flow-fix}/references/bug-analyzer.md +0 -0
  84. /package/.claude/skills/{workflow/flow-init → flow-init}/assets/BRAINSTORM_TEMPLATE.md +0 -0
  85. /package/.claude/skills/{workflow/flow-init → flow-init}/assets/INIT_FLOW_TEMPLATE.md +0 -0
  86. /package/.claude/skills/{workflow/flow-init → flow-init}/assets/RESEARCH_TEMPLATE.md +0 -0
  87. /package/.claude/skills/{workflow/flow-init → flow-init}/context.jsonl +0 -0
  88. /package/.claude/skills/{workflow/flow-init → flow-init}/references/flow-researcher.md +0 -0
  89. /package/.claude/skills/{workflow/flow-init → flow-init}/scripts/check-prerequisites.sh +0 -0
  90. /package/.claude/skills/{workflow/flow-init → flow-init}/scripts/consolidate-research.sh +0 -0
  91. /package/.claude/skills/{workflow/flow-init → flow-init}/scripts/create-requirement.sh +0 -0
  92. /package/.claude/skills/{workflow/flow-init → flow-init}/scripts/generate-research-tasks.sh +0 -0
  93. /package/.claude/skills/{workflow/flow-init → flow-init}/scripts/populate-research-tasks.sh +0 -0
  94. /package/.claude/skills/{workflow/flow-init → flow-init}/scripts/validate-research.sh +0 -0
  95. /package/.claude/skills/{workflow/flow-quality → flow-quality}/SKILL.md +0 -0
  96. /package/.claude/skills/{workflow/flow-quality → flow-quality}/context.jsonl +0 -0
  97. /package/.claude/skills/{workflow/flow-quality → flow-quality}/references/code-quality-reviewer.md +0 -0
  98. /package/.claude/skills/{workflow/flow-quality → flow-quality}/references/qa-tester.md +0 -0
  99. /package/.claude/skills/{workflow/flow-quality → flow-quality}/references/security-reviewer.md +0 -0
  100. /package/.claude/skills/{workflow/flow-quality → flow-quality}/references/spec-reviewer.md +0 -0
  101. /package/.claude/skills/{workflow/flow-release → flow-release}/context.jsonl +0 -0
  102. /package/.claude/skills/{workflow/flow-release → flow-release}/references/release-manager.md +0 -0
  103. /package/.claude/skills/{workflow/flow-spec → flow-spec}/CLAUDE.md +0 -0
  104. /package/.claude/skills/{workflow/flow-spec → flow-spec}/context.jsonl +0 -0
  105. /package/.claude/skills/{workflow/flow-spec → flow-spec}/scripts/entry-gate.sh +0 -0
  106. /package/.claude/skills/{workflow/flow-spec → flow-spec}/scripts/exit-gate.sh +0 -0
  107. /package/.claude/skills/{workflow/flow-spec → flow-spec}/scripts/parallel-orchestrator.sh +0 -0
  108. /package/.claude/skills/{workflow/flow-spec → flow-spec}/scripts/team-communication.sh +0 -0
  109. /package/.claude/skills/{workflow/flow-spec → flow-spec}/scripts/team-init.sh +0 -0
  110. /package/.claude/skills/{workflow/flow-spec → flow-spec}/scripts/test-team-mode.sh +0 -0
  111. /package/.claude/skills/{workflow/flow-spec → flow-spec}/team-config.json +0 -0
  112. /package/.claude/skills/{workflow/flow-verify → flow-verify}/CLAUDE.md +0 -0
  113. /package/.claude/skills/{workflow/flow-verify → flow-verify}/SKILL.md +0 -0
  114. /package/.claude/skills/{workflow/flow-verify → flow-verify}/context.jsonl +0 -0
  115. /package/.claude/skills/{utility/fractal-docs → fractal-docs}/SKILL.md +0 -0
  116. /package/.claude/skills/{utility/journey-checker → journey-checker}/SKILL.md +0 -0
  117. /package/.claude/skills/{utility/journey-checker → journey-checker}/pressure-scenarios.md +0 -0
  118. /package/.claude/skills/{domain/receiving-review → receiving-review}/SKILL.md +0 -0
  119. /package/.claude/skills/{utility/skill-creator → skill-creator}/LICENSE.txt +0 -0
  120. /package/.claude/skills/{utility/skill-creator → skill-creator}/SKILL.md +0 -0
  121. /package/.claude/skills/{utility/skill-creator → skill-creator}/references/output-patterns.md +0 -0
  122. /package/.claude/skills/{utility/skill-creator → skill-creator}/references/workflows.md +0 -0
  123. /package/.claude/skills/{utility/skill-creator → skill-creator}/scripts/init_skill.py +0 -0
  124. /package/.claude/skills/{utility/skill-creator → skill-creator}/scripts/package_skill.py +0 -0
  125. /package/.claude/skills/{utility/skill-creator → skill-creator}/scripts/quick_validate.py +0 -0
  126. /package/.claude/skills/{domain/tdd → tdd}/SKILL.md +0 -0
  127. /package/.claude/skills/{guardrail/tdd-enforcer → tdd-enforcer}/SKILL.md +0 -0
  128. /package/.claude/skills/{domain/verification → verification}/SKILL.md +0 -0
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: npm-release
3
- description: Use when ready to publish a new version of cc-devflow npm package to npm registry
3
+ description: Use when ready to publish a new version of cc-devflow npm package to npm registry. Enforces semantic versioning rules, prevents arbitrary version jumps (e.g., 3.0.1→7.0.0), and ensures atomic synchronization across package.json, CHANGELOG.md, and git tags.
4
4
  ---
5
5
 
6
6
  # NPM Release Workflow
@@ -9,7 +9,10 @@ description: Use when ready to publish a new version of cc-devflow npm package t
9
9
 
10
10
  Standardized release process for cc-devflow npm package ensuring consistent versioning, changelog maintenance, and safe publishing.
11
11
 
12
- **Core Principle**: Atomic release - all version markers (package.json, CHANGELOG.md, git tag) must stay in sync.
12
+ **Core Principles**:
13
+ 1. **Atomic release** - All version markers (package.json, CHANGELOG.md, git tag) stay in sync
14
+ 2. **Semantic versioning enforcement** - Prevents arbitrary jumps and format inconsistencies
15
+ 3. **Decision tree validation** - Every version bump follows explicit SemVer rules
13
16
 
14
17
  ## When to Use
15
18
 
@@ -24,18 +27,57 @@ Don't use when:
24
27
  - ❌ Not on main branch
25
28
  - ❌ Pre-release/beta versions (needs adaptation)
26
29
 
27
- ## Release Types
30
+ ## Version Decision Protocol
31
+
32
+ **MANDATORY**: Before any version bump, determine change type using the decision tree.
33
+
34
+ See [references/version-decision-guide.md](references/version-decision-guide.md) for detailed rules and examples.
35
+
36
+ ### Quick Decision Tree
37
+
38
+ ```
39
+ Is this a breaking change?
40
+ ├─ YES → MAJOR bump (X.0.0)
41
+ └─ NO → Is this a new feature?
42
+ ├─ YES → MINOR bump (X.Y.0)
43
+ └─ NO → PATCH bump (X.Y.Z)
44
+ ```
45
+
46
+ ### Release Types
28
47
 
29
48
  Follow [Semantic Versioning](https://semver.org/):
30
49
 
31
50
  | Type | Version Change | When |
32
51
  |------|---------------|------|
33
- | **Patch** | 2.4.3 → 2.4.4 | Bug fixes, minor improvements |
34
- | **Minor** | 2.4.42.5.0 | New features, backward compatible |
35
- | **Major** | 2.5.0 → 3.0.0 | Breaking changes |
52
+ | **Patch** | 4.2.04.2.1 | Bug fixes, minor improvements |
53
+ | **Minor** | 4.2.14.3.0 | New features, backward compatible |
54
+ | **Major** | 4.3.0 → 5.0.0 | Breaking changes |
55
+
56
+ ### Anti-Patterns (FORBIDDEN)
57
+
58
+ ❌ **Arbitrary jumps**: 3.0.1 → 7.0.0 (no justification)
59
+ ❌ **Skipping versions**: 4.2.0 → 4.4.0 (skipped 4.3.0)
60
+ ❌ **Inconsistent formats**: v1.0, 1.0.0, release-1.0 (mixed formats)
36
61
 
37
62
  ## Complete Workflow
38
63
 
64
+ ### Phase 0: Version Validation (MANDATORY)
65
+
66
+ **Before any changes**, validate current state and determine next version:
67
+
68
+ ```bash
69
+ # 1. Validate version synchronization
70
+ bash .claude/skills/utility/npm-release/scripts/validate-version-sync.sh
71
+
72
+ # 2. Determine change type (patch/minor/major)
73
+ # Use decision tree in references/version-decision-guide.md
74
+
75
+ # 3. Calculate next version
76
+ bash .claude/skills/utility/npm-release/scripts/version-decision-tree.sh $(grep -o '"version": *"[^"]*"' package.json | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+') <patch|minor|major>
77
+ ```
78
+
79
+ **STOP if validation fails** - Fix inconsistencies before proceeding.
80
+
39
81
  ### Phase 1: Pre-Release Checks
40
82
 
41
83
  ```bash
@@ -45,7 +87,7 @@ git status
45
87
 
46
88
  # 2. Check current version
47
89
  cat package.json | grep version
48
- # e.g., "version": "2.4.3"
90
+ # e.g., "version": "4.2.0"
49
91
 
50
92
  # 3. Review recent changes
51
93
  git log --oneline -10
@@ -56,9 +98,29 @@ git log --oneline -10
56
98
  - Uncommitted changes exist
57
99
  - Unpushed commits exist
58
100
 
59
- ### Phase 2: Version Updates
101
+ ### Phase 2: Atomic Version Bump
102
+
103
+ **Use the atomic bump script** (recommended):
104
+
105
+ ```bash
106
+ # Automatically updates package.json + CHANGELOG.md
107
+ bash .claude/skills/utility/npm-release/scripts/atomic-version-bump.sh <patch|minor|major> "Brief description"
108
+
109
+ # Example:
110
+ bash .claude/skills/utility/npm-release/scripts/atomic-version-bump.sh minor "Add export command"
111
+ ```
112
+
113
+ **Or manual update** (if script unavailable):
114
+
115
+ **Step 1: Update package.json**
116
+
117
+ ```bash
118
+ npm version patch --no-git-tag-version # For patch release
119
+ npm version minor --no-git-tag-version # For minor release
120
+ npm version major --no-git-tag-version # For major release
121
+ ```
60
122
 
61
- **Step 1: Update CHANGELOG.md**
123
+ **Step 2: Update CHANGELOG.md**
62
124
 
63
125
  Add new version section at the top (after `---`):
64
126
 
@@ -78,22 +140,6 @@ Brief description of main changes.
78
140
  - ✅ Benefit 2
79
141
  ```
80
142
 
81
- **Step 2: Update package.json**
82
-
83
- ```bash
84
- # Manually edit or use npm version
85
- npm version patch --no-git-tag-version # For patch release
86
- npm version minor --no-git-tag-version # For minor release
87
- npm version major --no-git-tag-version # For major release
88
- ```
89
-
90
- Or edit directly:
91
- ```json
92
- {
93
- "version": "X.Y.Z"
94
- }
95
- ```
96
-
97
143
  ### Phase 3: Git Operations
98
144
 
99
145
  **Step 1: Create Release Commit**
@@ -188,56 +234,75 @@ npm view cc-devflow version
188
234
 
189
235
  | Step | Command | Purpose |
190
236
  |------|---------|---------|
237
+ | **Validate sync** | `bash scripts/validate-version-sync.sh` | Check version consistency |
238
+ | **Decide version** | `bash scripts/version-decision-tree.sh <current> <type>` | Calculate next version |
239
+ | **Atomic bump** | `bash scripts/atomic-version-bump.sh <type> "desc"` | Update all markers |
191
240
  | Check status | `git status` | Verify clean state |
192
241
  | Check version | `grep version package.json` | Current version |
193
- | Bump version | Edit package.json | Update version number |
194
- | Update changelog | Edit CHANGELOG.md | Document changes |
195
242
  | Create commit | `git commit -m "chore(release): ..."` | Commit version bump |
196
243
  | Create tag | `git tag -a vX.Y.Z -m "..."` | Tag release |
197
244
  | Push commits | `git push origin main` | Push to GitHub |
198
245
  | Push tags | `git push origin vX.Y.Z` | Push tag to GitHub |
199
246
  | Publish npm | `npm publish` | Publish to registry |
200
247
 
248
+ ## Version Management Scripts
249
+
250
+ Three scripts enforce version discipline:
251
+
252
+ 1. **validate-version-sync.sh** - Checks package.json, git tags, CHANGELOG.md consistency
253
+ 2. **version-decision-tree.sh** - Calculates next version following SemVer rules
254
+ 3. **atomic-version-bump.sh** - Updates all version markers atomically
255
+
256
+ **Usage**:
257
+ ```bash
258
+ # Check current state
259
+ bash .claude/skills/utility/npm-release/scripts/validate-version-sync.sh
260
+
261
+ # Calculate next version
262
+ bash .claude/skills/utility/npm-release/scripts/version-decision-tree.sh 4.2.0 minor
263
+ # Output: 4.3.0
264
+
265
+ # Atomic bump (recommended)
266
+ bash .claude/skills/utility/npm-release/scripts/atomic-version-bump.sh minor "Add export command"
267
+ ```
268
+
201
269
  ## Common Mistakes
202
270
 
203
- ### ❌ Mistake 1: Forgetting to Update CHANGELOG.md
271
+ ### ❌ Mistake 1: Arbitrary Version Jumps
204
272
 
205
- **Problem**: Version bumped but no changelog entry
273
+ **Problem**: Version jumps from 3.0.1 to 7.0.0 without justification
206
274
 
207
- **Fix**: Always update CHANGELOG.md BEFORE committing
275
+ **Fix**: Use version-decision-tree.sh to calculate correct next version based on change type
208
276
 
209
277
  ### ❌ Mistake 2: Inconsistent Version Numbers
210
278
 
211
- **Problem**: package.json shows 2.4.4 but CHANGELOG.md shows 2.4.3
279
+ **Problem**: package.json shows 4.2.1 but CHANGELOG.md shows 4.2.0
280
+
281
+ **Fix**: Use atomic-version-bump.sh to update all markers simultaneously
282
+
283
+ ### ❌ Mistake 3: Forgetting to Update CHANGELOG.md
284
+
285
+ **Problem**: Version bumped but no changelog entry
212
286
 
213
- **Fix**: Double-check all version numbers match before committing
287
+ **Fix**: Always update CHANGELOG.md BEFORE committing (atomic-version-bump.sh does this automatically)
214
288
 
215
- ### ❌ Mistake 3: Pushing Tag Before Commit
289
+ ### ❌ Mistake 4: Pushing Tag Before Commit
216
290
 
217
291
  **Problem**: Tag points to wrong commit
218
292
 
219
293
  **Fix**: Always commit first, then tag, then push both together
220
294
 
221
- ### ❌ Mistake 4: Not Testing npm publish
295
+ ### ❌ Mistake 5: Not Testing npm publish
222
296
 
223
297
  **Problem**: Published package is broken
224
298
 
225
299
  **Fix**: Run `npm publish --dry-run` first to catch issues
226
300
 
227
- ### ❌ Mistake 5: Network Timeout During Push
301
+ ### ❌ Mistake 6: Inconsistent Tag Format
228
302
 
229
- **Problem**: `Failed to connect to github.com port 443`
303
+ **Problem**: Mixed formats like v1.0, 1.0.0, release-1.0
230
304
 
231
- **Fix**:
232
- ```bash
233
- # Option 1: Retry after network stabilizes
234
- git push origin main
235
- git push origin vX.Y.Z
236
-
237
- # Option 2: Switch to SSH (if HTTPS blocked)
238
- git remote set-url origin git@github.com:Dimon94/cc-devflow.git
239
- git push origin main
240
- ```
305
+ **Fix**: Always use vX.Y.Z format (e.g., v4.2.0). validate-version-sync.sh detects format inconsistencies
241
306
 
242
307
  ## Network Troubleshooting
243
308
 
@@ -0,0 +1,134 @@
1
+ # Version Decision Reference
2
+
3
+ ## Semantic Versioning Rules
4
+
5
+ **Format**: `MAJOR.MINOR.PATCH` (e.g., 4.2.0)
6
+
7
+ ### When to Bump Each Number
8
+
9
+ | Version | Increment When | Examples |
10
+ |---------|---------------|----------|
11
+ | **MAJOR** | Breaking changes that require user action | API redesign, removed features, incompatible changes |
12
+ | **MINOR** | New features, backward compatible | New commands, new options, enhanced functionality |
13
+ | **PATCH** | Bug fixes, minor improvements | Fix crashes, improve error messages, documentation |
14
+
15
+ ### Decision Tree
16
+
17
+ ```
18
+ Is this a breaking change?
19
+ ├─ YES → MAJOR bump (X.0.0)
20
+ └─ NO → Is this a new feature?
21
+ ├─ YES → MINOR bump (X.Y.0)
22
+ └─ NO → PATCH bump (X.Y.Z)
23
+ ```
24
+
25
+ ## Common Scenarios
26
+
27
+ ### Scenario 1: Bug Fix
28
+ **Current**: 4.2.0
29
+ **Change**: Fix login crash
30
+ **Decision**: PATCH → **4.2.1**
31
+
32
+ ### Scenario 2: New Feature (Compatible)
33
+ **Current**: 4.2.1
34
+ **Change**: Add `/flow:export` command
35
+ **Decision**: MINOR → **4.3.0**
36
+
37
+ ### Scenario 3: Breaking Change
38
+ **Current**: 4.3.0
39
+ **Change**: Remove deprecated `/flow-new` command
40
+ **Decision**: MAJOR → **5.0.0**
41
+
42
+ ### Scenario 4: Multiple Changes
43
+ **Current**: 4.3.0
44
+ **Changes**:
45
+ - Fix 3 bugs (PATCH)
46
+ - Add 2 new features (MINOR)
47
+ - No breaking changes
48
+
49
+ **Decision**: Take highest level → MINOR → **4.4.0**
50
+
51
+ ## Anti-Patterns (FORBIDDEN)
52
+
53
+ ### ❌ Arbitrary Jumps
54
+ ```
55
+ 3.0.1 → 7.0.0 # WRONG: No justification for jumping 4 major versions
56
+ ```
57
+
58
+ **Correct**:
59
+ ```
60
+ 3.0.1 → 4.0.0 # If breaking change
61
+ 3.0.1 → 3.1.0 # If new feature
62
+ 3.0.1 → 3.0.2 # If bug fix
63
+ ```
64
+
65
+ ### ❌ Skipping Versions
66
+ ```
67
+ 4.2.0 → 4.4.0 # WRONG: Skipped 4.3.0
68
+ ```
69
+
70
+ **Correct**:
71
+ ```
72
+ 4.2.0 → 4.3.0 → 4.4.0 # Sequential
73
+ ```
74
+
75
+ ### ❌ Inconsistent Formats
76
+ ```
77
+ v1.0 # WRONG: Missing patch
78
+ 1.0.0 # WRONG: Missing 'v' prefix in git tag
79
+ release-1.0 # WRONG: Non-standard format
80
+ ```
81
+
82
+ **Correct**:
83
+ ```
84
+ Git tag: v4.2.0
85
+ package.json: "version": "4.2.0"
86
+ CHANGELOG: ## [4.2.0] - 2026-03-12
87
+ ```
88
+
89
+ ## Version Validation Checklist
90
+
91
+ Before bumping version, verify:
92
+
93
+ - [ ] Change type is clear (patch/minor/major)
94
+ - [ ] Version increment follows SemVer rules
95
+ - [ ] No arbitrary jumps (e.g., 3.x → 7.x)
96
+ - [ ] All version markers will be updated atomically
97
+ - [ ] CHANGELOG.md entry prepared
98
+ - [ ] Git tag format will be `vX.Y.Z`
99
+
100
+ ## Breaking Change Examples
101
+
102
+ **Breaking changes require MAJOR bump**:
103
+
104
+ - Removing commands or options
105
+ - Changing command syntax
106
+ - Changing output format (breaking scripts)
107
+ - Removing configuration options
108
+ - Changing default behavior significantly
109
+ - Requiring new dependencies
110
+ - Dropping support for Node versions
111
+
112
+ **NOT breaking changes** (MINOR or PATCH):
113
+
114
+ - Adding new commands (MINOR)
115
+ - Adding new options with defaults (MINOR)
116
+ - Deprecation warnings (MINOR)
117
+ - Bug fixes (PATCH)
118
+ - Performance improvements (PATCH)
119
+ - Documentation updates (PATCH)
120
+
121
+ ## Version History Analysis
122
+
123
+ Use this to understand past version decisions:
124
+
125
+ ```bash
126
+ # View version history
127
+ git tag --sort=v:refname
128
+
129
+ # View changes between versions
130
+ git log v4.1.0..v4.2.0 --oneline
131
+
132
+ # Check CHANGELOG for version rationale
133
+ grep -A 10 "## \[4.2.0\]" CHANGELOG.md
134
+ ```
@@ -0,0 +1,95 @@
1
+ #!/usr/bin/env bash
2
+ # Atomic Version Bump - Updates all version markers in one transaction
3
+ # Ensures package.json, CHANGELOG.md stay in sync
4
+
5
+ set -euo pipefail
6
+
7
+ CHANGE_TYPE="${1:-}"
8
+ CHANGE_DESCRIPTION="${2:-}"
9
+
10
+ if [[ -z "$CHANGE_TYPE" ]]; then
11
+ echo "Usage: $0 <patch|minor|major> [description]"
12
+ echo ""
13
+ echo "Examples:"
14
+ echo " $0 patch 'Fix login bug'"
15
+ echo " $0 minor 'Add user dashboard'"
16
+ echo " $0 major 'Redesign API'"
17
+ exit 1
18
+ fi
19
+
20
+ # Get script directory
21
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
22
+
23
+ # 1. Get current version
24
+ CURRENT_VERSION=$(grep -o '"version": *"[^"]*"' package.json | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')
25
+ echo "📦 Current version: $CURRENT_VERSION"
26
+
27
+ # 2. Calculate next version using decision tree
28
+ NEXT_VERSION=$("$SCRIPT_DIR/version-decision-tree.sh" "$CURRENT_VERSION" "$CHANGE_TYPE")
29
+ echo "🎯 Next version: $NEXT_VERSION"
30
+
31
+ # 3. Validate version sync before proceeding
32
+ echo ""
33
+ echo "🔍 Pre-flight validation..."
34
+ if ! "$SCRIPT_DIR/validate-version-sync.sh"; then
35
+ echo ""
36
+ echo "❌ Version sync validation failed. Fix inconsistencies before bumping."
37
+ exit 1
38
+ fi
39
+
40
+ # 4. Update package.json
41
+ echo ""
42
+ echo "📝 Updating package.json..."
43
+ sed -i.bak "s/\"version\": \"$CURRENT_VERSION\"/\"version\": \"$NEXT_VERSION\"/" package.json
44
+ rm package.json.bak
45
+
46
+ # 5. Prepare CHANGELOG.md entry
47
+ CURRENT_DATE=$(date +%Y-%m-%d)
48
+ CHANGELOG_ENTRY="## [$NEXT_VERSION] - $CURRENT_DATE
49
+
50
+ ### 🎯 ${CHANGE_DESCRIPTION:-Version $NEXT_VERSION}
51
+
52
+ #### Changed
53
+ - TODO: Add change details
54
+
55
+ ---
56
+
57
+ "
58
+
59
+ # Insert after the first "---" line in CHANGELOG.md
60
+ if [[ -f "CHANGELOG.md" ]]; then
61
+ echo "📝 Updating CHANGELOG.md..."
62
+ # Create temp file with new entry
63
+ awk -v entry="$CHANGELOG_ENTRY" '
64
+ /^---$/ && !inserted {
65
+ print
66
+ print entry
67
+ inserted=1
68
+ next
69
+ }
70
+ {print}
71
+ ' CHANGELOG.md > CHANGELOG.md.tmp
72
+ mv CHANGELOG.md.tmp CHANGELOG.md
73
+ else
74
+ echo "⚠️ CHANGELOG.md not found, skipping"
75
+ fi
76
+
77
+ # 6. Validate post-update
78
+ echo ""
79
+ echo "🔍 Post-update validation..."
80
+ UPDATED_VERSION=$(grep -o '"version": *"[^"]*"' package.json | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')
81
+
82
+ if [[ "$UPDATED_VERSION" != "$NEXT_VERSION" ]]; then
83
+ echo "❌ Version update failed: expected $NEXT_VERSION, got $UPDATED_VERSION"
84
+ exit 1
85
+ fi
86
+
87
+ echo ""
88
+ echo "✅ Version bumped successfully: $CURRENT_VERSION → $NEXT_VERSION"
89
+ echo ""
90
+ echo "📋 Next steps:"
91
+ echo " 1. Edit CHANGELOG.md to add detailed changes"
92
+ echo " 2. Review changes: git diff"
93
+ echo " 3. Commit: git add package.json CHANGELOG.md && git commit -m 'chore(release): bump version to $NEXT_VERSION'"
94
+ echo " 4. Tag: git tag -a v$NEXT_VERSION -m 'Release v$NEXT_VERSION'"
95
+ echo " 5. Push: git push origin main && git push origin v$NEXT_VERSION"
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env bash
2
+ # Version Sync Validator - Ensures all version markers are consistent
3
+ # Checks: package.json, git tags, CHANGELOG.md
4
+
5
+ set -euo pipefail
6
+
7
+ # Colors
8
+ RED='\033[0;31m'
9
+ GREEN='\033[0;32m'
10
+ YELLOW='\033[1;33m'
11
+ NC='\033[0m' # No Color
12
+
13
+ ERRORS=0
14
+
15
+ echo "🔍 Validating version synchronization..."
16
+ echo ""
17
+
18
+ # 1. Extract version from package.json
19
+ if [[ ! -f "package.json" ]]; then
20
+ echo -e "${RED}❌ package.json not found${NC}"
21
+ exit 1
22
+ fi
23
+
24
+ PKG_VERSION=$(grep -o '"version": *"[^"]*"' package.json | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')
25
+ echo "📦 package.json version: $PKG_VERSION"
26
+
27
+ # 2. Check latest git tag
28
+ LATEST_TAG=$(git tag --sort=-v:refname | head -1 || echo "")
29
+ if [[ -z "$LATEST_TAG" ]]; then
30
+ echo -e "${YELLOW}⚠️ No git tags found${NC}"
31
+ else
32
+ TAG_VERSION="${LATEST_TAG#v}" # Remove 'v' prefix
33
+ echo "🏷️ Latest git tag: $LATEST_TAG ($TAG_VERSION)"
34
+
35
+ if [[ "$PKG_VERSION" != "$TAG_VERSION" ]]; then
36
+ echo -e "${RED}❌ Version mismatch: package.json ($PKG_VERSION) != git tag ($TAG_VERSION)${NC}"
37
+ ((ERRORS++))
38
+ else
39
+ echo -e "${GREEN}✅ package.json and git tag match${NC}"
40
+ fi
41
+ fi
42
+
43
+ # 3. Check CHANGELOG.md
44
+ if [[ ! -f "CHANGELOG.md" ]]; then
45
+ echo -e "${YELLOW}⚠️ CHANGELOG.md not found${NC}"
46
+ else
47
+ # Extract first version from CHANGELOG (after the header)
48
+ # macOS grep doesn't support -P, use sed instead
49
+ CHANGELOG_VERSION=$(sed -n 's/^## \[\([0-9]\+\.[0-9]\+\.[0-9]\+\)\].*/\1/p' CHANGELOG.md | head -1)
50
+
51
+ if [[ -z "$CHANGELOG_VERSION" ]]; then
52
+ echo -e "${YELLOW}⚠️ No version found in CHANGELOG.md${NC}"
53
+ else
54
+ echo "📝 CHANGELOG.md latest: $CHANGELOG_VERSION"
55
+
56
+ if [[ "$PKG_VERSION" != "$CHANGELOG_VERSION" ]]; then
57
+ echo -e "${RED}❌ Version mismatch: package.json ($PKG_VERSION) != CHANGELOG.md ($CHANGELOG_VERSION)${NC}"
58
+ ((ERRORS++))
59
+ else
60
+ echo -e "${GREEN}✅ package.json and CHANGELOG.md match${NC}"
61
+ fi
62
+ fi
63
+ fi
64
+
65
+ # 4. Check for version format consistency in git tags
66
+ echo ""
67
+ echo "🔍 Checking git tag format consistency..."
68
+ INCONSISTENT_TAGS=$(git tag | grep -v '^v[0-9]\+\.[0-9]\+\.[0-9]\+$' || true)
69
+ if [[ -n "$INCONSISTENT_TAGS" ]]; then
70
+ echo -e "${YELLOW}⚠️ Found tags with inconsistent format:${NC}"
71
+ echo "$INCONSISTENT_TAGS" | sed 's/^/ /'
72
+ echo -e "${YELLOW} Expected format: vX.Y.Z (e.g., v4.2.0)${NC}"
73
+ fi
74
+
75
+ echo ""
76
+ if [[ $ERRORS -eq 0 ]]; then
77
+ echo -e "${GREEN}✅ All version markers are synchronized${NC}"
78
+ exit 0
79
+ else
80
+ echo -e "${RED}❌ Found $ERRORS version synchronization error(s)${NC}"
81
+ exit 1
82
+ fi
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env bash
2
+ # Version Decision Tree - Semantic Versioning Enforcer
3
+ # Prevents arbitrary version jumps by enforcing SemVer rules
4
+
5
+ set -euo pipefail
6
+
7
+ CURRENT_VERSION="${1:-}"
8
+ CHANGE_TYPE="${2:-}"
9
+
10
+ if [[ -z "$CURRENT_VERSION" || -z "$CHANGE_TYPE" ]]; then
11
+ echo "Usage: $0 <current-version> <patch|minor|major>"
12
+ exit 1
13
+ fi
14
+
15
+ # Parse current version
16
+ if [[ ! "$CURRENT_VERSION" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
17
+ echo "❌ Invalid version format: $CURRENT_VERSION"
18
+ echo " Expected: X.Y.Z (e.g., 4.2.0)"
19
+ exit 1
20
+ fi
21
+
22
+ MAJOR="${BASH_REMATCH[1]}"
23
+ MINOR="${BASH_REMATCH[2]}"
24
+ PATCH="${BASH_REMATCH[3]}"
25
+
26
+ # Calculate next version based on change type
27
+ case "$CHANGE_TYPE" in
28
+ patch)
29
+ NEXT_VERSION="$MAJOR.$MINOR.$((PATCH + 1))"
30
+ ;;
31
+ minor)
32
+ NEXT_VERSION="$MAJOR.$((MINOR + 1)).0"
33
+ ;;
34
+ major)
35
+ NEXT_VERSION="$((MAJOR + 1)).0.0"
36
+ ;;
37
+ *)
38
+ echo "❌ Invalid change type: $CHANGE_TYPE"
39
+ echo " Expected: patch, minor, or major"
40
+ exit 1
41
+ ;;
42
+ esac
43
+
44
+ echo "$NEXT_VERSION"
@@ -0,0 +1,2 @@
1
+ 1773366329 Edit /Users/dimon/001Area/80-CodeWorld/002-devflow/cc-devflow/package.json root
2
+ 1773366437 Edit /Users/dimon/001Area/80-CodeWorld/002-devflow/cc-devflow/package.json root