···11+# langrules-opencode
22+33+OpenCode plugin that provides language-specific coding rules and style guidelines.
44+55+## Installation
66+77+Add to your `opencode.json`:
88+99+```json
1010+{
1111+ "plugin": ["git@tangled.org:karitham.dev/langrules-opencode"]
1212+}
1313+```
1414+1515+## What it does
1616+1717+This plugin provides a `langrules` tool that reads language-specific coding rules from `.rules/*.md` files in your project. It helps maintain consistent code style and best practices across your codebase.
1818+1919+### Features
2020+2121+- **`langrules` tool**: Reads coding rules for specific languages (e.g., `langrules({ language: 'typescript' })`)
2222+- **Smart hints**: Automatically suggests reading relevant rules when you're about to edit a file
2323+- **Session tracking**: Only prompts once per language per session to avoid redundancy
2424+- **Custom rules**: Supports project-local rules in `.rules/` directory
2525+- **Global fallback**: Falls back to `$LANGRULES_DIR` for shared rule sets
2626+2727+### Supported Languages
2828+2929+TypeScript, JavaScript, Go, Nix, Rust, Ruby, Python, Java, C, C++, C#, Shell, HTML, CSS, JSON, YAML, XML, TOML, Markdown, SQL
3030+3131+## Usage
3232+3333+The plugin works automatically - when you edit a file, it suggests reading the relevant language rules. You can also manually invoke:
3434+3535+```
3636+langrules({ language: 'typescript' })
3737+```
3838+3939+## Rule Files
4040+4141+Place language rule files in `.rules/` at your project root:
4242+4343+```
4444+.rules/
4545+ typescript.md
4646+ go.md
4747+ python.md
4848+```
4949+5050+Or set `LANGRULES_DIR` environment variable for global rules.