Persist bash history and bake shell quality-of-life defaults
Two changes that address a longstanding frustration: bash history is lost on every container recreate, and the container's ~/.bashrc and ~/.inputrc are stock Debian (no history tuning, no prefix search on arrow keys, no integrations). Added a named volume 'devbox-shell-history' mounted at ~/.cache/bash with HISTFILE pointing there; history now survives 'docker compose up --force-recreate'. The volume is added to both docker-compose.yml and docker-compose.shared.yml, and ~/.cache/bash is registered in the entrypoint ownership-fix loop per the AGENTS.md convention. Baked rootfs/home/developer/.bash_aliases (sourced automatically by Debian's default ~/.bashrc) and rootfs/home/developer/.inputrc into the image. They give new containers: 100k-entry timestamped dedup history with per-prompt flush, Up/Down arrow prefix history search, case-insensitive coloured completion, aliases that prefer eza and bat when present, git shortcuts, interactive rm/mv/cp, zoxide and fzf (via 'fzf --bash') integration, and a [devbox] prompt marker. The fzf integration uses 'fzf --bash' because we install fzf from GitHub releases, not apt — the apt-path key-bindings aren't present. Users who prefer their host's own shell config can uncomment two commented bind-mount lines in docker-compose.yml to shadow the baked defaults.
This commit is contained in:
@@ -438,6 +438,24 @@ The `--use-device-code` flag outputs a URL and short code instead of trying to o
|
||||
|
||||
SSO sessions typically last 8–12 hours before requiring re-authentication. Since `~/.aws` is mounted from the host, tokens persist across container restarts.
|
||||
|
||||
## Shell defaults
|
||||
|
||||
The image ships a baked `~/.bash_aliases` and `~/.inputrc` with quality-of-life defaults:
|
||||
|
||||
- **Prefix history search** on Up/Down arrows (type `git `, press Up, walk back through prior `git ...` commands only). Ctrl-Up / Ctrl-Down still step through full history.
|
||||
- **Persistent history** — `$HISTFILE` points at `~/.cache/bash/history`, backed by the `devbox-shell-history` named volume so history survives container recreation. Timestamps, 100 000 entries, dedup.
|
||||
- **Case-insensitive tab completion**, coloured completion lists, `show-all-if-ambiguous`.
|
||||
- **Aliases** — `ls`/`ll`/`la` use `eza`, `cat` uses `bat`, `gs`/`gd`/`gl` for git, safe `rm`/`mv`/`cp`.
|
||||
- **Integrations** — `zoxide` (`z <fragment>` to jump), `fzf` Ctrl-R / Ctrl-T key bindings.
|
||||
- **Prompt marker** — `[devbox]` prefix so it's always obvious you're inside the container.
|
||||
|
||||
To override with your own host config, uncomment the bind-mount lines in `docker-compose.yml`:
|
||||
|
||||
```yaml
|
||||
- ~/.bash_aliases:/home/developer/.bash_aliases:ro
|
||||
- ~/.inputrc:/home/developer/.inputrc:ro
|
||||
```
|
||||
|
||||
## Secret Scanning
|
||||
|
||||
A [gitleaks](https://github.com/gitleaks/gitleaks) pre-commit hook prevents accidentally committing API keys, passwords, or other secrets.
|
||||
@@ -496,6 +514,7 @@ Container (Debian trixie)
|
||||
| `/home/developer/.aws` | Host bind mount (if configured) | ✅ Yes | AWS credentials/SSO cache |
|
||||
| `/home/developer/.local/share/opencode` | Named volume `devbox-data` | ✅ Yes | Session history, memory |
|
||||
| `/home/developer/.local/state/opencode` | Named volume `devbox-state` | ✅ Yes | TUI settings (theme, toggles) |
|
||||
| `/home/developer/.cache/bash` | Named volume `devbox-shell-history` | ✅ Yes | Bash history (`$HISTFILE`), survives container recreate |
|
||||
| `/home/developer/.local/share/uv` | Named volume `devbox-uv` (if configured) | ✅ Yes | Python installs, uv tool installs |
|
||||
| `/home/developer/.rustup` | Named volume `devbox-rustup` (if configured) | ✅ Yes | Rust toolchains |
|
||||
| `/home/developer/.cargo` | Named volume `devbox-cargo` (if configured) | ✅ Yes | Cargo binaries, registry cache |
|
||||
|
||||
Reference in New Issue
Block a user