- Build:
mise run buildorbun build ./src/index.ts --outdir dist --target bun - Test:
mise run testorbun test - Single Test:
bun test BackgroundTask.test.ts(use file glob pattern) - Watch Mode:
bun test --watch - Lint:
mise run lintorbun run lint(biome) - Fix Lint:
mise run lint:fixorbun run lint:fix(biome --write) - Format:
mise run formatorbun run format(biome format --write) - Check (Lint + Format):
bun run check(biome check --write)
- Conventional Commits: Use conventional commit messages (e.g.,
fix:,feat:,chore:,docs:,refactor:,test:,revert:). - PR Titles: PR titles MUST follow conventional commit format (e.g.,
fix: descriptive title). This is enforced by GitHub checks. - Workflow: Run
bun run checkandbun run testbefore creating a PR.
- Use ES6
import/exportsyntax (module: "ESNext", type: "module") - Group imports: external libraries first, then internal modules
- Use explicit file extensions (
.js) for internal imports
- Single quotes (
quoteStyle: 'single') - Line width: 100 characters
- Tab width: 2 spaces (indentStyle: 'space')
- Trailing commas: ES5 (no trailing commas in function parameters)
- Semicolons: enabled
- NeverNesters: avoid deeply nested structures. Always exit early.
- Strict mode: enforced (
"strict": true) - Classes: PascalCase (e.g.,
BackgroundTask,BackgroundTaskManager) - Methods/properties: camelCase
- Status strings: use union types (e.g.,
'pending' | 'running' | 'completed' | 'failed' | 'cancelled') - Explicit types: prefer explicit type annotations over inference
- Return types: optional (not required but recommended for public methods)
- Check error type before accessing error properties:
error instanceof Error ? error.toString() : String(error) - Log errors with
[ERROR]prefix for consistency - Always provide error context when recording output
@typescript-eslint/no-explicit-any: warn (avoidanytype)no-console: error (minimize console logs)prettier/prettier: error (formatting violations are errors)
- Framework: vitest with
describe&itblocks - Style: Descriptive nested test cases with clear expectations
- Assertion library:
expect()(vitest)
- Store temporary data in
.memory/directory (gitignored)
- Type: ES Module package for opencode plugin system
- Target: Bun runtime, ES2021+
- Purpose: Sync global opencode config across machines via GitHub, with optional secrets support (e.g., 1Password backend)