---
name: statusline
description: Use when installing or uninstalling Groundwork's optional statusline configuration
argument-hint: "[install|uninstall]"
disable-model-invocation: true
---

# Groundwork Statusline

Configure Groundwork's optional statusline only after the user explicitly invokes this workflow.

Use the supplied action, `install` or `uninstall`. When no action is supplied, default to `install`. Reject any other action and show `/groundwork:statusline [install|uninstall]`.

## Install

The renderer asset is `${CLAUDE_PLUGIN_ROOT}/statusline-command.sh`. Claude Code does not expand `${CLAUDE_PLUGIN_ROOT}` inside a user `statusLine` command, and marketplace installs are versioned. Install a stable wrapper at `$HOME/.claude/groundwork-statusline.sh` so future plugin upgrades use the newest installed Groundwork plugin version.

1. Resolve the absolute home directory and the current plugin versions directory:

   ```bash
   HOME_DIR="$HOME"
   VERSIONS_DIR="$(dirname "$CLAUDE_PLUGIN_ROOT")"
   ```

2. Read `$HOME/.claude/settings.json`, treating a missing file as `{}`. Inspect its `statusLine` value.
   - If it already invokes `$HOME/.claude/groundwork-statusline.sh`, Groundwork owns it; continue so the wrapper is refreshed.
   - If a different `statusLine` exists, ask the user before replacing it. Stop without modifying settings or the wrapper when they decline.

3. Write this executable wrapper, substituting the resolved absolute `<VERSIONS_DIR>`:

   ```bash
   #!/usr/bin/env bash
   # Auto-generated by /groundwork:statusline.
   base="<VERSIONS_DIR>"
   latest=$(ls -1 "$base" 2>/dev/null | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -t. -k1,1n -k2,2n -k3,3n | tail -1)
   script="$base/$latest/statusline-command.sh"
   [ -n "$latest" ] && [ -f "$script" ] && exec bash "$script"
   ```

   Then run `chmod +x "$HOME/.claude/groundwork-statusline.sh"`.

4. Add or replace only `statusLine` in `$HOME/.claude/settings.json`, preserving all unrelated settings. Substitute the resolved absolute `<HOME_DIR>`; do not use `~`:

   ```json
   "statusLine": {
     "type": "command",
     "command": "bash <HOME_DIR>/.claude/groundwork-statusline.sh",
     "height": 3
   }
   ```

5. Report that installation is complete and Claude Code must be restarted to display it.

## Uninstall

1. Read `$HOME/.claude/settings.json`. If no `statusLine` exists, report that nothing is configured and stop.
2. Groundwork owns the setting only when its command invokes `$HOME/.claude/groundwork-statusline.sh`.
3. If another command is configured, leave both it and the wrapper untouched and report that Groundwork does not own the active statusline.
4. For an owned setting, remove only the `statusLine` key while preserving all unrelated settings. Then remove the wrapper. In other words, remove the wrapper only when Groundwork owns the configured statusLine.
5. Report that removal is complete and Claude Code must be restarted to apply it.
