Skip to content

Commit cfceb01

Browse files
committed
Add claude, codex, and agy shortcuts back to our container
1 parent fd465e6 commit cfceb01

5 files changed

Lines changed: 65 additions & 24 deletions

File tree

dot_files/nvim/Containerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Codex, Antigravity, GitHub CLI). Agents are launched from inside nvim.
66
#
77
# Build: podman build -t nvim-dev .
8-
# Run: podman run --rm -it nvim-dev (see scripts/nvim.sh for mounts)
8+
# Run: podman run --rm -it nvim-dev (see scripts/sandbox.sh for mounts)
99

1010
FROM registry.fedoraproject.org/fedora-toolbox:44
1111

dot_files/nvim/Justfile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,17 @@ push:
3434
# Usage (against the LOCAL image)
3535
# =============================================================================
3636

37-
# Launch the sandbox from the local image, using a throwaway test volume
37+
# Launch the sandbox (nvim) from the local image, using a throwaway test volume
3838
run *args:
39-
HYPERCUBE_NVIM_IMAGE={{local_image}} HYPERCUBE_NVIM_VOLUME={{test_volume}} ./scripts/nvim.sh {{args}}
39+
HYPERCUBE_NVIM_IMAGE={{local_image}} HYPERCUBE_NVIM_VOLUME={{test_volume}} ./scripts/sandbox.sh {{args}}
40+
41+
# Launch an agent directly (e.g. `just run-agent claude`) from the local image
42+
run-agent agent *args:
43+
#!/usr/bin/bash
44+
set -euo pipefail
45+
link="$(mktemp -d)/{{agent}}"
46+
ln -s "$(pwd)/scripts/sandbox.sh" "$link"
47+
HYPERCUBE_NVIM_IMAGE={{local_image}} HYPERCUBE_NVIM_VOLUME={{test_volume}} "$link" {{args}}
4048

4149
# Open a shell in the local image
4250
shell:

dot_files/nvim/README.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
A self-contained, **portable** Neovim environment: [LazyVim](https://github.com/LazyVim/LazyVim)
44
plus the full dev toolchain (LSPs/formatters/linters) **and** AI coding agents,
5-
all baked into one podman image. Launch the agents from inside nvim.
5+
all baked into one podman image. Launch the agents from inside nvim — or run
6+
`claude` / `codex` / `agy` directly when you just want the agent.
67

78
Runs identically on the Hypercube Linux desktop, a remote box, and macOS — no
89
distrobox required.
@@ -24,8 +25,12 @@ distrobox required.
2425

2526
## How it works
2627

27-
`scripts/nvim.sh` runs the image as an ephemeral `podman` container and mounts
28-
only what's needed:
28+
`scripts/sandbox.sh` runs the image as an ephemeral `podman` container and
29+
mounts only what's needed. It dispatches on the name it's invoked as: installed
30+
as `nvim` it launches the editor, and it's symlinked to `claude`, `codex`, and
31+
`agy` so those run the matching agent directly in the same container. All share
32+
the home volume below, so an AI login from any one entry point works in all of
33+
them. The mounts:
2934

3035
| Mounted in | Purpose |
3136
|---|---|
@@ -46,14 +51,15 @@ Clipboard uses **OSC 52** through the terminal, so yank/paste works locally
4651
## Setup (Hypercube)
4752

4853
```bash
49-
ujust nvim-setup # pull image + install the 'nvim' wrapper to ~/.local/bin
50-
nvim file.rs # launch
54+
ujust nvim-setup # pull image + install the nvim + agent wrappers to ~/.local/bin
55+
nvim file.rs # launch the editor
56+
claude # ...or run an agent directly (also: codex, agy)
5157
```
5258

5359
| Command | Description |
5460
|---------|-------------|
55-
| `ujust nvim-setup` | pull image + install the `nvim` wrapper |
56-
| `ujust nvim-upgrade` | pull the latest image + refresh the wrapper |
61+
| `ujust nvim-setup` | pull image + install the `nvim`, `claude`, `codex`, `agy` wrappers |
62+
| `ujust nvim-upgrade` | pull the latest image + refresh the wrappers |
5763
| `ujust nvim-reset` | drop the home volume to re-seed (clears plugin state + AI logins) |
5864
| `ujust nvim-shell` | debug shell inside a throwaway sandbox container |
5965

@@ -63,7 +69,9 @@ No `ujust` needed — install the wrapper by hand:
6369

6470
```bash
6571
podman pull ghcr.io/binarypie-dev/nvim-dev:latest
66-
install -m 0755 dot_files/nvim/scripts/nvim.sh ~/.local/bin/nvim
72+
install -m 0755 dot_files/nvim/scripts/sandbox.sh ~/.local/bin/nvim
73+
# Symlink the agent wrappers (the script dispatches on its invoked name):
74+
for agent in claude codex agy; do ln -sf nvim ~/.local/bin/$agent; done
6775
nvim
6876
```
6977

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,33 @@
11
#!/usr/bin/env bash
2-
# Hypercube AI-first Neovim sandbox launcher.
2+
# Hypercube AI-first sandbox launcher.
33
#
4-
# Runs the baked LazyVim + AI-agent image in an ephemeral podman container,
5-
# mounting only the current project, your personal overrides, and a few host
6-
# facts (git identity, SSH agent, terminal). Portable across Linux and macOS.
4+
# One podman image bakes Neovim (LazyVim) + the AI coding agents + the dev
5+
# toolchain. This single wrapper is installed under several names; the name it
6+
# is invoked as selects what runs inside the (otherwise identical) container:
7+
#
8+
# nvim -> the editor (launch agents from inside it) -- the default
9+
# claude -> Claude Code CLI, run directly
10+
# codex -> OpenAI Codex CLI, run directly
11+
# agy -> Antigravity CLI, run directly
712
#
8-
# Launch AI agents (Claude, Codex, ...) from inside nvim -- there is no separate
9-
# claude/codex wrapper by design.
13+
# All four share the same home volume, so AI-CLI logins persist across them --
14+
# log in once (from nvim or any agent wrapper) and every entry point is authed.
15+
#
16+
# Mounts only the current project, your personal overrides, and a few host
17+
# facts (git identity, SSH agent, terminal). Portable across Linux and macOS.
1018
#
1119
# Env overrides:
1220
# HYPERCUBE_NVIM_IMAGE container image (default ghcr.io/binarypie-dev/nvim-dev:latest)
1321
# HYPERCUBE_NVIM_VOLUME named volume holding state + AI auth (default hypercube-nvim-home)
1422
set -euo pipefail
1523

24+
# What to run is chosen by the name we were invoked as (symlinks point here).
25+
CMD="$(basename "$0")"
26+
case "$CMD" in
27+
nvim | claude | codex | agy) ;;
28+
*) CMD=nvim ;;
29+
esac
30+
1631
IMAGE="${HYPERCUBE_NVIM_IMAGE:-ghcr.io/binarypie-dev/nvim-dev:latest}"
1732
VOLUME="${HYPERCUBE_NVIM_VOLUME:-hypercube-nvim-home}"
1833
OVERRIDE_DIR="$HOME/.config/hypercube/nvim"
@@ -28,7 +43,7 @@ args=(
2843
run --rm --interactive --tty --init
2944
--user 0:0
3045
--security-opt label=disable
31-
--hostname nvim
46+
--hostname "$CMD"
3247
-e HYPERCUBE_NVIM=1
3348
-e TERM
3449
-e COLORTERM
@@ -55,4 +70,4 @@ if [ "$(uname -s)" = "Linux" ] && [ -n "${SSH_AUTH_SOCK:-}" ] && [ -S "${SSH_AUT
5570
args+=(-v "${SSH_AUTH_SOCK}:${SSH_AUTH_SOCK}:rw" -e "SSH_AUTH_SOCK=${SSH_AUTH_SOCK}")
5671
fi
5772

58-
exec podman "${args[@]}" "$IMAGE" nvim "$@"
73+
exec podman "${args[@]}" "$IMAGE" "$CMD" "$@"

system_files/shared/usr/share/ublue-os/just/61-nvim.just

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
# Hypercube AI-first Neovim sandbox commands
33
#
44
# The editor and AI agents (Claude Code, Codex, Antigravity, gh) ship as a
5-
# single portable podman image. A thin wrapper at ~/.local/bin/nvim runs it.
5+
# single portable podman image. A thin wrapper at ~/.local/bin/nvim runs it;
6+
# the same wrapper is symlinked to claude/codex/agy so you can launch an agent
7+
# directly (they share the image's home volume, so logins are shared too).
68
# Personal plugin overrides live in ~/.config/hypercube/nvim/lua/plugins/.
79

810
image := "ghcr.io/binarypie-dev/nvim-dev:latest"
9-
wrapper := "/usr/share/hypercube/config/nvim/scripts/nvim.sh"
11+
wrapper := "/usr/share/hypercube/config/nvim/scripts/sandbox.sh"
1012
volume := "hypercube-nvim-home"
1113

12-
# Pull the image and install the nvim wrapper to ~/.local/bin
14+
# Pull the image and install the nvim + agent wrappers to ~/.local/bin
1315
nvim-setup:
1416
#!/usr/bin/bash
1517
set -euo pipefail
@@ -20,19 +22,27 @@ nvim-setup:
2022

2123
mkdir -p "$HOME/.local/bin" "$HOME/.config/hypercube/nvim/lua/plugins"
2224
install -m 0755 {{wrapper}} "$HOME/.local/bin/nvim"
25+
# The wrapper dispatches on the name it's invoked as; symlink the agents to it.
26+
for agent in claude codex agy; do
27+
ln -sf nvim "$HOME/.local/bin/$agent"
28+
done
2329

2430
echo ""
25-
echo "Setup complete! Run 'nvim' to launch the AI-first editor."
31+
echo "Setup complete! Run 'nvim' to launch the AI-first editor,"
32+
echo "or 'claude' / 'codex' / 'agy' to run an agent directly."
2633
echo "Personal overrides go in: ~/.config/hypercube/nvim/lua/plugins/"
2734

28-
# Pull the latest image and refresh the wrapper
35+
# Pull the latest image and refresh the wrappers
2936
nvim-upgrade:
3037
#!/usr/bin/bash
3138
set -euo pipefail
3239

3340
echo "Pulling latest Neovim sandbox image..."
3441
podman pull {{image}}
3542
install -m 0755 {{wrapper}} "$HOME/.local/bin/nvim"
43+
for agent in claude codex agy; do
44+
ln -sf nvim "$HOME/.local/bin/$agent"
45+
done
3646

3747
echo "Done!"
3848
echo "Tip: run ':Lazy update' inside nvim to update plugins, or"

0 commit comments

Comments
 (0)