elizaos-plugin-github 2.0.0a4__py3-none-any.whl

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.
@@ -0,0 +1,413 @@
1
+ from enum import Enum
2
+ from typing import Literal
3
+
4
+ from pydantic import BaseModel, ConfigDict
5
+
6
+
7
+ class RepositoryRef(BaseModel):
8
+ model_config = ConfigDict(frozen=True)
9
+
10
+ owner: str
11
+ repo: str
12
+
13
+
14
+ class FileChange(BaseModel):
15
+ model_config = ConfigDict(frozen=True)
16
+
17
+ path: str
18
+ content: str
19
+ encoding: Literal["utf-8", "base64"] = "utf-8"
20
+ operation: Literal["add", "modify", "delete"] = "modify"
21
+
22
+
23
+ class IssueState(str, Enum):
24
+ OPEN = "open"
25
+ CLOSED = "closed"
26
+
27
+
28
+ class IssueStateReason(str, Enum):
29
+ COMPLETED = "completed"
30
+ NOT_PLANNED = "not_planned"
31
+ REOPENED = "reopened"
32
+
33
+
34
+ class GitHubLabel(BaseModel):
35
+ model_config = ConfigDict(frozen=True)
36
+
37
+ id: int
38
+ name: str
39
+ color: str
40
+ description: str | None = None
41
+ default: bool = False
42
+
43
+
44
+ class GitHubMilestone(BaseModel):
45
+ model_config = ConfigDict(frozen=True)
46
+
47
+ number: int
48
+ title: str
49
+ description: str | None = None
50
+ state: Literal["open", "closed"]
51
+ due_on: str | None = None
52
+ created_at: str
53
+ updated_at: str
54
+ closed_at: str | None = None
55
+ open_issues: int = 0
56
+ closed_issues: int = 0
57
+
58
+
59
+ class GitHubUser(BaseModel):
60
+ model_config = ConfigDict(frozen=True)
61
+
62
+ id: int
63
+ login: str
64
+ name: str | None = None
65
+ avatar_url: str
66
+ html_url: str
67
+ type: Literal["User", "Organization", "Bot"]
68
+
69
+
70
+ class GitHubIssue(BaseModel):
71
+ model_config = ConfigDict(frozen=True)
72
+
73
+ number: int
74
+ title: str
75
+ body: str | None = None
76
+ state: IssueState
77
+ state_reason: IssueStateReason | None = None
78
+ user: GitHubUser
79
+ assignees: list[GitHubUser] = []
80
+ labels: list[GitHubLabel] = []
81
+ milestone: GitHubMilestone | None = None
82
+ created_at: str
83
+ updated_at: str
84
+ closed_at: str | None = None
85
+ html_url: str
86
+ comments: int = 0
87
+ is_pull_request: bool = False
88
+
89
+
90
+ class CreateIssueParams(RepositoryRef):
91
+ model_config = ConfigDict(frozen=True)
92
+
93
+ title: str
94
+ body: str | None = None
95
+ assignees: list[str] = []
96
+ labels: list[str] = []
97
+ milestone: int | None = None
98
+
99
+
100
+ class UpdateIssueParams(RepositoryRef):
101
+ model_config = ConfigDict(frozen=False)
102
+
103
+ issue_number: int
104
+ title: str | None = None
105
+ body: str | None = None
106
+ state: IssueState | None = None
107
+ state_reason: IssueStateReason | None = None
108
+ assignees: list[str] | None = None
109
+ labels: list[str] | None = None
110
+ milestone: int | None = None
111
+
112
+
113
+ class ListIssuesParams(RepositoryRef):
114
+ model_config = ConfigDict(frozen=True)
115
+
116
+ state: Literal["open", "closed", "all"] = "open"
117
+ labels: str | None = None
118
+ sort: Literal["created", "updated", "comments"] = "created"
119
+ direction: Literal["asc", "desc"] = "desc"
120
+ assignee: str | None = None
121
+ creator: str | None = None
122
+ mentioned: str | None = None
123
+ per_page: int = 30
124
+ page: int = 1
125
+
126
+
127
+ class PullRequestState(str, Enum):
128
+ OPEN = "open"
129
+ CLOSED = "closed"
130
+
131
+
132
+ class MergeableState(str, Enum):
133
+ MERGEABLE = "mergeable"
134
+ CONFLICTING = "conflicting"
135
+ UNKNOWN = "unknown"
136
+
137
+
138
+ class GitHubBranchRef(BaseModel):
139
+ model_config = ConfigDict(frozen=True)
140
+
141
+ ref: str
142
+ label: str
143
+ sha: str
144
+ repo: RepositoryRef | None = None
145
+
146
+
147
+ class GitHubPullRequest(BaseModel):
148
+ model_config = ConfigDict(frozen=True)
149
+
150
+ number: int
151
+ title: str
152
+ body: str | None = None
153
+ state: PullRequestState
154
+ draft: bool = False
155
+ merged: bool = False
156
+ mergeable: bool | None = None
157
+ mergeable_state: MergeableState = MergeableState.UNKNOWN
158
+ user: GitHubUser
159
+ head: GitHubBranchRef
160
+ base: GitHubBranchRef
161
+ assignees: list[GitHubUser] = []
162
+ requested_reviewers: list[GitHubUser] = []
163
+ labels: list[GitHubLabel] = []
164
+ milestone: GitHubMilestone | None = None
165
+ created_at: str
166
+ updated_at: str
167
+ closed_at: str | None = None
168
+ merged_at: str | None = None
169
+ html_url: str
170
+ commits: int = 0
171
+ additions: int = 0
172
+ deletions: int = 0
173
+ changed_files: int = 0
174
+
175
+
176
+ class CreatePullRequestParams(RepositoryRef):
177
+ model_config = ConfigDict(frozen=True)
178
+
179
+ title: str
180
+ body: str | None = None
181
+ head: str
182
+ base: str
183
+ draft: bool = False
184
+ maintainer_can_modify: bool = True
185
+
186
+
187
+ class UpdatePullRequestParams(RepositoryRef):
188
+ model_config = ConfigDict(frozen=False)
189
+
190
+ pull_number: int
191
+ title: str | None = None
192
+ body: str | None = None
193
+ state: PullRequestState | None = None
194
+ base: str | None = None
195
+ maintainer_can_modify: bool | None = None
196
+
197
+
198
+ class ListPullRequestsParams(RepositoryRef):
199
+ model_config = ConfigDict(frozen=True)
200
+
201
+ state: Literal["open", "closed", "all"] = "open"
202
+ head: str | None = None
203
+ base: str | None = None
204
+ sort: Literal["created", "updated", "popularity", "long-running"] = "created"
205
+ direction: Literal["asc", "desc"] = "desc"
206
+ per_page: int = 30
207
+ page: int = 1
208
+
209
+
210
+ class MergePullRequestParams(RepositoryRef):
211
+ model_config = ConfigDict(frozen=True)
212
+
213
+ pull_number: int
214
+ commit_title: str | None = None
215
+ commit_message: str | None = None
216
+ merge_method: Literal["merge", "squash", "rebase"] = "merge"
217
+ sha: str | None = None
218
+
219
+
220
+ class ReviewState(str, Enum):
221
+ APPROVED = "APPROVED"
222
+ CHANGES_REQUESTED = "CHANGES_REQUESTED"
223
+ COMMENTED = "COMMENTED"
224
+ DISMISSED = "DISMISSED"
225
+ PENDING = "PENDING"
226
+
227
+
228
+ class ReviewEvent(str, Enum):
229
+ APPROVE = "APPROVE"
230
+ REQUEST_CHANGES = "REQUEST_CHANGES"
231
+ COMMENT = "COMMENT"
232
+
233
+
234
+ class ReviewCommentInput(BaseModel):
235
+ model_config = ConfigDict(frozen=True)
236
+
237
+ path: str
238
+ line: int
239
+ body: str
240
+ side: Literal["LEFT", "RIGHT"] = "RIGHT"
241
+ start_line: int | None = None
242
+ start_side: Literal["LEFT", "RIGHT"] | None = None
243
+
244
+
245
+ class GitHubReview(BaseModel):
246
+ model_config = ConfigDict(frozen=True)
247
+
248
+ id: int
249
+ user: GitHubUser
250
+ body: str | None = None
251
+ state: ReviewState
252
+ commit_id: str
253
+ html_url: str
254
+ submitted_at: str | None = None
255
+
256
+
257
+ class CreateReviewParams(RepositoryRef):
258
+ model_config = ConfigDict(frozen=True)
259
+
260
+ pull_number: int
261
+ body: str | None = None
262
+ event: ReviewEvent
263
+ commit_id: str | None = None
264
+ comments: list[ReviewCommentInput] = []
265
+
266
+
267
+ class GitHubComment(BaseModel):
268
+ model_config = ConfigDict(frozen=True)
269
+
270
+ id: int
271
+ body: str
272
+ user: GitHubUser
273
+ created_at: str
274
+ updated_at: str
275
+ html_url: str
276
+
277
+
278
+ class CreateCommentParams(RepositoryRef):
279
+ model_config = ConfigDict(frozen=True)
280
+
281
+ issue_number: int
282
+ body: str
283
+
284
+
285
+ class GitHubBranch(BaseModel):
286
+ model_config = ConfigDict(frozen=True)
287
+
288
+ name: str
289
+ sha: str
290
+ protected: bool = False
291
+
292
+
293
+ class CreateBranchParams(RepositoryRef):
294
+ model_config = ConfigDict(frozen=True)
295
+
296
+ branch_name: str
297
+ from_ref: str
298
+
299
+
300
+ class GitHubCommitAuthor(BaseModel):
301
+ model_config = ConfigDict(frozen=True)
302
+
303
+ name: str
304
+ email: str
305
+ date: str
306
+
307
+
308
+ class GitHubCommit(BaseModel):
309
+ model_config = ConfigDict(frozen=True)
310
+
311
+ sha: str
312
+ message: str
313
+ author: GitHubCommitAuthor
314
+ committer: GitHubCommitAuthor
315
+ timestamp: str
316
+ html_url: str
317
+ parents: list[str] = []
318
+
319
+
320
+ class CreateCommitParams(RepositoryRef):
321
+ model_config = ConfigDict(frozen=True)
322
+
323
+ message: str
324
+ files: list[FileChange]
325
+ branch: str
326
+ parent_sha: str | None = None
327
+ author_name: str | None = None
328
+ author_email: str | None = None
329
+
330
+
331
+ class GitHubFileContent(BaseModel):
332
+ model_config = ConfigDict(frozen=True)
333
+
334
+ name: str
335
+ path: str
336
+ content: str
337
+ sha: str
338
+ size: int
339
+ type: Literal["file", "dir", "symlink", "submodule"]
340
+ encoding: str
341
+ html_url: str
342
+ download_url: str | None = None
343
+
344
+
345
+ class GitHubDirectoryEntry(BaseModel):
346
+ model_config = ConfigDict(frozen=True)
347
+
348
+ name: str
349
+ path: str
350
+ sha: str
351
+ size: int
352
+ type: Literal["file", "dir", "symlink", "submodule"]
353
+ html_url: str
354
+ download_url: str | None = None
355
+
356
+
357
+ class GitHubLicense(BaseModel):
358
+ model_config = ConfigDict(frozen=True)
359
+
360
+ key: str
361
+ name: str
362
+ spdx_id: str | None = None
363
+ url: str | None = None
364
+
365
+
366
+ class GitHubRepository(BaseModel):
367
+ model_config = ConfigDict(frozen=True)
368
+
369
+ id: int
370
+ name: str
371
+ full_name: str
372
+ owner: GitHubUser
373
+ description: str | None = None
374
+ private: bool = False
375
+ fork: bool = False
376
+ default_branch: str
377
+ language: str | None = None
378
+ stargazers_count: int = 0
379
+ forks_count: int = 0
380
+ open_issues_count: int = 0
381
+ watchers_count: int = 0
382
+ html_url: str
383
+ clone_url: str
384
+ ssh_url: str
385
+ created_at: str
386
+ updated_at: str
387
+ pushed_at: str
388
+ topics: list[str] = []
389
+ license: GitHubLicense | None = None
390
+
391
+
392
+ # =============================================================================
393
+ # Event Types
394
+ # =============================================================================
395
+
396
+
397
+ class GitHubEventType(str, Enum):
398
+ PUSH = "push"
399
+ PULL_REQUEST = "pull_request"
400
+ PULL_REQUEST_REVIEW = "pull_request_review"
401
+ PULL_REQUEST_REVIEW_COMMENT = "pull_request_review_comment"
402
+ ISSUES = "issues"
403
+ ISSUE_COMMENT = "issue_comment"
404
+ CREATE = "create"
405
+ DELETE = "delete"
406
+ FORK = "fork"
407
+ STAR = "star"
408
+ WATCH = "watch"
409
+ RELEASE = "release"
410
+ WORKFLOW_RUN = "workflow_run"
411
+ CHECK_RUN = "check_run"
412
+ CHECK_SUITE = "check_suite"
413
+ STATUS = "status"
@@ -0,0 +1,178 @@
1
+ Metadata-Version: 2.4
2
+ Name: elizaos-plugin-github
3
+ Version: 2.0.0a4
4
+ Summary: GitHub plugin for elizaOS - Python implementation
5
+ Project-URL: Homepage, https://github.com/elizaos/eliza
6
+ Project-URL: Documentation, https://elizaos.ai/docs
7
+ Project-URL: Repository, https://github.com/elizaos/eliza
8
+ Project-URL: Issues, https://github.com/elizaos/eliza/issues
9
+ Author: elizaOS Contributors
10
+ License-Expression: MIT
11
+ Keywords: agent,ai,elizaos,git,github
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Classifier: Topic :: Software Development :: Version Control :: Git
19
+ Classifier: Typing :: Typed
20
+ Requires-Python: >=3.11
21
+ Requires-Dist: aiohttp>=3.9.0
22
+ Requires-Dist: gitpython>=3.1.0
23
+ Requires-Dist: pydantic>=2.0.0
24
+ Requires-Dist: pygithub>=2.3.0
25
+ Requires-Dist: python-dotenv>=1.0.0
26
+ Provides-Extra: dev
27
+ Requires-Dist: mypy>=1.8.0; extra == 'dev'
28
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
29
+ Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
30
+ Requires-Dist: pytest-xprocess>=1.0.0; extra == 'dev'
31
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
32
+ Requires-Dist: ruff>=0.3.0; extra == 'dev'
33
+ Description-Content-Type: text/markdown
34
+
35
+ # elizaos-plugin-github (Python)
36
+
37
+ Python implementation of the GitHub plugin for elizaOS.
38
+
39
+ ## Installation
40
+
41
+ ```bash
42
+ pip install elizaos-plugin-github
43
+ ```
44
+
45
+ ## Usage
46
+
47
+ ```python
48
+ from elizaos_plugin_github import GitHubConfig, GitHubService
49
+
50
+ # Create configuration
51
+ config = GitHubConfig(
52
+ api_token="ghp_your_token_here",
53
+ owner="my-org",
54
+ repo="my-repo",
55
+ )
56
+
57
+ # Create service
58
+ service = GitHubService(config)
59
+
60
+ # Start service
61
+ await service.start()
62
+
63
+ # Create an issue
64
+ from elizaos_plugin_github.types import CreateIssueParams
65
+
66
+ issue = await service.create_issue(
67
+ CreateIssueParams(
68
+ owner="my-org",
69
+ repo="my-repo",
70
+ title="Bug: Something is broken",
71
+ body="Description of the bug...",
72
+ labels=["bug"],
73
+ )
74
+ )
75
+ print(f"Created issue #{issue.number}")
76
+
77
+ # Create a pull request
78
+ from elizaos_plugin_github.types import CreatePullRequestParams
79
+
80
+ pr = await service.create_pull_request(
81
+ CreatePullRequestParams(
82
+ owner="my-org",
83
+ repo="my-repo",
84
+ title="Fix the bug",
85
+ head="fix/bug-123",
86
+ base="main",
87
+ )
88
+ )
89
+ print(f"Created PR #{pr.number}")
90
+
91
+ # Stop service
92
+ await service.stop()
93
+ ```
94
+
95
+ ## Configuration
96
+
97
+ The plugin can be configured via environment variables:
98
+
99
+ - `GITHUB_API_TOKEN` (required): GitHub personal access token
100
+ - `GITHUB_OWNER`: Default repository owner
101
+ - `GITHUB_REPO`: Default repository name
102
+ - `GITHUB_BRANCH`: Default branch (defaults to "main")
103
+ - `GITHUB_WEBHOOK_SECRET`: Secret for webhook verification
104
+ - `GITHUB_APP_ID`: GitHub App ID for app authentication
105
+ - `GITHUB_APP_PRIVATE_KEY`: GitHub App private key
106
+ - `GITHUB_INSTALLATION_ID`: GitHub App installation ID
107
+
108
+ ## Features
109
+
110
+ ### Repository Operations
111
+
112
+ - Get repository information
113
+ - List repositories
114
+
115
+ ### Issue Operations
116
+
117
+ - Create issues
118
+ - Get issue details
119
+ - Update issues
120
+ - List issues
121
+ - Close/reopen issues
122
+
123
+ ### Pull Request Operations
124
+
125
+ - Create pull requests
126
+ - Get PR details
127
+ - Update pull requests
128
+ - List pull requests
129
+ - Merge pull requests
130
+
131
+ ### Review Operations
132
+
133
+ - Create reviews (approve, request changes, comment)
134
+ - List reviews
135
+
136
+ ### Comment Operations
137
+
138
+ - Create comments on issues/PRs
139
+ - List comments
140
+
141
+ ### Branch Operations
142
+
143
+ - Create branches
144
+ - Delete branches
145
+ - List branches
146
+
147
+ ### File Operations
148
+
149
+ - Get file content
150
+ - List directory contents
151
+
152
+ ### Commit Operations
153
+
154
+ - Create commits with file changes
155
+
156
+ ## Development
157
+
158
+ ```bash
159
+ # Install dev dependencies
160
+ pip install -e ".[dev]"
161
+
162
+ # Run tests
163
+ pytest
164
+
165
+ # Type checking
166
+ mypy elizaos_plugin_github
167
+
168
+ # Linting
169
+ ruff check .
170
+ ruff format .
171
+ ```
172
+
173
+ ## License
174
+
175
+ MIT
176
+
177
+
178
+
@@ -0,0 +1,22 @@
1
+ elizaos_plugin_github/__init__.py,sha256=DmD60Yz6hFj05y8niJlGV27OSVl7_675irCqF_dw3yg,2603
2
+ elizaos_plugin_github/config.py,sha256=gsgZWSCLZ-f0GOLRMDZw7oEX6JHEWg5w6jxlO5Upt7U,2184
3
+ elizaos_plugin_github/error.py,sha256=CMtJCSQN52bb4W5ZTXu4WqopFv_-p9mpAgL-VPoixnM,5162
4
+ elizaos_plugin_github/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ elizaos_plugin_github/service.py,sha256=6INsGzW2GdE3DK0NCfurpMeDF5u6u8EKTNyddsl4UFw,26900
6
+ elizaos_plugin_github/types.py,sha256=qScPwJQ_HfbAGxB51jYMMmGWaTyj92MMap_2hvziYJg,9280
7
+ elizaos_plugin_github/actions/__init__.py,sha256=slBIGzYq1Sz67qSRW-RLxvwh2jLVnYPk8TIi_bJ6Zcw,966
8
+ elizaos_plugin_github/actions/create_branch.py,sha256=TGMxTd6h1_qTdLa7SrPq-LBqdYV6Tm47UBBpHnLaMX0,1988
9
+ elizaos_plugin_github/actions/create_comment.py,sha256=ehK3lhO93RLsPTpaIMSDrQuHkIjwV5C8BMhRsY4sR4E,2085
10
+ elizaos_plugin_github/actions/create_issue.py,sha256=MhZkBlXklTR9WxolJk-jgDGGPk-b-X_kMuRcA7ExcU0,2712
11
+ elizaos_plugin_github/actions/create_pull_request.py,sha256=zkfEROgooBklPuHFuDG3xxn7UtfRMK1g1YLzD_60DN0,2389
12
+ elizaos_plugin_github/actions/merge_pull_request.py,sha256=4xMN-WFNz9UpzDegupeLGt8lSjfMuwIJTxaL5qrw7jM,2645
13
+ elizaos_plugin_github/actions/push_code.py,sha256=mJN3pPKUc1UnK2lzUR09irFnsMFGYyKWSxaSR8O76T4,2700
14
+ elizaos_plugin_github/actions/review_pull_request.py,sha256=YAyC7VJwjc_BXyYnkJBealZvj21P-zUOt46fBTn8fpo,2845
15
+ elizaos_plugin_github/generated/specs/__init__.py,sha256=WbH0CDLPo2YBQZdpOeml1DoGR-TmWsdL1WjKq9pHOC4,37
16
+ elizaos_plugin_github/generated/specs/specs.py,sha256=5kJvpVdvX8JeFTPRTlP2TyJwlcVNUAhwVyZctdIreSo,3918
17
+ elizaos_plugin_github/providers/__init__.py,sha256=1XnEBJa5A5ESIRrGmhH4G9f1v29VaxEFqMu92GhiKYQ,318
18
+ elizaos_plugin_github/providers/issue_context.py,sha256=tfLjG3SOSuESiqjI-Iz18ubaztCl35YYVgo30APZQQ4,4673
19
+ elizaos_plugin_github/providers/repository_state.py,sha256=tTSk25PPUwbouS0KC84jZnH2mZypVTE0pqFhze1Yzek,2963
20
+ elizaos_plugin_github-2.0.0a4.dist-info/METADATA,sha256=EllSuSukLGEnG3IHv_WZEEB-v62eiKK_RyZANuWLHts,3946
21
+ elizaos_plugin_github-2.0.0a4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
22
+ elizaos_plugin_github-2.0.0a4.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.28.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any