Add statusline script showing branch in powerline
This commit is contained in:
parent
aa1139c004
commit
ac745d02f6
18
src/vm.ts
18
src/vm.ts
|
|
@ -157,7 +157,10 @@ async function configureEnvironment(home: string, apiKey: string): Promise<void>
|
|||
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<void>
|
|||
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
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user