mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-15 12:55:51 +00:00
fix(buddy): address second round CodeRabbit findings
- buddy.ts:105: remove unsafe (context as any).messages cast. ToolUseContext already declares messages: Message[] at Tool.ts:250, so context.messages is properly typed. Other commands (feedback, copy, export) access it the same way without cast. - companionReact.ts:154: wrap resp.json() in try/catch for defensive JSON parsing. Malformed 200 responses now return null instead of propagating to the outer catch. Rate-limit timing (set before API call) kept as-is — matches official ZUK pattern: prevents retry-storm on transient failures. src/ path alias suggestions dismissed — project uses relative paths. Auto-unmute on /buddy view kept — matches official behavior. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -151,6 +151,10 @@ async function callBuddyReactAPI(
|
||||
|
||||
if (!resp.ok) return null
|
||||
|
||||
const data = (await resp.json()) as { reaction?: string }
|
||||
return data.reaction?.trim() || null
|
||||
try {
|
||||
const data = (await resp.json()) as { reaction?: string }
|
||||
return data.reaction?.trim() || null
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ export async function call(
|
||||
setState?.(prev => ({ ...prev, companionPetAt: Date.now() }))
|
||||
|
||||
// Trigger a post-pet reaction
|
||||
triggerCompanionReaction((context as any).messages ?? [], reaction =>
|
||||
triggerCompanionReaction(context.messages ?? [], reaction =>
|
||||
setState?.(prev =>
|
||||
prev.companionReaction === reaction
|
||||
? prev
|
||||
|
||||
Reference in New Issue
Block a user