@opentabs-dev/opentabs-plugin-github 0.0.76 → 0.0.77

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.
Files changed (142) hide show
  1. package/README.md +75 -129
  2. package/dist/adapter.iife.js +1149 -663
  3. package/dist/adapter.iife.js.map +4 -4
  4. package/dist/github-api.d.ts +16 -10
  5. package/dist/github-api.d.ts.map +1 -1
  6. package/dist/github-api.js +314 -112
  7. package/dist/github-api.js.map +1 -1
  8. package/dist/tools/add-reaction.d.ts +5 -9
  9. package/dist/tools/add-reaction.d.ts.map +1 -1
  10. package/dist/tools/add-reaction.js +29 -31
  11. package/dist/tools/add-reaction.js.map +1 -1
  12. package/dist/tools/compare-commits.d.ts +2 -8
  13. package/dist/tools/compare-commits.d.ts.map +1 -1
  14. package/dist/tools/compare-commits.js +32 -34
  15. package/dist/tools/compare-commits.js.map +1 -1
  16. package/dist/tools/create-comment.d.ts +1 -8
  17. package/dist/tools/create-comment.d.ts.map +1 -1
  18. package/dist/tools/create-comment.js +21 -5
  19. package/dist/tools/create-comment.js.map +1 -1
  20. package/dist/tools/create-issue.d.ts +0 -2
  21. package/dist/tools/create-issue.d.ts.map +1 -1
  22. package/dist/tools/create-issue.js +32 -15
  23. package/dist/tools/create-issue.js.map +1 -1
  24. package/dist/tools/create-label.d.ts.map +1 -1
  25. package/dist/tools/create-label.js +20 -12
  26. package/dist/tools/create-label.js.map +1 -1
  27. package/dist/tools/create-or-update-file.d.ts +1 -4
  28. package/dist/tools/create-or-update-file.d.ts.map +1 -1
  29. package/dist/tools/create-or-update-file.js +23 -23
  30. package/dist/tools/create-or-update-file.js.map +1 -1
  31. package/dist/tools/create-pull-request.d.ts.map +1 -1
  32. package/dist/tools/create-pull-request.js +37 -16
  33. package/dist/tools/create-pull-request.js.map +1 -1
  34. package/dist/tools/create-release.d.ts.map +1 -1
  35. package/dist/tools/create-release.js +29 -19
  36. package/dist/tools/create-release.js.map +1 -1
  37. package/dist/tools/create-repo.d.ts.map +1 -1
  38. package/dist/tools/create-repo.js +33 -18
  39. package/dist/tools/create-repo.js.map +1 -1
  40. package/dist/tools/delete-file.d.ts +1 -6
  41. package/dist/tools/delete-file.d.ts.map +1 -1
  42. package/dist/tools/delete-file.js +8 -25
  43. package/dist/tools/delete-file.js.map +1 -1
  44. package/dist/tools/get-file-content.d.ts.map +1 -1
  45. package/dist/tools/get-file-content.js +5 -9
  46. package/dist/tools/get-file-content.js.map +1 -1
  47. package/dist/tools/get-issue.d.ts.map +1 -1
  48. package/dist/tools/get-issue.js +25 -4
  49. package/dist/tools/get-issue.js.map +1 -1
  50. package/dist/tools/get-pull-request-diff.d.ts.map +1 -1
  51. package/dist/tools/get-pull-request-diff.js +19 -5
  52. package/dist/tools/get-pull-request-diff.js.map +1 -1
  53. package/dist/tools/get-pull-request.d.ts.map +1 -1
  54. package/dist/tools/get-pull-request.js +32 -3
  55. package/dist/tools/get-pull-request.js.map +1 -1
  56. package/dist/tools/get-repo.d.ts.map +1 -1
  57. package/dist/tools/get-repo.js +21 -4
  58. package/dist/tools/get-repo.js.map +1 -1
  59. package/dist/tools/get-user-profile.d.ts.map +1 -1
  60. package/dist/tools/get-user-profile.js +15 -2
  61. package/dist/tools/get-user-profile.js.map +1 -1
  62. package/dist/tools/get-workflow-run.d.ts.map +1 -1
  63. package/dist/tools/get-workflow-run.js +28 -5
  64. package/dist/tools/get-workflow-run.js.map +1 -1
  65. package/dist/tools/list-branches.d.ts +0 -2
  66. package/dist/tools/list-branches.d.ts.map +1 -1
  67. package/dist/tools/list-branches.js +3 -9
  68. package/dist/tools/list-branches.js.map +1 -1
  69. package/dist/tools/list-comments.d.ts +0 -2
  70. package/dist/tools/list-comments.d.ts.map +1 -1
  71. package/dist/tools/list-comments.js +33 -10
  72. package/dist/tools/list-comments.js.map +1 -1
  73. package/dist/tools/list-commits.d.ts +0 -2
  74. package/dist/tools/list-commits.d.ts.map +1 -1
  75. package/dist/tools/list-commits.js +8 -13
  76. package/dist/tools/list-commits.js.map +1 -1
  77. package/dist/tools/list-issues.d.ts +2 -2
  78. package/dist/tools/list-issues.d.ts.map +1 -1
  79. package/dist/tools/list-issues.js +43 -16
  80. package/dist/tools/list-issues.js.map +1 -1
  81. package/dist/tools/list-labels.d.ts +0 -2
  82. package/dist/tools/list-labels.d.ts.map +1 -1
  83. package/dist/tools/list-labels.js +18 -10
  84. package/dist/tools/list-labels.js.map +1 -1
  85. package/dist/tools/list-notifications.d.ts +1 -6
  86. package/dist/tools/list-notifications.d.ts.map +1 -1
  87. package/dist/tools/list-notifications.js +30 -23
  88. package/dist/tools/list-notifications.js.map +1 -1
  89. package/dist/tools/list-org-members.d.ts +0 -3
  90. package/dist/tools/list-org-members.d.ts.map +1 -1
  91. package/dist/tools/list-org-members.js +24 -18
  92. package/dist/tools/list-org-members.js.map +1 -1
  93. package/dist/tools/list-pull-request-files.d.ts +0 -3
  94. package/dist/tools/list-pull-request-files.d.ts.map +1 -1
  95. package/dist/tools/list-pull-request-files.js +6 -28
  96. package/dist/tools/list-pull-request-files.js.map +1 -1
  97. package/dist/tools/list-pull-requests.d.ts +2 -4
  98. package/dist/tools/list-pull-requests.d.ts.map +1 -1
  99. package/dist/tools/list-pull-requests.js +34 -18
  100. package/dist/tools/list-pull-requests.js.map +1 -1
  101. package/dist/tools/list-releases.d.ts +0 -2
  102. package/dist/tools/list-releases.d.ts.map +1 -1
  103. package/dist/tools/list-releases.js +37 -10
  104. package/dist/tools/list-releases.js.map +1 -1
  105. package/dist/tools/list-repos.d.ts +0 -7
  106. package/dist/tools/list-repos.d.ts.map +1 -1
  107. package/dist/tools/list-repos.js +18 -23
  108. package/dist/tools/list-repos.js.map +1 -1
  109. package/dist/tools/list-workflow-runs.d.ts +0 -21
  110. package/dist/tools/list-workflow-runs.d.ts.map +1 -1
  111. package/dist/tools/list-workflow-runs.js +32 -43
  112. package/dist/tools/list-workflow-runs.js.map +1 -1
  113. package/dist/tools/merge-pull-request.d.ts +1 -3
  114. package/dist/tools/merge-pull-request.d.ts.map +1 -1
  115. package/dist/tools/merge-pull-request.js +11 -15
  116. package/dist/tools/merge-pull-request.js.map +1 -1
  117. package/dist/tools/request-pull-request-review.d.ts +1 -21
  118. package/dist/tools/request-pull-request-review.d.ts.map +1 -1
  119. package/dist/tools/request-pull-request-review.js +17 -10
  120. package/dist/tools/request-pull-request-review.js.map +1 -1
  121. package/dist/tools/schemas.d.ts +130 -38
  122. package/dist/tools/schemas.d.ts.map +1 -1
  123. package/dist/tools/schemas.js +140 -52
  124. package/dist/tools/schemas.js.map +1 -1
  125. package/dist/tools/search-issues.d.ts +0 -13
  126. package/dist/tools/search-issues.d.ts.map +1 -1
  127. package/dist/tools/search-issues.js +23 -17
  128. package/dist/tools/search-issues.js.map +1 -1
  129. package/dist/tools/search-repos.d.ts +0 -10
  130. package/dist/tools/search-repos.d.ts.map +1 -1
  131. package/dist/tools/search-repos.js +7 -12
  132. package/dist/tools/search-repos.js.map +1 -1
  133. package/dist/tools/update-issue.d.ts +2 -18
  134. package/dist/tools/update-issue.d.ts.map +1 -1
  135. package/dist/tools/update-issue.js +19 -16
  136. package/dist/tools/update-issue.js.map +1 -1
  137. package/dist/tools/update-pull-request.d.ts +2 -24
  138. package/dist/tools/update-pull-request.d.ts.map +1 -1
  139. package/dist/tools/update-pull-request.js +28 -20
  140. package/dist/tools/update-pull-request.js.map +1 -1
  141. package/dist/tools.json +70 -747
  142. package/package.json +10 -4
