Skip to content

feat(pr): pr create, edit, close and ready pass gh arguments #4852

Description

@dan-petty

Problem or Motivation

devops pr create and devops pr edit take the body only as --body text. Agents typed gh's --body-file 33 times (Claude 26 in 9 sessions, other tools 7 in 3 sessions), and Click suggested --body. A long Markdown body in a shell argument breaks on quotes and backticks. devops roadmap intake already takes --body-file.

Tracker #4833, child 8. The owner asked on 2026-11-11 to fix the devops gh issue name and to record such errors for a later analysis of missing flags, features and aliases. The counts come from a study of Claude Code, Kilo, Antigravity and Loki records from 2026-09-23 to 2026-11-11.

Proposed Solution & Architectural Design

Add --body-file/-F <path> to pr create and pr edit, with - for stdin, as gh has it. One shared option helper reads the file as UTF-8 and refuses --body together with --body-file; reuse the reader of devops roadmap intake --body-file if it fits. The body checks of pr create (at most 1,000 characters, no template text) apply to the file text too. Items issue-gh-flags and comment-commands reuse the helper. Open #4708 also changes pr create; read it before the push and keep its change.

Target Subsystem

SDLC, Git & PR Governance (devops pr create and devops pr edit).

Existing Tool Considered

gh's --body-file form, with - for stdin. Click's file parameter reads the file. Reuse the reader of devops roadmap intake --body-file if it fits.

Acceptance Criteria

devops pr create --title <t> --body-file body.md --dry-run lists the request with the file text and sends 0 requests. --body-file - reads stdin. --body x --body-file f exits 2 with a bad-parameter error. A missing file exits 2 and names the option, not the file text. Tests cover pr create and pr edit.

Dependencies

None. An agent can start it now.

Source: #4833

