Conversation
|
🔥 |
Introduces `chunk watch`, a live BubbleTea dashboard showing active sidecars and their recent sync/validate activity. Adds an append-only JSONL event log written by `chunk sidecar sync` and `chunk validate` so the TUI has data to display. Also adds `iostream.LevelError` and wires done/error completion events into validate so the TUI correctly reflects when an operation finishes rather than spinning indefinitely. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| return fmt.Errorf("sync: %w", cwdErr) | ||
| } | ||
| syncFn := newStatusFunc(io) | ||
| if dataDir, dirErr := sidecar.StateDir(); dirErr == nil { |
There was a problem hiding this comment.
we duplicate this a few times, can you create a helper in the event log that closes over all the work to figure out the file path and handle any errors loading the sidecar
| } | ||
| offset := m.offsets[i] | ||
| if offset == 0 { | ||
| recent, _ := p.Log.Recent(recentEvents) |
There was a problem hiding this comment.
do we need to handle these errors at all?
| branch := CurrentBranch(root) | ||
| return os.WriteFile(filepath.Join(dir, sidecarFileName(session.IDFromCtx(ctx), branch)), data, 0o644) | ||
| if err := os.WriteFile(filepath.Join(dir, sidecarFileName(session.IDFromCtx(ctx), branch)), data, 0o644); err != nil { | ||
| return err |
There was a problem hiding this comment.
Could saveDir() and config.ProjectDataDir() produce different subdirectory paths for the same project root? Both write a project-root breadcrumb, but AllProjectRoots discovers projects by iterating config.AppData() subdirs. If the two functions hash or clean the project path differently, projects registered via watch.go (which calls config.ProjectDataDir(abs) directly) would never appear in --all output — silently producing an empty list with no error.
- Add eventlog.WrapFromDir helper to consolidate the StateDir→Open→Wrap pattern duplicated across sync and validate commands - Cache headRef and CurrentBranch in loadData so git subprocesses fire once per poll tick instead of on every render frame; bump pollInterval 2s→5s - Fix ProjectDataDir to resolve symlinks via EvalSymlinks before hashing, ensuring watch.go (git --show-toplevel) and sidecar.saveDir (filesystem walk) always land in the same data directory Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
Adds
chunk watch, a live TUI dashboard showing active sidecars, sync state, and recent activity in a split-pane layout.--allflag watches all known projects, not just the current direcotyrScreen.Recording.2026-07-23.at.3.44.56.PM.mov
Implementation
New packages:
internal/eventlog— append-only JSONL log;Log.Wrapdecorates anyStatusFuncto mirror calls into the log tagged with sidecar ID, op, and branchinternal/tui/watch— BubbleTea model: left pane lists sidecars with sync/running state, right pane shows events filtered to the selected sidecar grouped by op-run; polls every 2s and tails the log incrementallyWiring changes:
internal/cmd/sidecar.go— wrapssyncFnwith the event log before passing toBundleSync/Syncinternal/cmd/validate.go— wrapsstatusFnwith the event log beforerunValidate; emitsLevelDone/LevelErrorafter the run so the TUI knows when validation is completeinternal/cmd/root.go— registersnewWatchCmd()internal/iostream/status.go— addsLevelErrorconstantinternal/ui/format.go— addsErrFailurefor red stderr renderinggo.mod— promotescharm.land/lipgloss/v2from indirect to direct dependencyTest plan
task build && ./dist/chunk watch— opens TUI; shows sidecars, updates every 2s./dist/chunk sidecar sync— sync events appear in right pane for the active sidecar./dist/chunk validate— validate events appear; spinner clears after✓ validate passed✗ validate failedin redj/k— navigates sidecars; right pane updates to show selected sidecar's eventsq/Ctrl-C— exits cleanlytask test— all tests pass🤖 Generated with Claude Code