@kb-labs/github-entry 2.93.0 → 2.96.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/README.md +5 -0
- package/dist/handlers/create-branch.js +44 -38
- package/dist/handlers/create-branch.js.map +1 -1
- package/dist/handlers/create-pr.js +28 -24
- package/dist/handlers/create-pr.js.map +1 -1
- package/dist/handlers/fetch-issue.js +21 -17
- package/dist/handlers/fetch-issue.js.map +1 -1
- package/dist/handlers/post-comment.js +16 -12
- package/dist/handlers/post-comment.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/manifest.d.ts +11 -11
- package/dist/manifest.js +6 -5
- package/dist/manifest.js.map +1 -1
- package/package.json +13 -5
package/README.md
ADDED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineHandler, useEnv } from '@kb-labs/sdk';
|
|
1
|
+
import { defineHandler, rethrowForRest, useEnv } from '@kb-labs/sdk';
|
|
2
2
|
|
|
3
3
|
// src/handlers/create-branch.ts
|
|
4
4
|
function headers(token) {
|
|
@@ -13,45 +13,51 @@ function headers(token) {
|
|
|
13
13
|
}
|
|
14
14
|
var create_branch_default = defineHandler({
|
|
15
15
|
async execute(ctx, input) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
16
|
+
try {
|
|
17
|
+
const { owner, repo, branchName, fromBranch = "main", token } = input;
|
|
18
|
+
const hdrs = headers(token);
|
|
19
|
+
const refRes = await ctx.runtime.fetch(
|
|
20
|
+
`https://api.github.com/repos/${owner}/${repo}/git/ref/heads/${fromBranch}`,
|
|
21
|
+
{ headers: hdrs }
|
|
22
|
+
);
|
|
23
|
+
if (!refRes.ok) throw new Error(`GitHub ${refRes.status}: ${await refRes.text()}`);
|
|
24
|
+
const ref = await refRes.json();
|
|
25
|
+
const sha = ref.object.sha;
|
|
26
|
+
const createRes = await ctx.runtime.fetch(
|
|
27
|
+
`https://api.github.com/repos/${owner}/${repo}/git/refs`,
|
|
28
|
+
{
|
|
29
|
+
method: "POST",
|
|
30
|
+
headers: hdrs,
|
|
31
|
+
body: JSON.stringify({ ref: `refs/heads/${branchName}`, sha })
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
if (!createRes.ok) {
|
|
35
|
+
if (createRes.status === 422) {
|
|
36
|
+
const patchRes = await ctx.runtime.fetch(
|
|
37
|
+
`https://api.github.com/repos/${owner}/${repo}/git/refs/heads/${branchName}`,
|
|
38
|
+
{
|
|
39
|
+
method: "PATCH",
|
|
40
|
+
headers: hdrs,
|
|
41
|
+
body: JSON.stringify({ sha, force: true })
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
if (!patchRes.ok) throw new Error(`GitHub ${patchRes.status}: ${await patchRes.text()}`);
|
|
45
|
+
return {
|
|
46
|
+
branchName,
|
|
47
|
+
sha,
|
|
48
|
+
url: `https://github.com/${owner}/${repo}/tree/${branchName}`
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
throw new Error(`GitHub ${createRes.status}: ${await createRes.text()}`);
|
|
31
52
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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()}`);
|
|
53
|
+
return {
|
|
54
|
+
branchName,
|
|
55
|
+
sha,
|
|
56
|
+
url: `https://github.com/${owner}/${repo}/tree/${branchName}`
|
|
57
|
+
};
|
|
58
|
+
} catch (err) {
|
|
59
|
+
rethrowForRest(err);
|
|
49
60
|
}
|
|
50
|
-
return {
|
|
51
|
-
branchName,
|
|
52
|
-
sha,
|
|
53
|
-
url: `https://github.com/${owner}/${repo}/tree/${branchName}`
|
|
54
|
-
};
|
|
55
61
|
}
|
|
56
62
|
});
|
|
57
63
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/handlers/create-branch.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,wBAAQ,aAAA,CAA8D;AAAA,EAC3E,MAAM,OAAA,CAAQ,GAAA,EAAK,KAAA,EAAO;AACxB,IAAA,MAAM,EAAE,KAAA,EAAO,IAAA,EAAM,YAAY,UAAA,GAAa,MAAA,EAAQ,OAAM,GAAI,KAAA;AAChE,
|
|
1
|
+
{"version":3,"sources":["../../src/handlers/create-branch.ts"],"names":[],"mappings":"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","file":"create-branch.js","sourcesContent":["import { defineHandler, rethrowForRest, 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 try {\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 — force-reset it to fromBranch SHA so the\n // new run starts clean without contamination from previous runs.\n const patchRes = await ctx.runtime.fetch(\n `https://api.github.com/repos/${owner}/${repo}/git/refs/heads/${branchName}`,\n {\n method: 'PATCH',\n headers: hdrs,\n body: JSON.stringify({ sha, force: true }),\n },\n )\n if (!patchRes.ok) throw new Error(`GitHub ${patchRes.status}: ${await patchRes.text()}`)\n return {\n branchName,\n sha,\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 } catch (err) {\n rethrowForRest(err)\n }\n },\n})\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineHandler, useEnv } from '@kb-labs/sdk';
|
|
1
|
+
import { defineHandler, rethrowForRest, useEnv } from '@kb-labs/sdk';
|
|
2
2
|
|
|
3
3
|
// src/handlers/create-pr.ts
|
|
4
4
|
function headers(token) {
|
|
@@ -13,33 +13,37 @@ function headers(token) {
|
|
|
13
13
|
}
|
|
14
14
|
var create_pr_default = defineHandler({
|
|
15
15
|
async execute(ctx, input) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
try {
|
|
17
|
+
const { owner, repo, title, body = "", head, base = "main", issueNumber, labels = [], token } = input;
|
|
18
|
+
const hdrs = headers(token);
|
|
19
|
+
const prBody = issueNumber ? `${body}
|
|
19
20
|
|
|
20
21
|
Closes #${issueNumber}` : body;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
const prRes = await ctx.runtime.fetch(
|
|
23
|
+
`https://api.github.com/repos/${owner}/${repo}/pulls`,
|
|
24
|
+
{
|
|
25
|
+
method: "POST",
|
|
26
|
+
headers: hdrs,
|
|
27
|
+
body: JSON.stringify({ title, body: prBody, head, base })
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
if (!prRes.ok) throw new Error(`GitHub ${prRes.status}: ${await prRes.text()}`);
|
|
31
|
+
const pr = await prRes.json();
|
|
32
|
+
const prNumber = pr.number;
|
|
33
|
+
if (labels.length > 0) {
|
|
34
|
+
await ctx.runtime.fetch(
|
|
35
|
+
`https://api.github.com/repos/${owner}/${repo}/issues/${prNumber}/labels`,
|
|
36
|
+
{ method: "POST", headers: hdrs, body: JSON.stringify({ labels }) }
|
|
37
|
+
).catch(() => void 0);
|
|
27
38
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
{ method: "POST", headers: hdrs, body: JSON.stringify({ labels }) }
|
|
36
|
-
).catch(() => void 0);
|
|
39
|
+
return {
|
|
40
|
+
prNumber,
|
|
41
|
+
url: pr.html_url,
|
|
42
|
+
title: pr.title
|
|
43
|
+
};
|
|
44
|
+
} catch (err) {
|
|
45
|
+
rethrowForRest(err);
|
|
37
46
|
}
|
|
38
|
-
return {
|
|
39
|
-
prNumber,
|
|
40
|
-
url: pr.html_url,
|
|
41
|
-
title: pr.title
|
|
42
|
-
};
|
|
43
47
|
}
|
|
44
48
|
});
|
|
45
49
|
|
|
@@ -1 +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,
|
|
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,IAAI;AACF,MAAA,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,MAAA,MAAM,IAAA,GAAO,QAAQ,KAAK,CAAA;AAE1B,MAAA,MAAM,MAAA,GAAS,WAAA,GAAc,CAAA,EAAG,IAAI;;AAAA,QAAA,EAAe,WAAW,CAAA,CAAA,GAAK,IAAA;AAEnE,MAAA,MAAM,KAAA,GAAQ,MAAM,GAAA,CAAI,OAAA,CAAQ,KAAA;AAAA,QAC9B,CAAA,6BAAA,EAAgC,KAAK,CAAA,CAAA,EAAI,IAAI,CAAA,MAAA,CAAA;AAAA,QAC7C;AAAA,UACE,MAAA,EAAQ,MAAA;AAAA,UACR,OAAA,EAAS,IAAA;AAAA,UACT,IAAA,EAAM,KAAK,SAAA,CAAU,EAAE,OAAO,IAAA,EAAM,MAAA,EAAQ,IAAA,EAAM,IAAA,EAAM;AAAA;AAC1D,OACF;AACA,MAAA,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,MAAA,MAAM,EAAA,GAAK,MAAM,KAAA,CAAM,IAAA,EAAK;AAC5B,MAAA,MAAM,WAAW,EAAA,CAAG,MAAA;AAGpB,MAAA,IAAI,MAAA,CAAO,SAAS,CAAA,EAAG;AACrB,QAAA,MAAM,IAAI,OAAA,CAAQ,KAAA;AAAA,UAChB,CAAA,6BAAA,EAAgC,KAAK,CAAA,CAAA,EAAI,IAAI,WAAW,QAAQ,CAAA,OAAA,CAAA;AAAA,UAChE,EAAE,MAAA,EAAQ,MAAA,EAAQ,OAAA,EAAS,IAAA,EAAM,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,EAAE,MAAA,EAAQ,CAAA;AAAE,SACpE,CAAE,KAAA,CAAM,MAAM,KAAA,CAAS,CAAA;AAAA,MACzB;AAEA,MAAA,OAAO;AAAA,QACL,QAAA;AAAA,QACA,KAAK,EAAA,CAAG,QAAA;AAAA,QACR,OAAO,EAAA,CAAG;AAAA,OACZ;AAAA,IACF,SAAS,GAAA,EAAK;AACZ,MAAA,cAAA,CAAe,GAAG,CAAA;AAAA,IACpB;AAAA,EACF;AACF,CAAC","file":"create-pr.js","sourcesContent":["import { defineHandler, rethrowForRest, 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 try {\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 } catch (err) {\n rethrowForRest(err)\n }\n },\n})\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineHandler, useEnv } from '@kb-labs/sdk';
|
|
1
|
+
import { defineHandler, rethrowForRest, useEnv } from '@kb-labs/sdk';
|
|
2
2
|
|
|
3
3
|
// src/handlers/fetch-issue.ts
|
|
4
4
|
function headers(token) {
|
|
@@ -12,22 +12,26 @@ function headers(token) {
|
|
|
12
12
|
}
|
|
13
13
|
var fetch_issue_default = defineHandler({
|
|
14
14
|
async execute(ctx, input) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
15
|
+
try {
|
|
16
|
+
const { owner, repo, issueNumber, token } = input;
|
|
17
|
+
const res = await ctx.runtime.fetch(
|
|
18
|
+
`https://api.github.com/repos/${owner}/${repo}/issues/${issueNumber}`,
|
|
19
|
+
{ headers: headers(token) }
|
|
20
|
+
);
|
|
21
|
+
if (!res.ok) throw new Error(`GitHub ${res.status}: ${await res.text()}`);
|
|
22
|
+
const issue = await res.json();
|
|
23
|
+
return {
|
|
24
|
+
number: issue.number,
|
|
25
|
+
title: issue.title,
|
|
26
|
+
body: issue.body ?? null,
|
|
27
|
+
state: issue.state,
|
|
28
|
+
url: issue.html_url,
|
|
29
|
+
labels: (issue.labels ?? []).map((l) => l.name),
|
|
30
|
+
author: issue.user?.login ?? ""
|
|
31
|
+
};
|
|
32
|
+
} catch (err) {
|
|
33
|
+
rethrowForRest(err);
|
|
34
|
+
}
|
|
31
35
|
}
|
|
32
36
|
});
|
|
33
37
|
|
|
@@ -1 +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,
|
|
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,IAAI;AACF,MAAA,MAAM,EAAE,KAAA,EAAO,IAAA,EAAM,WAAA,EAAa,OAAM,GAAI,KAAA;AAE5C,MAAA,MAAM,GAAA,GAAM,MAAM,GAAA,CAAI,OAAA,CAAQ,KAAA;AAAA,QAC5B,CAAA,6BAAA,EAAgC,KAAK,CAAA,CAAA,EAAI,IAAI,WAAW,WAAW,CAAA,CAAA;AAAA,QACnE,EAAE,OAAA,EAAS,OAAA,CAAQ,KAAK,CAAA;AAAE,OAC5B;AACA,MAAA,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,MAAA,MAAM,KAAA,GAAQ,MAAM,GAAA,CAAI,IAAA,EAAK;AAC7B,MAAA,OAAO;AAAA,QACL,QAAQ,KAAA,CAAM,MAAA;AAAA,QACd,OAAO,KAAA,CAAM,KAAA;AAAA,QACb,IAAA,EAAO,MAAM,IAAA,IAAQ,IAAA;AAAA,QACrB,OAAO,KAAA,CAAM,KAAA;AAAA,QACb,KAAK,KAAA,CAAM,QAAA;AAAA,QACX,MAAA,EAAA,CAAU,MAAM,MAAA,IAAsC,IAAI,GAAA,CAAI,CAAC,CAAA,KAAM,CAAA,CAAE,IAAI,CAAA;AAAA,QAC3E,MAAA,EAAS,KAAA,CAAM,IAAA,EAA4B,KAAA,IAAS;AAAA,OACtD;AAAA,IACF,SAAS,GAAA,EAAK;AACZ,MAAA,cAAA,CAAe,GAAG,CAAA;AAAA,IACpB;AAAA,EACF;AACF,CAAC","file":"fetch-issue.js","sourcesContent":["import { defineHandler, rethrowForRest, 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 try {\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 } catch (err) {\n rethrowForRest(err)\n }\n },\n})\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineHandler, useEnv } from '@kb-labs/sdk';
|
|
1
|
+
import { defineHandler, rethrowForRest, useEnv } from '@kb-labs/sdk';
|
|
2
2
|
|
|
3
3
|
// src/handlers/post-comment.ts
|
|
4
4
|
function headers(token) {
|
|
@@ -13,17 +13,21 @@ function headers(token) {
|
|
|
13
13
|
}
|
|
14
14
|
var post_comment_default = defineHandler({
|
|
15
15
|
async execute(ctx, input) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
try {
|
|
17
|
+
const { owner, repo, issueNumber, body, token } = input;
|
|
18
|
+
const res = await ctx.runtime.fetch(
|
|
19
|
+
`https://api.github.com/repos/${owner}/${repo}/issues/${issueNumber}/comments`,
|
|
20
|
+
{ method: "POST", headers: headers(token), body: JSON.stringify({ body }) }
|
|
21
|
+
);
|
|
22
|
+
if (!res.ok) throw new Error(`GitHub ${res.status}: ${await res.text()}`);
|
|
23
|
+
const comment = await res.json();
|
|
24
|
+
return {
|
|
25
|
+
commentId: comment.id,
|
|
26
|
+
url: comment.html_url
|
|
27
|
+
};
|
|
28
|
+
} catch (err) {
|
|
29
|
+
rethrowForRest(err);
|
|
30
|
+
}
|
|
27
31
|
}
|
|
28
32
|
});
|
|
29
33
|
|
|
@@ -1 +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,
|
|
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,IAAI;AACF,MAAA,MAAM,EAAE,KAAA,EAAO,IAAA,EAAM,WAAA,EAAa,IAAA,EAAM,OAAM,GAAI,KAAA;AAElD,MAAA,MAAM,GAAA,GAAM,MAAM,GAAA,CAAI,OAAA,CAAQ,KAAA;AAAA,QAC5B,CAAA,6BAAA,EAAgC,KAAK,CAAA,CAAA,EAAI,IAAI,WAAW,WAAW,CAAA,SAAA,CAAA;AAAA,QACnE,EAAE,MAAA,EAAQ,MAAA,EAAQ,OAAA,EAAS,OAAA,CAAQ,KAAK,CAAA,EAAG,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,EAAE,IAAA,EAAM,CAAA;AAAE,OAC5E;AACA,MAAA,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,MAAA,MAAM,OAAA,GAAU,MAAM,GAAA,CAAI,IAAA,EAAK;AAC/B,MAAA,OAAO;AAAA,QACL,WAAW,OAAA,CAAQ,EAAA;AAAA,QACnB,KAAK,OAAA,CAAQ;AAAA,OACf;AAAA,IACF,SAAS,GAAA,EAAK;AACZ,MAAA,cAAA,CAAe,GAAG,CAAA;AAAA,IACpB;AAAA,EACF;AACF,CAAC","file":"post-comment.js","sourcesContent":["import { defineHandler, rethrowForRest, 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 try {\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 } catch (err) {\n rethrowForRest(err)\n }\n },\n})\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as manifest } from './manifest.js';
|
|
2
|
-
import '@kb-labs/
|
|
2
|
+
import '@kb-labs/plugin-contracts';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { combinePermissions, kbPlatformPreset } from '@kb-labs/sdk';
|
|
2
2
|
|
|
3
3
|
// src/manifest.ts
|
|
4
|
-
var
|
|
4
|
+
var pluginPermissions = combinePermissions().with(kbPlatformPreset).with({
|
|
5
5
|
network: {
|
|
6
6
|
fetch: ["https://api.github.com/*"]
|
|
7
7
|
},
|
|
@@ -15,7 +15,7 @@ var manifest = {
|
|
|
15
15
|
version: "0.1.0",
|
|
16
16
|
display: {
|
|
17
17
|
name: "GitHub",
|
|
18
|
-
description: "GitHub integration
|
|
18
|
+
description: "GitHub integration for issues, PRs, and branches",
|
|
19
19
|
tags: ["github", "integration", "workflow"]
|
|
20
20
|
},
|
|
21
21
|
platform: { requires: [], optional: [] },
|
|
@@ -42,9 +42,10 @@ var manifest = {
|
|
|
42
42
|
describe: "Create a pull request and optionally link it to an issue"
|
|
43
43
|
}
|
|
44
44
|
]
|
|
45
|
-
}
|
|
45
|
+
},
|
|
46
|
+
permissions: pluginPermissions
|
|
46
47
|
};
|
|
47
|
-
var manifest_default =
|
|
48
|
+
var manifest_default = manifest;
|
|
48
49
|
|
|
49
50
|
export { manifest_default as manifest };
|
|
50
51
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/manifest.ts"],"names":[],"mappings":";;;AAEA,IAAM,
|
|
1
|
+
{"version":3,"sources":["../src/manifest.ts"],"names":[],"mappings":";;;AAEA,IAAM,oBAAoB,kBAAA,EAAmB,CAC1C,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;AAEF,IAAM,QAAA,GAAW;AAAA,EACtB,MAAA,EAAQ,aAAA;AAAA,EACR,EAAA,EAAI,iBAAA;AAAA,EACJ,OAAA,EAAS,OAAA;AAAA,EAET,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,QAAA;AAAA,IACN,WAAA,EAAa,kDAAA;AAAA,IACb,IAAA,EAAM,CAAC,QAAA,EAAU,aAAA,EAAe,UAAU;AAAA,GAC5C;AAAA,EAEA,UAAU,EAAE,QAAA,EAAU,EAAC,EAAG,QAAA,EAAU,EAAC,EAAE;AAAA,EAEvC,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,GACF;AAAA,EAEA,WAAA,EAAa;AACf,CAAA;AAEA,IAAO,gBAAA,GAAQ","file":"index.js","sourcesContent":["import { combinePermissions, kbPlatformPreset } from '@kb-labs/sdk';\n\nconst pluginPermissions = 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\nexport const manifest = {\n schema: 'kb.plugin/3' as const,\n id: '@kb-labs/github',\n version: '0.1.0',\n\n display: {\n name: 'GitHub',\n description: 'GitHub integration for issues, PRs, and branches',\n tags: ['github', 'integration', 'workflow'],\n },\n\n platform: { requires: [], optional: [] },\n\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\n permissions: pluginPermissions,\n} as const;\n\nexport default manifest;\n"]}
|
package/dist/manifest.d.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _kb_labs_plugin_contracts from '@kb-labs/plugin-contracts';
|
|
2
2
|
|
|
3
|
-
declare const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
display: {
|
|
3
|
+
declare const manifest: {
|
|
4
|
+
readonly schema: "kb.plugin/3";
|
|
5
|
+
readonly id: "@kb-labs/github";
|
|
6
|
+
readonly version: "0.1.0";
|
|
7
|
+
readonly display: {
|
|
9
8
|
readonly name: "GitHub";
|
|
10
|
-
readonly description: "GitHub integration
|
|
9
|
+
readonly description: "GitHub integration for issues, PRs, and branches";
|
|
11
10
|
readonly tags: readonly ["github", "integration", "workflow"];
|
|
12
11
|
};
|
|
13
|
-
platform: {
|
|
12
|
+
readonly platform: {
|
|
14
13
|
readonly requires: readonly [];
|
|
15
14
|
readonly optional: readonly [];
|
|
16
15
|
};
|
|
17
|
-
workflows: {
|
|
16
|
+
readonly workflows: {
|
|
18
17
|
readonly handlers: readonly [{
|
|
19
18
|
readonly id: "fetch-issue";
|
|
20
19
|
readonly handler: "./dist/handlers/fetch-issue.js#default";
|
|
@@ -33,6 +32,7 @@ declare const _default: {
|
|
|
33
32
|
readonly describe: "Create a pull request and optionally link it to an issue";
|
|
34
33
|
}];
|
|
35
34
|
};
|
|
35
|
+
readonly permissions: _kb_labs_plugin_contracts.PermissionSpec;
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
export {
|
|
38
|
+
export { manifest as default, manifest };
|
package/dist/manifest.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { combinePermissions, kbPlatformPreset } from '@kb-labs/sdk';
|
|
2
2
|
|
|
3
3
|
// src/manifest.ts
|
|
4
|
-
var
|
|
4
|
+
var pluginPermissions = combinePermissions().with(kbPlatformPreset).with({
|
|
5
5
|
network: {
|
|
6
6
|
fetch: ["https://api.github.com/*"]
|
|
7
7
|
},
|
|
@@ -15,7 +15,7 @@ var manifest = {
|
|
|
15
15
|
version: "0.1.0",
|
|
16
16
|
display: {
|
|
17
17
|
name: "GitHub",
|
|
18
|
-
description: "GitHub integration
|
|
18
|
+
description: "GitHub integration for issues, PRs, and branches",
|
|
19
19
|
tags: ["github", "integration", "workflow"]
|
|
20
20
|
},
|
|
21
21
|
platform: { requires: [], optional: [] },
|
|
@@ -42,10 +42,11 @@ var manifest = {
|
|
|
42
42
|
describe: "Create a pull request and optionally link it to an issue"
|
|
43
43
|
}
|
|
44
44
|
]
|
|
45
|
-
}
|
|
45
|
+
},
|
|
46
|
+
permissions: pluginPermissions
|
|
46
47
|
};
|
|
47
|
-
var manifest_default =
|
|
48
|
+
var manifest_default = manifest;
|
|
48
49
|
|
|
49
|
-
export { manifest_default as default };
|
|
50
|
+
export { manifest_default as default, manifest };
|
|
50
51
|
//# sourceMappingURL=manifest.js.map
|
|
51
52
|
//# sourceMappingURL=manifest.js.map
|
package/dist/manifest.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/manifest.ts"],"names":[],"mappings":";;;AAEA,IAAM,
|
|
1
|
+
{"version":3,"sources":["../src/manifest.ts"],"names":[],"mappings":";;;AAEA,IAAM,oBAAoB,kBAAA,EAAmB,CAC1C,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;AAEF,IAAM,QAAA,GAAW;AAAA,EACtB,MAAA,EAAQ,aAAA;AAAA,EACR,EAAA,EAAI,iBAAA;AAAA,EACJ,OAAA,EAAS,OAAA;AAAA,EAET,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,QAAA;AAAA,IACN,WAAA,EAAa,kDAAA;AAAA,IACb,IAAA,EAAM,CAAC,QAAA,EAAU,aAAA,EAAe,UAAU;AAAA,GAC5C;AAAA,EAEA,UAAU,EAAE,QAAA,EAAU,EAAC,EAAG,QAAA,EAAU,EAAC,EAAE;AAAA,EAEvC,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,GACF;AAAA,EAEA,WAAA,EAAa;AACf;AAEA,IAAO,gBAAA,GAAQ","file":"manifest.js","sourcesContent":["import { combinePermissions, kbPlatformPreset } from '@kb-labs/sdk';\n\nconst pluginPermissions = 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\nexport const manifest = {\n schema: 'kb.plugin/3' as const,\n id: '@kb-labs/github',\n version: '0.1.0',\n\n display: {\n name: 'GitHub',\n description: 'GitHub integration for issues, PRs, and branches',\n tags: ['github', 'integration', 'workflow'],\n },\n\n platform: { requires: [], optional: [] },\n\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\n permissions: pluginPermissions,\n} as const;\n\nexport default manifest;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kb-labs/github-entry",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.96.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Manifest and workflow handlers for the GitHub plugin",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,20 +24,28 @@
|
|
|
24
24
|
"sideEffects": false,
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@kb-labs/sdk": "2.21.2",
|
|
27
|
-
"@kb-labs/github-contracts": "2.
|
|
27
|
+
"@kb-labs/github-contracts": "2.96.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/node": "^24.3.3",
|
|
31
31
|
"rimraf": "^6.0.1",
|
|
32
32
|
"tsup": "^8.5.0",
|
|
33
33
|
"typescript": "^5.6.3",
|
|
34
|
-
"vitest": "^3.2.
|
|
35
|
-
"@kb-labs/devkit": "2.
|
|
34
|
+
"vitest": "^3.2.6",
|
|
35
|
+
"@kb-labs/devkit": "2.96.0"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=20.0.0",
|
|
39
|
+
"pnpm": ">=9.0.0"
|
|
36
40
|
},
|
|
37
41
|
"scripts": {
|
|
38
42
|
"build": "tsup --config tsup.config.ts",
|
|
39
43
|
"clean": "rimraf dist",
|
|
44
|
+
"dev": "tsup --config tsup.config.ts --watch",
|
|
45
|
+
"lint": "eslint src --ext .ts",
|
|
46
|
+
"lint:fix": "eslint . --fix",
|
|
40
47
|
"type-check": "tsc --noEmit",
|
|
41
|
-
"test": "vitest run --passWithNoTests"
|
|
48
|
+
"test": "vitest run --passWithNoTests",
|
|
49
|
+
"test:cli": "vitest run --config vitest.cli.config.ts --passWithNoTests"
|
|
42
50
|
}
|
|
43
51
|
}
|