Metadata-Version: 2.4
Name: yacc-statusline-editor
Version: 0.1.0
Summary: Yet Another Claude Code statusline editor — interactive TUI for composing the Claude Code statusline.
Project-URL: Homepage, https://github.com/barvhaim/claude-code-statusline-editor
Project-URL: Repository, https://github.com/barvhaim/claude-code-statusline-editor
Project-URL: Issues, https://github.com/barvhaim/claude-code-statusline-editor/issues
Author: Bar Haim
License-Expression: MIT
License-File: LICENSE
Keywords: claude,claude-code,cli,statusline,textual,tui
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development
Classifier: Topic :: Terminals
Classifier: Topic :: Utilities
Requires-Python: >=3.11
Requires-Dist: textual>=0.70
Description-Content-Type: text/markdown

# yacc-statusline-editor

**Yet Another Claude Code statusline editor.** Interactive Textual TUI for composing a Claude Code statusline by picking, ordering, and configuring pre-built segments. It outputs a Bash script (using `jq`) and merges a `statusLine` block into your chosen scope's `settings.json`.

## Requirements

- Python ≥ 3.11
- `jq` on `PATH` (the editor still launches without it, but the test-run modal is disabled)

## Install

Recommended — install as an isolated tool:

```bash
# with uv
uv tool install yacc-statusline-editor

# or with pipx
pipx install yacc-statusline-editor
```

Then launch:

```bash
statusline-editor
```

### From source (development)

```bash
uv sync
uv run statusline-editor
# equivalent
uv run python -m statusline_editor
```

## What it does

- Pick segments from a registry, reorder them, configure each with typed options (color, bool, int, string, enum, threshold), and split rows with a `newline` segment.
- Live in-process preview against mock JSON fixtures (FULL / MINIMAL / NULLED) so you see exactly what the statusline will render.
- On save: writes `statusline.sh` (Bash + `jq`) and merges a `statusLine` block into `settings.json` for the chosen scope. Existing `settings.json` is backed up to `settings.json.bak`; the write is atomic. Unrelated keys (`hooks`, `env`, `permissions`, …) are preserved in original order.
- Sidecar `statusline.config.json` is the source of truth — reopening the editor reads the sidecar, never re-parses the generated Bash.
- Hand-edit detection: if `statusline.sh` exists without the editor's marker, you'll get a warning before overwrite.

## Scope

- **User scope:** `~/.claude/`
- **Project scope:** `<cwd>/.claude/`

You pick the scope at save time. On load, project beats user when both have a sidecar.

## Built-in segments

`model`, `directory`, `git`, `context_bar`, `context_pct`, `context_tokens`, `cost`, `duration`, `lines_changed`, `rate_5h`, `rate_7d`, `pr`, `effort`, `output_style`, `session_name`, `worktree`, `vim_mode`, `custom_text`, `newline`.

## Adding a new segment

1. Create `src/statusline_editor/segments/<id>.py` with a class implementing `id`, `label`, `default_options`, `options_schema`, `render`, `to_bash`.
2. Add one entry to `SEGMENT_REGISTRY` in `segments/__init__.py`.

The edit panel renders itself from `options_schema` — no UI code needed. Every segment is automatically opted into a parameterized matrix test that asserts `render` (Python) and `to_bash` (Bash) produce byte-identical output (modulo ANSI) across the three fixtures.

## Tests

```bash
uv run pytest
uv run pytest -k duplicate
uv run pytest tests/test_composition_refresh.py::test_refresh_after_initial_load_keeps_unique_ids
```

## Project layout

```
src/statusline_editor/
├── app.py          # Textual App + modals (only impure layer)
├── config.py       # Composition / SegmentInstance + atomic_write + scope resolution
├── generator.py    # Composition → statusline.sh
├── settings.py     # Merge statusLine into settings.json (atomic, backed up)
├── preview.py      # In-process live render + subprocess test-run
├── fixtures.py     # FULL / MINIMAL / NULLED mock JSON
└── segments/       # Segment registry — one file per id
```

See `CLAUDE.md` for architecture notes and `docs/superpowers/specs/2026-06-03-statusline-editor-design.md` for the full design spec.
