yunxiao-code 1.0.6 → 1.0.8
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 +155 -28
- 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/bin/yx-code.js +18 -19
- package/package.json +3 -4
- package/scripts/postinstall.js +8 -75
- package/bin/yx-code +0 -0
- package/skills/.claude-plugin/plugin.json +0 -10
- package/skills/README.md +0 -100
- package/skills/skills/yx-workflow/SKILL.md +0 -65
- package/skills/yx-commands/clone.md +0 -18
- package/skills/yx-commands/commit.md +0 -44
- package/skills/yx-commands/init.md +0 -20
- package/skills/yx-commands/mr.md +0 -25
- package/skills/yx-commands/push.md +0 -20
package/README.md
CHANGED
|
@@ -1,35 +1,58 @@
|
|
|
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
|
|
18
|
-
|
|
29
|
+
cd yunxiao-code
|
|
30
|
+
make build-local
|
|
31
|
+
sudo make install
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
或手动编译:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
go build -o yx-code ./cmd/yx-code
|
|
19
38
|
sudo mv yx-code /usr/local/bin/
|
|
20
39
|
```
|
|
21
40
|
|
|
22
|
-
##
|
|
41
|
+
## 系统要求
|
|
42
|
+
|
|
43
|
+
- Go 1.26.1+(从源码编译时)
|
|
44
|
+
- Git CLI(运行时依赖)
|
|
45
|
+
- Node.js 14+(npm 安装时)
|
|
23
46
|
|
|
24
|
-
|
|
47
|
+
## 快速开始
|
|
25
48
|
|
|
26
|
-
|
|
49
|
+
### 1. 初始化配置
|
|
27
50
|
|
|
28
51
|
```bash
|
|
29
52
|
yx-code init
|
|
30
53
|
```
|
|
31
54
|
|
|
32
|
-
|
|
55
|
+
在当前目录生成 `.yunxiao.yaml` 配置文件:
|
|
33
56
|
|
|
34
57
|
```yaml
|
|
35
58
|
# 云效合并请求 CLI 配置
|
|
@@ -40,20 +63,21 @@ token: ""
|
|
|
40
63
|
|
|
41
64
|
填写 `organization_id` 和 `token`(个人访问令牌)。
|
|
42
65
|
|
|
66
|
+
> **获取 Token**: 云效控制台 → 个人设置 → 个人访问令牌 → 创建令牌
|
|
67
|
+
|
|
43
68
|
### 2. 配置项说明
|
|
44
69
|
|
|
45
70
|
| 字段 | 说明 | 默认值 |
|
|
46
71
|
|------|------|--------|
|
|
47
72
|
| `domain` | 云效 API 域名 | `openapi-rdc.aliyuncs.com` |
|
|
48
|
-
| `organization_id` | 组织 ID |
|
|
49
|
-
| `token` |
|
|
73
|
+
| `organization_id` | 组织 ID(必填) | 无 |
|
|
74
|
+
| `token` | 个人访问令牌(必填) | 无 |
|
|
50
75
|
|
|
51
76
|
### 3. 环境变量配置
|
|
52
77
|
|
|
53
78
|
也可以通过环境变量配置:
|
|
54
79
|
|
|
55
80
|
```bash
|
|
56
|
-
# 设置环境变量
|
|
57
81
|
export YUNXIAO_DOMAIN="openapi-rdc.aliyuncs.com"
|
|
58
82
|
export YUNXIAO_ORGANIZATION_ID="your-org-id"
|
|
59
83
|
export YUNXIAO_TOKEN="your-token"
|
|
@@ -66,50 +90,153 @@ export YUNXIAO_TOKEN="your-token"
|
|
|
66
90
|
3. 环境变量:`YUNXIAO_DOMAIN`、`YUNXIAO_ORGANIZATION_ID`、`YUNXIAO_TOKEN`
|
|
67
91
|
4. CLI 参数:`--domain`、`--org`、`--token`
|
|
68
92
|
|
|
69
|
-
##
|
|
93
|
+
## 命令参考
|
|
94
|
+
|
|
95
|
+
### yx-code init
|
|
70
96
|
|
|
71
|
-
|
|
97
|
+
初始化云效配置文件。
|
|
72
98
|
|
|
73
99
|
```bash
|
|
74
|
-
yx-code
|
|
100
|
+
yx-code init
|
|
75
101
|
```
|
|
76
102
|
|
|
77
|
-
|
|
103
|
+
### yx-code clone
|
|
78
104
|
|
|
79
|
-
|
|
80
|
-
- `-p <路径>` — 指定克隆目标路径
|
|
105
|
+
克隆云效代码仓库。
|
|
81
106
|
|
|
82
|
-
|
|
107
|
+
```bash
|
|
108
|
+
yx-code clone <git-url> [flags]
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
| 参数 | 简写 | 必填 | 说明 |
|
|
112
|
+
|------|------|------|------|
|
|
113
|
+
| `<git-url>` | | 是 | Git 仓库地址 |
|
|
114
|
+
| `--branch` | `-b` | 否 | 新分支名称,指定后会从主分支创建新分支 |
|
|
115
|
+
| `--path` | `-p` | 否 | 克隆目标路径,默认从 URL 提取仓库名 |
|
|
83
116
|
|
|
84
117
|
```bash
|
|
85
|
-
|
|
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
|
|
86
123
|
```
|
|
87
124
|
|
|
88
|
-
|
|
125
|
+
### yx-code commit
|
|
89
126
|
|
|
90
|
-
|
|
127
|
+
提交代码变更。
|
|
91
128
|
|
|
92
129
|
```bash
|
|
93
|
-
yx-code
|
|
130
|
+
yx-code commit -m "<message>"
|
|
94
131
|
```
|
|
95
132
|
|
|
133
|
+
| 参数 | 简写 | 必填 | 说明 |
|
|
134
|
+
|------|------|------|------|
|
|
135
|
+
| `--message` | `-m` | 是 | 提交信息 |
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
yx-code commit -m "feat: 添加用户登录功能"
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### yx-code push
|
|
142
|
+
|
|
96
143
|
推送当前分支到远程仓库。
|
|
97
144
|
|
|
98
|
-
|
|
145
|
+
```bash
|
|
146
|
+
yx-code push
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### yx-code mr
|
|
150
|
+
|
|
151
|
+
创建合并请求。
|
|
99
152
|
|
|
100
153
|
```bash
|
|
101
|
-
yx-code mr -m "
|
|
154
|
+
yx-code mr -m "<title>" [flags]
|
|
102
155
|
```
|
|
103
156
|
|
|
104
|
-
|
|
157
|
+
| 参数 | 简写 | 必填 | 说明 |
|
|
158
|
+
|------|------|------|------|
|
|
159
|
+
| `--message` | `-m` | 是 | MR 标题 |
|
|
160
|
+
| `--description` | `-d` | 否 | MR 描述 |
|
|
161
|
+
| `--target` | `-t` | 否 | 目标分支,默认: develop |
|
|
105
162
|
|
|
106
|
-
|
|
107
|
-
|
|
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
|
+
```
|
|
173
|
+
|
|
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
|
+
```
|
|
108
194
|
|
|
109
195
|
### 全局参数
|
|
110
196
|
|
|
111
|
-
|
|
197
|
+
所有子命令支持以下全局参数,用于覆盖配置文件:
|
|
112
198
|
|
|
113
199
|
```bash
|
|
114
200
|
yx-code <command> --domain <域名> --org <组织ID> --token <令牌>
|
|
115
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/bin/yx-code.js
CHANGED
|
@@ -1,34 +1,33 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
const { spawn } = require('child_process');
|
|
3
4
|
const path = require('path');
|
|
4
5
|
const os = require('os');
|
|
5
6
|
|
|
7
|
+
// 根据平台选择二进制文件
|
|
6
8
|
const platform = os.platform();
|
|
7
9
|
const arch = os.arch();
|
|
8
10
|
|
|
9
|
-
let
|
|
11
|
+
let binaryName;
|
|
10
12
|
if (platform === 'darwin' && arch === 'arm64') {
|
|
11
|
-
|
|
13
|
+
binaryName = 'yx-code-darwin-arm64';
|
|
12
14
|
} else if (platform === 'darwin' && arch === 'x64') {
|
|
13
|
-
|
|
15
|
+
binaryName = 'yx-code-darwin-amd64';
|
|
14
16
|
} else if (platform === 'linux' && arch === 'x64') {
|
|
15
|
-
|
|
17
|
+
binaryName = 'yx-code-linux-amd64';
|
|
16
18
|
} else {
|
|
17
|
-
console.error(`Unsupported platform: ${platform}
|
|
19
|
+
console.error(`Unsupported platform: ${platform}-${arch}`);
|
|
18
20
|
process.exit(1);
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
const binaryPath = path.join(__dirname,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}).join(' ');
|
|
23
|
+
const binaryPath = path.join(__dirname, binaryName);
|
|
24
|
+
|
|
25
|
+
// 执行二进制文件,传递所有参数
|
|
26
|
+
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
27
|
+
stdio: 'inherit',
|
|
28
|
+
shell: false
|
|
29
|
+
});
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
process.exit(error.status);
|
|
34
|
-
}
|
|
31
|
+
child.on('exit', (code) => {
|
|
32
|
+
process.exit(code || 0);
|
|
33
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yunxiao-code",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "阿里云云效 CLI 工具",
|
|
5
5
|
"bin": {
|
|
6
6
|
"yx-code": "bin/yx-code.js"
|
|
@@ -10,11 +10,10 @@
|
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"bin",
|
|
13
|
-
"scripts"
|
|
14
|
-
"skills"
|
|
13
|
+
"scripts"
|
|
15
14
|
],
|
|
16
15
|
"license": "MIT",
|
|
17
16
|
"engines": {
|
|
18
17
|
"node": ">=14"
|
|
19
18
|
}
|
|
20
|
-
}
|
|
19
|
+
}
|
package/scripts/postinstall.js
CHANGED
|
@@ -1,77 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
// 获取 npm 包安装目录
|
|
12
|
-
const packageDir = path.resolve(__dirname, '..');
|
|
13
|
-
const skillsSourceDir = path.join(packageDir, 'skills');
|
|
14
|
-
|
|
15
|
-
console.log('\n🔧 Installing yunxiao-code Claude Code integration...\n');
|
|
16
|
-
|
|
17
|
-
// 确保目录存在
|
|
18
|
-
function ensureDir(dir) {
|
|
19
|
-
if (!fs.existsSync(dir)) {
|
|
20
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
21
|
-
console.log(` ✓ Created directory: ${dir}`);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// 复制目录
|
|
26
|
-
function copyDir(src, dest) {
|
|
27
|
-
ensureDir(path.dirname(dest));
|
|
28
|
-
|
|
29
|
-
if (fs.existsSync(dest)) {
|
|
30
|
-
fs.rmSync(dest, { recursive: true });
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
fs.cpSync(src, dest, { recursive: true });
|
|
34
|
-
console.log(` ✓ Installed: ${dest}`);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// 安装命令
|
|
38
|
-
function installCommands() {
|
|
39
|
-
const commandsSource = path.join(skillsSourceDir, 'yx-commands');
|
|
40
|
-
|
|
41
|
-
if (fs.existsSync(commandsSource)) {
|
|
42
|
-
copyDir(commandsSource, COMMANDS_DIR);
|
|
43
|
-
console.log(` 📦 Commands installed to ~/.claude/commands/yx-commands/`);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// 安装 skills
|
|
48
|
-
function installSkills() {
|
|
49
|
-
const skillSource = path.join(skillsSourceDir, 'skills', 'yx-workflow');
|
|
50
|
-
|
|
51
|
-
if (fs.existsSync(skillSource)) {
|
|
52
|
-
copyDir(skillSource, SKILLS_DIR);
|
|
53
|
-
console.log(` 📦 Skill installed to ~/.claude/skills/yx-workflow/`);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// 主流程
|
|
58
|
-
try {
|
|
59
|
-
ensureDir(CLAUDE_DIR);
|
|
60
|
-
ensureDir(path.join(CLAUDE_DIR, 'commands'));
|
|
61
|
-
ensureDir(path.join(CLAUDE_DIR, 'skills'));
|
|
62
|
-
|
|
63
|
-
installCommands();
|
|
64
|
-
installSkills();
|
|
65
|
-
|
|
66
|
-
console.log('\n✅ yunxiao-code Claude Code integration installed successfully!\n');
|
|
67
|
-
console.log('Available commands:');
|
|
68
|
-
console.log(' /yx-commands:init - 初始化云效配置');
|
|
69
|
-
console.log(' /yx-commands:clone - 克隆仓库');
|
|
70
|
-
console.log(' /yx-commands:commit - 提交代码');
|
|
71
|
-
console.log(' /yx-commands:push - 推送代码');
|
|
72
|
-
console.log(' /yx-commands:mr - 创建合并请求');
|
|
73
|
-
console.log('\nRun /reload-plugins or restart Claude Code to activate.\n');
|
|
74
|
-
} catch (error) {
|
|
75
|
-
console.error('❌ Installation failed:', error.message);
|
|
76
|
-
process.exit(1);
|
|
77
|
-
}
|
|
3
|
+
console.log('\n✅ yx-code CLI installed successfully!\n');
|
|
4
|
+
console.log('Usage:');
|
|
5
|
+
console.log(' yx-code init - 初始化云效配置');
|
|
6
|
+
console.log(' yx-code clone - 克隆仓库');
|
|
7
|
+
console.log(' yx-code commit - 提交代码');
|
|
8
|
+
console.log(' yx-code push - 推送代码');
|
|
9
|
+
console.log(' yx-code mr - 创建合并请求');
|
|
10
|
+
console.log(' yx-code review - 代码审查\n');
|
package/bin/yx-code
DELETED
|
Binary file
|
package/skills/README.md
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
# Yunxiao Code - Claude Code Plugin
|
|
2
|
-
|
|
3
|
-
云效代码仓库工作流自动化插件,为 Claude Code 提供云效相关命令支持。
|
|
4
|
-
|
|
5
|
-
## 安装
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install -g yunxiao-code
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
安装完成后,会自动:
|
|
12
|
-
1. 安装 `yunxiao-code` CLI 工具到系统 PATH
|
|
13
|
-
2. 安装 Claude Code 命令到 `~/.claude/commands/yx-commands/`
|
|
14
|
-
3. 安装 Claude Code 技能到 `~/.claude/skills/yx-workflow/`
|
|
15
|
-
|
|
16
|
-
重启 Claude Code 或执行 `/reload-plugins` 后即可使用。
|
|
17
|
-
|
|
18
|
-
## 可用命令
|
|
19
|
-
|
|
20
|
-
| 命令 | 功能 | 示例 |
|
|
21
|
-
|------|------|------|
|
|
22
|
-
| `/yx-commands:init` | 初始化云效配置 | `/yx-commands:init` |
|
|
23
|
-
| `/yx-commands:clone` | 克隆仓库 | `/yx-commands:clone <git-url>` |
|
|
24
|
-
| `/yx-commands:commit` | 提交代码 | `/yx-commands:commit` |
|
|
25
|
-
| `/yx-commands:push` | 推送代码 | `/yx-commands:push` |
|
|
26
|
-
| `/yx-commands:mr` | 创建合并请求 | `/yx-commands:mr <title>` |
|
|
27
|
-
|
|
28
|
-
## 使用指南
|
|
29
|
-
|
|
30
|
-
### 1. 初始化配置
|
|
31
|
-
|
|
32
|
-
首次使用需要配置云效凭证:
|
|
33
|
-
|
|
34
|
-
```
|
|
35
|
-
/yx-commands:init
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
按提示填写:
|
|
39
|
-
- `organization_id`: 云效组织 ID
|
|
40
|
-
- `token`: 云效个人访问令牌
|
|
41
|
-
|
|
42
|
-
### 2. 克隆仓库
|
|
43
|
-
|
|
44
|
-
克隆云效代码仓库:
|
|
45
|
-
|
|
46
|
-
```
|
|
47
|
-
/yx-commands:clone https://codeup.aliyun.com/your-org/your-repo.git
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### 3. 提交代码
|
|
51
|
-
|
|
52
|
-
自动分析变更并提交:
|
|
53
|
-
|
|
54
|
-
```
|
|
55
|
-
/yx-commands:commit
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### 4. 推送代码
|
|
59
|
-
|
|
60
|
-
推送当前分支到远程:
|
|
61
|
-
|
|
62
|
-
```
|
|
63
|
-
/yx-commands:push
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
### 5. 创建合并请求
|
|
67
|
-
|
|
68
|
-
创建 MR 到 develop 分支:
|
|
69
|
-
|
|
70
|
-
```
|
|
71
|
-
/yx-commands:mr "添加用户登录功能"
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
## 技能触发
|
|
75
|
-
|
|
76
|
-
当对话中出现以下关键词时,`yx-workflow` 技能会自动激活:
|
|
77
|
-
|
|
78
|
-
- 云效
|
|
79
|
-
- 合并请求
|
|
80
|
-
- MR
|
|
81
|
-
- yx-code
|
|
82
|
-
- 阿里云代码仓库
|
|
83
|
-
|
|
84
|
-
## 手动安装(可选)
|
|
85
|
-
|
|
86
|
-
如果需要手动安装命令和技能:
|
|
87
|
-
|
|
88
|
-
```bash
|
|
89
|
-
# 安装命令
|
|
90
|
-
mkdir -p ~/.claude/commands/yx-commands
|
|
91
|
-
cp -r skills/yx-commands/*.md ~/.claude/commands/yx-commands/
|
|
92
|
-
|
|
93
|
-
# 安装技能
|
|
94
|
-
mkdir -p ~/.claude/skills/yx-workflow
|
|
95
|
-
cp -r skills/skills/yx-workflow ~/.claude/skills/
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
## 许可证
|
|
99
|
-
|
|
100
|
-
MIT License
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: yx-workflow
|
|
3
|
-
description: 云效代码仓库工作流自动化助手
|
|
4
|
-
triggers:
|
|
5
|
-
- 云效
|
|
6
|
-
- 合并请求
|
|
7
|
-
- MR
|
|
8
|
-
- yx-code
|
|
9
|
-
- 阿里云代码仓库
|
|
10
|
-
- 阿里云云效
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
# 云效代码仓库工作流
|
|
14
|
-
|
|
15
|
-
我是一个帮助你在云效代码仓库进行开发的助手。我可以帮助你:
|
|
16
|
-
|
|
17
|
-
## 可用命令
|
|
18
|
-
|
|
19
|
-
| 命令 | 功能 | 用法 |
|
|
20
|
-
|------|------|------|
|
|
21
|
-
| `/yx-commands:init` | 初始化云效配置 | 直接运行,配置 token |
|
|
22
|
-
| `/yx-commands:clone` | 克隆仓库 | `/yx-commands:clone <git-url>` |
|
|
23
|
-
| `/yx-commands:commit` | 提交代码 | 自动分析变更生成 commit message |
|
|
24
|
-
| `/yx-commands:push` | 推送代码 | 推送当前分支到远程 |
|
|
25
|
-
| `/yx-commands:mr` | 创建合并请求 | `/yx-commands:mr <title>` |
|
|
26
|
-
|
|
27
|
-
## 典型工作流
|
|
28
|
-
|
|
29
|
-
1. **初始化配置**
|
|
30
|
-
```
|
|
31
|
-
/yx-commands:init
|
|
32
|
-
```
|
|
33
|
-
首次使用需要配置云效的 organization_id 和 token。
|
|
34
|
-
|
|
35
|
-
2. **克隆仓库**
|
|
36
|
-
```
|
|
37
|
-
/yx-commands:clone https://codeup.aliyun.com/xxx/xxx.git
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
3. **提交代码**
|
|
41
|
-
```
|
|
42
|
-
/yx-commands:commit
|
|
43
|
-
```
|
|
44
|
-
会自动分析变更并生成合适的 commit message。
|
|
45
|
-
|
|
46
|
-
4. **推送代码**
|
|
47
|
-
```
|
|
48
|
-
/yx-commands:push
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
5. **创建合并请求**
|
|
52
|
-
```
|
|
53
|
-
/yx-commands:mr "添加新功能"
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## 注意事项
|
|
57
|
-
|
|
58
|
-
- 确保已安装 `yx-code` CLI 工具
|
|
59
|
-
- 确保 `yx-code` 在系统 PATH 中可用
|
|
60
|
-
- MR 默认合并到 develop 分支
|
|
61
|
-
|
|
62
|
-
## 相关链接
|
|
63
|
-
|
|
64
|
-
- [云效控制台](https://devops.aliyun.com/)
|
|
65
|
-
- [云效文档](https://help.aliyun.com/product/153293.html)
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: clone
|
|
3
|
-
description: 克隆云效代码仓库
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
根据用户提供的参数执行克隆操作。
|
|
7
|
-
|
|
8
|
-
**参数说明:**
|
|
9
|
-
- 第一个参数是云效仓库的 Git URL(必填)
|
|
10
|
-
- `-b` 参数指定分支名(可选)
|
|
11
|
-
- `-p` 参数指定本地路径(可选)
|
|
12
|
-
|
|
13
|
-
如果用户没有提供 git-url,请询问用户提供仓库地址。
|
|
14
|
-
|
|
15
|
-
执行命令示例:
|
|
16
|
-
```bash
|
|
17
|
-
yx-code clone <git-url> [-b <branch>] [-p <path>]
|
|
18
|
-
```
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: commit
|
|
3
|
-
description: 分析代码变更并提交到云效仓库
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
分析当前的代码变更并提交。
|
|
7
|
-
|
|
8
|
-
**步骤:**
|
|
9
|
-
|
|
10
|
-
1. 首先查看当前变更状态:
|
|
11
|
-
```bash
|
|
12
|
-
git status
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
2. 查看变更统计:
|
|
16
|
-
```bash
|
|
17
|
-
git diff --stat
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
3. 如果有暂存的变更,查看具体内容:
|
|
21
|
-
```bash
|
|
22
|
-
git diff --cached
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
4. 如果没有暂存的变更但有未暂存的变更,查看:
|
|
26
|
-
```bash
|
|
27
|
-
git diff
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
5. 分析变更后,根据变更内容生成合适的 commit message,格式遵循 Conventional Commits:
|
|
31
|
-
- `feat:` 新功能
|
|
32
|
-
- `fix:` 修复 bug
|
|
33
|
-
- `refactor:` 重构
|
|
34
|
-
- `docs:` 文档变更
|
|
35
|
-
- `style:` 代码格式
|
|
36
|
-
- `test:` 测试
|
|
37
|
-
- `chore:` 构建/工具
|
|
38
|
-
|
|
39
|
-
6. 执行提交:
|
|
40
|
-
```bash
|
|
41
|
-
yx-code commit -m "<生成的commit-message>"
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
如果用户提供了特定的 commit message,则使用用户提供的。
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: init
|
|
3
|
-
description: 初始化云效配置文件
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
请执行以下命令初始化云效配置:
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
yx-code init
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
执行后,配置文件将创建在 `~/.yunxiao-code/config.json`。
|
|
13
|
-
|
|
14
|
-
你需要填写以下信息:
|
|
15
|
-
- `organization_id`: 云效组织 ID
|
|
16
|
-
- `token`: 云效个人访问令牌
|
|
17
|
-
|
|
18
|
-
获取方式:
|
|
19
|
-
1. organization_id: 在云效控制台 URL 中可以找到,格式如 `https://devops.aliyun.com/organization/{organization_id}/...`
|
|
20
|
-
2. token: 在云效控制台 -> 个人设置 -> 个人访问令牌 中创建
|
package/skills/yx-commands/mr.md
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: mr
|
|
3
|
-
description: 创建云效合并请求(Merge Request)
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
创建合并请求到 develop 分支。
|
|
7
|
-
|
|
8
|
-
**步骤:**
|
|
9
|
-
|
|
10
|
-
1. 首先显示当前分支和仓库信息:
|
|
11
|
-
```bash
|
|
12
|
-
git branch --show-current
|
|
13
|
-
git remote -v | head -1
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
2. 获取合并请求标题(必填)和描述(可选)
|
|
17
|
-
- 如果用户没有提供标题,请询问用户提供合并请求的标题
|
|
18
|
-
- 描述是可选的,用户可以补充详细说明
|
|
19
|
-
|
|
20
|
-
3. 执行创建 MR:
|
|
21
|
-
```bash
|
|
22
|
-
yx-code mr -m "<title>" [-d "<description>"]
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
创建成功后,会返回合并请求的 URL 链接,用户可以在浏览器中查看。
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: push
|
|
3
|
-
description: 推送代码到云效远程仓库
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
推送代码到远程仓库。
|
|
7
|
-
|
|
8
|
-
**步骤:**
|
|
9
|
-
|
|
10
|
-
1. 首先显示当前分支信息:
|
|
11
|
-
```bash
|
|
12
|
-
git branch --show-current
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
2. 执行推送:
|
|
16
|
-
```bash
|
|
17
|
-
yx-code push
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
如果推送失败,可能需要先设置上游分支。在这种情况下,提示用户是否需要设置上游分支并重试。
|