@almadar/integrations 2.0.1 → 2.0.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/dist/{factory-rMujCO3M.d.ts → BaseIntegration-DNSuiUnG.d.ts} +1 -33
- package/dist/factory-B1QtCI_c.d.ts +37 -0
- package/dist/index.d.ts +5 -59
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/dist/integrations/github/index.d.ts +326 -0
- package/dist/integrations/github/index.js +756 -0
- package/dist/integrations/github/index.js.map +1 -0
- package/dist/mocks/index.d.ts +2 -1
- package/dist/mocks/index.js.map +1 -1
- package/dist/runtime/index.d.ts +2 -1
- package/dist/runtime/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
import { B as BaseIntegration, b as IntegrationConfig, c as IntegrationResult } from '../../BaseIntegration-DNSuiUnG.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* GitHub integration types
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* GitHub clone repository parameters
|
|
8
|
+
*/
|
|
9
|
+
interface GitHubCloneParams {
|
|
10
|
+
/** Repository URL (e.g., https://github.com/owner/repo) */
|
|
11
|
+
repoUrl: string;
|
|
12
|
+
/** Target directory for clone */
|
|
13
|
+
targetDir: string;
|
|
14
|
+
/** Optional branch to checkout */
|
|
15
|
+
branch?: string;
|
|
16
|
+
/** Clone depth (default: 1 for shallow clone) */
|
|
17
|
+
depth?: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* GitHub create branch parameters
|
|
21
|
+
*/
|
|
22
|
+
interface GitHubCreateBranchParams {
|
|
23
|
+
/** Branch name to create */
|
|
24
|
+
branchName: string;
|
|
25
|
+
/** Base branch (defaults to current branch) */
|
|
26
|
+
baseBranch?: string;
|
|
27
|
+
/** Working directory (defaults to workspace root) */
|
|
28
|
+
workDir?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* GitHub commit parameters
|
|
32
|
+
*/
|
|
33
|
+
interface GitHubCommitParams {
|
|
34
|
+
/** Commit message */
|
|
35
|
+
message: string;
|
|
36
|
+
/** Optional specific files to commit (defaults to all changes) */
|
|
37
|
+
files?: string[];
|
|
38
|
+
/** Working directory (defaults to workspace root) */
|
|
39
|
+
workDir?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* GitHub push parameters
|
|
43
|
+
*/
|
|
44
|
+
interface GitHubPushParams {
|
|
45
|
+
/** Branch name to push */
|
|
46
|
+
branchName: string;
|
|
47
|
+
/** Force push (NEVER set to true in agent context) */
|
|
48
|
+
force?: boolean;
|
|
49
|
+
/** Working directory (defaults to workspace root) */
|
|
50
|
+
workDir?: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* GitHub create pull request parameters
|
|
54
|
+
*/
|
|
55
|
+
interface GitHubCreatePRParams {
|
|
56
|
+
/** PR title */
|
|
57
|
+
title: string;
|
|
58
|
+
/** PR body/description */
|
|
59
|
+
body: string;
|
|
60
|
+
/** Base branch (e.g., 'main') */
|
|
61
|
+
baseBranch: string;
|
|
62
|
+
/** Head branch (feature branch) */
|
|
63
|
+
headBranch: string;
|
|
64
|
+
/** Draft PR (default: false) */
|
|
65
|
+
draft?: boolean;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* GitHub get PR comments parameters
|
|
69
|
+
*/
|
|
70
|
+
interface GitHubGetPRCommentsParams {
|
|
71
|
+
/** Pull request number */
|
|
72
|
+
prNumber: number;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* GitHub list issues parameters
|
|
76
|
+
*/
|
|
77
|
+
interface GitHubListIssuesParams {
|
|
78
|
+
/** Issue state filter */
|
|
79
|
+
state?: 'open' | 'closed' | 'all';
|
|
80
|
+
/** Labels to filter by */
|
|
81
|
+
labels?: string[];
|
|
82
|
+
/** Maximum number of issues to return */
|
|
83
|
+
limit?: number;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* GitHub get issue parameters
|
|
87
|
+
*/
|
|
88
|
+
interface GitHubGetIssueParams {
|
|
89
|
+
/** Issue number */
|
|
90
|
+
issueNumber: number;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* GitHub pull request response
|
|
94
|
+
*/
|
|
95
|
+
interface GitHubPullRequest {
|
|
96
|
+
/** PR number */
|
|
97
|
+
number: number;
|
|
98
|
+
/** PR URL */
|
|
99
|
+
url: string;
|
|
100
|
+
/** PR title */
|
|
101
|
+
title: string;
|
|
102
|
+
/** PR state */
|
|
103
|
+
state: string;
|
|
104
|
+
/** Head branch */
|
|
105
|
+
head: {
|
|
106
|
+
ref: string;
|
|
107
|
+
};
|
|
108
|
+
/** Base branch */
|
|
109
|
+
base: {
|
|
110
|
+
ref: string;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* GitHub issue response
|
|
115
|
+
*/
|
|
116
|
+
interface GitHubIssue {
|
|
117
|
+
/** Issue number */
|
|
118
|
+
number: number;
|
|
119
|
+
/** Issue URL */
|
|
120
|
+
url: string;
|
|
121
|
+
/** Issue title */
|
|
122
|
+
title: string;
|
|
123
|
+
/** Issue body */
|
|
124
|
+
body: string | null;
|
|
125
|
+
/** Issue state */
|
|
126
|
+
state: string;
|
|
127
|
+
/** Issue labels */
|
|
128
|
+
labels: Array<{
|
|
129
|
+
name: string;
|
|
130
|
+
color: string;
|
|
131
|
+
}>;
|
|
132
|
+
/** Created at */
|
|
133
|
+
created_at: string;
|
|
134
|
+
/** Updated at */
|
|
135
|
+
updated_at: string;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* GitHub comment response
|
|
139
|
+
*/
|
|
140
|
+
interface GitHubComment {
|
|
141
|
+
/** Comment ID */
|
|
142
|
+
id: number;
|
|
143
|
+
/** Comment body */
|
|
144
|
+
body: string;
|
|
145
|
+
/** Comment author */
|
|
146
|
+
user: {
|
|
147
|
+
login: string;
|
|
148
|
+
};
|
|
149
|
+
/** Created at */
|
|
150
|
+
created_at: string;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* GitHub rate limit info
|
|
154
|
+
*/
|
|
155
|
+
interface GitHubRateLimit {
|
|
156
|
+
/** Requests remaining */
|
|
157
|
+
remaining: number;
|
|
158
|
+
/** Total requests allowed */
|
|
159
|
+
limit: number;
|
|
160
|
+
/** Reset timestamp */
|
|
161
|
+
reset: number;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Git CLI operations for GitHub integration
|
|
166
|
+
*/
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Clone a repository
|
|
170
|
+
*/
|
|
171
|
+
declare function cloneRepo(params: GitHubCloneParams, token: string): Promise<void>;
|
|
172
|
+
/**
|
|
173
|
+
* Create a new branch
|
|
174
|
+
*/
|
|
175
|
+
declare function createBranch(params: GitHubCreateBranchParams, workDir: string): Promise<void>;
|
|
176
|
+
/**
|
|
177
|
+
* Commit changes
|
|
178
|
+
*/
|
|
179
|
+
declare function commit(params: GitHubCommitParams, workDir: string): Promise<void>;
|
|
180
|
+
/**
|
|
181
|
+
* Push branch to remote
|
|
182
|
+
*/
|
|
183
|
+
declare function push(params: GitHubPushParams, workDir: string, token: string): Promise<void>;
|
|
184
|
+
/**
|
|
185
|
+
* Get current branch name
|
|
186
|
+
*/
|
|
187
|
+
declare function getCurrentBranch(workDir: string): Promise<string>;
|
|
188
|
+
/**
|
|
189
|
+
* Check if working directory has uncommitted changes
|
|
190
|
+
*/
|
|
191
|
+
declare function hasUncommittedChanges(workDir: string): Promise<boolean>;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* GitHub REST API client
|
|
195
|
+
*/
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* GitHub API client configuration
|
|
199
|
+
*/
|
|
200
|
+
interface GitHubAPIConfig {
|
|
201
|
+
token: string;
|
|
202
|
+
owner: string;
|
|
203
|
+
repo: string;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Create a pull request
|
|
207
|
+
*/
|
|
208
|
+
declare function createPR(params: GitHubCreatePRParams, config: GitHubAPIConfig): Promise<GitHubPullRequest>;
|
|
209
|
+
/**
|
|
210
|
+
* Get pull request comments
|
|
211
|
+
*/
|
|
212
|
+
declare function getPRComments(params: GitHubGetPRCommentsParams, config: GitHubAPIConfig): Promise<GitHubComment[]>;
|
|
213
|
+
/**
|
|
214
|
+
* List repository issues
|
|
215
|
+
*/
|
|
216
|
+
declare function listIssues(params: GitHubListIssuesParams, config: GitHubAPIConfig): Promise<GitHubIssue[]>;
|
|
217
|
+
/**
|
|
218
|
+
* Get issue details
|
|
219
|
+
*/
|
|
220
|
+
declare function getIssue(params: GitHubGetIssueParams, config: GitHubAPIConfig): Promise<{
|
|
221
|
+
issue: GitHubIssue;
|
|
222
|
+
comments: GitHubComment[];
|
|
223
|
+
}>;
|
|
224
|
+
/**
|
|
225
|
+
* Get current rate limit status
|
|
226
|
+
*/
|
|
227
|
+
declare function getRateLimit(config: GitHubAPIConfig): Promise<GitHubRateLimit>;
|
|
228
|
+
/**
|
|
229
|
+
* A commit from the GitHub API with optional stats.
|
|
230
|
+
*/
|
|
231
|
+
interface GitHubCommit {
|
|
232
|
+
sha: string;
|
|
233
|
+
message: string;
|
|
234
|
+
author: {
|
|
235
|
+
name: string;
|
|
236
|
+
email: string;
|
|
237
|
+
date: string;
|
|
238
|
+
};
|
|
239
|
+
stats?: {
|
|
240
|
+
additions: number;
|
|
241
|
+
deletions: number;
|
|
242
|
+
total: number;
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* List commits for a repository, optionally filtered by file path.
|
|
247
|
+
*/
|
|
248
|
+
declare function listCommits(config: GitHubAPIConfig, options?: {
|
|
249
|
+
path?: string;
|
|
250
|
+
perPage?: number;
|
|
251
|
+
page?: number;
|
|
252
|
+
}): Promise<GitHubCommit[]>;
|
|
253
|
+
/**
|
|
254
|
+
* Get the diff for a specific commit as a unified diff string.
|
|
255
|
+
*/
|
|
256
|
+
declare function getCommitDiff(config: GitHubAPIConfig, sha: string): Promise<string>;
|
|
257
|
+
/**
|
|
258
|
+
* Get a file's content at a specific commit SHA.
|
|
259
|
+
* Returns null if the file doesn't exist at that commit.
|
|
260
|
+
*/
|
|
261
|
+
declare function getFileAtCommit(config: GitHubAPIConfig, path: string, sha: string): Promise<string | null>;
|
|
262
|
+
/**
|
|
263
|
+
* Parse repository owner and name from URL
|
|
264
|
+
*/
|
|
265
|
+
declare function parseRepoUrl(repoUrl: string): {
|
|
266
|
+
owner: string;
|
|
267
|
+
repo: string;
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* GitHub Integration for Almadar
|
|
272
|
+
* Provides git operations and GitHub API access for the agent
|
|
273
|
+
*/
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* GitHub integration class
|
|
277
|
+
*/
|
|
278
|
+
declare class GitHubIntegration extends BaseIntegration {
|
|
279
|
+
private token;
|
|
280
|
+
private owner;
|
|
281
|
+
private repo;
|
|
282
|
+
private workDir;
|
|
283
|
+
constructor(config: IntegrationConfig);
|
|
284
|
+
/**
|
|
285
|
+
* Execute a GitHub action
|
|
286
|
+
*/
|
|
287
|
+
execute(action: string, params: Record<string, unknown>): Promise<IntegrationResult>;
|
|
288
|
+
/**
|
|
289
|
+
* Clone a repository
|
|
290
|
+
*/
|
|
291
|
+
private cloneRepo;
|
|
292
|
+
/**
|
|
293
|
+
* Create a branch
|
|
294
|
+
*/
|
|
295
|
+
private createBranch;
|
|
296
|
+
/**
|
|
297
|
+
* Commit changes
|
|
298
|
+
*/
|
|
299
|
+
private commit;
|
|
300
|
+
/**
|
|
301
|
+
* Push branch
|
|
302
|
+
*/
|
|
303
|
+
private push;
|
|
304
|
+
/**
|
|
305
|
+
* Create a pull request
|
|
306
|
+
*/
|
|
307
|
+
private createPR;
|
|
308
|
+
/**
|
|
309
|
+
* Get PR comments
|
|
310
|
+
*/
|
|
311
|
+
private getPRComments;
|
|
312
|
+
/**
|
|
313
|
+
* List issues
|
|
314
|
+
*/
|
|
315
|
+
private listIssues;
|
|
316
|
+
/**
|
|
317
|
+
* Get issue details
|
|
318
|
+
*/
|
|
319
|
+
private getIssue;
|
|
320
|
+
/**
|
|
321
|
+
* Get API config for GitHub API calls
|
|
322
|
+
*/
|
|
323
|
+
private getAPIConfig;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
export { type GitHubAPIConfig, type GitHubCloneParams, type GitHubComment, type GitHubCommit, type GitHubCommitParams, type GitHubCreateBranchParams, type GitHubCreatePRParams, type GitHubGetIssueParams, type GitHubGetPRCommentsParams, GitHubIntegration, type GitHubIssue, type GitHubListIssuesParams, type GitHubPullRequest, type GitHubPushParams, type GitHubRateLimit, cloneRepo, commit, createBranch, createPR, getCommitDiff, getCurrentBranch, getFileAtCommit, getIssue, getPRComments, getRateLimit, hasUncommittedChanges, listCommits, listIssues, parseRepoUrl, push };
|