ccman 2.1.3 → 2.1.5

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 (54) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +201 -301
  3. package/README_en.md +294 -0
  4. package/dist/cli.js +213 -33
  5. package/dist/cli.js.map +1 -1
  6. package/dist/config/default-providers.d.ts +34 -0
  7. package/dist/config/default-providers.d.ts.map +1 -0
  8. package/dist/config/default-providers.js +96 -0
  9. package/dist/config/default-providers.js.map +1 -0
  10. package/dist/config/static-env.d.ts +1 -1
  11. package/dist/config/static-env.js +1 -1
  12. package/dist/core/ClaudeConfigManager.d.ts +1 -1
  13. package/dist/core/ClaudeConfigManager.d.ts.map +1 -1
  14. package/dist/core/ClaudeConfigManager.js +2 -4
  15. package/dist/core/ClaudeConfigManager.js.map +1 -1
  16. package/package.json +24 -3
  17. package/.editorconfig +0 -15
  18. package/.env.development +0 -3
  19. package/.env.production +0 -3
  20. package/.eslintrc.js +0 -28
  21. package/.github/workflows/release.yml +0 -99
  22. package/.prettierrc +0 -10
  23. package/CLAUDE.md +0 -279
  24. package/README_zh.md +0 -394
  25. package/dev-test.sh +0 -40
  26. package/docs/npm-publish-guide.md +0 -71
  27. package/docs/release-guide.md +0 -144
  28. package/docs/scripts-guide.md +0 -221
  29. package/docs/version-management.md +0 -64
  30. package/jest.config.js +0 -22
  31. package/release-temp/README.md +0 -394
  32. package/release-temp/package.json +0 -61
  33. package/scripts/build-env.js +0 -75
  34. package/scripts/modules/check-uncommitted.sh +0 -109
  35. package/scripts/modules/create-tag.sh +0 -279
  36. package/scripts/modules/monitor-release.sh +0 -296
  37. package/scripts/modules/version-bump.sh +0 -262
  38. package/scripts/publish-local.sh +0 -91
  39. package/scripts/quick-release.sh +0 -100
  40. package/scripts/release.sh +0 -430
  41. package/scripts/smart-release-v3.sh +0 -283
  42. package/scripts/smart-release.sh +0 -322
  43. package/src/cli.ts +0 -598
  44. package/src/commands/lang.ts +0 -105
  45. package/src/core/CCMConfigManager.ts +0 -259
  46. package/src/core/ClaudeConfigManager.ts +0 -141
  47. package/src/i18n/LanguageManager.ts +0 -169
  48. package/src/i18n/messages.ts +0 -233
  49. package/src/index.ts +0 -4
  50. package/src/providers/ProviderManager.ts +0 -412
  51. package/src/types/index.ts +0 -101
  52. package/src/utils/env-config.ts +0 -53
  53. package/src/utils/version.ts +0 -16
  54. package/tsconfig.json +0 -25
@@ -1,322 +0,0 @@
1
- #!/bin/bash
2
-
3
- # CCM Enhanced Release Script
4
- # 增强版快速发布脚本 - 支持智能代码处理和发布状态监控
5
-
6
- set -e
7
-
8
- # 颜色定义
9
- GREEN='\033[0;32m'
10
- YELLOW='\033[1;33m'
11
- RED='\033[0;31m'
12
- BLUE='\033[0;34m'
13
- CYAN='\033[0;36m'
14
- NC='\033[0m'
15
-
16
- print_success() { echo -e "${GREEN}✅ $1${NC}"; }
17
- print_warning() { echo -e "${YELLOW}⚠️ $1${NC}"; }
18
- print_error() { echo -e "${RED}❌ $1${NC}"; exit 1; }
19
- print_info() { echo -e "${BLUE}ℹ️ $1${NC}"; }
20
- print_check() { echo -e "${CYAN}🔍 $1${NC}"; }
21
-
22
- # 检查基本环境
23
- check_environment() {
24
- [ ! -f "package.json" ] && print_error "package.json 未找到"
25
- [ ! -d ".git" ] && print_error "不在 Git 仓库中"
26
-
27
- if ! command -v curl &> /dev/null; then
28
- print_warning "curl 未安装,将跳过发布状态检查"
29
- SKIP_STATUS_CHECK=true
30
- fi
31
- }
32
-
33
- # 智能处理未提交代码
34
- handle_uncommitted_changes() {
35
- print_info "检查工作目录状态..."
36
-
37
- if git diff-index --quiet HEAD --; then
38
- print_success "工作目录干净"
39
- return 0
40
- fi
41
-
42
- print_warning "发现未提交的更改:"
43
- git status --short
44
- echo ""
45
-
46
- echo "请选择处理方式:"
47
- echo "1) 提交所有更改并继续发布"
48
- echo "2) 暂存所有更改并继续发布"
49
- echo "3) 取消发布,手动处理"
50
- echo ""
51
-
52
- read -p "请选择 (1-3): " choice
53
-
54
- case $choice in
55
- 1)
56
- read -p "输入提交信息: " commit_msg
57
- [ -z "$commit_msg" ] && commit_msg="chore: 发布前提交未完成更改"
58
-
59
- git add .
60
- git commit -m "$commit_msg"
61
- print_success "所有更改已提交"
62
- ;;
63
- 2)
64
- git add .
65
- print_success "所有更改已暂存"
66
- ;;
67
- 3)
68
- print_info "发布已取消,请手动处理更改后重新运行"
69
- exit 0
70
- ;;
71
- *)
72
- print_error "无效选择"
73
- ;;
74
- esac
75
- }
76
-
77
- # 获取和选择版本
78
- get_and_select_version() {
79
- current_version=$(node -p "require('./package.json').version")
80
- version_type=${1:-""}
81
-
82
- echo "🚀 CCM 智能发布"
83
- echo "当前版本: $current_version"
84
- echo ""
85
-
86
- if [ -z "$version_type" ]; then
87
- print_info "选择版本升级类型:"
88
- echo "1) patch (修订版本): $current_version → $(pnpm version patch --dry-run 2>/dev/null | cut -d'v' -f2 || echo '计算中...')"
89
- echo "2) minor (次版本): $current_version → $(pnpm version minor --dry-run 2>/dev/null | cut -d'v' -f2 || echo '计算中...')"
90
- echo "3) major (主版本): $current_version → $(pnpm version major --dry-run 2>/dev/null | cut -d'v' -f2 || echo '计算中...')"
91
- echo "4) 跳过版本升级,仅重新发布当前版本"
92
- echo ""
93
-
94
- read -p "请选择 (1-4, 回车默认选择 patch): " choice
95
-
96
- case ${choice:-1} in
97
- 1|"") version_type="patch" ;;
98
- 2) version_type="minor" ;;
99
- 3) version_type="major" ;;
100
- 4) version_type="skip" ;;
101
- *) print_error "无效选择" ;;
102
- esac
103
- fi
104
-
105
- print_info "选择: $version_type"
106
-
107
- if [ "$version_type" != "skip" ]; then
108
- echo ""
109
- read -p "确认升级版本? (y/N): " -n 1 -r
110
- echo
111
- [[ ! $REPLY =~ ^[Yy]$ ]] && { print_warning "取消发布"; exit 0; }
112
- fi
113
- }
114
-
115
- # 执行发布流程
116
- execute_release() {
117
- print_success "开始发布流程..."
118
-
119
- # 1. 构建和测试
120
- print_info "运行构建和代码检查..."
121
- pnpm run build
122
- pnpm run lint
123
-
124
- # 2. 更新版本号
125
- if [ "$version_type" != "skip" ]; then
126
- print_info "更新版本号..."
127
- new_version=$(pnpm version $version_type --no-git-tag-version)
128
- new_version=${new_version#v}
129
- print_success "版本已更新: $current_version → $new_version"
130
- else
131
- new_version=$current_version
132
- print_info "跳过版本更新,使用当前版本: $new_version"
133
- fi
134
-
135
- # 3. 先创建tag,再提交(按你的需求顺序)
136
- tag_name="v$new_version"
137
-
138
- if [ "$version_type" != "skip" ]; then
139
- print_info "创建标签: $tag_name"
140
- git tag -a "$tag_name" -m "Release v$new_version
141
-
142
- 🚀 智能发布 $version_type 版本
143
- ⏰ $(date '+%Y-%m-%d %H:%M:%S')
144
-
145
- 🤖 Generated with [Claude Code](https://claude.ai/code)
146
-
147
- Co-Authored-By: Claude <noreply@anthropic.com>"
148
-
149
- print_info "提交版本更改..."
150
- git add .
151
- git commit -m "chore: 发布版本 v$new_version
152
-
153
- 🚀 智能发布 $version_type 版本,标签 $tag_name 已创建
154
- ⏰ $(date '+%Y-%m-%d %H:%M:%S')
155
-
156
- 🤖 Generated with [Claude Code](https://claude.ai/code)
157
-
158
- Co-Authored-By: Claude <noreply@anthropic.com>"
159
-
160
- print_success "标签 $tag_name 已创建,更改已提交"
161
- fi
162
-
163
- # 4. 推送
164
- print_info "推送到远程仓库..."
165
- git push origin $(git branch --show-current)
166
- git push origin "$tag_name"
167
-
168
- print_success "版本 v$new_version 已推送,GitHub Actions 已触发"
169
-
170
- # 输出监控链接(按你的需求)
171
- print_info "📊 监控链接:"
172
- echo " 🔗 GitHub Actions: https://github.com/2ue/ccm/actions"
173
- echo " 🔗 NPM Registry: https://www.npmjs.com/package/ccman"
174
- echo " 🔗 GitHub Releases: https://github.com/2ue/ccm/releases"
175
- }
176
-
177
- # 监控发布状态
178
- monitor_release_status() {
179
- if [ "$SKIP_STATUS_CHECK" = true ]; then
180
- print_warning "跳过发布状态检查"
181
- show_manual_links
182
- return 0
183
- fi
184
-
185
- print_info "开始监控发布状态..."
186
- echo ""
187
-
188
- # GitHub Actions 状态检查
189
- print_check "检查 GitHub Actions 状态..."
190
-
191
- local max_attempts=30 # 最多检查5分钟
192
- local attempt=0
193
- local actions_success=false
194
-
195
- while [ $attempt -lt $max_attempts ]; do
196
- # 检查最新的 workflow run
197
- local run_status=$(curl -s -H "Accept: application/vnd.github.v3+json" \
198
- "https://api.github.com/repos/2ue/ccm/actions/runs?per_page=1" \
199
- | grep -o '"status":"[^"]*"' | head -1 | cut -d'"' -f4 2>/dev/null || echo "unknown")
200
-
201
- local run_conclusion=$(curl -s -H "Accept: application/vnd.github.v3+json" \
202
- "https://api.github.com/repos/2ue/ccm/actions/runs?per_page=1" \
203
- | grep -o '"conclusion":"[^"]*"' | head -1 | cut -d'"' -f4 2>/dev/null || echo "null")
204
-
205
- case "$run_status" in
206
- "completed")
207
- if [ "$run_conclusion" = "success" ]; then
208
- print_success "GitHub Actions 构建成功!"
209
- actions_success=true
210
- break
211
- else
212
- print_error "GitHub Actions 构建失败: $run_conclusion"
213
- return 1
214
- fi
215
- ;;
216
- "in_progress"|"queued")
217
- echo -ne "\r${CYAN}🔍 GitHub Actions 运行中... (${attempt}/${max_attempts})${NC}"
218
- ;;
219
- *)
220
- echo -ne "\r${YELLOW}⚠️ 等待 GitHub Actions 开始... (${attempt}/${max_attempts})${NC}"
221
- ;;
222
- esac
223
-
224
- sleep 10
225
- ((attempt++))
226
- done
227
-
228
- echo # 换行
229
-
230
- if [ "$actions_success" != true ]; then
231
- print_warning "GitHub Actions 检查超时,请手动确认"
232
- show_manual_links
233
- return 0
234
- fi
235
-
236
- # NPM 发布状态检查
237
- print_check "检查 NPM 包发布状态..."
238
-
239
- local npm_attempts=20
240
- local npm_attempt=0
241
- local npm_success=false
242
-
243
- while [ $npm_attempt -lt $npm_attempts ]; do
244
- local npm_response=$(curl -s "https://registry.npmjs.org/ccman" | grep -o "\"$new_version\"" 2>/dev/null || echo "")
245
-
246
- if [ -n "$npm_response" ]; then
247
- print_success "NPM 包 v$new_version 发布成功!"
248
- npm_success=true
249
- break
250
- else
251
- echo -ne "\r${CYAN}🔍 等待 NPM 包发布... (${npm_attempt}/${npm_attempts})${NC}"
252
- sleep 15
253
- ((npm_attempt++))
254
- fi
255
- done
256
-
257
- echo # 换行
258
-
259
- if [ "$npm_success" != true ]; then
260
- print_warning "NPM 包检查超时,可能仍在发布中"
261
- fi
262
-
263
- # GitHub Release 检查
264
- print_check "检查 GitHub Release..."
265
-
266
- local release_response=$(curl -s "https://api.github.com/repos/2ue/ccm/releases/tags/v$new_version" \
267
- | grep -o '"tag_name":"[^"]*"' 2>/dev/null || echo "")
268
-
269
- if [ -n "$release_response" ]; then
270
- print_success "GitHub Release v$new_version 创建成功!"
271
- else
272
- print_warning "GitHub Release 可能仍在创建中"
273
- fi
274
- }
275
-
276
- # 显示手动检查链接
277
- show_manual_links() {
278
- print_info "请手动检查以下链接:"
279
- echo " GitHub Actions: https://github.com/2ue/ccm/actions"
280
- echo " GitHub Release: https://github.com/2ue/ccm/releases/tag/v$new_version"
281
- echo " NPM 包: https://www.npmjs.com/package/ccman"
282
- }
283
-
284
- # 显示发布总结
285
- show_release_summary() {
286
- echo ""
287
- print_success "🎉 发布流程完成!"
288
- echo ""
289
- print_info "📋 发布总结:"
290
- echo " 版本: v$new_version"
291
- echo " NPM 包: ccman@$new_version"
292
- echo ""
293
- print_info "📦 安装命令:"
294
- echo " npm install -g ccman@$new_version"
295
- echo ""
296
- print_info "🔗 相关链接:"
297
- echo " NPM: https://www.npmjs.com/package/ccman/v/$new_version"
298
- echo " GitHub: https://github.com/2ue/ccm/releases/tag/v$new_version"
299
- echo ""
300
- }
301
-
302
- # 主函数
303
- main() {
304
- print_info "🚀 CCM 智能发布脚本 v2.0"
305
- print_info "=================================="
306
- echo ""
307
-
308
- check_environment
309
- handle_uncommitted_changes
310
- get_and_select_version "$1"
311
- execute_release
312
- monitor_release_status
313
- show_release_summary
314
-
315
- print_success "✨ 发布成功完成!"
316
- }
317
-
318
- # 错误处理
319
- trap 'print_error "发布过程中出现错误,请检查输出信息"' ERR
320
-
321
- # 运行主函数
322
- main "$@"