feat(scripts): shared output library with NO_COLOR #265

Merged
jfraeys merged 2 commits from jfraeys/feat/scripts-util-lib into main 2026-10-17 13:14:49 -04:00
Owner

New scripts/lib/output.sh (+ output.py): one log format ([INFO]/[OK] stdout, [WARN]/[ERROR] stderr) and one colour decision per stream: NO_COLOR (non-empty) off, TERM=dumb off, FORCE_COLOR/CLICOLOR_FORCE on, else terminal detection (the manage CLI only checked stdout and ignored NO_COLOR).

  • manage's log::* and C_* variables and lib/log.sh's log_* now come from it; output on a non-terminal is unchanged and escape handling (echo -e) is kept.
  • Tests: test-output.sh, test_output.py, wired into lint. The existing manage/rotation tests still pass.
  • Not converted yet: the ~30 scripts with their own echo "[OK]" / escape codes; they adopt it as they are touched (documented in scripts/CLAUDE.md).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ge5tovcwdEUBtPwUktsZZZ

New `scripts/lib/output.sh` (+ `output.py`): one log format (`[INFO]`/`[OK]` stdout, `[WARN]`/`[ERROR]` stderr) and one colour decision per stream: `NO_COLOR` (non-empty) off, `TERM=dumb` off, `FORCE_COLOR`/`CLICOLOR_FORCE` on, else terminal detection (the manage CLI only checked stdout and ignored NO_COLOR). - `manage`'s `log::*` and `C_*` variables and `lib/log.sh`'s `log_*` now come from it; output on a non-terminal is unchanged and escape handling (`echo -e`) is kept. - Tests: `test-output.sh`, `test_output.py`, wired into lint. The existing manage/rotation tests still pass. - Not converted yet: the ~30 scripts with their own `echo "[OK]"` / escape codes; they adopt it as they are touched (documented in scripts/CLAUDE.md). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Ge5tovcwdEUBtPwUktsZZZ
feat(scripts): shared output library (lib/output.sh + output.py) with NO_COLOR
All checks were successful
Lint / lint (pull_request) Successful in 2m47s
Secret scan / scan (pull_request) Successful in 17s
4714e0343d
One log format and one colour rule for every script: NO_COLOR, TERM=dumb, FORCE_COLOR/CLICOLOR_FORCE,
per-stream terminal detection. manage's log::* and lib/log.sh now use it; output is unchanged on a
non-terminal. Other scripts adopt it as they are touched.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ge5tovcwdEUBtPwUktsZZZ
fix(manage): ship lib/output.sh to hosts; test that manage_cli's file list runs manage
All checks were successful
Lint / lint (pull_request) Successful in 2m21s
Secret scan / scan (pull_request) Successful in 16s
46ac5abd25
core.sh now sources ../output.sh; the manage_cli role and install.sh copy explicit file lists,
so without this a manage_cli deploy would break the on-host CLI.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ge5tovcwdEUBtPwUktsZZZ
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jfraeys/infra!265
No description provided.