@sokeai/cli 1.0.2 → 1.0.3

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": "@sokeai/cli",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "授客AI官方CLI工具 - 支持AI Agent Skills",
5
5
  "bin": {
6
6
  "soke-cli": "scripts/run.js"
@@ -0,0 +1,107 @@
1
+ #!/bin/bash
2
+
3
+ # 授客CLI双远程仓库推送脚本
4
+ # 用途:将代码同时推送到 GitHub 和 Aliyun 远程仓库
5
+
6
+ set -e # 遇到错误立即退出
7
+
8
+ # 颜色定义
9
+ RED='\033[0;31m'
10
+ GREEN='\033[0;32m'
11
+ YELLOW='\033[1;33m'
12
+ NC='\033[0m' # No Color
13
+
14
+ # 打印带颜色的信息
15
+ print_info() {
16
+ echo -e "${GREEN}[信息]${NC} $1"
17
+ }
18
+
19
+ print_warning() {
20
+ echo -e "${YELLOW}[警告]${NC} $1"
21
+ }
22
+
23
+ print_error() {
24
+ echo -e "${RED}[错误]${NC} $1"
25
+ }
26
+
27
+ # 获取当前分支名
28
+ CURRENT_BRANCH=$(git branch --show-current)
29
+
30
+ # 显示当前分支并确认
31
+ echo ""
32
+ print_info "当前所在分支: ${GREEN}${CURRENT_BRANCH}${NC}"
33
+ echo ""
34
+ read -p "是否在当前分支提交代码?(y/n): " confirm
35
+
36
+ if [[ "$confirm" != "y" && "$confirm" != "Y" ]]; then
37
+ print_warning "用户取消操作,脚本退出"
38
+ exit 0
39
+ fi
40
+
41
+ # 执行 git add .
42
+ print_info "正在暂存所有更改..."
43
+ git add .
44
+
45
+ # 检查是否有需要提交的更改
46
+ if git diff --cached --quiet; then
47
+ print_warning "没有需要提交的更改"
48
+ exit 0
49
+ fi
50
+
51
+ # 提示输入 commit 信息
52
+ echo ""
53
+ read -p "请输入 commit 信息: " commit_info
54
+
55
+ if [[ -z "$commit_info" ]]; then
56
+ print_error "commit 信息不能为空"
57
+ exit 1
58
+ fi
59
+
60
+ # 执行 commit
61
+ print_info "正在提交代码..."
62
+ git commit -m "$commit_info"
63
+
64
+ # 保存当前分支名(用于后续合并)
65
+ FEATURE_BRANCH=$CURRENT_BRANCH
66
+
67
+ # 切换到 master 分支
68
+ print_info "切换到 master 分支..."
69
+ git checkout master
70
+
71
+ # 合并功能分支到 master
72
+ print_info "合并 ${FEATURE_BRANCH} 到 master..."
73
+ git merge $FEATURE_BRANCH
74
+
75
+ # 推送到 origin (Aliyun) 的 master 分支
76
+ print_info "推送到 Aliyun 远程仓库 (origin master)..."
77
+ git push origin master
78
+
79
+ # 推送到 github 的 master 分支
80
+ print_info "推送到 GitHub 远程仓库 (github master)..."
81
+ git push github master
82
+
83
+ # 切换到 main 分支
84
+ print_info "切换到 main 分支..."
85
+ git checkout main
86
+
87
+ # 合并 master 到 main
88
+ print_info "合并 master 到 main..."
89
+ git merge master
90
+
91
+ # 推送到 github 的 main 分支
92
+ print_info "推送到 GitHub 远程仓库 (github main)..."
93
+ git push github main
94
+
95
+ # 切换回原分支
96
+ print_info "切换回原分支 ${FEATURE_BRANCH}..."
97
+ git checkout $FEATURE_BRANCH
98
+
99
+ echo ""
100
+ print_info "✅ 代码推送完成!"
101
+ echo ""
102
+ print_info "推送摘要:"
103
+ echo " - 功能分支: ${FEATURE_BRANCH}"
104
+ echo " - Commit 信息: ${commit_info}"
105
+ echo " - Aliyun (origin): master 分支已更新"
106
+ echo " - GitHub (github): master 和 main 分支已更新"
107
+ echo ""
@@ -199,8 +199,8 @@ main() {
199
199
  echo -e "NPM: ${BLUE}https://www.npmjs.com/package/@sokeai/cli${NC}"
200
200
  echo -e "GitHub: ${BLUE}https://github.com/sokeai/soke-cli/releases/tag/v${VERSION}${NC}"
201
201
  echo ""
202
- echo "用户可以通过以下命令安装:"
203
- echo -e "${YELLOW}npm install -g @sokeai/cli${NC}"
202
+ echo "安装或升级到最新版本:"
203
+ echo -e "${YELLOW}npm install -g @sokeai/cli@latest${NC}"
204
204
  }
205
205
 
206
206
  # 确认发布