(cwd: string, options: { modes?: readonly RulesMode[] } = {})
| 74 | } |
| 75 | |
| 76 | export async function getRules(cwd: string, options: { modes?: readonly RulesMode[] } = {}): Promise<RuleMetadata[]> { |
| 77 | const directories = getRuleDirectories(cwd, options.modes) |
| 78 | const rulesById = new Map<string, RuleMetadata>() |
| 79 | |
| 80 | for (const directory of directories) { |
| 81 | const rules = await scanRuleDirectory(directory) |
| 82 | for (const rule of rules) { |
| 83 | rulesById.set(rule.id, rule) |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | return Array.from(rulesById.values()).sort(compareRules) |
| 88 | } |
| 89 | |
| 90 | export async function createRule(cwd: string, input: CreateRuleInput): Promise<string> { |
| 91 | const directoryPath = getTargetRuleDirectory(cwd, input) |
no test coverage detected