Complete Ralph to Loop rename across entire codebase

Rename all Ralph references to Loop including types, services, hooks,
filenames, KV keys, API routes, frontend components, tests, and docs.

Key changes:
- Types: RalphState → LoopState, RalphConfig → LoopConfig
- Services: ralph.ts → loop.ts with worktree field (inverted from inPlace)
- KV keys: ralph: → loop:, ralph-session: → loop-session:
- API routes: /ralph/* → /loop/*
- Frontend: useLoopStatus, RepoLoopList, getLoopStatus, cancelLoop
- Config backward compatibility: accepts both loop and ralph (prefers loop)
- Automatic KV migration on plugin startup
- memory-plan-execute keeps inPlace parameter (different semantics)

Fixes critical bugs found in code review:
- Backend /loop/cancel route using wrong ralph: KV prefix
- Frontend error messages still referencing Ralph
- Log message consistency
This commit is contained in:
Chris Scott committed 2026-03-27 14:45:54 -04:00
1 parent 00489d9901
commit 2c4a9c9257
31 files changed
+789 -745

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
import { truncate } from '../cli/utils'
import type { LoopSessionOutput } from '../services/loop'
export function formatTokens(n: number): string {
return n >= 1000 ? `${(n / 1000).toFixed(1)}k` : `${n}`
}
export function formatSessionOutput(sessionOutput: LoopSessionOutput): string[] {
const lines: string[] = []
const costStr = `$${sessionOutput.totalCost.toFixed(4)}`
const t = sessionOutput.totalTokens
const tokensStr = `${formatTokens(t.input)} in / ${formatTokens(t.output)} out / ${formatTokens(t.reasoning)} reasoning / ${formatTokens(t.cacheRead)} cache read / ${formatTokens(t.cacheWrite)} cache write`
lines.push(` Cost: ${costStr} | Tokens: ${tokensStr}`)
if (sessionOutput.fileChanges) {
const fc = sessionOutput.fileChanges
lines.push(` Files changed: ${fc.files} (+${fc.additions}/-${fc.deletions} lines)`)
}
if (sessionOutput.messages.length > 0) {
lines.push('')
lines.push('Recent Activity:')
for (const msg of sessionOutput.messages) {
const preview = truncate(msg.text.replace(/\n/g, ' ').trim(), 200)
lines.push(` [assistant] ${preview}`)
}
}
return lines
}
export function formatAuditResult(auditResult: string): string[] {
const auditPreview = truncate(auditResult, 300)
return ['', 'Last Audit:', ` ${auditPreview}`]
}