- Nix 53.3%
- TypeScript 46.7%
| .config/opencode | ||
| home-manager | ||
| .editorconfig | ||
| .gitignore | ||
| LICENSE | ||
| README.md | ||
| tsconfig.json | ||
OpenCode BTCA
Allow OpenCode to directly retrieve information from source files by integrating BTCA as OpenCode tools.
Demo
I asked OpenCode about the Zig programming language using the BTCA tools. Check out the video on YouTube.
Contents
Files
Note
Combine the files with your existing configuration. You don't need to use all the files.
.config/opencode/tools/btca.ts
Allow OpenCode agents to invoke BTCA commands as standard command-line tools (for example, ls or grep). The tool supports these BTCA CLI commands:
btca ask: supports single and multiple sourcesbtca connect: the CLI does not exit automatically, so a timeout is used as a workaroundbtca resourcesbtca addbtca removebtca clear
Reference:
home-manager/btca.nix
Nix Home Manager version of .config/opencode/tools/btca.ts. You only need to use either of the two. Please properly import this file and make sure you have set the config.home.homeDirectory by yourself. An older Home Manager version may not require that. Official documentation reference Since this points to the @opencode-ai/plugin/dist/index.js, this is kind of hacky, and might have breakages upon the entry file change on OpenCode.
Reference:
.config/opencode/opencode.jsonc
Set permissions for the BTCA tools. Explicit permissions are recommended for destructive commands such as btca clear, although they are not strictly required.
Reference:
Contributions
- Open issues or pull requests for bug reports, feature requests, or improvements.
- Create branches from
devand targetdevwhen opening a pull request. - Consider starring the repository if it is useful!
LLM Disclaimer
I used LLM to write the scripts in this repository (especially for the original TypeScript script). This is because I'm not familier with TypeScript/JavaScript, but it was the most natural to use TypeScript for OpenCode tools script. The code logic was reviewed heavily, but the type reference and syntax might be wrong. Please make an issue or a PR to report anything to improve the code as needed.