this repo has no description
1# langrules-opencode
2
3OpenCode plugin that provides language-specific coding rules and style guidelines.
4
5## Installation
6
7Add to your `opencode.json`:
8
9```json
10{
11 "plugin": ["git@tangled.org:karitham.dev/langrules-opencode"]
12}
13```
14
15## What it does
16
17This 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.
18
19### Features
20
21- **`langrules` tool**: Reads coding rules for specific languages (e.g., `langrules({ language: 'typescript' })`)
22- **Smart hints**: Automatically suggests reading relevant rules when you're about to edit a file
23- **Session tracking**: Only prompts once per language per session to avoid redundancy
24- **Custom rules**: Supports project-local rules in `.rules/` directory
25- **Global fallback**: Falls back to `$LANGRULES_DIR` for shared rule sets
26
27### Supported Languages
28
29TypeScript, JavaScript, Go, Nix, Rust, Ruby, Python, Java, C, C++, C#, Shell, HTML, CSS, JSON, YAML, XML, TOML, Markdown, SQL
30
31## Usage
32
33The plugin works automatically - when you edit a file, it suggests reading the relevant language rules. You can also manually invoke:
34
35```
36langrules({ language: 'typescript' })
37```
38
39## Rule Files
40
41Place language rule files in `.rules/` at your project root:
42
43```
44.rules/
45 typescript.md
46 go.md
47 python.md
48```
49
50Or set `LANGRULES_DIR` environment variable for global rules.