mirror of
https://github.com/Twigpine/zero.git
synced 2026-11-11 23:40:28 -10:00
write_file/edit_file only reported "Created X (8462 bytes)" / "edited X", so the user never saw WHAT changed — no code preview, no red/green. The TUI already renders a colored diff card whenever a tool's output looks like a unified diff (diffFirstToolBodyRenderer + looksLikeDiff), so the fix is purely tool-side: emit a diff. - edit_file appends a unified diff (old vs new) after its summary line → red/green change preview. - write_file appends a unified diff of prior vs new content: a fresh create previews as all-green additions, an overwrite as red/green. It reads the prior bytes before writing only when the file existed. - boundedUnifiedDiff (via the already-vendored go-udiff, now a direct require) caps the emitted diff at 48KB so a large generated file can't flood the transcript or balloon persisted session events; past the cap only the summary shows. The summary stays the first output line so any consumer that reads it (swarm/Task result bubbling) is unaffected. Tests: edit emits @@/-/+ ; new-file emits additions-only; overwrite emits red/green. Full tools/tui/agent/swarm suites green.
40 lines
1.4 KiB
AMPL
40 lines
1.4 KiB
AMPL
module github.com/Gitlawb/zero
|
|
|
|
go 1.25.0
|
|
|
|
toolchain go1.26.4
|
|
|
|
require (
|
|
charm.land/bubbles/v2 v2.1.0
|
|
charm.land/bubbletea/v2 v2.0.7
|
|
charm.land/lipgloss/v2 v2.0.4
|
|
github.com/alecthomas/chroma/v2 v2.27.0
|
|
github.com/atotto/clipboard v0.1.4
|
|
github.com/aymanbagabas/go-udiff v0.4.1
|
|
github.com/charmbracelet/colorprofile v0.4.3
|
|
github.com/charmbracelet/x/ansi v0.11.7
|
|
github.com/ledongthuc/pdf v0.0.0-20250511090121-5959a4027728
|
|
golang.org/x/sys v0.46.0
|
|
mvdan.cc/sh/v3 v3.13.1
|
|
)
|
|
|
|
require (
|
|
github.com/charmbracelet/ultraviolet v0.0.0-20260615092913-2399af76d5b1 // indirect
|
|
github.com/charmbracelet/x/exp/golden v0.0.0-20260615092313-b57e5e6d29bb // indirect
|
|
github.com/charmbracelet/x/term v0.2.2 // indirect
|
|
github.com/charmbracelet/x/termios v0.1.1 // indirect
|
|
github.com/charmbracelet/x/windows v0.2.2 // indirect
|
|
github.com/clipperhouse/displaywidth v0.11.0 // indirect
|
|
github.com/clipperhouse/uax29/v2 v2.7.0 // indirect
|
|
github.com/dlclark/regexp2/v2 v2.2.1 // indirect
|
|
github.com/go-quicktest/qt v1.102.0 // indirect
|
|
github.com/lucasb-eyer/go-colorful v1.4.0 // indirect
|
|
github.com/mattn/go-runewidth v0.0.24 // indirect
|
|
github.com/muesli/cancelreader v0.2.2 // indirect
|
|
github.com/rivo/uniseg v0.4.7 // indirect
|
|
github.com/rogpeppe/go-internal v1.15.0 // indirect
|
|
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
|
|
golang.org/x/exp v0.0.0-20260611194520-c48552f49976 // indirect
|
|
golang.org/x/sync v0.21.0 // indirect
|
|
)
|