From ac745d02f646a5f7ed729756e0c62d9e35e1d723 Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Wed, 11 Mar 2026 22:36:18 -0700 Subject: [PATCH] Add statusline script showing branch in powerline --- src/vm.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/vm.ts b/src/vm.ts index bcfde9d..454e177 100644 --- a/src/vm.ts +++ b/src/vm.ts @@ -157,7 +157,10 @@ async function configureEnvironment(home: string, apiKey: string): Promise Stop: [{ hooks: [{ type: "command", command: `${activityBin} idle` }] }], PostToolUseFailure: [{ hooks: [{ type: "command", command: `${activityBin} idle` }] }], } - const settingsJson = JSON.stringify({ apiKeyHelper: "~/.claude/api-key-helper.sh", skipDangerousModePermissionPrompt: true, hooks }) + // Status line: show current branch in the Claude Code powerline + const statusLineBin = `/home/${USER}/.local/bin/sandlot-statusline` + const statusLine = { type: "command", command: statusLineBin } + const settingsJson = JSON.stringify({ apiKeyHelper: "~/.claude/api-key-helper.sh", skipDangerousModePermissionPrompt: true, hooks, statusLine }) const claudeJson = JSON.stringify({ hasCompletedOnboarding: true, effortCalloutDismissed: true, projects: { "/": { hasTrustDialogAccepted: true } } }) // Write the helper script to a temp file and copy it in so the key @@ -180,6 +183,19 @@ async function configureEnvironment(home: string, apiKey: string): Promise await $`container exec --user ${USER} ${CONTAINER_NAME} bash -c ${"cp /sandlot/.sandlot-activity.tmp ~/.local/bin/sandlot-activity"}`.quiet() await Bun.file(activityTmp).unlink() + // Install statusline script (shows branch in Claude Code powerline) + const statuslineTmp = `${home}/.sandlot/.sandlot-statusline.tmp` + await Bun.write(statuslineTmp, [ + '#!/bin/bash', + 'input=$(cat)', + 'branch=$(echo "$input" | grep -oP \'"branch"\\s*:\\s*"\\K[^"]+\' | head -1)', + '[ -n "$branch" ] && printf \'\\033[36m⎇ %s\\033[0m\\n\' "$branch"', + '', + ].join('\n')) + await $`chmod +x ${statuslineTmp}`.quiet() + await $`container exec --user ${USER} ${CONTAINER_NAME} bash -c ${"cp /sandlot/.sandlot-statusline.tmp ~/.local/bin/sandlot-statusline"}`.quiet() + await Bun.file(statuslineTmp).unlink() + await $`container exec --user ${USER} ${CONTAINER_NAME} bash -c ${` mkdir -p ~/.claude echo '${settingsJson}' > ~/.claude/settings.json