@dyyz1993/pi-rules-engine
v0.2.10
Published
Rules engine plugin for pi coding agent - supports .claude/rules/ and .pi/rules/
Downloads
1,555
Maintainers
Readme
@dyyz1993/pi-rules-engine
Rules engine plugin for pi coding agent. Supports both .claude/rules/ (Claude Code compatibility) and .pi/rules/ (PI native) directories.
Features
- Load rules from Markdown files with YAML frontmatter
- Glob pattern matching for conditional rules
- Three tools:
rules_list,rules_reload,rules_check - Command:
/rules - Auto-match rules when using read/grep/glob tools
Installation
npm install @dyyz1993/pi-rules-engineUsage
Add to your pi extension config:
import rulesEngine from "@dyyz1993/pi-rules-engine";
export default {
extensions: [rulesEngine],
};Rule File Format
---
paths: src/**/*.ts, tests/**/*.ts
description: TypeScript coding standards
---
# TypeScript Rules
- Use explicit types over `any`
- Follow strict modeAPI
Exported Functions
parseFrontmatter(content)- Parse YAML frontmatter from markdownmatchGlob(filePath, pattern)- Match file path against glob patternparseRuleFile(filePath, content)- Parse a rule fileloadRules(rulesDir)- Load all rules from a directory
Types
RuleFrontmatter- Frontmatter interfaceParsedRule- Parsed rule interfaceRuleCache- Rule cache interface
