All stream notes

Reviewing AI suggestions and choosing a chat voice

Read on GitHub

Today I reviewed how an AI suggestion for Kando's --list-menus command would affect logging across the CLI, added a way for viewers to choose the voice that reads their Bilibili chat messages, and rebuilt the voice picker with Vite, React, and TypeScript.

A code review question for AI suggestions

kando --list-menus prints JSON to stdout so other apps can read the menu list. One extra log line while loading an older config can make JSON.parse fail. The AI suggested replacing globalThis.console in the CLI process to send logs to stderr. That reminded me of an ESLint rule I'd used before. Why change where every console.log goes just to handle one migration message? Someone reading another module would have no clue that the CLI had redirected its logs. Unicorn's no-global-object-property-assignment rule

The migration function already returned didMigration, so we used that to let the desktop app log a successful migration and let the CLI print the menu list. Looking only at the JSON, both approaches could give the same result. That's how a change to global behavior can slip through review even when the feature works. When I review an AI suggestion, I want to ask one more question. What else would these lines change for the code around them? Kando PR #1637

Pick your voice in Bilibili chat

You can now preview any of the 31 voices in the picker, copy the command beside the play button, and paste it into chat. I gave the three Siri 2 voices distinct names so you can tell them apart in a message. Send /voice Siri 2 普通话 for Mandarin or /voice Siri 2 粤语 for Cantonese, and you'll hear the new voice announce your choice. Voice picker · Voice picker changes

Viewers get three changes per day by default. As the broadcaster, I can send /voice @小明 彬彬 without using any of 小明's allowance. I migrated the existing chat-selected voice and its daily count to SQLite. Each change now saves the voice and its count together, so viewers can switch while I edit pronunciations or individual limits in JSON. Chat commands and storage

Locking a viewer's voice

When I want to lock a voice, I set users["小明"].voice in config.json. Saving the file copies the voice to SQLite. While the lock is in place, both 小明's own /voice command and my broadcaster command leave the voice and daily count alone. Deleting just the voice field unlocks it. 小明 keeps that voice until the next switch. Voice lock documentation

I ran npm start -- --migrate-initial-voices for the nine viewers whose voices I'd previously set by hand. All nine kept their voices and can change them in chat. Their pronunciation settings stayed in JSON. Migration implementation

Rebuilding the voice picker with Vite

I noticed the picker always requested styles.css, even after I changed the styles. I moved the site to Vite 8.4.1, React, and TypeScript. The production build now gives CSS and JavaScript filenames a content hash, so a change gets a new URL and browsers can pick it up on the next page load. Voice picker migration

I kept all 31 voice cards in the initial HTML so you can browse the list while React loads. I tested the production build under the same /voices/ path used by GitHub Pages and checked that I could combine filters, switch audio samples, and copy a chat command. To try the picker locally, run npm ci and npm run dev. Local development guide