yunxiao-code 1.1.2 → 1.2.0

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 CHANGED
@@ -9,7 +9,7 @@
9
9
  - 📤 **推送代码** - 自动推送当前分支到远程
10
10
  - 🔀 **合并请求** - 快速创建 MR,支持指定目标分支
11
11
  - 📊 **代码差异** - 查看分支间的代码差异统计
12
- - 🤖 **Claude Code 集成** - 支持 Claude Code Skills/Commands 自动化工作流
12
+ - 🤖 **AI Agent 集成** - 基于 Agent Skills 标准,兼容 Claude Code、Cursor AI 编程工具
13
13
 
14
14
  ## 安装
15
15
 
@@ -39,24 +39,22 @@ go build -o yx-code ./cmd/yx-code
39
39
  sudo mv yx-code /usr/local/bin/
40
40
  ```
41
41
 
42
- #### 安装 Claude Code 插件(可选)
42
+ #### 安装 AI Agent 插件(可选)
43
43
 
44
- 如需使用 Claude Code 斜杠命令,手动创建软链接:
44
+ 如需使用斜杠命令,手动为每个 skill 创建软链接:
45
45
 
46
46
  ```bash
47
- # 安装 commands
48
- ln -s $(pwd)/claude-plugin/commands ~/.claude/commands/yx-commands
49
-
50
- # 安装 skills
51
- ln -s $(pwd)/claude-plugin/skills ~/.claude/skills/yx-commands
47
+ for dir in claude-plugin/skills/*/; do
48
+ ln -s "$(pwd)/$dir" ~/.claude/skills/"$(basename $dir)"
49
+ done
52
50
  ```
53
51
 
54
- 安装后可在 Claude Code 中使用:
55
- - `/yx-commands:commit` - 分析代码变更并提交
56
- - `/yx-commands:push` - 推送代码
57
- - `/yx-commands:mr` - 创建合并请求
58
- - `/yx-commands:review` - 查看代码差异
59
- - `/yx-commands:commit-push-mr` - 一键完成完整工作流
52
+ 安装后可在 Claude Code 或 Cursor Agent 中使用:
53
+ - `/yx-commands-commit` - 分析代码变更并提交
54
+ - `/yx-commands-push` - 推送代码
55
+ - `/yx-commands-mr` - 创建合并请求
56
+ - `/yx-commands-review` - 查看代码差异
57
+ - `/yx-commands-commit-push-mr` - 一键完成完整工作流
60
58
 
61
59
  ## 系统要求
62
60
 
@@ -252,29 +250,36 @@ yx-code mr -m "添加用户登录功能"
252
250
  yx-code diff
253
251
  ```
254
252
 
255
- ## Claude Code 集成
253
+ ## AI Agent 集成
254
+
255
+ 本工具基于 [Agent Skills](https://agentskills.io/) 开放标准,兼容 Claude Code、Cursor 等支持该标准的 AI 编程工具,可通过斜杠命令自动化云效工作流。
256
256
 
257
- 本工具提供 Claude Code Skills/Commands 支持,可在 Claude Code 中通过斜杠命令自动化云效工作流。
257
+ ### 兼容性
258
+
259
+ | 工具 | 支持 | 说明 |
260
+ |------|------|------|
261
+ | [Claude Code](https://claude.ai/code) | ✅ | 原生支持,从 `~/.claude/skills/` 加载 |
262
+ | [Cursor](https://cursor.com) | ✅ | 兼容加载 `~/.claude/skills/` 目录 |
258
263
 
259
264
  ### 可用命令
260
265
 
261
266
  | 命令 | 功能 |
262
267
  |------|------|
263
- | `/yx-commands:commit` | 分析代码变更并提交 |
264
- | `/yx-commands:push` | 推送代码到远程 |
265
- | `/yx-commands:mr` | 创建合并请求 |
266
- | `/yx-commands:review` | 查看分支代码差异 |
267
- | `/yx-commands:commit-push-mr` | 一键完成提交、推送、创建MR |
268
+ | `/yx-commands-commit` | 分析代码变更并提交 |
269
+ | `/yx-commands-push` | 推送代码到远程 |
270
+ | `/yx-commands-mr` | 创建合并请求 |
271
+ | `/yx-commands-review` | 查看分支代码差异 |
272
+ | `/yx-commands-commit-push-mr` | 一键完成提交、推送、创建MR |
268
273
 
269
274
  ### 使用示例
270
275
 
271
- 在 Claude Code 中直接输入命令:
276
+ 在 Claude Code 或 Cursor Agent 中直接输入命令:
272
277
 
273
278
  ```
274
- /yx-commands:commit-push-mr
279
+ /yx-commands-commit-push-mr
275
280
  ```
276
281
 
277
- Claude 会自动:
282
+ AI 会自动:
278
283
  1. 分析代码变更
279
284
  2. 生成 commit message
280
285
  3. 执行 commit、push
@@ -282,7 +287,19 @@ Claude 会自动:
282
287
 
283
288
  ### 安装
284
289
 
285
- npm 安装后自动部署到 `~/.claude/commands/yx-commands/` `~/.claude/skills/yx-commands/`。
290
+ npm 安装后自动将每个 skill 部署为独立符号链接到 `~/.claude/skills/`:
291
+
292
+ ```
293
+ ~/.claude/skills/
294
+ ├── yx-commands/ ← 主 skill(工作流路由)
295
+ ├── yx-commands-commit/ ← 提交命令
296
+ ├── yx-commands-push/ ← 推送命令
297
+ ├── yx-commands-mr/ ← 创建 MR
298
+ ├── yx-commands-review/ ← 代码审查
299
+ └── yx-commands-commit-push-mr/ ← 一键完整工作流
300
+ ```
301
+
302
+ Cursor 会自动从 `~/.claude/skills/` 加载,无需额外配置。
286
303
 
287
304
  ## 相关链接
288
305
 
@@ -18,39 +18,39 @@ tools: Bash, Read
18
18
  2. **Git 操作** - 提交、推送
19
19
  3. **yx-code 工具** - 提到云效 CLI
20
20
  4. **复合工作流** - 用户说"提交合并"、"提交并合并"、"提交MR"时,按顺序执行:
21
- - 先执行 `/yx-commands:commit` 提交代码
22
- - 再执行 `/yx-commands:push` 推送到远程
23
- - 然后执行 `/yx-commands:mr` 创建合并请求
21
+ - 先执行 `/yx-commands-commit` 提交代码
22
+ - 再执行 `/yx-commands-push` 推送到远程
23
+ - 然后执行 `/yx-commands-mr` 创建合并请求
24
24
 
25
25
  ## 可用命令
26
26
 
27
27
  | 命令 | 功能 | 典型用法 |
28
28
  |------|------|----------|
29
- | `/yx-commands:commit` | 智能提交 | 分析变更生成 commit |
30
- | `/yx-commands:push` | 推送代码 | 推送到远程 |
31
- | `/yx-commands:mr` | 创建 MR | 提交合并请求(默认 develop) |
32
- | `/yx-commands:review` | 代码审查 | 查看分支差异 |
33
- | `/yx-commands:commit-push-mr` | 完整工作流 | 一键完成提交、推送、创建MR |
29
+ | `/yx-commands-commit` | 智能提交 | 分析变更生成 commit |
30
+ | `/yx-commands-push` | 推送代码 | 推送到远程 |
31
+ | `/yx-commands-mr` | 创建 MR | 提交合并请求(默认 develop) |
32
+ | `/yx-commands-review` | 代码审查 | 查看分支差异 |
33
+ | `/yx-commands-commit-push-mr` | 完整工作流 | 一键完成提交、推送、创建MR |
34
34
 
35
35
  ## 典型工作流
36
36
 
37
37
  ### 一键完成(推荐)
38
38
  ```
39
39
  1. 编写代码...
40
- 2. /yx-commands:commit-push-mr → 一键完成提交、推送、创建MR
40
+ 2. /yx-commands-commit-push-mr → 一键完成提交、推送、创建MR
41
41
  ```
42
42
 
43
43
  ### 分步执行
44
44
  ```
45
45
  1. 编写代码...
46
- 2. /yx-commands:commit → 智能生成 commit message 并提交
47
- 3. /yx-commands:push → 推送到远程
48
- 4. /yx-commands:mr → 创建合并请求
46
+ 2. /yx-commands-commit → 智能生成 commit message 并提交
47
+ 3. /yx-commands-push → 推送到远程
48
+ 4. /yx-commands-mr → 创建合并请求
49
49
  ```
50
50
 
51
51
  ### 代码审查
52
52
  ```
53
- /yx-commands:review -t develop -s feature-branch
53
+ /yx-commands-review -t develop -s feature-branch
54
54
  ```
55
55
 
56
56
  ## 前置条件
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: commit
2
+ name: yx-commands-commit
3
3
  description: 分析代码变更并提交到云效仓库
4
4
  ---
5
5
 
@@ -31,4 +31,4 @@ git diff HEAD
31
31
  yx-code commit -m "<生成的commit-message>"
32
32
  ```
33
33
 
34
- 如果用户提供了特定的 commit message,则使用用户提供的。
34
+ 如果用户提供了特定的 commit message,则使用用户提供的。
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: commit-push-mr
2
+ name: yx-commands-commit-push-mr
3
3
  description: 一键完成提交、推送、创建合并请求(完整工作流)
4
4
  ---
5
5
 
@@ -35,4 +35,4 @@ yx-code mr -m "<mr-title>"
35
35
  **注意:**
36
36
  - 如果用户提供了特定的 commit message,则使用用户提供的
37
37
  - MR 标题默认使用 commit message
38
- - 目标分支默认为 develop,可通过参数指定
38
+ - 目标分支默认为 develop,可通过参数指定
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: mr
2
+ name: yx-commands-mr
3
3
  description: 创建云效合并请求(Merge Request)
4
4
  ---
5
5
 
@@ -75,4 +75,4 @@ yx-code mr -m "feat: 添加用户登录功能" -d "实现了登录、登出功
75
75
  - 合并请求 ID
76
76
  - 合并请求 URL 链接
77
77
 
78
- 用户可在浏览器中访问链接进行代码审查和合并操作。
78
+ 用户可在浏览器中访问链接进行代码审查和合并操作。
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: push
2
+ name: yx-commands-push
3
3
  description: 推送代码到云效远程仓库
4
4
  ---
5
5
 
@@ -27,4 +27,4 @@ yx-code push
27
27
  4. **如果推送失败且提示无上游分支**,自动设置上游并重试:
28
28
  ```bash
29
29
  yx-code push -u origin HEAD
30
- ```
30
+ ```
@@ -22,17 +22,25 @@ disable-model-invocation: false
22
22
  yx-code diff --target <target> --source <source>
23
23
  ```
24
24
 
25
- ### 步骤 2: 收集上下文信息
25
+ ### 步骤 2: 展示代码差异
26
26
 
27
- 使用 Haiku agent 收集以下信息:
27
+ yx-code diff 的完整输出直接展示给用户,包括:
28
+ - 变更统计摘要(文件数、新增行数、删除行数)
29
+ - 每个变更文件的完整 diff 内容
30
+
31
+ 保留原始的 diff 代码块格式,让用户能直接阅读代码差异。
32
+
33
+ ### 步骤 3: 收集上下文信息
34
+
35
+ 使用轻量级 agent 收集以下信息:
28
36
 
29
37
  1. **获取 CLAUDE.md 文件列表**:查找项目根目录及变更文件所在目录的 CLAUDE.md 文件
30
38
  2. **获取变更摘要**:分析差异内容,返回变更的简要总结
31
39
  3. **检查审查资格**:确认分支是否需要进行代码审查(排除已关闭、草稿、自动生成等)
32
40
 
33
- ### 步骤 3: 并行代码审查
41
+ ### 步骤 4: 并行代码审查
34
42
 
35
- 启动 5 个并行的 Sonnet agent 独立进行代码审查:
43
+ 启动 5 个并行 agent 独立进行代码审查:
36
44
 
37
45
  **Agent #1: CLAUDE.md 合规审查**
38
46
  - 检查变更是否遵循项目 CLAUDE.md 中的规范
@@ -60,9 +68,9 @@ yx-code diff --target <target> --source <source>
60
68
  - 确保变更遵循注释中的指导
61
69
  - 返回问题列表及原因(代码注释合规性)
62
70
 
63
- ### 步骤 4: 问题置信度评分
71
+ ### 步骤 5: 问题置信度评分
64
72
 
65
- 对步骤 3 发现的每个问题,启动并行 Haiku agent 进行置信度评分:
73
+ 对步骤 4 发现的每个问题,启动并行轻量级 agent 进行置信度评分:
66
74
 
67
75
  **评分标准(0-100 分)**:
68
76
 
@@ -74,7 +82,7 @@ yx-code diff --target <target> --source <source>
74
82
  | 75 | 高度确信。验证了这是很可能在现实中发生的真正问题。当前方案不充分。问题很重要,直接影响功能,或在 CLAUDE.md 中明确提及 |
75
83
  | 100 | 绝对确定。验证了这是肯定会在现实中频繁发生的真正问题。证据直接确认 |
76
84
 
77
- ### 步骤 5: 过滤并输出结果
85
+ ### 步骤 6: 过滤并输出结果
78
86
 
79
87
  1. **过滤问题**:仅保留评分 >= 80 的问题
80
88
  2. **重新检查资格**:确认分支仍符合审查条件
@@ -83,7 +91,7 @@ yx-code diff --target <target> --source <source>
83
91
  ### 使用方式
84
92
 
85
93
  ```
86
- /yx-commands:review [-t target] [-s source]
94
+ /yx-commands-review [-t target] [-s source]
87
95
  ```
88
96
 
89
97
  参数:
@@ -94,12 +102,12 @@ yx-code diff --target <target> --source <source>
94
102
 
95
103
  查看与 develop 的差异:
96
104
  ```
97
- /yx-commands:review
105
+ /yx-commands-review
98
106
  ```
99
107
 
100
108
  查看 feature 分支与 main 的差异:
101
109
  ```
102
- /yx-commands:review -t main -s feature-branch
110
+ /yx-commands-review -t main -s feature-branch
103
111
  ```
104
112
 
105
113
  ### 输出格式
@@ -160,4 +168,4 @@ https://<云效域名>/<项目路径>/blob/<完整sha1>/<文件路径>#L<起始
160
168
  - 目标分支需要存在于远程
161
169
  - 不检查构建信号,不尝试构建或类型检查
162
170
  - 大量变更时输出可能较长
163
- - 对于复杂文件,优先使用 yx-code diff 获取准确差异
171
+ - 对于复杂文件,优先使用 yx-code diff 获取准确差异
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yunxiao-code",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "阿里云云效 CLI 工具",
5
5
  "keywords": [
6
6
  "aliyun",
@@ -23,43 +23,55 @@ function removeExisting(target) {
23
23
 
24
24
  function deployPlugin() {
25
25
  const claudeDir = path.join(os.homedir(), '.claude');
26
- const commandsDir = path.join(claudeDir, 'commands');
27
26
  const skillsDir = path.join(claudeDir, 'skills');
28
27
 
29
28
  // 获取 npm 包路径
30
29
  const packageDir = path.dirname(require.main.filename);
31
30
  const pluginDir = path.join(packageDir, '..', 'claude-plugin');
31
+ const skillsSource = path.join(pluginDir, 'skills');
32
32
 
33
33
  // 确保目标目录存在
34
- if (!fs.existsSync(commandsDir)) {
35
- fs.mkdirSync(commandsDir, { recursive: true });
36
- }
37
34
  if (!fs.existsSync(skillsDir)) {
38
35
  fs.mkdirSync(skillsDir, { recursive: true });
39
36
  }
40
37
 
41
- const commandsTarget = path.join(commandsDir, 'yx-commands');
42
- const skillsTarget = path.join(skillsDir, 'yx-commands');
43
- const commandsSource = path.join(pluginDir, 'commands');
44
- const skillsSource = path.join(pluginDir, 'skills');
38
+ // 清理旧的 commands 软链接(如果存在)
39
+ const oldCommandsTarget = path.join(claudeDir, 'commands', 'yx-commands');
40
+ removeExisting(oldCommandsTarget);
45
41
 
46
- // 创建/更新 commands 软链接
47
- if (fs.existsSync(commandsSource)) {
48
- if (removeExisting(commandsTarget)) {
49
- fs.symlinkSync(commandsSource, commandsTarget);
50
- console.log('✅ 已链接 commands ~/.claude/commands/yx-commands/');
42
+ // 清理旧版本的单一 skills 软链接(指向整个 skills 目录的)
43
+ const oldSkillsTarget = path.join(skillsDir, 'yx-commands');
44
+ try {
45
+ const linkTarget = fs.readlinkSync(oldSkillsTarget);
46
+ if (linkTarget === skillsSource || linkTarget.endsWith('/claude-plugin/skills')) {
47
+ removeExisting(oldSkillsTarget);
51
48
  }
49
+ } catch (e) { /* not a symlink or doesn't exist */ }
50
+
51
+ if (!fs.existsSync(skillsSource)) {
52
+ console.log('⚠️ skills 目录不存在:', skillsSource);
53
+ return;
52
54
  }
