Skip to content

Fluent text input: positional args, short flags, and stdin#14

Merged
jeremy merged 5 commits intomainfrom
fluent-text-input
Mar 5, 2026
Merged

Fluent text input: positional args, short flags, and stdin#14
jeremy merged 5 commits intomainfrom
fluent-text-input

Conversation

@jeremy
Copy link
Copy Markdown
Member

@jeremy jeremy commented Mar 5, 2026

Summary

  • todo add accepts positional title, -t shorthand, and stdin (in addition to existing --title)
  • journal write accepts positional content with date/content disambiguation, -c shorthand (in addition to existing --content and stdin/$EDITOR)
  • Flag and positional are mutually exclusive with clear error messages
  • Resolution order: named flag > positional arg > stdin > $EDITOR
# Before
hey todo add --title "Buy milk"
hey journal write --content "Today was great"

# After (flag forms still work)
hey todo add "Buy milk"
hey journal write "Today was great"
hey journal write 2024-01-15 "Retrospective"
echo "Buy milk" | hey todo add

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 unchanged
  • make check — full suite passes (go vet + all tests; lint deferred to CI due to local toolchain mismatch)

jeremy added 4 commits March 5, 2026 00:04
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.
Copilot AI review requested due to automatic review settings March 5, 2026 08:05
@github-actions github-actions bot added enhancement New feature or request breaking labels Mar 5, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 5, 2026

⚠️ Potential breaking changes detected:

  • The 'write' subcommand of 'hey journal' changed its usage pattern by making 'content' a positional argument instead of requiring the '--content' flag. This breaks backward compatibility for existing scripts or commands.
  • The '--content' flag in the 'write' subcommand of 'hey journal' was modified to allow a short flag '-c', which may conflict with existing scripts.
  • The 'add' subcommand of 'hey todo' changed its usage pattern by making 'title' a positional argument instead of requiring the '--title' flag. This breaks backward compatibility for existing scripts or commands.

Review carefully before merging. Consider a major version bump.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

@jeremy
Copy link
Copy Markdown
Member Author

jeremy commented Mar 5, 2026

Breaking change assessment: false positive

The 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:

  • New short flags: -t (alias for --title), -c (alias for --content)
  • New positional shorthand: hey todo add "Buy milk", hey journal write "Today was great"
  • New stdin support for todo add

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

  • go test ./internal/cmd/ -run TestTodoAdd -v — 6/6 pass (positional, short flag, long flag, conflict, empty, stdin)
  • go test ./internal/cmd/ -run TestJournalWrite -v — 5/5 pass (positional content, date+content, short flag, two conflict cases)
  • go test ./internal/cmd/ -run TestSurface -v — surface unchanged
  • make check — full suite passes (vet, lint, all tests)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@jeremy jeremy merged commit 6117aff into main Mar 5, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants