@amonstack/gitea-mcp 0.1.3
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/LICENSE +21 -0
- package/README.md +190 -0
- package/README.zh-CN.md +189 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +15 -0
- package/dist/cli.js.map +1 -0
- package/dist/gitea-client.d.ts +170 -0
- package/dist/gitea-client.js +202 -0
- package/dist/gitea-client.js.map +1 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.js +312 -0
- package/dist/server.js.map +1 -0
- package/dist/tools.d.ts +185 -0
- package/dist/tools.js +165 -0
- package/dist/tools.js.map +1 -0
- package/package.json +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 amonstack
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# gitea-mcp
|
|
2
|
+
|
|
3
|
+
[中文文档](https://github.com/amonstack/gitea_mcp/blob/master/README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
> MCP server that lets AI assistants manage Gitea repositories — issues, labels,
|
|
6
|
+
> milestones, comments, and more via the Gitea API.
|
|
7
|
+
|
|
8
|
+
## What is gitea-mcp?
|
|
9
|
+
|
|
10
|
+
`gitea-mcp` is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/)
|
|
11
|
+
server that exposes Gitea repository operations as tools. Once connected to an
|
|
12
|
+
MCP client (Claude Desktop, opencode, Cursor, etc.), an AI assistant can list,
|
|
13
|
+
create, update, and delete issues, labels, milestones, and comments on your
|
|
14
|
+
Gitea instance — all through natural language.
|
|
15
|
+
|
|
16
|
+
The server communicates over stdio and wraps the [Gitea REST API
|
|
17
|
+
(`/api/v1`)](https://docs.gitea.com/api/1.22/).
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
### From GitHub Packages
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm set @amonstack:registry https://npm.pkg.github.com
|
|
25
|
+
npm set //npm.pkg.github.com/:_authToken YOUR_GITHUB_PAT
|
|
26
|
+
npm install -g @amonstack/gitea-mcp
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Your GitHub PAT needs the `read:packages` scope.
|
|
30
|
+
|
|
31
|
+
### Build from source
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
git clone https://github.com/amonstack/gitea-mcp.git
|
|
35
|
+
cd gitea-mcp
|
|
36
|
+
npm ci
|
|
37
|
+
npm run build
|
|
38
|
+
node dist/cli.js
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Configuration
|
|
42
|
+
|
|
43
|
+
| Variable | Required | Description |
|
|
44
|
+
|----------|:--------:|-------------|
|
|
45
|
+
| `GITEA_BASE_URL` | Yes | Gitea instance URL (e.g. `https://gitea.example.com`) |
|
|
46
|
+
| `GITEA_TOKEN` | Yes | Gitea API access token |
|
|
47
|
+
| `GITEA_DEFAULT_OWNER` | No | Default repository owner — skip passing `owner` on every call |
|
|
48
|
+
| `GITEA_DEFAULT_REPO` | No | Default repository name — skip passing `repo` on every call |
|
|
49
|
+
|
|
50
|
+
When `GITEA_DEFAULT_OWNER` and `GITEA_DEFAULT_REPO` are set, you can omit the
|
|
51
|
+
`owner` and `repo` parameters in tool calls. The `resolve_repo` tool can also
|
|
52
|
+
auto-detect them from a local git repository.
|
|
53
|
+
|
|
54
|
+
## MCP Client Setup
|
|
55
|
+
|
|
56
|
+
### Claude Desktop
|
|
57
|
+
|
|
58
|
+
Add to `claude_desktop_config.json`:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"mcpServers": {
|
|
63
|
+
"gitea-mcp": {
|
|
64
|
+
"command": "gitea-mcp",
|
|
65
|
+
"env": {
|
|
66
|
+
"GITEA_BASE_URL": "https://gitea.example.com",
|
|
67
|
+
"GITEA_TOKEN": "your-token-here",
|
|
68
|
+
"GITEA_DEFAULT_OWNER": "my-org",
|
|
69
|
+
"GITEA_DEFAULT_REPO": "my-repo"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
If you built from source, use `node /path/to/gitea-mcp/dist/cli.js` instead.
|
|
77
|
+
|
|
78
|
+
### opencode
|
|
79
|
+
|
|
80
|
+
Add to your opencode MCP configuration:
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"mcpServers": {
|
|
85
|
+
"gitea-mcp": {
|
|
86
|
+
"command": "gitea-mcp",
|
|
87
|
+
"env": {
|
|
88
|
+
"GITEA_BASE_URL": "https://gitea.example.com",
|
|
89
|
+
"GITEA_TOKEN": "your-token-here"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
If you built from source, use `node /path/to/gitea-mcp/dist/cli.js` instead.
|
|
97
|
+
|
|
98
|
+
### Other MCP Clients
|
|
99
|
+
|
|
100
|
+
Any client that supports stdio-based MCP servers can use `gitea-mcp`. After
|
|
101
|
+
installation, set the required environment variables and run:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
export GITEA_BASE_URL="https://gitea.example.com"
|
|
105
|
+
export GITEA_TOKEN="your-access-token"
|
|
106
|
+
gitea-mcp
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Available Tools
|
|
110
|
+
|
|
111
|
+
### Issues
|
|
112
|
+
|
|
113
|
+
| Tool | Description |
|
|
114
|
+
|------|-------------|
|
|
115
|
+
| `list_issues` | List issues (filter by `state`, `labels`, page/limit) |
|
|
116
|
+
| `get_issue` | Get a single issue by `index` (issue number) |
|
|
117
|
+
| `create_issue` | Create an issue with `title`, `body`, `assignee`, `labels`, `milestone` |
|
|
118
|
+
| `update_issue` | Update issue fields or `state` |
|
|
119
|
+
| `delete_issue` | Delete an issue by `index` |
|
|
120
|
+
| `search_issues` | Search across repositories by `query`, `type`, `state`, `labels` |
|
|
121
|
+
|
|
122
|
+
### Comments
|
|
123
|
+
|
|
124
|
+
| Tool | Description |
|
|
125
|
+
|------|-------------|
|
|
126
|
+
| `list_comments` | List comments on an issue |
|
|
127
|
+
| `create_comment` | Add a comment to an issue |
|
|
128
|
+
| `update_comment` | Update a comment by `id` |
|
|
129
|
+
| `delete_comment` | Delete a comment by `id` |
|
|
130
|
+
|
|
131
|
+
### Labels
|
|
132
|
+
|
|
133
|
+
| Tool | Description |
|
|
134
|
+
|------|-------------|
|
|
135
|
+
| `list_labels` | List repository labels |
|
|
136
|
+
| `create_label` | Create a label (`name`, `color`, `description`) |
|
|
137
|
+
| `update_label` | Update a label by `id` |
|
|
138
|
+
| `delete_label` | Delete a label by `id` |
|
|
139
|
+
| `add_issue_labels` | Add labels to an issue by name |
|
|
140
|
+
| `remove_issue_label` | Remove a label from an issue by label `id` |
|
|
141
|
+
| `replace_issue_labels` | Replace all labels on an issue |
|
|
142
|
+
| `clear_issue_labels` | Remove all labels from an issue |
|
|
143
|
+
|
|
144
|
+
### Milestones
|
|
145
|
+
|
|
146
|
+
| Tool | Description |
|
|
147
|
+
|------|-------------|
|
|
148
|
+
| `list_milestones` | List milestones (filter by `state`) |
|
|
149
|
+
| `get_milestone` | Get a milestone by `id` |
|
|
150
|
+
| `create_milestone` | Create a milestone with `title`, `description`, `due_on` |
|
|
151
|
+
| `update_milestone` | Update milestone fields or `state` |
|
|
152
|
+
| `delete_milestone` | Delete a milestone by `id` |
|
|
153
|
+
|
|
154
|
+
### Repository Helpers
|
|
155
|
+
|
|
156
|
+
| Tool | Description |
|
|
157
|
+
|------|-------------|
|
|
158
|
+
| `list_my_repos` | List repositories accessible to the authenticated user |
|
|
159
|
+
| `resolve_repo` | Auto-detect `owner` and `repo` from a local git remote URL |
|
|
160
|
+
|
|
161
|
+
## Development
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
git clone https://github.com/amonstack/gitea-mcp.git
|
|
165
|
+
cd gitea-mcp
|
|
166
|
+
npm ci
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
| Command | Description |
|
|
170
|
+
|---------|-------------|
|
|
171
|
+
| `make lint` | Type-check only |
|
|
172
|
+
| `make build` | Compile `src/` to `dist/` |
|
|
173
|
+
| `make test` | Run unit tests |
|
|
174
|
+
| `make test-watch` | Run tests in watch mode |
|
|
175
|
+
| `make test-integration` | Run integration tests (needs live Gitea instance) |
|
|
176
|
+
| `make dev` | Run directly with tsx |
|
|
177
|
+
|
|
178
|
+
### Project layout
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
src/
|
|
182
|
+
cli.ts # Entry point
|
|
183
|
+
server.ts # MCP server setup and tool registration
|
|
184
|
+
tools.ts # Zod input schemas for all tools
|
|
185
|
+
gitea-client.ts # REST client wrapping Gitea /api/v1 endpoints
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## License
|
|
189
|
+
|
|
190
|
+
MIT
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# gitea-mcp
|
|
2
|
+
|
|
3
|
+
[English](https://github.com/amonstack/gitea_mcp/blob/master/README.md)
|
|
4
|
+
|
|
5
|
+
> 让 AI 助手通过 MCP 协议管理 Gitea 仓库 —— 议题、标签、里程碑、评论等功能,
|
|
6
|
+
> 全部通过 Gitea API 实现。
|
|
7
|
+
|
|
8
|
+
## 这是什么?
|
|
9
|
+
|
|
10
|
+
`gitea-mcp` 是一个 [Model Context Protocol (MCP)](https://modelcontextprotocol.io/)
|
|
11
|
+
服务端,将 Gitea 仓库操作暴露为 MCP 工具。连接到 MCP 客户端(Claude Desktop、
|
|
12
|
+
opencode、Cursor 等)后,AI 助手即可通过自然语言在 Gitea 实例上创建、查询、
|
|
13
|
+
更新和删除议题、标签、里程碑和评论。
|
|
14
|
+
|
|
15
|
+
服务端通过 stdio 通信,封装了 [Gitea REST API
|
|
16
|
+
(`/api/v1`)](https://docs.gitea.com/api/1.22/)。
|
|
17
|
+
|
|
18
|
+
## 安装
|
|
19
|
+
|
|
20
|
+
### 从 GitHub Packages 安装
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm set @amonstack:registry https://npm.pkg.github.com
|
|
24
|
+
npm set //npm.pkg.github.com/:_authToken <你的 GitHub PAT>
|
|
25
|
+
npm install -g @amonstack/gitea-mcp
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
GitHub PAT 需要 `read:packages` 权限。
|
|
29
|
+
|
|
30
|
+
### 从源码构建
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
git clone https://github.com/amonstack/gitea-mcp.git
|
|
34
|
+
cd gitea-mcp
|
|
35
|
+
npm ci
|
|
36
|
+
npm run build
|
|
37
|
+
node dist/cli.js
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## 配置
|
|
41
|
+
|
|
42
|
+
| 变量 | 必填 | 说明 |
|
|
43
|
+
|------|:----:|------|
|
|
44
|
+
| `GITEA_BASE_URL` | 是 | Gitea 实例地址(如 `https://gitea.example.com`) |
|
|
45
|
+
| `GITEA_TOKEN` | 是 | Gitea API 访问令牌 |
|
|
46
|
+
| `GITEA_DEFAULT_OWNER` | 否 | 默认仓库所有者,免去每次传入 `owner` 参数 |
|
|
47
|
+
| `GITEA_DEFAULT_REPO` | 否 | 默认仓库名称,免去每次传入 `repo` 参数 |
|
|
48
|
+
|
|
49
|
+
设置 `GITEA_DEFAULT_OWNER` 和 `GITEA_DEFAULT_REPO` 后,调用工具时可以省略
|
|
50
|
+
`owner` 和 `repo` 参数。也可以使用 `resolve_repo` 工具自动从本地 git 仓库
|
|
51
|
+
检测这两个值。
|
|
52
|
+
|
|
53
|
+
## MCP 客户端配置
|
|
54
|
+
|
|
55
|
+
### Claude Desktop
|
|
56
|
+
|
|
57
|
+
在 `claude_desktop_config.json` 中添加:
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"mcpServers": {
|
|
62
|
+
"gitea-mcp": {
|
|
63
|
+
"command": "gitea-mcp",
|
|
64
|
+
"env": {
|
|
65
|
+
"GITEA_BASE_URL": "https://gitea.example.com",
|
|
66
|
+
"GITEA_TOKEN": "your-token-here",
|
|
67
|
+
"GITEA_DEFAULT_OWNER": "my-org",
|
|
68
|
+
"GITEA_DEFAULT_REPO": "my-repo"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
如果从源码构建,将 `command` 改为 `node /path/to/gitea-mcp/dist/cli.js`。
|
|
76
|
+
|
|
77
|
+
### opencode
|
|
78
|
+
|
|
79
|
+
在 opencode 的 MCP 配置中添加:
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"mcpServers": {
|
|
84
|
+
"gitea-mcp": {
|
|
85
|
+
"command": "gitea-mcp",
|
|
86
|
+
"env": {
|
|
87
|
+
"GITEA_BASE_URL": "https://gitea.example.com",
|
|
88
|
+
"GITEA_TOKEN": "your-token-here"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
如果从源码构建,将 `command` 改为 `node /path/to/gitea-mcp/dist/cli.js`。
|
|
96
|
+
|
|
97
|
+
### 其他 MCP 客户端
|
|
98
|
+
|
|
99
|
+
任何支持 stdio 方式运行 MCP 服务端的客户端都可以使用。安装完成后设置环境
|
|
100
|
+
变量并启动:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
export GITEA_BASE_URL="https://gitea.example.com"
|
|
104
|
+
export GITEA_TOKEN="your-access-token"
|
|
105
|
+
gitea-mcp
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## 可用工具
|
|
109
|
+
|
|
110
|
+
### 议题 (Issues)
|
|
111
|
+
|
|
112
|
+
| 工具 | 说明 |
|
|
113
|
+
|------|------|
|
|
114
|
+
| `list_issues` | 列出议题(可按 `state`、`labels` 筛选及分页) |
|
|
115
|
+
| `get_issue` | 按 `index`(议题编号)获取单个议题 |
|
|
116
|
+
| `create_issue` | 创建议题,支持 `title`、`body`、`assignee`、`labels`、`milestone` |
|
|
117
|
+
| `update_issue` | 更新议题字段或 `state` |
|
|
118
|
+
| `delete_issue` | 按 `index` 删除议题 |
|
|
119
|
+
| `search_issues` | 跨仓库搜索议题,支持 `query`、`type`、`state`、`labels` |
|
|
120
|
+
|
|
121
|
+
### 评论 (Comments)
|
|
122
|
+
|
|
123
|
+
| 工具 | 说明 |
|
|
124
|
+
|------|------|
|
|
125
|
+
| `list_comments` | 列出某个议题的评论 |
|
|
126
|
+
| `create_comment` | 为议题添加评论 |
|
|
127
|
+
| `update_comment` | 按 `id` 更新评论 |
|
|
128
|
+
| `delete_comment` | 按 `id` 删除评论 |
|
|
129
|
+
|
|
130
|
+
### 标签 (Labels)
|
|
131
|
+
|
|
132
|
+
| 工具 | 说明 |
|
|
133
|
+
|------|------|
|
|
134
|
+
| `list_labels` | 列出仓库标签 |
|
|
135
|
+
| `create_label` | 创建标签(`name`、`color`、`description`) |
|
|
136
|
+
| `update_label` | 按 `id` 更新标签 |
|
|
137
|
+
| `delete_label` | 按 `id` 删除标签 |
|
|
138
|
+
| `add_issue_labels` | 按名称给议题添加标签 |
|
|
139
|
+
| `remove_issue_label` | 按标签 `id` 从议题移除标签 |
|
|
140
|
+
| `replace_issue_labels` | 替换议题上的所有标签 |
|
|
141
|
+
| `clear_issue_labels` | 清除议题上的所有标签 |
|
|
142
|
+
|
|
143
|
+
### 里程碑 (Milestones)
|
|
144
|
+
|
|
145
|
+
| 工具 | 说明 |
|
|
146
|
+
|------|------|
|
|
147
|
+
| `list_milestones` | 列出里程碑(可按 `state` 筛选) |
|
|
148
|
+
| `get_milestone` | 按 `id` 获取里程碑 |
|
|
149
|
+
| `create_milestone` | 创建里程碑,支持 `title`、`description`、`due_on` |
|
|
150
|
+
| `update_milestone` | 更新里程碑字段或 `state` |
|
|
151
|
+
| `delete_milestone` | 按 `id` 删除里程碑 |
|
|
152
|
+
|
|
153
|
+
### 仓库辅助 (Repository Helpers)
|
|
154
|
+
|
|
155
|
+
| 工具 | 说明 |
|
|
156
|
+
|------|------|
|
|
157
|
+
| `list_my_repos` | 列出当前用户可访问的仓库 |
|
|
158
|
+
| `resolve_repo` | 从本地 git 仓库的远程地址自动检测 `owner` 和 `repo` |
|
|
159
|
+
|
|
160
|
+
## 二次开发
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
git clone https://github.com/amonstack/gitea-mcp.git
|
|
164
|
+
cd gitea-mcp
|
|
165
|
+
npm ci
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
| 命令 | 说明 |
|
|
169
|
+
|------|------|
|
|
170
|
+
| `make lint` | 仅类型检查 |
|
|
171
|
+
| `make build` | 将 `src/` 编译到 `dist/` |
|
|
172
|
+
| `make test` | 运行单元测试 |
|
|
173
|
+
| `make test-watch` | 监听模式运行测试 |
|
|
174
|
+
| `make test-integration` | 运行集成测试(需要可用的 Gitea 实例) |
|
|
175
|
+
| `make dev` | 通过 tsx 直接运行 |
|
|
176
|
+
|
|
177
|
+
### 项目结构
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
src/
|
|
181
|
+
cli.ts # 入口文件
|
|
182
|
+
server.ts # MCP 服务端搭建与工具注册
|
|
183
|
+
tools.ts # 所有工具的 Zod 输入模式定义
|
|
184
|
+
gitea-client.ts # 封装 Gitea /api/v1 端点的 REST 客户端
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## 许可证
|
|
188
|
+
|
|
189
|
+
MIT
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { runServer } from "./server.js";
|
|
3
|
+
const baseUrl = process.env.GITEA_BASE_URL;
|
|
4
|
+
const token = process.env.GITEA_TOKEN;
|
|
5
|
+
const defaultOwner = process.env.GITEA_DEFAULT_OWNER;
|
|
6
|
+
const defaultRepo = process.env.GITEA_DEFAULT_REPO;
|
|
7
|
+
if (!baseUrl || !token) {
|
|
8
|
+
console.error("GITEA_BASE_URL and GITEA_TOKEN environment variables are required");
|
|
9
|
+
process.exit(1);
|
|
10
|
+
}
|
|
11
|
+
runServer(baseUrl, token, defaultOwner, defaultRepo).catch((err) => {
|
|
12
|
+
console.error("Fatal error:", err);
|
|
13
|
+
process.exit(1);
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;AAC3C,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;AACtC,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;AACrD,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;AAEnD,IAAI,CAAC,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;IACvB,OAAO,CAAC,KAAK,CAAC,mEAAmE,CAAC,CAAC;IACnF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,SAAS,CAAC,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACjE,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;IACnC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
export interface GiteaConfig {
|
|
2
|
+
baseUrl: string;
|
|
3
|
+
token: string;
|
|
4
|
+
}
|
|
5
|
+
export interface Issue {
|
|
6
|
+
id: number;
|
|
7
|
+
number: number;
|
|
8
|
+
title: string;
|
|
9
|
+
state: string;
|
|
10
|
+
body?: string;
|
|
11
|
+
html_url: string;
|
|
12
|
+
url: string;
|
|
13
|
+
comments: number;
|
|
14
|
+
created_at: string;
|
|
15
|
+
updated_at: string;
|
|
16
|
+
closed_at?: string;
|
|
17
|
+
labels: Label[];
|
|
18
|
+
assignee?: User;
|
|
19
|
+
assignees?: User[];
|
|
20
|
+
milestone?: Milestone;
|
|
21
|
+
repository: Repository;
|
|
22
|
+
}
|
|
23
|
+
export interface Label {
|
|
24
|
+
id: number;
|
|
25
|
+
name: string;
|
|
26
|
+
color: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface User {
|
|
30
|
+
id: number;
|
|
31
|
+
login: string;
|
|
32
|
+
full_name?: string;
|
|
33
|
+
avatar_url: string;
|
|
34
|
+
email?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface Milestone {
|
|
37
|
+
id: number;
|
|
38
|
+
title: string;
|
|
39
|
+
description?: string;
|
|
40
|
+
state: string;
|
|
41
|
+
open_issues: number;
|
|
42
|
+
closed_issues: number;
|
|
43
|
+
due_on?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface Repository {
|
|
46
|
+
id: number;
|
|
47
|
+
full_name: string;
|
|
48
|
+
name: string;
|
|
49
|
+
owner: {
|
|
50
|
+
login: string;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export interface Comment {
|
|
54
|
+
id: number;
|
|
55
|
+
body: string;
|
|
56
|
+
html_url: string;
|
|
57
|
+
created_at: string;
|
|
58
|
+
updated_at: string;
|
|
59
|
+
user: User;
|
|
60
|
+
}
|
|
61
|
+
export interface Repo {
|
|
62
|
+
id: number;
|
|
63
|
+
full_name: string;
|
|
64
|
+
name: string;
|
|
65
|
+
owner: User;
|
|
66
|
+
description?: string;
|
|
67
|
+
html_url: string;
|
|
68
|
+
default_branch?: string;
|
|
69
|
+
created_at: string;
|
|
70
|
+
updated_at: string;
|
|
71
|
+
}
|
|
72
|
+
export interface CreateIssueParams {
|
|
73
|
+
owner: string;
|
|
74
|
+
repo: string;
|
|
75
|
+
title: string;
|
|
76
|
+
body?: string;
|
|
77
|
+
assignee?: string;
|
|
78
|
+
assignees?: string[];
|
|
79
|
+
labels?: number[];
|
|
80
|
+
milestone?: number;
|
|
81
|
+
}
|
|
82
|
+
export interface UpdateIssueParams {
|
|
83
|
+
owner: string;
|
|
84
|
+
repo: string;
|
|
85
|
+
index: number;
|
|
86
|
+
title?: string;
|
|
87
|
+
body?: string;
|
|
88
|
+
assignee?: string;
|
|
89
|
+
assignees?: string[];
|
|
90
|
+
labels?: number[];
|
|
91
|
+
milestone?: number;
|
|
92
|
+
state?: string;
|
|
93
|
+
}
|
|
94
|
+
export interface ListIssuesParams {
|
|
95
|
+
owner: string;
|
|
96
|
+
repo: string;
|
|
97
|
+
state?: "open" | "closed" | "all";
|
|
98
|
+
labels?: string;
|
|
99
|
+
page?: number;
|
|
100
|
+
limit?: number;
|
|
101
|
+
}
|
|
102
|
+
export interface SearchIssuesParams {
|
|
103
|
+
query?: string;
|
|
104
|
+
type?: "issues" | "pulls";
|
|
105
|
+
state?: "open" | "closed" | "all";
|
|
106
|
+
labels?: string;
|
|
107
|
+
page?: number;
|
|
108
|
+
limit?: number;
|
|
109
|
+
}
|
|
110
|
+
export interface CreateLabelParams {
|
|
111
|
+
owner: string;
|
|
112
|
+
repo: string;
|
|
113
|
+
name: string;
|
|
114
|
+
color: string;
|
|
115
|
+
description?: string;
|
|
116
|
+
}
|
|
117
|
+
export interface UpdateLabelParams {
|
|
118
|
+
owner: string;
|
|
119
|
+
repo: string;
|
|
120
|
+
id: number;
|
|
121
|
+
name?: string;
|
|
122
|
+
color?: string;
|
|
123
|
+
description?: string;
|
|
124
|
+
}
|
|
125
|
+
export interface CreateMilestoneParams {
|
|
126
|
+
owner: string;
|
|
127
|
+
repo: string;
|
|
128
|
+
title: string;
|
|
129
|
+
description?: string;
|
|
130
|
+
due_on?: string;
|
|
131
|
+
}
|
|
132
|
+
export interface UpdateMilestoneParams {
|
|
133
|
+
owner: string;
|
|
134
|
+
repo: string;
|
|
135
|
+
id: number;
|
|
136
|
+
title?: string;
|
|
137
|
+
description?: string;
|
|
138
|
+
due_on?: string;
|
|
139
|
+
state?: string;
|
|
140
|
+
}
|
|
141
|
+
export declare class GiteaClient {
|
|
142
|
+
private baseUrl;
|
|
143
|
+
private token;
|
|
144
|
+
constructor(config: GiteaConfig);
|
|
145
|
+
private request;
|
|
146
|
+
listIssues(params: ListIssuesParams): Promise<Issue[]>;
|
|
147
|
+
getIssue(owner: string, repo: string, index: number): Promise<Issue>;
|
|
148
|
+
createIssue(params: CreateIssueParams): Promise<Issue>;
|
|
149
|
+
updateIssue(params: UpdateIssueParams): Promise<Issue>;
|
|
150
|
+
deleteIssue(owner: string, repo: string, index: number): Promise<void>;
|
|
151
|
+
searchIssues(params: SearchIssuesParams): Promise<Issue[]>;
|
|
152
|
+
listComments(owner: string, repo: string, index: number): Promise<Comment[]>;
|
|
153
|
+
createComment(owner: string, repo: string, index: number, body: string): Promise<Comment>;
|
|
154
|
+
updateComment(owner: string, repo: string, id: number, body: string): Promise<Comment>;
|
|
155
|
+
deleteComment(owner: string, repo: string, id: number): Promise<void>;
|
|
156
|
+
listLabels(owner: string, repo: string, page?: number, limit?: number): Promise<Label[]>;
|
|
157
|
+
createLabel(params: CreateLabelParams): Promise<Label>;
|
|
158
|
+
updateLabel(params: UpdateLabelParams): Promise<Label>;
|
|
159
|
+
deleteLabel(owner: string, repo: string, id: number): Promise<void>;
|
|
160
|
+
addIssueLabels(owner: string, repo: string, index: number, labels: string[]): Promise<Label[]>;
|
|
161
|
+
removeIssueLabel(owner: string, repo: string, index: number, id: number): Promise<void>;
|
|
162
|
+
replaceIssueLabels(owner: string, repo: string, index: number, labels: string[]): Promise<Label[]>;
|
|
163
|
+
clearIssueLabels(owner: string, repo: string, index: number): Promise<void>;
|
|
164
|
+
listMilestones(owner: string, repo: string, state?: string, page?: number, limit?: number): Promise<Milestone[]>;
|
|
165
|
+
getMilestone(owner: string, repo: string, id: number): Promise<Milestone>;
|
|
166
|
+
createMilestone(params: CreateMilestoneParams): Promise<Milestone>;
|
|
167
|
+
updateMilestone(params: UpdateMilestoneParams): Promise<Milestone>;
|
|
168
|
+
deleteMilestone(owner: string, repo: string, id: number): Promise<void>;
|
|
169
|
+
listMyRepos(page?: number, limit?: number): Promise<Repo[]>;
|
|
170
|
+
}
|