@kb-labs/github-entry 2.93.0
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/handlers/create-branch.d.ts +15 -0
- package/dist/handlers/create-branch.js +60 -0
- package/dist/handlers/create-branch.js.map +1 -0
- package/dist/handlers/create-pr.d.ts +19 -0
- package/dist/handlers/create-pr.js +48 -0
- package/dist/handlers/create-pr.js.map +1 -0
- package/dist/handlers/fetch-issue.d.ts +18 -0
- package/dist/handlers/fetch-issue.js +36 -0
- package/dist/handlers/fetch-issue.js.map +1 -0
- package/dist/handlers/post-comment.d.ts +14 -0
- package/dist/handlers/post-comment.js +32 -0
- package/dist/handlers/post-comment.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.d.ts +38 -0
- package/dist/manifest.js +51 -0
- package/dist/manifest.js.map +1 -0
- package/package.json +43 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as _kb_labs_shared_command_kit from '@kb-labs/shared-command-kit';
|
|
2
|
+
|
|
3
|
+
declare const _default: _kb_labs_shared_command_kit.Handler<unknown, {
|
|
4
|
+
owner: string;
|
|
5
|
+
repo: string;
|
|
6
|
+
branchName: string;
|
|
7
|
+
fromBranch: string;
|
|
8
|
+
token?: string | undefined;
|
|
9
|
+
}, {
|
|
10
|
+
url: string;
|
|
11
|
+
branchName: string;
|
|
12
|
+
sha: string;
|
|
13
|
+
}>;
|
|
14
|
+
|
|
15
|
+
export { _default as default };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { defineHandler, useEnv } from '@kb-labs/sdk';
|
|
2
|
+
|
|
3
|
+
// src/handlers/create-branch.ts
|
|
4
|
+
function headers(token) {
|
|
5
|
+
const h = {
|
|
6
|
+
Accept: "application/vnd.github+json",
|
|
7
|
+
"Content-Type": "application/json",
|
|
8
|
+
"X-GitHub-Api-Version": "2022-11-28"
|
|
9
|
+
};
|
|
10
|
+
const tok = token ?? useEnv("GITHUB_WORKFLOW_TOKEN");
|
|
11
|
+
if (tok) h.Authorization = `Bearer ${tok}`;
|
|
12
|
+
return h;
|
|
13
|
+
}
|
|
14
|
+
var create_branch_default = defineHandler({
|
|
15
|
+
async execute(ctx, input) {
|
|
16
|
+
const { owner, repo, branchName, fromBranch = "main", token } = input;
|
|
17
|
+
const hdrs = headers(token);
|
|
18
|
+
const refRes = await ctx.runtime.fetch(
|
|
19
|
+
`https://api.github.com/repos/${owner}/${repo}/git/ref/heads/${fromBranch}`,
|
|
20
|
+
{ headers: hdrs }
|
|
21
|
+
);
|
|
22
|
+
if (!refRes.ok) throw new Error(`GitHub ${refRes.status}: ${await refRes.text()}`);
|
|
23
|
+
const ref = await refRes.json();
|
|
24
|
+
const sha = ref.object.sha;
|
|
25
|
+
const createRes = await ctx.runtime.fetch(
|
|
26
|
+
`https://api.github.com/repos/${owner}/${repo}/git/refs`,
|
|
27
|
+
{
|
|
28
|
+
method: "POST",
|
|
29
|
+
headers: hdrs,
|
|
30
|
+
body: JSON.stringify({ ref: `refs/heads/${branchName}`, sha })
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
if (!createRes.ok) {
|
|
34
|
+
if (createRes.status === 422) {
|
|
35
|
+
const existingRes = await ctx.runtime.fetch(
|
|
36
|
+
`https://api.github.com/repos/${owner}/${repo}/git/ref/heads/${branchName}`,
|
|
37
|
+
{ headers: hdrs }
|
|
38
|
+
);
|
|
39
|
+
if (!existingRes.ok) throw new Error(`GitHub ${existingRes.status}: ${await existingRes.text()}`);
|
|
40
|
+
const existing = await existingRes.json();
|
|
41
|
+
const existingSha = existing.object.sha;
|
|
42
|
+
return {
|
|
43
|
+
branchName,
|
|
44
|
+
sha: existingSha,
|
|
45
|
+
url: `https://github.com/${owner}/${repo}/tree/${branchName}`
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
throw new Error(`GitHub ${createRes.status}: ${await createRes.text()}`);
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
branchName,
|
|
52
|
+
sha,
|
|
53
|
+
url: `https://github.com/${owner}/${repo}/tree/${branchName}`
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export { create_branch_default as default };
|
|
59
|
+
//# sourceMappingURL=create-branch.js.map
|
|
60
|
+
//# sourceMappingURL=create-branch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/handlers/create-branch.ts"],"names":[],"mappings":"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","file":"create-branch.js","sourcesContent":["import { defineHandler, useEnv } from '@kb-labs/sdk'\nimport type { CreateBranchInput, CreateBranchOutput } from '@kb-labs/github-contracts'\n\nfunction headers(token?: string): Record<string, string> {\n const h: Record<string, string> = {\n Accept: 'application/vnd.github+json',\n 'Content-Type': 'application/json',\n 'X-GitHub-Api-Version': '2022-11-28',\n }\n const tok = token ?? useEnv('GITHUB_WORKFLOW_TOKEN')\n if (tok) h.Authorization = `Bearer ${tok}`\n return h\n}\n\nexport default defineHandler<unknown, CreateBranchInput, CreateBranchOutput>({\n async execute(ctx, input) {\n const { owner, repo, branchName, fromBranch = 'main', token } = input\n const hdrs = headers(token)\n\n // Get SHA of the base branch\n const refRes = await ctx.runtime.fetch(\n `https://api.github.com/repos/${owner}/${repo}/git/ref/heads/${fromBranch}`,\n { headers: hdrs },\n )\n if (!refRes.ok) throw new Error(`GitHub ${refRes.status}: ${await refRes.text()}`)\n\n const ref = await refRes.json() as Record<string, unknown>\n const sha = (ref.object as { sha: string }).sha\n\n // Create the new branch (idempotent — if already exists, use it)\n const createRes = await ctx.runtime.fetch(\n `https://api.github.com/repos/${owner}/${repo}/git/refs`,\n {\n method: 'POST',\n headers: hdrs,\n body: JSON.stringify({ ref: `refs/heads/${branchName}`, sha }),\n },\n )\n\n if (!createRes.ok) {\n if (createRes.status === 422) {\n // Branch already exists — fetch its current SHA\n const existingRes = await ctx.runtime.fetch(\n `https://api.github.com/repos/${owner}/${repo}/git/ref/heads/${branchName}`,\n { headers: hdrs },\n )\n if (!existingRes.ok) throw new Error(`GitHub ${existingRes.status}: ${await existingRes.text()}`)\n const existing = await existingRes.json() as Record<string, unknown>\n const existingSha = (existing.object as { sha: string }).sha\n return {\n branchName,\n sha: existingSha,\n url: `https://github.com/${owner}/${repo}/tree/${branchName}`,\n }\n }\n throw new Error(`GitHub ${createRes.status}: ${await createRes.text()}`)\n }\n\n return {\n branchName,\n sha,\n url: `https://github.com/${owner}/${repo}/tree/${branchName}`,\n }\n },\n})\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as _kb_labs_shared_command_kit from '@kb-labs/shared-command-kit';
|
|
2
|
+
|
|
3
|
+
declare const _default: _kb_labs_shared_command_kit.Handler<unknown, {
|
|
4
|
+
owner: string;
|
|
5
|
+
repo: string;
|
|
6
|
+
title: string;
|
|
7
|
+
body: string;
|
|
8
|
+
labels: string[];
|
|
9
|
+
head: string;
|
|
10
|
+
base: string;
|
|
11
|
+
issueNumber?: number | undefined;
|
|
12
|
+
token?: string | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
title: string;
|
|
15
|
+
url: string;
|
|
16
|
+
prNumber: number;
|
|
17
|
+
}>;
|
|
18
|
+
|
|
19
|
+
export { _default as default };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { defineHandler, useEnv } from '@kb-labs/sdk';
|
|
2
|
+
|
|
3
|
+
// src/handlers/create-pr.ts
|
|
4
|
+
function headers(token) {
|
|
5
|
+
const h = {
|
|
6
|
+
Accept: "application/vnd.github+json",
|
|
7
|
+
"Content-Type": "application/json",
|
|
8
|
+
"X-GitHub-Api-Version": "2022-11-28"
|
|
9
|
+
};
|
|
10
|
+
const tok = token ?? useEnv("GITHUB_WORKFLOW_TOKEN");
|
|
11
|
+
if (tok) h.Authorization = `Bearer ${tok}`;
|
|
12
|
+
return h;
|
|
13
|
+
}
|
|
14
|
+
var create_pr_default = defineHandler({
|
|
15
|
+
async execute(ctx, input) {
|
|
16
|
+
const { owner, repo, title, body = "", head, base = "main", issueNumber, labels = [], token } = input;
|
|
17
|
+
const hdrs = headers(token);
|
|
18
|
+
const prBody = issueNumber ? `${body}
|
|
19
|
+
|
|
20
|
+
Closes #${issueNumber}` : body;
|
|
21
|
+
const prRes = await ctx.runtime.fetch(
|
|
22
|
+
`https://api.github.com/repos/${owner}/${repo}/pulls`,
|
|
23
|
+
{
|
|
24
|
+
method: "POST",
|
|
25
|
+
headers: hdrs,
|
|
26
|
+
body: JSON.stringify({ title, body: prBody, head, base })
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
if (!prRes.ok) throw new Error(`GitHub ${prRes.status}: ${await prRes.text()}`);
|
|
30
|
+
const pr = await prRes.json();
|
|
31
|
+
const prNumber = pr.number;
|
|
32
|
+
if (labels.length > 0) {
|
|
33
|
+
await ctx.runtime.fetch(
|
|
34
|
+
`https://api.github.com/repos/${owner}/${repo}/issues/${prNumber}/labels`,
|
|
35
|
+
{ method: "POST", headers: hdrs, body: JSON.stringify({ labels }) }
|
|
36
|
+
).catch(() => void 0);
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
prNumber,
|
|
40
|
+
url: pr.html_url,
|
|
41
|
+
title: pr.title
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export { create_pr_default as default };
|
|
47
|
+
//# sourceMappingURL=create-pr.js.map
|
|
48
|
+
//# sourceMappingURL=create-pr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/handlers/create-pr.ts"],"names":[],"mappings":";;;AAGA,SAAS,QAAQ,KAAA,EAAwC;AACvD,EAAA,MAAM,CAAA,GAA4B;AAAA,IAChC,MAAA,EAAQ,6BAAA;AAAA,IACR,cAAA,EAAgB,kBAAA;AAAA,IAChB,sBAAA,EAAwB;AAAA,GAC1B;AACA,EAAA,MAAM,GAAA,GAAM,KAAA,IAAS,MAAA,CAAO,uBAAuB,CAAA;AACnD,EAAA,IAAI,GAAA,EAAK,CAAA,CAAE,aAAA,GAAgB,CAAA,OAAA,EAAU,GAAG,CAAA,CAAA;AACxC,EAAA,OAAO,CAAA;AACT;AAEA,IAAO,oBAAQ,aAAA,CAAsD;AAAA,EACnE,MAAM,OAAA,CAAQ,GAAA,EAAK,KAAA,EAAO;AACxB,IAAA,MAAM,EAAE,KAAA,EAAO,IAAA,EAAM,KAAA,EAAO,OAAO,EAAA,EAAI,IAAA,EAAM,IAAA,GAAO,MAAA,EAAQ,WAAA,EAAa,MAAA,GAAS,EAAC,EAAG,OAAM,GAAI,KAAA;AAChG,IAAA,MAAM,IAAA,GAAO,QAAQ,KAAK,CAAA;AAE1B,IAAA,MAAM,MAAA,GAAS,WAAA,GAAc,CAAA,EAAG,IAAI;;AAAA,QAAA,EAAe,WAAW,CAAA,CAAA,GAAK,IAAA;AAEnE,IAAA,MAAM,KAAA,GAAQ,MAAM,GAAA,CAAI,OAAA,CAAQ,KAAA;AAAA,MAC9B,CAAA,6BAAA,EAAgC,KAAK,CAAA,CAAA,EAAI,IAAI,CAAA,MAAA,CAAA;AAAA,MAC7C;AAAA,QACE,MAAA,EAAQ,MAAA;AAAA,QACR,OAAA,EAAS,IAAA;AAAA,QACT,IAAA,EAAM,KAAK,SAAA,CAAU,EAAE,OAAO,IAAA,EAAM,MAAA,EAAQ,IAAA,EAAM,IAAA,EAAM;AAAA;AAC1D,KACF;AACA,IAAA,IAAI,CAAC,KAAA,CAAM,EAAA,EAAI,MAAM,IAAI,KAAA,CAAM,CAAA,OAAA,EAAU,KAAA,CAAM,MAAM,CAAA,EAAA,EAAK,MAAM,KAAA,CAAM,IAAA,EAAM,CAAA,CAAE,CAAA;AAE9E,IAAA,MAAM,EAAA,GAAK,MAAM,KAAA,CAAM,IAAA,EAAK;AAC5B,IAAA,MAAM,WAAW,EAAA,CAAG,MAAA;AAGpB,IAAA,IAAI,MAAA,CAAO,SAAS,CAAA,EAAG;AACrB,MAAA,MAAM,IAAI,OAAA,CAAQ,KAAA;AAAA,QAChB,CAAA,6BAAA,EAAgC,KAAK,CAAA,CAAA,EAAI,IAAI,WAAW,QAAQ,CAAA,OAAA,CAAA;AAAA,QAChE,EAAE,MAAA,EAAQ,MAAA,EAAQ,OAAA,EAAS,IAAA,EAAM,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,EAAE,MAAA,EAAQ,CAAA;AAAE,OACpE,CAAE,KAAA,CAAM,MAAM,MAAS,CAAA;AAAA,IACzB;AAEA,IAAA,OAAO;AAAA,MACL,QAAA;AAAA,MACA,KAAK,EAAA,CAAG,QAAA;AAAA,MACR,OAAO,EAAA,CAAG;AAAA,KACZ;AAAA,EACF;AACF,CAAC","file":"create-pr.js","sourcesContent":["import { defineHandler, useEnv } from '@kb-labs/sdk'\nimport type { CreatePRInput, CreatePROutput } from '@kb-labs/github-contracts'\n\nfunction headers(token?: string): Record<string, string> {\n const h: Record<string, string> = {\n Accept: 'application/vnd.github+json',\n 'Content-Type': 'application/json',\n 'X-GitHub-Api-Version': '2022-11-28',\n }\n const tok = token ?? useEnv('GITHUB_WORKFLOW_TOKEN')\n if (tok) h.Authorization = `Bearer ${tok}`\n return h\n}\n\nexport default defineHandler<unknown, CreatePRInput, CreatePROutput>({\n async execute(ctx, input) {\n const { owner, repo, title, body = '', head, base = 'main', issueNumber, labels = [], token } = input\n const hdrs = headers(token)\n\n const prBody = issueNumber ? `${body}\\n\\nCloses #${issueNumber}` : body\n\n const prRes = await ctx.runtime.fetch(\n `https://api.github.com/repos/${owner}/${repo}/pulls`,\n {\n method: 'POST',\n headers: hdrs,\n body: JSON.stringify({ title, body: prBody, head, base }),\n },\n )\n if (!prRes.ok) throw new Error(`GitHub ${prRes.status}: ${await prRes.text()}`)\n\n const pr = await prRes.json() as Record<string, unknown>\n const prNumber = pr.number as number\n\n // Apply labels (non-critical)\n if (labels.length > 0) {\n await ctx.runtime.fetch(\n `https://api.github.com/repos/${owner}/${repo}/issues/${prNumber}/labels`,\n { method: 'POST', headers: hdrs, body: JSON.stringify({ labels }) },\n ).catch(() => undefined)\n }\n\n return {\n prNumber,\n url: pr.html_url as string,\n title: pr.title as string,\n }\n },\n})\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as _kb_labs_shared_command_kit from '@kb-labs/shared-command-kit';
|
|
2
|
+
|
|
3
|
+
declare const _default: _kb_labs_shared_command_kit.Handler<unknown, {
|
|
4
|
+
owner: string;
|
|
5
|
+
repo: string;
|
|
6
|
+
issueNumber: number;
|
|
7
|
+
token?: string | undefined;
|
|
8
|
+
}, {
|
|
9
|
+
number: number;
|
|
10
|
+
title: string;
|
|
11
|
+
body: string | null;
|
|
12
|
+
state: string;
|
|
13
|
+
url: string;
|
|
14
|
+
labels: string[];
|
|
15
|
+
author: string;
|
|
16
|
+
}>;
|
|
17
|
+
|
|
18
|
+
export { _default as default };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { defineHandler, useEnv } from '@kb-labs/sdk';
|
|
2
|
+
|
|
3
|
+
// src/handlers/fetch-issue.ts
|
|
4
|
+
function headers(token) {
|
|
5
|
+
const h = {
|
|
6
|
+
Accept: "application/vnd.github+json",
|
|
7
|
+
"X-GitHub-Api-Version": "2022-11-28"
|
|
8
|
+
};
|
|
9
|
+
const tok = token ?? useEnv("GITHUB_WORKFLOW_TOKEN");
|
|
10
|
+
if (tok) h.Authorization = `Bearer ${tok}`;
|
|
11
|
+
return h;
|
|
12
|
+
}
|
|
13
|
+
var fetch_issue_default = defineHandler({
|
|
14
|
+
async execute(ctx, input) {
|
|
15
|
+
const { owner, repo, issueNumber, token } = input;
|
|
16
|
+
const res = await ctx.runtime.fetch(
|
|
17
|
+
`https://api.github.com/repos/${owner}/${repo}/issues/${issueNumber}`,
|
|
18
|
+
{ headers: headers(token) }
|
|
19
|
+
);
|
|
20
|
+
if (!res.ok) throw new Error(`GitHub ${res.status}: ${await res.text()}`);
|
|
21
|
+
const issue = await res.json();
|
|
22
|
+
return {
|
|
23
|
+
number: issue.number,
|
|
24
|
+
title: issue.title,
|
|
25
|
+
body: issue.body ?? null,
|
|
26
|
+
state: issue.state,
|
|
27
|
+
url: issue.html_url,
|
|
28
|
+
labels: (issue.labels ?? []).map((l) => l.name),
|
|
29
|
+
author: issue.user?.login ?? ""
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export { fetch_issue_default as default };
|
|
35
|
+
//# sourceMappingURL=fetch-issue.js.map
|
|
36
|
+
//# sourceMappingURL=fetch-issue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/handlers/fetch-issue.ts"],"names":[],"mappings":";;;AAGA,SAAS,QAAQ,KAAA,EAAwC;AACvD,EAAA,MAAM,CAAA,GAA4B;AAAA,IAChC,MAAA,EAAQ,6BAAA;AAAA,IACR,sBAAA,EAAwB;AAAA,GAC1B;AACA,EAAA,MAAM,GAAA,GAAM,KAAA,IAAS,MAAA,CAAO,uBAAuB,CAAA;AACnD,EAAA,IAAI,GAAA,EAAK,CAAA,CAAE,aAAA,GAAgB,CAAA,OAAA,EAAU,GAAG,CAAA,CAAA;AACxC,EAAA,OAAO,CAAA;AACT;AAEA,IAAO,sBAAQ,aAAA,CAA0D;AAAA,EACvE,MAAM,OAAA,CAAQ,GAAA,EAAK,KAAA,EAAO;AACxB,IAAA,MAAM,EAAE,KAAA,EAAO,IAAA,EAAM,WAAA,EAAa,OAAM,GAAI,KAAA;AAE5C,IAAA,MAAM,GAAA,GAAM,MAAM,GAAA,CAAI,OAAA,CAAQ,KAAA;AAAA,MAC5B,CAAA,6BAAA,EAAgC,KAAK,CAAA,CAAA,EAAI,IAAI,WAAW,WAAW,CAAA,CAAA;AAAA,MACnE,EAAE,OAAA,EAAS,OAAA,CAAQ,KAAK,CAAA;AAAE,KAC5B;AACA,IAAA,IAAI,CAAC,GAAA,CAAI,EAAA,EAAI,MAAM,IAAI,KAAA,CAAM,CAAA,OAAA,EAAU,GAAA,CAAI,MAAM,CAAA,EAAA,EAAK,MAAM,GAAA,CAAI,IAAA,EAAM,CAAA,CAAE,CAAA;AAExE,IAAA,MAAM,KAAA,GAAQ,MAAM,GAAA,CAAI,IAAA,EAAK;AAC7B,IAAA,OAAO;AAAA,MACL,QAAQ,KAAA,CAAM,MAAA;AAAA,MACd,OAAO,KAAA,CAAM,KAAA;AAAA,MACb,IAAA,EAAO,MAAM,IAAA,IAAQ,IAAA;AAAA,MACrB,OAAO,KAAA,CAAM,KAAA;AAAA,MACb,KAAK,KAAA,CAAM,QAAA;AAAA,MACX,MAAA,EAAA,CAAU,MAAM,MAAA,IAAsC,IAAI,GAAA,CAAI,CAAC,CAAA,KAAM,CAAA,CAAE,IAAI,CAAA;AAAA,MAC3E,MAAA,EAAS,KAAA,CAAM,IAAA,EAA4B,KAAA,IAAS;AAAA,KACtD;AAAA,EACF;AACF,CAAC","file":"fetch-issue.js","sourcesContent":["import { defineHandler, useEnv } from '@kb-labs/sdk'\nimport type { FetchIssueInput, FetchIssueOutput } from '@kb-labs/github-contracts'\n\nfunction headers(token?: string): Record<string, string> {\n const h: Record<string, string> = {\n Accept: 'application/vnd.github+json',\n 'X-GitHub-Api-Version': '2022-11-28',\n }\n const tok = token ?? useEnv('GITHUB_WORKFLOW_TOKEN')\n if (tok) h.Authorization = `Bearer ${tok}`\n return h\n}\n\nexport default defineHandler<unknown, FetchIssueInput, FetchIssueOutput>({\n async execute(ctx, input) {\n const { owner, repo, issueNumber, token } = input\n\n const res = await ctx.runtime.fetch(\n `https://api.github.com/repos/${owner}/${repo}/issues/${issueNumber}`,\n { headers: headers(token) },\n )\n if (!res.ok) throw new Error(`GitHub ${res.status}: ${await res.text()}`)\n\n const issue = await res.json() as Record<string, unknown>\n return {\n number: issue.number as number,\n title: issue.title as string,\n body: (issue.body ?? null) as string | null,\n state: issue.state as string,\n url: issue.html_url as string,\n labels: ((issue.labels as Array<{ name: string }>) ?? []).map((l) => l.name),\n author: (issue.user as { login: string })?.login ?? '',\n }\n },\n})\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as _kb_labs_shared_command_kit from '@kb-labs/shared-command-kit';
|
|
2
|
+
|
|
3
|
+
declare const _default: _kb_labs_shared_command_kit.Handler<unknown, {
|
|
4
|
+
owner: string;
|
|
5
|
+
repo: string;
|
|
6
|
+
issueNumber: number;
|
|
7
|
+
body: string;
|
|
8
|
+
token?: string | undefined;
|
|
9
|
+
}, {
|
|
10
|
+
url: string;
|
|
11
|
+
commentId: number;
|
|
12
|
+
}>;
|
|
13
|
+
|
|
14
|
+
export { _default as default };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { defineHandler, useEnv } from '@kb-labs/sdk';
|
|
2
|
+
|
|
3
|
+
// src/handlers/post-comment.ts
|
|
4
|
+
function headers(token) {
|
|
5
|
+
const h = {
|
|
6
|
+
Accept: "application/vnd.github+json",
|
|
7
|
+
"Content-Type": "application/json",
|
|
8
|
+
"X-GitHub-Api-Version": "2022-11-28"
|
|
9
|
+
};
|
|
10
|
+
const tok = token ?? useEnv("GITHUB_WORKFLOW_TOKEN");
|
|
11
|
+
if (tok) h.Authorization = `Bearer ${tok}`;
|
|
12
|
+
return h;
|
|
13
|
+
}
|
|
14
|
+
var post_comment_default = defineHandler({
|
|
15
|
+
async execute(ctx, input) {
|
|
16
|
+
const { owner, repo, issueNumber, body, token } = input;
|
|
17
|
+
const res = await ctx.runtime.fetch(
|
|
18
|
+
`https://api.github.com/repos/${owner}/${repo}/issues/${issueNumber}/comments`,
|
|
19
|
+
{ method: "POST", headers: headers(token), body: JSON.stringify({ body }) }
|
|
20
|
+
);
|
|
21
|
+
if (!res.ok) throw new Error(`GitHub ${res.status}: ${await res.text()}`);
|
|
22
|
+
const comment = await res.json();
|
|
23
|
+
return {
|
|
24
|
+
commentId: comment.id,
|
|
25
|
+
url: comment.html_url
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export { post_comment_default as default };
|
|
31
|
+
//# sourceMappingURL=post-comment.js.map
|
|
32
|
+
//# sourceMappingURL=post-comment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/handlers/post-comment.ts"],"names":[],"mappings":";;;AAGA,SAAS,QAAQ,KAAA,EAAwC;AACvD,EAAA,MAAM,CAAA,GAA4B;AAAA,IAChC,MAAA,EAAQ,6BAAA;AAAA,IACR,cAAA,EAAgB,kBAAA;AAAA,IAChB,sBAAA,EAAwB;AAAA,GAC1B;AACA,EAAA,MAAM,GAAA,GAAM,KAAA,IAAS,MAAA,CAAO,uBAAuB,CAAA;AACnD,EAAA,IAAI,GAAA,EAAK,CAAA,CAAE,aAAA,GAAgB,CAAA,OAAA,EAAU,GAAG,CAAA,CAAA;AACxC,EAAA,OAAO,CAAA;AACT;AAEA,IAAO,uBAAQ,aAAA,CAA4D;AAAA,EACzE,MAAM,OAAA,CAAQ,GAAA,EAAK,KAAA,EAAO;AACxB,IAAA,MAAM,EAAE,KAAA,EAAO,IAAA,EAAM,WAAA,EAAa,IAAA,EAAM,OAAM,GAAI,KAAA;AAElD,IAAA,MAAM,GAAA,GAAM,MAAM,GAAA,CAAI,OAAA,CAAQ,KAAA;AAAA,MAC5B,CAAA,6BAAA,EAAgC,KAAK,CAAA,CAAA,EAAI,IAAI,WAAW,WAAW,CAAA,SAAA,CAAA;AAAA,MACnE,EAAE,MAAA,EAAQ,MAAA,EAAQ,OAAA,EAAS,OAAA,CAAQ,KAAK,CAAA,EAAG,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,EAAE,IAAA,EAAM,CAAA;AAAE,KAC5E;AACA,IAAA,IAAI,CAAC,GAAA,CAAI,EAAA,EAAI,MAAM,IAAI,KAAA,CAAM,CAAA,OAAA,EAAU,GAAA,CAAI,MAAM,CAAA,EAAA,EAAK,MAAM,GAAA,CAAI,IAAA,EAAM,CAAA,CAAE,CAAA;AAExE,IAAA,MAAM,OAAA,GAAU,MAAM,GAAA,CAAI,IAAA,EAAK;AAC/B,IAAA,OAAO;AAAA,MACL,WAAW,OAAA,CAAQ,EAAA;AAAA,MACnB,KAAK,OAAA,CAAQ;AAAA,KACf;AAAA,EACF;AACF,CAAC","file":"post-comment.js","sourcesContent":["import { defineHandler, useEnv } from '@kb-labs/sdk'\nimport type { PostCommentInput, PostCommentOutput } from '@kb-labs/github-contracts'\n\nfunction headers(token?: string): Record<string, string> {\n const h: Record<string, string> = {\n Accept: 'application/vnd.github+json',\n 'Content-Type': 'application/json',\n 'X-GitHub-Api-Version': '2022-11-28',\n }\n const tok = token ?? useEnv('GITHUB_WORKFLOW_TOKEN')\n if (tok) h.Authorization = `Bearer ${tok}`\n return h\n}\n\nexport default defineHandler<unknown, PostCommentInput, PostCommentOutput>({\n async execute(ctx, input) {\n const { owner, repo, issueNumber, body, token } = input\n\n const res = await ctx.runtime.fetch(\n `https://api.github.com/repos/${owner}/${repo}/issues/${issueNumber}/comments`,\n { method: 'POST', headers: headers(token), body: JSON.stringify({ body }) },\n )\n if (!res.ok) throw new Error(`GitHub ${res.status}: ${await res.text()}`)\n\n const comment = await res.json() as Record<string, unknown>\n return {\n commentId: comment.id as number,\n url: comment.html_url as string,\n }\n },\n})\n"]}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { combinePermissions, kbPlatformPreset } from '@kb-labs/sdk';
|
|
2
|
+
|
|
3
|
+
// src/manifest.ts
|
|
4
|
+
var permissions = combinePermissions().with(kbPlatformPreset).with({
|
|
5
|
+
network: {
|
|
6
|
+
fetch: ["https://api.github.com/*"]
|
|
7
|
+
},
|
|
8
|
+
env: {
|
|
9
|
+
read: ["GITHUB_WORKFLOW_TOKEN"]
|
|
10
|
+
}
|
|
11
|
+
}).build();
|
|
12
|
+
var manifest = {
|
|
13
|
+
schema: "kb.plugin/3",
|
|
14
|
+
id: "@kb-labs/github",
|
|
15
|
+
version: "0.1.0",
|
|
16
|
+
display: {
|
|
17
|
+
name: "GitHub",
|
|
18
|
+
description: "GitHub integration \u2014 fetch issues, post comments, create branches and PRs",
|
|
19
|
+
tags: ["github", "integration", "workflow"]
|
|
20
|
+
},
|
|
21
|
+
platform: { requires: [], optional: [] },
|
|
22
|
+
workflows: {
|
|
23
|
+
handlers: [
|
|
24
|
+
{
|
|
25
|
+
id: "fetch-issue",
|
|
26
|
+
handler: "./dist/handlers/fetch-issue.js#default",
|
|
27
|
+
describe: "Fetch a GitHub issue by number"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: "post-comment",
|
|
31
|
+
handler: "./dist/handlers/post-comment.js#default",
|
|
32
|
+
describe: "Post a comment on a GitHub issue or PR"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: "create-branch",
|
|
36
|
+
handler: "./dist/handlers/create-branch.js#default",
|
|
37
|
+
describe: "Create a new branch from a base branch"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: "create-pr",
|
|
41
|
+
handler: "./dist/handlers/create-pr.js#default",
|
|
42
|
+
describe: "Create a pull request and optionally link it to an issue"
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var manifest_default = { ...manifest, permissions };
|
|
48
|
+
|
|
49
|
+
export { manifest_default as manifest };
|
|
50
|
+
//# sourceMappingURL=index.js.map
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/manifest.ts"],"names":[],"mappings":";;;AAEA,IAAM,cAAc,kBAAA,EAAmB,CACpC,IAAA,CAAK,gBAAgB,EACrB,IAAA,CAAK;AAAA,EACJ,OAAA,EAAS;AAAA,IACP,KAAA,EAAO,CAAC,0BAA0B;AAAA,GACpC;AAAA,EACA,GAAA,EAAK;AAAA,IACH,IAAA,EAAM,CAAC,uBAAuB;AAAA;AAElC,CAAC,EACA,KAAA,EAAM;AAET,IAAM,QAAA,GAAW;AAAA,EACf,MAAA,EAAQ,aAAA;AAAA,EACR,EAAA,EAAI,iBAAA;AAAA,EACJ,OAAA,EAAS,OAAA;AAAA,EACT,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,QAAA;AAAA,IACN,WAAA,EAAa,gFAAA;AAAA,IACb,IAAA,EAAM,CAAC,QAAA,EAAU,aAAA,EAAe,UAAU;AAAA,GAC5C;AAAA,EACA,UAAU,EAAE,QAAA,EAAU,EAAC,EAAG,QAAA,EAAU,EAAC,EAAE;AAAA,EACvC,SAAA,EAAW;AAAA,IACT,QAAA,EAAU;AAAA,MACR;AAAA,QACE,EAAA,EAAI,aAAA;AAAA,QACJ,OAAA,EAAS,wCAAA;AAAA,QACT,QAAA,EAAU;AAAA,OACZ;AAAA,MACA;AAAA,QACE,EAAA,EAAI,cAAA;AAAA,QACJ,OAAA,EAAS,yCAAA;AAAA,QACT,QAAA,EAAU;AAAA,OACZ;AAAA,MACA;AAAA,QACE,EAAA,EAAI,eAAA;AAAA,QACJ,OAAA,EAAS,0CAAA;AAAA,QACT,QAAA,EAAU;AAAA,OACZ;AAAA,MACA;AAAA,QACE,EAAA,EAAI,WAAA;AAAA,QACJ,OAAA,EAAS,sCAAA;AAAA,QACT,QAAA,EAAU;AAAA;AACZ;AACF;AAEJ,CAAA;AAEA,IAAO,gBAAA,GAAQ,EAAE,GAAG,QAAA,EAAU,WAAA","file":"index.js","sourcesContent":["import { combinePermissions, kbPlatformPreset } from '@kb-labs/sdk'\n\nconst permissions = combinePermissions()\n .with(kbPlatformPreset)\n .with({\n network: {\n fetch: ['https://api.github.com/*'],\n },\n env: {\n read: ['GITHUB_WORKFLOW_TOKEN'],\n },\n })\n .build()\n\nconst manifest = {\n schema: 'kb.plugin/3',\n id: '@kb-labs/github',\n version: '0.1.0',\n display: {\n name: 'GitHub',\n description: 'GitHub integration — fetch issues, post comments, create branches and PRs',\n tags: ['github', 'integration', 'workflow'],\n },\n platform: { requires: [], optional: [] },\n workflows: {\n handlers: [\n {\n id: 'fetch-issue',\n handler: './dist/handlers/fetch-issue.js#default',\n describe: 'Fetch a GitHub issue by number',\n },\n {\n id: 'post-comment',\n handler: './dist/handlers/post-comment.js#default',\n describe: 'Post a comment on a GitHub issue or PR',\n },\n {\n id: 'create-branch',\n handler: './dist/handlers/create-branch.js#default',\n describe: 'Create a new branch from a base branch',\n },\n {\n id: 'create-pr',\n handler: './dist/handlers/create-pr.js#default',\n describe: 'Create a pull request and optionally link it to an issue',\n },\n ],\n },\n} as const\n\nexport default { ...manifest, permissions }\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as _kb_labs_perm_presets from '@kb-labs/perm-presets';
|
|
2
|
+
|
|
3
|
+
declare const _default: {
|
|
4
|
+
permissions: _kb_labs_perm_presets.RuntimePermissionSpec;
|
|
5
|
+
schema: "kb.plugin/3";
|
|
6
|
+
id: "@kb-labs/github";
|
|
7
|
+
version: "0.1.0";
|
|
8
|
+
display: {
|
|
9
|
+
readonly name: "GitHub";
|
|
10
|
+
readonly description: "GitHub integration — fetch issues, post comments, create branches and PRs";
|
|
11
|
+
readonly tags: readonly ["github", "integration", "workflow"];
|
|
12
|
+
};
|
|
13
|
+
platform: {
|
|
14
|
+
readonly requires: readonly [];
|
|
15
|
+
readonly optional: readonly [];
|
|
16
|
+
};
|
|
17
|
+
workflows: {
|
|
18
|
+
readonly handlers: readonly [{
|
|
19
|
+
readonly id: "fetch-issue";
|
|
20
|
+
readonly handler: "./dist/handlers/fetch-issue.js#default";
|
|
21
|
+
readonly describe: "Fetch a GitHub issue by number";
|
|
22
|
+
}, {
|
|
23
|
+
readonly id: "post-comment";
|
|
24
|
+
readonly handler: "./dist/handlers/post-comment.js#default";
|
|
25
|
+
readonly describe: "Post a comment on a GitHub issue or PR";
|
|
26
|
+
}, {
|
|
27
|
+
readonly id: "create-branch";
|
|
28
|
+
readonly handler: "./dist/handlers/create-branch.js#default";
|
|
29
|
+
readonly describe: "Create a new branch from a base branch";
|
|
30
|
+
}, {
|
|
31
|
+
readonly id: "create-pr";
|
|
32
|
+
readonly handler: "./dist/handlers/create-pr.js#default";
|
|
33
|
+
readonly describe: "Create a pull request and optionally link it to an issue";
|
|
34
|
+
}];
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { _default as default };
|
package/dist/manifest.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { combinePermissions, kbPlatformPreset } from '@kb-labs/sdk';
|
|
2
|
+
|
|
3
|
+
// src/manifest.ts
|
|
4
|
+
var permissions = combinePermissions().with(kbPlatformPreset).with({
|
|
5
|
+
network: {
|
|
6
|
+
fetch: ["https://api.github.com/*"]
|
|
7
|
+
},
|
|
8
|
+
env: {
|
|
9
|
+
read: ["GITHUB_WORKFLOW_TOKEN"]
|
|
10
|
+
}
|
|
11
|
+
}).build();
|
|
12
|
+
var manifest = {
|
|
13
|
+
schema: "kb.plugin/3",
|
|
14
|
+
id: "@kb-labs/github",
|
|
15
|
+
version: "0.1.0",
|
|
16
|
+
display: {
|
|
17
|
+
name: "GitHub",
|
|
18
|
+
description: "GitHub integration \u2014 fetch issues, post comments, create branches and PRs",
|
|
19
|
+
tags: ["github", "integration", "workflow"]
|
|
20
|
+
},
|
|
21
|
+
platform: { requires: [], optional: [] },
|
|
22
|
+
workflows: {
|
|
23
|
+
handlers: [
|
|
24
|
+
{
|
|
25
|
+
id: "fetch-issue",
|
|
26
|
+
handler: "./dist/handlers/fetch-issue.js#default",
|
|
27
|
+
describe: "Fetch a GitHub issue by number"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: "post-comment",
|
|
31
|
+
handler: "./dist/handlers/post-comment.js#default",
|
|
32
|
+
describe: "Post a comment on a GitHub issue or PR"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: "create-branch",
|
|
36
|
+
handler: "./dist/handlers/create-branch.js#default",
|
|
37
|
+
describe: "Create a new branch from a base branch"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: "create-pr",
|
|
41
|
+
handler: "./dist/handlers/create-pr.js#default",
|
|
42
|
+
describe: "Create a pull request and optionally link it to an issue"
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var manifest_default = { ...manifest, permissions };
|
|
48
|
+
|
|
49
|
+
export { manifest_default as default };
|
|
50
|
+
//# sourceMappingURL=manifest.js.map
|
|
51
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/manifest.ts"],"names":[],"mappings":";;;AAEA,IAAM,cAAc,kBAAA,EAAmB,CACpC,IAAA,CAAK,gBAAgB,EACrB,IAAA,CAAK;AAAA,EACJ,OAAA,EAAS;AAAA,IACP,KAAA,EAAO,CAAC,0BAA0B;AAAA,GACpC;AAAA,EACA,GAAA,EAAK;AAAA,IACH,IAAA,EAAM,CAAC,uBAAuB;AAAA;AAElC,CAAC,EACA,KAAA,EAAM;AAET,IAAM,QAAA,GAAW;AAAA,EACf,MAAA,EAAQ,aAAA;AAAA,EACR,EAAA,EAAI,iBAAA;AAAA,EACJ,OAAA,EAAS,OAAA;AAAA,EACT,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,QAAA;AAAA,IACN,WAAA,EAAa,gFAAA;AAAA,IACb,IAAA,EAAM,CAAC,QAAA,EAAU,aAAA,EAAe,UAAU;AAAA,GAC5C;AAAA,EACA,UAAU,EAAE,QAAA,EAAU,EAAC,EAAG,QAAA,EAAU,EAAC,EAAE;AAAA,EACvC,SAAA,EAAW;AAAA,IACT,QAAA,EAAU;AAAA,MACR;AAAA,QACE,EAAA,EAAI,aAAA;AAAA,QACJ,OAAA,EAAS,wCAAA;AAAA,QACT,QAAA,EAAU;AAAA,OACZ;AAAA,MACA;AAAA,QACE,EAAA,EAAI,cAAA;AAAA,QACJ,OAAA,EAAS,yCAAA;AAAA,QACT,QAAA,EAAU;AAAA,OACZ;AAAA,MACA;AAAA,QACE,EAAA,EAAI,eAAA;AAAA,QACJ,OAAA,EAAS,0CAAA;AAAA,QACT,QAAA,EAAU;AAAA,OACZ;AAAA,MACA;AAAA,QACE,EAAA,EAAI,WAAA;AAAA,QACJ,OAAA,EAAS,sCAAA;AAAA,QACT,QAAA,EAAU;AAAA;AACZ;AACF;AAEJ,CAAA;AAEA,IAAO,gBAAA,GAAQ,EAAE,GAAG,QAAA,EAAU,WAAA","file":"manifest.js","sourcesContent":["import { combinePermissions, kbPlatformPreset } from '@kb-labs/sdk'\n\nconst permissions = combinePermissions()\n .with(kbPlatformPreset)\n .with({\n network: {\n fetch: ['https://api.github.com/*'],\n },\n env: {\n read: ['GITHUB_WORKFLOW_TOKEN'],\n },\n })\n .build()\n\nconst manifest = {\n schema: 'kb.plugin/3',\n id: '@kb-labs/github',\n version: '0.1.0',\n display: {\n name: 'GitHub',\n description: 'GitHub integration — fetch issues, post comments, create branches and PRs',\n tags: ['github', 'integration', 'workflow'],\n },\n platform: { requires: [], optional: [] },\n workflows: {\n handlers: [\n {\n id: 'fetch-issue',\n handler: './dist/handlers/fetch-issue.js#default',\n describe: 'Fetch a GitHub issue by number',\n },\n {\n id: 'post-comment',\n handler: './dist/handlers/post-comment.js#default',\n describe: 'Post a comment on a GitHub issue or PR',\n },\n {\n id: 'create-branch',\n handler: './dist/handlers/create-branch.js#default',\n describe: 'Create a new branch from a base branch',\n },\n {\n id: 'create-pr',\n handler: './dist/handlers/create-pr.js#default',\n describe: 'Create a pull request and optionally link it to an issue',\n },\n ],\n },\n} as const\n\nexport default { ...manifest, permissions }\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kb-labs/github-entry",
|
|
3
|
+
"version": "2.93.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Manifest and workflow handlers for the GitHub plugin",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./plugin-manifest": {
|
|
14
|
+
"types": "./dist/manifest.d.ts",
|
|
15
|
+
"import": "./dist/manifest.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"kb": {
|
|
19
|
+
"manifest": "./dist/manifest.js"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"sideEffects": false,
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@kb-labs/sdk": "2.21.2",
|
|
27
|
+
"@kb-labs/github-contracts": "2.93.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "^24.3.3",
|
|
31
|
+
"rimraf": "^6.0.1",
|
|
32
|
+
"tsup": "^8.5.0",
|
|
33
|
+
"typescript": "^5.6.3",
|
|
34
|
+
"vitest": "^3.2.4",
|
|
35
|
+
"@kb-labs/devkit": "2.93.0"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsup --config tsup.config.ts",
|
|
39
|
+
"clean": "rimraf dist",
|
|
40
|
+
"type-check": "tsc --noEmit",
|
|
41
|
+
"test": "vitest run --passWithNoTests"
|
|
42
|
+
}
|
|
43
|
+
}
|