Alternatives check of 2026-11-21: in-use.
The repository already uses this tool.
Tool: pallets/click (https://github.com/pallets/click), BSD-3-Clause, last activity 2026-11-16, maintained.
Reason: Searches and the issue's own analysis show Click, already reached through Typer, supplies the file-typed option, the - stdin form and the missing-file bad-parameter error; only the project's own rules remain, so it covers part of the need.

Covers:

  • File-typed option opens a UTF-8 text file
  • - reads standard input
  • Missing file becomes a bad-parameter error before the command runs

Lacks:

  • No rule refusing --body with --body-file
  • 1,000-character and template-text checks not applied to file text
  • No shared helper, -F alias or gh argv handling

Proposed design

Problem statement

devops pr create and devops pr edit take the body only as --body text. A long Markdown body in a shell argument breaks on quotes and backticks. Agents typed gh's --body-file 33 times. Add --body-file/-F <path> with - for stdin to both commands. The shared helper is designed for reuse by other items.

Acceptance criteria

Requirement: PR create body file

devops pr create SHALL accept --body-file/-F <path> and read the file as UTF-8 text.

Scenario: Dry run prints the file body

  • WHEN devops pr create --title 'feat(pr): x' --body-file body.md --dry-run runs with body.md holding valid text.
  • THEN It prints the gh argv with the file text as --body and sends 0 requests.

Requirement: PR create stdin body

devops pr create SHALL read the body from standard input when --body-file - is given.

Scenario: Stdin body in a dry run

  • WHEN printf 'body' | devops pr create --title 'feat(pr): x' --body-file - --dry-run runs.
  • THEN It prints the gh argv with --body body and sends 0 requests.

Requirement: Body source exclusion

devops pr create and devops pr edit MUST refuse --body together with --body-file with exit code 2 and a bad-parameter error.

Scenario: Both body flags

  • WHEN devops pr create --title 'feat(pr): x' --body x --body-file f --dry-run runs with f holding text.
  • THEN It exits 2 and names both --body and --body-file.

Requirement: Missing body file

devops pr create and devops pr edit MUST exit 2 and name --body-file when the file does not exist.

Scenario: Missing file

  • WHEN devops pr create --title 'feat(pr): x' --body-file missing.md --dry-run runs.
  • THEN It exits 2, names --body-file, and prints no file text.

Requirement: PR create body checks on file

devops pr create MUST apply its 1,000-character limit and template-text refusal to the text read from --body-file.

Scenario: Long file body

  • WHEN devops pr create --title 'feat(pr): x' --body-file long.md --dry-run runs with a file over 1,000 characters.
  • THEN It exits 1 with the form refusal and sends no request.

Requirement: PR edit body file

devops pr edit SHALL accept --body-file/-F <path> and read the file as UTF-8 text.

Scenario: Edit body file dry run

  • WHEN devops pr edit 12 --body-file body.md --dry-run runs.
  • THEN It prints the gh argv with the file text as --body and sends 0 requests.

Existing Tool Considered

Click (pallets/click, BSD-3-Clause, last activity 2026-11-13, maintained) is in use through Typer. It covers: a file-typed option reads a UTF-8 text file, - reads stdin, and the missing-file error comes from the option's parameter check. It lacks: no rule refusing --body with --body-file, and the body checks of pr create are not applied to the file text. The change uses Click for the file read. It builds the rule layers: about 8,000 tokens to build, about 2,000 tokens a year to keep and fix, and half a day elapsed.

Key questions

  • How should pr create and pr edit read --body-file and stdin?: Use one shared helper with a typer.FileText option, as devops gh issue close --comment-file does. It opens a UTF-8 text file, and - reads standard input. Read the text once and pass it to gh as --body <text>, so gh never reads stdin or the file a second time. (best practice) [sources: src/devops_cli/commands/gh.py:1397, src/devops_cli/commands/gh.py:1411, src/devops_cli/github/pr_plans.py:153]
    • Chosen: typer.FileText in a shared helper. It reads a UTF-8 file and - for stdin, reports a missing file as a bad parameter, and the project already uses it for gh issue close --comment-file.
    • Rejected: Reuse the roadmap intake reader. It takes a Path with exists=True and calls read_text, so it refuses - and does not cover the stdin form.
    • Rejected: Custom open() reader. It duplicates Click's file, stdin and missing-file handling.
  • Should the intake reader of devops roadmap intake --body-file be reused?: No. It takes a Path with exists=True and calls read_text, so it refuses - and does not cover the stdin form. (best practice) [sources: src/devops_cli/commands/roadmap.py:171, src/devops_cli/commands/roadmap.py:144]
    • Chosen: Do not reuse the intake reader. It takes a Path with exists=True and cannot read - for stdin.
    • Rejected: Reuse the intake reader. It cannot read - for stdin, which the body requires.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    on Nov 11, 2026
  2. added
    type/feature
    scope/pr
    status/new
    value/medium
    effort/low
    on Nov 11, 2026
  3. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/pr. The (pr) scope of the title gives the scope.
    • Priority: P2-Medium. Agents typed the flag 33 times, but --body still works, so it is not blocking.
    • Value: Medium. It removes a quoting failure for long Markdown bodies and matches the gh convention agents already expect.
    • Effort: Low. One shared helper reads a UTF-8 file, and the reader from roadmap intake may be reused.
    • Related: feat(pr): build and check the title and body of a pull request #3198, which asks for a different change. Both touch devops pr create and the body parameter, but 3198 adds validation rules while the candidate adds a file-based input method.
  4. added
    priority/p2-medium
    on Nov 11, 2026
  5. removed
    priority/p2-medium
    on Nov 11, 2026
  6. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Priority: P2-Medium. Agents hit the missing option 33 times and a long body breaks on shell quotes, but a workaround exists.
    • Value: Medium. The option removes quote and backtick failures for long Markdown bodies in pr create and pr edit.
    • Effort: Low. The change adds one shared option helper and reuses the reader of devops roadmap intake.
    • Related: feat(pr): pr view, list, checks, diff and status run gh #4842, which asks for a different change. Both are children of tracker #4833 that add missing gh flags; this item adds --body-file to pr create and pr edit, and #4842 adds --json, --head, --base, --comments, --search and pr status.
  7. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor

    Re-scope (owner direction of 2026-11-12). New title: feat(pr): pr create, edit, close and ready pass gh arguments.

    New scope

    The pull request commands that write use the pass-through of #5223 (ADR 0026). A command owns only the gh options that a project rule must read or refuse. gh gets each other argument unchanged. --body-file comes with this change, in the form of gh, with - for stdin.

    Evidence

    • feat(cli): track gh-parity names and usage-error capture #4833 study: --body-file on pr create and pr edit failed 33 times (Claude 26 in 9 sessions, other tools 7).
    • Loki, 7 days to 2026-11-12: gh pr ready --undo 1 and gh pr create --head 1. fix(pr): pr create fits a repository without openspec #5142 added --head after that call.
    • pr create always adds --draft, but it refuses a typed --draft.
    • The form check reads the title, the body, the repository and the base (_form_checked(title, body, repo, base), commands/pr.py:1156). The labels from the title and the Status go to that repository (_finish_created_pr, commands/pr.py:1139). The skill devops-pr-ci tells agents to add --repo <owner>/<repo> --head <branch> for another repository (.agents/skills/devops-pr-ci/SKILL.md:27).
    • pr ready has -m/--monitor and -f/--force, which gh does not have (commands/pr.py:1430-1445).
    • pr wait is a second name of pr monitor (commands/pr.py:714).
    • pr update sends the route PUT pulls/{n}/update-branch, which gh names gh pr update-branch (commands/pr.py:1923).

    Proposed Solution & Architectural Design

    • pr create: the prefix is gh pr create --draft.
      • It owns -t/--title, -b/--body, -F/--body-file, -R/--repo and -B/--base. It reads them for the form check and for the labels and the Status, then gives them to gh unchanged.
      • It refuses -f/--fill, --fill-first, --fill-verbose, -T/--template, --recover, -w/--web and -e/--editor with exit 2, because the check needs the title and the body first.
      • It accepts a typed -d/--draft.
      • The step that sets In Progress does not change.
    • pr edit: the prefix is gh pr edit. It owns -t/--title, -b/--body, -F/--body-file and -R/--repo for the title check of fix(pr): devops pr edit checks the title form #4782. If fix(pr): devops pr edit checks the title form #4782 is not merged, this item adds that check.
    • pr close: the prefix is gh pr close. It owns only -R/--repo (feat(cli): tool commands pass unknown arguments to the tool #5223).
    • pr ready: it owns the number, -R/--repo and --undo. The readiness gate stays in the ready direction (AGENTS.md rule 6). --undo runs gh pr ready --undo with no gate. -m/--monitor and -f/--force go: run devops pr monitor <n> first.
    • pr wait goes (alpha rule: no second name).
    • Premise check: list each caller of pr ready -m/-f and of pr wait in documents, skills, prompts and the Service, and change it.
    • pr update becomes pr update-branch, which is the name in gh and in the route. It stays a REST command (ADR 0026, API naming), with --expected-head-sha (the body field) and --dispatch-ci.
    • The REST fallbacks of pr create and pr edit go. Each write runs gh once (feat(cli): tool commands pass unknown arguments to the tool #5223), so a failed call never writes twice. On a rate-limit refusal, the command exits with the code of gh and prints the reset-time line.
    • The MCP rows pr edit, pr close, pr ready and pr update-branch are not read-only. Their allowlists hold no -F/--body-file, --recover, -w/--web or -e/--editor.

    Acceptance Criteria

    • devops pr create --title 'feat(pr): x' --body-file body.md --label scope/pr --dry-run prints the gh argv with --draft and sends 0 requests. The form check reads the file. A bad title exits 2 before any request.
    • A test with a stub repository: devops pr create --repo other/x --head b --title 'feat(x): y' --body '<body with no Change line>' passes the form check and gives --repo other/x to gh.
    • devops pr create --body-file - reads stdin. devops pr create --fill, -f and --recover f.json exit 2 and name --title and --body.
    • devops pr edit <n> --add-label x --remove-label y --dry-run prints both flags.
    • devops pr ready <n> --undo runs gh pr ready <n> --undo and reads no check (process-stub test).
    • devops pr update-branch <n> --dry-run prints PUT repos/{owner}/{repo}/pulls/<n>/update-branch. devops pr update and devops pr wait exit 2.

    Dependencies

    Merge first: #5223 and #4842 (commands/pr.py). Do not open a pull request for this item while a pull request of #4708, #4782, #5112 or #5178 is open, because they change pr create or pr edit.

  8. changed the title [-]feat(pr): read the pr body from --body-file[/-] [+]feat(pr): pr create, edit, close and ready pass gh arguments[/+] on Nov 12, 2026
  9. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

    Alternatives check: in-use

    Reason: The searches returned no tool that provides a --body-file-style gh pass-through for this CLI, but Click, the framework the project already builds its commands with, supplies the file half: a file-typed option reads a path or - (stdin) as text, and unknown arguments can be passed through to gh. It covers no part of the project's own rules — refusing --body with --body-file, the 1,000-character and template checks on the file text, the dry-run argv output and the MCP allowlists — so the item is still needed.

    The repository already uses this tool.

    Tool: pallets/click (https://github.com/pallets/click)

    • License: BSD-3-Clause
    • Last activity: 2026-11-13
    • Maintained: yes

    Covers:

    • A file-typed option reads a UTF-8 text file into the command
    • - as the value reads stdin, as gh's --body-file does
    • Unknown options can be accepted and handed on to gh unchanged
    • The missing-file error comes from the option's own parameter check

    Lacks:

    • No rule refusing --body together with --body-file
    • The body checks of pr create (1,000-character limit, no template text) are not applied to the file text
    • No dry-run that prints the gh argv and sends 0 requests
    • No MCP allowlist rows for pr edit, pr close, pr ready and pr update-branch
    • No rename of pr update to pr update-branch or removal of pr wait, and no gh pr create --draft prefix

    Tools considered:

    Searches run:

    • Click Python click.File type read file stdin "-", results: 5
    • gh pr create --body-file read body from file or stdin, results: 5
    • click python library cli option read text file utf-8, results: 5
    • pallets click documentation file type lazy file for option, results: 5
    • GitHub CLI gh pr create manual body-file stdin flag, results: 5
    • click.palletsprojects.com parameters file type stdin, results: 5
    • "click.File" option stdin dash example, results: 5
    • dan-petty devops-cli pull request body-file flag, results: 5
    • click context_settings ignore_unknown_options allow_extra_args pass through arguments, results: 5

    Sources:

    Checked on 2026-11-14. A person decides what this means for the item. The check changes no label and closes no issue.

  10. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at ca62d6a while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.

    The next refine round also looks at the item again when a commit on the default branch changes one of these files: src/devops_cli/commands/pr.py.

  11. added
    status/ready
    and removed
    status/new
    on Nov 16, 2026
  12. devops-cli-service commented on Nov 16, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 7ba78c5 (see proposed design in issue body).

    Moved to new items: #5908.

  13. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 25, 2026
  14. removed
    status/in-review
    owner/agent
    on Nov 25, 2026
  15. devops-cli-service commented on Nov 25, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-25 03:35 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumscope/prsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions