@kosha-ai/integration-github 0.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Codemancers
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,11 @@
1
+ # integration-github
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Building
6
+
7
+ Run `nx build integration-github` to build the library.
8
+
9
+ ## Running unit tests
10
+
11
+ Run `nx test integration-github` to execute the unit tests via [Jest](https://jestjs.io).
@@ -0,0 +1,2 @@
1
+ export { github, github as default, type GithubIntegrationOptions, } from './lib/integration-github.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,MAAM,IAAI,OAAO,EACjB,KAAK,wBAAwB,GAC9B,MAAM,6BAA6B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export { github, github as default, } from './lib/integration-github.js';
@@ -0,0 +1,9 @@
1
+ import type { KoshaIntegration } from '@kosha-ai/integration-sdk';
2
+ export interface GithubIntegrationOptions {
3
+ /** Point at a GitHub Enterprise Server instance. */
4
+ baseUrl?: string;
5
+ webBaseUrl?: string;
6
+ }
7
+ export declare function github(options?: GithubIntegrationOptions): KoshaIntegration;
8
+ export default github;
9
+ //# sourceMappingURL=integration-github.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration-github.d.ts","sourceRoot":"","sources":["../../src/lib/integration-github.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE,MAAM,WAAW,wBAAwB;IACvC,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAOD,wBAAgB,MAAM,CACpB,OAAO,GAAE,wBAA6B,GACrC,gBAAgB,CA2ClB;AAED,eAAe,MAAM,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { defineIntegration, oauth2 } from '@kosha-ai/integration-sdk';
2
+ export function github(options = {}) {
3
+ const apiBaseUrl = options.baseUrl ?? 'https://api.github.com';
4
+ const webBaseUrl = options.webBaseUrl ?? 'https://github.com';
5
+ return defineIntegration({
6
+ key: 'github',
7
+ name: 'GitHub',
8
+ docsUrl: 'https://docs.github.com/rest',
9
+ auth: oauth2({
10
+ authorizationUrl: `${webBaseUrl}/login/oauth/authorize`,
11
+ tokenUrl: `${webBaseUrl}/login/oauth/access_token`,
12
+ // GitHub accepts JSON on the token endpoint and returns form-encoded
13
+ // unless asked for JSON, which the SDK does via the Accept header.
14
+ tokenRequest: 'json',
15
+ scopeSeparator: ' ',
16
+ scopesAvailable: [
17
+ 'repo',
18
+ 'repo:status',
19
+ 'public_repo',
20
+ 'read:org',
21
+ 'read:user',
22
+ 'user:email',
23
+ 'workflow',
24
+ ],
25
+ }),
26
+ api: {
27
+ baseUrl: apiBaseUrl,
28
+ authHeaders: ({ accessToken }) => ({
29
+ Authorization: `Bearer ${accessToken}`,
30
+ Accept: 'application/vnd.github+json',
31
+ 'X-GitHub-Api-Version': '2022-11-28',
32
+ }),
33
+ },
34
+ identity: {
35
+ async fetchAccount({ accessToken, http }) {
36
+ const user = await http.get('/user', { accessToken });
37
+ return { externalAccountId: String(user.id), label: user.login };
38
+ },
39
+ },
40
+ });
41
+ }
42
+ export default github;
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@kosha-ai/integration-github",
3
+ "version": "0.0.1",
4
+ "description": "GitHub integration for Kosha",
5
+ "keywords": [
6
+ "kosha",
7
+ "github",
8
+ "oauth",
9
+ "integrations"
10
+ ],
11
+ "license": "MIT",
12
+ "homepage": "https://github.com/codemancers/kosha#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/codemancers/kosha/issues"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/codemancers/kosha.git",
19
+ "directory": "packages/integrations/github"
20
+ },
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "type": "module",
25
+ "main": "./dist/index.js",
26
+ "module": "./dist/index.js",
27
+ "types": "./dist/index.d.ts",
28
+ "exports": {
29
+ "./package.json": "./package.json",
30
+ ".": {
31
+ "@org/source": "./src/index.ts",
32
+ "types": "./dist/index.d.ts",
33
+ "import": "./dist/index.js",
34
+ "default": "./dist/index.js"
35
+ }
36
+ },
37
+ "files": [
38
+ "dist",
39
+ "!**/*.tsbuildinfo"
40
+ ],
41
+ "dependencies": {
42
+ "tslib": "^2.3.0"
43
+ },
44
+ "kosha": {
45
+ "kind": "integration",
46
+ "key": "github"
47
+ },
48
+ "peerDependencies": {
49
+ "@kosha-ai/integration-sdk": "0.0.1"
50
+ },
51
+ "devDependencies": {
52
+ "@kosha-ai/integration-sdk": "0.0.1"
53
+ }
54
+ }