Skip to content

fix: read import's stdin and terminal check through Deps, update the no_verify comment, send area uuids as area-id - #344

Merged
ryanlewis merged 4 commits into
mainfrom
fix/readback-cleanups
Oct 3, 2026
Merged

ryanlewis merged 4 commits into
mainfrom
fix/readback-cleanups

Conversation

@ryanlewis

Copy link
Copy Markdown
Owner

The last follow-ups from the add/edit read-back work: two small cleanups to how Deps reads stdin, an out-of-date config comment, and a project add --area <uuid> bug found while fixing the same bug in add (#343).

What was wrong

  • import read os.Stdin directly instead of through Deps.Stdin (d.in()), the reader the prompts use. A caller that supplied stdin through Deps wasn't the one read.
  • Deps.interactive() checked the real stdin through the global isInteractive(). A caller could not inject that check, the way it can inject Stdin and Stderr.
  • The no_verify comment in the config template still said it covered only "a complete/cancel or an edit". Since feat(add): read back the created item and print it as show does #332 it also covers add, and it covers tag creation and import status changes too. The --no-verify help and the configuration page already said so.
  • project add --area <uuid> created the project under no area, though the help says "Area name or UUID". Things matches area by title only. I confirmed this with a throwaway zz things-cli test project in the real app.

What changed

  • Deps gains TTY func() bool. When it is nil, the CLI checks the real terminal, the same way Stdin and Stderr fall back to the real streams. interactive() and import both use it through a new stdinTTY(). import reads its payload from d.in().
  • The template comment now lists add, complete/cancel, edit, tag creation and import status changes. The template block in docs/content/configuration.md is regenerated to match, which TestDocsPageQuotesTheTemplate checks. This is a comment-only change to the template text.
  • project add resolves --area with db.FindAreaUUID. When the value is an area's UUID it is sent as area-id; a title is still sent as area. A second throwaway project with the fix landed in the right area. Both throwaway projects are in the Trash.
  • docs/content/commands.md and internal/skill/SKILL.md say --area takes a UUID.

Tests

  • TestRunImportReadsDepsStdin: import with a payload in Deps.Stdin. On the unfixed code it read the real stdin and failed with "empty payload".
  • TestInteractiveUsesDepsTTY: an injected terminal lets confirmAction prompt and read the answer, --json still turns prompting off, and import on that terminal gives the "no JSON on stdin" error. It does not compile on the unfixed code, because there was nowhere to inject the check.
  • TestProjectAddSendsUUIDAsAreaID: a UUID goes as area-id with no area beside it, and a title or an unknown name goes as area. The UUID case failed on the unfixed code.

make test and make lint pass. /code-review medium --fix found nothing.

import read os.Stdin directly instead of Deps.Stdin, and Deps.interactive
checked the real stdin through the global isInteractive. Deps gains a TTY
func, defaulting to the real check, and import uses it and d.in().
Things matches add-project's area by title only, so project add --area
<uuid> created the project under no area. A uuid of an area now goes as
area-id.
@ryanlewis
ryanlewis merged commit b93a1b0 into main Oct 3, 2026
12 of 13 checks passed
@ryanlewis
ryanlewis deleted the fix/readback-cleanups branch October 3, 2026 21:10
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.

1 participant