ccman 0.1.0 → 0.1.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccman",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Claude Code Manager - A TypeScript tool to manage Claude Code API configurations",
5
5
  "main": "dist/index.js",
6
6
  "packageManager": "pnpm@8.15.1",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccman",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Claude Code Manager - A TypeScript tool to manage Claude Code API configurations",
5
5
  "main": "dist/index.js",
6
6
  "packageManager": "pnpm@8.15.1",
@@ -148,11 +148,11 @@ push_to_remote_quiet() {
148
148
  # 推送提交(如果有)
149
149
  if [ "$has_commit" = "true" ]; then
150
150
  local current_branch=$(git branch --show-current)
151
- git push origin "$current_branch" 2>/dev/null
151
+ git push origin "$current_branch" >/dev/null 2>&1
152
152
  fi
153
153
 
154
154
  # 推送tag
155
- git push origin "$tag_name" 2>/dev/null || git push origin "$tag_name" --force 2>/dev/null
155
+ git push origin "$tag_name" >/dev/null 2>&1 || git push origin "$tag_name" --force >/dev/null 2>&1
156
156
  }
157
157
 
158
158
  # 推送tag和提交到远程(交互模式)
@@ -185,8 +185,8 @@ create_tag_quietly() {
185
185
  # 检查tag是否已存在
186
186
  if check_tag_exists "$tag_name"; then
187
187
  # 如果tag存在,删除并重新创建
188
- git tag -d "$tag_name" 2>/dev/null
189
- git push origin --delete "$tag_name" 2>/dev/null
188
+ git tag -d "$tag_name" >/dev/null 2>&1
189
+ git push origin --delete "$tag_name" >/dev/null 2>&1
190
190
  fi
191
191
 
192
192
  # 创建tag
@@ -199,10 +199,10 @@ create_tag_quietly() {
199
199
 
200
200
  Co-Authored-By: Claude <noreply@anthropic.com>"
201
201
 
202
- git tag -a "$tag_name" -m "$tag_message" 2>/dev/null
202
+ git tag -a "$tag_name" -m "$tag_message" >/dev/null 2>&1
203
203
 
204
- # 静默推送
205
- push_to_remote_quiet "$tag_name" "false"
204
+ # 静默推送(始终推送当前分支和tag)
205
+ push_to_remote_quiet "$tag_name" "true"
206
206
 
207
207
  # 输出tag名称
208
208
  echo "$tag_name"
@@ -74,12 +74,13 @@ check_github_actions() {
74
74
  # 检查最新的workflow运行状态
75
75
  local api_response=$(curl -s "https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/actions/runs?per_page=1" 2>/dev/null || echo "")
76
76
 
77
- if [ -n "$api_response" ]; then
77
+ if [ -n "$api_response" ] && ! echo "$api_response" | grep -q '"message"'; then
78
78
  local run_status=$(echo "$api_response" | grep -o '"status":"[^"]*"' | head -1 | cut -d'"' -f4 2>/dev/null || echo "unknown")
79
79
  local run_conclusion=$(echo "$api_response" | grep -o '"conclusion":"[^"]*"' | head -1 | cut -d'"' -f4 2>/dev/null || echo "null")
80
80
 
81
81
  case "$run_status" in
82
82
  "completed")
83
+ echo # 换行
83
84
  if [ "$run_conclusion" = "success" ]; then
84
85
  print_success "GitHub Actions 构建成功! ✨"
85
86
  return 0
@@ -156,9 +157,13 @@ check_github_release() {
156
157
 
157
158
  if [ -n "$release_response" ] && ! echo "$release_response" | grep -q '"message":"Not Found"'; then
158
159
  # 检查release状态
159
- local release_draft=$(echo "$release_response" | grep -o '"draft":[^,}]*' | cut -d':' -f2 2>/dev/null || echo "true")
160
+ local release_draft=$(echo "$release_response" | grep -o '"draft":[^,}]*' | cut -d':' -f2 | tr -d ' ' 2>/dev/null || echo "true")
161
+
162
+ # 调试输出
163
+ # echo "[DEBUG] release_draft = '$release_draft'" >&2
160
164
 
161
165
  if [ "$release_draft" = "false" ]; then
166
+ echo # 换行
162
167
  print_success "GitHub Release v$version 创建成功! 🎉"
163
168
  return 0
164
169
  else
@@ -220,7 +225,7 @@ generate_summary() {
220
225
  fi
221
226
  }
222
227
 
223
- # 主函数: 监控发布状态
228
+ # 主函数: 监控发布状态(只监控NPM和Release)
224
229
  monitor_release() {
225
230
  local version=$(get_version_info)
226
231
  local commit_id=$(get_latest_commit)
@@ -232,8 +237,12 @@ monitor_release() {
232
237
  print_info "超时: ${MAX_WAIT_MINUTES} 分钟"
233
238
  echo ""
234
239
 
235
- # 显示监控链接
236
- show_monitoring_links "$version" "$commit_id"
240
+ # 显示监控链接(只显示需要的)
241
+ print_info "📊 监控链接:"
242
+ echo " 🔗 NPM Package: https://www.npmjs.com/package/${PACKAGE_NAME}"
243
+ echo " 🔗 NPM Version: https://www.npmjs.com/package/${PACKAGE_NAME}/v/${version}"
244
+ echo " 🔗 GitHub Release: https://github.com/${REPO_OWNER}/${REPO_NAME}/releases/tag/v${version}"
245
+ echo ""
237
246
 
238
247
  # 检查curl是否可用
239
248
  if ! command -v curl &> /dev/null; then
@@ -242,16 +251,11 @@ monitor_release() {
242
251
  return 1
243
252
  fi
244
253
 
245
- # 并行监控各个状态
246
254
  print_info "开始监控发布状态... (最长等待 ${MAX_WAIT_MINUTES} 分钟)"
247
255
  echo ""
248
256
 
249
- # 检查GitHub Actions
250
- check_github_actions
251
- local actions_status=$?
252
-
253
257
  # 检查NPM包发布
254
- check_npm_package "$version"
258
+ check_npm_package "$version"
255
259
  local npm_status=$?
256
260
 
257
261
  # 检查GitHub Release
@@ -259,7 +263,31 @@ monitor_release() {
259
263
  local release_status=$?
260
264
 
261
265
  # 生成总结报告
262
- generate_summary "$version" $actions_status $npm_status $release_status
266
+ echo ""
267
+ echo "📋 发布监控总结"
268
+ echo "================"
269
+ echo " 版本: v$version"
270
+ echo " NPM 包发布: $(get_status_icon $npm_status)"
271
+ echo " GitHub Release: $(get_status_icon $release_status)"
272
+ echo ""
273
+
274
+ # 结果判断
275
+ if [ $npm_status -eq 0 ] && [ $release_status -eq 0 ]; then
276
+ print_success "🎉 发布完成!NPM包和GitHub Release都已正常发布"
277
+ return 0
278
+ elif [ $npm_status -eq 2 ] || [ $release_status -eq 2 ]; then
279
+ print_warning "⚠️ 发布监控超时 (${MAX_WAIT_MINUTES}分钟),请手动检查:"
280
+ if [ $npm_status -eq 2 ]; then
281
+ echo " • NPM包状态: https://www.npmjs.com/package/${PACKAGE_NAME}/v/${version}"
282
+ fi
283
+ if [ $release_status -eq 2 ]; then
284
+ echo " • GitHub Release: https://github.com/${REPO_OWNER}/${REPO_NAME}/releases/tag/v${version}"
285
+ fi
286
+ return 2
287
+ else
288
+ print_warning "⚠️ 发布部分失败,请手动检查上述链接"
289
+ return 1
290
+ fi
263
291
  }
264
292
 
265
293
  # 如果直接运行此脚本
@@ -37,8 +37,10 @@ get_current_version() {
37
37
  calculate_version_preview() {
38
38
  local version_type=$1
39
39
  local preview=$(pnpm version $version_type --dry-run 2>/dev/null)
40
- if [ $? -eq 0 ] && [ -n "$preview" ]; then
41
- echo "$preview" | sed 's/^v//' 2>/dev/null || echo "计算失败"
40
+
41
+ if [ -n "$preview" ]; then
42
+ # 移除前缀v并返回
43
+ echo "$preview" | sed 's/^v//'
42
44
  else
43
45
  echo "计算失败"
44
46
  fi
@@ -94,23 +96,18 @@ version_bump() {
94
96
  show_version_menu "$current_version" "$suggested_type"
95
97
 
96
98
  # 获取用户选择
97
- read -p "请选择版本升级类型 (1-5, 回车默认选择推荐): " choice
99
+ read -p "请选择版本升级类型 (1-4, 回车默认选择推荐): " choice
98
100
 
99
101
  # 处理用户选择
100
102
  case ${choice:-""} in
101
- 1|"")
102
- if [ "$suggested_type" == "patch" ]; then
103
- version_type="patch"
104
- elif [ "$suggested_type" == "minor" ]; then
105
- version_type="minor"
106
- else
107
- version_type="major"
108
- fi
103
+ "")
104
+ # 回车默认选择推荐版本
105
+ version_type="$suggested_type"
109
106
  ;;
110
- 2) version_type="patch" ;;
111
- 3) version_type="minor" ;;
112
- 4) version_type="major" ;;
113
- 5) handle_custom_version ;;
107
+ 1) version_type="patch" ;;
108
+ 2) version_type="minor" ;;
109
+ 3) version_type="major" ;;
110
+ 4) handle_custom_version ;;
114
111
  *)
115
112
  print_error "无效选择"
116
113
  exit 1