Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ scripted installs). Values use the same keys as `sqrbx-setup`:
|----------|---------|
| `SQUAREBOX_AI` | AI assistants (`claude,copilot,gemini,codex,opencode,pi,omp`) |
| `SQUAREBOX_SDKS` | language SDKs (`node,python,go,dotnet,rust`) |
| `SQUAREBOX_EDITORS` | editors (`micro,edit,fresh,helix,nvim`; Helix launches as `hx`) |
| `SQUAREBOX_EDITORS` | editors (`micro,edit,fresh,helix,nvim,ttt`; Helix launches as `hx`) |
| `SQUAREBOX_TUIS` | TUI tools (`lazygit,gh-dash,yazi,elio`) |
| `SQUAREBOX_MULTIPLEXERS` | multiplexers (`tmux,zellij,herdr`) |
| `SQUAREBOX_GIT_NAME` / `SQUAREBOX_GIT_EMAIL` | git identity (when no host gitconfig) |
Expand Down Expand Up @@ -294,6 +294,7 @@ installed editor instead.
|------|----------|-------------|
| [micro](https://github.com/micro-editor/micro) | Go | Modern, intuitive terminal editor |
| [edit](https://github.com/microsoft/edit) | Rust | Terminal text editor (Microsoft) |
| [ttt](https://github.com/eugenioenko/ttt) | Go | Terminal Text Tool |
| [fresh](https://github.com/sinelaw/fresh) | Rust | Modern terminal text editor |
| [helix](https://github.com/helix-editor/helix) | Rust | Modal editor (Kakoune-inspired) |
| [nvim](https://github.com/neovim/neovim) | C/Lua | Neovim |
Expand Down Expand Up @@ -612,7 +613,7 @@ container environment variables (set to an empty string to opt out of a tier):
|----------|---------|---------|
| `SQUAREBOX_DC_AI` | `claude` | AI assistants (`claude,copilot,gemini,codex,opencode,pi,omp`) |
| `SQUAREBOX_DC_SDKS` | `node` | SDKs (`node,python,go,dotnet,rust`) |
| `SQUAREBOX_DC_EDITORS` | _(none)_ | Editors (`micro,edit,fresh,helix,nvim`; Helix launches as `hx`) |
| `SQUAREBOX_DC_EDITORS` | _(none)_ | Editors (`micro,edit,fresh,helix,nvim,ttt`; Helix launches as `hx`) |
| `SQUAREBOX_DC_TUIS` | _(none)_ | TUI tools (`lazygit,gh-dash,yazi,elio`) |
| `SQUAREBOX_DC_MULTIPLEXERS` | _(none)_ | Multiplexers (`tmux,zellij,herdr`) |

Expand Down
3 changes: 2 additions & 1 deletion scripts/e2e-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ suite_setup_editors() {
# Pre-seed selections in /workspace/.squarebox/
mkdir -p /workspace/.squarebox
echo "opencode,pi" > /workspace/.squarebox/ai-tool
echo "micro,edit,fresh,helix,nvim" > /workspace/.squarebox/editors
echo "micro,edit,fresh,helix,nvim,ttt" > /workspace/.squarebox/editors
echo "lazygit,gh-dash,yazi,elio" > /workspace/.squarebox/tuis
echo "tmux,zellij,herdr" > /workspace/.squarebox/multiplexer
echo "node,go" > /workspace/.squarebox/sdks
Expand Down Expand Up @@ -262,6 +262,7 @@ suite_setup_editors() {
run_test "3.7a2 pi installed" command -v pi
run_test "3.7b micro installed" command -v micro
run_test "3.7c edit installed" command -v edit
run_test "3.7g ttt installed" command -v ttt
run_test "3.7d fresh installed" command -v fresh
run_test "3.7e helix installed as hx" command -v hx
run_test "3.7f nvim installed" command -v nvim
Expand Down
10 changes: 10 additions & 0 deletions scripts/lib/tools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,16 @@ tools:
group: setup
verification: github-release-digest

ttt:
repo: eugenioenko/ttt
version_prefix: v
artifact: ttt-linux-{goarch}
method: binary
binaries: ttt
dest: user
group: setup
verification: github-release-digest

helix:
repo: helix-editor/helix
version_prefix: ""
Expand Down
2 changes: 1 addition & 1 deletion scripts/squarebox-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ usage() {
git Git identity (name, email)
github GitHub CLI authentication
ai AI coding assistants (claude, copilot, gemini, codex, opencode, pi, omp)
editors Text editors (micro, edit, fresh, helix/hx, nvim)
editors Text editors (micro, edit, fresh, helix/hx, nvim, ttt)
tuis TUI tools (lazygit, gh-dash, yazi, elio)
multiplexers Terminal multiplexers (tmux, zellij, herdr)
sdks SDKs (node, python, go, dotnet, rust)
Expand Down
1 change: 1 addition & 0 deletions scripts/squarebox-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ starship_current() { starship --version 2>/dev/null | _extract_first_version; }
ghdash_current() { gh-dash --version 2>/dev/null | _extract_first_version; }
glow_current() { glow --version 2>/dev/null | _extract_first_version; }
micro_current() { micro --version 2>/dev/null | _extract_first_version; }
ttt_current() { ttt --version 2>/dev/null | _extract_first_version; }
fresh_current() { fresh --version 2>/dev/null | _extract_first_version; }
edit_current() { edit --version 2>/dev/null | _extract_first_version; }
helix_current() { hx --version 2>/dev/null | _extract_first_version; }
Expand Down
22 changes: 17 additions & 5 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ fi
if [ -f "$EDITOR_DEFAULT_CONFIG" ]; then
editor_default_prev=$(cat "$EDITOR_DEFAULT_CONFIG")
case "$editor_default_prev" in
nano|micro|edit|fresh|hx|nvim) ;;
nano|micro|edit|fresh|hx|nvim|ttt) ;;
*) echo "Warning: ignoring invalid saved default editor '$editor_default_prev'." >&2; editor_default_prev="" ;;
esac
fi
Expand All @@ -858,14 +858,15 @@ if $INTERACTIVE; then
edit) gum_selected="${gum_selected:+$gum_selected,}edit" ;;
fresh) gum_selected="${gum_selected:+$gum_selected,}fresh" ;;
helix) gum_selected="${gum_selected:+$gum_selected,}helix" ;;
ttt) gum_selected="${gum_selected:+$gum_selected,}ttt" ;;
nvim) gum_selected="${gum_selected:+$gum_selected,}nvim" ;;
esac
done
echo "Nano is always available and remains the fallback default unless you choose an installed editor instead."
gum_args=(--no-limit --header "Select text editors to install:")
[ -n "$gum_selected" ] && gum_args+=(--selected "$gum_selected")
if ! selected=$(gum choose "${gum_args[@]}" \
"micro" "edit" "fresh" "helix" "nvim"); then
"micro" "edit" "fresh" "helix" "nvim" "ttt"); then
cancel_setup
fi
editor_list=""
Expand All @@ -876,13 +877,14 @@ if $INTERACTIVE; then
else
echo "Select text editors to install (comma-separated, or 'all', or press Enter to skip):"
echo " Nano is always available and remains the fallback default unless you choose an installed editor instead."
for ed_item in "1:micro:micro" "2:edit:edit" "3:fresh:fresh" "4:helix:helix (hx)" "5:nvim:nvim"; do
for ed_item in "1:micro:micro" "2:edit:edit" "3:fresh:fresh" "4:helix:helix (hx)" "5:nvim:nvim" "6:ttt:ttt"; do
num="${ed_item%%:*}"; rest="${ed_item#*:}"; key="${rest%%:*}"; label="${rest#*:}"
case "$key" in
micro) desc="modern, intuitive terminal editor" ;;
edit) desc="terminal text editor (Microsoft)" ;;
fresh) desc="modern terminal text editor" ;;
helix) desc="modal editor (Kakoune-inspired)" ;;
ttt) desc="Terminal Text Tool" ;;
nvim) desc="Neovim" ;;
esac
if [[ ",$editor_prev," == *",${key},"* ]]; then
Expand All @@ -891,20 +893,21 @@ if $INTERACTIVE; then
echo " ${num}) ${label} — ${desc}"
fi
done
read -rp "Selection [1,2,3,4,5/all/skip]: " editor_selection
read -rp "Selection [1,2,3,4,5,6/all/skip]: " editor_selection
if [ -z "$editor_selection" ] && [ -n "$editor_prev" ]; then
editor_list="$editor_prev"
else
editor_list=""
if [ "$editor_selection" = "all" ]; then
editor_list="micro,edit,fresh,helix,nvim"
editor_list="micro,edit,fresh,helix,nvim,ttt"
elif [ -n "$editor_selection" ]; then
for item in $(echo "$editor_selection" | tr ',' ' '); do
case "$item" in
1) editor_list="${editor_list:+$editor_list,}micro" ;;
2) editor_list="${editor_list:+$editor_list,}edit" ;;
3) editor_list="${editor_list:+$editor_list,}fresh" ;;
4) editor_list="${editor_list:+$editor_list,}helix" ;;
6) editor_list="${editor_list:+$editor_list,}ttt" ;;
5) editor_list="${editor_list:+$editor_list,}nvim" ;;
esac
done
Expand Down Expand Up @@ -975,6 +978,12 @@ install_fresh() {
command -v fresh >/dev/null 2>&1
}

