Skip to content

[codex] Add literal mode for subcommand-shaped prompts#33

Merged
CoreyRDean merged 1 commit into
mainfrom
ux/literal-natural-language
May 21, 2026
Merged

[codex] Add literal mode for subcommand-shaped prompts#33
CoreyRDean merged 1 commit into
mainfrom
ux/literal-natural-language

Conversation

@CoreyRDean
Copy link
Copy Markdown
Owner

Non-technical summary

This adds a small but important escape hatch for intent's command-line UX: prompts that begin with words like version, report, or explain can now be forced through natural-language mode instead of being mistaken for subcommands. That matters now because the current dispatch rule makes some perfectly valid prompts awkward or impossible to express without rewriting them.

After this change, i --literal ... keeps the rest of the argv tail as prompt text, so users can intentionally say things that look like subcommands or flags without fighting the parser.

Technical summary

  • add dispatcher-level --literal handling in internal/cli/cli.go by collapsing everything after the first --literal into one prompt token before subcommand matching
  • preserve natural-language flags placed before --literal, while keeping everything after it inside the prompt text
  • extend unit coverage in internal/cli/cli_test.go for the argv rewrite behavior
  • add smoke coverage in internal/cli/smoke_test.go proving that version stays in natural-language mode under --literal and that tail flag-shaped words are not re-parsed
  • update docs/SPEC.md and README.md to document the new public flag
  • verification: go test ./internal/cli/..., go test ./..., go vet ./..., make build
  • breaking changes: none intended; this is an additive CLI alignment fix

Additional notes

Trade-off: --literal is intentionally narrow. It fixes the dispatch ambiguity without redesigning the broader natural-language flag parser.

Deferred: larger parser/prompting issues like file-edit grounding and other open natural-language behavior bugs remain separate increments.

Remaining gap: this makes subcommand-shaped prompts expressible, but it does not change how ordinary natural-language prompts are interpreted once they reach the model.

@CoreyRDean CoreyRDean marked this pull request as ready for review May 21, 2026 13:06
@CoreyRDean CoreyRDean merged commit 289292b into main May 21, 2026
8 checks passed
@CoreyRDean CoreyRDean deleted the ux/literal-natural-language branch May 21, 2026 13:07
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

switch args[0] {
case "--version", "-V":
return cmdVersion(ctx, nil)
case "--help", "-h":
return cmdHelp(ctx, nil)

P1 Badge Skip top-level flag dispatch after --literal

When --literal is the first flag, tokens after it are documented as prompt text, but this dispatcher still interprets --help/--version as top-level commands. For example, i --literal --help currently prints help instead of treating --help as the natural-language prompt, which breaks the new literal-mode contract for subcommand/flag-shaped prompts. Gate this early switch on !forceLiteral (or move it before rewriting) so post-literal tokens are never re-parsed as dispatcher flags.

ℹ️ 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".

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant