yunxiao-code 1.0.5 → 1.0.7

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
@@ -15,7 +15,14 @@ npm install -g yx-code
15
15
  ```bash
16
16
  git clone <repo-url>
17
17
  cd yx-code
18
- go build -o yx-code .
18
+ make build-local
19
+ sudo make install
20
+ ```
21
+
22
+ 或手动编译:
23
+
24
+ ```bash
25
+ go build -o yx-code ./cmd/yx-code
19
26
  sudo mv yx-code /usr/local/bin/
20
27
  ```
21
28
 
Binary file
Binary file
Binary file
package/bin/yx-code.js CHANGED
@@ -1,34 +1,33 @@
1
1
  #!/usr/bin/env node
2
- const { execSync } = require('child_process');
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 binary;
11
+ let binaryName;
10
12
  if (platform === 'darwin' && arch === 'arm64') {
11
- binary = 'yx-code-darwin-arm64';
13
+ binaryName = 'yx-code-darwin-arm64';
12
14
  } else if (platform === 'darwin' && arch === 'x64') {
13
- binary = 'yx-code-darwin-amd64';
15
+ binaryName = 'yx-code-darwin-amd64';
14
16
  } else if (platform === 'linux' && arch === 'x64') {
15
- binary = 'yx-code-linux-amd64';
17
+ binaryName = 'yx-code-linux-amd64';
16
18
  } else {
17
- console.error(`Unsupported platform: ${platform}/${arch}`);
19
+ console.error(`Unsupported platform: ${platform}-${arch}`);
18
20
  process.exit(1);
19
21
  }
20
22
 
21
- const binaryPath = path.join(__dirname, binary);
22
- const args = process.argv.slice(2).map(arg => {
23
- // Escape quotes and wrap in quotes if contains spaces
24
- if (arg.includes(' ')) {
25
- return `"${arg.replace(/"/g, '\\"')}"`;
26
- }
27
- return arg;
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
- try {
31
- execSync(`"${binaryPath}" ${args}`, { stdio: 'inherit' });
32
- } catch (error) {
33
- process.exit(error.status);
34
- }
31
+ child.on('exit', (code) => {
32
+ process.exit(code || 0);
33
+ });
package/package.json CHANGED
@@ -1,20 +1,19 @@
1
1
  {
2
2
  "name": "yunxiao-code",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "阿里云云效 CLI 工具",
5
5
  "bin": {
6
- "yx-code": "./bin/yx-code.js"
6
+ "yx-code": "bin/yx-code.js"
7
7
  },
8
8
  "scripts": {
9
9
  "postinstall": "node scripts/postinstall.js"
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
+ }
@@ -1,77 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const fs = require('fs');
4
- const path = require('path');
5
- const os = require('os');
6
-
7
- const CLAUDE_DIR = path.join(os.homedir(), '.claude');
8
- const COMMANDS_DIR = path.join(CLAUDE_DIR, 'commands', 'yx-commands');
9
- const SKILLS_DIR = path.join(CLAUDE_DIR, 'skills', 'yx-workflow');
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
@@ -1,10 +0,0 @@
1
- {
2
- "name": "yunxiao-code",
3
- "description": "云效代码仓库工作流自动化 - 初始化配置、克隆仓库、提交代码、推送、创建合并请求",
4
- "author": {
5
- "name": "yunxiao-code"
6
- },
7
- "skills": {
8
- "yx-workflow": "skills/yx-workflow/SKILL.md"
9
- }
10
- }
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-init` | 初始化云效配置 | 直接运行,配置 token |
22
- | `/yx-clone` | 克隆仓库 | `/yx-clone <git-url> [-b branch] [-p path]` |
23
- | `/yx-commit` | 提交代码 | 自动分析变更生成 commit message |
24
- | `/yx-push` | 推送代码 | 推送当前分支到远程 |
25
- | `/yx-mr` | 创建合并请求 | `/yx-mr <title> [-d description]` |
26
-
27
- ## 典型工作流
28
-
29
- 1. **初始化配置**
30
- ```
31
- /yx-init
32
- ```
33
- 首次使用需要配置云效的 organization_id 和 token。
34
-
35
- 2. **克隆仓库**
36
- ```
37
- /yx-clone https://codeup.aliyun.com/xxx/xxx.git
38
- ```
39
-
40
- 3. **提交代码**
41
- ```
42
- /yx-commit
43
- ```
44
- 会自动分析变更并生成合适的 commit message。
45
-
46
- 4. **推送代码**
47
- ```
48
- /yx-push
49
- ```
50
-
51
- 5. **创建合并请求**
52
- ```
53
- /yx-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: 在云效控制台 -> 个人设置 -> 个人访问令牌 中创建
@@ -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
- 如果推送失败,可能需要先设置上游分支。在这种情况下,提示用户是否需要设置上游分支并重试。