From 98b5390a22e2dc07c94727e19aad19d8b71d5a4d Mon Sep 17 00:00:00 2001 From: Dax Raad Date: Tue, 27 May 2025 02:26:53 -0400 Subject: Refactor grep tool output generation and fix ls directory traversal bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with opencode Co-Authored-By: opencode --- js/OpenCode.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 js/OpenCode.md (limited to 'js/OpenCode.md') diff --git a/js/OpenCode.md b/js/OpenCode.md new file mode 100644 index 000000000..7def6f8c7 --- /dev/null +++ b/js/OpenCode.md @@ -0,0 +1,27 @@ +# 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 ` - Run specific test files +- `bun test --test-name-pattern ` - 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 +- **Variable declarations: Prefer `const` over `let` unless reassignment is necessary** \ No newline at end of file -- cgit v1.2.3