yunxiao-code 1.0.7 → 1.0.9
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/README.md +147 -27
- package/bin/yx-code-darwin-amd64 +0 -0
- package/bin/yx-code-darwin-arm64 +0 -0
- package/bin/yx-code-linux-amd64 +0 -0
- package/package.json +10 -1
package/README.md
CHANGED
|
@@ -1,20 +1,32 @@
|
|
|
1
1
|
# yx-code
|
|
2
2
|
|
|
3
|
-
阿里云云效 CLI 工具,支持 Git
|
|
3
|
+
阿里云云效 CLI 工具,支持 Git 提交、推送、克隆及创建合并请求,让开发者可以在终端中完成日常开发工作流,无需打开浏览器。
|
|
4
|
+
|
|
5
|
+
## 功能特性
|
|
6
|
+
|
|
7
|
+
- 🚀 **克隆仓库** - 支持从主分支自动创建新分支
|
|
8
|
+
- 📝 **提交代码** - 一键 add + commit
|
|
9
|
+
- 📤 **推送代码** - 自动推送当前分支到远程
|
|
10
|
+
- 🔀 **合并请求** - 快速创建 MR,支持指定目标分支
|
|
11
|
+
- 📊 **代码差异** - 查看分支间的代码差异统计
|
|
4
12
|
|
|
5
13
|
## 安装
|
|
6
14
|
|
|
7
15
|
### npm 安装(推荐)
|
|
8
16
|
|
|
9
17
|
```bash
|
|
10
|
-
npm install -g
|
|
18
|
+
npm install -g yunxiao-code
|
|
11
19
|
```
|
|
12
20
|
|
|
21
|
+
支持平台:
|
|
22
|
+
- macOS (Intel/Apple Silicon)
|
|
23
|
+
- Linux (x64)
|
|
24
|
+
|
|
13
25
|
### 从源码编译
|
|
14
26
|
|
|
15
27
|
```bash
|
|
16
28
|
git clone <repo-url>
|
|
17
|
-
cd
|
|
29
|
+
cd yunxiao-code
|
|
18
30
|
make build-local
|
|
19
31
|
sudo make install
|
|
20
32
|
```
|
|
@@ -26,17 +38,21 @@ go build -o yx-code ./cmd/yx-code
|
|
|
26
38
|
sudo mv yx-code /usr/local/bin/
|
|
27
39
|
```
|
|
28
40
|
|
|
29
|
-
##
|
|
41
|
+
## 系统要求
|
|
42
|
+
|
|
43
|
+
- Go 1.26.1+(从源码编译时)
|
|
44
|
+
- Git CLI(运行时依赖)
|
|
45
|
+
- Node.js 14+(npm 安装时)
|
|
30
46
|
|
|
31
|
-
|
|
47
|
+
## 快速开始
|
|
32
48
|
|
|
33
|
-
|
|
49
|
+
### 1. 初始化配置
|
|
34
50
|
|
|
35
51
|
```bash
|
|
36
52
|
yx-code init
|
|
37
53
|
```
|
|
38
54
|
|
|
39
|
-
|
|
55
|
+
在当前目录生成 `.yunxiao.yaml` 配置文件:
|
|
40
56
|
|
|
41
57
|
```yaml
|
|
42
58
|
# 云效合并请求 CLI 配置
|
|
@@ -47,20 +63,21 @@ token: ""
|
|
|
47
63
|
|
|
48
64
|
填写 `organization_id` 和 `token`(个人访问令牌)。
|
|
49
65
|
|
|
66
|
+
> **获取 Token**: 云效控制台 → 个人设置 → 个人访问令牌 → 创建令牌
|
|
67
|
+
|
|
50
68
|
### 2. 配置项说明
|
|
51
69
|
|
|
52
70
|
| 字段 | 说明 | 默认值 |
|
|
53
71
|
|------|------|--------|
|
|
54
72
|
| `domain` | 云效 API 域名 | `openapi-rdc.aliyuncs.com` |
|
|
55
|
-
| `organization_id` | 组织 ID |
|
|
56
|
-
| `token` |
|
|
73
|
+
| `organization_id` | 组织 ID(必填) | 无 |
|
|
74
|
+
| `token` | 个人访问令牌(必填) | 无 |
|
|
57
75
|
|
|
58
76
|
### 3. 环境变量配置
|
|
59
77
|
|
|
60
78
|
也可以通过环境变量配置:
|
|
61
79
|
|
|
62
80
|
```bash
|
|
63
|
-
# 设置环境变量
|
|
64
81
|
export YUNXIAO_DOMAIN="openapi-rdc.aliyuncs.com"
|
|
65
82
|
export YUNXIAO_ORGANIZATION_ID="your-org-id"
|
|
66
83
|
export YUNXIAO_TOKEN="your-token"
|
|
@@ -73,50 +90,153 @@ export YUNXIAO_TOKEN="your-token"
|
|
|
73
90
|
3. 环境变量:`YUNXIAO_DOMAIN`、`YUNXIAO_ORGANIZATION_ID`、`YUNXIAO_TOKEN`
|
|
74
91
|
4. CLI 参数:`--domain`、`--org`、`--token`
|
|
75
92
|
|
|
76
|
-
##
|
|
93
|
+
## 命令参考
|
|
94
|
+
|
|
95
|
+
### yx-code init
|
|
77
96
|
|
|
78
|
-
|
|
97
|
+
初始化云效配置文件。
|
|
79
98
|
|
|
80
99
|
```bash
|
|
81
|
-
yx-code
|
|
100
|
+
yx-code init
|
|
82
101
|
```
|
|
83
102
|
|
|
84
|
-
|
|
103
|
+
### yx-code clone
|
|
85
104
|
|
|
86
|
-
|
|
87
|
-
- `-p <路径>` — 指定克隆目标路径
|
|
105
|
+
克隆云效代码仓库。
|
|
88
106
|
|
|
89
|
-
|
|
107
|
+
```bash
|
|
108
|
+
yx-code clone <git-url> [flags]
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
| 参数 | 简写 | 必填 | 说明 |
|
|
112
|
+
|------|------|------|------|
|
|
113
|
+
| `<git-url>` | | 是 | Git 仓库地址 |
|
|
114
|
+
| `--branch` | `-b` | 否 | 新分支名称,指定后会从主分支创建新分支 |
|
|
115
|
+
| `--path` | `-p` | 否 | 克隆目标路径,默认从 URL 提取仓库名 |
|
|
90
116
|
|
|
91
117
|
```bash
|
|
92
|
-
|
|
118
|
+
# 基本克隆
|
|
119
|
+
yx-code clone https://codeup.aliyun.com/your-org/your-repo.git
|
|
120
|
+
|
|
121
|
+
# 克隆并创建新分支
|
|
122
|
+
yx-code clone https://codeup.aliyun.com/your-org/your-repo.git -b feature/new-feature
|
|
93
123
|
```
|
|
94
124
|
|
|
95
|
-
|
|
125
|
+
### yx-code commit
|
|
96
126
|
|
|
97
|
-
|
|
127
|
+
提交代码变更。
|
|
98
128
|
|
|
99
129
|
```bash
|
|
100
|
-
yx-code
|
|
130
|
+
yx-code commit -m "<message>"
|
|
101
131
|
```
|
|
102
132
|
|
|
133
|
+
| 参数 | 简写 | 必填 | 说明 |
|
|
134
|
+
|------|------|------|------|
|
|
135
|
+
| `--message` | `-m` | 是 | 提交信息 |
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
yx-code commit -m "feat: 添加用户登录功能"
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### yx-code push
|
|
142
|
+
|
|
103
143
|
推送当前分支到远程仓库。
|
|
104
144
|
|
|
105
|
-
|
|
145
|
+
```bash
|
|
146
|
+
yx-code push
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### yx-code mr
|
|
150
|
+
|
|
151
|
+
创建合并请求。
|
|
106
152
|
|
|
107
153
|
```bash
|
|
108
|
-
yx-code mr -m "
|
|
154
|
+
yx-code mr -m "<title>" [flags]
|
|
109
155
|
```
|
|
110
156
|
|
|
111
|
-
|
|
157
|
+
| 参数 | 简写 | 必填 | 说明 |
|
|
158
|
+
|------|------|------|------|
|
|
159
|
+
| `--message` | `-m` | 是 | MR 标题 |
|
|
160
|
+
| `--description` | `-d` | 否 | MR 描述 |
|
|
161
|
+
| `--target` | `-t` | 否 | 目标分支,默认: develop |
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# 基本用法(目标分支默认 develop)
|
|
165
|
+
yx-code mr -m "添加用户登录功能"
|
|
166
|
+
|
|
167
|
+
# 指定目标分支
|
|
168
|
+
yx-code mr -m "添加用户登录功能" -t main
|
|
169
|
+
|
|
170
|
+
# 带描述
|
|
171
|
+
yx-code mr -m "添加用户登录功能" -d "实现用户登录、注销功能"
|
|
172
|
+
```
|
|
112
173
|
|
|
113
|
-
|
|
114
|
-
|
|
174
|
+
### yx-code diff
|
|
175
|
+
|
|
176
|
+
查看分支间的代码差异统计。
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
yx-code diff [flags]
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
| 参数 | 简写 | 必填 | 说明 |
|
|
183
|
+
|------|------|------|------|
|
|
184
|
+
| `--target` | `-t` | 否 | 目标分支,默认: develop |
|
|
185
|
+
| `--source` | `-s` | 否 | 源分支,默认: 当前分支 |
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
# 查看当前分支与 develop 的差异
|
|
189
|
+
yx-code diff
|
|
190
|
+
|
|
191
|
+
# 指定分支
|
|
192
|
+
yx-code diff -t main -s feature/new-feature
|
|
193
|
+
```
|
|
115
194
|
|
|
116
195
|
### 全局参数
|
|
117
196
|
|
|
118
|
-
|
|
197
|
+
所有子命令支持以下全局参数,用于覆盖配置文件:
|
|
119
198
|
|
|
120
199
|
```bash
|
|
121
200
|
yx-code <command> --domain <域名> --org <组织ID> --token <令牌>
|
|
122
201
|
```
|
|
202
|
+
|
|
203
|
+
| 参数 | 说明 |
|
|
204
|
+
|------|------|
|
|
205
|
+
| `--domain` | 云效 API 域名 |
|
|
206
|
+
| `--org` | 组织 ID |
|
|
207
|
+
| `--token` | 个人访问令牌 |
|
|
208
|
+
|
|
209
|
+
## 工作流示例
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
# 1. 初始化配置
|
|
213
|
+
yx-code init
|
|
214
|
+
# 编辑 .yunxiao.yaml 填写凭证
|
|
215
|
+
|
|
216
|
+
# 2. 克隆仓库并创建特性分支
|
|
217
|
+
yx-code clone https://codeup.aliyun.com/org/repo.git -b feature/login
|
|
218
|
+
|
|
219
|
+
# 3. 进入仓库目录
|
|
220
|
+
cd repo
|
|
221
|
+
|
|
222
|
+
# 4. 开发完成后提交
|
|
223
|
+
yx-code commit -m "feat: 实现登录功能"
|
|
224
|
+
|
|
225
|
+
# 5. 推送到远程
|
|
226
|
+
yx-code push
|
|
227
|
+
|
|
228
|
+
# 6. 创建合并请求
|
|
229
|
+
yx-code mr -m "添加用户登录功能"
|
|
230
|
+
|
|
231
|
+
# 7. 查看代码差异
|
|
232
|
+
yx-code diff
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## 相关链接
|
|
236
|
+
|
|
237
|
+
- [阿里云云效官方文档](https://help.aliyun.com/zh/yunxiao/)
|
|
238
|
+
- [云效 OpenAPI 文档](https://help.aliyun.com/zh/yunxiao/developer-reference/)
|
|
239
|
+
|
|
240
|
+
## License
|
|
241
|
+
|
|
242
|
+
MIT
|
package/bin/yx-code-darwin-amd64
CHANGED
|
Binary file
|
package/bin/yx-code-darwin-arm64
CHANGED
|
Binary file
|
package/bin/yx-code-linux-amd64
CHANGED
|
Binary file
|
package/package.json
CHANGED