feat: add pr create and comment (task 0010)
`pr create` takes --title (required), --body/--body-file, --base, --head,
--assignee, --reviewer, repeatable name-resolved --label, and --milestone.
An omitted --head defaults to the current local branch; an omitted --base to
the repository's default branch. Before creating, an existing open PR for the
same base/head pair short-circuits to `pull_request: { number, url, already:
true }` rather than opening a duplicate; only an open PR does, since a closed
one's branches are free to be proposed again.
`pr comment <n>` posts through the shared issue-comment endpoint and returns
the created comment as `comment: { number, author, created, body }` (ADR 0008),
reporting a 404 as PR_NOT_FOUND since the caller asked about a pull request.
That comment block is now built in one place (src/comment.ts) for both issue
and pr comment, as ADR 0008 requires them to stay identical.
This commit was merged in pull request #4.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { exitCodeForError, runAxiCli, AxiError } from "axi-sdk-js";
|
||||
import { issueCommand } from "./commands/issue.js";
|
||||
import { prCommand } from "./commands/pr.js";
|
||||
import { resolveRepoContext } from "./context.js";
|
||||
import type { CliDeps, GlobalFlags } from "./deps.js";
|
||||
import { consumeFlagValue, splitFlag } from "./flags.js";
|
||||
@@ -16,6 +17,8 @@ commands:
|
||||
issue view Show a single issue's details
|
||||
issue create Create an issue
|
||||
issue comment Post a comment on an issue or pull request
|
||||
pr create Create a pull request
|
||||
pr comment Post a comment on a pull request
|
||||
|
||||
global flags:
|
||||
-R, --repo <OWNER/NAME> Override the repository detected from the git origin remote
|
||||
@@ -111,6 +114,7 @@ export async function runCli(options: RunCliOptions): Promise<number> {
|
||||
topLevelHelp: TOP_LEVEL_HELP,
|
||||
commands: {
|
||||
issue: issueCommand(deps),
|
||||
pr: prCommand(deps),
|
||||
},
|
||||
home: homeCommand(deps),
|
||||
stdout: options.stdout,
|
||||
|
||||
Reference in New Issue
Block a user