Skip to content

fix(cli): fit the line of a running step to the terminal's width, and keep the indent of doctor's details - #356

Merged
goldbarth merged 1 commit into
mainfrom
fix/progress-fits-the-terminal
Oct 8, 2026
Merged

goldbarth merged 1 commit into
mainfrom
fix/progress-fits-the-terminal

Conversation

@goldbarth

Copy link
Copy Markdown
Owner

Closes #349

  • Why: the line of a running step is 53 to 60 columns wide and was redrawn without knowing how wide the terminal is. In a narrower window it wraps, the carriage return goes back to the start of its last row only, and every frame leaves a row behind: more than a thousand lines for a step of two minutes.
  • Fitted, not switched to plain lines: the line gives up whole parts until it fits in one row. First the padding and the word "commits" (Reading pull requests 47/64 19 s), then the time, then the count, and at last the end of the label. Whole parts go before one is cut, so a narrow line never ends in half a number. Falling back to the plain lines below a width would have been less code, but a narrow pane would lose the spinner, the count and the time at once, and a resize during a step would need a switch between two forms.
  • The last column stays empty: some terminals move to the next row as soon as it is written to. So a line may fill the width minus one.
  • Below ten columns no frame is drawn: the spinner and its indent alone are nine columns, so there is nothing to fit. The step shows its finished line once.
  • The width is read with every line (TerminalWidth.Current), so a window resized during a step is right from the next frame on, and the finished · done and × fail lines fit the same width. It is not part of TerminalProfile, which is decided once per stream.
  • A width that cannot be read keeps the line as it was. That includes one case measured here: with stdout and stdin both redirected and only stderr on a terminal, the runtime reports 80 columns whatever the window is.
  • doctor (the comment on the issue): on a terminal, a detail longer than the window is broken between words and every row keeps the indent of the details, where the terminal's own wrapping put the rest on column 0. A word longer than the room, such as a URL, keeps a row to itself and is not cut. Plain output is never broken, so a report pasted into an issue reads as before; below 20 columns of room the detail is left to the terminal.
  • docs/cli.md says what a narrow window shows, under "While a run works" and under doctor.

Verified:

  • Reproduced first on main (2bd14c1): chartula preview --tag v0.1.0-preview.4 in a pseudo-terminal of 39 columns (script, stty cols 39) draws 385 lines of 53 to 56 columns, each of which wraps.
  • The same command with this change: 363 lines drawn, the widest 36 columns, the last · done Reading pull requests 64/64. At 30 columns: the widest 29, · done Reading pull request.
  • chartula doctor at 100 and at 60 columns: the detail of a missing key is broken between words under its check, and the key URL stands on a row of its own.
  • The terminal mode sequence of A run writes a terminal mode sequence on a terminal even with --plain, and again after each git call #348 is written as often as before, 8 times in that run on both builds: reading the width adds none.

Tests: ConsoleRunProgressTests gain the form at ten widths, a finished step at two, no line as wide as the terminal at any width from 10 to 70, no frame below ten columns, and a resize between two frames; its existing tests now pass "no width", so they do not depend on the console of the test runner. DoctorCommandTests hold the broken detail with its indent on a terminal, and the unbroken one in plain output. Full suite 1,031 passing, build without warnings.

@goldbarth goldbarth self-assigned this Oct 8, 2026
@goldbarth
goldbarth merged commit 1367ed3 into main Oct 8, 2026
4 checks passed
@goldbarth
goldbarth deleted the fix/progress-fits-the-terminal branch October 8, 2026 14:08
goldbarth added a commit that referenced this pull request Oct 8, 2026
Follows #360. Step 1 of `docs/development/releasing.md`.

