Skip to content

feat(init): Plan 22 Phase 2 — initflow package + Chromeless harness hook#48

Merged
LastStep merged 1 commit into
mainfrom
worktree-agent-a479d6c6
Apr 21, 2026
Merged

feat(init): Plan 22 Phase 2 — initflow package + Chromeless harness hook#48
LastStep merged 1 commit into
mainfrom
worktree-agent-a479d6c6

Conversation

@LastStep

Copy link
Copy Markdown
Owner

Summary

Phase 2 of Plan 22 (bonsai init cinematic redesign) — adds internal/tui/initflow/ package with chrome/enso/stage/fallback primitives, a Chromeless optional capability on the harness, and an env-flag branch in cmd/init.go routing to a stub runInitRedesign. Legacy bonsai init flow unchanged; new path runs only under BONSAI_REDESIGN=1 and renders empty stage scaffolds.

Changes

  • internal/tui/harness/harness.goChromeless optional interface + short-circuit in View().
  • internal/tui/harness/harness_test.go — coverage for chromeless render path.
  • internal/tui/initflow/fallback.goWideCharSafe() + StageLabel.
  • internal/tui/initflow/fallback_test.go — tests.
  • internal/tui/initflow/enso.goRenderEnsoRail.
  • internal/tui/initflow/chrome.goRenderHeader, RenderFooter, KeyHint.
  • internal/tui/initflow/stage.goStage base + renderFrame.
  • internal/tui/initflow/stub.goStubStage used by Phase 2's four placeholder stages.
  • cmd/init.go — env-flag branch.
  • cmd/init_redesign.go — stub runInitRedesign with 4 placeholder stages.
  • go.mod — promotes mattn/go-runewidth from indirect to direct (now imported by initflow/fallback.go).

Plan

station/Playbook/Plans/Active/22-init-redesign.md — Phase 2.

Verification

  • make build
  • go test ./...
  • gofmt -s -l . clean
  • go vet ./... clean
  • bonsai init (no env) runs legacy flow unchanged.
  • BONSAI_REDESIGN=1 bonsai init renders 4-stage chrome; Enter cycles; Esc pops; Ctrl-C aborts cleanly.
  • BONSAI_ASCII_ONLY=1 BONSAI_REDESIGN=1 bonsai init uses ASCII rail.
  • Ctrl-C with no env flag / with redesign env leaves no .bonsai.yaml in tmpdir.

Snapshot (120 × 32)

Redesign — stage 2 (Branches), wide-char safe:

[盆] BONSAI · INITIALIZE · v0.2.0                                                                        PLANTING INTO
                                                                                  /Users/dev/code/voyager-api/station/

  ●────────────────────────────────────●────────────────────────────────────[枝]────────────────────────────────────○
VESSEL                               SOIL                                 BRANCHES                               OBSERVE
                                                                             えだ

  (stage body goes here)



 一 BONSAI 一                                                                   ↵ continue  ·  esc back  ·  ctrl-c quit

Redesign — stage 2 (Branches), ASCII fallback (BONSAI_ASCII_ONLY=1):

[o] BONSAI · INITIALIZE · v0.2.0                                                                         PLANTING INTO
                                                                                  /Users/dev/code/voyager-api/station/

  [x]──────────────────────────────────[x]──────────────────────────────────[3]──────────────────────────────────[ ]
VESSEL                                SOIL                               BRANCHES                              OBSERVE

  (stage body goes here)



 一 BONSAI 一                                                                   ↵ continue  ·  esc back  ·  ctrl-c quit

Live tmux smoke test — first stage of redesign (VESSEL), wide-char:

[盆] BONSAI · INITIALIZE                                                                                 PLANTING INTO
                                                                                              /tmp/t-redesign/station/

  [器]────────────────────────────────────○────────────────────────────────────○────────────────────────────────────○
 VESSEL                                 SOIL                               BRANCHES                              OBSERVE
   うつわ

  (stage body goes here)



 一 BONSAI 一                                                                                ↵ continue  ·  ctrl-c quit

🤖 Generated with Claude Code

Adds the internal/tui/initflow/ scaffolding for the cinematic `bonsai init`
redesign (Plan 22):

- harness: Chromeless optional capability; harness.View() yields Step.View()
  verbatim when a step opts in. Regression-guarded by a new harness_test
  entry.
- initflow/fallback.go: WideCharSafe() + StageLabels table + StageLabel.Render
  with kanji/kana-safe and ASCII-only branches.
- initflow/enso.go: RenderEnsoRail draws the 4-stage progress rail with
  [kanji]-box current marker, ● / ○ dots, and LeafDim/Rule2 connectors.
  ASCII fallback renders [x]/[N]/[ ] brackets.
- initflow/chrome.go: RenderHeader (enso-ringed brand + PLANTING INTO
  breadcrumb) and RenderFooter (一 BONSAI 一 + KeyHint list).
- initflow/stage.go: Stage base type (projectDir, stationDir, version,
  agentDisplay, startedAt) satisfying harness.Step + Chromeless, plus
  renderFrame composing header + rail + body + footer into the full
  AltScreen frame.
- initflow/stub.go: Phase-2 placeholder stage used by runInitRedesign.
- cmd/init.go: BONSAI_REDESIGN=1 branches to runInitRedesign; legacy path
  untouched.
- cmd/init_redesign.go: stub orchestrator — captures startedAt, loads
  catalog/agent, builds 4 placeholder stages, runs harness.Run, no file
  writes.
- go.mod: promotes mattn/go-runewidth from indirect to direct.

Legacy `bonsai init` remains the default — Phase 5 will flip the default
and delete the env-flag branch.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@LastStep LastStep marked this pull request as ready for review April 21, 2026 08:54
@LastStep LastStep merged commit 2e2a08c into main Apr 21, 2026
6 checks passed
LastStep added a commit that referenced this pull request Apr 21, 2026
PR #48 merged (squash 2e2a08c). initflow package + chrome + env-flag
entrypoint live behind BONSAI_REDESIGN=1. Phase 3 (Vessel + Soil real
input) queued next.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
LastStep added a commit that referenced this pull request Apr 21, 2026
Plan 22 (bonsai init cinematic redesign) shipped end-to-end via 6 PRs
(#47 #48 #49 #50 #51 #52) over 2026-04-21. Default `bonsai init` now
runs the cinematic flow; legacy init path + BONSAI_REDESIGN env-flag
deleted in 5B (main at `5916e05`).

- Move 22-init-redesign.md → Plans/Archive/
- Status.md: In Progress row → 2 Recently Done rows (5A + 5B)
- memory.md: Work State updated (no current task)
- Backlog.md: 2 follow-ups (composition test + dead-path warning)
- Reports/Pending/2026-04-21-plan-22-init-redesign.md: final report

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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