@sokeai/cli 1.0.5 → 1.0.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/scripts/push.sh +35 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sokeai/cli",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "授客AI官方CLI工具 - 支持AI Agent Skills",
5
5
  "bin": {
6
6
  "soke-cli": "scripts/run.js"
package/scripts/push.sh CHANGED
@@ -42,7 +42,7 @@ get_current_version() {
42
42
  }
43
43
 
44
44
  # 更新 package.json 中的版本号
45
- update_version() {
45
+ update_package_json_version() {
46
46
  local new_version=$1
47
47
 
48
48
  if [[ "$OSTYPE" == "darwin"* ]]; then
@@ -56,6 +56,35 @@ update_version() {
56
56
  print_info "已更新 package.json 版本号为: ${GREEN}${new_version}${NC}"
57
57
  }
58
58
 
59
+ # 更新 internal/version/checker.go 中的版本号
60
+ update_version_checker() {
61
+ local new_version=$1
62
+ local version_file="internal/version/checker.go"
63
+
64
+ if [[ ! -f "$version_file" ]]; then
65
+ print_warning "未找到 $version_file 文件,跳过更新"
66
+ return
67
+ fi
68
+
69
+ if [[ "$OSTYPE" == "darwin"* ]]; then
70
+ # macOS 使用 BSD sed
71
+ sed -i '' "s/var Version = \".*\"/var Version = \"$new_version\"/" "$version_file"
72
+ else
73
+ # Linux 使用 GNU sed
74
+ sed -i "s/var Version = \".*\"/var Version = \"$new_version\"/" "$version_file"
75
+ fi
76
+
77
+ print_info "已更新 $version_file 版本号为: ${GREEN}${new_version}${NC}"
78
+ }
79
+
80
+ # 更新所有版本号
81
+ update_all_versions() {
82
+ local new_version=$1
83
+
84
+ update_package_json_version "$new_version"
85
+ update_version_checker "$new_version"
86
+ }
87
+
59
88
  # 验证版本号格式(简单的语义化版本检查)
60
89
  validate_version() {
61
90
  local version=$1
@@ -117,12 +146,12 @@ if [[ "$is_release" == "y" || "$is_release" == "Y" ]]; then
117
146
  fi
118
147
  done
119
148
 
120
- # 更新 package.json 中的版本号
121
- update_version "$NEW_VERSION"
149
+ # 更新所有文件中的版本号
150
+ update_all_versions "$NEW_VERSION"
122
151
 
123
- # 将 package.json 的改动加入暂存区
124
- git add package.json
125
- print_info "已将 package.json 版本更新加入暂存区"
152
+ # 将版本更新的改动加入暂存区
153
+ git add package.json internal/version/checker.go
154
+ print_info "已将版本更新加入暂存区"
126
155
  fi
127
156
 
128
157
  # 执行 git add .