copilot-hub-cli 1.1.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 +76 -0
- package/bin/run.js +74 -0
- package/binaries/darwin-arm64 +0 -0
- package/binaries/darwin-x64 +0 -0
- package/binaries/linux-arm64 +0 -0
- package/binaries/linux-x64 +0 -0
- package/binaries/win32-x64.exe +0 -0
- package/package.json +36 -0
- package/scripts/postinstall.js +27 -0
package/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Copilot Hub CLI
|
|
2
|
+
|
|
3
|
+
> AI 编程助手代理服务 — 一键启动 GitHub Copilot 代理 + Web 管理面板
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g copilot-hub-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 使用
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
copilot-hub
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
启动后:
|
|
18
|
+
- 🖥️ 终端显示运行状态
|
|
19
|
+
- 🌐 浏览器自动打开管理面板 `http://127.0.0.1:9100`
|
|
20
|
+
- 🔑 在面板中输入卡密激活
|
|
21
|
+
- 🚀 一键启动 VS Code 并自动配置代理
|
|
22
|
+
|
|
23
|
+
## 功能
|
|
24
|
+
|
|
25
|
+
- ✅ 自动代理 VS Code Copilot 请求
|
|
26
|
+
- ✅ Web 管理面板(额度查看、模型管理、诊断工具)
|
|
27
|
+
- ✅ API Key 管理(支持 Cursor、Continue 等第三方工具)
|
|
28
|
+
- ✅ 实时额度监控
|
|
29
|
+
- ✅ 自动更新
|
|
30
|
+
- ✅ 跨平台支持(macOS / Windows / Linux)
|
|
31
|
+
|
|
32
|
+
## 支持的平台
|
|
33
|
+
|
|
34
|
+
| 平台 | 架构 | 状态 |
|
|
35
|
+
|------|------|------|
|
|
36
|
+
| macOS | Apple Silicon (arm64) | ✅ |
|
|
37
|
+
| macOS | Intel (x64) | ✅ |
|
|
38
|
+
| Windows | x64 | ✅ |
|
|
39
|
+
| Linux | x64 | ✅ |
|
|
40
|
+
| Linux | arm64 | ✅ |
|
|
41
|
+
|
|
42
|
+
## 使用步骤
|
|
43
|
+
|
|
44
|
+
1. **安装**: `npm install -g copilot-hub-cli`
|
|
45
|
+
2. **启动**: `copilot-hub`
|
|
46
|
+
3. **激活**: 在弹出的浏览器面板中输入卡密
|
|
47
|
+
4. **启动代理**: 点击"启动代理"按钮
|
|
48
|
+
5. **使用 VS Code**: 点击"启动 VS Code",Copilot 已自动配置好
|
|
49
|
+
|
|
50
|
+
## 常见问题
|
|
51
|
+
|
|
52
|
+
### macOS 提示"无法验证开发者"
|
|
53
|
+
```bash
|
|
54
|
+
# 找到二进制文件位置
|
|
55
|
+
which copilot-hub
|
|
56
|
+
# 或者直接对全局 node_modules 目录操作
|
|
57
|
+
xattr -cr $(npm root -g)/copilot-hub-cli/binaries/
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Linux 权限不足
|
|
61
|
+
```bash
|
|
62
|
+
chmod +x $(npm root -g)/copilot-hub-cli/binaries/*
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 端口被占用
|
|
66
|
+
程序会自动尝试 9100-9120 端口,如果全部占用请释放端口后重试。
|
|
67
|
+
|
|
68
|
+
## 卸载
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm uninstall -g copilot-hub-cli
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## 获取卡密
|
|
75
|
+
|
|
76
|
+
请联系客服获取卡密激活使用。
|
package/bin/run.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Copilot Hub CLI — 跨平台启动器
|
|
5
|
+
* 检测当前系统平台和架构,启动对应的 Go 二进制
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { spawn } = require('child_process');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const os = require('os');
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
|
|
13
|
+
// 平台/架构映射
|
|
14
|
+
const PLATFORM_MAP = {
|
|
15
|
+
'darwin-arm64': 'darwin-arm64',
|
|
16
|
+
'darwin-x64': 'darwin-x64',
|
|
17
|
+
'linux-x64': 'linux-x64',
|
|
18
|
+
'linux-arm64': 'linux-arm64',
|
|
19
|
+
'win32-x64': 'win32-x64.exe',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function getBinaryPath() {
|
|
23
|
+
const platform = os.platform();
|
|
24
|
+
const arch = os.arch();
|
|
25
|
+
const key = `${platform}-${arch}`;
|
|
26
|
+
const binaryName = PLATFORM_MAP[key];
|
|
27
|
+
|
|
28
|
+
if (!binaryName) {
|
|
29
|
+
console.error(`❌ 不支持的平台: ${platform}-${arch}`);
|
|
30
|
+
console.error(` 支持的平台: ${Object.keys(PLATFORM_MAP).join(', ')}`);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const binaryPath = path.join(__dirname, '..', 'binaries', binaryName);
|
|
35
|
+
|
|
36
|
+
if (!fs.existsSync(binaryPath)) {
|
|
37
|
+
console.error(`❌ 二进制文件未找到: ${binaryPath}`);
|
|
38
|
+
console.error(` 请尝试重新安装: npm install -g copilot-hub-cli`);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return binaryPath;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const binaryPath = getBinaryPath();
|
|
46
|
+
|
|
47
|
+
// 启动 Go 二进制,继承标准输入输出(支持 Ctrl+C)
|
|
48
|
+
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
49
|
+
stdio: 'inherit',
|
|
50
|
+
env: process.env,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// 转发退出信号
|
|
54
|
+
['SIGINT', 'SIGTERM', 'SIGHUP'].forEach(signal => {
|
|
55
|
+
process.on(signal, () => {
|
|
56
|
+
child.kill(signal);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
child.on('exit', (code, signal) => {
|
|
61
|
+
if (signal) {
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
process.exit(code || 0);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
child.on('error', (err) => {
|
|
68
|
+
console.error(`❌ 启动失败: ${err.message}`);
|
|
69
|
+
console.error(` 二进制路径: ${binaryPath}`);
|
|
70
|
+
if (err.code === 'EACCES') {
|
|
71
|
+
console.error(` 请运行: chmod +x "${binaryPath}"`);
|
|
72
|
+
}
|
|
73
|
+
process.exit(1);
|
|
74
|
+
});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "copilot-hub-cli",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Copilot Hub CLI - AI 编程助手代理服务,一键启动 GitHub Copilot 代理 + Web 管理面板",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"copilot",
|
|
7
|
+
"github-copilot",
|
|
8
|
+
"ai",
|
|
9
|
+
"proxy",
|
|
10
|
+
"vscode",
|
|
11
|
+
"copilot-hub",
|
|
12
|
+
"cli"
|
|
13
|
+
],
|
|
14
|
+
"author": "Copilot Hub",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"bin": {
|
|
17
|
+
"copilot-hub": "bin/run.js"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"bin/",
|
|
21
|
+
"binaries/",
|
|
22
|
+
"scripts/",
|
|
23
|
+
"README.md"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"postinstall": "node scripts/postinstall.js"
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=14.0.0"
|
|
30
|
+
},
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "https://github.com/copilot-hub/cli"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://github.jiandunyun.com"
|
|
36
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* postinstall — 确保二进制文件有执行权限
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const os = require('os');
|
|
8
|
+
|
|
9
|
+
// Windows 不需要 chmod
|
|
10
|
+
if (os.platform() === 'win32') {
|
|
11
|
+
process.exit(0);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const binDir = path.join(__dirname, '..', 'binaries');
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
const files = fs.readdirSync(binDir);
|
|
18
|
+
files.forEach(file => {
|
|
19
|
+
if (!file.endsWith('.exe')) {
|
|
20
|
+
const filePath = path.join(binDir, file);
|
|
21
|
+
fs.chmodSync(filePath, 0o755);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
} catch (err) {
|
|
25
|
+
// 非致命错误,不阻止安装
|
|
26
|
+
console.warn('⚠️ 设置二进制权限失败:', err.message);
|
|
27
|
+
}
|