53
55
 
54
- // 创建/更新 skills 软链接
55
- if (fs.existsSync(skillsSource)) {
56
- if (removeExisting(skillsTarget)) {
57
- fs.symlinkSync(skillsSource, skillsTarget);
58
- console.log('✅ 已链接 skills 到 ~/.claude/skills/yx-commands/');
56
+ // 为每个 skill 子目录单独创建符号链接
57
+ const entries = fs.readdirSync(skillsSource, { withFileTypes: true });
58
+ const linked = [];
59
+ for (const entry of entries) {
60
+ if (!entry.isDirectory()) continue;
61
+ const source = path.join(skillsSource, entry.name);
62
+ const target = path.join(skillsDir, entry.name);
63
+ if (removeExisting(target)) {
64
+ fs.symlinkSync(source, target);
65
+ linked.push(entry.name);
59
66
  }
60
67
  }
61
68
 
62
- console.log('\n可用命令: /yx-commands:commit, /yx-commands:push, /yx-commands:mr, /yx-commands:review\n');
69
+ if (linked.length > 0) {
70
+ console.log('✅ 已链接 ' + linked.length + ' 个 skills 到 ~/.claude/skills/');
71
+ linked.forEach(name => console.log(' - ' + name));
72
+ }
73
+
74
+ console.log('\n可用命令: /yx-commands-commit, /yx-commands-push, /yx-commands-mr, /yx-commands-review, /yx-commands-commit-push-mr\n');
63
75
  }
64
76
 
65
77
  console.log('\n✅ yx-code CLI installed successfully!\n');