myaidev-method 0.2.5 โ 0.2.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/USER_GUIDE.md +389 -8
- package/bin/cli.js +161 -70
- package/package.json +1 -1
- package/src/lib/ascii-banner.js +100 -0
- package/src/templates/claude/commands/myai-deploy-dev.md +500 -0
- package/src/templates/claude/commands/myai-deploy-prod.md +837 -0
- package/src/templates/claude/commands/myai-deploy-staging.md +331 -0
- package/src/templates/claude/commands/myai-git-hotfix.md +957 -0
- package/src/templates/claude/commands/myai-git-pr.md +200 -0
- package/src/templates/claude/commands/myai-git-release.md +806 -0
- package/src/templates/claude/commands/myai-git-sync.md +796 -0
- package/src/templates/codex/commands/myai-astro-publish.md +51 -0
- package/src/templates/codex/commands/myai-configure.md +185 -0
- package/src/templates/codex/commands/myai-content-writer.md +73 -0
- package/src/templates/codex/commands/myai-coolify-deploy.md +159 -0
- package/src/templates/codex/commands/myai-deploy-dev.md +379 -0
- package/src/templates/codex/commands/myai-deploy-prod.md +431 -0
- package/src/templates/codex/commands/myai-deploy-staging.md +275 -0
- package/src/templates/codex/commands/myai-dev-architect.md +69 -0
- package/src/templates/codex/commands/myai-dev-code.md +82 -0
- package/src/templates/codex/commands/myai-dev-docs.md +83 -0
- package/src/templates/codex/commands/myai-dev-review.md +85 -0
- package/src/templates/codex/commands/myai-dev-test.md +84 -0
- package/src/templates/codex/commands/myai-docusaurus-publish.md +42 -0
- package/src/templates/codex/commands/myai-git-hotfix.md +512 -0
- package/src/templates/codex/commands/myai-git-pr.md +196 -0
- package/src/templates/codex/commands/myai-git-release.md +516 -0
- package/src/templates/codex/commands/myai-git-sync.md +517 -0
- package/src/templates/codex/commands/myai-mintlify-publish.md +42 -0
- package/src/templates/codex/commands/myai-payloadcms-publish.md +42 -0
- package/src/templates/codex/commands/myai-sparc-workflow.md +185 -0
- package/src/templates/codex/commands/myai-wordpress-admin.md +143 -0
- package/src/templates/codex/commands/myai-wordpress-publish.md +66 -0
- package/src/templates/gemini/commands/myai-astro-publish.toml +76 -0
- package/src/templates/gemini/commands/myai-configure.toml +188 -0
- package/src/templates/gemini/commands/myai-content-writer.toml +76 -0
- package/src/templates/gemini/commands/myai-coolify-deploy.toml +138 -0
- package/src/templates/gemini/commands/myai-deploy-dev.toml +379 -0
- package/src/templates/gemini/commands/myai-deploy-prod.toml +438 -0
- package/src/templates/gemini/commands/myai-deploy-staging.toml +275 -0
- package/src/templates/gemini/commands/myai-dev-architect.toml +64 -0
- package/src/templates/gemini/commands/myai-dev-code.toml +75 -0
- package/src/templates/gemini/commands/myai-dev-docs.toml +76 -0
- package/src/templates/gemini/commands/myai-dev-review.toml +78 -0
- package/src/templates/gemini/commands/myai-dev-test.toml +77 -0
- package/src/templates/gemini/commands/myai-docusaurus-publish.toml +63 -0
- package/src/templates/gemini/commands/myai-git-hotfix.toml +953 -0
- package/src/templates/gemini/commands/myai-git-pr.toml +196 -0
- package/src/templates/gemini/commands/myai-git-release.toml +802 -0
- package/src/templates/gemini/commands/myai-git-sync.toml +792 -0
- package/src/templates/gemini/commands/myai-mintlify-publish.toml +67 -0
- package/src/templates/gemini/commands/myai-payloadcms-publish.toml +59 -0
- package/src/templates/gemini/commands/myai-sparc-workflow.toml +47 -0
- package/src/templates/gemini/commands/myai-wordpress-admin.toml +143 -0
- package/src/templates/gemini/commands/myai-wordpress-publish.toml +77 -0
|
@@ -0,0 +1,806 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: myai-git-release
|
|
3
|
+
description: Create releases with semantic versioning and changelog generation
|
|
4
|
+
tools: [bash, read, write]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are a release automation assistant specializing in semantic versioning, changelog generation, and GitHub releases.
|
|
8
|
+
|
|
9
|
+
Task: Create release - $ARGUMENTS
|
|
10
|
+
|
|
11
|
+
## Release Management Workflow
|
|
12
|
+
|
|
13
|
+
### 1. Pre-Release Validation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
echo "๐ Validating release prerequisites..."
|
|
17
|
+
|
|
18
|
+
# Ensure on correct branch
|
|
19
|
+
current_branch=$(git branch --show-current)
|
|
20
|
+
if [[ "$current_branch" != "main" && "$current_branch" != "master" ]]; then
|
|
21
|
+
echo "โ ๏ธ Not on main/master branch"
|
|
22
|
+
read -p "Continue from $current_branch? (yes/no): " confirm
|
|
23
|
+
if [ "$confirm" != "yes" ]; then
|
|
24
|
+
exit 1
|
|
25
|
+
fi
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
# Check for uncommitted changes
|
|
29
|
+
if ! git diff-index --quiet HEAD --; then
|
|
30
|
+
echo "โ Uncommitted changes detected"
|
|
31
|
+
git status
|
|
32
|
+
exit 1
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
# Ensure branch is up to date
|
|
36
|
+
git fetch origin
|
|
37
|
+
if [ "$(git rev-parse HEAD)" != "$(git rev-parse @{u})" ]; then
|
|
38
|
+
echo "โ Branch not in sync with remote"
|
|
39
|
+
echo "Run: git pull origin $current_branch"
|
|
40
|
+
exit 1
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
# Check if tests pass
|
|
44
|
+
echo "๐งช Running tests before release..."
|
|
45
|
+
npm test || {
|
|
46
|
+
echo "โ Tests must pass before release"
|
|
47
|
+
exit 1
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
echo "โ
Pre-release validation passed"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 2. Determine Version Bump
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
determine_version_bump() {
|
|
57
|
+
echo "๐ Analyzing commits for version bump..."
|
|
58
|
+
|
|
59
|
+
# Get current version
|
|
60
|
+
if [ -f "package.json" ]; then
|
|
61
|
+
current_version=$(jq -r '.version' package.json)
|
|
62
|
+
elif [ -f "version.txt" ]; then
|
|
63
|
+
current_version=$(cat version.txt)
|
|
64
|
+
else
|
|
65
|
+
current_version="0.0.0"
|
|
66
|
+
fi
|
|
67
|
+
|
|
68
|
+
echo "Current version: $current_version"
|
|
69
|
+
|
|
70
|
+
# Get latest tag
|
|
71
|
+
latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
|
|
72
|
+
echo "Latest tag: $latest_tag"
|
|
73
|
+
|
|
74
|
+
# Analyze commits since last tag
|
|
75
|
+
commits=$(git log $latest_tag..HEAD --oneline 2>/dev/null || git log --oneline)
|
|
76
|
+
|
|
77
|
+
# Determine bump type based on conventional commits
|
|
78
|
+
has_breaking=false
|
|
79
|
+
has_feature=false
|
|
80
|
+
has_fix=false
|
|
81
|
+
|
|
82
|
+
while IFS= read -r commit; do
|
|
83
|
+
commit_msg=$(echo "$commit" | cut -d' ' -f2-)
|
|
84
|
+
|
|
85
|
+
# Check for breaking changes
|
|
86
|
+
if echo "$commit_msg" | grep -qE "^(BREAKING|breaking|BREAKING CHANGE|breaking change|!)"; then
|
|
87
|
+
has_breaking=true
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
# Check for features
|
|
91
|
+
if echo "$commit_msg" | grep -qE "^(feat|feature|add|new):"; then
|
|
92
|
+
has_feature=true
|
|
93
|
+
fi
|
|
94
|
+
|
|
95
|
+
# Check for fixes
|
|
96
|
+
if echo "$commit_msg" | grep -qE "^(fix|bugfix|patch):"; then
|
|
97
|
+
has_fix=true
|
|
98
|
+
fi
|
|
99
|
+
done <<< "$commits"
|
|
100
|
+
|
|
101
|
+
# Determine bump type
|
|
102
|
+
if [ "$has_breaking" = true ]; then
|
|
103
|
+
bump_type="major"
|
|
104
|
+
elif [ "$has_feature" = true ]; then
|
|
105
|
+
bump_type="minor"
|
|
106
|
+
elif [ "$has_fix" = true ]; then
|
|
107
|
+
bump_type="patch"
|
|
108
|
+
else
|
|
109
|
+
bump_type="patch"
|
|
110
|
+
fi
|
|
111
|
+
|
|
112
|
+
echo "Recommended bump: $bump_type"
|
|
113
|
+
|
|
114
|
+
# Calculate new version
|
|
115
|
+
IFS='.' read -r major minor patch <<< "${current_version#v}"
|
|
116
|
+
|
|
117
|
+
case $bump_type in
|
|
118
|
+
major)
|
|
119
|
+
major=$((major + 1))
|
|
120
|
+
minor=0
|
|
121
|
+
patch=0
|
|
122
|
+
;;
|
|
123
|
+
minor)
|
|
124
|
+
minor=$((minor + 1))
|
|
125
|
+
patch=0
|
|
126
|
+
;;
|
|
127
|
+
patch)
|
|
128
|
+
patch=$((patch + 1))
|
|
129
|
+
;;
|
|
130
|
+
esac
|
|
131
|
+
|
|
132
|
+
new_version="$major.$minor.$patch"
|
|
133
|
+
echo "New version: $new_version"
|
|
134
|
+
|
|
135
|
+
# Confirm version
|
|
136
|
+
read -p "Accept version $new_version? (yes/no/custom): " choice
|
|
137
|
+
|
|
138
|
+
case $choice in
|
|
139
|
+
yes)
|
|
140
|
+
echo "$new_version"
|
|
141
|
+
;;
|
|
142
|
+
custom)
|
|
143
|
+
read -p "Enter custom version: " custom_version
|
|
144
|
+
echo "$custom_version"
|
|
145
|
+
;;
|
|
146
|
+
*)
|
|
147
|
+
echo "Release cancelled"
|
|
148
|
+
exit 1
|
|
149
|
+
;;
|
|
150
|
+
esac
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
# Get new version
|
|
154
|
+
new_version=$(determine_version_bump)
|
|
155
|
+
echo "Releasing version: $new_version"
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### 3. Generate Changelog
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
generate_changelog() {
|
|
162
|
+
local version=$1
|
|
163
|
+
local previous_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
|
|
164
|
+
|
|
165
|
+
echo "๐ Generating changelog for v$version..."
|
|
166
|
+
|
|
167
|
+
# Create changelog file
|
|
168
|
+
changelog_file="CHANGELOG-v$version.md"
|
|
169
|
+
|
|
170
|
+
cat > "$changelog_file" << EOF
|
|
171
|
+
# Release v$version
|
|
172
|
+
|
|
173
|
+
**Release Date:** $(date +%Y-%m-%d)
|
|
174
|
+
|
|
175
|
+
## Changes
|
|
176
|
+
|
|
177
|
+
EOF
|
|
178
|
+
|
|
179
|
+
# Get commits since last tag
|
|
180
|
+
if [ -n "$previous_tag" ]; then
|
|
181
|
+
commits=$(git log $previous_tag..HEAD --pretty=format:"%s|%an|%h" 2>/dev/null)
|
|
182
|
+
else
|
|
183
|
+
commits=$(git log --pretty=format:"%s|%an|%h")
|
|
184
|
+
fi
|
|
185
|
+
|
|
186
|
+
# Categorize commits
|
|
187
|
+
declare -A categories
|
|
188
|
+
categories=(
|
|
189
|
+
["๐ฅ Breaking Changes"]=""
|
|
190
|
+
["โจ Features"]=""
|
|
191
|
+
["๐ Bug Fixes"]=""
|
|
192
|
+
["๐ Documentation"]=""
|
|
193
|
+
["๐ง Maintenance"]=""
|
|
194
|
+
["โก Performance"]=""
|
|
195
|
+
["๐จ Style"]=""
|
|
196
|
+
["โป๏ธ Refactor"]=""
|
|
197
|
+
["๐งช Tests"]=""
|
|
198
|
+
["Other"]=""
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
while IFS='|' read -r message author hash; do
|
|
202
|
+
# Categorize based on conventional commit format
|
|
203
|
+
case "$message" in
|
|
204
|
+
BREAKING*|breaking*|*!:*)
|
|
205
|
+
categories["๐ฅ Breaking Changes"]+="- $message ([$hash](commit/$hash)) - $author\n"
|
|
206
|
+
;;
|
|
207
|
+
feat*|feature*|add*|new*)
|
|
208
|
+
categories["โจ Features"]+="- $message ([$hash](commit/$hash)) - $author\n"
|
|
209
|
+
;;
|
|
210
|
+
fix*|bugfix*|patch*)
|
|
211
|
+
categories["๐ Bug Fixes"]+="- $message ([$hash](commit/$hash)) - $author\n"
|
|
212
|
+
;;
|
|
213
|
+
docs*|doc*)
|
|
214
|
+
categories["๐ Documentation"]+="- $message ([$hash](commit/$hash)) - $author\n"
|
|
215
|
+
;;
|
|
216
|
+
chore*|deps*|build*)
|
|
217
|
+
categories["๐ง Maintenance"]+="- $message ([$hash](commit/$hash)) - $author\n"
|
|
218
|
+
;;
|
|
219
|
+
perf*|performance*)
|
|
220
|
+
categories["โก Performance"]+="- $message ([$hash](commit/$hash)) - $author\n"
|
|
221
|
+
;;
|
|
222
|
+
style*|format*)
|
|
223
|
+
categories["๐จ Style"]+="- $message ([$hash](commit/$hash)) - $author\n"
|
|
224
|
+
;;
|
|
225
|
+
refactor*)
|
|
226
|
+
categories["โป๏ธ Refactor"]+="- $message ([$hash](commit/$hash)) - $author\n"
|
|
227
|
+
;;
|
|
228
|
+
test*)
|
|
229
|
+
categories["๐งช Tests"]+="- $message ([$hash](commit/$hash)) - $author\n"
|
|
230
|
+
;;
|
|
231
|
+
*)
|
|
232
|
+
categories["Other"]+="- $message ([$hash](commit/$hash)) - $author\n"
|
|
233
|
+
;;
|
|
234
|
+
esac
|
|
235
|
+
done <<< "$commits"
|
|
236
|
+
|
|
237
|
+
# Write categories to changelog
|
|
238
|
+
for category in "${!categories[@]}"; do
|
|
239
|
+
if [ -n "${categories[$category]}" ]; then
|
|
240
|
+
echo -e "\n### $category\n" >> "$changelog_file"
|
|
241
|
+
echo -e "${categories[$category]}" >> "$changelog_file"
|
|
242
|
+
fi
|
|
243
|
+
done
|
|
244
|
+
|
|
245
|
+
# Add contributors
|
|
246
|
+
echo -e "\n## Contributors\n" >> "$changelog_file"
|
|
247
|
+
git log $previous_tag..HEAD --format='%aN' 2>/dev/null | sort -u | while read author; do
|
|
248
|
+
echo "- $author" >> "$changelog_file"
|
|
249
|
+
done
|
|
250
|
+
|
|
251
|
+
# Add statistics
|
|
252
|
+
echo -e "\n## Statistics\n" >> "$changelog_file"
|
|
253
|
+
commit_count=$(git rev-list $previous_tag..HEAD --count 2>/dev/null || git rev-list --count HEAD)
|
|
254
|
+
files_changed=$(git diff --stat $previous_tag..HEAD 2>/dev/null | tail -1 || echo "N/A")
|
|
255
|
+
|
|
256
|
+
echo "- **Commits:** $commit_count" >> "$changelog_file"
|
|
257
|
+
echo "- **Files Changed:** $files_changed" >> "$changelog_file"
|
|
258
|
+
|
|
259
|
+
echo "โ
Changelog generated: $changelog_file"
|
|
260
|
+
echo "$changelog_file"
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
# Generate changelog
|
|
264
|
+
changelog_file=$(generate_changelog "$new_version")
|
|
265
|
+
|
|
266
|
+
# Show changelog for review
|
|
267
|
+
echo ""
|
|
268
|
+
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
|
|
269
|
+
cat "$changelog_file"
|
|
270
|
+
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
|
|
271
|
+
echo ""
|
|
272
|
+
|
|
273
|
+
read -p "Accept changelog? (yes/edit/cancel): " changelog_choice
|
|
274
|
+
|
|
275
|
+
case $changelog_choice in
|
|
276
|
+
edit)
|
|
277
|
+
${EDITOR:-nano} "$changelog_file"
|
|
278
|
+
;;
|
|
279
|
+
cancel)
|
|
280
|
+
echo "Release cancelled"
|
|
281
|
+
rm "$changelog_file"
|
|
282
|
+
exit 1
|
|
283
|
+
;;
|
|
284
|
+
esac
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### 4. Update Version in Files
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
update_version_files() {
|
|
291
|
+
local version=$1
|
|
292
|
+
|
|
293
|
+
echo "๐ Updating version in project files..."
|
|
294
|
+
|
|
295
|
+
# Update package.json
|
|
296
|
+
if [ -f "package.json" ]; then
|
|
297
|
+
echo "Updating package.json..."
|
|
298
|
+
jq ".version = \"$version\"" package.json > package.json.tmp
|
|
299
|
+
mv package.json.tmp package.json
|
|
300
|
+
echo "โ
package.json updated"
|
|
301
|
+
fi
|
|
302
|
+
|
|
303
|
+
# Update package-lock.json
|
|
304
|
+
if [ -f "package-lock.json" ]; then
|
|
305
|
+
echo "Updating package-lock.json..."
|
|
306
|
+
jq ".version = \"$version\"" package-lock.json > package-lock.json.tmp
|
|
307
|
+
mv package-lock.json.tmp package-lock.json
|
|
308
|
+
echo "โ
package-lock.json updated"
|
|
309
|
+
fi
|
|
310
|
+
|
|
311
|
+
# Update version.txt if exists
|
|
312
|
+
if [ -f "version.txt" ]; then
|
|
313
|
+
echo "$version" > version.txt
|
|
314
|
+
echo "โ
version.txt updated"
|
|
315
|
+
fi
|
|
316
|
+
|
|
317
|
+
# Update Cargo.toml if Rust project
|
|
318
|
+
if [ -f "Cargo.toml" ]; then
|
|
319
|
+
sed -i "s/^version = .*/version = \"$version\"/" Cargo.toml
|
|
320
|
+
echo "โ
Cargo.toml updated"
|
|
321
|
+
fi
|
|
322
|
+
|
|
323
|
+
# Update pyproject.toml if Python project
|
|
324
|
+
if [ -f "pyproject.toml" ]; then
|
|
325
|
+
sed -i "s/^version = .*/version = \"$version\"/" pyproject.toml
|
|
326
|
+
echo "โ
pyproject.toml updated"
|
|
327
|
+
fi
|
|
328
|
+
|
|
329
|
+
# Update setup.py if Python project
|
|
330
|
+
if [ -f "setup.py" ]; then
|
|
331
|
+
sed -i "s/version=['\"].*['\"]/version='$version'/" setup.py
|
|
332
|
+
echo "โ
setup.py updated"
|
|
333
|
+
fi
|
|
334
|
+
|
|
335
|
+
# Stage all version changes
|
|
336
|
+
git add -A
|
|
337
|
+
|
|
338
|
+
echo "โ
Version files updated"
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
# Update version
|
|
342
|
+
update_version_files "$new_version"
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### 5. Commit and Tag Release
|
|
346
|
+
|
|
347
|
+
```bash
|
|
348
|
+
create_release_commit() {
|
|
349
|
+
local version=$1
|
|
350
|
+
local changelog_file=$2
|
|
351
|
+
|
|
352
|
+
echo "๐ท๏ธ Creating release commit and tag..."
|
|
353
|
+
|
|
354
|
+
# Create release commit
|
|
355
|
+
git commit -m "chore(release): v$version
|
|
356
|
+
|
|
357
|
+
$(cat $changelog_file)
|
|
358
|
+
|
|
359
|
+
๐ค Generated with [Claude Code](https://claude.com/claude-code)
|
|
360
|
+
|
|
361
|
+
Co-Authored-By: Claude <noreply@anthropic.com>"
|
|
362
|
+
|
|
363
|
+
# Create annotated tag
|
|
364
|
+
git tag -a "v$version" -m "Release v$version
|
|
365
|
+
|
|
366
|
+
$(head -20 $changelog_file)
|
|
367
|
+
|
|
368
|
+
Full changelog: See CHANGELOG.md"
|
|
369
|
+
|
|
370
|
+
echo "โ
Release commit and tag created"
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
# Create commit and tag
|
|
374
|
+
create_release_commit "$new_version" "$changelog_file"
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
### 6. Update CHANGELOG.md
|
|
378
|
+
|
|
379
|
+
```bash
|
|
380
|
+
update_main_changelog() {
|
|
381
|
+
local version=$1
|
|
382
|
+
local changelog_file=$2
|
|
383
|
+
|
|
384
|
+
echo "๐ Updating CHANGELOG.md..."
|
|
385
|
+
|
|
386
|
+
# Create CHANGELOG.md if it doesn't exist
|
|
387
|
+
if [ ! -f "CHANGELOG.md" ]; then
|
|
388
|
+
cat > CHANGELOG.md << EOF
|
|
389
|
+
# Changelog
|
|
390
|
+
|
|
391
|
+
All notable changes to this project will be documented in this file.
|
|
392
|
+
|
|
393
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
394
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
395
|
+
|
|
396
|
+
EOF
|
|
397
|
+
fi
|
|
398
|
+
|
|
399
|
+
# Insert new version at the top (after header)
|
|
400
|
+
temp_file=$(mktemp)
|
|
401
|
+
|
|
402
|
+
# Read header
|
|
403
|
+
sed '/^## /q' CHANGELOG.md > "$temp_file"
|
|
404
|
+
|
|
405
|
+
# Add new version
|
|
406
|
+
echo "" >> "$temp_file"
|
|
407
|
+
cat "$changelog_file" >> "$temp_file"
|
|
408
|
+
echo "" >> "$temp_file"
|
|
409
|
+
|
|
410
|
+
# Add rest of changelog
|
|
411
|
+
sed -n '/^## /,$p' CHANGELOG.md >> "$temp_file"
|
|
412
|
+
|
|
413
|
+
# Replace old changelog
|
|
414
|
+
mv "$temp_file" CHANGELOG.md
|
|
415
|
+
|
|
416
|
+
# Stage changelog
|
|
417
|
+
git add CHANGELOG.md
|
|
418
|
+
|
|
419
|
+
# Amend the release commit to include updated CHANGELOG
|
|
420
|
+
git commit --amend --no-edit
|
|
421
|
+
|
|
422
|
+
# Update the tag
|
|
423
|
+
git tag -d "v$version"
|
|
424
|
+
git tag -a "v$version" -m "Release v$version
|
|
425
|
+
|
|
426
|
+
$(head -20 $changelog_file)
|
|
427
|
+
|
|
428
|
+
Full changelog: See CHANGELOG.md"
|
|
429
|
+
|
|
430
|
+
# Clean up temporary changelog
|
|
431
|
+
rm "$changelog_file"
|
|
432
|
+
|
|
433
|
+
echo "โ
CHANGELOG.md updated"
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
# Update main changelog
|
|
437
|
+
update_main_changelog "$new_version" "$changelog_file"
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
### 7. Push Release
|
|
441
|
+
|
|
442
|
+
```bash
|
|
443
|
+
push_release() {
|
|
444
|
+
local version=$1
|
|
445
|
+
|
|
446
|
+
echo "๐ Pushing release to remote..."
|
|
447
|
+
|
|
448
|
+
read -p "Push release v$version to origin? (yes/no): " push_confirm
|
|
449
|
+
|
|
450
|
+
if [ "$push_confirm" != "yes" ]; then
|
|
451
|
+
echo "โ ๏ธ Release created locally but not pushed"
|
|
452
|
+
echo "To push later: git push origin $current_branch && git push origin v$version"
|
|
453
|
+
return
|
|
454
|
+
fi
|
|
455
|
+
|
|
456
|
+
# Push commit
|
|
457
|
+
git push origin "$current_branch" || {
|
|
458
|
+
echo "โ Failed to push commit"
|
|
459
|
+
exit 1
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
# Push tag
|
|
463
|
+
git push origin "v$version" || {
|
|
464
|
+
echo "โ Failed to push tag"
|
|
465
|
+
exit 1
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
echo "โ
Release pushed to origin"
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
# Push release
|
|
472
|
+
push_release "$new_version"
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
### 8. Create GitHub Release
|
|
476
|
+
|
|
477
|
+
```bash
|
|
478
|
+
create_github_release() {
|
|
479
|
+
local version=$1
|
|
480
|
+
|
|
481
|
+
echo "๐ฆ Creating GitHub release..."
|
|
482
|
+
|
|
483
|
+
# Check if gh CLI is installed
|
|
484
|
+
if ! command -v gh &> /dev/null; then
|
|
485
|
+
echo "โ ๏ธ GitHub CLI not installed. Install with: brew install gh"
|
|
486
|
+
echo "Manual release creation: https://github.com/$(git config remote.origin.url | sed 's/.*://;s/.git$//')/releases/new"
|
|
487
|
+
return
|
|
488
|
+
fi
|
|
489
|
+
|
|
490
|
+
# Check if authenticated
|
|
491
|
+
if ! gh auth status &> /dev/null; then
|
|
492
|
+
echo "๐ Authenticating with GitHub..."
|
|
493
|
+
gh auth login
|
|
494
|
+
fi
|
|
495
|
+
|
|
496
|
+
# Extract changelog content for this version
|
|
497
|
+
changelog_content=$(sed -n '/^# Release/,/^# Release/p' CHANGELOG.md | head -n -1)
|
|
498
|
+
|
|
499
|
+
# Create release
|
|
500
|
+
echo "Creating GitHub release..."
|
|
501
|
+
|
|
502
|
+
gh release create "v$version" \
|
|
503
|
+
--title "Release v$version" \
|
|
504
|
+
--notes "$changelog_content" \
|
|
505
|
+
|| {
|
|
506
|
+
echo "โ Failed to create GitHub release"
|
|
507
|
+
exit 1
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
echo "โ
GitHub release created"
|
|
511
|
+
echo "๐ View at: https://github.com/$(git remote get-url origin | sed 's/.*://;s/.git$//')/releases/tag/v$version"
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
# Create GitHub release if available
|
|
515
|
+
create_github_release "$new_version"
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
### 9. Upload Release Assets
|
|
519
|
+
|
|
520
|
+
```bash
|
|
521
|
+
upload_release_assets() {
|
|
522
|
+
local version=$1
|
|
523
|
+
|
|
524
|
+
echo "๐ Uploading release assets..."
|
|
525
|
+
|
|
526
|
+
# Build release artifacts
|
|
527
|
+
if [ -f "package.json" ] && grep -q "\"build\"" package.json; then
|
|
528
|
+
echo "Building release artifacts..."
|
|
529
|
+
npm run build || echo "โ ๏ธ Build failed"
|
|
530
|
+
|
|
531
|
+
# Create distribution archive
|
|
532
|
+
if [ -d "dist" ]; then
|
|
533
|
+
echo "Creating distribution archive..."
|
|
534
|
+
tar -czf "dist-v$version.tar.gz" dist/
|
|
535
|
+
asset_files+=("dist-v$version.tar.gz")
|
|
536
|
+
fi
|
|
537
|
+
fi
|
|
538
|
+
|
|
539
|
+
# Upload checksums
|
|
540
|
+
if [ ${#asset_files[@]} -gt 0 ]; then
|
|
541
|
+
echo "Generating checksums..."
|
|
542
|
+
sha256sum "${asset_files[@]}" > "checksums-v$version.txt"
|
|
543
|
+
asset_files+=("checksums-v$version.txt")
|
|
544
|
+
fi
|
|
545
|
+
|
|
546
|
+
# Upload to GitHub release
|
|
547
|
+
if command -v gh &> /dev/null; then
|
|
548
|
+
for asset in "${asset_files[@]}"; do
|
|
549
|
+
echo "Uploading $asset..."
|
|
550
|
+
gh release upload "v$version" "$asset" || echo "โ ๏ธ Failed to upload $asset"
|
|
551
|
+
done
|
|
552
|
+
|
|
553
|
+
echo "โ
Assets uploaded"
|
|
554
|
+
else
|
|
555
|
+
echo "โ ๏ธ GitHub CLI not available, upload assets manually"
|
|
556
|
+
echo "Assets: ${asset_files[*]}"
|
|
557
|
+
fi
|
|
558
|
+
|
|
559
|
+
# Clean up
|
|
560
|
+
rm -f "${asset_files[@]}"
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
# Upload assets
|
|
564
|
+
declare -a asset_files=()
|
|
565
|
+
upload_release_assets "$new_version"
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
### 10. Publish to NPM (Optional)
|
|
569
|
+
|
|
570
|
+
```bash
|
|
571
|
+
publish_to_npm() {
|
|
572
|
+
local version=$1
|
|
573
|
+
|
|
574
|
+
if [ ! -f "package.json" ]; then
|
|
575
|
+
return
|
|
576
|
+
fi
|
|
577
|
+
|
|
578
|
+
echo "๐ฆ NPM Publishing..."
|
|
579
|
+
|
|
580
|
+
read -p "Publish v$version to NPM? (yes/no): " npm_confirm
|
|
581
|
+
|
|
582
|
+
if [ "$npm_confirm" != "yes" ]; then
|
|
583
|
+
echo "โ ๏ธ Skipping NPM publish"
|
|
584
|
+
return
|
|
585
|
+
fi
|
|
586
|
+
|
|
587
|
+
# Check if logged in
|
|
588
|
+
if ! npm whoami &> /dev/null; then
|
|
589
|
+
echo "๐ Logging into NPM..."
|
|
590
|
+
npm login
|
|
591
|
+
fi
|
|
592
|
+
|
|
593
|
+
# Run pre-publish checks
|
|
594
|
+
echo "Running pre-publish checks..."
|
|
595
|
+
npm run prepublishOnly || echo "โ ๏ธ Pre-publish hook failed"
|
|
596
|
+
|
|
597
|
+
# Publish
|
|
598
|
+
echo "Publishing to NPM..."
|
|
599
|
+
npm publish --access public || {
|
|
600
|
+
echo "โ NPM publish failed"
|
|
601
|
+
return 1
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
echo "โ
Published to NPM"
|
|
605
|
+
echo "๐ View at: https://www.npmjs.com/package/$(jq -r '.name' package.json)"
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
# Publish to NPM
|
|
609
|
+
publish_to_npm "$new_version"
|
|
610
|
+
```
|
|
611
|
+
|
|
612
|
+
### 11. Post-Release Actions
|
|
613
|
+
|
|
614
|
+
```bash
|
|
615
|
+
post_release_actions() {
|
|
616
|
+
local version=$1
|
|
617
|
+
|
|
618
|
+
echo "๐ Post-release actions..."
|
|
619
|
+
|
|
620
|
+
# Trigger release deployment
|
|
621
|
+
if [ -f ".github/workflows/release.yml" ]; then
|
|
622
|
+
echo "๐ข GitHub Actions will handle deployment"
|
|
623
|
+
fi
|
|
624
|
+
|
|
625
|
+
# Create next development version
|
|
626
|
+
read -p "Create next dev version? (yes/no): " dev_version
|
|
627
|
+
|
|
628
|
+
if [ "$dev_version" == "yes" ]; then
|
|
629
|
+
IFS='.' read -r major minor patch <<< "$version"
|
|
630
|
+
next_patch=$((patch + 1))
|
|
631
|
+
dev_version="$major.$minor.$next_patch-dev"
|
|
632
|
+
|
|
633
|
+
# Update version files
|
|
634
|
+
if [ -f "package.json" ]; then
|
|
635
|
+
jq ".version = \"$dev_version\"" package.json > package.json.tmp
|
|
636
|
+
mv package.json.tmp package.json
|
|
637
|
+
fi
|
|
638
|
+
|
|
639
|
+
git add -A
|
|
640
|
+
git commit -m "chore: bump to v$dev_version"
|
|
641
|
+
git push origin "$current_branch"
|
|
642
|
+
|
|
643
|
+
echo "โ
Development version set to v$dev_version"
|
|
644
|
+
fi
|
|
645
|
+
|
|
646
|
+
# Notify team
|
|
647
|
+
send_release_notification "$version"
|
|
648
|
+
|
|
649
|
+
echo "โ
Post-release actions complete"
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
# Post-release actions
|
|
653
|
+
post_release_actions "$new_version"
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
### 12. Release Notification
|
|
657
|
+
|
|
658
|
+
```bash
|
|
659
|
+
send_release_notification() {
|
|
660
|
+
local version=$1
|
|
661
|
+
local repo_url=$(git config remote.origin.url | sed 's/git@github.com:/https:\/\/github.com\//' | sed 's/.git$//')
|
|
662
|
+
local release_url="$repo_url/releases/tag/v$version"
|
|
663
|
+
local changelog=$(sed -n '/^# Release/,/^# Release/p' CHANGELOG.md | head -n -1)
|
|
664
|
+
|
|
665
|
+
# Slack notification
|
|
666
|
+
if [ -n "$SLACK_WEBHOOK_URL" ]; then
|
|
667
|
+
curl -X POST "$SLACK_WEBHOOK_URL" \
|
|
668
|
+
-H 'Content-Type: application/json' \
|
|
669
|
+
-d "{
|
|
670
|
+
\"text\": \"๐ New Release: v$version\",
|
|
671
|
+
\"blocks\": [
|
|
672
|
+
{
|
|
673
|
+
\"type\": \"header\",
|
|
674
|
+
\"text\": {
|
|
675
|
+
\"type\": \"plain_text\",
|
|
676
|
+
\"text\": \"๐ New Release: v$version\"
|
|
677
|
+
}
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
\"type\": \"section\",
|
|
681
|
+
\"text\": {
|
|
682
|
+
\"type\": \"mrkdwn\",
|
|
683
|
+
\"text\": \"$changelog\"
|
|
684
|
+
}
|
|
685
|
+
},
|
|
686
|
+
{
|
|
687
|
+
\"type\": \"actions\",
|
|
688
|
+
\"elements\": [
|
|
689
|
+
{
|
|
690
|
+
\"type\": \"button\",
|
|
691
|
+
\"text\": {\"type\": \"plain_text\", \"text\": \"View Release\"},
|
|
692
|
+
\"url\": \"$release_url\"
|
|
693
|
+
}
|
|
694
|
+
]
|
|
695
|
+
}
|
|
696
|
+
]
|
|
697
|
+
}"
|
|
698
|
+
fi
|
|
699
|
+
|
|
700
|
+
# Discord notification
|
|
701
|
+
if [ -n "$DISCORD_WEBHOOK_URL" ]; then
|
|
702
|
+
curl -X POST "$DISCORD_WEBHOOK_URL" \
|
|
703
|
+
-H 'Content-Type: application/json' \
|
|
704
|
+
-d "{
|
|
705
|
+
\"content\": \"๐ **New Release: v$version**\",
|
|
706
|
+
\"embeds\": [{
|
|
707
|
+
\"title\": \"Release v$version\",
|
|
708
|
+
\"url\": \"$release_url\",
|
|
709
|
+
\"description\": \"$(echo "$changelog" | head -500)\",
|
|
710
|
+
\"color\": 5763719,
|
|
711
|
+
\"timestamp\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"
|
|
712
|
+
}]
|
|
713
|
+
}"
|
|
714
|
+
fi
|
|
715
|
+
|
|
716
|
+
echo "โ
Release notification sent"
|
|
717
|
+
}
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
## Complete Release Script
|
|
721
|
+
|
|
722
|
+
```bash
|
|
723
|
+
#!/bin/bash
|
|
724
|
+
set -e
|
|
725
|
+
|
|
726
|
+
echo "๐ Starting release process..."
|
|
727
|
+
|
|
728
|
+
# 1. Validate
|
|
729
|
+
git diff-index --quiet HEAD -- || { echo "โ Uncommitted changes"; exit 1; }
|
|
730
|
+
npm test || { echo "โ Tests failed"; exit 1; }
|
|
731
|
+
|
|
732
|
+
# 2. Determine version
|
|
733
|
+
new_version=$(determine_version_bump)
|
|
734
|
+
|
|
735
|
+
# 3. Generate changelog
|
|
736
|
+
changelog_file=$(generate_changelog "$new_version")
|
|
737
|
+
|
|
738
|
+
# 4. Update files
|
|
739
|
+
update_version_files "$new_version"
|
|
740
|
+
|
|
741
|
+
# 5. Commit and tag
|
|
742
|
+
create_release_commit "$new_version" "$changelog_file"
|
|
743
|
+
update_main_changelog "$new_version" "$changelog_file"
|
|
744
|
+
|
|
745
|
+
# 6. Push
|
|
746
|
+
push_release "$new_version"
|
|
747
|
+
|
|
748
|
+
# 7. Create GitHub release
|
|
749
|
+
create_github_release "$new_version"
|
|
750
|
+
|
|
751
|
+
# 8. Upload assets
|
|
752
|
+
upload_release_assets "$new_version"
|
|
753
|
+
|
|
754
|
+
# 9. Publish to NPM
|
|
755
|
+
publish_to_npm "$new_version"
|
|
756
|
+
|
|
757
|
+
# 10. Post-release
|
|
758
|
+
post_release_actions "$new_version"
|
|
759
|
+
|
|
760
|
+
echo "โ
Release v$new_version complete!"
|
|
761
|
+
echo "๐ Release: https://github.com/$(git remote get-url origin | sed 's/.*://;s/.git$//')/releases/tag/v$new_version"
|
|
762
|
+
```
|
|
763
|
+
|
|
764
|
+
## Quick Release Commands
|
|
765
|
+
|
|
766
|
+
**Patch release (bug fixes):**
|
|
767
|
+
```bash
|
|
768
|
+
npm run release:patch
|
|
769
|
+
# or
|
|
770
|
+
/myai-git-release --patch
|
|
771
|
+
```
|
|
772
|
+
|
|
773
|
+
**Minor release (new features):**
|
|
774
|
+
```bash
|
|
775
|
+
npm run release:minor
|
|
776
|
+
# or
|
|
777
|
+
/myai-git-release --minor
|
|
778
|
+
```
|
|
779
|
+
|
|
780
|
+
**Major release (breaking changes):**
|
|
781
|
+
```bash
|
|
782
|
+
npm run release:major
|
|
783
|
+
# or
|
|
784
|
+
/myai-git-release --major
|
|
785
|
+
```
|
|
786
|
+
|
|
787
|
+
## Environment Configuration
|
|
788
|
+
|
|
789
|
+
```bash
|
|
790
|
+
# GitHub (for releases)
|
|
791
|
+
GH_TOKEN=your_github_token
|
|
792
|
+
|
|
793
|
+
# NPM (for publishing)
|
|
794
|
+
NPM_TOKEN=your_npm_token
|
|
795
|
+
|
|
796
|
+
# Notifications
|
|
797
|
+
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/YOUR/WEBHOOK
|
|
798
|
+
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/YOUR/WEBHOOK
|
|
799
|
+
|
|
800
|
+
# Release settings
|
|
801
|
+
AUTO_PUBLISH_NPM=false
|
|
802
|
+
CREATE_DEV_VERSION=true
|
|
803
|
+
UPLOAD_ASSETS=true
|
|
804
|
+
```
|
|
805
|
+
|
|
806
|
+
Execute the release workflow with semantic versioning and complete automation.
|