Thank you for your interest in contributing! This document outlines the process for contributing to this project.
# Clone the repo
git clone https://github.com/Smart-Coders-HQ/opencode-model-fallback.git
cd opencode-model-fallback
# Install dependencies
bun install
# Run tests
bun test
# Type check
bunx tsc --noEmit
# Build
bun run build- Fork the repository and create a feature branch from
main. - Write code — follow the TypeScript/JavaScript conventions in
AGENTS.md. - Test — add tests for new functionality. All tests must pass:
bun test. - Lint — run
bun run lintandbun run formatbefore committing. - Commit — use Conventional Commits format:
feat: add X— new feature (triggers minor release)fix: correct Y— bug fix (triggers patch release)docs: update Z— documentation onlytest: add coverage for W— test changeschore: bump deps— maintenanceBREAKING CHANGE:in footer — triggers major release
- Pull Request — open a PR against
main. Fill in the PR template.
Before a PR can be merged, all of these must pass:
bun run lint— Biome lintingbun test— 101 tests, 0 failuresbunx tsc --noEmit— TypeScript type checkbun run build— clean build
The plugin is structured as follows:
src/
plugin.ts # Entry point — event router + chat.message hook
preemptive.ts # Sync preemptive redirect logic
types.ts # Shared type definitions
config/ # Zod schema, file discovery, defaults, auto-migration
detection/ # Pattern matching + error classification
state/ # ModelHealthStore, SessionStateStore, FallbackStore
resolution/ # Chain walker, agent→config resolver
replay/ # abort→revert→prompt orchestrator
display/ # Toast notifications, usage enrichment
tools/ # /fallback-status tool
logging/ # Structured file + client logger
See AGENTS.md for full architecture details and key invariants.
Please use GitHub Issues and select the appropriate template.
Please do not open public issues for security vulnerabilities. See SECURITY.md for responsible disclosure instructions.
By contributing, you agree that your contributions will be licensed under the Apache 2.0 License.