@neturely/okffs 0.4.0 → 0.5.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 +24 -1
- package/README.md +106 -250
- package/dist/board.d.ts +33 -0
- package/dist/board.d.ts.map +1 -0
- package/dist/board.js +171 -0
- package/dist/board.js.map +1 -0
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +8 -0
- package/dist/config.js.map +1 -1
- package/dist/github.d.ts +1 -0
- package/dist/github.d.ts.map +1 -1
- package/dist/github.js +6 -0
- package/dist/github.js.map +1 -1
- package/dist/index.js +19 -4
- package/dist/index.js.map +1 -1
- package/dist/projects.d.ts.map +1 -1
- package/dist/projects.js +30 -12
- package/dist/projects.js.map +1 -1
- package/dist/tools/close_issue.d.ts +1 -1
- package/dist/tools/close_issue.d.ts.map +1 -1
- package/dist/tools/close_issue.js +38 -3
- package/dist/tools/close_issue.js.map +1 -1
- package/dist/tools/create_issue.d.ts +5 -4
- package/dist/tools/create_issue.d.ts.map +1 -1
- package/dist/tools/create_issue.js +53 -114
- package/dist/tools/create_issue.js.map +1 -1
- package/dist/tools/create_issues_from_list.d.ts +11 -1
- package/dist/tools/create_issues_from_list.d.ts.map +1 -1
- package/dist/tools/create_issues_from_list.js +39 -2
- package/dist/tools/create_issues_from_list.js.map +1 -1
- package/dist/tools/create_pull_request.d.ts +4 -1
- package/dist/tools/create_pull_request.d.ts.map +1 -1
- package/dist/tools/create_pull_request.js +18 -1
- package/dist/tools/create_pull_request.js.map +1 -1
- package/dist/tools/delete_branch.d.ts.map +1 -1
- package/dist/tools/delete_branch.js +3 -10
- package/dist/tools/delete_branch.js.map +1 -1
- package/dist/tools/delete_issue.d.ts.map +1 -1
- package/dist/tools/delete_issue.js +3 -11
- package/dist/tools/delete_issue.js.map +1 -1
- package/dist/tools/plan.d.ts +11 -1
- package/dist/tools/plan.d.ts.map +1 -1
- package/dist/tools/plan.js +47 -5
- package/dist/tools/plan.js.map +1 -1
- package/dist/tools/prepare_release.d.ts.map +1 -1
- package/dist/tools/prepare_release.js +15 -1
- package/dist/tools/prepare_release.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,76 +2,51 @@ import { z } from "zod";
|
|
|
2
2
|
import { createIssue, updateIssueBody, getDefaultBranch, getRef, createBranch, buildBranchName, createDraftPullRequest } from "../github.js";
|
|
3
3
|
import { config } from "../config.js";
|
|
4
4
|
import { git, currentBranch } from "../git.js";
|
|
5
|
-
import {
|
|
6
|
-
// Set a board single-select field (Priority, Effort, …) to `value`. Handles both
|
|
7
|
-
// shapes: a project-native single-select (set on the project item), and a GitHub
|
|
8
|
-
// org-level Issue Field (project field reports no options → set on the issue via
|
|
9
|
-
// setIssueFieldValue, gated on OKFFS_CLASSIC_PAT — #91). Non-fatal: warns and
|
|
10
|
-
// returns null on any miss. Returns the applied value on success.
|
|
11
|
-
async function applyBoardSingleSelect(label, value, itemId, issueNodeId, meta) {
|
|
12
|
-
const native = meta.singleSelectByName.get(label.toLowerCase());
|
|
13
|
-
if (!native) {
|
|
14
|
-
console.warn(`[okffs] ${label} "${value}" not set: the board has no ${label} field.`);
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
// Project-native single-select with resolvable options.
|
|
18
|
-
if (native.options.size > 0) {
|
|
19
|
-
const optionId = native.options.get(value);
|
|
20
|
-
if (optionId) {
|
|
21
|
-
await setProjectFieldValue(itemId, native.fieldId, optionId);
|
|
22
|
-
return value;
|
|
23
|
-
}
|
|
24
|
-
console.warn(`[okffs] ${label} "${value}" not set — no matching option. Board ${label} options: ${[...native.options.keys()].join(", ")}.`);
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
// No options via the project API → it's a GitHub org-level Issue Field.
|
|
28
|
-
if (!config.classicPat) {
|
|
29
|
-
console.warn(`[okffs] ${label} "${value}" not set: the board's ${label} is an org-level Issue Field, ` +
|
|
30
|
-
`which okffs can only set with a classic PAT (\`admin:org\`) and OKFFS_CLASSIC_PAT=true (security tradeoff — see docs). ` +
|
|
31
|
-
`Set it manually in the board UI for now.`);
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
try {
|
|
35
|
-
const orgField = await getOrgIssueField(label);
|
|
36
|
-
if (!orgField) {
|
|
37
|
-
console.warn(`[okffs] ${label} "${value}" not set: no org-level ${label} Issue Field found.`);
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
const orgOptionId = orgField.options.get(value);
|
|
41
|
-
if (!orgOptionId) {
|
|
42
|
-
console.warn(`[okffs] ${label} "${value}" not set — no matching org Issue Field option. Options: ${[...orgField.options.keys()].join(", ")}.`);
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
await setIssueFieldSingleSelect(issueNodeId, orgField.fieldId, orgOptionId);
|
|
46
|
-
return value;
|
|
47
|
-
}
|
|
48
|
-
catch (err) {
|
|
49
|
-
// Permission (fine-grained PAT FORBIDDEN) / preview-API errors — never fatal.
|
|
50
|
-
console.warn(`[okffs] ${label} not set via org Issue Field:`, err instanceof Error ? err.message : err);
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
5
|
+
import { boardAutoAddEnabled, addIssueToBoard, applyInitialStatus, renderBoardLines, getBoardFieldOptions, } from "../board.js";
|
|
54
6
|
export const name = "create_issue";
|
|
7
|
+
const DESCRIPTION_HEAD = "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.";
|
|
8
|
+
const DESCRIPTION_TAIL = " 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.";
|
|
55
9
|
// Priority/Effort inference guidance is woven into the tool description so Claude
|
|
56
10
|
// uses its own judgement to triage the issue it's creating (like it already does
|
|
57
11
|
// for labels), falling back to OKFFS_DEFAULT_* only when it can't tell. Toggle per
|
|
58
|
-
// field with OKFFS_INFER_PRIORITY / OKFFS_INFER_EFFORT (default on).
|
|
59
|
-
|
|
12
|
+
// field with OKFFS_INFER_PRIORITY / OKFFS_INFER_EFFORT (default on). When the
|
|
13
|
+
// board's real option names are known they replace the generic scale so Claude
|
|
14
|
+
// infers against the actual options (#133) — e.g. a P0/P1/P2 board.
|
|
15
|
+
function inferenceGuidance(priorityOpts, effortOpts) {
|
|
60
16
|
const bits = [];
|
|
61
17
|
if (config.inferPriority) {
|
|
62
|
-
|
|
18
|
+
const scale = priorityOpts?.length ? priorityOpts.join(", ") : "Urgent, High, Medium, Low";
|
|
19
|
+
bits.push(`infer a \`priority\` for the issue from its urgency and impact (board options: ${scale})`);
|
|
63
20
|
}
|
|
64
21
|
if (config.inferEffort) {
|
|
65
|
-
|
|
22
|
+
const scale = effortOpts?.length ? effortOpts.join(", ") : "High, Medium, Low";
|
|
23
|
+
bits.push(`infer an \`effort\` from the expected amount of work (board options: ${scale})`);
|
|
66
24
|
}
|
|
67
25
|
if (bits.length === 0)
|
|
68
26
|
return "";
|
|
69
27
|
return (` Also ${bits.join(" and ")}, passing the value(s) in the matching parameter. ` +
|
|
70
28
|
"okffs matches these against the board's actual options and falls back to OKFFS_DEFAULT_PRIORITY / OKFFS_DEFAULT_EFFORT when you omit them — so if you genuinely can't judge, omit the field rather than guessing.");
|
|
71
29
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
30
|
+
// Static description (generic scale) — the safe fallback used before the board is
|
|
31
|
+
// reachable and whenever real options can't be read.
|
|
32
|
+
export const description = DESCRIPTION_HEAD + inferenceGuidance() + DESCRIPTION_TAIL;
|
|
33
|
+
// Dynamic description resolved at tools/list time (index.ts awaits this). When
|
|
34
|
+
// auto-add is on and inference is enabled, inject the board's real Priority/Effort
|
|
35
|
+
// option names so Claude infers against them (#133). Any miss falls back to the
|
|
36
|
+
// static description. Cheap after the first call — board metadata is memoized.
|
|
37
|
+
export async function getDescription() {
|
|
38
|
+
if (!boardAutoAddEnabled())
|
|
39
|
+
return description;
|
|
40
|
+
if (!config.inferPriority && !config.inferEffort)
|
|
41
|
+
return description;
|
|
42
|
+
const [priorityOpts, effortOpts] = await Promise.all([
|
|
43
|
+
config.inferPriority ? getBoardFieldOptions("Priority") : Promise.resolve(null),
|
|
44
|
+
config.inferEffort ? getBoardFieldOptions("Effort") : Promise.resolve(null),
|
|
45
|
+
]);
|
|
46
|
+
if (!priorityOpts && !effortOpts)
|
|
47
|
+
return description;
|
|
48
|
+
return DESCRIPTION_HEAD + inferenceGuidance(priorityOpts, effortOpts) + DESCRIPTION_TAIL;
|
|
49
|
+
}
|
|
75
50
|
export const inputSchema = z.object({
|
|
76
51
|
title: z.string().describe("Issue title"),
|
|
77
52
|
description: z.string().describe("Issue body / description"),
|
|
@@ -97,29 +72,15 @@ export async function handler(input) {
|
|
|
97
72
|
const updatedBody = `${input.description}\n\n**Branch:** \`${branchName}\``;
|
|
98
73
|
await updateIssueBody(issue.number, updatedBody);
|
|
99
74
|
// Add the issue to the configured Project board (fallback for users without
|
|
100
|
-
// native board automation). Non-fatal, mirroring the
|
|
101
|
-
// failure warns with an [okffs] prefix
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
let
|
|
75
|
+
// native board automation) and set Priority/Effort. Non-fatal, mirroring the
|
|
76
|
+
// autoPR block below: any failure warns with an [okffs] prefix, is surfaced in
|
|
77
|
+
// the response, and never blocks issue creation. Initial Status is applied
|
|
78
|
+
// later (after the draft PR) — see the applyInitialStatus call below.
|
|
79
|
+
let boardAdd = null;
|
|
105
80
|
let boardError = null;
|
|
106
|
-
|
|
107
|
-
if (config.projectAutoAdd && config.projectEnabled) {
|
|
81
|
+
if (boardAutoAddEnabled()) {
|
|
108
82
|
try {
|
|
109
|
-
|
|
110
|
-
boardItemId = itemId;
|
|
111
|
-
addedToBoard = true;
|
|
112
|
-
// Priority and Effort are set the same way — project-native single-select,
|
|
113
|
-
// or a GitHub org-level Issue Field when OKFFS_CLASSIC_PAT is on (#91).
|
|
114
|
-
if (resolvedPriority || resolvedEffort) {
|
|
115
|
-
const meta = await getProjectMetadata();
|
|
116
|
-
if (resolvedPriority) {
|
|
117
|
-
priorityApplied = await applyBoardSingleSelect("Priority", resolvedPriority, itemId, issue.node_id, meta);
|
|
118
|
-
}
|
|
119
|
-
if (resolvedEffort) {
|
|
120
|
-
effortApplied = await applyBoardSingleSelect("Effort", resolvedEffort, itemId, issue.node_id, meta);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
83
|
+
boardAdd = await addIssueToBoard(issue.node_id, { priority: resolvedPriority, effort: resolvedEffort });
|
|
123
84
|
}
|
|
124
85
|
catch (err) {
|
|
125
86
|
boardError = err instanceof Error ? err.message : String(err);
|
|
@@ -165,28 +126,9 @@ export async function handler(input) {
|
|
|
165
126
|
// issue to "In Progress". Setting our intended status here lets it win that
|
|
166
127
|
// race so freshly-created issues land where okffs means them to (#103).
|
|
167
128
|
// Non-fatal, like the rest of the board handling.
|
|
168
|
-
let
|
|
169
|
-
if (
|
|
170
|
-
|
|
171
|
-
const meta = await getProjectMetadata();
|
|
172
|
-
const optionId = meta.statusFieldId
|
|
173
|
-
? meta.statusOptions.get(config.projectInitialStatus)
|
|
174
|
-
: undefined;
|
|
175
|
-
if (meta.statusFieldId && optionId) {
|
|
176
|
-
await setProjectFieldValue(boardItemId, meta.statusFieldId, optionId);
|
|
177
|
-
initialStatusApplied = config.projectInitialStatus;
|
|
178
|
-
}
|
|
179
|
-
else if (!meta.statusFieldId) {
|
|
180
|
-
console.warn(`[okffs] OKFFS_PROJECT_INITIAL_STATUS set but the board has no Status field.`);
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
const opts = [...meta.statusOptions.keys()].join(", ");
|
|
184
|
-
console.warn(`[okffs] OKFFS_PROJECT_INITIAL_STATUS "${config.projectInitialStatus}" doesn't match a board Status option. Options: ${opts}.`);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
catch (err) {
|
|
188
|
-
console.warn("[okffs] Failed to set initial board status:", err instanceof Error ? err.message : err);
|
|
189
|
-
}
|
|
129
|
+
let initialStatus = null;
|
|
130
|
+
if (boardAdd) {
|
|
131
|
+
initialStatus = await applyInitialStatus(boardAdd.itemId);
|
|
190
132
|
}
|
|
191
133
|
const lines = [
|
|
192
134
|
`Issue #${issue.number} created: ${issue.html_url}`,
|
|
@@ -203,25 +145,22 @@ export async function handler(input) {
|
|
|
203
145
|
const source = input.labels ? "" : " (default)";
|
|
204
146
|
lines.push(`Labels: ${resolvedLabels.join(", ")}${source}`);
|
|
205
147
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
// otherwise makes an empty board look like it worked. See #101.
|
|
218
|
-
lines.push(`Board: NOT added — auto-add is on but failed. The issue itself was created fine.`, ` ${boardError}`);
|
|
219
|
-
}
|
|
148
|
+
const addedToBoard = Boolean(boardAdd);
|
|
149
|
+
lines.push(...renderBoardLines({
|
|
150
|
+
addedToBoard,
|
|
151
|
+
boardError,
|
|
152
|
+
requestedPriority: resolvedPriority,
|
|
153
|
+
priority: boardAdd?.priority ?? null,
|
|
154
|
+
requestedEffort: resolvedEffort,
|
|
155
|
+
effort: boardAdd?.effort ?? null,
|
|
156
|
+
requestedStatus: config.projectInitialStatus,
|
|
157
|
+
initialStatus,
|
|
158
|
+
}));
|
|
220
159
|
lines.push(``, `To start work:`, ` git fetch origin`, ` git checkout ${branchName}`);
|
|
221
160
|
// Conversational nudge: prompt the host LLM to offer moving the issue into
|
|
222
161
|
// the "In Progress" column via update_project_status once work begins.
|
|
223
162
|
if (addedToBoard) {
|
|
224
|
-
const where =
|
|
163
|
+
const where = initialStatus?.applied ? `"${initialStatus.applied}"` : "its default column";
|
|
225
164
|
lines.push(``, `This issue is on the board in ${where}. Want me to move it to "In Progress" and start? ` +
|
|
226
165
|
`(I can call update_project_status for #${issue.number}.)`);
|
|
227
166
|
}
|
|
@@ -1 +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;AAC/C,OAAO,
|
|
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;AAC/C,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,GAGrB,MAAM,aAAa,CAAC;AAErB,MAAM,CAAC,MAAM,IAAI,GAAG,cAAc,CAAC;AAEnC,MAAM,gBAAgB,GACpB,2XAA2X,CAAC;AAE9X,MAAM,gBAAgB,GACpB,uNAAuN,CAAC;AAE1N,kFAAkF;AAClF,iFAAiF;AACjF,mFAAmF;AACnF,8EAA8E;AAC9E,+EAA+E;AAC/E,oEAAoE;AACpE,SAAS,iBAAiB,CAAC,YAA8B,EAAE,UAA4B;IACrF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,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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
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.";
|
|
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. When the Project board is enabled (OKFFS_PROJECT_AUTO_ADD=true), each issue is added to the board like create_issue does \u2014 infer a per-task priority/effort where you can, falling back to OKFFS_DEFAULT_PRIORITY/EFFORT. Confirms before creating.";
|
|
4
4
|
export declare const inputSchema: z.ZodObject<{
|
|
5
5
|
tasks: z.ZodArray<z.ZodObject<{
|
|
6
6
|
title: z.ZodString;
|
|
@@ -8,15 +8,21 @@ export declare const inputSchema: z.ZodObject<{
|
|
|
8
8
|
assignees: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
9
9
|
labels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
10
10
|
milestone: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
priority: z.ZodOptional<z.ZodString>;
|
|
12
|
+
effort: z.ZodOptional<z.ZodString>;
|
|
11
13
|
}, "strip", z.ZodTypeAny, {
|
|
12
14
|
title: string;
|
|
13
15
|
description: string;
|
|
16
|
+
priority?: string | undefined;
|
|
17
|
+
effort?: string | undefined;
|
|
14
18
|
assignees?: string[] | undefined;
|
|
15
19
|
labels?: string[] | undefined;
|
|
16
20
|
milestone?: number | undefined;
|
|
17
21
|
}, {
|
|
18
22
|
title: string;
|
|
19
23
|
description: string;
|
|
24
|
+
priority?: string | undefined;
|
|
25
|
+
effort?: string | undefined;
|
|
20
26
|
assignees?: string[] | undefined;
|
|
21
27
|
labels?: string[] | undefined;
|
|
22
28
|
milestone?: number | undefined;
|
|
@@ -26,6 +32,8 @@ export declare const inputSchema: z.ZodObject<{
|
|
|
26
32
|
tasks: {
|
|
27
33
|
title: string;
|
|
28
34
|
description: string;
|
|
35
|
+
priority?: string | undefined;
|
|
36
|
+
effort?: string | undefined;
|
|
29
37
|
assignees?: string[] | undefined;
|
|
30
38
|
labels?: string[] | undefined;
|
|
31
39
|
milestone?: number | undefined;
|
|
@@ -35,6 +43,8 @@ export declare const inputSchema: z.ZodObject<{
|
|
|
35
43
|
tasks: {
|
|
36
44
|
title: string;
|
|
37
45
|
description: string;
|
|
46
|
+
priority?: string | undefined;
|
|
47
|
+
effort?: string | undefined;
|
|
38
48
|
assignees?: string[] | undefined;
|
|
39
49
|
labels?: string[] | undefined;
|
|
40
50
|
milestone?: number | undefined;
|
|
@@ -1 +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;
|
|
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;AAYxB,eAAO,MAAM,IAAI,4BAA4B,CAAC;AAE9C,eAAO,MAAM,WAAW,woBAC0mB,CAAC;AAgBnoB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGtB,CAAC;AAEH,wBAAsB,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC;;;;;GAuE/D"}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { createIssue, updateIssueBody, getDefaultBranch, getRef, createBranch, buildBranchName } from "../github.js";
|
|
3
3
|
import { config } from "../config.js";
|
|
4
|
+
import { boardAutoAddEnabled, addIssueToBoard, applyInitialStatus, renderBoardLines, } from "../board.js";
|
|
4
5
|
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
|
+
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. When the Project board is enabled (OKFFS_PROJECT_AUTO_ADD=true), each issue is added to the board like create_issue does — infer a per-task priority/effort where you can, falling back to OKFFS_DEFAULT_PRIORITY/EFFORT. Confirms before creating.";
|
|
6
7
|
const taskSchema = z.object({
|
|
7
8
|
title: z.string().describe("Issue title"),
|
|
8
9
|
description: z.string().describe("Issue body / description"),
|
|
9
10
|
assignees: z.array(z.string()).optional().describe("GitHub usernames to assign"),
|
|
10
11
|
labels: z.array(z.string()).optional().describe("Labels to apply to this issue"),
|
|
11
12
|
milestone: z.number().int().optional().describe("Milestone number to assign"),
|
|
13
|
+
priority: z.string().optional().describe("Optional Project board Priority (e.g. Urgent, High, Medium, Low). Only applied when OKFFS_PROJECT_AUTO_ADD=true; falls back to OKFFS_DEFAULT_PRIORITY when omitted."),
|
|
14
|
+
effort: z.string().optional().describe("Optional Project board Effort (e.g. High, Medium, Low). Only applied when OKFFS_PROJECT_AUTO_ADD=true; falls back to OKFFS_DEFAULT_EFFORT when omitted."),
|
|
12
15
|
});
|
|
13
16
|
export const inputSchema = z.object({
|
|
14
17
|
tasks: z.array(taskSchema).min(1).describe("List of issues to create"),
|
|
@@ -34,12 +37,46 @@ export async function handler(input) {
|
|
|
34
37
|
const resolvedLabels = [
|
|
35
38
|
...new Set([...(task.labels ?? []), ...config.defaultLabels])
|
|
36
39
|
];
|
|
40
|
+
const resolvedPriority = task.priority ?? config.defaultPriority;
|
|
41
|
+
const resolvedEffort = task.effort ?? config.defaultEffort;
|
|
37
42
|
const issue = await createIssue(task.title, task.description, resolvedAssignees, resolvedLabels, task.milestone);
|
|
38
43
|
const branchName = buildBranchName(issue.number, task.title);
|
|
39
44
|
await createBranch(branchName, ref.object.sha);
|
|
40
45
|
const updatedBody = `${task.description}\n\n**Branch:** \`${branchName}\``;
|
|
41
46
|
await updateIssueBody(issue.number, updatedBody);
|
|
42
|
-
|
|
47
|
+
// Board placement, mirroring create_issue. Non-fatal per task and surfaced in
|
|
48
|
+
// the response — never silent (#144, #146). No draft PR here, so the initial
|
|
49
|
+
// status has no linked-PR race to win and can be applied right away.
|
|
50
|
+
let boardAdd = null;
|
|
51
|
+
let boardError = null;
|
|
52
|
+
let initialStatus = null;
|
|
53
|
+
if (boardAutoAddEnabled()) {
|
|
54
|
+
try {
|
|
55
|
+
boardAdd = await addIssueToBoard(issue.node_id, { priority: resolvedPriority, effort: resolvedEffort });
|
|
56
|
+
initialStatus = await applyInitialStatus(boardAdd.itemId);
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
boardError = err instanceof Error ? err.message : String(err);
|
|
60
|
+
console.warn(`[okffs] Failed to add #${issue.number} to project board:`, boardError);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const entryLines = [
|
|
64
|
+
`#${issue.number} — ${task.title}`,
|
|
65
|
+
` Branch: \`${branchName}\``,
|
|
66
|
+
` ${issue.html_url}`,
|
|
67
|
+
];
|
|
68
|
+
entryLines.push(...renderBoardLines({
|
|
69
|
+
addedToBoard: Boolean(boardAdd),
|
|
70
|
+
boardError,
|
|
71
|
+
requestedPriority: resolvedPriority,
|
|
72
|
+
priority: boardAdd?.priority ?? null,
|
|
73
|
+
requestedEffort: resolvedEffort,
|
|
74
|
+
effort: boardAdd?.effort ?? null,
|
|
75
|
+
requestedStatus: config.projectInitialStatus,
|
|
76
|
+
initialStatus,
|
|
77
|
+
indent: " ",
|
|
78
|
+
}));
|
|
79
|
+
results.push(entryLines.join("\n"));
|
|
43
80
|
}
|
|
44
81
|
return {
|
|
45
82
|
content: [{ type: "text", text: `Created ${results.length} issue(s):\n\n${results.join("\n\n")}` }],
|
|
@@ -1 +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;
|
|
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;AACtC,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,gBAAgB,GAGjB,MAAM,aAAa,CAAC;AAErB,MAAM,CAAC,MAAM,IAAI,GAAG,yBAAyB,CAAC;AAE9C,MAAM,CAAC,MAAM,WA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,QAAQ,CAAC;YAC/B,UAAU;YACV,iBAAiB,EAAE,gBAAgB;YACnC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,IAAI,IAAI;YACpC,eAAe,EAAE,cAAc;YAC/B,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,IAAI;YAChC,eAAe,EAAE,MAAM,CAAC,oBAAoB;YAC5C,aAAa;YACb,MAAM,EAAE,IAAI;SACb,CAAC,CACH,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACtC,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"}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
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, writes a per-issue changelog fragment under .changes/unreleased/ (assembled into CHANGELOG.md at release time by prepare_release \u2014 not a direct CHANGELOG.md edit), plus SECURITY.md for security-related changes, 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.";
|
|
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, writes a per-issue changelog fragment under .changes/unreleased/ (assembled into CHANGELOG.md at release time by prepare_release \u2014 not a direct CHANGELOG.md edit), plus SECURITY.md for security-related changes, 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. If the PR would target OKFFS_PROTECTED_BRANCH, the tool refuses without confirmed: true \u2014 promoting into a protected branch must be explicitly confirmed by the user.";
|
|
4
4
|
export declare const inputSchema: z.ZodObject<{
|
|
5
5
|
issue_number: z.ZodNumber;
|
|
6
6
|
summary: z.ZodOptional<z.ZodString>;
|
|
7
|
+
confirmed: z.ZodOptional<z.ZodBoolean>;
|
|
7
8
|
}, "strip", z.ZodTypeAny, {
|
|
8
9
|
issue_number: number;
|
|
10
|
+
confirmed?: boolean | undefined;
|
|
9
11
|
summary?: string | undefined;
|
|
10
12
|
}, {
|
|
11
13
|
issue_number: number;
|
|
14
|
+
confirmed?: boolean | undefined;
|
|
12
15
|
summary?: string | undefined;
|
|
13
16
|
}>;
|
|
14
17
|
export declare function handler(input: z.infer<typeof inputSchema>): Promise<{
|
|
@@ -1 +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,
|
|
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,o0BACiyB,CAAC;AAE1zB,eAAO,MAAM,WAAW;;;;;;;;;;;;EAItB,CAAC;AAEH,wBAAsB,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC;;;;;GAoN/D"}
|
|
@@ -4,10 +4,11 @@ import { config } from "../config.js";
|
|
|
4
4
|
import { updateProjectDocs } from "../docs.js";
|
|
5
5
|
import { git, currentBranch } from "../git.js";
|
|
6
6
|
export const name = "create_pull_request";
|
|
7
|
-
export 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, writes a per-issue changelog fragment under .changes/unreleased/ (assembled into CHANGELOG.md at release time by prepare_release — not a direct CHANGELOG.md edit), plus SECURITY.md for security-related changes, 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.";
|
|
7
|
+
export 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, writes a per-issue changelog fragment under .changes/unreleased/ (assembled into CHANGELOG.md at release time by prepare_release — not a direct CHANGELOG.md edit), plus SECURITY.md for security-related changes, 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. If the PR would target OKFFS_PROTECTED_BRANCH, the tool refuses without confirmed: true — promoting into a protected branch must be explicitly confirmed by the user.";
|
|
8
8
|
export const inputSchema = z.object({
|
|
9
9
|
issue_number: z.number().int().positive().describe("The issue number to create a PR for"),
|
|
10
10
|
summary: z.string().optional().describe("Optional summary of what was done — used in PR body and issue comment"),
|
|
11
|
+
confirmed: z.boolean().optional().describe("Required (true) only when the PR would target OKFFS_PROTECTED_BRANCH — an explicit acknowledgement that this promotes into a protected branch"),
|
|
11
12
|
});
|
|
12
13
|
export async function handler(input) {
|
|
13
14
|
const issue = await getIssue(input.issue_number);
|
|
@@ -19,6 +20,22 @@ export async function handler(input) {
|
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
22
|
const baseBranch = await getDefaultBranch();
|
|
23
|
+
// Protected-branch gate: if this PR would promote into OKFFS_PROTECTED_BRANCH,
|
|
24
|
+
// refuse without an explicit confirmed:true and hand back to the user. Runs
|
|
25
|
+
// before any side effects (no branch checkout / push / PR yet) so a decline is
|
|
26
|
+
// a clean no-op. Guards against an agent auto-driving a promotion into a
|
|
27
|
+
// protected branch (e.g. a full release) — see #152.
|
|
28
|
+
if (config.protectedBranch && baseBranch === config.protectedBranch && !input.confirmed) {
|
|
29
|
+
return {
|
|
30
|
+
content: [{
|
|
31
|
+
type: "text",
|
|
32
|
+
text: `⛔ This PR would target \`${baseBranch}\`, which is set as OKFFS_PROTECTED_BRANCH.\n\n` +
|
|
33
|
+
`Promoting into a protected branch is a user-gated step. Do NOT proceed autonomously — ` +
|
|
34
|
+
`confirm with the user, then re-call create_pull_request with confirmed: true. ` +
|
|
35
|
+
`(This call made no changes — any pre-existing draft PR is left untouched.)`,
|
|
36
|
+
}],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
22
39
|
// `Closes #N` only auto-closes the issue when the PR merges into the repo's
|
|
23
40
|
// default branch. If OKFFS_BASE_BRANCH targets a non-default branch (e.g.
|
|
24
41
|
// develop), warn that the issue must be closed manually after merge.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create_pull_request.js","sourceRoot":"","sources":["../../src/tools/create_pull_request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,QAAQ,EACR,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,2BAA2B,EAC3B,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,GAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,CAAC,MAAM,IAAI,GAAG,qBAAqB,CAAC;AAE1C,MAAM,CAAC,MAAM,WAAW,GACtB,
|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EAAE,GAAG,MAAM,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;QAClE,MAAM,GAAG,SAAS,CAAC;IACrB,CAAC;IAED,MAAM,OAAO,GAAG;QACd,MAAM,MAAM,KAAK,EAAE,CAAC,QAAQ,EAAE;QAC9B,EAAE;QACF,IAAI;KACL,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC;IAC7B,MAAM,eAAe,CAAC,KAAK,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAEnD,4EAA4E;IAC5E,6EAA6E;IAC7E,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc;QACxC,CAAC,CAAC,uLAAuL,UAAU,6BAA6B;QAChO,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,MAAM,IAAI,MAAM,KAAK,EAAE,CAAC,QAAQ,GAAG,aAAa,GAAG,YAAY,EAAE,EAAE,CAAC;KACxH,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete_branch.d.ts","sourceRoot":"","sources":["../../src/tools/delete_branch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"delete_branch.d.ts","sourceRoot":"","sources":["../../src/tools/delete_branch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,IAAI,kBAAkB,CAAC;AAEpC,eAAO,MAAM,WAAW,sGACwE,CAAC;AAEjG,eAAO,MAAM,WAAW;;;;;;;;;EAGtB,CAAC;AAEH,wBAAsB,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC;;;;;GA6B/D"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { addIssueComment, deleteBranch, closeIssue } from "../github.js";
|
|
3
|
-
import { config } from "../config.js";
|
|
4
|
-
import { updateProjectDocs } from "../docs.js";
|
|
5
3
|
export const name = "delete_branch";
|
|
6
4
|
export const description = "Delete a branch and close its matching GitHub issue. Destructive — requires confirmed: true.";
|
|
7
5
|
export const inputSchema = z.object({
|
|
@@ -21,14 +19,9 @@ export async function handler(input) {
|
|
|
21
19
|
await addIssueComment(issueNumber, `Branch \`${input.branch_name}\` was deleted. No working branch remains for this issue. Issue closed via okffs.`);
|
|
22
20
|
await deleteBranch(input.branch_name);
|
|
23
21
|
await closeIssue(issueNumber);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
issueNumber: issueNumber,
|
|
28
|
-
summary: `Branch \`${input.branch_name}\` deleted and issue #${issueNumber} closed.`,
|
|
29
|
-
branchName: input.branch_name,
|
|
30
|
-
});
|
|
31
|
-
}
|
|
22
|
+
// No changelog fragment here: deleting a branch is cleanup, not a functionality
|
|
23
|
+
// change. create_pull_request is the single source of auto-changelog fragments
|
|
24
|
+
// (matches close_issue's behaviour) — #160.
|
|
32
25
|
return {
|
|
33
26
|
content: [{
|
|
34
27
|
type: "text",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete_branch.js","sourceRoot":"","sources":["../../src/tools/delete_branch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"delete_branch.js","sourceRoot":"","sources":["../../src/tools/delete_branch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEzE,MAAM,C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E,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"delete_issue.d.ts","sourceRoot":"","sources":["../../src/tools/delete_issue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,IAAI,iBAAiB,CAAC;AAEnC,eAAO,MAAM,WAAW,sGACwE,CAAC;AAEjG,eAAO,MAAM,WAAW;;;;;;;;;EAGtB,CAAC;AAEH,wBAAsB,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC;;;;;GAgC/D"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { getIssue, addIssueComment, closeIssue, deleteBranch, extractBranchFromBody } from "../github.js";
|
|
3
|
-
import { config } from "../config.js";
|
|
4
|
-
import { updateProjectDocs } from "../docs.js";
|
|
5
3
|
export const name = "delete_issue";
|
|
6
4
|
export const description = "Close a GitHub issue and delete its matching branch. Destructive — requires confirmed: true.";
|
|
7
5
|
export const inputSchema = z.object({
|
|
@@ -27,15 +25,9 @@ export async function handler(input) {
|
|
|
27
25
|
if (branchName) {
|
|
28
26
|
await deleteBranch(branchName);
|
|
29
27
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
issueNumber: input.issue_number,
|
|
34
|
-
issueTitle: issue.title,
|
|
35
|
-
summary: issue.body ? `Deleted: ${issue.title}. ${issue.body.slice(0, 200)}` : `Deleted: ${issue.title}`,
|
|
36
|
-
branchName: branchName ?? undefined,
|
|
37
|
-
});
|
|
38
|
-
}
|
|
28
|
+
// No changelog fragment here: deleting an issue is cleanup, not a functionality
|
|
29
|
+
// change. create_pull_request is the single source of auto-changelog fragments
|
|
30
|
+
// (matches close_issue's behaviour) — #160.
|
|
39
31
|
const lines = [`Issue #${input.issue_number} closed.`];
|
|
40
32
|
if (branchName)
|
|
41
33
|
lines.push(`Branch \`${branchName}\` deleted.`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete_issue.js","sourceRoot":"","sources":["../../src/tools/delete_issue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"delete_issue.js","sourceRoot":"","sources":["../../src/tools/delete_issue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE1G,MAAM,CAAC,MAAM,IAAI,GAAG,cAAc,CAAC;AAEnC,MAAM,CAAC,MAAM,WAAW,GACtB,8FAA8F,CAAC;AAEjG,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sDAAsD,CAAC;IAC1G,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qDAAqD,CAAC;CAClG,CAAC,CAAC;AAEH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,KAAkC;IAC9D,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACjD,MAAM,UAAU,GAAG,qBAAqB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAErD,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;QACrB,MAAM,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,uBAAuB,UAAU,IAAI,CAAC,CAAC,CAAC,iCAAiC,CAAC;QAC1G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