diff --git a/src/buddy/CompanionCard.tsx b/src/buddy/CompanionCard.tsx index 2d7d316fe..f9264acf3 100644 --- a/src/buddy/CompanionCard.tsx +++ b/src/buddy/CompanionCard.tsx @@ -12,7 +12,8 @@ const CARD_WIDTH = 40; const CARD_PADDING_X = 2; function StatBar({ name, value }: { name: string; value: number }) { - const filled = Math.round(value / 10); + const clamped = Math.max(0, Math.min(100, value)); + const filled = Math.round(clamped / 10); const bar = '\u2588'.repeat(filled) + '\u2591'.repeat(10 - filled); return ( diff --git a/src/commands/buddy/buddy.ts b/src/commands/buddy/buddy.ts index 1ae2c205f..e28826ef1 100644 --- a/src/commands/buddy/buddy.ts +++ b/src/commands/buddy/buddy.ts @@ -71,7 +71,7 @@ export async function call( onDone: LocalJSXCommandOnDone, context: ToolUseContext & LocalJSXCommandContext, args: string, -): Promise { +): Promise { const sub = args?.trim().toLowerCase() ?? '' const setState = context.setAppState