- **Why now:** the manual run of `0.1.0-preview.4` on 2026-10-08 found
what a first user meets in the terminal, and six pull requests fixed it.
The binary people install is still preview.4, which has none of them,
and the terminal recording for the README (#325) and the model
comparison (#324) should show and measure the Chartula the announcement
describes.
- **What ships since preview.4,** 6 changes:
- the progress: the spinner next to its label and the header on the
column of the steps (#352), the line fitted to a narrow terminal (#356),
the step of an audience that did not render marked `× fail` (#359);
- the summary: a rendering shown for reading on a terminal, in the two
colours of the ramp (#360), a publishing run that says what became of
the release notes (#359), a blank line before the count of failed
audiences (#358);
- `doctor`: details broken between words with their indent (#356), a
rate limit message that stands on its own (#358);
- the command line: a slip in `--audience` refused, every refused
argument printed alike, `chartula version` told the flag (#358);
- the free check: a number with thousands separators read as one number
(#357).
- **Breaks to state in the notes,** as `docs/versioning.md` asks of a
preview:
- On a terminal the summary no longer prints a rendering as Markdown
source (#360). Redirected output, CI and `--plain` are unchanged, so a
script is not affected; a person who copied from the terminal copies
from the files or passes `--plain`.
- The header keys `Model:`, `GitHub:` and `Range:` are padded by one
more space (#352). A script that cuts the value at a fixed column needs
a look; one that reads past the key does not.
- `--audience product,` and `--audience 1` stop the run (#358); both ran
before, the second as the customer audience.
- A refused argument prints a second line, the pointer to the help, and
`--repo name-only` no longer prints the header first (#358).
- A publishing run without a technical rendering lists the release notes
under `Skipped` (#359), and the step of a failed audience reads `× fail`
where it read `· done`.
- The rule-based check reads `100,200` as one number (#357), so facts
that list three-digit numbers without a space no longer back each of
them.
- The csproj `Version` is the single source; nothing else carries the
number.

**After merge:** tag the merge commit on `main` with `v0.1.0-preview.5`
and push it; `release.yml` builds the draft, `chartula generate --tag
v0.1.0-preview.5` writes the notes into it with the settings
`releasing.md` names (`gpt-6.1-sol`, thinking `low`), and publishing
runs `install.yml`. The pinned `v0.1.0-preview.4` in `docs/ci.md` and
`docs/install.md`, and the template link in the `doctor` samples, move
to the new tag with the changelog pull request of step 6.

**Verified:** the built CLI prints `chartula 0.1.0-preview.5+<commit>`.

Tests: no test changed. Full suite 1,082 passing, build without
warnings.
goldbarth added a commit that referenced this pull request Oct 8, 2026
…d the getting-started guide (#363)

Closes #325

- **Why:** the README shows a real finding as text. A recording shows
the workflow around it: the command, the progress, the summary. With
#352 to #360 the terminal output has a form worth showing.
- **Two clips, from real runs on a public repository,**
[goldbarth/ServiceDeskLite](https://github.com/goldbarth/ServiceDeskLite)
`v1.9.0`, with the released binary `0.1.0-preview.5` and
`claude-sonnet-5-5`, on 2026-10-09:
- `chartula doctor`, in `docs/getting-started.md` at the step that reads
its report;
- `chartula generate --no-publish --audience customer`, in the README at
the end of "What it looks like", below the text example, which stays
complete without it.
- **Recorded with [VHS](https://github.com/charmbracelet/vhs) from tapes
in `docs/assets/tapes/`,** not typed by hand: a tape holds the command,
the size, the palette and the settings, so a clip can be recorded again
after the output changes. Each tape says what it needs and what a take
costs.
- **At the speed of the run:** nothing is sped up and no pause is cut.
The captions say so, and give no duration as a statement about runtime.
- **GIF, not video:** a GIF plays by itself in the README, a video waits
for a click. A camera that follows the summary was tried and is only
small as a video (0.5 MB against 35 MB as a GIF), so the clip keeps the
jump a terminal makes when the summary is printed.
- **The run in the README raised no flag,** in three takes on this
release. The caption says so and points at the text example for what a
flag looks like, rather than choosing a larger case to get one.
- **`claude-sonnet-5-5` in place of the pinned `claude-sonnet-5`:** the
tape sets `Chartula__Llm__Model`, the header of the clip names the
model, and so does the caption. It is also the first run of Chartula on
that model: `doctor` and three runs passed.
- **The tapes drop every `Chartula__` setting the starting terminal has
exported** before they set the model. The first take recorded an OpenAI
endpoint left over from a release run as if it were the default.
- **The palette is the Goldbarth ramp.** A terminal theme decides what
the standard green of `ok` and red of `fail` look like: green is the
ramp's teal, and the red, which the ramp does not have, is a muted tone
chosen for the recording. No red shows in either clip.

**Verification**

- Both clips read frame by frame: no key or token value, no private path
(the checkout is `/home/goldbarth/demo/ServiceDeskLite`), no line broken
in mid-word. `doctor.gif` is 197 KB, `generate.gif` 475 KB.
- The run in the README is run record `20261008T232030Z-v1.9.0`:
`toolVersion` `0.1.0-preview.5+541842d`, 10 pull requests, 10 facts,
22,254 tokens in and 4,542 out, 37.0 s, no flags, no failed call.
- `vhs validate` passes for both tapes.

Not in this pull request: `doctor`'s last line is not broken to the
window like its details are (#356), which is why its clip is wider than
the other. That is a finding for an issue.

Tests: none, documentation and assets only.
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.

On a terminal narrower than the progress line, the spinner writes a new line with every frame

1 participant