Create a new PRRadar review rule. Use when the user wants to add a code review rule, create a violation check, or set up a new pattern to detect in PRs. Handles choosing the project config, rule directory, evaluation mode (AI/script/regex), file targeting, and grep filtering.
Create a new rule file for PRRadar's code review pipeline. Rules are markdown files with YAML frontmatter that define what to look for in PR diffs.
If the user didn't specify a project config or rule directory, help them choose:
swift run PRRadarMacCLI config list (from the PRRadarLibrary/ directory) to show available configurationsIf the user already specified a directory (e.g., "add a rule to my experimental rules"), use that directly.
Determine the following from the user's request or by asking:
["*.h"], ["*.swift", "*.m"]If the user describes something that can be checked deterministically (like "flag uses of X macro" or "check for missing Y annotation"), suggest script or regex mode since they're faster and fully deterministic. If the check requires judgment or understanding context, suggest AI mode.
Rules are organized into subdirectories within the rule path (e.g., apis-apple/, safety/, clarity/). List the existing subdirectories and either:
Write a .md file with YAML frontmatter and a markdown body.
---