mmkal / mmkal/trpc-cli

Feature Request: Support repeated flags or comma-separated values for array options

Open
#174 0 comments 0 reactions 0 assignees View on GitHub

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:

  1. Repeated flags (like npm, docker, etc.):

    mycli init --agents cursor --agents claude --agents codex
    
  2. 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() inside z.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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.