package/README.md CHANGED
@@ -1,159 +1,105 @@
1
- # opentabs-plugin-github
1
+ # GitHub
2
2
 
3
- OpenTabs plugin for GitHub
3
+ OpenTabs plugin for GitHub — gives AI agents access to GitHub through your authenticated browser session.
4
4
 
5
- ## Project Structure
5
+ ## Install
6
6
 
7
+ ```bash
8
+ opentabs plugin install github
7
9
  ```
8
- github/
9
- ├── package.json # Plugin metadata (name, opentabs field, dependencies)
10
- ├── icon.svg # Optional custom icon (square SVG, max 8KB)
11
- ├── icon-inactive.svg # Optional manual inactive icon override
12
- ├── src/
13
- │ ├── index.ts # Plugin class (extends OpenTabsPlugin)
14
- │ └── tools/ # One file per tool (using defineTool)
15
- │ └── example.ts
16
- └── dist/ # Build output (generated)
17
- ├── adapter.iife.js # Bundled adapter injected into matching tabs
18
- └── tools.json # Tool schemas for MCP registration
19
- ```
20
-
21
- ## Configuration
22
-
23
- Plugin metadata is defined in `package.json` under the `opentabs` field:
24
-
25
- ```json
26
- {
27
- "name": "opentabs-plugin-github",
28
- "main": "dist/adapter.iife.js",
29
- "opentabs": {
30
- "displayName": "GitHub",
31
- "description": "OpenTabs plugin for GitHub",
32
- "urlPatterns": ["*://github.com/*"]
33
- }
34
- }
35
- ```
36
-
37
- - **`main`** — entry point for the bundled adapter IIFE
38
- - **`opentabs.displayName`** — human-readable name shown in the side panel
39
- - **`opentabs.description`** — short description of what the plugin does
40
- - **`opentabs.urlPatterns`** — Chrome match patterns for tabs where the adapter is injected
41
-
42
- ## Custom Icons
43
10
 
44
- By default, the side panel shows a colored letter avatar for your plugin. To use a custom icon, place an `icon.svg` file in the plugin root (next to `package.json`):
11
+ Or install globally via npm:
45
12
 
46
- ```
47
- github/
48
- ├── package.json
49
- ├── icon.svg ← custom icon (optional)
50
- ├── icon-inactive.svg ← manual inactive override (optional, requires icon.svg)
51
- ├── src/
52
- │ └── ...
13
+ ```bash
14
+ npm install -g @opentabs-dev/opentabs-plugin-github
53
15
  ```
54
16
 
55
- **How it works:**
17
+ ## Setup
56
18
 
57
- - `opentabs-plugin build` reads `icon.svg`, validates it, auto-generates a grayscale inactive variant, and embeds both in `dist/tools.json`
58
- - To override the auto-generated inactive icon, provide `icon-inactive.svg` (must use only grayscale colors)
59
- - If no `icon.svg` is provided, the letter avatar is used automatically
19
+ 1. Open [github.com](https://github.com) in Chrome and log in
20
+ 2. Open the OpenTabs side panel the GitHub plugin should appear as **ready**
60
21
 
61
- **Icon requirements:**
22
+ ## Tools (35)
62
23
 
63
- - Square SVG with a `viewBox` attribute (e.g., `viewBox="0 0 32 32"`)
64
- - Maximum 8 KB file size
65
- - No embedded `<image>`, `<script>`, or event handler attributes (`onclick`, etc.)
66
- - Manual `icon-inactive.svg` must use only achromatic (grayscale) colors
24
+ ### Repositories (11)
67
25
 
68
- ## Development
26
+ | Tool | Description | Type |
27
+ |---|---|---|
28
+ | `list_repos` | List repositories for a user or organization | Read |
29
+ | `get_repo` | Get details of a specific repository | Read |
30
+ | `create_repo` | Create a new repository | Write |
31
+ | `list_commits` | List commits for a repository | Read |
32
+ | `compare_commits` | Compare two commits or branches | Write |
33
+ | `list_releases` | List releases for a repository | Read |
34
+ | `create_release` | Create a release in a repository | Write |
35
+ | `list_branches` | List branches for a repository | Read |
36
+ | `get_file_content` | Read a file from a repository | Read |
37
+ | `create_or_update_file` | Create or update a file in a repository | Write |
38
+ | `delete_file` | Delete a file from a repository | Write |
69
39
 
70
- ```bash
71
- npm install
72
- npm run build # tsc && opentabs-plugin build
73
- npm run dev # watch mode (tsc --watch + opentabs-plugin build --watch)
74
- npm run type-check # tsc --noEmit
75
- npm run lint # biome
76
- ```
40
+ ### Issues (7)
77
41
 
78
- ## Adding Tools
79
-
80
- Create a new file in `src/tools/` using `defineTool`:
81
-
82
- ```ts
83
- import { z } from 'zod';
84
- import { defineTool } from '@opentabs-dev/plugin-sdk';
85
-
86
- export const myTool = defineTool({
87
- name: 'my_tool',
88
- displayName: 'My Tool',
89
- description: 'What this tool does',
90
- icon: 'wrench',
91
- input: z.object({ /* ... */ }),
92
- output: z.object({ /* ... */ }),
93
- handle: async (params) => {
94
- // Tool implementation runs in the browser tab context
95
- return { /* ... */ };
96
- },
97
- });
98
- ```
42
+ | Tool | Description | Type |
43
+ |---|---|---|
44
+ | `list_issues` | List issues for a repository | Read |
45
+ | `get_issue` | Get details of a specific issue | Read |
46
+ | `create_issue` | Create a new issue in a repository | Write |
47
+ | `update_issue` | Update an existing issue | Write |
48
+ | `search_issues` | Search issues and pull requests | Read |
49
+ | `list_labels` | List labels for a repository | Read |
50
+ | `create_label` | Create a label in a repository | Write |
99
51
 
100
- Then register it in `src/index.ts` by adding it to the `tools` array.
52
+ ### Pull Requests (8)
101
53
 
102
- ## Authentication
54
+ | Tool | Description | Type |
55
+ |---|---|---|
56
+ | `list_pull_requests` | List pull requests for a repository | Read |
57
+ | `get_pull_request` | Get details of a specific pull request | Read |
58
+ | `create_pull_request` | Create a new pull request | Write |
59
+ | `update_pull_request` | Update a pull request | Write |
60
+ | `merge_pull_request` | Merge a pull request | Write |
61
+ | `get_pull_request_diff` | Get the raw diff of a pull request | Read |
62
+ | `list_pull_request_files` | List files changed in a pull request | Read |
63
+ | `request_pull_request_review` | Request reviewers for a pull request | Write |
103
64
 
104
- Plugin tools run in the browser tab context, so they can read auth tokens directly from the page. The SDK provides utilities for the most common patterns:
65
+ ### Comments (2)
105
66
 
106
- ```ts
107
- import { getLocalStorage, getCookie, getPageGlobal } from '@opentabs-dev/plugin-sdk';
67
+ | Tool | Description | Type |
68
+ |---|---|---|
69
+ | `list_comments` | List comments on an issue or pull request | Read |
70
+ | `create_comment` | Add a comment to an issue or pull request | Write |
108
71
 
109
- // localStorage — most common
110
- const token = getLocalStorage('token');
72
+ ### Users (3)
111
73
 
112
- // Cookies session tokens, JWTs
113
- const session = getCookie('session_id');
74
+ | Tool | Description | Type |
75
+ |---|---|---|
76
+ | `get_user_profile` | Get a user's profile information | Read |
77
+ | `list_org_members` | List members of an organization | Read |
78
+ | `list_notifications` | List notifications for the authenticated user | Read |
114
79
 
115
- // Page globals — SPA boot data (e.g., window.__APP_STATE__)
116
- const appState = getPageGlobal('__APP_STATE__');
117
- ```
80
+ ### Actions (2)
118
81
 
119
- **Iframe fallback:** Some apps (e.g., Discord) delete `window.localStorage` after boot. `getLocalStorage` automatically tries a hidden same-origin iframe fallback before returning `null`, so you don't need to handle this case manually.
82
+ | Tool | Description | Type |
83
+ |---|---|---|
84
+ | `list_workflow_runs` | List GitHub Actions workflow runs | Read |
85
+ | `get_workflow_run` | Get a workflow run by ID | Read |
120
86
 
121
- **SPA hydration:** Auth tokens may not be available immediately on page load. Implement polling in `isReady()` to wait until the app has hydrated before your tools run. See the comments in `src/index.ts` for an example polling pattern.
87
+ ### Search (1)
122
88
 
123
- ## Shared Schemas
89
+ | Tool | Description | Type |
90
+ |---|---|---|
91
+ | `search_repos` | Search repositories on GitHub | Read |
124
92
 
125
- When 3 or more tools share the same input or output shape, extract common Zod schemas into a shared file to avoid duplication:
93
+ ### Reactions (1)
126
94
 
127
- ```ts
128
- // src/schemas/channel.ts
129
- import { z } from 'zod';
95
+ | Tool | Description | Type |
96
+ |---|---|---|
97
+ | `add_reaction` | Add a reaction to an issue or comment | Write |
130
98
 
131
- export const channelSchema = z.object({
132
- id: z.string().describe('Channel ID'),
133
- name: z.string().describe('Channel name'),
134
- });
99
+ ## How It Works
135
100
 
136
- export type Channel = z.infer<typeof channelSchema>;
137
- ```
101
+ This plugin runs inside your GitHub tab through the [OpenTabs](https://opentabs.dev) Chrome extension. It uses your existing browser session — no API tokens or OAuth apps required. All operations happen as you, with your permissions.
138
102
 
139
- Then import and reuse in your tools:
140
-
141
- ```ts
142
- // src/tools/list-channels.ts
143
- import { channelSchema } from '../schemas/channel.js';
144
-
145
- export const listChannels = defineTool({
146
- name: 'list_channels',
147
- displayName: 'List Channels',
148
- description: 'List all available channels',
149
- icon: 'list',
150
- input: z.object({}),
151
- output: z.object({ channels: z.array(channelSchema) }),
152
- handle: async () => {
153
- // ...
154
- return { channels: [] };
155
- },
156
- });
157
- ```
103
+ ## License
158
104
 
159
- This keeps your tool schemas DRY and makes it easy to evolve shared types in one place.
105
+ MIT