diff options
| author | Dax Raad <[email protected]> | 2025-05-26 21:38:17 -0400 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-05-26 21:38:17 -0400 |
| commit | a1d40f8f28a7fcb6ff3362a21a177418d76fbe95 (patch) | |
| tree | d0dcbc2aa34e867ffdbe164d55632807e3701480 | |
| parent | 575d76fa060bb78613ac3476392cee516d835395 (diff) | |
| download | opencode-a1d40f8f28a7fcb6ff3362a21a177418d76fbe95.tar.gz opencode-a1d40f8f28a7fcb6ff3362a21a177418d76fbe95.zip | |
add context.md
| -rw-r--r-- | js/CONTEXT.md | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/js/CONTEXT.md b/js/CONTEXT.md new file mode 100644 index 000000000..6c9521857 --- /dev/null +++ b/js/CONTEXT.md @@ -0,0 +1,24 @@ +# OpenCode Context + +## Build/Test Commands +- `bun install` - Install dependencies +- `bun run index.ts` - Run the application +- `bun build src/index.ts --compile --outfile ./dist/opencode` - Build executable +- `bun test` - Run all tests +- `bun test <pattern>` - Run specific test files +- `bun test --test-name-pattern <regex>` - Run tests matching pattern + +## Code Style & Conventions +- TypeScript with Bun runtime +- ES modules (`"type": "module"`) +- Namespace-based organization (e.g., `Tool.define`, `App.provide`) +- Zod for schema validation and type safety +- Async/await patterns throughout +- Structured logging with service-based loggers (`Log.create({ service: "name" })`) +- Tool pattern: define tools with `Tool.define()` wrapper for metadata/timing +- Context pattern: use `Context.create()` for dependency injection +- Import style: Node.js built-ins with `node:` prefix, relative imports with explicit extensions +- Error handling: try/catch with structured logging +- File organization: group by feature in `src/` with index files for exports +- Test files: co-located in `test/` directory, use Bun's built-in test runner +- Naming: camelCase for variables/functions, PascalCase for namespaces/types
\ No newline at end of file |
