@foundation0/git 1.2.5 → 1.3.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 +291 -291
- package/gitea-swagger.json +28627 -28627
- package/mcp/README.md +266 -250
- package/mcp/cli.mjs +37 -37
- package/mcp/src/cli.ts +76 -76
- package/mcp/src/client.ts +147 -147
- package/mcp/src/index.ts +7 -7
- package/mcp/src/redaction.ts +207 -207
- package/mcp/src/server.ts +1778 -718
- package/package.json +3 -1
- package/src/actions-api.ts +900 -531
- package/src/api.ts +69 -69
- package/src/ci-api.ts +544 -0
- package/src/git-service-api.ts +822 -683
- package/src/git-service-feature-spec.generated.ts +5341 -5341
- package/src/index.ts +55 -54
- package/src/issue-dependencies.ts +533 -469
- package/src/label-management.ts +587 -587
- package/src/platform/config.ts +62 -62
- package/src/platform/gitea-adapter.ts +460 -448
- package/src/platform/gitea-rules.ts +129 -129
- package/src/platform/index.ts +44 -44
- package/src/repository.ts +151 -151
- package/src/spec-mock.ts +45 -45
package/README.md
CHANGED
|
@@ -1,291 +1,291 @@
|
|
|
1
|
-
# git
|
|
2
|
-
|
|
3
|
-
`@foundation0/git` exposes a generated Git API object where methods follow the shape `repo.issue.create(...)`, `repo.pr.merge(...)`, etc.
|
|
4
|
-
|
|
5
|
-
The API client maps GH-style feature paths to Gitea REST endpoints and executes real HTTP requests through `fetch`.
|
|
6
|
-
|
|
7
|
-
## Install
|
|
8
|
-
|
|
9
|
-
Install globally:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
pnpm add -g @foundation0/git
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
Run MCP server through npm without a global install:
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npx -y -p @foundation0/git f0-git-mcp --help
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Using pnpm:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
pnpm dlx @foundation0/git f0-git-mcp --help
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Installation in this monorepo
|
|
28
|
-
|
|
29
|
-
From repo root:
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
pnpm install
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Run tests:
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
pnpm -C packages/git test
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## Quick start
|
|
42
|
-
|
|
43
|
-
```ts
|
|
44
|
-
import { createGitServiceApi } from '@foundation0/git'
|
|
45
|
-
|
|
46
|
-
const api = createGitServiceApi({
|
|
47
|
-
config: {
|
|
48
|
-
platform: 'GITEA',
|
|
49
|
-
giteaHost: 'https://gitea.example.com',
|
|
50
|
-
giteaToken: process.env.GITEA_TOKEN,
|
|
51
|
-
},
|
|
52
|
-
defaultOwner: 'example-org',
|
|
53
|
-
defaultRepo: 'example-repo',
|
|
54
|
-
})
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
You can also import the singleton:
|
|
58
|
-
|
|
59
|
-
```ts
|
|
60
|
-
import { gitServiceApi } from '@foundation0/git'
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
All methods return:
|
|
64
|
-
|
|
65
|
-
```ts
|
|
66
|
-
type GitServiceApiExecutionResult = {
|
|
67
|
-
mapping: GitApiFeatureMapping
|
|
68
|
-
request: {
|
|
69
|
-
url: string
|
|
70
|
-
method: string
|
|
71
|
-
headers: Record<string, string>
|
|
72
|
-
query: string[]
|
|
73
|
-
body?: unknown
|
|
74
|
-
}
|
|
75
|
-
status: number
|
|
76
|
-
ok: boolean
|
|
77
|
-
body: unknown
|
|
78
|
-
}
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
## Core request shapes
|
|
82
|
-
|
|
83
|
-
Write methods accept request fields directly (recommended), or you can set the raw request body with `data` / `json` / `payload` / `requestBody`.
|
|
84
|
-
|
|
85
|
-
```ts
|
|
86
|
-
await api.repo.issue.create({
|
|
87
|
-
title: 'Bug report',
|
|
88
|
-
body: 'Describe issue details',
|
|
89
|
-
labels: ['bug'],
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
// equivalent explicit-body form
|
|
93
|
-
await api.repo.issue.create({
|
|
94
|
-
data: { title: 'Bug report', body: 'Describe issue details', labels: ['bug'] },
|
|
95
|
-
})
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
Use `headers` to pass custom headers and `query` for additional URL params.
|
|
99
|
-
|
|
100
|
-
```ts
|
|
101
|
-
await api.repo.issue.list({
|
|
102
|
-
headers: { 'X-Request-Id': 'local' },
|
|
103
|
-
query: { state: 'open', limit: 20, page: 1 },
|
|
104
|
-
})
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
## Popular workflow examples
|
|
108
|
-
|
|
109
|
-
### 1) Issue lifecycle (most used)
|
|
110
|
-
|
|
111
|
-
```ts
|
|
112
|
-
// List issues in the default repo
|
|
113
|
-
await api.repo.issue.list()
|
|
114
|
-
|
|
115
|
-
// Create a new issue
|
|
116
|
-
await api.repo.issue.create({
|
|
117
|
-
data: {
|
|
118
|
-
title: 'Login fails with 401',
|
|
119
|
-
body: 'Repro: open login page and click submit.',
|
|
120
|
-
labels: ['bug'],
|
|
121
|
-
},
|
|
122
|
-
})
|
|
123
|
-
|
|
124
|
-
// View an issue
|
|
125
|
-
await api.repo.issue.view('17')
|
|
126
|
-
|
|
127
|
-
// Comment on an issue
|
|
128
|
-
await api.repo.issue.comment('17', {
|
|
129
|
-
data: { body: 'We are investigating this now.' },
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
// Edit title/body
|
|
133
|
-
await api.repo.issue.edit('17', {
|
|
134
|
-
data: {
|
|
135
|
-
title: 'Login fails with 401 (investigating)',
|
|
136
|
-
body: 'Updated with steps to reproduce.',
|
|
137
|
-
},
|
|
138
|
-
})
|
|
139
|
-
|
|
140
|
-
// Close and reopen
|
|
141
|
-
await api.repo.issue.close('17', { reason: 'not_planned' })
|
|
142
|
-
await api.repo.issue.reopen('17')
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
### 2) Pull request workflow
|
|
146
|
-
|
|
147
|
-
```ts
|
|
148
|
-
// Open a pull request
|
|
149
|
-
await api.repo.pr.create({
|
|
150
|
-
data: {
|
|
151
|
-
title: 'chore: improve error handling',
|
|
152
|
-
body: 'Adds retries and better messaging.',
|
|
153
|
-
head: 'feature/error-handling',
|
|
154
|
-
base: 'main',
|
|
155
|
-
},
|
|
156
|
-
})
|
|
157
|
-
|
|
158
|
-
// List and inspect PRs
|
|
159
|
-
await api.repo.pr.list({ query: { state: 'open' } })
|
|
160
|
-
await api.repo.pr.view('42')
|
|
161
|
-
|
|
162
|
-
// Add a review comment
|
|
163
|
-
await api.repo.pr.comment('42', {
|
|
164
|
-
data: { body: 'Looks good, please add one test for this branch.' },
|
|
165
|
-
})
|
|
166
|
-
|
|
167
|
-
// Manage PR lifecycle
|
|
168
|
-
await api.repo.pr.close('42')
|
|
169
|
-
await api.repo.pr.reopen('42')
|
|
170
|
-
await api.repo.pr.merge('42')
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
### 3) Release flow
|
|
174
|
-
|
|
175
|
-
```ts
|
|
176
|
-
await api.repo.release.create({
|
|
177
|
-
data: {
|
|
178
|
-
tag_name: 'v1.2.0',
|
|
179
|
-
name: 'v1.2.0',
|
|
180
|
-
body: 'Changelog and upgrade notes.',
|
|
181
|
-
},
|
|
182
|
-
})
|
|
183
|
-
|
|
184
|
-
await api.repo.release.list()
|
|
185
|
-
await api.repo.release.view('v1.2.0')
|
|
186
|
-
await api.repo.release.delete('v1.2.0')
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
### 4) Repository setup and sync
|
|
190
|
-
|
|
191
|
-
```ts
|
|
192
|
-
// Read current repo
|
|
193
|
-
await api.repo.view()
|
|
194
|
-
|
|
195
|
-
// Create repository for authenticated user
|
|
196
|
-
await api.repo.create({ data: { name: 'new-repo', description: 'Automation workspace' } })
|
|
197
|
-
|
|
198
|
-
// Fork and sync mirror repo
|
|
199
|
-
await api.repo.fork()
|
|
200
|
-
await api.repo.sync()
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
### 5) Team triage with labels
|
|
204
|
-
|
|
205
|
-
```ts
|
|
206
|
-
await api.repo.label.listManaged()
|
|
207
|
-
|
|
208
|
-
await api.repo.label.upsert('priority-high', {
|
|
209
|
-
color: '#d73a4a',
|
|
210
|
-
description: 'Initial escalation label',
|
|
211
|
-
})
|
|
212
|
-
|
|
213
|
-
await api.repo.label.getByName('priority-high')
|
|
214
|
-
|
|
215
|
-
await api.repo.label.upsert('priority-high', {
|
|
216
|
-
color: '#fbca04',
|
|
217
|
-
description: 'Escalated issue',
|
|
218
|
-
})
|
|
219
|
-
|
|
220
|
-
await api.repo.label.deleteByName('priority-high')
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
### 6) Search and discovery
|
|
224
|
-
|
|
225
|
-
```ts
|
|
226
|
-
await api.search.issues({
|
|
227
|
-
query: {
|
|
228
|
-
q: 'repo:example-org/example-repo is:open',
|
|
229
|
-
sort: 'created',
|
|
230
|
-
},
|
|
231
|
-
})
|
|
232
|
-
|
|
233
|
-
await api.search.prs({
|
|
234
|
-
query: {
|
|
235
|
-
q: 'repo:example-org/example-repo is:pr is:open',
|
|
236
|
-
sort: 'updated',
|
|
237
|
-
},
|
|
238
|
-
})
|
|
239
|
-
|
|
240
|
-
await api.search.repos({
|
|
241
|
-
query: {
|
|
242
|
-
q: 'name:example-repo',
|
|
243
|
-
limit: 10,
|
|
244
|
-
},
|
|
245
|
-
})
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
### 7) CI workflow dispatch
|
|
249
|
-
|
|
250
|
-
```ts
|
|
251
|
-
await api.workflow.list()
|
|
252
|
-
await api.workflow.view('ci.yml')
|
|
253
|
-
await api.workflow.run('ci.yml', {
|
|
254
|
-
data: {
|
|
255
|
-
ref: 'main',
|
|
256
|
-
},
|
|
257
|
-
})
|
|
258
|
-
await api.workflow.disable('ci.yml')
|
|
259
|
-
await api.workflow.enable('ci.yml')
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
### 8) Security material for automation
|
|
263
|
-
|
|
264
|
-
```ts
|
|
265
|
-
await api.secret.list()
|
|
266
|
-
await api.variable.list()
|
|
267
|
-
await api.variable.set('CANARY', {
|
|
268
|
-
data: {
|
|
269
|
-
value: 'true',
|
|
270
|
-
},
|
|
271
|
-
})
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
## Targeting a specific repository
|
|
275
|
-
|
|
276
|
-
Defaults can be replaced per call by passing owner/repo arguments.
|
|
277
|
-
|
|
278
|
-
```ts
|
|
279
|
-
await api.repo.issue.create('acme', 'infra', {
|
|
280
|
-
data: {
|
|
281
|
-
title: 'Issue in another repo',
|
|
282
|
-
body: 'Cross-repo task',
|
|
283
|
-
},
|
|
284
|
-
})
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
## Notes
|
|
288
|
-
|
|
289
|
-
1) Some endpoints expose top-level methods too (for example `api.issue.create(...)`), but `repo.*` is the canonical usage style for this package.
|
|
290
|
-
2) This package currently ships with Gitea mapping, with `PLATFORM`/`GITEA_*` configuration ready for multi-platform expansion.
|
|
291
|
-
3) Use the generated feature matrix/spec to discover every mapped command before adding new workflows.
|
|
1
|
+
# git
|
|
2
|
+
|
|
3
|
+
`@foundation0/git` exposes a generated Git API object where methods follow the shape `repo.issue.create(...)`, `repo.pr.merge(...)`, etc.
|
|
4
|
+
|
|
5
|
+
The API client maps GH-style feature paths to Gitea REST endpoints and executes real HTTP requests through `fetch`.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
Install globally:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pnpm add -g @foundation0/git
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Run MCP server through npm without a global install:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx -y -p @foundation0/git f0-git-mcp --help
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Using pnpm:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pnpm dlx @foundation0/git f0-git-mcp --help
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Installation in this monorepo
|
|
28
|
+
|
|
29
|
+
From repo root:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pnpm install
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Run tests:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pnpm -C packages/git test
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Quick start
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import { createGitServiceApi } from '@foundation0/git'
|
|
45
|
+
|
|
46
|
+
const api = createGitServiceApi({
|
|
47
|
+
config: {
|
|
48
|
+
platform: 'GITEA',
|
|
49
|
+
giteaHost: 'https://gitea.example.com',
|
|
50
|
+
giteaToken: process.env.GITEA_TOKEN,
|
|
51
|
+
},
|
|
52
|
+
defaultOwner: 'example-org',
|
|
53
|
+
defaultRepo: 'example-repo',
|
|
54
|
+
})
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
You can also import the singleton:
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
import { gitServiceApi } from '@foundation0/git'
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
All methods return:
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
type GitServiceApiExecutionResult = {
|
|
67
|
+
mapping: GitApiFeatureMapping
|
|
68
|
+
request: {
|
|
69
|
+
url: string
|
|
70
|
+
method: string
|
|
71
|
+
headers: Record<string, string>
|
|
72
|
+
query: string[]
|
|
73
|
+
body?: unknown
|
|
74
|
+
}
|
|
75
|
+
status: number
|
|
76
|
+
ok: boolean
|
|
77
|
+
body: unknown
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Core request shapes
|
|
82
|
+
|
|
83
|
+
Write methods accept request fields directly (recommended), or you can set the raw request body with `data` / `json` / `payload` / `requestBody`.
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
await api.repo.issue.create({
|
|
87
|
+
title: 'Bug report',
|
|
88
|
+
body: 'Describe issue details',
|
|
89
|
+
labels: ['bug'],
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
// equivalent explicit-body form
|
|
93
|
+
await api.repo.issue.create({
|
|
94
|
+
data: { title: 'Bug report', body: 'Describe issue details', labels: ['bug'] },
|
|
95
|
+
})
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Use `headers` to pass custom headers and `query` for additional URL params.
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
await api.repo.issue.list({
|
|
102
|
+
headers: { 'X-Request-Id': 'local' },
|
|
103
|
+
query: { state: 'open', limit: 20, page: 1 },
|
|
104
|
+
})
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Popular workflow examples
|
|
108
|
+
|
|
109
|
+
### 1) Issue lifecycle (most used)
|
|
110
|
+
|
|
111
|
+
```ts
|
|
112
|
+
// List issues in the default repo
|
|
113
|
+
await api.repo.issue.list()
|
|
114
|
+
|
|
115
|
+
// Create a new issue
|
|
116
|
+
await api.repo.issue.create({
|
|
117
|
+
data: {
|
|
118
|
+
title: 'Login fails with 401',
|
|
119
|
+
body: 'Repro: open login page and click submit.',
|
|
120
|
+
labels: ['bug'],
|
|
121
|
+
},
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
// View an issue
|
|
125
|
+
await api.repo.issue.view('17')
|
|
126
|
+
|
|
127
|
+
// Comment on an issue
|
|
128
|
+
await api.repo.issue.comment('17', {
|
|
129
|
+
data: { body: 'We are investigating this now.' },
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
// Edit title/body
|
|
133
|
+
await api.repo.issue.edit('17', {
|
|
134
|
+
data: {
|
|
135
|
+
title: 'Login fails with 401 (investigating)',
|
|
136
|
+
body: 'Updated with steps to reproduce.',
|
|
137
|
+
},
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
// Close and reopen
|
|
141
|
+
await api.repo.issue.close('17', { reason: 'not_planned' })
|
|
142
|
+
await api.repo.issue.reopen('17')
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### 2) Pull request workflow
|
|
146
|
+
|
|
147
|
+
```ts
|
|
148
|
+
// Open a pull request
|
|
149
|
+
await api.repo.pr.create({
|
|
150
|
+
data: {
|
|
151
|
+
title: 'chore: improve error handling',
|
|
152
|
+
body: 'Adds retries and better messaging.',
|
|
153
|
+
head: 'feature/error-handling',
|
|
154
|
+
base: 'main',
|
|
155
|
+
},
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
// List and inspect PRs
|
|
159
|
+
await api.repo.pr.list({ query: { state: 'open' } })
|
|
160
|
+
await api.repo.pr.view('42')
|
|
161
|
+
|
|
162
|
+
// Add a review comment
|
|
163
|
+
await api.repo.pr.comment('42', {
|
|
164
|
+
data: { body: 'Looks good, please add one test for this branch.' },
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
// Manage PR lifecycle
|
|
168
|
+
await api.repo.pr.close('42')
|
|
169
|
+
await api.repo.pr.reopen('42')
|
|
170
|
+
await api.repo.pr.merge('42')
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### 3) Release flow
|
|
174
|
+
|
|
175
|
+
```ts
|
|
176
|
+
await api.repo.release.create({
|
|
177
|
+
data: {
|
|
178
|
+
tag_name: 'v1.2.0',
|
|
179
|
+
name: 'v1.2.0',
|
|
180
|
+
body: 'Changelog and upgrade notes.',
|
|
181
|
+
},
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
await api.repo.release.list()
|
|
185
|
+
await api.repo.release.view('v1.2.0')
|
|
186
|
+
await api.repo.release.delete('v1.2.0')
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### 4) Repository setup and sync
|
|
190
|
+
|
|
191
|
+
```ts
|
|
192
|
+
// Read current repo
|
|
193
|
+
await api.repo.view()
|
|
194
|
+
|
|
195
|
+
// Create repository for authenticated user
|
|
196
|
+
await api.repo.create({ data: { name: 'new-repo', description: 'Automation workspace' } })
|
|
197
|
+
|
|
198
|
+
// Fork and sync mirror repo
|
|
199
|
+
await api.repo.fork()
|
|
200
|
+
await api.repo.sync()
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### 5) Team triage with labels
|
|
204
|
+
|
|
205
|
+
```ts
|
|
206
|
+
await api.repo.label.listManaged()
|
|
207
|
+
|
|
208
|
+
await api.repo.label.upsert('priority-high', {
|
|
209
|
+
color: '#d73a4a',
|
|
210
|
+
description: 'Initial escalation label',
|
|
211
|
+
})
|
|
212
|
+
|
|
213
|
+
await api.repo.label.getByName('priority-high')
|
|
214
|
+
|
|
215
|
+
await api.repo.label.upsert('priority-high', {
|
|
216
|
+
color: '#fbca04',
|
|
217
|
+
description: 'Escalated issue',
|
|
218
|
+
})
|
|
219
|
+
|
|
220
|
+
await api.repo.label.deleteByName('priority-high')
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### 6) Search and discovery
|
|
224
|
+
|
|
225
|
+
```ts
|
|
226
|
+
await api.search.issues({
|
|
227
|
+
query: {
|
|
228
|
+
q: 'repo:example-org/example-repo is:open',
|
|
229
|
+
sort: 'created',
|
|
230
|
+
},
|
|
231
|
+
})
|
|
232
|
+
|
|
233
|
+
await api.search.prs({
|
|
234
|
+
query: {
|
|
235
|
+
q: 'repo:example-org/example-repo is:pr is:open',
|
|
236
|
+
sort: 'updated',
|
|
237
|
+
},
|
|
238
|
+
})
|
|
239
|
+
|
|
240
|
+
await api.search.repos({
|
|
241
|
+
query: {
|
|
242
|
+
q: 'name:example-repo',
|
|
243
|
+
limit: 10,
|
|
244
|
+
},
|
|
245
|
+
})
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### 7) CI workflow dispatch
|
|
249
|
+
|
|
250
|
+
```ts
|
|
251
|
+
await api.workflow.list()
|
|
252
|
+
await api.workflow.view('ci.yml')
|
|
253
|
+
await api.workflow.run('ci.yml', {
|
|
254
|
+
data: {
|
|
255
|
+
ref: 'main',
|
|
256
|
+
},
|
|
257
|
+
})
|
|
258
|
+
await api.workflow.disable('ci.yml')
|
|
259
|
+
await api.workflow.enable('ci.yml')
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### 8) Security material for automation
|
|
263
|
+
|
|
264
|
+
```ts
|
|
265
|
+
await api.secret.list()
|
|
266
|
+
await api.variable.list()
|
|
267
|
+
await api.variable.set('CANARY', {
|
|
268
|
+
data: {
|
|
269
|
+
value: 'true',
|
|
270
|
+
},
|
|
271
|
+
})
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
## Targeting a specific repository
|
|
275
|
+
|
|
276
|
+
Defaults can be replaced per call by passing owner/repo arguments.
|
|
277
|
+
|
|
278
|
+
```ts
|
|
279
|
+
await api.repo.issue.create('acme', 'infra', {
|
|
280
|
+
data: {
|
|
281
|
+
title: 'Issue in another repo',
|
|
282
|
+
body: 'Cross-repo task',
|
|
283
|
+
},
|
|
284
|
+
})
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## Notes
|
|
288
|
+
|
|
289
|
+
1) Some endpoints expose top-level methods too (for example `api.issue.create(...)`), but `repo.*` is the canonical usage style for this package.
|
|
290
|
+
2) This package currently ships with Gitea mapping, with `PLATFORM`/`GITEA_*` configuration ready for multi-platform expansion.
|
|
291
|
+
3) Use the generated feature matrix/spec to discover every mapped command before adding new workflows.
|