Rules

Audience: Customer — this page documents managing rules in the dashboard.

The rules page (/dashboard/rules) manages the rules that the Rulecatch engine evaluates against AI-generated code events.


URL

/dashboard/rules

Access

Available to all plans. Custom rule creation requires Enterprise (feature-gated via customRules).


Data Sources

GET /api/v1/rules              — List all user rules
GET /api/v1/billing/status     — Check plan features (customRules)
GET /api/v1/user/me            — Get saved stack selection

Page Layout

The page has three main states:

  1. No rules — Empty state with "Define Your Stack" and "Add Rule Manually" buttons
  2. Stack selector — Inline stack selection UI
  3. Rule browser — Browsable, filterable list of all rules

Stack Selection

The "Define Stack" / "Redefine Stack" button opens an inline StackSelector component:

  1. User selects technologies (React, TypeScript, MongoDB, Docker, etc.)
  2. On continue, calls POST /api/v1/user/save-stack with the selection
  3. Server maps stack choices to rule categories and activates matching templates
  4. Shows confirmation with count of activated categories
  5. Rule list refreshes automatically

The stack-to-category mapping is defined in packages/core/src/rules/stack-categories.ts and covers 20+ technologies across 17 categories.


Rule Browser

When rules exist, the RuleBrowser component provides:

Search

Text search across rule names. Located at the top of the browser.

Category Filter

Horizontal pill buttons to filter by category:

  • All (default)
  • AI, CSS, Docker, Git, HTML, MongoDB, React, Security, TypeScript, etc.

Categories are derived from the actual rules present.

Severity Filter

Filter rules by severity level: error, warning, info.

Difficulty Filter

Filter rules by estimated fix difficulty. Enabled via showDifficultyFilter prop.


Rule Card

Each rule is displayed as a RuleCard with:

Element Description
Name Rule display name
Badge Template (from Global.ruleTemplates) or Custom
Severity Color-coded badge (error/warning/info)
Category Rule category
Description Brief explanation of what the rule checks
Conditions Number of conditions
Fix time Estimated minutes to fix
Toggle Enable/disable switch
Edit button Opens inline edit form
Delete button Removes the rule (with confirmation)

Rule Form

The RuleForm component handles both creation and editing:

Field Description
Name Rule display name
Description What the rule checks for
Severity Dropdown: error, warning, info
Fix Time Estimated minutes to fix (number)
Conditions Array of condition objects (field, operator, value)

Custom Rules

Custom rule creation is gated by the customRules feature:

  • Starter/Pro: Can browse and toggle templates, cannot create custom rules
  • Enterprise: Full custom rule creation

If a non-Enterprise user clicks "Add Rule", an UpgradePrompt modal appears.


Rule Actions

Action Method Endpoint
Create POST /api/v1/rules
Toggle PUT /api/v1/rules/{id} (body: { enabled, ruleType })
Update PUT /api/v1/rules/{id} (body: full rule object)
Delete DELETE /api/v1/rules/{id}

Template vs Custom Rules

Property Template Rules Custom Rules
Source Global.ruleTemplates collection User-created
Badge "Template" "Custom"
Editable Toggle only Full edit
Deletable No (disable instead) Yes
Plan required All plans Enterprise

See Also