@neturely/okffs 0.2.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/CHANGELOG.md +60 -0
- package/LICENSE +21 -0
- package/README.md +251 -0
- package/dist/config.d.ts +13 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +27 -0
- package/dist/config.js.map +1 -0
- package/dist/docs.d.ts +11 -0
- package/dist/docs.d.ts.map +1 -0
- package/dist/docs.js +203 -0
- package/dist/docs.js.map +1 -0
- package/dist/git.d.ts +7 -0
- package/dist/git.d.ts.map +1 -0
- package/dist/git.js +22 -0
- package/dist/git.js.map +1 -0
- package/dist/github.d.ts +111 -0
- package/dist/github.d.ts.map +1 -0
- package/dist/github.js +301 -0
- package/dist/github.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +63 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/address_pr_review.d.ts +18 -0
- package/dist/prompts/address_pr_review.d.ts.map +1 -0
- package/dist/prompts/address_pr_review.js +35 -0
- package/dist/prompts/address_pr_review.js.map +1 -0
- package/dist/prompts/update_guidance.d.ts +18 -0
- package/dist/prompts/update_guidance.d.ts.map +1 -0
- package/dist/prompts/update_guidance.js +47 -0
- package/dist/prompts/update_guidance.js.map +1 -0
- package/dist/tools/close_issue.d.ts +17 -0
- package/dist/tools/close_issue.d.ts.map +1 -0
- package/dist/tools/close_issue.js +28 -0
- package/dist/tools/close_issue.js.map +1 -0
- package/dist/tools/comment_issue.d.ts +20 -0
- package/dist/tools/comment_issue.d.ts.map +1 -0
- package/dist/tools/comment_issue.js +23 -0
- package/dist/tools/comment_issue.js.map +1 -0
- package/dist/tools/commit_and_update.d.ts +20 -0
- package/dist/tools/commit_and_update.d.ts.map +1 -0
- package/dist/tools/commit_and_update.js +80 -0
- package/dist/tools/commit_and_update.js.map +1 -0
- package/dist/tools/create_issue.d.ts +29 -0
- package/dist/tools/create_issue.d.ts.map +1 -0
- package/dist/tools/create_issue.js +82 -0
- package/dist/tools/create_issue.js.map +1 -0
- package/dist/tools/create_issues_from_list.d.ts +50 -0
- package/dist/tools/create_issues_from_list.d.ts.map +1 -0
- package/dist/tools/create_issues_from_list.js +48 -0
- package/dist/tools/create_issues_from_list.js.map +1 -0
- package/dist/tools/create_pull_request.d.ts +20 -0
- package/dist/tools/create_pull_request.d.ts.map +1 -0
- package/dist/tools/create_pull_request.js +170 -0
- package/dist/tools/create_pull_request.js.map +1 -0
- package/dist/tools/delete_branch.d.ts +20 -0
- package/dist/tools/delete_branch.d.ts.map +1 -0
- package/dist/tools/delete_branch.js +39 -0
- package/dist/tools/delete_branch.js.map +1 -0
- package/dist/tools/delete_issue.d.ts +20 -0
- package/dist/tools/delete_issue.d.ts.map +1 -0
- package/dist/tools/delete_issue.js +46 -0
- package/dist/tools/delete_issue.js.map +1 -0
- package/dist/tools/get_issue.d.ts +17 -0
- package/dist/tools/get_issue.d.ts.map +1 -0
- package/dist/tools/get_issue.js +27 -0
- package/dist/tools/get_issue.js.map +1 -0
- package/dist/tools/link_issues.d.ts +23 -0
- package/dist/tools/link_issues.d.ts.map +1 -0
- package/dist/tools/link_issues.js +42 -0
- package/dist/tools/link_issues.js.map +1 -0
- package/dist/tools/list_issues.d.ts +11 -0
- package/dist/tools/list_issues.d.ts.map +1 -0
- package/dist/tools/list_issues.js +61 -0
- package/dist/tools/list_issues.js.map +1 -0
- package/dist/tools/list_pr_review_comments.d.ts +17 -0
- package/dist/tools/list_pr_review_comments.d.ts.map +1 -0
- package/dist/tools/list_pr_review_comments.js +43 -0
- package/dist/tools/list_pr_review_comments.js.map +1 -0
- package/dist/tools/plan.d.ts +79 -0
- package/dist/tools/plan.d.ts.map +1 -0
- package/dist/tools/plan.js +159 -0
- package/dist/tools/plan.js.map +1 -0
- package/dist/tools/prepare_release.d.ts +23 -0
- package/dist/tools/prepare_release.d.ts.map +1 -0
- package/dist/tools/prepare_release.js +172 -0
- package/dist/tools/prepare_release.js.map +1 -0
- package/dist/tools/reply_to_review_comment.d.ts +23 -0
- package/dist/tools/reply_to_review_comment.d.ts.map +1 -0
- package/dist/tools/reply_to_review_comment.js +25 -0
- package/dist/tools/reply_to_review_comment.js.map +1 -0
- package/dist/tools/resolve_review_thread.d.ts +17 -0
- package/dist/tools/resolve_review_thread.d.ts.map +1 -0
- package/dist/tools/resolve_review_thread.js +27 -0
- package/dist/tools/resolve_review_thread.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export const name = "update_guidance";
|
|
2
|
+
export const description = "Review the work done for an issue and intelligently maintain the okffs-owned 'Project Guidance (okffs usage)' section of CLAUDE.md to reflect new or changed functionality.";
|
|
3
|
+
export const argumentDefs = [
|
|
4
|
+
{
|
|
5
|
+
name: "issue_number",
|
|
6
|
+
description: "The issue number whose changes to review (optional; defaults to the current branch)",
|
|
7
|
+
required: false,
|
|
8
|
+
},
|
|
9
|
+
];
|
|
10
|
+
const START_MARKER = "<!-- okffs:guidance:start -->";
|
|
11
|
+
const END_MARKER = "<!-- okffs:guidance:end -->";
|
|
12
|
+
export function build(args) {
|
|
13
|
+
const scope = args.issue_number ? `issue #${args.issue_number}` : "the current branch";
|
|
14
|
+
const text = [
|
|
15
|
+
`Maintain the okffs-owned guidance section of CLAUDE.md to reflect the changes from ${scope}. This is substantive guidance for future agents — not a changelog (CHANGELOG.md covers history).`,
|
|
16
|
+
``,
|
|
17
|
+
`**Only edit within the okffs-owned region**, delimited by these markers:`,
|
|
18
|
+
``,
|
|
19
|
+
"```markdown",
|
|
20
|
+
START_MARKER,
|
|
21
|
+
`## Project Guidance (okffs usage)`,
|
|
22
|
+
`- LLM-maintained notes: project tooling, conventions, and anything agents should know.`,
|
|
23
|
+
END_MARKER,
|
|
24
|
+
"```",
|
|
25
|
+
``,
|
|
26
|
+
`Steps:`,
|
|
27
|
+
`1. Look at the diff (e.g. \`git diff\` against the base branch) to see what changed.`,
|
|
28
|
+
`2. If the markers don't exist in CLAUDE.md yet, create the section once — append the start marker, the \`## Project Guidance (okffs usage)\` heading, the content, then the end marker — at the end of the file.`,
|
|
29
|
+
`3. Update the content **between the markers only** to reflect current functionality/conventions: add new tools, env vars, MCP prompts/slash commands, or workflow conventions; revise or remove entries that are now stale. Curate it (organize, dedupe, rewrite) — keep it a clean current-state summary, not a running log.`,
|
|
30
|
+
``,
|
|
31
|
+
`Rules:`,
|
|
32
|
+
`- **Never modify anything outside the two markers** — the rest of CLAUDE.md is the user's hand-written content.`,
|
|
33
|
+
`- If nothing substantive changed (e.g. a trivial bug fix or pure docs tweak), make **no edits** and say so.`,
|
|
34
|
+
`- Keep it concise and consistent in style.`,
|
|
35
|
+
`- Commit any CLAUDE.md change to the current branch so it's included in the PR for review — never leave silent uncommitted edits.`,
|
|
36
|
+
].join("\n");
|
|
37
|
+
return {
|
|
38
|
+
description: `Maintain the okffs guidance section of CLAUDE.md for ${scope}`,
|
|
39
|
+
messages: [
|
|
40
|
+
{
|
|
41
|
+
role: "user",
|
|
42
|
+
content: { type: "text", text },
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=update_guidance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update_guidance.js","sourceRoot":"","sources":["../../src/prompts/update_guidance.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG,iBAAiB,CAAC;AAEtC,MAAM,CAAC,MAAM,WAAW,GACtB,6KAA6K,CAAC;AAEhL,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B;QACE,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,qFAAqF;QAClG,QAAQ,EAAE,KAAK;KAChB;CACF,CAAC;AAEF,MAAM,YAAY,GAAG,+BAA+B,CAAC;AACrD,MAAM,UAAU,GAAG,6BAA6B,CAAC;AAEjD,MAAM,UAAU,KAAK,CAAC,IAAwC;IAC5D,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,oBAAoB,CAAC;IACvF,MAAM,IAAI,GAAG;QACX,sFAAsF,KAAK,mGAAmG;QAC9L,EAAE;QACF,0EAA0E;QAC1E,EAAE;QACF,aAAa;QACb,YAAY;QACZ,mCAAmC;QACnC,wFAAwF;QACxF,UAAU;QACV,KAAK;QACL,EAAE;QACF,QAAQ;QACR,sFAAsF;QACtF,kNAAkN;QAClN,+TAA+T;QAC/T,EAAE;QACF,QAAQ;QACR,iHAAiH;QACjH,6GAA6G;QAC7G,4CAA4C;QAC5C,mIAAmI;KACpI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,OAAO;QACL,WAAW,EAAE,wDAAwD,KAAK,EAAE;QAC5E,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAe;gBACrB,OAAO,EAAE,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE;aACzC;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const name = "close_issue";
|
|
3
|
+
export declare const description = "Close a GitHub issue by issue number.";
|
|
4
|
+
export declare const inputSchema: z.ZodObject<{
|
|
5
|
+
issue_number: z.ZodNumber;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
issue_number: number;
|
|
8
|
+
}, {
|
|
9
|
+
issue_number: number;
|
|
10
|
+
}>;
|
|
11
|
+
export declare function handler(input: z.infer<typeof inputSchema>): Promise<{
|
|
12
|
+
content: {
|
|
13
|
+
type: "text";
|
|
14
|
+
text: string;
|
|
15
|
+
}[];
|
|
16
|
+
}>;
|
|
17
|
+
//# sourceMappingURL=close_issue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"close_issue.d.ts","sourceRoot":"","sources":["../../src/tools/close_issue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,IAAI,gBAAgB,CAAC;AAElC,eAAO,MAAM,WAAW,0CAA0C,CAAC;AAEnE,eAAO,MAAM,WAAW;;;;;;EAEtB,CAAC;AAEH,wBAAsB,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC;;;;;GAsB/D"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { closeIssue, getIssue, addIssueComment, extractBranchFromBody, owner, repo } from "../github.js";
|
|
3
|
+
import { config } from "../config.js";
|
|
4
|
+
export const name = "close_issue";
|
|
5
|
+
export const description = "Close a GitHub issue by issue number.";
|
|
6
|
+
export const inputSchema = z.object({
|
|
7
|
+
issue_number: z.number().int().positive().describe("The issue number to close"),
|
|
8
|
+
});
|
|
9
|
+
export async function handler(input) {
|
|
10
|
+
const issue = await getIssue(input.issue_number);
|
|
11
|
+
const branchName = extractBranchFromBody(issue.body);
|
|
12
|
+
await closeIssue(input.issue_number);
|
|
13
|
+
if (branchName && !config.autoPR) {
|
|
14
|
+
const comment = [
|
|
15
|
+
`Issue closed. Branch \`${branchName}\` remains open — https://github.com/${owner}/${repo}/tree/${branchName}`,
|
|
16
|
+
``,
|
|
17
|
+
`No action has been taken on the branch.`,
|
|
18
|
+
].join("\n");
|
|
19
|
+
await addIssueComment(input.issue_number, comment);
|
|
20
|
+
}
|
|
21
|
+
// Closing no longer triggers a CHANGELOG update. create_pull_request is the
|
|
22
|
+
// single source of auto-changelog entries — firing here too produced
|
|
23
|
+
// duplicates (the PR already logged the change).
|
|
24
|
+
return {
|
|
25
|
+
content: [{ type: "text", text: `Issue #${input.issue_number} closed.\n\n💡 Tip: run /clear to reset Claude Code context and save tokens before starting the next issue.` }],
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=close_issue.js.map
|
|
@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EAAE,MAAe,EAAE,IAAI,EAAE,UAAU,KAAK,CAAC,YAAY,6GAA6G,EAAE,CAAC;KACtL,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const name = "comment_issue";
|
|
3
|
+
export declare const description = "Post a comment to a GitHub issue. Use after committing to a working branch to log what was done.";
|
|
4
|
+
export declare const inputSchema: z.ZodObject<{
|
|
5
|
+
issue_number: z.ZodNumber;
|
|
6
|
+
comment: z.ZodString;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
issue_number: number;
|
|
9
|
+
comment: string;
|
|
10
|
+
}, {
|
|
11
|
+
issue_number: number;
|
|
12
|
+
comment: string;
|
|
13
|
+
}>;
|
|
14
|
+
export declare function handler(input: z.infer<typeof inputSchema>): Promise<{
|
|
15
|
+
content: {
|
|
16
|
+
type: "text";
|
|
17
|
+
text: string;
|
|
18
|
+
}[];
|
|
19
|
+
}>;
|
|
20
|
+
//# sourceMappingURL=comment_issue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment_issue.d.ts","sourceRoot":"","sources":["../../src/tools/comment_issue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,IAAI,kBAAkB,CAAC;AAEpC,eAAO,MAAM,WAAW,qGAC4E,CAAC;AAErG,eAAO,MAAM,WAAW;;;;;;;;;EAGtB,CAAC;AAEH,wBAAsB,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC;;;;;GAc/D"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { addIssueComment, owner, repo } from "../github.js";
|
|
3
|
+
export const name = "comment_issue";
|
|
4
|
+
export const description = "Post a comment to a GitHub issue. Use after committing to a working branch to log what was done.";
|
|
5
|
+
export const inputSchema = z.object({
|
|
6
|
+
issue_number: z.number().int().positive(),
|
|
7
|
+
comment: z.string().describe("Comment body to post to the issue"),
|
|
8
|
+
});
|
|
9
|
+
export async function handler(input) {
|
|
10
|
+
// Note: commenting intentionally does not trigger CHANGELOG updates — it is
|
|
11
|
+
// too frequent to be a meaningful changelog event. create_pull_request is the
|
|
12
|
+
// single source of auto-changelog entries.
|
|
13
|
+
await addIssueComment(input.issue_number, input.comment);
|
|
14
|
+
return {
|
|
15
|
+
content: [
|
|
16
|
+
{
|
|
17
|
+
type: "text",
|
|
18
|
+
text: `Comment posted to issue #${input.issue_number}.\nhttps://github.com/${owner}/${repo}/issues/${input.issue_number}`,
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=comment_issue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment_issue.js","sourceRoot":"","sources":["../../src/tools/comment_issue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAE5D,MAAM,CAAC,MAAM,IAAI,GAAG,eAAe,CAAC;AAEpC,MAAM,CAAC,MAAM,WAAW,GACtB,kGAAkG,CAAC;AAErG,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACzC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;CAClE,CAAC,CAAC;AAEH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,KAAkC;IAC9D,4EAA4E;IAC5E,8EAA8E;IAC9E,2CAA2C;IAC3C,MAAM,eAAe,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAEzD,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAe;gBACrB,IAAI,EAAE,4BAA4B,KAAK,CAAC,YAAY,yBAAyB,KAAK,IAAI,IAAI,WAAW,KAAK,CAAC,YAAY,EAAE;aAC1H;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const name = "commit_and_update";
|
|
3
|
+
export declare const description = "Stage all changes, build a commit message from the provided hint (or the changed file list), commit, push to the issue branch, and post a rich progress comment to the linked issue.";
|
|
4
|
+
export declare const inputSchema: z.ZodObject<{
|
|
5
|
+
issue_number: z.ZodNumber;
|
|
6
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
issue_number: number;
|
|
9
|
+
hint?: string | undefined;
|
|
10
|
+
}, {
|
|
11
|
+
issue_number: number;
|
|
12
|
+
hint?: string | undefined;
|
|
13
|
+
}>;
|
|
14
|
+
export declare function handler(input: z.infer<typeof inputSchema>): Promise<{
|
|
15
|
+
content: {
|
|
16
|
+
type: "text";
|
|
17
|
+
text: string;
|
|
18
|
+
}[];
|
|
19
|
+
}>;
|
|
20
|
+
//# sourceMappingURL=commit_and_update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit_and_update.d.ts","sourceRoot":"","sources":["../../src/tools/commit_and_update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,IAAI,sBAAsB,CAAC;AACxC,eAAO,MAAM,WAAW,yLACgK,CAAC;AAEzL,eAAO,MAAM,WAAW;;;;;;;;;EAGtB,CAAC;AAEH,wBAAsB,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC;;;;;GAyE/D"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { addIssueComment, getIssue, extractBranchFromBody } from "../github.js";
|
|
3
|
+
import { git, gitOutput, currentBranch } from "../git.js";
|
|
4
|
+
export const name = "commit_and_update";
|
|
5
|
+
export const description = "Stage all changes, build a commit message from the provided hint (or the changed file list), commit, push to the issue branch, and post a rich progress comment to the linked issue.";
|
|
6
|
+
export const inputSchema = z.object({
|
|
7
|
+
issue_number: z.number().int().positive().describe("The issue number this work is against"),
|
|
8
|
+
hint: z.string().optional().describe("Short description of what was done — used to build the commit message and issue comment"),
|
|
9
|
+
});
|
|
10
|
+
export async function handler(input) {
|
|
11
|
+
const issue = await getIssue(input.issue_number);
|
|
12
|
+
const branchName = extractBranchFromBody(issue.body);
|
|
13
|
+
// Files changed relative to HEAD — used for the commit message and comment.
|
|
14
|
+
let changedFiles = [];
|
|
15
|
+
try {
|
|
16
|
+
changedFiles = gitOutput(["diff", "--name-only", "HEAD"]).split("\n").filter(Boolean);
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
changedFiles = [];
|
|
20
|
+
}
|
|
21
|
+
const hintText = input.hint ?? "";
|
|
22
|
+
const filesText = changedFiles.length > 0 ? changedFiles.join(", ") : "various files";
|
|
23
|
+
// Build the commit message from the hint when provided, else the file list.
|
|
24
|
+
const commitMessage = hintText
|
|
25
|
+
? hintText.slice(0, 72)
|
|
26
|
+
: `chore: update ${filesText.slice(0, 60)}`;
|
|
27
|
+
// Stage, commit, and push on the issue branch. Arguments are passed as an
|
|
28
|
+
// array (no shell), so the hint and branch name can't be interpreted as
|
|
29
|
+
// shell commands. The caller's original branch is restored afterward.
|
|
30
|
+
const previousBranch = currentBranch();
|
|
31
|
+
let commitHash = "";
|
|
32
|
+
try {
|
|
33
|
+
if (branchName && previousBranch !== branchName) {
|
|
34
|
+
git(["checkout", branchName]);
|
|
35
|
+
}
|
|
36
|
+
git(["add", "-A"]);
|
|
37
|
+
git(["commit", "-m", commitMessage]);
|
|
38
|
+
if (branchName) {
|
|
39
|
+
git(["push", "origin", branchName]);
|
|
40
|
+
}
|
|
41
|
+
commitHash = gitOutput(["rev-parse", "--short", "HEAD"]);
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
45
|
+
return {
|
|
46
|
+
content: [{ type: "text", text: `commit_and_update failed: ${msg}` }],
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
if (branchName && previousBranch && previousBranch !== branchName) {
|
|
51
|
+
try {
|
|
52
|
+
git(["checkout", previousBranch]);
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
console.warn("[okffs] Failed to restore branch:", err instanceof Error ? err.message : err);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// Post rich comment to issue
|
|
60
|
+
const timestamp = new Date().toISOString();
|
|
61
|
+
const filesSection = changedFiles.length > 0
|
|
62
|
+
? changedFiles.map((f) => `- \`${f}\``).join("\n")
|
|
63
|
+
: "- No files detected";
|
|
64
|
+
const comment = [
|
|
65
|
+
`### 🔧 Commit update`,
|
|
66
|
+
``,
|
|
67
|
+
`**Commit:** \`${commitHash}\``,
|
|
68
|
+
`**Message:** ${commitMessage}`,
|
|
69
|
+
`**Time:** ${timestamp}`,
|
|
70
|
+
``,
|
|
71
|
+
`**Files changed:**`,
|
|
72
|
+
filesSection,
|
|
73
|
+
hintText ? `\n**Summary:** ${hintText}` : "",
|
|
74
|
+
].filter((l) => l !== undefined).join("\n");
|
|
75
|
+
await addIssueComment(input.issue_number, comment);
|
|
76
|
+
return {
|
|
77
|
+
content: [{ type: "text", text: `Committed \`${commitHash}\` and updated issue #${input.issue_number}.` }],
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=commit_and_update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit_and_update.js","sourceRoot":"","sources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} from "zod";
|
|
2
|
+
export declare const name = "create_issue";
|
|
3
|
+
export declare const description = "Create a GitHub issue and automatically create a matching branch. Before calling this tool, infer appropriate labels from the issue title and description using GitHub's default labels: bug, documentation, duplicate, enhancement, good first issue, help wanted, invalid, question, wontfix. Pass the inferred labels in the labels parameter unless the user has specified their own. If the user mentions that this issue is blocked by, blocking, or a child of another issue, call link_issues after creating this issue to set the relationship. Returns the issue URL, issue number, and branch name.";
|
|
4
|
+
export declare const inputSchema: z.ZodObject<{
|
|
5
|
+
title: z.ZodString;
|
|
6
|
+
description: z.ZodString;
|
|
7
|
+
assignees: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
8
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
9
|
+
milestone: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
title: string;
|
|
12
|
+
description: string;
|
|
13
|
+
assignees?: string[] | undefined;
|
|
14
|
+
labels?: string[] | undefined;
|
|
15
|
+
milestone?: number | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
title: string;
|
|
18
|
+
description: string;
|
|
19
|
+
assignees?: string[] | undefined;
|
|
20
|
+
labels?: string[] | undefined;
|
|
21
|
+
milestone?: number | undefined;
|
|
22
|
+
}>;
|
|
23
|
+
export declare function handler(input: z.infer<typeof inputSchema>): Promise<{
|
|
24
|
+
content: {
|
|
25
|
+
type: "text";
|
|
26
|
+
text: string;
|
|
27
|
+
}[];
|
|
28
|
+
}>;
|
|
29
|
+
//# sourceMappingURL=create_issue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create_issue.d.ts","sourceRoot":"","sources":["../../src/tools/create_issue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,IAAI,iBAAiB,CAAC;AAEnC,eAAO,MAAM,WAAW,mlBAC0jB,CAAC;AAEnlB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;EAMtB,CAAC;AAEH,wBAAsB,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC;;;;;GA4F/D"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { createIssue, updateIssueBody, getDefaultBranch, getRef, createBranch, buildBranchName, createDraftPullRequest } from "../github.js";
|
|
3
|
+
import { config } from "../config.js";
|
|
4
|
+
import { git, currentBranch } from "../git.js";
|
|
5
|
+
export const name = "create_issue";
|
|
6
|
+
export const description = "Create a GitHub issue and automatically create a matching branch. Before calling this tool, infer appropriate labels from the issue title and description using GitHub's default labels: bug, documentation, duplicate, enhancement, good first issue, help wanted, invalid, question, wontfix. Pass the inferred labels in the labels parameter unless the user has specified their own. If the user mentions that this issue is blocked by, blocking, or a child of another issue, call link_issues after creating this issue to set the relationship. Returns the issue URL, issue number, and branch name.";
|
|
7
|
+
export const inputSchema = z.object({
|
|
8
|
+
title: z.string().describe("Issue title"),
|
|
9
|
+
description: z.string().describe("Issue body / description"),
|
|
10
|
+
assignees: z.array(z.string()).optional().describe("GitHub usernames to assign"),
|
|
11
|
+
labels: z.array(z.string()).optional().describe("Labels to apply e.g. bug, feature"),
|
|
12
|
+
milestone: z.number().int().optional().describe("Milestone number to assign"),
|
|
13
|
+
});
|
|
14
|
+
export async function handler(input) {
|
|
15
|
+
const resolvedAssignees = input.assignees ?? config.defaultAssignees;
|
|
16
|
+
const resolvedLabels = [
|
|
17
|
+
...new Set([...(input.labels ?? []), ...config.defaultLabels])
|
|
18
|
+
];
|
|
19
|
+
const issue = await createIssue(input.title, input.description, resolvedAssignees, resolvedLabels, input.milestone);
|
|
20
|
+
const branchName = buildBranchName(issue.number, input.title);
|
|
21
|
+
const defaultBranch = await getDefaultBranch();
|
|
22
|
+
const ref = await getRef(defaultBranch);
|
|
23
|
+
await createBranch(branchName, ref.object.sha);
|
|
24
|
+
const updatedBody = `${input.description}\n\n**Branch:** \`${branchName}\``;
|
|
25
|
+
await updateIssueBody(issue.number, updatedBody);
|
|
26
|
+
let draftPRUrl = null;
|
|
27
|
+
if (config.autoPR) {
|
|
28
|
+
// Push an empty init commit so the branch diverges from base, allowing
|
|
29
|
+
// GitHub to accept a draft PR immediately. Only needed for the auto-PR flow.
|
|
30
|
+
const previousBranch = currentBranch();
|
|
31
|
+
try {
|
|
32
|
+
git(["fetch", "origin"]);
|
|
33
|
+
git(["checkout", branchName]);
|
|
34
|
+
git(["commit", "--allow-empty", "-m", `chore: init branch for #${issue.number}`]);
|
|
35
|
+
git(["push", "origin", branchName]);
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
console.warn("[okffs] Failed to push init commit:", err instanceof Error ? err.message : err);
|
|
39
|
+
}
|
|
40
|
+
finally {
|
|
41
|
+
// Always restore the caller's original branch, even if a step above failed.
|
|
42
|
+
if (previousBranch && previousBranch !== branchName) {
|
|
43
|
+
try {
|
|
44
|
+
git(["checkout", previousBranch]);
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
console.warn("[okffs] Failed to restore branch:", err instanceof Error ? err.message : err);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
const pr = await createDraftPullRequest(`WIP: #${issue.number} - ${input.title}`, `Closes #${issue.number}`, branchName, defaultBranch);
|
|
53
|
+
draftPRUrl = pr.html_url;
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
console.warn("[okffs] Failed to create draft PR:", err instanceof Error ? err.message : err);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const lines = [
|
|
60
|
+
`Issue #${issue.number} created: ${issue.html_url}`,
|
|
61
|
+
`Branch: \`${branchName}\``,
|
|
62
|
+
];
|
|
63
|
+
if (draftPRUrl) {
|
|
64
|
+
lines.push(`Draft PR: ${draftPRUrl}`);
|
|
65
|
+
}
|
|
66
|
+
if (resolvedAssignees.length > 0) {
|
|
67
|
+
const source = input.assignees ? "" : " (default)";
|
|
68
|
+
lines.push(`Assignees: ${resolvedAssignees.join(", ")}${source}`);
|
|
69
|
+
}
|
|
70
|
+
if (resolvedLabels.length > 0) {
|
|
71
|
+
const source = input.labels ? "" : " (default)";
|
|
72
|
+
lines.push(`Labels: ${resolvedLabels.join(", ")}${source}`);
|
|
73
|
+
}
|
|
74
|
+
lines.push(``, `To start work:`, ` git fetch origin`, ` git checkout ${branchName}`);
|
|
75
|
+
if (config.promptForMetadata && !input.assignees && !input.labels) {
|
|
76
|
+
lines.push(``, `Tip: You can include assignees and labels next time:`, ` assignees: ["your-github-username"]`, ` labels: ["feature", "bug"]`, `Or set OKFFS_PROMPT_METADATA=false in .env to hide this tip.`);
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=create_issue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create_issue.js","sourceRoot":"","sources":["../../src/tools/create_issue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,EAAE,YAAY,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC7I,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,CAAC,MAAM,IAAI,GAAG,cAAc,CAAC;AAEnC,MAAM,CAAC,MAAM,WAAW,GACtB,glBAAglB,CAAC;AAEnlB,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,Q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C,iBAAiB,IAAI,CAAC,KAAK,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QAClE,KAAK,CAAC,IAAI,CACR,EAAE,EACF,sDAAsD,EACtD,uCAAuC,EACvC,8BAA8B,EAC9B,8DAA8D,CAC/D,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;KAC7D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const name = "create_issues_from_list";
|
|
3
|
+
export declare const description = "Create multiple GitHub issues and matching branches from a list of tasks. Before calling this tool, infer appropriate labels for each task from its title and description using GitHub's default labels: bug, documentation, duplicate, enhancement, good first issue, help wanted, invalid, question, wontfix. Pass inferred labels per task in the labels field unless the user has specified their own. Confirms before creating.";
|
|
4
|
+
export declare const inputSchema: z.ZodObject<{
|
|
5
|
+
tasks: z.ZodArray<z.ZodObject<{
|
|
6
|
+
title: z.ZodString;
|
|
7
|
+
description: z.ZodString;
|
|
8
|
+
assignees: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
9
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
10
|
+
milestone: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
title: string;
|
|
13
|
+
description: string;
|
|
14
|
+
assignees?: string[] | undefined;
|
|
15
|
+
labels?: string[] | undefined;
|
|
16
|
+
milestone?: number | undefined;
|
|
17
|
+
}, {
|
|
18
|
+
title: string;
|
|
19
|
+
description: string;
|
|
20
|
+
assignees?: string[] | undefined;
|
|
21
|
+
labels?: string[] | undefined;
|
|
22
|
+
milestone?: number | undefined;
|
|
23
|
+
}>, "many">;
|
|
24
|
+
confirmed: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
tasks: {
|
|
27
|
+
title: string;
|
|
28
|
+
description: string;
|
|
29
|
+
assignees?: string[] | undefined;
|
|
30
|
+
labels?: string[] | undefined;
|
|
31
|
+
milestone?: number | undefined;
|
|
32
|
+
}[];
|
|
33
|
+
confirmed?: boolean | undefined;
|
|
34
|
+
}, {
|
|
35
|
+
tasks: {
|
|
36
|
+
title: string;
|
|
37
|
+
description: string;
|
|
38
|
+
assignees?: string[] | undefined;
|
|
39
|
+
labels?: string[] | undefined;
|
|
40
|
+
milestone?: number | undefined;
|
|
41
|
+
}[];
|
|
42
|
+
confirmed?: boolean | undefined;
|
|
43
|
+
}>;
|
|
44
|
+
export declare function handler(input: z.infer<typeof inputSchema>): Promise<{
|
|
45
|
+
content: {
|
|
46
|
+
type: "text";
|
|
47
|
+
text: string;
|
|
48
|
+
}[];
|
|
49
|
+
}>;
|
|
50
|
+
//# sourceMappingURL=create_issues_from_list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create_issues_from_list.d.ts","sourceRoot":"","sources":["../../src/tools/create_issues_from_list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,IAAI,4BAA4B,CAAC;AAE9C,eAAO,MAAM,WAAW,yaACgZ,CAAC;AAUza,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGtB,CAAC;AAEH,wBAAsB,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC;;;;;GAmC/D"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { createIssue, updateIssueBody, getDefaultBranch, getRef, createBranch, buildBranchName } from "../github.js";
|
|
3
|
+
import { config } from "../config.js";
|
|
4
|
+
export const name = "create_issues_from_list";
|
|
5
|
+
export const description = "Create multiple GitHub issues and matching branches from a list of tasks. Before calling this tool, infer appropriate labels for each task from its title and description using GitHub's default labels: bug, documentation, duplicate, enhancement, good first issue, help wanted, invalid, question, wontfix. Pass inferred labels per task in the labels field unless the user has specified their own. Confirms before creating.";
|
|
6
|
+
const taskSchema = z.object({
|
|
7
|
+
title: z.string().describe("Issue title"),
|
|
8
|
+
description: z.string().describe("Issue body / description"),
|
|
9
|
+
assignees: z.array(z.string()).optional().describe("GitHub usernames to assign"),
|
|
10
|
+
labels: z.array(z.string()).optional().describe("Labels to apply to this issue"),
|
|
11
|
+
milestone: z.number().int().optional().describe("Milestone number to assign"),
|
|
12
|
+
});
|
|
13
|
+
export const inputSchema = z.object({
|
|
14
|
+
tasks: z.array(taskSchema).min(1).describe("List of issues to create"),
|
|
15
|
+
confirmed: z.boolean().optional().describe("Must be true to proceed with creation"),
|
|
16
|
+
});
|
|
17
|
+
export async function handler(input) {
|
|
18
|
+
if (!input.confirmed) {
|
|
19
|
+
const preview = input.tasks
|
|
20
|
+
.map((t, i) => `${i + 1}. ${t.title}${t.labels?.length ? ` [${t.labels.join(", ")}]` : ""}`)
|
|
21
|
+
.join("\n");
|
|
22
|
+
return {
|
|
23
|
+
content: [{
|
|
24
|
+
type: "text",
|
|
25
|
+
text: `About to create ${input.tasks.length} issue(s):\n\n${preview}\n\nRe-call create_issues_from_list with confirmed: true to proceed.`,
|
|
26
|
+
}],
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const defaultBranch = await getDefaultBranch();
|
|
30
|
+
const ref = await getRef(defaultBranch);
|
|
31
|
+
const results = [];
|
|
32
|
+
for (const task of input.tasks) {
|
|
33
|
+
const resolvedAssignees = task.assignees ?? config.defaultAssignees;
|
|
34
|
+
const resolvedLabels = [
|
|
35
|
+
...new Set([...(task.labels ?? []), ...config.defaultLabels])
|
|
36
|
+
];
|
|
37
|
+
const issue = await createIssue(task.title, task.description, resolvedAssignees, resolvedLabels, task.milestone);
|
|
38
|
+
const branchName = buildBranchName(issue.number, task.title);
|
|
39
|
+
await createBranch(branchName, ref.object.sha);
|
|
40
|
+
const updatedBody = `${task.description}\n\n**Branch:** \`${branchName}\``;
|
|
41
|
+
await updateIssueBody(issue.number, updatedBody);
|
|
42
|
+
results.push(`#${issue.number} — ${task.title}\n Branch: \`${branchName}\`\n ${issue.html_url}`);
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
content: [{ type: "text", text: `Created ${results.length} issue(s):\n\n${results.join("\n\n")}` }],
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=create_issues_from_list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create_issues_from_list.js","sourceRoot":"","sources":["../../src/tools/create_issues_from_list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACrH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,MAAM,CAAC,MAAM,IAAI,GAAG,yBAAyB,CAAC;AAE9C,MAAM,CAAC,MAAM,WAAW,GACtB,saAAsa,CAAC;AAEza,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC;IACzC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;IAC5D,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;IAChF,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,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AM,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAC/B,MAAM,iBAAiB,GAAG,IAAI,CAAC,SAAS,IAAI,MAAM,CAAC,gBAAgB,CAAC;QACpE,MAAM,cAAc,GAAG;YACrB,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,EAAE,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;SAC9D,CAAC;QAEF,MAAM,KAAK,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,iBAAiB,EAAE,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACjH,MAAM,UAAU,GAAG,eAAe,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7D,MAAM,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC/C,MAAM,WAAW,GAAG,GAAG,IAAI,CAAC,WAAW,qBAAqB,UAAU,IAAI,CAAC;QAC3E,MAAM,eAAe,CAAC,KAAK,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QAEjD,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,MAAM,MAAM,IAAI,CAAC,KAAK,iBAAiB,UAAU,SAAS,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;IACrG,CAAC;IAED,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,WAAW,OAAO,CAAC,MAAM,iBAAiB,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;KAC7G,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const name = "create_pull_request";
|
|
3
|
+
export declare const description = "Create a pull request for the current issue branch. Reads the issue, its comments, and commits to generate a PR title and body. Always includes Closes #N. If OKFFS_UPDATE_DOCS is true, updates the project docs (CHANGELOG.md, and when relevant CLAUDE.md, CONTRIBUTING.md, SECURITY.md) and commits them onto the branch before creating the PR. If a PR already exists for the branch (e.g. a draft opened by create_issue under OKFFS_AUTO_PR=true), it is updated and marked ready for review instead of erroring. Posts a summary comment to the issue.";
|
|
4
|
+
export declare const inputSchema: z.ZodObject<{
|
|
5
|
+
issue_number: z.ZodNumber;
|
|
6
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
issue_number: number;
|
|
9
|
+
summary?: string | undefined;
|
|
10
|
+
}, {
|
|
11
|
+
issue_number: number;
|
|
12
|
+
summary?: string | undefined;
|
|
13
|
+
}>;
|
|
14
|
+
export declare function handler(input: z.infer<typeof inputSchema>): Promise<{
|
|
15
|
+
content: {
|
|
16
|
+
type: "text";
|
|
17
|
+
text: string;
|
|
18
|
+
}[];
|
|
19
|
+
}>;
|
|
20
|
+
//# sourceMappingURL=create_pull_request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create_pull_request.d.ts","sourceRoot":"","sources":["../../src/tools/create_pull_request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkBxB,eAAO,MAAM,IAAI,wBAAwB,CAAC;AAE1C,eAAO,MAAM,WAAW,oiBAC2gB,CAAC;AAEpiB,eAAO,MAAM,WAAW;;;;;;;;;EAGtB,CAAC;AAEH,wBAAsB,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC;;;;;GAkM/D"}
|