gitlab-mcp-setup 1.0.0 → 1.0.1
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 +47 -69
- package/dist/cli.js +0 -0
- package/dist/config.d.ts +15 -0
- package/dist/config.js +18 -1
- package/dist/detector.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/writer.js +23 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,92 +1,70 @@
|
|
|
1
|
-
#
|
|
1
|
+
# UCloud Frontend Skills
|
|
2
2
|
|
|
3
|
+
UCloud 前端 AI Skills 体系 - 让 AI 理解并使用公司的组件、服务和开发规范。
|
|
3
4
|
|
|
5
|
+
## 快速开始
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
|
|
8
|
-
|
|
9
|
-
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
|
|
10
|
-
|
|
11
|
-
## Add your files
|
|
12
|
-
|
|
13
|
-
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
|
|
14
|
-
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
|
|
7
|
+
### 1. 配置 GitLab MCP(首次使用)
|
|
15
8
|
|
|
9
|
+
```bash
|
|
10
|
+
npx gitlab-mcp-setup
|
|
16
11
|
```
|
|
17
|
-
cd existing_repo
|
|
18
|
-
git remote add origin https://git.ucloudadmin.com/Leo/u-frontend-skills.git
|
|
19
|
-
git branch -M main
|
|
20
|
-
git push -uf origin main
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Integrate with your tools
|
|
24
|
-
|
|
25
|
-
- [ ] [Set up project integrations](https://git.ucloudadmin.com/Leo/u-frontend-skills/-/settings/integrations)
|
|
26
|
-
|
|
27
|
-
## Collaborate with your team
|
|
28
12
|
|
|
29
|
-
|
|
30
|
-
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
|
|
31
|
-
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
|
|
32
|
-
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
|
|
33
|
-
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
|
|
13
|
+
在弹出的浏览器中完成 OAuth 授权,选择要配置的 AI 工具,**配置完成后重启 AI 工具**。
|
|
34
14
|
|
|
35
|
-
|
|
15
|
+
### 2. 使用 Skills
|
|
36
16
|
|
|
37
|
-
|
|
17
|
+
配置完成后,AI 工具就能使用以下 Skills:
|
|
38
18
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
19
|
+
| Skill | 用途 |
|
|
20
|
+
|-------|------|
|
|
21
|
+
| [console-project-init](./skills/console-project-init/SKILL.md) | 创建新的 Console 产品项目 |
|
|
22
|
+
| [console-local-setup](./skills/console-local-setup/SKILL.md) | 本地开发环境搭建和运行 |
|
|
23
|
+
| [console-services](./skills/console-services/SKILL.md) | 使用控制台公共 Services |
|
|
44
24
|
|
|
45
|
-
|
|
25
|
+
## Skills 列表
|
|
46
26
|
|
|
47
|
-
|
|
27
|
+
### 已完成
|
|
48
28
|
|
|
49
|
-
|
|
29
|
+
- **console-project-init** - 控制台新产品初始化项目
|
|
30
|
+
- **console-local-setup** - 控制台项目本地环境搭建和运行
|
|
31
|
+
- **console-services** - 使用控制台 Services(queryService, regionService, projectService 等)
|
|
50
32
|
|
|
51
|
-
|
|
52
|
-
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
|
|
33
|
+
### 规划中
|
|
53
34
|
|
|
54
|
-
|
|
55
|
-
|
|
35
|
+
- **udesign-components** - UDesign UI 组件库使用规范
|
|
36
|
+
- **console-components** - Console 业务组件库
|
|
37
|
+
- **page-patterns** - 页面模式(列表页、详情页、表单页)
|
|
38
|
+
- **form-patterns** - 表单处理模式
|
|
56
39
|
|
|
57
|
-
##
|
|
58
|
-
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
|
|
40
|
+
## 项目结构
|
|
59
41
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
## Roadmap
|
|
76
|
-
If you have ideas for releases in the future, it is a good idea to list them in the README.
|
|
42
|
+
```
|
|
43
|
+
u-frontend-skills/
|
|
44
|
+
├── skills/ # Skills 文档
|
|
45
|
+
│ ├── console-project-init/SKILL.md
|
|
46
|
+
│ ├── console-local-setup/SKILL.md
|
|
47
|
+
│ └── console-services/SKILL.md
|
|
48
|
+
├── src/ # gitlab-mcp-setup 源码
|
|
49
|
+
│ ├── cli.ts # CLI 入口
|
|
50
|
+
│ ├── config.ts # GitLab OAuth 配置
|
|
51
|
+
│ ├── detector.ts # AI 工具检测器
|
|
52
|
+
│ └── writer.ts # 配置写入器
|
|
53
|
+
├── package.json
|
|
54
|
+
└── README.md
|
|
55
|
+
```
|
|
77
56
|
|
|
78
|
-
##
|
|
79
|
-
State if you are open to contributions and what your requirements are for accepting them.
|
|
57
|
+
## 相关资源
|
|
80
58
|
|
|
81
|
-
|
|
59
|
+
- [Console 前端开发文档](http://console.page.ucloudadmin.com/console-docs/docs/intro)
|
|
60
|
+
- [Services API 文档](http://console.page.ucloudadmin.com/services/)
|
|
61
|
+
- [UDesign 组件库](https://udesign.ucloud.cn)
|
|
62
|
+
- [Console 业务组件库](https://console-test03.ucloudadmin.com/components-examples/)
|
|
82
63
|
|
|
83
|
-
|
|
64
|
+
## 贡献
|
|
84
65
|
|
|
85
|
-
|
|
86
|
-
Show your appreciation to those who have contributed to the project.
|
|
66
|
+
欢迎贡献新的 Skills!请参考现有 Skills 的格式编写。
|
|
87
67
|
|
|
88
68
|
## License
|
|
89
|
-
For open source projects, say how it is licensed.
|
|
90
69
|
|
|
91
|
-
|
|
92
|
-
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
|
|
70
|
+
MIT
|
package/dist/cli.js
CHANGED
|
File without changes
|
package/dist/config.d.ts
CHANGED
|
@@ -17,3 +17,18 @@ export declare const MCP_SERVER_CONFIG: {
|
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
+
export declare const OPENCODE_MCP_CONFIG: {
|
|
21
|
+
mcp: {
|
|
22
|
+
'ucloud-gitlab': {
|
|
23
|
+
type: string;
|
|
24
|
+
command: string[];
|
|
25
|
+
enabled: boolean;
|
|
26
|
+
environment: {
|
|
27
|
+
GITLAB_USE_OAUTH: string;
|
|
28
|
+
GITLAB_OAUTH_CLIENT_ID: string;
|
|
29
|
+
GITLAB_OAUTH_REDIRECT_URI: string;
|
|
30
|
+
GITLAB_API_URL: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
};
|
package/dist/config.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MCP_SERVER_CONFIG = exports.GITLAB_CONFIG = void 0;
|
|
3
|
+
exports.OPENCODE_MCP_CONFIG = exports.MCP_SERVER_CONFIG = exports.GITLAB_CONFIG = void 0;
|
|
4
4
|
exports.GITLAB_CONFIG = {
|
|
5
5
|
OAUTH_CLIENT_ID: '4cc64d7325e8271d5c2425ea02e61199957ddd471f95fc39af951cb19eda1214',
|
|
6
6
|
OAUTH_REDIRECT_URI: 'http://127.0.0.1:8888/callback',
|
|
7
7
|
API_URL: 'https://git.ucloudadmin.com/api/v4',
|
|
8
8
|
};
|
|
9
|
+
// 标准MCP配置格式 (Cursor, Claude Code, VS Code, Claude Desktop)
|
|
9
10
|
exports.MCP_SERVER_CONFIG = {
|
|
10
11
|
mcpServers: {
|
|
11
12
|
'ucloud-gitlab': {
|
|
@@ -20,3 +21,19 @@ exports.MCP_SERVER_CONFIG = {
|
|
|
20
21
|
},
|
|
21
22
|
},
|
|
22
23
|
};
|
|
24
|
+
// OpenCode MCP配置格式
|
|
25
|
+
exports.OPENCODE_MCP_CONFIG = {
|
|
26
|
+
mcp: {
|
|
27
|
+
'ucloud-gitlab': {
|
|
28
|
+
type: 'local',
|
|
29
|
+
command: ['npx', '-y', '@zereight/mcp-gitlab'],
|
|
30
|
+
enabled: true,
|
|
31
|
+
environment: {
|
|
32
|
+
GITLAB_USE_OAUTH: 'true',
|
|
33
|
+
GITLAB_OAUTH_CLIENT_ID: exports.GITLAB_CONFIG.OAUTH_CLIENT_ID,
|
|
34
|
+
GITLAB_OAUTH_REDIRECT_URI: exports.GITLAB_CONFIG.OAUTH_REDIRECT_URI,
|
|
35
|
+
GITLAB_API_URL: exports.GITLAB_CONFIG.API_URL,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
package/dist/detector.js
CHANGED
|
@@ -52,7 +52,7 @@ function getConfigPaths() {
|
|
|
52
52
|
: path.join(home, '.config', 'cursor', 'mcp.json'),
|
|
53
53
|
'claude-code': path.join(home, '.claude', 'settings.json'),
|
|
54
54
|
'vscode': path.join(home, '.vscode', 'mcp.json'),
|
|
55
|
-
'opencode': path.join(home, '.config', 'opencode', '
|
|
55
|
+
'opencode': path.join(home, '.config', 'opencode', 'opencode.json'),
|
|
56
56
|
'claude-desktop': platform === 'darwin'
|
|
57
57
|
? path.join(home, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json')
|
|
58
58
|
: platform === 'win32'
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { detectAITools, getInstalledTools, AITool } from './detector';
|
|
2
2
|
export { writeConfigToTool, writeConfigToTools, WriteResult } from './writer';
|
|
3
|
-
export { GITLAB_CONFIG, MCP_SERVER_CONFIG } from './config';
|
|
3
|
+
export { GITLAB_CONFIG, MCP_SERVER_CONFIG, OPENCODE_MCP_CONFIG } from './config';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MCP_SERVER_CONFIG = exports.GITLAB_CONFIG = exports.writeConfigToTools = exports.writeConfigToTool = exports.getInstalledTools = exports.detectAITools = void 0;
|
|
3
|
+
exports.OPENCODE_MCP_CONFIG = exports.MCP_SERVER_CONFIG = exports.GITLAB_CONFIG = exports.writeConfigToTools = exports.writeConfigToTool = exports.getInstalledTools = exports.detectAITools = void 0;
|
|
4
4
|
var detector_1 = require("./detector");
|
|
5
5
|
Object.defineProperty(exports, "detectAITools", { enumerable: true, get: function () { return detector_1.detectAITools; } });
|
|
6
6
|
Object.defineProperty(exports, "getInstalledTools", { enumerable: true, get: function () { return detector_1.getInstalledTools; } });
|
|
@@ -10,3 +10,4 @@ Object.defineProperty(exports, "writeConfigToTools", { enumerable: true, get: fu
|
|
|
10
10
|
var config_1 = require("./config");
|
|
11
11
|
Object.defineProperty(exports, "GITLAB_CONFIG", { enumerable: true, get: function () { return config_1.GITLAB_CONFIG; } });
|
|
12
12
|
Object.defineProperty(exports, "MCP_SERVER_CONFIG", { enumerable: true, get: function () { return config_1.MCP_SERVER_CONFIG; } });
|
|
13
|
+
Object.defineProperty(exports, "OPENCODE_MCP_CONFIG", { enumerable: true, get: function () { return config_1.OPENCODE_MCP_CONFIG; } });
|
package/dist/writer.js
CHANGED
|
@@ -64,7 +64,7 @@ function readExistingConfig(filePath) {
|
|
|
64
64
|
}
|
|
65
65
|
return {};
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function mergeStandardConfig(existing, newConfig) {
|
|
68
68
|
const merged = { ...existing };
|
|
69
69
|
if (!merged.mcpServers) {
|
|
70
70
|
merged.mcpServers = {};
|
|
@@ -76,12 +76,33 @@ function mergeConfigs(existing, newConfig) {
|
|
|
76
76
|
}
|
|
77
77
|
return merged;
|
|
78
78
|
}
|
|
79
|
+
function mergeOpenCodeConfig(existing, newConfig) {
|
|
80
|
+
const merged = { ...existing };
|
|
81
|
+
if (!merged.mcp) {
|
|
82
|
+
merged.mcp = {};
|
|
83
|
+
}
|
|
84
|
+
const existingMcp = merged.mcp;
|
|
85
|
+
const newMcp = newConfig.mcp;
|
|
86
|
+
for (const [key, value] of Object.entries(newMcp)) {
|
|
87
|
+
existingMcp[key] = value;
|
|
88
|
+
}
|
|
89
|
+
return merged;
|
|
90
|
+
}
|
|
91
|
+
function isOpenCodeTool(tool) {
|
|
92
|
+
return tool.name === 'OpenCode';
|
|
93
|
+
}
|
|
79
94
|
function writeConfigToTool(tool) {
|
|
80
95
|
try {
|
|
81
96
|
ensureDirectoryExists(tool.configPath);
|
|
82
97
|
const backupPath = backupExistingConfig(tool.configPath);
|
|
83
98
|
const existingConfig = readExistingConfig(tool.configPath);
|
|
84
|
-
|
|
99
|
+
let mergedConfig;
|
|
100
|
+
if (isOpenCodeTool(tool)) {
|
|
101
|
+
mergedConfig = mergeOpenCodeConfig(existingConfig, config_1.OPENCODE_MCP_CONFIG);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
mergedConfig = mergeStandardConfig(existingConfig, config_1.MCP_SERVER_CONFIG);
|
|
105
|
+
}
|
|
85
106
|
fs.writeFileSync(tool.configPath, JSON.stringify(mergedConfig, null, 2), 'utf-8');
|
|
86
107
|
return {
|
|
87
108
|
tool,
|
package/package.json
CHANGED