Skip to content

Latest commit

 

History

History
33 lines (25 loc) · 1.55 KB

File metadata and controls

33 lines (25 loc) · 1.55 KB

Agent Guidelines for opencode-sessions

Build & Test Commands

  • 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

Code Style

  • No semicolons (prettier configured with { "semi": false })
  • TypeScript ES2022 modules with import type for types
  • Imports: Named imports, type imports separate (import type { X })
  • Types: Interface definitions for objects, strict: false in 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)

Commit Messages

  • 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

Project Structure

  • 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