This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a Bitfocus Companion module for controlling Stagetimer.io timers remotely. It integrates with Companion v3 using the @companion-module/base framework.
yarn lint- Run ESLint on./srcyarn test- Run tests using Node.js built-in test runneryarn version- Sync versions and stage changes (used during release)
ESLint is configured with:
- 2-space indentation
- Single quotes
- No semicolons
- Trailing commas in multiline
- Space before function parentheses
- Unused variables prefixed with
_are allowed
ModuleInstance extends InstanceBase from Companion and orchestrates:
- Configuration validation and updates
- API client instantiation
- Socket connection management
- Loading of actions, feedbacks, variables, and presets
src/api.js- HTTP RPC client for Stagetimer.io API v1. Sends actions with query parameters to/v1/endpoints.src/socket.js- Socket.io client for real-time state updates. Connects to the Stagetimer.io WebSocket API and receives events likeplayback_status,room,current_timer,next_timer,flash, andmessage.
Central state store with update functions that:
- Merge incoming state
- Update Companion variables via
setVariableValues() - Trigger feedback checks via
checkFeedbacks()
A timekeeper service (setInterval at 250ms) updates playback state while timers are running.
src/actions.js- Defines transport controls (start/stop/reset/next/previous), viewer controls (flash/blackout/focus), timer-specific actions, and message actions. Actions map to API endpoints.src/feedbacks.js- Boolean feedbacks for playback state, timer phases (yellow/red warnings), and viewer modes.src/variables.js- Exposes room info, current/next timer details, and time display values.src/presets.js- Pre-configured button presets for common operations.src/config.js- Configuration fields and validation (Room ID, API Key, API URL).
JSDoc typedefs for TypeScript-like type checking. Key types:
StagetimerConfig- Module configurationState- Full module state shapePlaybackState,TimerState,RoomState,MessageState- State slicesApiResponse,StatusData,RoomData,TimerData- API response types
@companion-module/base- Companion module framework@stagetimerio/shared- Shared Stagetimer utilities@stagetimerio/timeutils- Time formatting utilitiessocket.io-client- WebSocket client for real-time updates
The user-facing documentation lives in the landing page repo:
stagetimer-landing/src/pages/docs/integration-with-streamdeck-companion.md
When updating the docs after code changes, also update the version badge at the top of the file to match the current module version in package.json.