Skip to content

feat(cli): read prose fields from a file or stdin - #30

Merged
cderv merged 1 commit into
mainfrom
feat/text-from-file
Dec 2, 2026
Merged

cderv merged 1 commit into
mainfrom
feat/text-from-file

Conversation

@cderv

@cderv cderv commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

Agents on Windows usually pass strand text through Git Bash, which mangles it: MSYS rewrites an argument starting with / into a Windows path (/proj becomes C:/Program Files/Git/proj), and some agent shells collapse \\ to \. Reading the text from a file avoids the shell entirely.

Every prose field gets a file variant:

  • create --description-file
  • update --description-file, --design-file, --acceptance-criteria-file, --notes-file
  • close --reason-file
  • comment -F / --file, after git commit -F

- reads stdin (one flag per command at most). The text is stored exactly as read: no trimming, no newline translation. Non-UTF-8 input is rejected with the file name. Each file flag conflicts with its inline form, and comment requires one of the two.

The four new fields on update trip clippy's large_enum_variant on Cmd. I allowed it in place since the enum is parsed once per process; boxing the update args is the alternative if you prefer.

Test plan

  • New e2e tests in crates/braid/tests/text_file_cli.rs read back each field through a file and through stdin with show --json, byte for byte, on text containing \\?\C:\x, a line starting with /proj, a CRLF and several lines (run on Windows)
  • Conflicts, missing comment text, two fields both reading stdin, an unreadable file and non-UTF-8 input fail with clear errors
  • docs_drift and agents_info pass with the updated guide
  • fmt, clippy -D warnings and the rest of the suite pass locally on Windows
  • CI on Linux, macOS and Windows

Agents on Windows pass strand text through Git Bash, which mangles it:
MSYS rewrites an argument starting with `/` into a Windows path
(`/proj` becomes `C:/Program Files/Git/proj`), and some agent shells
collapse `\\` to `\`. Reading the text from a file sidesteps the shell.

Every prose field gets a file variant: `--description-file` on create;
`--description-file`, `--design-file`, `--acceptance-criteria-file` and
`--notes-file` on update; `--reason-file` on close; and `-F`/`--file` on
comment, after `git commit -F`. `-` reads stdin, and only one flag per
command may use it. The bytes are stored as read, with no trimming or
newline translation; non-UTF-8 input is rejected. Each file flag
conflicts with its inline counterpart.

Adding four fields to `Update` trips clippy's `large_enum_variant` on
`Cmd`; it is allowed in place, since the enum is parsed once per
process.
@cderv
cderv merged commit d1cdbe7 into main Dec 2, 2026
4 checks passed
@cderv cderv mentioned this pull request Dec 2, 2026
1 of 2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant