heyio 0.1.17 → 0.1.18
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/dist/copilot/system-message.js +1 -0
- package/dist/copilot/tools.js +126 -1
- package/package.json +1 -1
|
@@ -86,6 +86,7 @@ The model is selected automatically. Tell the user which model tier was chosen w
|
|
|
86
86
|
### System
|
|
87
87
|
- \`shell\`: Run a shell command. You have full system access — you can create directories, install packages, clone repos, etc. **Always use this instead of the built-in \`bash\` tool.**
|
|
88
88
|
- \`file_ops\`: Read, write, or list files anywhere on the filesystem. Can create directories automatically.
|
|
89
|
+
- \`github\`: Manage GitHub issues and PRs — create, list, view, comment, close issues; create, list, view, comment on PRs.
|
|
89
90
|
- \`web_fetch\`: (built-in) Fetch a URL and return content.
|
|
90
91
|
|
|
91
92
|
## Guidelines
|
package/dist/copilot/tools.js
CHANGED
|
@@ -409,7 +409,132 @@ export function createTools(deps) {
|
|
|
409
409
|
}
|
|
410
410
|
},
|
|
411
411
|
});
|
|
412
|
-
|
|
412
|
+
// GitHub issue/PR management via gh CLI
|
|
413
|
+
const github = defineTool("github", {
|
|
414
|
+
description: "Manage GitHub issues and pull requests using the gh CLI. Supports creating, listing, viewing, and commenting on issues and PRs.",
|
|
415
|
+
skipPermission: true,
|
|
416
|
+
parameters: z.object({
|
|
417
|
+
action: z
|
|
418
|
+
.enum([
|
|
419
|
+
"create_issue",
|
|
420
|
+
"list_issues",
|
|
421
|
+
"view_issue",
|
|
422
|
+
"comment_issue",
|
|
423
|
+
"close_issue",
|
|
424
|
+
"create_pr",
|
|
425
|
+
"list_prs",
|
|
426
|
+
"view_pr",
|
|
427
|
+
"comment_pr",
|
|
428
|
+
])
|
|
429
|
+
.describe("The GitHub action to perform"),
|
|
430
|
+
repo: z.string().describe("Repository in owner/repo format"),
|
|
431
|
+
title: z.string().optional().describe("Title (for create_issue, create_pr)"),
|
|
432
|
+
body: z.string().optional().describe("Body text (for create_issue, create_pr, comment_*)"),
|
|
433
|
+
labels: z.array(z.string()).optional().describe("Labels (for create_issue)"),
|
|
434
|
+
assignees: z.array(z.string()).optional().describe("Assignees (for create_issue)"),
|
|
435
|
+
number: z.number().optional().describe("Issue or PR number (for view, comment, close)"),
|
|
436
|
+
base: z.string().optional().describe("Base branch (for create_pr)"),
|
|
437
|
+
head: z.string().optional().describe("Head branch (for create_pr)"),
|
|
438
|
+
state: z.enum(["open", "closed", "all"]).optional().describe("Filter by state (for list_*)"),
|
|
439
|
+
limit: z.number().optional().describe("Max results (for list_*, default 10)"),
|
|
440
|
+
}),
|
|
441
|
+
handler: async ({ action, repo, title, body, labels, assignees, number, base, head, state, limit }) => {
|
|
442
|
+
console.error(`[io] github tool called: ${action} on ${repo}`);
|
|
443
|
+
try {
|
|
444
|
+
let cmd;
|
|
445
|
+
const r = `--repo ${repo}`;
|
|
446
|
+
switch (action) {
|
|
447
|
+
case "create_issue": {
|
|
448
|
+
if (!title)
|
|
449
|
+
return "Error: title is required for create_issue";
|
|
450
|
+
cmd = `gh issue create ${r} --title "${title.replace(/"/g, '\\"')}"`;
|
|
451
|
+
if (body)
|
|
452
|
+
cmd += ` --body "${body.replace(/"/g, '\\"')}"`;
|
|
453
|
+
if (labels?.length)
|
|
454
|
+
cmd += ` --label "${labels.join(",")}"`;
|
|
455
|
+
if (assignees?.length)
|
|
456
|
+
cmd += ` --assignee "${assignees.join(",")}"`;
|
|
457
|
+
break;
|
|
458
|
+
}
|
|
459
|
+
case "list_issues": {
|
|
460
|
+
cmd = `gh issue list ${r} --limit ${limit ?? 10}`;
|
|
461
|
+
if (state)
|
|
462
|
+
cmd += ` --state ${state}`;
|
|
463
|
+
break;
|
|
464
|
+
}
|
|
465
|
+
case "view_issue": {
|
|
466
|
+
if (!number)
|
|
467
|
+
return "Error: number is required for view_issue";
|
|
468
|
+
cmd = `gh issue view ${number} ${r}`;
|
|
469
|
+
break;
|
|
470
|
+
}
|
|
471
|
+
case "comment_issue": {
|
|
472
|
+
if (!number)
|
|
473
|
+
return "Error: number is required for comment_issue";
|
|
474
|
+
if (!body)
|
|
475
|
+
return "Error: body is required for comment_issue";
|
|
476
|
+
cmd = `gh issue comment ${number} ${r} --body "${body.replace(/"/g, '\\"')}"`;
|
|
477
|
+
break;
|
|
478
|
+
}
|
|
479
|
+
case "close_issue": {
|
|
480
|
+
if (!number)
|
|
481
|
+
return "Error: number is required for close_issue";
|
|
482
|
+
cmd = `gh issue close ${number} ${r}`;
|
|
483
|
+
break;
|
|
484
|
+
}
|
|
485
|
+
case "create_pr": {
|
|
486
|
+
if (!title)
|
|
487
|
+
return "Error: title is required for create_pr";
|
|
488
|
+
cmd = `gh pr create ${r} --title "${title.replace(/"/g, '\\"')}"`;
|
|
489
|
+
if (body)
|
|
490
|
+
cmd += ` --body "${body.replace(/"/g, '\\"')}"`;
|
|
491
|
+
if (base)
|
|
492
|
+
cmd += ` --base ${base}`;
|
|
493
|
+
if (head)
|
|
494
|
+
cmd += ` --head ${head}`;
|
|
495
|
+
break;
|
|
496
|
+
}
|
|
497
|
+
case "list_prs": {
|
|
498
|
+
cmd = `gh pr list ${r} --limit ${limit ?? 10}`;
|
|
499
|
+
if (state)
|
|
500
|
+
cmd += ` --state ${state}`;
|
|
501
|
+
break;
|
|
502
|
+
}
|
|
503
|
+
case "view_pr": {
|
|
504
|
+
if (!number)
|
|
505
|
+
return "Error: number is required for view_pr";
|
|
506
|
+
cmd = `gh pr view ${number} ${r}`;
|
|
507
|
+
break;
|
|
508
|
+
}
|
|
509
|
+
case "comment_pr": {
|
|
510
|
+
if (!number)
|
|
511
|
+
return "Error: number is required for comment_pr";
|
|
512
|
+
if (!body)
|
|
513
|
+
return "Error: body is required for comment_pr";
|
|
514
|
+
cmd = `gh pr comment ${number} ${r} --body "${body.replace(/"/g, '\\"')}"`;
|
|
515
|
+
break;
|
|
516
|
+
}
|
|
517
|
+
default:
|
|
518
|
+
return `Unknown action: ${action}`;
|
|
519
|
+
}
|
|
520
|
+
const result = execSync(cmd, {
|
|
521
|
+
encoding: "utf-8",
|
|
522
|
+
timeout: 30_000,
|
|
523
|
+
maxBuffer: 1024 * 1024,
|
|
524
|
+
}).trim();
|
|
525
|
+
if (result.length > 8000) {
|
|
526
|
+
return result.slice(0, 8000) + "\n\n[…truncated]";
|
|
527
|
+
}
|
|
528
|
+
return result || "(success, no output)";
|
|
529
|
+
}
|
|
530
|
+
catch (err) {
|
|
531
|
+
const execErr = err;
|
|
532
|
+
const msg = execErr.stderr?.trim() || execErr.stdout?.trim() || execErr.message || "Command failed";
|
|
533
|
+
return `Error: ${msg.length > 4000 ? msg.slice(0, 4000) + "\n[…truncated]" : msg}`;
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
});
|
|
537
|
+
return [wikiRead, wikiWrite, wikiSearch, squadCreate, squadRecall, squadStatus, squadLogDecision, shell, fileOps, bash, readFile, viewTool, grepTool, strReplaceEditor, github];
|
|
413
538
|
}
|
|
414
539
|
function walkDirectory(dir, maxDepth = 3, depth = 0) {
|
|
415
540
|
if (depth >= maxDepth)
|