techunter 1.0.0 → 1.0.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 +237 -237
- package/dist/index.js +328 -149
- package/dist/mcp.js +221 -62
- package/package.json +1 -1
package/dist/mcp.js
CHANGED
|
@@ -46,11 +46,13 @@ __export(github_exports, {
|
|
|
46
46
|
extractTargetBranch: () => extractTargetBranch,
|
|
47
47
|
formatGuideAsMarkdown: () => formatGuideAsMarkdown,
|
|
48
48
|
getAuthenticatedUser: () => getAuthenticatedUser,
|
|
49
|
+
getBranchHeadSha: () => getBranchHeadSha,
|
|
49
50
|
getDefaultBranch: () => getDefaultBranch,
|
|
50
51
|
getIssueNumberFromBranch: () => getIssueNumberFromBranch,
|
|
51
52
|
getOpenSubtasks: () => getOpenSubtasks,
|
|
52
53
|
getRepoFile: () => getRepoFile,
|
|
53
54
|
getTask: () => getTask,
|
|
55
|
+
getTaskBranch: () => getTaskBranch,
|
|
54
56
|
getTaskPR: () => getTaskPR,
|
|
55
57
|
getTaskPRDiff: () => getTaskPRDiff,
|
|
56
58
|
isCollaborator: () => isCollaborator,
|
|
@@ -60,6 +62,7 @@ __export(github_exports, {
|
|
|
60
62
|
listTasksForReview: () => listTasksForReview,
|
|
61
63
|
markInReview: () => markInReview,
|
|
62
64
|
mergeWorkerIntoBase: () => mergeWorkerIntoBase,
|
|
65
|
+
moveTask: () => moveTask,
|
|
63
66
|
postComment: () => postComment,
|
|
64
67
|
postGuideComment: () => postGuideComment,
|
|
65
68
|
rejectTask: () => rejectTask,
|
|
@@ -437,6 +440,37 @@ async function getDefaultBranch(config) {
|
|
|
437
440
|
const { data } = await octokit.repos.get({ owner, repo });
|
|
438
441
|
return data.default_branch;
|
|
439
442
|
}
|
|
443
|
+
async function getTaskBranch(config, issueNumber) {
|
|
444
|
+
const octokit = createOctokit(config.githubToken);
|
|
445
|
+
const { owner, repo } = config.github;
|
|
446
|
+
const { data: prs } = await octokit.pulls.list({ owner, repo, state: "open", per_page: 100 });
|
|
447
|
+
const pr = prs.find((p) => new RegExp(`Closes #${issueNumber}\\b`, "i").test(p.body ?? ""));
|
|
448
|
+
if (pr) return pr.head.ref;
|
|
449
|
+
const { data: branches } = await octokit.repos.listBranches({ owner, repo, per_page: 100 });
|
|
450
|
+
const taskBranch = branches.find((b) => new RegExp(`^task-${issueNumber}-`).test(b.name));
|
|
451
|
+
return taskBranch?.name ?? null;
|
|
452
|
+
}
|
|
453
|
+
async function getBranchHeadSha(config, branchName) {
|
|
454
|
+
const octokit = createOctokit(config.githubToken);
|
|
455
|
+
const { owner, repo } = config.github;
|
|
456
|
+
try {
|
|
457
|
+
const { data } = await octokit.repos.getBranch({ owner, repo, branch: branchName });
|
|
458
|
+
return data.commit.sha;
|
|
459
|
+
} catch {
|
|
460
|
+
return null;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
async function moveTask(config, issueNumber, newTargetBranch, newBaseCommit) {
|
|
464
|
+
const octokit = createOctokit(config.githubToken);
|
|
465
|
+
const { owner, repo } = config.github;
|
|
466
|
+
const { data } = await octokit.issues.get({ owner, repo, issue_number: issueNumber });
|
|
467
|
+
let body = data.body ?? "";
|
|
468
|
+
body = body.replace(/\n*<!-- techunter-base:[a-f0-9]{7,40} -->/g, "");
|
|
469
|
+
body = body.replace(/\n*<!-- techunter-target:[^\s>]+ -->/g, "");
|
|
470
|
+
body = embedBaseCommit(body, newBaseCommit);
|
|
471
|
+
body = embedTargetBranch(body, newTargetBranch);
|
|
472
|
+
await octokit.issues.update({ owner, repo, issue_number: issueNumber, body });
|
|
473
|
+
}
|
|
440
474
|
async function getTaskPR(config, issueNumber) {
|
|
441
475
|
const octokit = createOctokit(config.githubToken);
|
|
442
476
|
const { owner, repo } = config.github;
|
|
@@ -2652,21 +2686,145 @@ async function execute11(input, config) {
|
|
|
2652
2686
|
}
|
|
2653
2687
|
var terminal11 = true;
|
|
2654
2688
|
|
|
2655
|
-
// src/tools/
|
|
2656
|
-
var
|
|
2657
|
-
__export(
|
|
2689
|
+
// src/tools/move-task/index.ts
|
|
2690
|
+
var move_task_exports = {};
|
|
2691
|
+
__export(move_task_exports, {
|
|
2658
2692
|
definition: () => definition12,
|
|
2659
2693
|
execute: () => execute12,
|
|
2660
2694
|
run: () => run12,
|
|
2661
2695
|
terminal: () => terminal12
|
|
2662
2696
|
});
|
|
2697
|
+
init_github();
|
|
2698
|
+
import { select as select9 } from "@inquirer/prompts";
|
|
2663
2699
|
import ora10 from "ora";
|
|
2664
2700
|
import chalk11 from "chalk";
|
|
2701
|
+
var definition12 = {
|
|
2702
|
+
type: "function",
|
|
2703
|
+
function: {
|
|
2704
|
+
name: "move_task",
|
|
2705
|
+
description: "Move one of your own published tasks to be a sub-task of another task. Updates the target branch and base commit so executors sync from the new parent HEAD. Equivalent to /move.",
|
|
2706
|
+
parameters: {
|
|
2707
|
+
type: "object",
|
|
2708
|
+
properties: {
|
|
2709
|
+
issue_number: { type: "number", description: "Issue number of the task to move." },
|
|
2710
|
+
parent_issue_number: { type: "number", description: "Issue number of the new parent task." }
|
|
2711
|
+
},
|
|
2712
|
+
required: ["issue_number", "parent_issue_number"]
|
|
2713
|
+
}
|
|
2714
|
+
}
|
|
2715
|
+
};
|
|
2716
|
+
async function run12(input, config) {
|
|
2717
|
+
const me = await getAuthenticatedUser(config);
|
|
2718
|
+
const allTasks = await listTasks(config);
|
|
2719
|
+
let issueNumber = input["issue_number"];
|
|
2720
|
+
let taskToMove;
|
|
2721
|
+
if (issueNumber) {
|
|
2722
|
+
try {
|
|
2723
|
+
taskToMove = await getTask(config, issueNumber);
|
|
2724
|
+
} catch (err) {
|
|
2725
|
+
return `Error loading task #${issueNumber}: ${err.message}`;
|
|
2726
|
+
}
|
|
2727
|
+
if (taskToMove.author !== me) {
|
|
2728
|
+
return `Task #${issueNumber} was not authored by you \u2014 you can only move your own tasks.`;
|
|
2729
|
+
}
|
|
2730
|
+
} else {
|
|
2731
|
+
const myTasks = allTasks.filter((t) => t.author === me);
|
|
2732
|
+
if (myTasks.length === 0) return "No tasks you authored are available to move.";
|
|
2733
|
+
try {
|
|
2734
|
+
issueNumber = await select9({
|
|
2735
|
+
message: "Select task to move:",
|
|
2736
|
+
choices: myTasks.map((t) => ({
|
|
2737
|
+
name: `#${t.number} [${getStatus(t)}] ${t.title}`,
|
|
2738
|
+
value: t.number
|
|
2739
|
+
}))
|
|
2740
|
+
});
|
|
2741
|
+
} catch {
|
|
2742
|
+
return "Cancelled.";
|
|
2743
|
+
}
|
|
2744
|
+
taskToMove = myTasks.find((t) => t.number === issueNumber);
|
|
2745
|
+
}
|
|
2746
|
+
const candidates = allTasks.filter((t) => t.number !== taskToMove.number);
|
|
2747
|
+
const resolveSpinner = ora10("Finding parent task branches\u2026").start();
|
|
2748
|
+
const parents = [];
|
|
2749
|
+
for (const t of candidates) {
|
|
2750
|
+
const branch = await getTaskBranch(config, t.number);
|
|
2751
|
+
if (branch) parents.push({ task: t, branch });
|
|
2752
|
+
}
|
|
2753
|
+
resolveSpinner.stop();
|
|
2754
|
+
if (parents.length === 0) {
|
|
2755
|
+
return "No other tasks with known branches are available as a parent.";
|
|
2756
|
+
}
|
|
2757
|
+
let parentIssueNumber = input["parent_issue_number"];
|
|
2758
|
+
let chosen;
|
|
2759
|
+
if (parentIssueNumber) {
|
|
2760
|
+
const found = parents.find((p) => p.task.number === parentIssueNumber);
|
|
2761
|
+
if (!found) {
|
|
2762
|
+
return `Task #${parentIssueNumber} is not available as a parent (no branch found or not open).`;
|
|
2763
|
+
}
|
|
2764
|
+
chosen = found;
|
|
2765
|
+
} else {
|
|
2766
|
+
try {
|
|
2767
|
+
const selectedBranch = await select9({
|
|
2768
|
+
message: `Move #${taskToMove.number} under which task?`,
|
|
2769
|
+
choices: parents.map((p) => ({
|
|
2770
|
+
name: `#${p.task.number} [${getStatus(p.task)}] ${p.task.title} ${chalk11.dim("\u2192 " + p.branch)}`,
|
|
2771
|
+
value: p.branch
|
|
2772
|
+
}))
|
|
2773
|
+
});
|
|
2774
|
+
chosen = parents.find((p) => p.branch === selectedBranch);
|
|
2775
|
+
} catch {
|
|
2776
|
+
return "Cancelled.";
|
|
2777
|
+
}
|
|
2778
|
+
}
|
|
2779
|
+
const sha = await getBranchHeadSha(config, chosen.branch);
|
|
2780
|
+
if (!sha) {
|
|
2781
|
+
return `Could not resolve HEAD of branch ${chosen.branch} \u2014 does it exist on the remote?`;
|
|
2782
|
+
}
|
|
2783
|
+
const spinner = ora10(`Moving #${taskToMove.number} under #${chosen.task.number}\u2026`).start();
|
|
2784
|
+
try {
|
|
2785
|
+
await moveTask(config, taskToMove.number, chosen.branch, sha);
|
|
2786
|
+
spinner.succeed(
|
|
2787
|
+
`Task #${taskToMove.number} moved under #${chosen.task.number} "${chosen.task.title}"
|
|
2788
|
+
target: ${chalk11.cyan(chosen.branch)} base: ${chalk11.dim(sha.slice(0, 7))}`
|
|
2789
|
+
);
|
|
2790
|
+
return `Task #${taskToMove.number} moved under #${chosen.task.number} (branch: ${chosen.branch}, base: ${sha.slice(0, 7)})`;
|
|
2791
|
+
} catch (err) {
|
|
2792
|
+
spinner.fail(`Failed: ${err.message}`);
|
|
2793
|
+
return `Error: ${err.message}`;
|
|
2794
|
+
}
|
|
2795
|
+
}
|
|
2796
|
+
async function execute12(input, config) {
|
|
2797
|
+
const me = await getAuthenticatedUser(config);
|
|
2798
|
+
const issueNumber = input["issue_number"];
|
|
2799
|
+
const parentIssueNumber = input["parent_issue_number"];
|
|
2800
|
+
const task = await getTask(config, issueNumber);
|
|
2801
|
+
if (task.author !== me) {
|
|
2802
|
+
return `Task #${issueNumber} was not authored by you \u2014 you can only move your own tasks.`;
|
|
2803
|
+
}
|
|
2804
|
+
const branch = await getTaskBranch(config, parentIssueNumber);
|
|
2805
|
+
if (!branch) return `No branch found for parent task #${parentIssueNumber}.`;
|
|
2806
|
+
const sha = await getBranchHeadSha(config, branch);
|
|
2807
|
+
if (!sha) return `Could not resolve HEAD of branch ${branch}.`;
|
|
2808
|
+
await moveTask(config, issueNumber, branch, sha);
|
|
2809
|
+
return `Task #${issueNumber} moved under #${parentIssueNumber} (branch: ${branch}, base: ${sha.slice(0, 7)})`;
|
|
2810
|
+
}
|
|
2811
|
+
var terminal12 = true;
|
|
2812
|
+
|
|
2813
|
+
// src/tools/wiki/index.ts
|
|
2814
|
+
var wiki_exports = {};
|
|
2815
|
+
__export(wiki_exports, {
|
|
2816
|
+
definition: () => definition13,
|
|
2817
|
+
execute: () => execute13,
|
|
2818
|
+
run: () => run13,
|
|
2819
|
+
terminal: () => terminal13
|
|
2820
|
+
});
|
|
2821
|
+
import ora11 from "ora";
|
|
2822
|
+
import chalk12 from "chalk";
|
|
2665
2823
|
import { readFile as readFile2 } from "fs/promises";
|
|
2666
|
-
import { select as
|
|
2824
|
+
import { select as select10 } from "@inquirer/prompts";
|
|
2667
2825
|
init_github();
|
|
2668
2826
|
var WIKI_PATH = "TECHUNTER.md";
|
|
2669
|
-
var
|
|
2827
|
+
var definition13 = {
|
|
2670
2828
|
type: "function",
|
|
2671
2829
|
function: {
|
|
2672
2830
|
name: "update_wiki",
|
|
@@ -2686,20 +2844,20 @@ async function readWikiContent(config) {
|
|
|
2686
2844
|
return getRepoFile(config, WIKI_PATH);
|
|
2687
2845
|
}
|
|
2688
2846
|
function printWiki(content) {
|
|
2689
|
-
const divider =
|
|
2847
|
+
const divider = chalk12.dim("\u2500".repeat(70));
|
|
2690
2848
|
console.log("\n" + divider);
|
|
2691
|
-
console.log(
|
|
2849
|
+
console.log(chalk12.bold(" TECHUNTER.md"));
|
|
2692
2850
|
console.log(divider);
|
|
2693
2851
|
console.log(renderMarkdown(content));
|
|
2694
2852
|
console.log(divider + "\n");
|
|
2695
2853
|
}
|
|
2696
|
-
async function
|
|
2697
|
-
const fetchSpinner =
|
|
2854
|
+
async function run13(_input, config) {
|
|
2855
|
+
const fetchSpinner = ora11("Checking for existing wiki\u2026").start();
|
|
2698
2856
|
const existing = await readWikiContent(config).catch(() => null);
|
|
2699
2857
|
fetchSpinner.stop();
|
|
2700
2858
|
let action;
|
|
2701
2859
|
try {
|
|
2702
|
-
action = await
|
|
2860
|
+
action = await select10({
|
|
2703
2861
|
message: "TECHUNTER.md \u2014 what would you like to do?",
|
|
2704
2862
|
choices: [
|
|
2705
2863
|
...existing ? [{ name: "View current wiki", value: "view" }] : [],
|
|
@@ -2715,7 +2873,7 @@ async function run12(_input, config) {
|
|
|
2715
2873
|
printWiki(existing);
|
|
2716
2874
|
return "Displayed TECHUNTER.md.";
|
|
2717
2875
|
}
|
|
2718
|
-
const authSpinner =
|
|
2876
|
+
const authSpinner = ora11("Checking permissions\u2026").start();
|
|
2719
2877
|
let me;
|
|
2720
2878
|
let allowed;
|
|
2721
2879
|
try {
|
|
@@ -2729,7 +2887,7 @@ async function run12(_input, config) {
|
|
|
2729
2887
|
if (!allowed) {
|
|
2730
2888
|
return `Permission denied: only repository collaborators can update the project wiki.`;
|
|
2731
2889
|
}
|
|
2732
|
-
const genSpinner =
|
|
2890
|
+
const genSpinner = ora11("Analyzing project and generating overview\u2026").start();
|
|
2733
2891
|
let content;
|
|
2734
2892
|
try {
|
|
2735
2893
|
content = await generateWiki(config);
|
|
@@ -2741,7 +2899,7 @@ async function run12(_input, config) {
|
|
|
2741
2899
|
printWiki(content);
|
|
2742
2900
|
let confirm;
|
|
2743
2901
|
try {
|
|
2744
|
-
confirm = await
|
|
2902
|
+
confirm = await select10({
|
|
2745
2903
|
message: `Publish to repository as ${WIKI_PATH}?`,
|
|
2746
2904
|
choices: [
|
|
2747
2905
|
{ name: "Yes, commit to repo", value: "publish" },
|
|
@@ -2752,7 +2910,7 @@ async function run12(_input, config) {
|
|
|
2752
2910
|
return "Cancelled.";
|
|
2753
2911
|
}
|
|
2754
2912
|
if (confirm === "cancel") return "Cancelled.";
|
|
2755
|
-
const writeSpinner =
|
|
2913
|
+
const writeSpinner = ora11(`Writing ${WIKI_PATH}\u2026`).start();
|
|
2756
2914
|
try {
|
|
2757
2915
|
const url = await upsertRepoFile(config, WIKI_PATH, content, "docs: update TECHUNTER.md project overview");
|
|
2758
2916
|
writeSpinner.succeed(`Written: ${url}`);
|
|
@@ -2763,7 +2921,7 @@ async function run12(_input, config) {
|
|
|
2763
2921
|
return `Error: ${err.message}`;
|
|
2764
2922
|
}
|
|
2765
2923
|
}
|
|
2766
|
-
async function
|
|
2924
|
+
async function execute13(_input, config) {
|
|
2767
2925
|
const me = await getAuthenticatedUser(config);
|
|
2768
2926
|
if (!await isCollaborator(config, me)) {
|
|
2769
2927
|
return `Permission denied: only repository collaborators can update the project wiki.`;
|
|
@@ -2776,16 +2934,16 @@ async function execute12(_input, config) {
|
|
|
2776
2934
|
return `Error: ${err.message}`;
|
|
2777
2935
|
}
|
|
2778
2936
|
}
|
|
2779
|
-
var
|
|
2937
|
+
var terminal13 = true;
|
|
2780
2938
|
|
|
2781
2939
|
// src/tools/list-tasks/index.ts
|
|
2782
2940
|
var list_tasks_exports = {};
|
|
2783
2941
|
__export(list_tasks_exports, {
|
|
2784
|
-
definition: () =>
|
|
2785
|
-
execute: () =>
|
|
2942
|
+
definition: () => definition14,
|
|
2943
|
+
execute: () => execute14
|
|
2786
2944
|
});
|
|
2787
2945
|
init_github();
|
|
2788
|
-
var
|
|
2946
|
+
var definition14 = {
|
|
2789
2947
|
type: "function",
|
|
2790
2948
|
function: {
|
|
2791
2949
|
name: "list_tasks",
|
|
@@ -2797,7 +2955,7 @@ var definition13 = {
|
|
|
2797
2955
|
}
|
|
2798
2956
|
}
|
|
2799
2957
|
};
|
|
2800
|
-
async function
|
|
2958
|
+
async function execute14(_input, config) {
|
|
2801
2959
|
const tasks = await listTasks(config);
|
|
2802
2960
|
if (tasks.length === 0) return "No open tasks.";
|
|
2803
2961
|
return tasks.map((t) => {
|
|
@@ -2810,11 +2968,11 @@ async function execute13(_input, config) {
|
|
|
2810
2968
|
// src/tools/get-task/index.ts
|
|
2811
2969
|
var get_task_exports = {};
|
|
2812
2970
|
__export(get_task_exports, {
|
|
2813
|
-
definition: () =>
|
|
2814
|
-
execute: () =>
|
|
2971
|
+
definition: () => definition15,
|
|
2972
|
+
execute: () => execute15
|
|
2815
2973
|
});
|
|
2816
2974
|
init_github();
|
|
2817
|
-
var
|
|
2975
|
+
var definition15 = {
|
|
2818
2976
|
type: "function",
|
|
2819
2977
|
function: {
|
|
2820
2978
|
name: "get_task",
|
|
@@ -2828,7 +2986,7 @@ var definition14 = {
|
|
|
2828
2986
|
}
|
|
2829
2987
|
}
|
|
2830
2988
|
};
|
|
2831
|
-
async function
|
|
2989
|
+
async function execute15(input, config) {
|
|
2832
2990
|
const issue = await getTask(config, input["issue_number"]);
|
|
2833
2991
|
const status = issue.labels.find((l) => l.startsWith("techunter:"))?.replace("techunter:", "") ?? "unknown";
|
|
2834
2992
|
const assignee = issue.assignee ? `@${issue.assignee}` : "\u2014";
|
|
@@ -2845,12 +3003,12 @@ ${issue.body}`);
|
|
|
2845
3003
|
// src/tools/get-comments/index.ts
|
|
2846
3004
|
var get_comments_exports = {};
|
|
2847
3005
|
__export(get_comments_exports, {
|
|
2848
|
-
definition: () =>
|
|
2849
|
-
execute: () =>
|
|
3006
|
+
definition: () => definition16,
|
|
3007
|
+
execute: () => execute16
|
|
2850
3008
|
});
|
|
2851
3009
|
init_github();
|
|
2852
|
-
import
|
|
2853
|
-
var
|
|
3010
|
+
import ora12 from "ora";
|
|
3011
|
+
var definition16 = {
|
|
2854
3012
|
type: "function",
|
|
2855
3013
|
function: {
|
|
2856
3014
|
name: "get_comments",
|
|
@@ -2865,10 +3023,10 @@ var definition15 = {
|
|
|
2865
3023
|
}
|
|
2866
3024
|
}
|
|
2867
3025
|
};
|
|
2868
|
-
async function
|
|
3026
|
+
async function execute16(input, config) {
|
|
2869
3027
|
const issueNumber = input["issue_number"];
|
|
2870
3028
|
const limit = input["limit"] ?? 5;
|
|
2871
|
-
const spinner =
|
|
3029
|
+
const spinner = ora12(`Loading comments for #${issueNumber}...`).start();
|
|
2872
3030
|
try {
|
|
2873
3031
|
const comments = await listComments(config, issueNumber, limit);
|
|
2874
3032
|
spinner.stop();
|
|
@@ -2887,11 +3045,11 @@ ${lines.join("\n\n")}`;
|
|
|
2887
3045
|
// src/tools/get-diff/index.ts
|
|
2888
3046
|
var get_diff_exports = {};
|
|
2889
3047
|
__export(get_diff_exports, {
|
|
2890
|
-
definition: () =>
|
|
2891
|
-
execute: () =>
|
|
3048
|
+
definition: () => definition17,
|
|
3049
|
+
execute: () => execute17
|
|
2892
3050
|
});
|
|
2893
|
-
import
|
|
2894
|
-
var
|
|
3051
|
+
import ora13 from "ora";
|
|
3052
|
+
var definition17 = {
|
|
2895
3053
|
type: "function",
|
|
2896
3054
|
function: {
|
|
2897
3055
|
name: "get_diff",
|
|
@@ -2899,8 +3057,8 @@ var definition16 = {
|
|
|
2899
3057
|
parameters: { type: "object", properties: {}, required: [] }
|
|
2900
3058
|
}
|
|
2901
3059
|
};
|
|
2902
|
-
async function
|
|
2903
|
-
const spinner =
|
|
3060
|
+
async function execute17(_input, _config) {
|
|
3061
|
+
const spinner = ora13("Reading git diff...").start();
|
|
2904
3062
|
try {
|
|
2905
3063
|
const diff = await getDiff();
|
|
2906
3064
|
spinner.stop();
|
|
@@ -2914,14 +3072,14 @@ async function execute16(_input, _config) {
|
|
|
2914
3072
|
// src/tools/run-command/index.ts
|
|
2915
3073
|
var run_command_exports = {};
|
|
2916
3074
|
__export(run_command_exports, {
|
|
2917
|
-
definition: () =>
|
|
2918
|
-
execute: () =>
|
|
3075
|
+
definition: () => definition18,
|
|
3076
|
+
execute: () => execute18
|
|
2919
3077
|
});
|
|
2920
3078
|
import { exec } from "child_process";
|
|
2921
3079
|
import { promisify } from "util";
|
|
2922
|
-
import
|
|
3080
|
+
import ora14 from "ora";
|
|
2923
3081
|
var execAsync = promisify(exec);
|
|
2924
|
-
var
|
|
3082
|
+
var definition18 = {
|
|
2925
3083
|
type: "function",
|
|
2926
3084
|
function: {
|
|
2927
3085
|
name: "run_command",
|
|
@@ -2935,10 +3093,10 @@ var definition17 = {
|
|
|
2935
3093
|
}
|
|
2936
3094
|
}
|
|
2937
3095
|
};
|
|
2938
|
-
async function
|
|
3096
|
+
async function execute18(input, _config) {
|
|
2939
3097
|
const command = input["command"];
|
|
2940
3098
|
const cwd = process.cwd();
|
|
2941
|
-
const spinner =
|
|
3099
|
+
const spinner = ora14(`$ ${command}`).start();
|
|
2942
3100
|
try {
|
|
2943
3101
|
const { stdout, stderr } = await execAsync(command, { cwd, timeout: 6e4, maxBuffer: 1024 * 1024 });
|
|
2944
3102
|
spinner.stop();
|
|
@@ -2957,15 +3115,15 @@ ${out || e.message}`;
|
|
|
2957
3115
|
// src/tools/list-files/index.ts
|
|
2958
3116
|
var list_files_exports = {};
|
|
2959
3117
|
__export(list_files_exports, {
|
|
2960
|
-
definition: () =>
|
|
2961
|
-
execute: () =>
|
|
3118
|
+
definition: () => definition19,
|
|
3119
|
+
execute: () => execute19
|
|
2962
3120
|
});
|
|
2963
3121
|
import { readFile as readFile3 } from "fs/promises";
|
|
2964
3122
|
import { existsSync } from "fs";
|
|
2965
3123
|
import path2 from "path";
|
|
2966
3124
|
import { globby } from "globby";
|
|
2967
3125
|
import ignore from "ignore";
|
|
2968
|
-
var
|
|
3126
|
+
var definition19 = {
|
|
2969
3127
|
type: "function",
|
|
2970
3128
|
function: {
|
|
2971
3129
|
name: "list_files",
|
|
@@ -3005,7 +3163,7 @@ var BINARY_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
|
3005
3163
|
".sqlite",
|
|
3006
3164
|
".lock"
|
|
3007
3165
|
]);
|
|
3008
|
-
async function
|
|
3166
|
+
async function execute19(input, _config) {
|
|
3009
3167
|
const glob = input["glob"] ?? "**/*";
|
|
3010
3168
|
const cwd = process.cwd();
|
|
3011
3169
|
const ig = ignore();
|
|
@@ -3024,15 +3182,15 @@ ${filtered.join("\n")}`;
|
|
|
3024
3182
|
// src/tools/grep-code/index.ts
|
|
3025
3183
|
var grep_code_exports = {};
|
|
3026
3184
|
__export(grep_code_exports, {
|
|
3027
|
-
definition: () =>
|
|
3028
|
-
execute: () =>
|
|
3185
|
+
definition: () => definition20,
|
|
3186
|
+
execute: () => execute20
|
|
3029
3187
|
});
|
|
3030
3188
|
import { readFile as readFile4 } from "fs/promises";
|
|
3031
3189
|
import { existsSync as existsSync2 } from "fs";
|
|
3032
3190
|
import path3 from "path";
|
|
3033
3191
|
import { globby as globby2 } from "globby";
|
|
3034
3192
|
import ignore2 from "ignore";
|
|
3035
|
-
var
|
|
3193
|
+
var definition20 = {
|
|
3036
3194
|
type: "function",
|
|
3037
3195
|
function: {
|
|
3038
3196
|
name: "grep_code",
|
|
@@ -3105,7 +3263,7 @@ function isText(f) {
|
|
|
3105
3263
|
return !BINARY_EXTENSIONS2.has(path3.extname(f).toLowerCase());
|
|
3106
3264
|
}
|
|
3107
3265
|
var MAX_RANGE_LINES = 300;
|
|
3108
|
-
async function
|
|
3266
|
+
async function execute20(input, _config) {
|
|
3109
3267
|
const pattern = input["pattern"] ?? "";
|
|
3110
3268
|
const fileGlob = input["file_glob"] ?? "**/*";
|
|
3111
3269
|
const contextLines = Math.min(input["context_lines"] ?? 2, 5);
|
|
@@ -3192,12 +3350,12 @@ ${snippets.join("\n---\n")}
|
|
|
3192
3350
|
// src/tools/ask-user/index.ts
|
|
3193
3351
|
var ask_user_exports = {};
|
|
3194
3352
|
__export(ask_user_exports, {
|
|
3195
|
-
definition: () =>
|
|
3196
|
-
execute: () =>
|
|
3353
|
+
definition: () => definition21,
|
|
3354
|
+
execute: () => execute21
|
|
3197
3355
|
});
|
|
3198
|
-
import
|
|
3199
|
-
import { select as
|
|
3200
|
-
var
|
|
3356
|
+
import chalk13 from "chalk";
|
|
3357
|
+
import { select as select11, input as promptInput5 } from "@inquirer/prompts";
|
|
3358
|
+
var definition21 = {
|
|
3201
3359
|
type: "function",
|
|
3202
3360
|
function: {
|
|
3203
3361
|
name: "ask_user",
|
|
@@ -3216,24 +3374,24 @@ var definition20 = {
|
|
|
3216
3374
|
}
|
|
3217
3375
|
}
|
|
3218
3376
|
};
|
|
3219
|
-
async function
|
|
3377
|
+
async function execute21(input, _config) {
|
|
3220
3378
|
const question = input["question"];
|
|
3221
3379
|
const options = input["options"];
|
|
3222
3380
|
const OTHER = "__other__";
|
|
3223
3381
|
console.log("");
|
|
3224
|
-
console.log(
|
|
3225
|
-
console.log(
|
|
3382
|
+
console.log(chalk13.dim(" \u250C\u2500 Agent question " + "\u2500".repeat(51)));
|
|
3383
|
+
console.log(chalk13.dim(" \u2502"));
|
|
3226
3384
|
for (const line of question.split("\n")) {
|
|
3227
|
-
console.log(
|
|
3385
|
+
console.log(chalk13.dim(" \u2502 ") + line);
|
|
3228
3386
|
}
|
|
3229
|
-
console.log(
|
|
3387
|
+
console.log(chalk13.dim(" \u2514" + "\u2500".repeat(67)));
|
|
3230
3388
|
let answer;
|
|
3231
3389
|
try {
|
|
3232
|
-
const chosen = await
|
|
3390
|
+
const chosen = await select11({
|
|
3233
3391
|
message: " ",
|
|
3234
3392
|
choices: [
|
|
3235
3393
|
...options.map((o) => ({ name: o, value: o })),
|
|
3236
|
-
{ name:
|
|
3394
|
+
{ name: chalk13.dim("Other (describe below)"), value: OTHER }
|
|
3237
3395
|
]
|
|
3238
3396
|
});
|
|
3239
3397
|
answer = chosen === OTHER ? await promptInput5({ message: "Your answer:" }) : chosen;
|
|
@@ -3258,6 +3416,7 @@ var toolModules = [
|
|
|
3258
3416
|
reject_exports,
|
|
3259
3417
|
accept_exports,
|
|
3260
3418
|
edit_task_exports,
|
|
3419
|
+
move_task_exports,
|
|
3261
3420
|
wiki_exports,
|
|
3262
3421
|
// Low-level tools
|
|
3263
3422
|
list_tasks_exports,
|