Merge branch 'for-sandlot'

# Conflicts:
#	src/cli.ts
This commit is contained in:
Chris Wanstrath 2026-02-19 13:07:11 -08:00
commit bf6b9973d5
2 changed files with 27 additions and 1 deletions

View File

@ -160,6 +160,32 @@ program
const st = await state.load(root)
const sessions = Object.values(st.sessions)
// Discover prompts from Claude history for sessions that lack one
const needsPrompt = sessions.filter(s => !s.prompt)
if (needsPrompt.length > 0 && (await vm.status()) === "running") {
try {
const result = await vm.exec(homedir() + "/.sandlot", "cat /home/ubuntu/.claude/history.jsonl 2>/dev/null")
if (result.exitCode === 0 && result.stdout) {
const entries = result.stdout.split("\n").filter(Boolean).map(line => {
try { return JSON.parse(line) } catch { return null }
}).filter(Boolean)
for (const s of needsPrompt) {
const cPath = vm.containerPath(s.worktree)
const match = entries.find((e: any) => e.project === cPath)
if (match?.display) {
s.prompt = match.display
}
}
}
} catch {}
}
if (opts.json) {
console.log(JSON.stringify(sessions, null, 2))
return
}
if (sessions.length === 0) {
if (opts.json) console.log("[]")
else console.log("◆ No active sessions.")

View File

@ -6,7 +6,7 @@ const USER = "ubuntu"
const CLAUDE_BIN = `/home/${USER}/.local/bin/claude`
/** Translate a host path to its corresponding container path. */
function containerPath(hostPath: string): string {
export function containerPath(hostPath: string): string {
const home = homedir()
if (hostPath.startsWith(`${home}/.sandlot`)) {
return "/sandlot" + hostPath.slice(`${home}/.sandlot`.length)