tts: --multi-speaker accepts extra '=' separators during --dry-run and normal execution

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

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
25/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go

Research direction

Read internal/cli/custom/tts.go at buildSpeechConfig near line 412 and the TestBuildSpeechConfig cases. The issue reports that strings.Cut accepts extra = separators; verify the malformed examples in dry-run mode and compare with the proposed validation check. Done means malformed mappings return ExitUsage with a clear flag error, while valid mappings still pass the focused test.

Written by the indexing model from the issue text.

Description

Description

buildSpeechConfig in internal/cli/custom/tts.go uses strings.Cut(pair, "="), which splits only at the first =. Entries such as Alice=Kore=oops, Alice==Kore, and Alice=Kore= are accepted as speaker mappings. Dry-run exits 0; normal execution sends the malformed voice to the API.

Reproduction
gemini-api --no-keyring tts 'Alice: hi. Bob: hello.' \
  --multi-speaker 'Alice=Kore=oops,Bob=Puck' --dry-run -o json
echo $?

Current: 0, with "voice":"Kore=oops" in the preview. Expected: 2 (ExitUsage), with a clear flag error. With the fix below, the same command exits 2.

Proposed fix

Add the extra separator check at internal/cli/custom/tts.go:412:

if !ok || name == "" || voice == "" || strings.Contains(voice, "=") {

The fix branch changes this line and adds four cases to TestBuildSpeechConfig. The focused test, full test suite, and go vet ./internal/cli/custom pass.

I can open a PR if you'd like one.

Dominant language
Go
Stars
514
Forks
84
Avg merge
1d 15h
Merged PRs (30d)
69

Getting set up

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.

More from google-gemini/gemini-api-cli

All issues in google-gemini/gemini-api-cli

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.