Skip to content

fix(tui): wire recipe dispatcher through newRootCmdForRecipeStep#16

Merged
jklaassenjc merged 1 commit into
mainfrom
juergen/tui-wire-recipe-step-reset
Apr 23, 2026
Merged

fix(tui): wire recipe dispatcher through newRootCmdForRecipeStep#16
jklaassenjc merged 1 commit into
mainfrom
juergen/tui-wire-recipe-step-reset

Conversation

@jklaassenjc
Copy link
Copy Markdown
Collaborator

@jklaassenjc jklaassenjc commented Apr 22, 2026

Summary

Why

#14 and #15 were split for cleaner review: #15 predates the runner and fixes a bug on the CLI path too, so it didn't need to be bundled. The cost was this tail — while #15 made jc recipe run security-audit work again, the TUI's dispatcher in internal/cmd/tui.go was still wired through an inline func() { return NewRootCmd() } that bypassed the viper reset. Recipes with capturing steps after -t steps (security-audit, compliance-report) would still misrender from the TUI.

Test plan

  • go build ./... clean
  • go test ./... — all suites pass unchanged
  • Local TUI smoke: run security-audit via jc tui → Recipes, verify Auth failures in last 7 days: 0 instead of the old <no value>

🤖 Generated with Claude Code


Note

Low Risk
Low risk wiring change confined to the TUI recipe dispatcher; behavior should only differ by preventing output-format/viper state leakage across recipe steps.

Overview
Fixes the TUI Recipes runner to build its dispatcher with newRootCmdForRecipeStep (instead of an inline NewRootCmd factory), so persistent viper keys are reset between steps.

This prevents a -t step from leaking table output settings into later JSON-capturing steps, aligning TUI recipe execution with jc recipe run.

Reviewed by Cursor Bugbot for commit 0a786f4. Bugbot is set up for automated code reviews on this repo. Configure here.

Follow-up to PR #14 (TUI runner) + PR #15 (viper leak fix). The runner
was left wiring an inline dispatcher factory because the helper from
#15 didn't exist yet on that branch. With both landed, switch the TUI
dispatcher to newRootCmdForRecipeStep so the TUI benefits from the
same viper state reset the CLI `jc recipe run` already gets — fixes
recipes that rely on a captured step's JSON output (security-audit,
compliance-report) when run from the TUI.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jklaassenjc jklaassenjc merged commit c79555a into main Apr 23, 2026
5 of 6 checks passed
@jklaassenjc jklaassenjc deleted the juergen/tui-wire-recipe-step-reset branch April 23, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants