techunter 0.1.0 → 0.1.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/README.md +1 -1
- package/dist/index.js +310 -159
- package/dist/mcp.js +204 -101
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -17,6 +17,7 @@ __export(github_exports, {
|
|
|
17
17
|
closeTask: () => closeTask,
|
|
18
18
|
createPR: () => createPR,
|
|
19
19
|
createTask: () => createTask,
|
|
20
|
+
editTask: () => editTask,
|
|
20
21
|
ensureLabels: () => ensureLabels,
|
|
21
22
|
formatGuideAsMarkdown: () => formatGuideAsMarkdown,
|
|
22
23
|
getAuthenticatedUser: () => getAuthenticatedUser,
|
|
@@ -59,46 +60,15 @@ function parseIssue(issue) {
|
|
|
59
60
|
async function listTasks(config) {
|
|
60
61
|
const octokit = createOctokit(config.githubToken);
|
|
61
62
|
const { owner, repo } = config.github;
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
owner,
|
|
72
|
-
repo,
|
|
73
|
-
labels: LABEL_CLAIMED,
|
|
74
|
-
state: "open",
|
|
75
|
-
per_page: 50
|
|
76
|
-
}),
|
|
77
|
-
octokit.issues.listForRepo({
|
|
78
|
-
owner,
|
|
79
|
-
repo,
|
|
80
|
-
labels: LABEL_IN_REVIEW,
|
|
81
|
-
state: "open",
|
|
82
|
-
per_page: 50
|
|
83
|
-
}),
|
|
84
|
-
octokit.issues.listForRepo({
|
|
85
|
-
owner,
|
|
86
|
-
repo,
|
|
87
|
-
labels: LABEL_CHANGES_NEEDED,
|
|
88
|
-
state: "open",
|
|
89
|
-
per_page: 50
|
|
90
|
-
})
|
|
91
|
-
]);
|
|
92
|
-
const allIssues = [...available.data, ...claimed.data, ...inReview.data, ...changesNeeded.data];
|
|
93
|
-
const seen = /* @__PURE__ */ new Set();
|
|
94
|
-
const unique = [];
|
|
95
|
-
for (const issue of allIssues) {
|
|
96
|
-
if (!seen.has(issue.number)) {
|
|
97
|
-
seen.add(issue.number);
|
|
98
|
-
unique.push(parseIssue(issue));
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return unique.sort((a, b) => a.number - b.number);
|
|
63
|
+
const { data } = await octokit.issues.listForRepo({
|
|
64
|
+
owner,
|
|
65
|
+
repo,
|
|
66
|
+
state: "open",
|
|
67
|
+
per_page: 100
|
|
68
|
+
});
|
|
69
|
+
return data.filter(
|
|
70
|
+
(issue) => !issue.pull_request && issue.labels.some((l) => TECHUNTER_LABELS.has(l.name ?? ""))
|
|
71
|
+
).map(parseIssue).sort((a, b) => a.number - b.number);
|
|
102
72
|
}
|
|
103
73
|
async function getTask(config, number) {
|
|
104
74
|
const octokit = createOctokit(config.githubToken);
|
|
@@ -316,6 +286,11 @@ async function ensureLabels(config) {
|
|
|
316
286
|
)
|
|
317
287
|
);
|
|
318
288
|
}
|
|
289
|
+
async function editTask(config, number, title, body) {
|
|
290
|
+
const octokit = createOctokit(config.githubToken);
|
|
291
|
+
const { owner, repo } = config.github;
|
|
292
|
+
await octokit.issues.update({ owner, repo, issue_number: number, title, body });
|
|
293
|
+
}
|
|
319
294
|
async function getDefaultBranch(config) {
|
|
320
295
|
const octokit = createOctokit(config.githubToken);
|
|
321
296
|
const { owner, repo } = config.github;
|
|
@@ -341,7 +316,7 @@ async function acceptTask(config, issueNumber) {
|
|
|
341
316
|
await closeTask(config, issueNumber);
|
|
342
317
|
return { prNumber: pr.number, prUrl: pr.html_url, sha: merge.sha ?? "" };
|
|
343
318
|
}
|
|
344
|
-
var LABEL_AVAILABLE, LABEL_CLAIMED, LABEL_IN_REVIEW, LABEL_CHANGES_NEEDED, LABELS;
|
|
319
|
+
var LABEL_AVAILABLE, LABEL_CLAIMED, LABEL_IN_REVIEW, LABEL_CHANGES_NEEDED, LABELS, TECHUNTER_LABELS;
|
|
345
320
|
var init_github = __esm({
|
|
346
321
|
"src/lib/github.ts"() {
|
|
347
322
|
"use strict";
|
|
@@ -355,6 +330,7 @@ var init_github = __esm({
|
|
|
355
330
|
{ name: LABEL_IN_REVIEW, color: "0075ca", description: "Task submitted for review" },
|
|
356
331
|
{ name: LABEL_CHANGES_NEEDED, color: "e11d48", description: "Task needs changes" }
|
|
357
332
|
];
|
|
333
|
+
TECHUNTER_LABELS = /* @__PURE__ */ new Set([LABEL_AVAILABLE, LABEL_CLAIMED, LABEL_IN_REVIEW, LABEL_CHANGES_NEEDED]);
|
|
358
334
|
}
|
|
359
335
|
});
|
|
360
336
|
|
|
@@ -362,6 +338,7 @@ var init_github = __esm({
|
|
|
362
338
|
import chalk14 from "chalk";
|
|
363
339
|
import readline from "readline";
|
|
364
340
|
import { createRequire } from "module";
|
|
341
|
+
import { input as input3 } from "@inquirer/prompts";
|
|
365
342
|
|
|
366
343
|
// src/commands/init.ts
|
|
367
344
|
import { input, password, select } from "@inquirer/prompts";
|
|
@@ -762,7 +739,7 @@ AI model set to: ${val.trim()}
|
|
|
762
739
|
init_github();
|
|
763
740
|
|
|
764
741
|
// src/lib/agent.ts
|
|
765
|
-
import
|
|
742
|
+
import ora15 from "ora";
|
|
766
743
|
import chalk13 from "chalk";
|
|
767
744
|
|
|
768
745
|
// src/tools/pick/index.ts
|
|
@@ -944,8 +921,8 @@ import { select as select3, input as promptInput } from "@inquirer/prompts";
|
|
|
944
921
|
|
|
945
922
|
// src/lib/agent-ui.ts
|
|
946
923
|
import chalk6 from "chalk";
|
|
947
|
-
function formatInput(
|
|
948
|
-
return Object.entries(
|
|
924
|
+
function formatInput(input4) {
|
|
925
|
+
return Object.entries(input4).map(([k, v]) => {
|
|
949
926
|
if (typeof v === "number") return `${k}=${v}`;
|
|
950
927
|
if (typeof v === "string") {
|
|
951
928
|
if (k === "body" || v.length > 50) return `${k}=[${v.length} chars]`;
|
|
@@ -958,8 +935,8 @@ function summarize(result) {
|
|
|
958
935
|
const first = result.split("\n").find((l) => l.trim()) ?? result;
|
|
959
936
|
return first.length > 100 ? first.slice(0, 97) + "..." : first;
|
|
960
937
|
}
|
|
961
|
-
function printToolCall(name,
|
|
962
|
-
const params = formatInput(
|
|
938
|
+
function printToolCall(name, input4) {
|
|
939
|
+
const params = formatInput(input4);
|
|
963
940
|
console.log(` ${chalk6.cyan("\u2192")} ${chalk6.bold(name)}${params ? " " + chalk6.dim(params) : ""}`);
|
|
964
941
|
}
|
|
965
942
|
function printToolResult(result) {
|
|
@@ -995,15 +972,15 @@ async function runSubAgentLoop(config, systemPrompt, userMessage, toolNames) {
|
|
|
995
972
|
}
|
|
996
973
|
if (choice.finish_reason === "tool_calls") {
|
|
997
974
|
for (const tc of choice.message.tool_calls ?? []) {
|
|
998
|
-
let
|
|
975
|
+
let input4;
|
|
999
976
|
try {
|
|
1000
|
-
|
|
977
|
+
input4 = JSON.parse(tc.function.arguments);
|
|
1001
978
|
} catch {
|
|
1002
|
-
|
|
979
|
+
input4 = {};
|
|
1003
980
|
}
|
|
1004
|
-
printToolCall(tc.function.name,
|
|
981
|
+
printToolCall(tc.function.name, input4);
|
|
1005
982
|
const mod = selected.find((m) => m.definition.function.name === tc.function.name);
|
|
1006
|
-
const result = mod ? await mod.execute(
|
|
983
|
+
const result = mod ? await mod.execute(input4, config) : `Unknown tool: ${tc.function.name}`;
|
|
1007
984
|
printToolResult(result);
|
|
1008
985
|
messages.push({ role: "tool", tool_call_id: tc.id, content: result });
|
|
1009
986
|
}
|
|
@@ -1045,7 +1022,7 @@ var definition = {
|
|
|
1045
1022
|
}
|
|
1046
1023
|
}
|
|
1047
1024
|
};
|
|
1048
|
-
async function run(config) {
|
|
1025
|
+
async function run(_input, config) {
|
|
1049
1026
|
const branch = await getCurrentBranch();
|
|
1050
1027
|
const match = branch.match(/^task-(\d+)-/);
|
|
1051
1028
|
if (!match) {
|
|
@@ -1133,7 +1110,7 @@ ${issue.body ?? ""}`.trim(),
|
|
|
1133
1110
|
Commit: "${commitMessage.trim()}"
|
|
1134
1111
|
PR: ${prUrl}`;
|
|
1135
1112
|
}
|
|
1136
|
-
async function execute(
|
|
1113
|
+
async function execute(input4, config) {
|
|
1137
1114
|
const branch = await getCurrentBranch();
|
|
1138
1115
|
const match = branch.match(/^task-(\d+)-/);
|
|
1139
1116
|
if (!match) return `Not on a task branch (current: ${branch}). Expected format: task-N-title.`;
|
|
@@ -1149,7 +1126,7 @@ async function execute(input3, config) {
|
|
|
1149
1126
|
} catch (err) {
|
|
1150
1127
|
review = `(Review failed: ${err.message})`;
|
|
1151
1128
|
}
|
|
1152
|
-
const commitMessage =
|
|
1129
|
+
const commitMessage = input4["commit_message"]?.trim() || `complete: ${issue.title}`;
|
|
1153
1130
|
try {
|
|
1154
1131
|
await stageAllAndCommit(commitMessage);
|
|
1155
1132
|
} catch (err) {
|
|
@@ -1206,8 +1183,8 @@ var definition2 = {
|
|
|
1206
1183
|
}
|
|
1207
1184
|
}
|
|
1208
1185
|
};
|
|
1209
|
-
async function run2(
|
|
1210
|
-
let issueNumber =
|
|
1186
|
+
async function run2(input4, config) {
|
|
1187
|
+
let issueNumber = input4["issue_number"];
|
|
1211
1188
|
if (!issueNumber) {
|
|
1212
1189
|
let tasks;
|
|
1213
1190
|
try {
|
|
@@ -1248,8 +1225,8 @@ async function run2(config, opts = {}) {
|
|
|
1248
1225
|
return `Error: ${err.message}`;
|
|
1249
1226
|
}
|
|
1250
1227
|
}
|
|
1251
|
-
async function execute2(
|
|
1252
|
-
const issueNumber =
|
|
1228
|
+
async function execute2(input4, config) {
|
|
1229
|
+
const issueNumber = input4["issue_number"];
|
|
1253
1230
|
const spinner = ora3(`Closing #${issueNumber}\u2026`).start();
|
|
1254
1231
|
try {
|
|
1255
1232
|
await closeTask(config, issueNumber);
|
|
@@ -1282,7 +1259,8 @@ var definition3 = {
|
|
|
1282
1259
|
}
|
|
1283
1260
|
}
|
|
1284
1261
|
};
|
|
1285
|
-
async function run3(
|
|
1262
|
+
async function run3(input4, config) {
|
|
1263
|
+
const preselected = input4["issue_number"];
|
|
1286
1264
|
let chosenNumber;
|
|
1287
1265
|
if (preselected !== void 0) {
|
|
1288
1266
|
chosenNumber = preselected;
|
|
@@ -1394,13 +1372,13 @@ Finish or submit it before claiming a new one.`;
|
|
|
1394
1372
|
return `Error claiming task: ${err.message}`;
|
|
1395
1373
|
}
|
|
1396
1374
|
}
|
|
1397
|
-
if (action === "submit") return run(config);
|
|
1398
|
-
if (action === "close") return run2(
|
|
1375
|
+
if (action === "submit") return run({}, config);
|
|
1376
|
+
if (action === "close") return run2({ issue_number: issue.number }, config);
|
|
1399
1377
|
return "Cancelled.";
|
|
1400
1378
|
}
|
|
1401
|
-
async function execute3(
|
|
1402
|
-
const issueNumber =
|
|
1403
|
-
const action =
|
|
1379
|
+
async function execute3(input4, config) {
|
|
1380
|
+
const issueNumber = input4["issue_number"];
|
|
1381
|
+
const action = input4["action"];
|
|
1404
1382
|
let issue;
|
|
1405
1383
|
try {
|
|
1406
1384
|
issue = await getTask(config, issueNumber);
|
|
@@ -1526,8 +1504,8 @@ var definition4 = {
|
|
|
1526
1504
|
}
|
|
1527
1505
|
}
|
|
1528
1506
|
};
|
|
1529
|
-
async function run4(
|
|
1530
|
-
let title =
|
|
1507
|
+
async function run4(input4, config) {
|
|
1508
|
+
let title = input4["title"]?.trim();
|
|
1531
1509
|
if (!title) {
|
|
1532
1510
|
try {
|
|
1533
1511
|
title = (await promptInput2({ message: "Task title:" })).trim();
|
|
@@ -1623,9 +1601,9 @@ async function run4(config, opts = {}) {
|
|
|
1623
1601
|
}
|
|
1624
1602
|
return `Created #${issueNumber} "${issueTitle}" \u2014 ${htmlUrl}`;
|
|
1625
1603
|
}
|
|
1626
|
-
async function execute4(
|
|
1627
|
-
const title =
|
|
1628
|
-
const feedback =
|
|
1604
|
+
async function execute4(input4, config) {
|
|
1605
|
+
const title = input4["title"].trim();
|
|
1606
|
+
const feedback = input4["feedback"];
|
|
1629
1607
|
let guide = await generateGuide(config, title);
|
|
1630
1608
|
if (feedback) {
|
|
1631
1609
|
guide = await generateGuide(config, title, { feedback, previousGuide: guide });
|
|
@@ -1660,7 +1638,7 @@ var definition5 = {
|
|
|
1660
1638
|
parameters: { type: "object", properties: {}, required: [] }
|
|
1661
1639
|
}
|
|
1662
1640
|
};
|
|
1663
|
-
async function run5(config) {
|
|
1641
|
+
async function run5(_input, config) {
|
|
1664
1642
|
const spinner = ora6("Fetching your tasks\u2026").start();
|
|
1665
1643
|
try {
|
|
1666
1644
|
const me = await getAuthenticatedUser(config);
|
|
@@ -1675,7 +1653,7 @@ ${lines.join("\n")}`;
|
|
|
1675
1653
|
return `Error: ${err.message}`;
|
|
1676
1654
|
}
|
|
1677
1655
|
}
|
|
1678
|
-
var execute5 =
|
|
1656
|
+
var execute5 = run5;
|
|
1679
1657
|
var terminal5 = true;
|
|
1680
1658
|
|
|
1681
1659
|
// src/tools/review/index.ts
|
|
@@ -1696,7 +1674,7 @@ var definition6 = {
|
|
|
1696
1674
|
parameters: { type: "object", properties: {}, required: [] }
|
|
1697
1675
|
}
|
|
1698
1676
|
};
|
|
1699
|
-
async function run6(config) {
|
|
1677
|
+
async function run6(_input, config) {
|
|
1700
1678
|
const spinner = ora7("Loading tasks for review\u2026").start();
|
|
1701
1679
|
try {
|
|
1702
1680
|
const me = await getAuthenticatedUser(config);
|
|
@@ -1711,7 +1689,7 @@ ${lines.join("\n")}`;
|
|
|
1711
1689
|
return `Error: ${err.message}`;
|
|
1712
1690
|
}
|
|
1713
1691
|
}
|
|
1714
|
-
var execute6 =
|
|
1692
|
+
var execute6 = run6;
|
|
1715
1693
|
var terminal6 = true;
|
|
1716
1694
|
|
|
1717
1695
|
// src/tools/refresh/index.ts
|
|
@@ -1730,7 +1708,7 @@ var definition7 = {
|
|
|
1730
1708
|
parameters: { type: "object", properties: {}, required: [] }
|
|
1731
1709
|
}
|
|
1732
1710
|
};
|
|
1733
|
-
async function run7(config) {
|
|
1711
|
+
async function run7(_input, config) {
|
|
1734
1712
|
const tasks = await printTaskList(config);
|
|
1735
1713
|
if (tasks.length === 0) return "No tasks found.";
|
|
1736
1714
|
const lines = tasks.map((t) => {
|
|
@@ -1741,7 +1719,7 @@ async function run7(config) {
|
|
|
1741
1719
|
return `Tasks (${tasks.length}):
|
|
1742
1720
|
${lines.join("\n")}`;
|
|
1743
1721
|
}
|
|
1744
|
-
var execute7 =
|
|
1722
|
+
var execute7 = run7;
|
|
1745
1723
|
var terminal7 = true;
|
|
1746
1724
|
|
|
1747
1725
|
// src/tools/open-code/index.ts
|
|
@@ -1761,7 +1739,7 @@ var definition8 = {
|
|
|
1761
1739
|
parameters: { type: "object", properties: {}, required: [] }
|
|
1762
1740
|
}
|
|
1763
1741
|
};
|
|
1764
|
-
async function run8(config) {
|
|
1742
|
+
async function run8(_input, config) {
|
|
1765
1743
|
let branch;
|
|
1766
1744
|
try {
|
|
1767
1745
|
branch = await getCurrentBranch();
|
|
@@ -1780,7 +1758,7 @@ async function run8(config) {
|
|
|
1780
1758
|
await launchClaudeCode(issue, branch);
|
|
1781
1759
|
return "Claude Code session ended.";
|
|
1782
1760
|
}
|
|
1783
|
-
var execute8 =
|
|
1761
|
+
var execute8 = run8;
|
|
1784
1762
|
var terminal8 = true;
|
|
1785
1763
|
|
|
1786
1764
|
// src/tools/reject/index.ts
|
|
@@ -1840,8 +1818,8 @@ var definition9 = {
|
|
|
1840
1818
|
}
|
|
1841
1819
|
}
|
|
1842
1820
|
};
|
|
1843
|
-
async function run9(
|
|
1844
|
-
const
|
|
1821
|
+
async function run9(input4, config) {
|
|
1822
|
+
const issueNumber = input4["issue_number"];
|
|
1845
1823
|
let feedback;
|
|
1846
1824
|
try {
|
|
1847
1825
|
feedback = await promptInput3({
|
|
@@ -1908,9 +1886,9 @@ async function run9(config, opts) {
|
|
|
1908
1886
|
return `Task #${issueNumber} rejected. Label changed to changes-needed.`;
|
|
1909
1887
|
}
|
|
1910
1888
|
}
|
|
1911
|
-
async function execute9(
|
|
1912
|
-
const issueNumber =
|
|
1913
|
-
const feedback =
|
|
1889
|
+
async function execute9(input4, config) {
|
|
1890
|
+
const issueNumber = input4["issue_number"];
|
|
1891
|
+
const feedback = input4["feedback"];
|
|
1914
1892
|
let comment;
|
|
1915
1893
|
try {
|
|
1916
1894
|
comment = await generateRejectionComment(config, issueNumber, feedback);
|
|
@@ -1960,8 +1938,8 @@ var definition10 = {
|
|
|
1960
1938
|
}
|
|
1961
1939
|
}
|
|
1962
1940
|
};
|
|
1963
|
-
async function run10(
|
|
1964
|
-
let issueNumber =
|
|
1941
|
+
async function run10(input4, config) {
|
|
1942
|
+
let issueNumber = input4["issue_number"];
|
|
1965
1943
|
if (!issueNumber) {
|
|
1966
1944
|
const spinner2 = ora9("Loading tasks for review\u2026").start();
|
|
1967
1945
|
let tasks;
|
|
@@ -2013,8 +1991,8 @@ Issue closed.`;
|
|
|
2013
1991
|
return `Error: ${err.message}`;
|
|
2014
1992
|
}
|
|
2015
1993
|
}
|
|
2016
|
-
async function execute10(
|
|
2017
|
-
const issueNumber =
|
|
1994
|
+
async function execute10(input4, config) {
|
|
1995
|
+
const issueNumber = input4["issue_number"];
|
|
2018
1996
|
const spinner = ora9(`Merging PR for #${issueNumber}\u2026`).start();
|
|
2019
1997
|
try {
|
|
2020
1998
|
const result = await acceptTask(config, issueNumber);
|
|
@@ -2030,14 +2008,138 @@ Issue closed.`;
|
|
|
2030
2008
|
}
|
|
2031
2009
|
var terminal10 = true;
|
|
2032
2010
|
|
|
2011
|
+
// src/tools/edit-task/index.ts
|
|
2012
|
+
var edit_task_exports = {};
|
|
2013
|
+
__export(edit_task_exports, {
|
|
2014
|
+
definition: () => definition11,
|
|
2015
|
+
execute: () => execute11,
|
|
2016
|
+
run: () => run11,
|
|
2017
|
+
terminal: () => terminal11
|
|
2018
|
+
});
|
|
2019
|
+
init_github();
|
|
2020
|
+
import { select as select9, input as promptInput4 } from "@inquirer/prompts";
|
|
2021
|
+
import ora10 from "ora";
|
|
2022
|
+
var definition11 = {
|
|
2023
|
+
type: "function",
|
|
2024
|
+
function: {
|
|
2025
|
+
name: "edit_task",
|
|
2026
|
+
description: "Edit the title and/or body of an existing task (GitHub Issue). Equivalent to /edit.",
|
|
2027
|
+
parameters: {
|
|
2028
|
+
type: "object",
|
|
2029
|
+
properties: {
|
|
2030
|
+
issue_number: { type: "number", description: "Issue number to edit." },
|
|
2031
|
+
title: { type: "string", description: "New title." },
|
|
2032
|
+
body: { type: "string", description: "New body/description." }
|
|
2033
|
+
},
|
|
2034
|
+
required: ["issue_number", "title", "body"]
|
|
2035
|
+
}
|
|
2036
|
+
}
|
|
2037
|
+
};
|
|
2038
|
+
async function run11(input4, config) {
|
|
2039
|
+
let issueNumber = input4["issue_number"];
|
|
2040
|
+
if (!issueNumber) {
|
|
2041
|
+
let tasks;
|
|
2042
|
+
try {
|
|
2043
|
+
tasks = await listTasks(config);
|
|
2044
|
+
} catch (err) {
|
|
2045
|
+
return `Error loading tasks: ${err.message}`;
|
|
2046
|
+
}
|
|
2047
|
+
if (tasks.length === 0) return "No tasks found.";
|
|
2048
|
+
try {
|
|
2049
|
+
issueNumber = await select9({
|
|
2050
|
+
message: "Select task to edit:",
|
|
2051
|
+
choices: tasks.map((t) => ({ name: `#${t.number} [${getStatus(t)}] ${t.title}`, value: t.number }))
|
|
2052
|
+
});
|
|
2053
|
+
} catch {
|
|
2054
|
+
return "Cancelled.";
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
let issue;
|
|
2058
|
+
try {
|
|
2059
|
+
issue = await getTask(config, issueNumber);
|
|
2060
|
+
} catch (err) {
|
|
2061
|
+
return `Error loading task: ${err.message}`;
|
|
2062
|
+
}
|
|
2063
|
+
let title;
|
|
2064
|
+
let body;
|
|
2065
|
+
try {
|
|
2066
|
+
title = await promptInput4({
|
|
2067
|
+
message: "Title:",
|
|
2068
|
+
default: issue.title
|
|
2069
|
+
});
|
|
2070
|
+
body = await promptInput4({
|
|
2071
|
+
message: "Description:",
|
|
2072
|
+
default: issue.body ?? ""
|
|
2073
|
+
});
|
|
2074
|
+
} catch {
|
|
2075
|
+
return "Cancelled.";
|
|
2076
|
+
}
|
|
2077
|
+
if (title.trim() === issue.title && body.trim() === (issue.body ?? "")) {
|
|
2078
|
+
return "No changes made.";
|
|
2079
|
+
}
|
|
2080
|
+
const spinner = ora10(`Updating #${issueNumber}\u2026`).start();
|
|
2081
|
+
try {
|
|
2082
|
+
await editTask(config, issueNumber, title.trim() || issue.title, body.trim());
|
|
2083
|
+
spinner.stop();
|
|
2084
|
+
return `Task #${issueNumber} updated.`;
|
|
2085
|
+
} catch (err) {
|
|
2086
|
+
spinner.stop();
|
|
2087
|
+
return `Error: ${err.message}`;
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2090
|
+
async function execute11(input4, config) {
|
|
2091
|
+
const issueNumber = input4["issue_number"];
|
|
2092
|
+
const title = input4["title"];
|
|
2093
|
+
const body = input4["body"];
|
|
2094
|
+
const spinner = ora10(`Updating #${issueNumber}\u2026`).start();
|
|
2095
|
+
try {
|
|
2096
|
+
await editTask(config, issueNumber, title, body);
|
|
2097
|
+
spinner.stop();
|
|
2098
|
+
return `Task #${issueNumber} updated.`;
|
|
2099
|
+
} catch (err) {
|
|
2100
|
+
spinner.stop();
|
|
2101
|
+
return `Error: ${err.message}`;
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2104
|
+
var terminal11 = true;
|
|
2105
|
+
|
|
2106
|
+
// src/tools/list-tasks/index.ts
|
|
2107
|
+
var list_tasks_exports = {};
|
|
2108
|
+
__export(list_tasks_exports, {
|
|
2109
|
+
definition: () => definition12,
|
|
2110
|
+
execute: () => execute12
|
|
2111
|
+
});
|
|
2112
|
+
init_github();
|
|
2113
|
+
var definition12 = {
|
|
2114
|
+
type: "function",
|
|
2115
|
+
function: {
|
|
2116
|
+
name: "list_tasks",
|
|
2117
|
+
description: "List all open tasks (GitHub Issues) with their status and assignee. Use this to answer questions about available work, task progress, or who is working on what.",
|
|
2118
|
+
parameters: {
|
|
2119
|
+
type: "object",
|
|
2120
|
+
properties: {},
|
|
2121
|
+
required: []
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
};
|
|
2125
|
+
async function execute12(_input, config) {
|
|
2126
|
+
const tasks = await listTasks(config);
|
|
2127
|
+
if (tasks.length === 0) return "No open tasks.";
|
|
2128
|
+
return tasks.map((t) => {
|
|
2129
|
+
const status = t.labels.find((l) => l.startsWith("techunter:"))?.replace("techunter:", "") ?? "unknown";
|
|
2130
|
+
const assignee = t.assignee ? `@${t.assignee}` : "\u2014";
|
|
2131
|
+
return `#${t.number} [${status}] ${assignee} ${t.title}`;
|
|
2132
|
+
}).join("\n");
|
|
2133
|
+
}
|
|
2134
|
+
|
|
2033
2135
|
// src/tools/get-task/index.ts
|
|
2034
2136
|
var get_task_exports = {};
|
|
2035
2137
|
__export(get_task_exports, {
|
|
2036
|
-
definition: () =>
|
|
2037
|
-
execute: () =>
|
|
2138
|
+
definition: () => definition13,
|
|
2139
|
+
execute: () => execute13
|
|
2038
2140
|
});
|
|
2039
2141
|
init_github();
|
|
2040
|
-
var
|
|
2142
|
+
var definition13 = {
|
|
2041
2143
|
type: "function",
|
|
2042
2144
|
function: {
|
|
2043
2145
|
name: "get_task",
|
|
@@ -2051,8 +2153,8 @@ var definition11 = {
|
|
|
2051
2153
|
}
|
|
2052
2154
|
}
|
|
2053
2155
|
};
|
|
2054
|
-
async function
|
|
2055
|
-
const issue = await getTask(config,
|
|
2156
|
+
async function execute13(input4, config) {
|
|
2157
|
+
const issue = await getTask(config, input4["issue_number"]);
|
|
2056
2158
|
const status = issue.labels.find((l) => l.startsWith("techunter:"))?.replace("techunter:", "") ?? "unknown";
|
|
2057
2159
|
const assignee = issue.assignee ? `@${issue.assignee}` : "\u2014";
|
|
2058
2160
|
const lines = [
|
|
@@ -2068,12 +2170,12 @@ ${issue.body}`);
|
|
|
2068
2170
|
// src/tools/get-comments/index.ts
|
|
2069
2171
|
var get_comments_exports = {};
|
|
2070
2172
|
__export(get_comments_exports, {
|
|
2071
|
-
definition: () =>
|
|
2072
|
-
execute: () =>
|
|
2173
|
+
definition: () => definition14,
|
|
2174
|
+
execute: () => execute14
|
|
2073
2175
|
});
|
|
2074
2176
|
init_github();
|
|
2075
|
-
import
|
|
2076
|
-
var
|
|
2177
|
+
import ora11 from "ora";
|
|
2178
|
+
var definition14 = {
|
|
2077
2179
|
type: "function",
|
|
2078
2180
|
function: {
|
|
2079
2181
|
name: "get_comments",
|
|
@@ -2088,10 +2190,10 @@ var definition12 = {
|
|
|
2088
2190
|
}
|
|
2089
2191
|
}
|
|
2090
2192
|
};
|
|
2091
|
-
async function
|
|
2092
|
-
const issueNumber =
|
|
2093
|
-
const limit =
|
|
2094
|
-
const spinner =
|
|
2193
|
+
async function execute14(input4, config) {
|
|
2194
|
+
const issueNumber = input4["issue_number"];
|
|
2195
|
+
const limit = input4["limit"] ?? 5;
|
|
2196
|
+
const spinner = ora11(`Loading comments for #${issueNumber}...`).start();
|
|
2095
2197
|
try {
|
|
2096
2198
|
const comments = await listComments(config, issueNumber, limit);
|
|
2097
2199
|
spinner.stop();
|
|
@@ -2110,11 +2212,11 @@ ${lines.join("\n\n")}`;
|
|
|
2110
2212
|
// src/tools/get-diff/index.ts
|
|
2111
2213
|
var get_diff_exports = {};
|
|
2112
2214
|
__export(get_diff_exports, {
|
|
2113
|
-
definition: () =>
|
|
2114
|
-
execute: () =>
|
|
2215
|
+
definition: () => definition15,
|
|
2216
|
+
execute: () => execute15
|
|
2115
2217
|
});
|
|
2116
|
-
import
|
|
2117
|
-
var
|
|
2218
|
+
import ora12 from "ora";
|
|
2219
|
+
var definition15 = {
|
|
2118
2220
|
type: "function",
|
|
2119
2221
|
function: {
|
|
2120
2222
|
name: "get_diff",
|
|
@@ -2122,8 +2224,8 @@ var definition13 = {
|
|
|
2122
2224
|
parameters: { type: "object", properties: {}, required: [] }
|
|
2123
2225
|
}
|
|
2124
2226
|
};
|
|
2125
|
-
async function
|
|
2126
|
-
const spinner =
|
|
2227
|
+
async function execute15(_input, _config) {
|
|
2228
|
+
const spinner = ora12("Reading git diff...").start();
|
|
2127
2229
|
try {
|
|
2128
2230
|
const diff = await getDiff(_config.github.baseBranch);
|
|
2129
2231
|
spinner.stop();
|
|
@@ -2137,14 +2239,14 @@ async function execute13(_input, _config) {
|
|
|
2137
2239
|
// src/tools/run-command/index.ts
|
|
2138
2240
|
var run_command_exports = {};
|
|
2139
2241
|
__export(run_command_exports, {
|
|
2140
|
-
definition: () =>
|
|
2141
|
-
execute: () =>
|
|
2242
|
+
definition: () => definition16,
|
|
2243
|
+
execute: () => execute16
|
|
2142
2244
|
});
|
|
2143
2245
|
import { exec } from "child_process";
|
|
2144
2246
|
import { promisify } from "util";
|
|
2145
|
-
import
|
|
2247
|
+
import ora13 from "ora";
|
|
2146
2248
|
var execAsync = promisify(exec);
|
|
2147
|
-
var
|
|
2249
|
+
var definition16 = {
|
|
2148
2250
|
type: "function",
|
|
2149
2251
|
function: {
|
|
2150
2252
|
name: "run_command",
|
|
@@ -2158,10 +2260,10 @@ var definition14 = {
|
|
|
2158
2260
|
}
|
|
2159
2261
|
}
|
|
2160
2262
|
};
|
|
2161
|
-
async function
|
|
2162
|
-
const command =
|
|
2263
|
+
async function execute16(input4, _config) {
|
|
2264
|
+
const command = input4["command"];
|
|
2163
2265
|
const cwd = process.cwd();
|
|
2164
|
-
const spinner =
|
|
2266
|
+
const spinner = ora13(`$ ${command}`).start();
|
|
2165
2267
|
try {
|
|
2166
2268
|
const { stdout, stderr } = await execAsync(command, { cwd, timeout: 6e4, maxBuffer: 1024 * 1024 });
|
|
2167
2269
|
spinner.stop();
|
|
@@ -2180,10 +2282,10 @@ ${out || e.message}`;
|
|
|
2180
2282
|
// src/tools/scan-project/index.ts
|
|
2181
2283
|
var scan_project_exports = {};
|
|
2182
2284
|
__export(scan_project_exports, {
|
|
2183
|
-
definition: () =>
|
|
2184
|
-
execute: () =>
|
|
2285
|
+
definition: () => definition17,
|
|
2286
|
+
execute: () => execute17
|
|
2185
2287
|
});
|
|
2186
|
-
import
|
|
2288
|
+
import ora14 from "ora";
|
|
2187
2289
|
|
|
2188
2290
|
// src/lib/project.ts
|
|
2189
2291
|
import { readFile as readFile2 } from "fs/promises";
|
|
@@ -2334,7 +2436,7 @@ async function buildProjectContext(cwd, issueTitle, issueBody) {
|
|
|
2334
2436
|
}
|
|
2335
2437
|
|
|
2336
2438
|
// src/tools/scan-project/index.ts
|
|
2337
|
-
var
|
|
2439
|
+
var definition17 = {
|
|
2338
2440
|
type: "function",
|
|
2339
2441
|
function: {
|
|
2340
2442
|
name: "scan_project",
|
|
@@ -2351,9 +2453,9 @@ var definition15 = {
|
|
|
2351
2453
|
}
|
|
2352
2454
|
}
|
|
2353
2455
|
};
|
|
2354
|
-
async function
|
|
2355
|
-
const focus =
|
|
2356
|
-
const spinner =
|
|
2456
|
+
async function execute17(input4, _config) {
|
|
2457
|
+
const focus = input4["focus"] ?? "";
|
|
2458
|
+
const spinner = ora14("Scanning project...").start();
|
|
2357
2459
|
try {
|
|
2358
2460
|
const cwd = process.cwd();
|
|
2359
2461
|
const context = await buildProjectContext(cwd, focus, "");
|
|
@@ -2382,12 +2484,12 @@ ${content}
|
|
|
2382
2484
|
// src/tools/read-file/index.ts
|
|
2383
2485
|
var read_file_exports = {};
|
|
2384
2486
|
__export(read_file_exports, {
|
|
2385
|
-
definition: () =>
|
|
2386
|
-
execute: () =>
|
|
2487
|
+
definition: () => definition18,
|
|
2488
|
+
execute: () => execute18
|
|
2387
2489
|
});
|
|
2388
2490
|
import { readFile as readFile3 } from "fs/promises";
|
|
2389
2491
|
import path3 from "path";
|
|
2390
|
-
var
|
|
2492
|
+
var definition18 = {
|
|
2391
2493
|
type: "function",
|
|
2392
2494
|
function: {
|
|
2393
2495
|
name: "read_file",
|
|
@@ -2401,8 +2503,8 @@ var definition16 = {
|
|
|
2401
2503
|
}
|
|
2402
2504
|
}
|
|
2403
2505
|
};
|
|
2404
|
-
async function
|
|
2405
|
-
const filePath =
|
|
2506
|
+
async function execute18(input4, _config) {
|
|
2507
|
+
const filePath = input4["path"];
|
|
2406
2508
|
try {
|
|
2407
2509
|
const fullPath = path3.join(process.cwd(), filePath);
|
|
2408
2510
|
const content = await readFile3(fullPath, "utf-8");
|
|
@@ -2415,12 +2517,12 @@ async function execute16(input3, _config) {
|
|
|
2415
2517
|
// src/tools/ask-user/index.ts
|
|
2416
2518
|
var ask_user_exports = {};
|
|
2417
2519
|
__export(ask_user_exports, {
|
|
2418
|
-
definition: () =>
|
|
2419
|
-
execute: () =>
|
|
2520
|
+
definition: () => definition19,
|
|
2521
|
+
execute: () => execute19
|
|
2420
2522
|
});
|
|
2421
2523
|
import chalk12 from "chalk";
|
|
2422
|
-
import { select as
|
|
2423
|
-
var
|
|
2524
|
+
import { select as select10, input as promptInput5 } from "@inquirer/prompts";
|
|
2525
|
+
var definition19 = {
|
|
2424
2526
|
type: "function",
|
|
2425
2527
|
function: {
|
|
2426
2528
|
name: "ask_user",
|
|
@@ -2439,9 +2541,9 @@ var definition17 = {
|
|
|
2439
2541
|
}
|
|
2440
2542
|
}
|
|
2441
2543
|
};
|
|
2442
|
-
async function
|
|
2443
|
-
const question =
|
|
2444
|
-
const options =
|
|
2544
|
+
async function execute19(input4, _config) {
|
|
2545
|
+
const question = input4["question"];
|
|
2546
|
+
const options = input4["options"];
|
|
2445
2547
|
const OTHER = "__other__";
|
|
2446
2548
|
console.log("");
|
|
2447
2549
|
console.log(chalk12.dim(" \u250C\u2500 Agent question " + "\u2500".repeat(51)));
|
|
@@ -2452,14 +2554,14 @@ async function execute17(input3, _config) {
|
|
|
2452
2554
|
console.log(chalk12.dim(" \u2514" + "\u2500".repeat(67)));
|
|
2453
2555
|
let answer;
|
|
2454
2556
|
try {
|
|
2455
|
-
const chosen = await
|
|
2557
|
+
const chosen = await select10({
|
|
2456
2558
|
message: " ",
|
|
2457
2559
|
choices: [
|
|
2458
2560
|
...options.map((o) => ({ name: o, value: o })),
|
|
2459
2561
|
{ name: chalk12.dim("Other (describe below)"), value: OTHER }
|
|
2460
2562
|
]
|
|
2461
2563
|
});
|
|
2462
|
-
answer = chosen === OTHER ? await
|
|
2564
|
+
answer = chosen === OTHER ? await promptInput5({ message: "Your answer:" }) : chosen;
|
|
2463
2565
|
} catch {
|
|
2464
2566
|
answer = "User skipped this question \u2014 use your best judgement.";
|
|
2465
2567
|
}
|
|
@@ -2480,7 +2582,9 @@ var toolModules = [
|
|
|
2480
2582
|
open_code_exports,
|
|
2481
2583
|
reject_exports,
|
|
2482
2584
|
accept_exports,
|
|
2585
|
+
edit_task_exports,
|
|
2483
2586
|
// Low-level tools
|
|
2587
|
+
list_tasks_exports,
|
|
2484
2588
|
get_task_exports,
|
|
2485
2589
|
get_comments_exports,
|
|
2486
2590
|
get_diff_exports,
|
|
@@ -2492,11 +2596,12 @@ var toolModules = [
|
|
|
2492
2596
|
|
|
2493
2597
|
// src/lib/agent.ts
|
|
2494
2598
|
var tools = toolModules.map((m) => m.definition);
|
|
2495
|
-
async function executeTool(name,
|
|
2599
|
+
async function executeTool(name, input4, config) {
|
|
2496
2600
|
const mod = toolModules.find((m) => m.definition.function.name === name);
|
|
2497
2601
|
if (!mod) return `Unknown tool: ${name}`;
|
|
2498
2602
|
try {
|
|
2499
|
-
|
|
2603
|
+
const fn = mod.run ?? mod.execute;
|
|
2604
|
+
return await fn(input4, config);
|
|
2500
2605
|
} catch (err) {
|
|
2501
2606
|
return `Error: ${err.message}`;
|
|
2502
2607
|
}
|
|
@@ -2549,9 +2654,7 @@ async function runAgentLoop(config, messages) {
|
|
|
2549
2654
|
if (++iterations > MAX_ITERATIONS) {
|
|
2550
2655
|
throw new Error(`Agent exceeded ${MAX_ITERATIONS} iterations without finishing.`);
|
|
2551
2656
|
}
|
|
2552
|
-
const
|
|
2553
|
-
const spinner = isWindows ? null : ora14({ text: chalk13.dim("Thinking\u2026"), color: "cyan" }).start();
|
|
2554
|
-
if (isWindows) process.stdout.write(chalk13.dim(" Thinking\u2026"));
|
|
2657
|
+
const spinner = ora15({ text: chalk13.dim("Thinking\u2026"), color: "cyan" }).start();
|
|
2555
2658
|
let response;
|
|
2556
2659
|
try {
|
|
2557
2660
|
response = await client.chat.completions.create({
|
|
@@ -2560,12 +2663,10 @@ async function runAgentLoop(config, messages) {
|
|
|
2560
2663
|
messages: [systemMessage, ...messages]
|
|
2561
2664
|
});
|
|
2562
2665
|
} catch (err) {
|
|
2563
|
-
|
|
2564
|
-
else process.stdout.write("\r" + " ".repeat(14) + "\r");
|
|
2666
|
+
spinner.stop();
|
|
2565
2667
|
throw err;
|
|
2566
2668
|
}
|
|
2567
|
-
|
|
2568
|
-
else process.stdout.write("\r" + " ".repeat(14) + "\r");
|
|
2669
|
+
spinner.stop();
|
|
2569
2670
|
const choice = response.choices[0];
|
|
2570
2671
|
const assistantMessage = {
|
|
2571
2672
|
role: "assistant",
|
|
@@ -2598,7 +2699,7 @@ async function runAgentLoop(config, messages) {
|
|
|
2598
2699
|
return executeTool(tc.function.name, parsed, config);
|
|
2599
2700
|
})
|
|
2600
2701
|
);
|
|
2601
|
-
let
|
|
2702
|
+
let terminal12 = false;
|
|
2602
2703
|
for (let i = 0; i < toolCalls.length; i++) {
|
|
2603
2704
|
printToolResult(results[i]);
|
|
2604
2705
|
messages.push({
|
|
@@ -2607,10 +2708,10 @@ async function runAgentLoop(config, messages) {
|
|
|
2607
2708
|
content: results[i]
|
|
2608
2709
|
});
|
|
2609
2710
|
if (toolModules.find((m) => m.definition.function.name === toolCalls[i].function.name)?.terminal) {
|
|
2610
|
-
|
|
2711
|
+
terminal12 = true;
|
|
2611
2712
|
}
|
|
2612
2713
|
}
|
|
2613
|
-
if (
|
|
2714
|
+
if (terminal12) return results[results.length - 1];
|
|
2614
2715
|
} else {
|
|
2615
2716
|
return choice.message.content ?? "";
|
|
2616
2717
|
}
|
|
@@ -2633,6 +2734,8 @@ var SLASH_NAMES = [
|
|
|
2633
2734
|
"/s",
|
|
2634
2735
|
"/close",
|
|
2635
2736
|
"/d",
|
|
2737
|
+
"/edit",
|
|
2738
|
+
"/e",
|
|
2636
2739
|
"/review",
|
|
2637
2740
|
"/rv",
|
|
2638
2741
|
"/accept",
|
|
@@ -2642,7 +2745,8 @@ var SLASH_NAMES = [
|
|
|
2642
2745
|
"/code",
|
|
2643
2746
|
"/c",
|
|
2644
2747
|
"/config",
|
|
2645
|
-
"/cfg"
|
|
2748
|
+
"/cfg",
|
|
2749
|
+
"/init"
|
|
2646
2750
|
];
|
|
2647
2751
|
function completer(line) {
|
|
2648
2752
|
if (line.startsWith("/")) {
|
|
@@ -2663,10 +2767,12 @@ var COMMANDS = [
|
|
|
2663
2767
|
{ cmd: "/pick", alias: "/p", desc: "Browse tasks and view details" },
|
|
2664
2768
|
{ cmd: "/new", alias: "/n", desc: "Create a new task interactively" },
|
|
2665
2769
|
{ cmd: "/close", alias: "/d", desc: "Close (delete) a task" },
|
|
2770
|
+
{ cmd: "/edit", alias: "/e", desc: "Edit the title or description of a task" },
|
|
2666
2771
|
{ cmd: "/submit", alias: "/s", desc: "Commit, create PR, and mark in-review" },
|
|
2667
2772
|
{ cmd: "/review", alias: "/rv", desc: "List tasks waiting for your approval" },
|
|
2668
2773
|
{ cmd: "/accept", alias: "/ac", desc: "Accept a reviewed task: merge PR and close issue" },
|
|
2669
2774
|
{ cmd: "/config", alias: "/cfg", desc: "Change settings (branch, repo, API keys)" },
|
|
2775
|
+
{ cmd: "/init", desc: "Re-run setup wizard for this repo" },
|
|
2670
2776
|
{ cmd: "/status", alias: "/me", desc: "Show tasks assigned to you" },
|
|
2671
2777
|
{ cmd: "/code", alias: "/c", desc: "Open Claude Code for the current task branch" }
|
|
2672
2778
|
];
|
|
@@ -2695,6 +2801,30 @@ function printBanner(config) {
|
|
|
2695
2801
|
);
|
|
2696
2802
|
console.log("");
|
|
2697
2803
|
}
|
|
2804
|
+
async function initNewRepo(config, owner, repo) {
|
|
2805
|
+
console.log("");
|
|
2806
|
+
console.log(chalk14.bold.cyan(` New repo detected: ${owner}/${repo}`));
|
|
2807
|
+
console.log(chalk14.dim(" Setting up Techunter for this repository...\n"));
|
|
2808
|
+
const baseBranch = await input3({
|
|
2809
|
+
message: "Main branch to merge PRs into:",
|
|
2810
|
+
default: "main"
|
|
2811
|
+
});
|
|
2812
|
+
const newConfig = {
|
|
2813
|
+
...config,
|
|
2814
|
+
github: { owner, repo, baseBranch: baseBranch.trim() || "main" }
|
|
2815
|
+
};
|
|
2816
|
+
setConfig({ github: newConfig.github });
|
|
2817
|
+
const ora16 = (await import("ora")).default;
|
|
2818
|
+
const spinner = ora16("Creating Techunter labels...").start();
|
|
2819
|
+
try {
|
|
2820
|
+
await ensureLabels(newConfig);
|
|
2821
|
+
spinner.succeed("Labels ready");
|
|
2822
|
+
} catch (err) {
|
|
2823
|
+
spinner.fail(`Could not create labels: ${err.message}`);
|
|
2824
|
+
}
|
|
2825
|
+
console.log("");
|
|
2826
|
+
return newConfig;
|
|
2827
|
+
}
|
|
2698
2828
|
async function main() {
|
|
2699
2829
|
const args = process.argv.slice(2);
|
|
2700
2830
|
if (args[0] === "config") {
|
|
@@ -2726,11 +2856,10 @@ Setup failed: ${err.message}`));
|
|
|
2726
2856
|
const detected = parseOwnerRepo(remoteUrl);
|
|
2727
2857
|
if (detected) {
|
|
2728
2858
|
const isNewRepo = detected.owner !== config.github.owner || detected.repo !== config.github.repo;
|
|
2729
|
-
config = { ...config, github: { ...config.github, owner: detected.owner, repo: detected.repo, baseBranch: void 0 } };
|
|
2730
2859
|
if (isNewRepo) {
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
}
|
|
2860
|
+
config = await initNewRepo(config, detected.owner, detected.repo);
|
|
2861
|
+
} else {
|
|
2862
|
+
config = { ...config, github: { ...config.github, owner: detected.owner, repo: detected.repo } };
|
|
2734
2863
|
}
|
|
2735
2864
|
}
|
|
2736
2865
|
} else if (!config.github.owner) {
|
|
@@ -2769,13 +2898,13 @@ Setup failed: ${err.message}`));
|
|
|
2769
2898
|
break;
|
|
2770
2899
|
case "/refresh":
|
|
2771
2900
|
case "/r":
|
|
2772
|
-
await run7(config);
|
|
2901
|
+
await run7({}, config);
|
|
2773
2902
|
break;
|
|
2774
2903
|
case "/pick":
|
|
2775
2904
|
case "/p": {
|
|
2776
2905
|
const arg = userInput.slice(cmd.length).trim().replace(/^#/, "");
|
|
2777
2906
|
const preselected = arg ? parseInt(arg, 10) : void 0;
|
|
2778
|
-
const result = await run3(
|
|
2907
|
+
const result = await run3({ issue_number: Number.isNaN(preselected) ? void 0 : preselected }, config);
|
|
2779
2908
|
if (result && result !== "Cancelled.") {
|
|
2780
2909
|
console.log(chalk14.green(`
|
|
2781
2910
|
${result}
|
|
@@ -2786,7 +2915,7 @@ Setup failed: ${err.message}`));
|
|
|
2786
2915
|
}
|
|
2787
2916
|
case "/new":
|
|
2788
2917
|
case "/n": {
|
|
2789
|
-
const result = await run4(config);
|
|
2918
|
+
const result = await run4({}, config);
|
|
2790
2919
|
console.log(chalk14.green(`
|
|
2791
2920
|
${result}
|
|
2792
2921
|
`));
|
|
@@ -2795,14 +2924,25 @@ Setup failed: ${err.message}`));
|
|
|
2795
2924
|
}
|
|
2796
2925
|
case "/submit":
|
|
2797
2926
|
case "/s": {
|
|
2798
|
-
const result = await run(config);
|
|
2927
|
+
const result = await run({}, config);
|
|
2799
2928
|
console.log("\n" + renderMarkdown(result));
|
|
2800
2929
|
await printTaskList(config);
|
|
2801
2930
|
break;
|
|
2802
2931
|
}
|
|
2932
|
+
case "/edit":
|
|
2933
|
+
case "/e": {
|
|
2934
|
+
const arg = userInput.slice(cmd.length).trim().replace(/^#/, "");
|
|
2935
|
+
const preselected = arg ? parseInt(arg, 10) : void 0;
|
|
2936
|
+
const result = await run11({ issue_number: Number.isNaN(preselected) ? void 0 : preselected }, config);
|
|
2937
|
+
console.log(chalk14.green(`
|
|
2938
|
+
${result}
|
|
2939
|
+
`));
|
|
2940
|
+
await printTaskList(config);
|
|
2941
|
+
break;
|
|
2942
|
+
}
|
|
2803
2943
|
case "/close":
|
|
2804
2944
|
case "/d": {
|
|
2805
|
-
const result = await run2(config);
|
|
2945
|
+
const result = await run2({}, config);
|
|
2806
2946
|
console.log(chalk14.green(`
|
|
2807
2947
|
${result}
|
|
2808
2948
|
`));
|
|
@@ -2811,13 +2951,13 @@ Setup failed: ${err.message}`));
|
|
|
2811
2951
|
}
|
|
2812
2952
|
case "/review":
|
|
2813
2953
|
case "/rv": {
|
|
2814
|
-
const result = await run6(config);
|
|
2954
|
+
const result = await run6({}, config);
|
|
2815
2955
|
console.log("\n" + renderMarkdown(result));
|
|
2816
2956
|
break;
|
|
2817
2957
|
}
|
|
2818
2958
|
case "/status":
|
|
2819
2959
|
case "/me": {
|
|
2820
|
-
const result = await run5(config);
|
|
2960
|
+
const result = await run5({}, config);
|
|
2821
2961
|
console.log("\n" + renderMarkdown(result));
|
|
2822
2962
|
break;
|
|
2823
2963
|
}
|
|
@@ -2825,7 +2965,7 @@ Setup failed: ${err.message}`));
|
|
|
2825
2965
|
case "/ac": {
|
|
2826
2966
|
const arg = userInput.slice(cmd.length).trim().replace(/^#/, "");
|
|
2827
2967
|
const preselected = arg ? parseInt(arg, 10) : void 0;
|
|
2828
|
-
const result = await run10(
|
|
2968
|
+
const result = await run10({ issue_number: Number.isNaN(preselected) ? void 0 : preselected }, config);
|
|
2829
2969
|
console.log(chalk14.green(`
|
|
2830
2970
|
${result}
|
|
2831
2971
|
`));
|
|
@@ -2836,9 +2976,20 @@ Setup failed: ${err.message}`));
|
|
|
2836
2976
|
case "/cfg":
|
|
2837
2977
|
await configCommand();
|
|
2838
2978
|
break;
|
|
2979
|
+
case "/init":
|
|
2980
|
+
try {
|
|
2981
|
+
await initCommand();
|
|
2982
|
+
config = getConfig();
|
|
2983
|
+
await printTaskList(config);
|
|
2984
|
+
} catch (err) {
|
|
2985
|
+
console.error(chalk14.red(`
|
|
2986
|
+
Init failed: ${err.message}
|
|
2987
|
+
`));
|
|
2988
|
+
}
|
|
2989
|
+
break;
|
|
2839
2990
|
case "/code":
|
|
2840
2991
|
case "/c":
|
|
2841
|
-
await run8(config);
|
|
2992
|
+
await run8({}, config);
|
|
2842
2993
|
break;
|
|
2843
2994
|
default:
|
|
2844
2995
|
console.log(chalk14.yellow(` Unknown command: ${cmd} (try /help)`));
|