Fluent text input: positional args, short flags, and stdin#14
Conversation
Parses YYYY-MM-DD format to distinguish date args from content args in commands that accept both positionally (e.g., journal write).
hey todo add "Buy milk" # positional shorthand hey todo add -t "Buy milk" # short flag echo "Buy milk" | hey todo add # stdin Flag and positional are mutually exclusive. Resolution order: --title flag > positional arg > stdin.
hey journal write "Today was great" # content for today hey journal write 2024-01-15 "Retrospective" # date + content hey journal write -c "Today was great" # short flag First positional is disambiguated: YYYY-MM-DD parses as date, anything else as content. Flag and positional are mutually exclusive.
Update README, SKILL.md quick reference, decision trees, and resource reference to show positional forms as primary examples.
Review carefully before merging. Consider a major version bump. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 52b7d78210
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Breaking change assessment: false positiveThe bot's analysis is incorrect. No flags were removed or replaced. All existing invocations continue to work identically: # These still work exactly as before:
hey todo add --title "Buy milk"
hey journal write --content "Today was great"
hey journal write 2024-01-15 --content "Retrospective"The changes are purely additive:
Surface test passes — confirms no flags or subcommands were removed. The "mutually exclusive" behavior only applies when a user supplies both a flag and a positional for the same field simultaneously, which was previously impossible (no positional existed). No version bump needed. Test plan verification
|
There was a problem hiding this comment.
Pull request overview
Adds more fluent text-input ergonomics to the HEY CLI so todo add and journal write accept positional arguments and short flags, while preserving existing long flags and stdin/$EDITOR behavior.
Changes:
todo add: support positional[title],-t, and stdin; enforce mutual exclusivity with--title.journal write: support positional[content]and[date] [content]with disambiguation, plus-c; enforce mutual exclusivity with--content.- Update docs/examples and add command-level tests for the new input modes.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| skills/hey/SKILL.md | Updates skill doc examples to use new positional forms. |
| internal/cmd/todo.go | Adds positional/stdin title resolution, -t, and mutual-exclusion errors. |
| internal/cmd/journal.go | Adds positional content parsing/disambiguation, -c, and mutual-exclusion errors. |
| internal/cmd/formatting.go | Introduces isDateArg helper for journal positional parsing. |
| internal/cmd/todo_test.go | Adds tests for positional, short/long flag, conflict, empty, and stdin for todo add. |
| internal/cmd/journal_test.go | Adds tests for positional content, date+content, short flag, and conflicts for journal write. |
| README.md | Updates README examples to use new positional forms. |
Comments suppressed due to low confidence (1)
internal/cmd/todo.go:168
- The usage hint string has double spaces around "or" (
"Buy milk" or hey ...), which will render oddly in output. Consider tightening spacing or using a multi-line hint for readability.
return output.ErrUsageHint("title is required",
"hey todo add \"Buy milk\" or hey todo add --title \"Buy milk\"")
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Validate args[0] is YYYY-MM-DD in the 2-arg form of journal write, with a clear error and hint when it isn't - Isolate XDG_CONFIG_HOME/STATE_HOME/CACHE_HOME in test helpers to prevent reads/writes against real user config - Add TestJournalWriteTwoPositionalsInvalidDate
Summary
todo addaccepts positional title,-tshorthand, and stdin (in addition to existing--title)journal writeaccepts positional content with date/content disambiguation,-cshorthand (in addition to existing--contentand stdin/$EDITOR)Cross-CLI conventions documented in basecamp/cli@6f99340 (INPUT-CONVENTIONS.md).
Test plan
go test ./internal/cmd/ -run TestTodoAdd -v— 6 tests (positional, short flag, long flag, conflict, empty, stdin)go test ./internal/cmd/ -run TestJournalWrite -v— 5 tests (positional content, date+content, short flag, two conflict cases)go test ./internal/cmd/ -run TestSurface -v— surface unchangedmake check— full suite passes (go vet+ all tests; lint deferred to CI due to local toolchain mismatch)