Skip to content

Commit 7d4adce

Browse files
unraidclaude
andcommitted
fix(buddy): address CodeRabbit review findings
- buddy.ts: return type Promise<null> → Promise<React.ReactNode> to match LocalJSXCommandCall interface (CompanionCard path returns ReactElement, not null). - CompanionCard.tsx: clamp stat value to 0..100 before .repeat() to prevent negative count runtime error on out-of-range values. Import path alias suggestions (src/ vs ../) dismissed — project convention uses relative paths (verified against color.ts, help.ts). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9911194 commit 7d4adce

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/buddy/CompanionCard.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ const CARD_WIDTH = 40;
1212
const CARD_PADDING_X = 2;
1313

1414
function StatBar({ name, value }: { name: string; value: number }) {
15-
const filled = Math.round(value / 10);
15+
const clamped = Math.max(0, Math.min(100, value));
16+
const filled = Math.round(clamped / 10);
1617
const bar = '\u2588'.repeat(filled) + '\u2591'.repeat(10 - filled);
1718
return (
1819
<Text>

src/commands/buddy/buddy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export async function call(
7171
onDone: LocalJSXCommandOnDone,
7272
context: ToolUseContext & LocalJSXCommandContext,
7373
args: string,
74-
): Promise<null> {
74+
): Promise<React.ReactNode> {
7575
const sub = args?.trim().toLowerCase() ?? ''
7676
const setState = context.setAppState
7777

0 commit comments

Comments
 (0)