cc-devflow 2.4.3 → 2.4.6
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/.claude/CLAUDE.md +3 -2
- package/.claude/agents/bug-analyzer.md +0 -1
- package/.claude/agents/compatibility-checker.md +0 -1
- package/.claude/agents/flow-researcher.md +132 -0
- package/.claude/agents/impact-analyzer.md +0 -1
- package/.claude/commands/flow-fix.md +1 -1
- package/.claude/commands/flow-init.md +33 -65
- package/.claude/commands/flow-new.md +2 -3
- package/.claude/commands/git-commit.md +425 -0
- package/.claude/docs/guides/NEW_TROUBLESHOOTING.md +4 -4
- package/.claude/docs/templates/INIT_FLOW_TEMPLATE.md +17 -40
- package/.claude/docs/templates/NEW_ORCHESTRATION_TEMPLATE.md +2 -3
- package/.claude/rules/devflow-conventions.md +3 -6
- package/.claude/scripts/generate-status-report.sh +7 -7
- package/.claude/scripts/populate-research-tasks.sh +63 -38
- package/.claude/scripts/recover-workflow.sh +18 -12
- package/.claude/skills/npm-release/SKILL.md +314 -0
- package/.claude/skills/writing-skills/SKILL.md +655 -0
- package/.claude/skills/writing-skills/anthropic-best-practices.md +1150 -0
- package/.claude/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
- package/.claude/skills/writing-skills/graphviz-conventions.dot +172 -0
- package/.claude/skills/writing-skills/persuasion-principles.md +187 -0
- package/.claude/skills/writing-skills/render-graphs.js +168 -0
- package/.claude/skills/writing-skills/testing-skills-with-subagents.md +384 -0
- package/CHANGELOG.md +76 -0
- package/README.md +12 -0
- package/README.zh-CN.md +12 -0
- package/docs/commands/flow-init.md +14 -10
- package/docs/commands/flow-init.zh-CN.md +12 -8
- package/package.json +2 -2
- package/.claude/tsc-cache/6e64f818-6398-49ca-8623-581a9af85c44/edited-files.log +0 -1
- package/.claude/tsc-cache/777aa1de-497e-411b-a40f-13b74efcec58/edited-files.log +0 -2
- package/.claude/tsc-cache/795ba6e3-b98a-423b-bab2-51aa62812569/edited-files.log +0 -1
- package/.claude/tsc-cache/ae335694-be5a-4ba4-a1a0-b676c09a7906/edited-files.log +0 -1
|
@@ -72,24 +72,44 @@ def extract_task_sections(markdown_content: str) -> List[Dict[str, str]]:
|
|
|
72
72
|
从 research-summary.md 中提取任务章节信息。
|
|
73
73
|
|
|
74
74
|
期望格式:
|
|
75
|
-
###
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
### R001 — 输入框架构重构
|
|
76
|
+
- **Decision**: 全面重构方案
|
|
77
|
+
- **Rationale**:
|
|
78
|
+
- 当前实现仅207行...
|
|
79
|
+
- **Alternatives Considered**:
|
|
80
|
+
- 渐进式增强...
|
|
79
81
|
"""
|
|
80
82
|
sections = []
|
|
81
83
|
current_section = None
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
#
|
|
86
|
-
|
|
87
|
-
#
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
84
|
+
current_field = None
|
|
85
|
+
|
|
86
|
+
# 匹配任务标题(兼容历史 RT-001):
|
|
87
|
+
# - ### R001 — Title
|
|
88
|
+
# - ### R001: Title
|
|
89
|
+
# - ### R001 - Title
|
|
90
|
+
# - ### RT-001: Title (legacy)
|
|
91
|
+
task_header = re.compile(r"^###\s+(?P<id>R\d{3}|RT-\d{3})\s*(?:[:—-])\s*(?P<title>.+)$")
|
|
92
|
+
|
|
93
|
+
# 匹配字段头(兼容是否带 bullet):
|
|
94
|
+
# - - **Decision**: xxx
|
|
95
|
+
# - - **Rationale**:
|
|
96
|
+
# - - **Alternatives Considered**:
|
|
97
|
+
field_header = re.compile(
|
|
98
|
+
r"^(?:[-*]\s*)?\*\*(?P<label>决策|Decision|理由|Rationale|备选方案|Alternatives(?:\s+Considered)?|来源|Source)\*\*:\s*(?P<value>.*)$"
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
def normalize_task_id(raw: str) -> str:
|
|
102
|
+
if raw.startswith("RT-"):
|
|
103
|
+
return f"R{raw.split('-', 1)[1]}"
|
|
104
|
+
return raw
|
|
105
|
+
|
|
106
|
+
def normalize_list_item(line: str) -> str:
|
|
107
|
+
line = line.strip()
|
|
108
|
+
line = re.sub(r"^[-*]\s+", "", line)
|
|
109
|
+
return line.strip()
|
|
91
110
|
|
|
92
111
|
for line in markdown_content.splitlines():
|
|
112
|
+
raw_line = line
|
|
93
113
|
line = line.strip()
|
|
94
114
|
|
|
95
115
|
# 检测新任务章节
|
|
@@ -97,9 +117,10 @@ def extract_task_sections(markdown_content: str) -> List[Dict[str, str]]:
|
|
|
97
117
|
if task_match:
|
|
98
118
|
if current_section:
|
|
99
119
|
sections.append(current_section)
|
|
120
|
+
current_field = None
|
|
100
121
|
current_section = {
|
|
101
|
-
"id": task_match.group(
|
|
102
|
-
"title": task_match.group(
|
|
122
|
+
"id": normalize_task_id(task_match.group("id")),
|
|
123
|
+
"title": task_match.group("title"),
|
|
103
124
|
"decision": "",
|
|
104
125
|
"rationale": "",
|
|
105
126
|
"alternatives": "",
|
|
@@ -109,31 +130,35 @@ def extract_task_sections(markdown_content: str) -> List[Dict[str, str]]:
|
|
|
109
130
|
if not current_section:
|
|
110
131
|
continue
|
|
111
132
|
|
|
112
|
-
#
|
|
113
|
-
|
|
114
|
-
if
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
133
|
+
# 检测字段头
|
|
134
|
+
field_match = field_header.match(line)
|
|
135
|
+
if field_match:
|
|
136
|
+
label = field_match.group("label").strip().lower()
|
|
137
|
+
value = (field_match.group("value") or "").strip()
|
|
138
|
+
|
|
139
|
+
if label in {"来源", "source"}:
|
|
140
|
+
current_field = None
|
|
141
|
+
continue
|
|
142
|
+
if label in {"决策", "decision"}:
|
|
143
|
+
current_field = "decision"
|
|
144
|
+
elif label in {"理由", "rationale"}:
|
|
145
|
+
current_field = "rationale"
|
|
146
|
+
else:
|
|
147
|
+
current_field = "alternatives"
|
|
148
|
+
|
|
149
|
+
if value:
|
|
150
|
+
current_section[current_field] = value
|
|
122
151
|
continue
|
|
123
152
|
|
|
124
|
-
#
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
# 继续累积多行备选方案
|
|
135
|
-
if current_section.get("alternatives") and line and not line.startswith("**"):
|
|
136
|
-
current_section["alternatives"] += " " + line.strip()
|
|
153
|
+
# 累积字段内容(支持列表项)
|
|
154
|
+
if current_field and line:
|
|
155
|
+
item = normalize_list_item(raw_line)
|
|
156
|
+
if not item:
|
|
157
|
+
continue
|
|
158
|
+
if current_section[current_field]:
|
|
159
|
+
current_section[current_field] += "\n" + item
|
|
160
|
+
else:
|
|
161
|
+
current_section[current_field] = item
|
|
137
162
|
|
|
138
163
|
# 添加最后一个章节
|
|
139
164
|
if current_section:
|
|
@@ -164,16 +164,19 @@ detect_workflow_status() {
|
|
|
164
164
|
|
|
165
165
|
# 检查任务进度
|
|
166
166
|
if [[ -f "$REQ_DIR/TASKS.md" ]]; then
|
|
167
|
-
|
|
168
|
-
local tasks_completed
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
167
|
+
# 统计已完成任务 (- [x] 标记)
|
|
168
|
+
local tasks_completed=$(grep -c "^\- \[x\]" "$REQ_DIR/TASKS.md" 2>/dev/null || echo "0")
|
|
169
|
+
|
|
170
|
+
# 统计待完成任务 (- [ ] 标记)
|
|
171
|
+
local tasks_pending=$(grep -c "^\- \[ \]" "$REQ_DIR/TASKS.md" 2>/dev/null || echo "0")
|
|
172
|
+
|
|
173
|
+
# 计算任务总数
|
|
174
|
+
local tasks_total=$((tasks_completed + tasks_pending))
|
|
172
175
|
|
|
173
176
|
echo -e "${BOLD}任务进度:${NC}"
|
|
174
177
|
echo -e " 总任务数: $tasks_total"
|
|
175
178
|
echo -e " 已完成: $tasks_completed"
|
|
176
|
-
echo -e " 未完成: $
|
|
179
|
+
echo -e " 未完成: $tasks_pending"
|
|
177
180
|
echo ""
|
|
178
181
|
fi
|
|
179
182
|
|
|
@@ -235,13 +238,16 @@ analyze_recovery_strategy() {
|
|
|
235
238
|
development|dev_complete)
|
|
236
239
|
# 检查是否有未完成的任务
|
|
237
240
|
if [[ -f "$REQ_DIR/TASKS.md" ]]; then
|
|
238
|
-
|
|
239
|
-
local tasks_completed
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
241
|
+
# 统计已完成任务 (- [x] 标记)
|
|
242
|
+
local tasks_completed=$(grep -c "^\- \[x\]" "$REQ_DIR/TASKS.md" 2>/dev/null || echo "0")
|
|
243
|
+
|
|
244
|
+
# 统计待完成任务 (- [ ] 标记)
|
|
245
|
+
local tasks_pending=$(grep -c "^\- \[ \]" "$REQ_DIR/TASKS.md" 2>/dev/null || echo "0")
|
|
246
|
+
|
|
247
|
+
# 计算任务总数
|
|
248
|
+
local tasks_total=$((tasks_completed + tasks_pending))
|
|
243
249
|
|
|
244
|
-
if [[ $
|
|
250
|
+
if [[ $tasks_pending -gt 0 ]]; then
|
|
245
251
|
echo -e "${CYAN}建议: 继续开发 (恢复未完成任务)${NC}"
|
|
246
252
|
echo "dev"
|
|
247
253
|
else
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: npm-release
|
|
3
|
+
description: Use when ready to publish a new version of cc-devflow npm package to npm registry
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# NPM Release Workflow
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Standardized release process for cc-devflow npm package ensuring consistent versioning, changelog maintenance, and safe publishing.
|
|
11
|
+
|
|
12
|
+
**Core Principle**: Atomic release - all version markers (package.json, CHANGELOG.md, git tag) must stay in sync.
|
|
13
|
+
|
|
14
|
+
## When to Use
|
|
15
|
+
|
|
16
|
+
Use this skill when:
|
|
17
|
+
- ✅ Ready to release a new version of cc-devflow
|
|
18
|
+
- ✅ All changes committed and pushed
|
|
19
|
+
- ✅ On main branch with clean working directory
|
|
20
|
+
- ✅ Need to publish to npm registry
|
|
21
|
+
|
|
22
|
+
Don't use when:
|
|
23
|
+
- ❌ Working directory has uncommitted changes
|
|
24
|
+
- ❌ Not on main branch
|
|
25
|
+
- ❌ Pre-release/beta versions (needs adaptation)
|
|
26
|
+
|
|
27
|
+
## Release Types
|
|
28
|
+
|
|
29
|
+
Follow [Semantic Versioning](https://semver.org/):
|
|
30
|
+
|
|
31
|
+
| Type | Version Change | When |
|
|
32
|
+
|------|---------------|------|
|
|
33
|
+
| **Patch** | 2.4.3 → 2.4.4 | Bug fixes, minor improvements |
|
|
34
|
+
| **Minor** | 2.4.4 → 2.5.0 | New features, backward compatible |
|
|
35
|
+
| **Major** | 2.5.0 → 3.0.0 | Breaking changes |
|
|
36
|
+
|
|
37
|
+
## Complete Workflow
|
|
38
|
+
|
|
39
|
+
### Phase 1: Pre-Release Checks
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# 1. Verify git status
|
|
43
|
+
git status
|
|
44
|
+
# MUST show: "On branch main", "working tree clean"
|
|
45
|
+
|
|
46
|
+
# 2. Check current version
|
|
47
|
+
cat package.json | grep version
|
|
48
|
+
# e.g., "version": "2.4.3"
|
|
49
|
+
|
|
50
|
+
# 3. Review recent changes
|
|
51
|
+
git log --oneline -10
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**STOP if**:
|
|
55
|
+
- Not on main branch
|
|
56
|
+
- Uncommitted changes exist
|
|
57
|
+
- Unpushed commits exist
|
|
58
|
+
|
|
59
|
+
### Phase 2: Version Updates
|
|
60
|
+
|
|
61
|
+
**Step 1: Update CHANGELOG.md**
|
|
62
|
+
|
|
63
|
+
Add new version section at the top (after `---`):
|
|
64
|
+
|
|
65
|
+
```markdown
|
|
66
|
+
## [X.Y.Z] - YYYY-MM-DD
|
|
67
|
+
|
|
68
|
+
### 🎯 Release Title
|
|
69
|
+
|
|
70
|
+
Brief description of main changes.
|
|
71
|
+
|
|
72
|
+
#### Changed / Added / Fixed
|
|
73
|
+
- Bullet point 1
|
|
74
|
+
- Bullet point 2
|
|
75
|
+
|
|
76
|
+
#### Benefits
|
|
77
|
+
- ✅ Benefit 1
|
|
78
|
+
- ✅ Benefit 2
|
|
79
|
+
```
|
|
80
|
+
|
|
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
|
+
### Phase 3: Git Operations
|
|
98
|
+
|
|
99
|
+
**Step 1: Create Release Commit**
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
git add CHANGELOG.md package.json
|
|
103
|
+
|
|
104
|
+
git commit -m "$(cat <<'EOF'
|
|
105
|
+
chore(release): bump version to X.Y.Z
|
|
106
|
+
|
|
107
|
+
Release X.Y.Z - [Brief title]
|
|
108
|
+
|
|
109
|
+
主要变更:
|
|
110
|
+
- 变更点 1
|
|
111
|
+
- 变更点 2
|
|
112
|
+
|
|
113
|
+
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
|
114
|
+
EOF
|
|
115
|
+
)"
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Step 2: Create Annotated Tag**
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
git tag -a vX.Y.Z -m "$(cat <<'EOF'
|
|
122
|
+
Release vX.Y.Z - [Brief title]
|
|
123
|
+
|
|
124
|
+
🎯 Main changes:
|
|
125
|
+
- Change 1
|
|
126
|
+
- Change 2
|
|
127
|
+
|
|
128
|
+
Benefits:
|
|
129
|
+
✅ Benefit 1
|
|
130
|
+
✅ Benefit 2
|
|
131
|
+
|
|
132
|
+
Full changelog: https://github.com/Dimon94/cc-devflow/blob/main/CHANGELOG.md
|
|
133
|
+
EOF
|
|
134
|
+
)"
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Step 3: Verify**
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# Check commit
|
|
141
|
+
git log --oneline -1
|
|
142
|
+
|
|
143
|
+
# Check tag
|
|
144
|
+
git tag -l "v2.4.*" | tail -3
|
|
145
|
+
|
|
146
|
+
# Verify tag annotation
|
|
147
|
+
git show vX.Y.Z
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Phase 4: Publish
|
|
151
|
+
|
|
152
|
+
**Step 1: Push to GitHub**
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Push commits
|
|
156
|
+
git push origin main
|
|
157
|
+
|
|
158
|
+
# Push tags
|
|
159
|
+
git push origin vX.Y.Z
|
|
160
|
+
# Or push all tags: git push origin --tags
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**Step 2: Create GitHub Release (Optional)**
|
|
164
|
+
|
|
165
|
+
Via GitHub CLI:
|
|
166
|
+
```bash
|
|
167
|
+
gh release create vX.Y.Z \
|
|
168
|
+
--title "vX.Y.Z - [Title]" \
|
|
169
|
+
--notes-file <(sed -n '/## \[X.Y.Z\]/,/## \[/p' CHANGELOG.md | head -n -1)
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Or manually at: https://github.com/Dimon94/cc-devflow/releases/new
|
|
173
|
+
|
|
174
|
+
**Step 3: Publish to npm**
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
# Test publish first (dry-run)
|
|
178
|
+
npm publish --dry-run
|
|
179
|
+
|
|
180
|
+
# Actual publish
|
|
181
|
+
npm publish
|
|
182
|
+
|
|
183
|
+
# Verify publication
|
|
184
|
+
npm view cc-devflow version
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Quick Reference
|
|
188
|
+
|
|
189
|
+
| Step | Command | Purpose |
|
|
190
|
+
|------|---------|---------|
|
|
191
|
+
| Check status | `git status` | Verify clean state |
|
|
192
|
+
| 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
|
+
| Create commit | `git commit -m "chore(release): ..."` | Commit version bump |
|
|
196
|
+
| Create tag | `git tag -a vX.Y.Z -m "..."` | Tag release |
|
|
197
|
+
| Push commits | `git push origin main` | Push to GitHub |
|
|
198
|
+
| Push tags | `git push origin vX.Y.Z` | Push tag to GitHub |
|
|
199
|
+
| Publish npm | `npm publish` | Publish to registry |
|
|
200
|
+
|
|
201
|
+
## Common Mistakes
|
|
202
|
+
|
|
203
|
+
### ❌ Mistake 1: Forgetting to Update CHANGELOG.md
|
|
204
|
+
|
|
205
|
+
**Problem**: Version bumped but no changelog entry
|
|
206
|
+
|
|
207
|
+
**Fix**: Always update CHANGELOG.md BEFORE committing
|
|
208
|
+
|
|
209
|
+
### ❌ Mistake 2: Inconsistent Version Numbers
|
|
210
|
+
|
|
211
|
+
**Problem**: package.json shows 2.4.4 but CHANGELOG.md shows 2.4.3
|
|
212
|
+
|
|
213
|
+
**Fix**: Double-check all version numbers match before committing
|
|
214
|
+
|
|
215
|
+
### ❌ Mistake 3: Pushing Tag Before Commit
|
|
216
|
+
|
|
217
|
+
**Problem**: Tag points to wrong commit
|
|
218
|
+
|
|
219
|
+
**Fix**: Always commit first, then tag, then push both together
|
|
220
|
+
|
|
221
|
+
### ❌ Mistake 4: Not Testing npm publish
|
|
222
|
+
|
|
223
|
+
**Problem**: Published package is broken
|
|
224
|
+
|
|
225
|
+
**Fix**: Run `npm publish --dry-run` first to catch issues
|
|
226
|
+
|
|
227
|
+
### ❌ Mistake 5: Network Timeout During Push
|
|
228
|
+
|
|
229
|
+
**Problem**: `Failed to connect to github.com port 443`
|
|
230
|
+
|
|
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
|
+
```
|
|
241
|
+
|
|
242
|
+
## Network Troubleshooting
|
|
243
|
+
|
|
244
|
+
If `git push` fails with timeout:
|
|
245
|
+
|
|
246
|
+
1. **Check network connectivity**:
|
|
247
|
+
```bash
|
|
248
|
+
curl -I https://github.com 2>&1 | head -5
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
2. **Try SSH instead of HTTPS**:
|
|
252
|
+
```bash
|
|
253
|
+
git remote -v # Check current remote URL
|
|
254
|
+
git remote set-url origin git@github.com:Dimon94/cc-devflow.git
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
3. **If SSH fails (publickey error)**:
|
|
258
|
+
- Check SSH key: `ssh -T git@github.com`
|
|
259
|
+
- Add SSH key to GitHub: https://github.com/settings/keys
|
|
260
|
+
- Or stay with HTTPS and retry later
|
|
261
|
+
|
|
262
|
+
4. **Commits and tags are safe locally**:
|
|
263
|
+
- They won't be lost
|
|
264
|
+
- Push when network is available
|
|
265
|
+
|
|
266
|
+
## Post-Release Verification
|
|
267
|
+
|
|
268
|
+
After successful release:
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
# 1. Verify GitHub tag
|
|
272
|
+
open https://github.com/Dimon94/cc-devflow/tags
|
|
273
|
+
|
|
274
|
+
# 2. Verify npm package
|
|
275
|
+
npm view cc-devflow version
|
|
276
|
+
npm view cc-devflow time
|
|
277
|
+
|
|
278
|
+
# 3. Test installation
|
|
279
|
+
npm install -g cc-devflow@latest
|
|
280
|
+
cc-devflow --version # Should show new version
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## Rollback (If Needed)
|
|
284
|
+
|
|
285
|
+
If published version has critical bugs:
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
# 1. Unpublish from npm (within 72 hours)
|
|
289
|
+
npm unpublish cc-devflow@X.Y.Z
|
|
290
|
+
|
|
291
|
+
# 2. Delete git tag locally and remotely
|
|
292
|
+
git tag -d vX.Y.Z
|
|
293
|
+
git push origin :refs/tags/vX.Y.Z
|
|
294
|
+
|
|
295
|
+
# 3. Revert commit
|
|
296
|
+
git revert HEAD
|
|
297
|
+
|
|
298
|
+
# 4. Fix bug and re-release with new patch version
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
**Note**: npm unpublish is only available within 72 hours of publication. After that, publish a new patch version instead.
|
|
302
|
+
|
|
303
|
+
## Real-World Impact
|
|
304
|
+
|
|
305
|
+
Following this workflow ensures:
|
|
306
|
+
- ✅ **Consistency**: All version markers stay in sync
|
|
307
|
+
- ✅ **Traceability**: Clear changelog and git history
|
|
308
|
+
- ✅ **Safety**: Dry-run catches issues before publishing
|
|
309
|
+
- ✅ **Recoverability**: Can rollback if needed
|
|
310
|
+
- ✅ **Automation-ready**: Scriptable workflow for future CI/CD
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
**[PROTOCOL]**: 变更时更新此头部,然后检查 CLAUDE.md
|