Skip to content

fix(cli): no-TTY fallback for task pickers - #77

Open
olddognewflex wants to merge 1 commit into
mainfrom
fix/no-tty-picker-fallback
Open

fix(cli): no-TTY fallback for task pickers#77
olddognewflex wants to merge 1 commit into
mainfrom
fix/no-tty-picker-fallback

Conversation

@olddognewflex

Copy link
Copy Markdown
Owner

Closes #62.

Problem

qi task done / schedule / breakdown invoked the Bubble Tea picker on an ambiguous match with no TTY guard. In a pipe (or under an agent), that dies with a raw bubbletea open /dev/tty error. qi inbox has --dry-run as its headless path; the pickers had nothing (§2.4).

Fix

The three picker calls now route through a pickTasks wrapper:

  • With a terminal — launches the interactive picker, unchanged.
  • Without one — prints the candidate list plus an instruction ("Re-run with a more specific query (or an exact single match)…") and returns a clear ambiguous match: N tasks and no terminal for the picker error, exiting non-zero.

TTY detection is stdinIsTTY, a package var over term.IsTerminal(os.Stdin) so tests can force the headless path.

Verification

$ qi task done write </dev/null
Tasks matching "write" — 2 candidates; the interactive picker needs a terminal.
  - write report
  - write tests
Re-run with a more specific query (or an exact single match) to select non-interactively.
ambiguous match: 2 tasks and no terminal for the picker   # exit 1

Test forces the no-TTY branch and asserts the candidate list + instruction + error. Full go test ./..., go vet, go build ./... green.

Merge-order note

Touches internal/commands/task.go. Overlaps #60 (constructor swap) and #61; a trivial rebase for whichever merges later.

qi task done/schedule/breakdown launched the Bubble Tea picker on an
ambiguous match with no TTY guard, so in a pipe (or an agent) they died
with a raw bubbletea "/dev/tty" error (closes #62). qi inbox has
--dry-run as its headless path; the pickers had nothing.

The three picker calls now go through a pickTasks wrapper: with a
terminal it launches the picker as before; without one it prints the
candidate list plus an instruction to narrow the match (a more specific
query or an exact single match) and returns a clear error. TTY
detection is stdinIsTTY, a package var over term.IsTerminal so tests
can force the headless path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No-TTY fallback for task pickers (task done/schedule/breakdown die in a pipe)

1 participant