feat(KB-200): add pr-create CLI command for task PR creation

- Implement kb task pr-create command to open GitHub PRs from tasks\n- Add draft PR support and title/description customization options\n- Integrate routing in CLI entry point with proper argument parsing\n- Add comprehensive test coverage for the new command\n- Update STANDALONE.md documentation and add changeset for release tracking
This commit is contained in:
gsxdsm
2026-03-31 03:27:11 -07:00
parent d34951a913
commit 3fe8dd3c89
5 changed files with 522 additions and 2 deletions

View File

@@ -39,7 +39,7 @@ if (isBunBinary) {
// Dynamic imports so the pi-coding-agent config module sees PI_PACKAGE_DIR
const { runDashboard } = await import("./commands/dashboard.js");
const { runTaskCreate, runTaskList, runTaskMove, runTaskMerge, runTaskUpdate, runTaskLog, runTaskLogs, runTaskShow, runTaskAttach, runTaskPause, runTaskUnpause, runTaskImportFromGitHub, runTaskDuplicate, runTaskArchive, runTaskUnarchive, runTaskRefine, runTaskPlan, runTaskDelete, runTaskRetry, runTaskSteer } = await import("./commands/task.js");
const { runTaskCreate, runTaskList, runTaskMove, runTaskMerge, runTaskUpdate, runTaskLog, runTaskLogs, runTaskShow, runTaskAttach, runTaskPause, runTaskUnpause, runTaskImportFromGitHub, runTaskDuplicate, runTaskArchive, runTaskUnarchive, runTaskRefine, runTaskPlan, runTaskDelete, runTaskRetry, runTaskSteer, runTaskPrCreate } = await import("./commands/task.js");
const { runSettingsShow, runSettingsSet } = await import("./commands/settings.js");
const { runGitStatus, runGitFetch, runGitPull, runGitPush } = await import("./commands/git.js");
@@ -71,6 +71,8 @@ Usage:
fn task unpause <id> Unpause a task (resumes automation)
fn task steer <id> [message] Add steering comment (prompts if message omitted)
fn task retry <id> Retry a failed task (clears error, moves to todo)
fn task pr-create <id> [--title <title>] [--base <branch>] [--body <body>]
Create a GitHub PR for an in-review task
fn task import <owner/repo> [opts] Import GitHub issues as tasks
fn settings Show current Fusion configuration
fn settings set <key> <value> Update a configuration setting
@@ -310,6 +312,36 @@ async function main() {
await runTaskRetry(id);
break;
}
case "pr-create": {
const id = args[2];
if (!id) {
console.error("Usage: fn task pr-create <id> [--title <title>] [--base <branch>] [--body <body>]");
process.exit(1);
}
// Parse optional flags
let title: string | undefined;
let base: string | undefined;
let body: string | undefined;
const titleIdx = args.indexOf("--title");
if (titleIdx !== -1 && titleIdx + 1 < args.length) {
title = args[titleIdx + 1];
}
const baseIdx = args.indexOf("--base");
if (baseIdx !== -1 && baseIdx + 1 < args.length) {
base = args[baseIdx + 1];
}
const bodyIdx = args.indexOf("--body");
if (bodyIdx !== -1 && bodyIdx + 1 < args.length) {
body = args[bodyIdx + 1];
}
await runTaskPrCreate(id, { title, base, body });
break;
}
case "import": {
const ownerRepo = args[2];
if (!ownerRepo) {