Feature Request: Support repeated flags or comma-separated values for array options
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 373
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Description
Hey! 👋 First off, thanks so much for building trpc-cli - it's been fantastic for building type-safe CLIs with minimal boilerplate. Really appreciate all the work that's gone into it!
Feature Request
It would be amazing if array options inside z.object() could support common CLI patterns like repeated flags or comma-separated values.
Current Behavior
When defining an array option inside a z.object:
t.procedure
.input(
z.object({
agents: z
.array(z.enum(["cursor", "claude", "codex"]))
.optional()
.describe("Agents to enable"),
})
)
Users attempting to pass multiple values get validation errors:
# All of these fail with validation errors:
mycli init --agents cursor,claude,codex
mycli init --agents cursor claude codex
mycli init --agents cursor --agents claude --agents codex
mycli init --agents "cursor" --agents "claude"
Error example:
Invalid option: expected one of "claude"|"codex"|"cursor"... → at agents[0]
The only working syntax is JSON:
mycli init --agents '["cursor","claude","codex"]'
Expected Behavior
It would be great if at least one of these common CLI patterns worked:
-
Repeated flags (like npm, docker, etc.):
mycli init --agents cursor --agents claude --agents codex -
Comma-separated values (like many CLI tools):
mycli init --agents cursor,claude,codex
Use Case
We're using trpc-cli for Ultracite and received a bug report from a user who couldn't figure out how to pass multiple agents. The JSON syntax works but isn't intuitive for most CLI users.
Suggestion
Perhaps this could be:
- A default behavior for
z.array()insidez.object() - An opt-in via
.meta()like{ arrayStyle: 'repeated' | 'csv' | 'json' } - Automatic detection that tries repeated flags first, then CSV, then JSON
Thanks again for considering this! Happy to help with implementation if you'd like. 🙏
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no implementation files, tests, or entry points; start by locating the CLI parsing path for z.object() array options. Compare repeated-flag, comma-separated, and JSON inputs, then clarify one supported behavior and add coverage showing the chosen syntax works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100