this repo has no description
TypeScript 88.9%
Nix 11.1%
5 1 0

Clone this repository

https://tangled.org/karitham.dev/langrules-opencode https://tangled.org/did:plc:kcgwlowulc3rac43lregdawo/langrules-opencode
git@tangled.org:karitham.dev/langrules-opencode git@tangled.org:did:plc:kcgwlowulc3rac43lregdawo/langrules-opencode

For self-hosted knots, clone URLs may differ based on your setup.

Download tar.gz
README.md

langrules-opencode#

OpenCode plugin that provides language-specific coding rules and style guidelines.

Installation#

Add to your opencode.json:

{
  "plugin": ["git@tangled.org:karitham.dev/langrules-opencode"]
}

What it does#

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.

Features#

  • langrules tool: Reads coding rules for specific languages (e.g., langrules({ language: 'typescript' }))
  • Smart hints: Automatically suggests reading relevant rules when you're about to edit a file
  • Session tracking: Only prompts once per language per session to avoid redundancy
  • Custom rules: Supports project-local rules in .rules/ directory
  • Global fallback: Falls back to $LANGRULES_DIR for shared rule sets

Supported Languages#

TypeScript, JavaScript, Go, Nix, Rust, Ruby, Python, Java, C, C++, C#, Shell, HTML, CSS, JSON, YAML, XML, TOML, Markdown, SQL

Usage#

The plugin works automatically - when you edit a file, it suggests reading the relevant language rules. You can also manually invoke:

langrules({ language: 'typescript' })

Rule Files#

Place language rule files in .rules/ at your project root:

.rules/
  typescript.md
  go.md
  python.md

Or set LANGRULES_DIR environment variable for global rules.