Skip to content

feat: interactive installer with profile and theme selection#24

Open
xinnaider wants to merge 3 commits into
inbrace-tech:mainfrom
xinnaider:feat/installer-themes
Open

feat: interactive installer with profile and theme selection#24
xinnaider wants to merge 3 commits into
inbrace-tech:mainfrom
xinnaider:feat/installer-themes

Conversation

@xinnaider

Copy link
Copy Markdown
Contributor

What

Reworks install.sh from a print-only dependency checker into an interactive
installer, and adds selectable themes to the statusline.

Depends on #23 (macOS support). This branch builds on it, so until #23
merges the diff here also shows that commit. Please merge #23 first.

Installer

install.sh now copies tokenline.sh into the Claude profile(s) you choose and
patches each settings.json with the same safety contract as the npm CLI:
backup, merge-only statusLine, idempotent, and never clobbering invalid JSON.

  • Discovers ~/.claude, any ~/.claude-*, and ./.claude. An arrow-key
    multi-select menu (↑/↓ move, space toggle, digits 1-9 quick-toggle, Enter
    confirm, q/Esc cancel) installs into one or several profiles at once; a typed
    fallback covers TERM=dumb.
  • Flags: --theme, --dir, --yes, --dry-run, --print, --force.
  • Minimal stepped UI with a TTY-only braille spinner; piped/non-interactive runs
    stay plain and default to ~/.claude.
  • Pure bash + ANSI (no stty), so it behaves the same on stock macOS bash 3.2
    and Linux. The 4+ check probes the PATH bash (what runs the statusline), not
    the interpreter, locale-independently via BASH_VERSINFO.

Themes

tokenline.sh gains --theme <name> (or TOKENLINE_THEME):

Theme Lines Shows
full 3 model · ctx · cache + economics + 5h/7d bars (default, unchanged)
minimal 1 model · ctx% · cache state
compact 1 model · ctx (tokens + %) · cache TTL · saving%
economics 2 first line + per-turn economics
limits 2 first line + 5h/7d bars

full emits no flag, keeping the command byte-identical to before. An unknown
name falls back to full, so a typo never blanks the statusline. The installer
asks for a theme before the profile, previewing each one in full with the live
statusline's colors and layout.

Testing

  • ShellCheck -s bash clean on install.sh and tokenline.sh (verified under
    both C and C.UTF-8).
  • pnpm lint, pnpm typecheck, pnpm build pass.
  • Settings patching: fresh create, idempotent re-run, merge that preserves other
    keys + backup, conflict refusal without --force, replace with --force,
    invalid-JSON refusal, and --dry-run no-op — all verified.
  • Interactive menus driven over a pty: arrow multi-select, typed fallback, theme
    single-select, and the full theme→profile flow writing the right --theme.
  • All five themes render identically on macOS (BSD) and Linux (Docker, GNU).
  • Runs on stock macOS bash 3.2.

José Fernando Gomes Marcial added 3 commits June 29, 2026 12:32
Abstract date/stat over GNU vs BSD by probing behavior once
(epoch_from_iso, file_mtime), so macOS works without coreutils. Pin
LC_ALL=C so comma-decimal locales (e.g. pt_BR) render identically to
the C-locale CI. install.sh accepts BSD date/stat; the npm CLI accepts
darwin as a supported platform.

Closes inbrace-tech#2
…atch)

Rework install.sh from a print-only dependency checker into an installer that
copies tokenline.sh into the chosen Claude profile(s) and patches each
settings.json with the npm CLI's safety contract: backup, merge-only statusLine,
idempotent, and never clobbering invalid JSON.

- Discovers ~/.claude, ~/.claude-*, and ./.claude. Arrow-key multi-select menu
  (up/down move, space toggle, digits 1-9 quick-toggle, Enter confirm, q/Esc
  cancel), with a typed-number fallback for TERM=dumb. Also --dir for a specific
  directory, --yes for non-interactive ~/.claude.
- Adds --dry-run, --print, --force; minimal stepped UI with a TTY-only braille
  spinner; piped/non-interactive runs stay plain and default to ~/.claude.
- Pure bash + ANSI (no stty), so the menu behaves the same on macOS bash 3.2 and
  Linux. Checks the PATH bash (not the interpreter) for the 4+ requirement,
  locale-independently via BASH_VERSINFO.
tokenline.sh gains --theme <name> (or TOKENLINE_THEME): full (default, the
original three-line render), minimal (model · ctx% · cache), compact (one dense
line with tokens + saving%), economics (model/ctx/cache + per-turn breakdown),
and limits (model/ctx/cache + 5h/7d bars). Unknown names fall back to full so a
typo never blanks the statusline; full emits no flag, keeping the command
byte-identical to before.

install.sh asks for a theme before the profile: a single-select arrow menu whose
preview renders each theme in full, with the live statusline's colors and
layout, so you see exactly what gets installed. The chosen --theme is baked into
the statusLine command; --theme <name> skips the prompt.
@xinnaider xinnaider requested a review from ropdias as a code owner June 29, 2026 21:51
@xinnaider

Copy link
Copy Markdown
Contributor Author

Suggested labels (can't self-apply from a fork): area:installer, area:statusline, feature, platform:macos, effort:M. Depends on #23.

@ropdias ropdias added area:statusline tokenline.sh render path (model/context/cache, economics, rate limits) area:installer install.sh + npm CLI (src/cli.ts), settings.json patching feature New feature or request platform:macos macOS support effort:M Multi-file change (~half day) labels Jun 30, 2026
@ropdias

ropdias commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

@xinnaider Thanks for the contribution!

This PR was based on the previous PR branch, which was squash merged into main, so GitHub is showing the previous changes again.

Could you please rebase this branch on the latest main and push the update to your fork?

After that, the PR diff should only show the changes from this branch.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:installer install.sh + npm CLI (src/cli.ts), settings.json patching area:statusline tokenline.sh render path (model/context/cache, economics, rate limits) effort:M Multi-file change (~half day) feature New feature or request platform:macos macOS support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants