- Build:
npm run build(compiles TS to dist/) - Type Check:
npm run typecheck(runs tsc --noEmit) - Pre-publish:
npm run prepublishOnly(builds before publishing) - No tests: This project has no test suite currently
- No semicolons (prettier configured with
{ "semi": false }) - TypeScript ES2022 modules with
import typefor types - Imports: Named imports, type imports separate (
import type { X }) - Types: Interface definitions for objects,
strict: falsein tsconfig - Naming: camelCase for variables/functions, PascalCase for types/interfaces/classes/exports
- Async: Prefer async/await over promises
- Error Handling: Try-catch blocks with proper cleanup, avoid silent failures
- Logging: Use
log()helper function (see index.ts:31), writes to .opencode/logs/session-plugin.log - Comments: JSDoc for public APIs and complex logic
- Architecture: Single-file plugin with event-driven hooks (tool.execute.before, event listeners)
- Use Conventional Commits:
feat:,fix:,docs:,chore:,refactor:,test:,perf: - Breaking changes: Use
!suffix (e.g.,feat!: change API) - Examples:
feat: add agent discovery,fix: handle empty frontmatter,docs: update README
index.ts- Main plugin entry point, single-file architecture (~560 lines)dist/- Compiled output (generated by tsc, not committed)- Package published to npm as
opencode-sessions