Skip to content

Colour the reporting commands; split the warnings line - #14

Merged
jayhesselberth merged 1 commit into
mainfrom
colour-reporting-commands
Aug 27, 2026
Merged

Colour the reporting commands; split the warnings line#14
jayhesselberth merged 1 commit into
mainfrom
colour-reporting-commands

Conversation

@jayhesselberth

Copy link
Copy Markdown
Member

Colour

--help, --list, --status, --check-quota and --install-claude printed flat text while the launch and teardown narration beside them was already colourised — the two halves of the same tool didn't look like the same tool.

The mechanism needed fixing, not just the call sites. init_colors gated on [[ -t 2 ]], but every one of those commands writes to stdout. It now takes an fd and clears the palette before deciding, so it's re-entrant: the narration asks about stderr, each reporting command calls init_colors 1 before its first line to ask about stdout. sinteractive --list | less carries no escapes; a plain --list does. SINTERACTIVE_COLOR, NO_COLOR and TERM=dumb are unchanged and apply to both.

Identifiers — job ids, node names — are teal wherever they appear, matching the narration and the status bar. Labels yellow, secondary text dim. Errors are uniform throughout: red bold label, message beside it, follow-on hint dimmed under it. Text sinteractive quotes rather than writes (sbatch's own stderr) is left exactly as sbatch produced it.

Two things now read by colour instead of by parsing:

  • --status shades remaining walltime yellow under an hour, red under fifteen minutes.
  • Job tables mark PENDING yellow against a green RUNNING. In the job-limit error that's the point — a pending job holds a slot exactly as a running one does.

The warnings line

Split: quota flush left, maintenance-trimmed end time flush right, under the two ends the session line above already uses. Both used to sit at the left sharing a , reading as one long run of text with the middle of the line empty.

Before:

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 ● session 246026 | compute15 | sint                              Help: Ctrl+b h | Detach: Ctrl+b d
 ⚠ OVER QUOTA  30.2T / 30T · over by 204.8G │ SHORT SESSION · ends before monthly-maint at Thu 06:00
 Claude Code: run sinteractive --install-claude to enable the skills and hooks

After, at 100 columns:

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 ● session 246026 | compute15 | sint                              Help: Ctrl+b h | Detach: Ctrl+b d
 ⚠ QUOTA over by 204.8G (30T limit)                                  ends Thu 06:00 · monthly-maint
 Claude Code: run sinteractive --install-claude to enable the skills and hooks

and at 80, still a 14-space gap:

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 ● session 246026 | compute15 | sint          Help: Ctrl+b h | Detach: Ctrl+b d
 ⚠ QUOTA over by 204.8G (30T limit)              ends Thu 06:00 · monthly-maint
 Claude Code: run sinteractive --install-claude to enable the skills and hooks

Each half keeps its side whether or not the other is there, so neither moves when its neighbour appears or clears.

Both are shorter. The quota notice reports the overage rather than the usage — that's the number you act on, and "over by" already says you're over. The maintenance notice drops its SHORT SESSION label: in yellow, on the warnings line, an end time that isn't the one you asked for already reads as a warning, so the space goes to the reservation name instead.

Verification

  • Full CI suite locally: bash -n on all four scripts, shellcheck --severity=warning, groff -ww -z on the man page, JSON check on the settings snippet.
  • The layouts above are a real tmux client attached on a 100- and 80-column pty, captured and replayed through a screen model — not mockups.
  • Colour off when stdout is piped, off under NO_COLOR, on under SINTERACTIVE_COLOR=always; --json output byte-identical on both --status and --list.
  • Quota wording in skills/bodhi-storage/SKILL.md is quoted verbatim from --check-quota, so that text is unchanged — only the status-bar notice moved.

README, man page, the bodhi-storage skill and CHANGELOG are updated to match.

🤖 Generated with Claude Code

The launch and teardown narration was already colourised while --help,
--list, --status, --check-quota and --install-claude beside it printed flat
text, so the two halves of the same tool did not look like the same tool.

Colour is now decided per stream rather than once at startup. init_colors
takes an fd and clears the palette before deciding, so it is re-entrant: the
narration asks about stderr, and each reporting command calls init_colors 1
before its first line to ask about stdout. `sinteractive --list | less` then
carries no escapes where a plain --list does. SINTERACTIVE_COLOR, NO_COLOR
and TERM=dumb are unchanged, and apply to both.

Identifiers — job ids, node names — are teal wherever they appear, matching
the narration and the status bar. Labels are yellow, secondary text dim, and
errors are uniform throughout: a red bold label, the message beside it, and
any follow-on hint dimmed under it. Two things now read by colour instead of
by parsing: --status shades remaining walltime yellow under an hour and red
under fifteen, and job tables mark PENDING yellow against a green RUNNING —
which in the job-limit error is the point, since a pending job holds a slot
exactly as a running one does. sbatch's own stderr is quoted, not recoloured.

The warnings line under the status bar is split, quota flush left and the
maintenance-trimmed end time flush right, under the two ends the session line
above already uses. Both used to sit at the left with a separator between
them, reading as one long run of text with the middle of the line empty; each
half now keeps its side whether or not the other is there, so neither moves
when its neighbour appears or clears.

Both are shorter. The quota notice reports the overage rather than the usage
(⚠ QUOTA over by 204.8G (30T limit)) because that is the number to act on,
and "over by" already says you are over. The maintenance notice drops its
SHORT SESSION label: in yellow, on the warnings line, an end time that is not
the one you asked for is already reading as a warning, so the space goes to
the reservation name instead.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jayhesselberth
jayhesselberth merged commit 823fdc0 into main Aug 27, 2026
1 check passed
@jayhesselberth
jayhesselberth deleted the colour-reporting-commands branch August 27, 2026 01:18
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