Skip to content

Commit 89d523a

Browse files
committed
fix: UTF-8 support in container vim and auto-configure origin/HEAD
- Set LANG=C.UTF-8 and LC_ALL=C.UTF-8 in Dockerfile - Add .vimrc with UTF-8 encoding settings - Auto-configure origin/HEAD during init project for worktree support
1 parent bff10c4 commit 89d523a

File tree

3 files changed

+43
-2
lines changed

3 files changed

+43
-2
lines changed

src/ai_sbx/commands/init.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,32 @@ def init_project(
659659
except Exception:
660660
pass
661661

662+
# Set up origin/HEAD if not configured (needed for worktrees to know default branch)
663+
try:
664+
# Check if origin/HEAD exists
665+
result = subprocess.run(
666+
["git", "symbolic-ref", "refs/remotes/origin/HEAD"],
667+
cwd=project_path,
668+
capture_output=True,
669+
text=True,
670+
check=False,
671+
)
672+
if result.returncode != 0:
673+
# origin/HEAD not set, configure it automatically
674+
set_head_result = subprocess.run(
675+
["git", "remote", "set-head", "origin", "--auto"],
676+
cwd=project_path,
677+
capture_output=True,
678+
text=True,
679+
check=False,
680+
)
681+
if set_head_result.returncode == 0:
682+
console.print("[green]✓[/green] Configured origin/HEAD for worktree support")
683+
elif verbose:
684+
console.print("[dim]Could not auto-configure origin/HEAD (no remote?)[/dim]")
685+
except Exception:
686+
pass
687+
662688
# Create or update project config
663689
if existing_config:
664690
config = existing_config

src/ai_sbx/dockerfiles/devcontainer-base/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ RUN set -eux; \
5656
if getent group docker >/dev/null; then usermod -aG docker "$USERNAME"; fi
5757

5858

59-
# Generate locale
60-
RUN locale-gen en_US.UTF-8
59+
# Set UTF-8 environment (C.UTF-8 is available by default in Debian)
60+
ENV LANG=C.UTF-8
61+
ENV LC_ALL=C.UTF-8
6162

6263
RUN mkdir -p /usr/local/share/npm-global && \
6364
chown -R $USERNAME:$USERNAME /usr/local/share
@@ -221,6 +222,7 @@ COPY --chown=$USERNAME:$USERNAME devcontainer-base/claude-defaults /home/$USERNA
221222
# Copy configuration files
222223
COPY --chown=$USERNAME:$USERNAME devcontainer-base/conf/.zshrc /home/$USERNAME/.zshrc
223224
COPY --chown=$USERNAME:$USERNAME devcontainer-base/conf/.tmux.conf /home/$USERNAME/.tmux.conf
225+
COPY --chown=$USERNAME:$USERNAME devcontainer-base/conf/.vimrc /home/$USERNAME/.vimrc
224226
COPY --chown=$USERNAME:$USERNAME devcontainer-base/conf/codex_config.toml /home/$USERNAME/.codex/config.toml
225227

226228
# Create logs directory for scripts to avoid conflicts with .ai_agents_sandbox directory
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
" UTF-8 encoding
2+
set encoding=utf-8
3+
set fileencoding=utf-8
4+
set termencoding=utf-8
5+
6+
" Basic settings
7+
set nocompatible
8+
set backspace=indent,eol,start
9+
set ruler
10+
set showcmd
11+
set incsearch
12+
set hlsearch
13+
syntax on

0 commit comments

Comments
 (0)