From d9ad634d5ae555aa1546425351affb9f6451ed70 Mon Sep 17 00:00:00 2001 From: pi Date: Wed, 1 Jul 2026 23:20:49 +0200 Subject: [PATCH] feat: ship nano + micro (non-modal editors) alongside nvim The image shipped only nvim (EDITOR=nvim), a modal vi-style editor. Add both a classic and a modern non-modal option so users who aren't comfortable with vi keybindings have a choice: - nano (apt): ~2.8 MB installed; deps (libc6, libncursesw6, libtinfo6) already present via nvim/less/htop/tmux, so no extra packages pulled in. - micro: ~12 MB single static Go binary from GitHub releases (same pattern as bat/eza/zoxide). Desktop-style keys (Ctrl+S/Ctrl+Q), mouse, syntax highlighting. ARG MICRO_VERSION pins; defaults to latest. Combined ~15 MB (well within the smoke size threshold's ~250 MB headroom, so no threshold bump). EDITOR stays nvim; both editors are opt-in (export EDITOR=micro | nano). Uses the canonical micro-editor/micro URL because the old zyedidia/micro org rename makes /releases/latest redirect to another /latest, defeating the tag-parsing latest-resolution idiom (independently verified: old org 302s to micro-editor/micro; both arch tarballs HTTP 200; latest resolves to v2.0.15). Base-image change, so it lands on the next base- rebuild. Updates README (what's-inside tree + EDITOR note), CHANGELOG (Unreleased/Added), and smoke-test.sh (nano + micro presence checks). Ported from pi-devbox 3a59e15. --- CHANGELOG.md | 17 +++++++++++++++++ Dockerfile.base | 33 +++++++++++++++++++++++++++++++++ README.md | 7 ++++++- scripts/smoke-test.sh | 3 +++ 4 files changed, 59 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c35e286..23f4048 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,23 @@ Tags follow **independent semver** (since `v2.0.0`) — they version *this image now ignored across all repos in the container without per-repo `.gitignore` entries. The `core.excludesFile` wiring is skipped if the user already set one. +- **Non-modal editors `nano` + `micro` alongside `nvim`.** The image shipped + only nvim (`EDITOR=nvim`), a modal vi-style editor. Added both a classic and + a modern non-modal option for users who don't want vi keybindings: + - **nano** (apt): ~2.8 MB installed; its deps (libc6, libncursesw6, + libtinfo6) are already present via nvim/less/htop/tmux, so no extra + packages are pulled in. + - **micro**: ~12 MB single static Go binary from GitHub releases (same + pattern as bat/eza/zoxide). Desktop-style keys (Ctrl+S/Ctrl+Q), mouse, + syntax highlighting. `ARG MICRO_VERSION` pins; defaults to latest. + + Combined ~15 MB (<0.5% of the image). `EDITOR` stays `nvim`; both are opt-in + (`export EDITOR=micro | nano`). Uses the canonical `micro-editor/micro` URL + because the old `zyedidia/micro` org rename makes `/releases/latest` redirect + to another `/latest`, defeating the tag-parsing latest-resolution idiom. + Base-image change, so it lands on the next `base-` rebuild. Ported from + pi-devbox 3a59e15. + - **Workflow-lint guard (`.gitea/workflows/lint.yml` + `scripts/check-workflow-shell.sh`).** New cheap (~10s) lint workflow that runs on every push/PR (not just release tags): a Gitea-accurate shell guard plus pinned `actionlint` + `shellcheck`. diff --git a/Dockerfile.base b/Dockerfile.base index 85d235a..e2c6fd3 100644 --- a/Dockerfile.base +++ b/Dockerfile.base @@ -35,6 +35,11 @@ ENV DEBIAN_FRONTEND=noninteractive # apt-get upgrade picks up any security/CVE fixes published between # debian:trixie-slim base-image rebuilds. Paired with the index update # and the install in the same layer so we don't bloat image history. +# `nano` is included as a small, non-modal terminal editor for users who +# don't want vi-style modal editing — a companion to nvim and the `micro` +# binary installed further down. ~2.8 MB; its deps (libc6, libncursesw6, +# libtinfo6) are already pulled in by nvim/less/htop/tmux, so it adds no +# extra packages. EDITOR stays nvim; opt in via `export EDITOR=nano`. RUN apt-get update && \ apt-get upgrade -y --no-install-recommends && \ apt-get install -y --no-install-recommends \ @@ -66,6 +71,7 @@ RUN apt-get update && \ rsync \ python3-pip \ python3-venv \ + nano \ && ln -s /usr/bin/fdfind /usr/local/bin/fd \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* @@ -204,6 +210,33 @@ RUN ARCH=$(case "${TARGETARCH}" in amd64) echo "x86_64" ;; arm64) echo "arm64" ; ln -s /opt/nvim-linux-${ARCH}/bin/nvim /usr/local/bin/nvim && \ nvim --version | head -1 +# micro — modern, non-modal terminal editor. Ships alongside nvim so users +# who aren't comfortable with vi-style modal editing have a friendly option: +# desktop-style keybindings (Ctrl+S save, Ctrl+Q quit, Ctrl+C/V/X, Ctrl+Z +# undo), mouse support, and syntax highlighting out of the box. A single +# static Go binary (~12 MB) installed from GitHub releases, exactly like +# bat/eza/zoxide below. EDITOR stays nvim (see below); users opt in with +# `export EDITOR=micro` or `git config --global core.editor micro`. +# +# NOTE: upstream moved zyedidia/micro -> micro-editor/micro. The old org URL +# still 302s, but its /releases/latest redirect lands on ANOTHER /latest URL +# (the org rename), so the tag-parsing idiom below would resolve "latest" +# instead of a version. Use the canonical micro-editor/micro URL. +# Arch asset naming differs from the others: amd64 -> linux64, arm64 -> +# linux-arm64. The tarball extracts to micro-/micro. +ARG MICRO_VERSION=latest +RUN ARCH=$(case "${TARGETARCH}" in amd64) echo "linux64" ;; arm64) echo "linux-arm64" ;; *) echo "linux64" ;; esac) && \ + V="${MICRO_VERSION}" && \ + if [ "$V" = "latest" ]; then \ + V=$(curl -sI --retry 5 --retry-delay 5 --retry-all-errors "https://github.com/micro-editor/micro/releases/latest" | awk 'tolower($1)=="location:" { sub(/\r$/,"",$2); n=split($2,a,"/"); print a[n] }'); \ + fi && \ + V="${V#v}" && [ -n "$V" ] && \ + echo "Installing micro ${V}" && \ + curl -fsSL --retry 5 --retry-delay 5 --retry-all-errors "https://github.com/micro-editor/micro/releases/download/v${V}/micro-${V}-${ARCH}.tar.gz" | tar -xz -C /tmp && \ + install /tmp/micro-${V}/micro /usr/local/bin/micro && \ + rm -rf /tmp/micro-${V} && \ + micro --version + # bat — syntax-highlighted cat replacement ARG BAT_VERSION=latest RUN ARCH=$(case "${TARGETARCH}" in amd64) echo "x86_64" ;; arm64) echo "aarch64" ;; *) echo "x86_64" ;; esac) && \ diff --git a/README.md b/README.md index 06c35f5..3618ae7 100644 --- a/README.md +++ b/README.md @@ -263,6 +263,11 @@ volumes: - ~/.config/nvim:/home/developer/.config/nvim:ro ``` +> **Not a vi person?** The image also ships two non-modal editors alongside nvim: +> **nano** (classic, minimal) and **micro** (modern — desktop-style `Ctrl+S`/`Ctrl+Q` +> keys, mouse, syntax highlighting). `EDITOR` stays `nvim`; opt in per-shell with +> `export EDITOR=nano` (or `micro`), or for git with `git config --global core.editor micro`. + ### Python development with uv The image includes Python 3.13 (from Debian Trixie) and [uv](https://docs.astral.sh/uv/), a fast Python package manager that replaces pip, venv, and pyenv: @@ -807,7 +812,7 @@ Container (Debian trixie) ├── opencode binary ├── oh-my-opencode-slim (optional — multi-agent orchestration plugin, includes Bun) ├── AWS CLI v2 (SSO + Bedrock auth) -├── neovim 0.12, tmux, htop, bat, eza, zoxide, uv, rustup, make, gcc, g++, rsync +├── neovim 0.12, nano, micro, tmux, htop, bat, eza, zoxide, uv, rustup, make, gcc, g++, rsync ├── git, git-crypt, age, gitleaks, ssh, ripgrep, fd, fzf, jq, curl, tree ├── Node.js (for MCP servers) ├── Bun (optional — included with oh-my-opencode-slim) diff --git a/scripts/smoke-test.sh b/scripts/smoke-test.sh index c258000..41a6f7c 100755 --- a/scripts/smoke-test.sh +++ b/scripts/smoke-test.sh @@ -3,6 +3,7 @@ # # Verifies: # - Core binaries are on PATH and runnable +# - non-modal editors nano + micro are present (alongside nvim) # - opencode itself starts and prints a version # - Entrypoint runs cleanly as non-root after UID adjustment # - Generated opencode.json has the expected shape @@ -118,6 +119,8 @@ run "node" "node --version" run "npm" "npm --version" run "git" "git --version" run "nvim" "nvim --version | head -1" +run "nano" "nano --version | head -1" +run "micro" "micro --version" run "bat" "bat --version" run "eza" "eza --version | head -1" run "zoxide" "zoxide --version"