install_ttt() {
if command -v ttt &>/dev/null; then echo "TTT already installed, skipping."; return 0; fi
run_with_spinner "Installing TTT..." sb_install ttt latest || return 1
command -v ttt >/dev/null 2>&1
}

install_helix() {
if command -v hx &>/dev/null && [ -d "$HOME/.config/helix/runtime" ]; then
echo "Helix already installed, skipping."
Expand Down Expand Up @@ -1082,6 +1091,9 @@ for editor in $(echo "$editor_list" | tr ',' ' '); do
fresh)
if install_fresh; then installed_editors+=("fresh"); committed_editors+=("fresh")
else record_failure "Fresh installation failed; new Selection was not committed"; [[ ",$editor_prev," == *",fresh,"* ]] && committed_editors+=("fresh"); fi ;;
ttt)
if install_ttt; then installed_editors+=("ttt"); committed_editors+=("ttt")
else record_failure "TTT installation failed; new Selection was not committed"; [[ ",$editor_prev," == *",ttt,"* ]] && committed_editors+=("ttt"); fi ;;
helix)
if install_helix; then installed_editors+=("hx"); committed_editors+=("helix")
else record_failure "Helix installation failed; new Selection was not committed"; [[ ",$editor_prev," == *",helix,"* ]] && committed_editors+=("helix"); fi ;;
Expand Down
4 changes: 2 additions & 2 deletions tests/test-provision-install-failures.sh
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,10 @@ assert_true "grep -qx 'herdr latest' '$HERDR_CASE/sb-install.calls'" \
# Audit every adjacent setup-tier sb_install caller, not just the two callers
# that originally had a successful config write after the failed install.
EDITORS_CASE="$TMP/editors"
run_selected_section editors $'micro\nedit\nfresh\nhelix\nnvim' "$EDITORS_CASE"
run_selected_section editors $'micro\nedit\nfresh\nhelix\nnvim\nttt' "$EDITORS_CASE"
assert_true "[ \"\$(cat '$EDITORS_CASE/setup.rc')\" -ne 0 ] && [ -z \"\$(cat '$EDITORS_CASE/state/editors')\" ]" \
"all editor sb_install failures propagate without committing Selections"
for editor in micro edit fresh helix nvim; do
for editor in micro edit fresh helix nvim ttt; do
assert_true "grep -qx '$editor latest' '$EDITORS_CASE/sb-install.calls'" \
"$editor failure audit exercises its sb_install caller"
done
Expand Down
10 changes: 10 additions & 0 deletions tests/test-provision-state.sh
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,16 @@ assert_true "grep -qx 'set -g mouse on' '$HOME_DIR/.config/tmux/tmux.conf'" "rec
assert_true "[ \"\$(cat '$STATE/multiplexer')\" = tmux ]" "successful reconciliation preserves the saved Selection"
assert_true "[ \"\$(cat '$STATE/editor-default')\" = fresh ] && grep -qx \"export EDITOR='fresh'\" '$HOME_DIR/.squarebox-editor-aliases'" "reconcile preserves a non-first default editor Selection"

# TTT is a valid saved default and remains selected during reconciliation.
printf '#!/usr/bin/env bash\nexit 0\n' > "$BIN/ttt"
chmod +x "$BIN/ttt"
printf 'micro,ttt\n' > "$STATE/editors"
printf 'ttt\n' > "$STATE/editor-default"
HOME="$HOME_DIR" SQUAREBOX_STATE_DIR="$STATE" \
SQUAREBOX_TOOL_LIB="$FIXTURE_LIB" SQUAREBOX_TOOLS_YAML=/dev/null \
PATH="$BIN:$PATH" bash "$ROOT/setup.sh" --reconcile-box >"$TMP/ttt-reconcile.out" 2>"$TMP/ttt-reconcile.err"
assert_true "grep -qx 'micro,ttt' '$STATE/editors' && grep -qx ttt '$STATE/editor-default' && grep -qx \"export EDITOR='ttt'\" '$HOME_DIR/.squarebox-editor-aliases'" "reconcile preserves TTT Selection and default editor"

for ai_binary in copilot gemini codex pi omp; do
printf '#!/usr/bin/env bash\nexit 0\n' > "$BIN/$ai_binary"
done
Expand Down
Loading