Skip to content

feat: add resolve_css_api anti-hallucination tool#162

Merged
himerus merged 1 commit intodevfrom
feature/css-api-resolver
Mar 21, 2026
Merged

feat: add resolve_css_api anti-hallucination tool#162
himerus merged 1 commit intodevfrom
feature/css-api-resolver

Conversation

@himerus
Copy link
Contributor

@himerus himerus commented Mar 21, 2026

Summary

  • New resolve_css_api MCP tool that validates every ::part(), CSS custom property, and slot reference against actual CEM data
  • Returns structured report: valid/invalid status per reference, fuzzy-match suggestions for typos, and full component API surface summary
  • Catches hallucinated part names, invalid token names, and unknown slot names before agents ship broken CSS

Anti-hallucination impact

When agents call resolve_css_api before finalizing CSS, they get immediate feedback on whether ::part(content) actually exists on sl-dialog (it doesn't — the valid parts are base, overlay, panel, header, body, footer, etc.)

Test plan

  • 20 tests covering part resolution, token resolution, slot resolution, typo suggestions, deduplication, bare components
  • TypeScript compiles clean
  • ESLint passes

🤖 Generated with Claude Code

Resolves every ::part(), CSS custom property, and slot reference against
actual CEM data. Returns structured report with valid/invalid status and
fuzzy-match suggestions for typos. 20 tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Mar 21, 2026

Warning

Rate limit exceeded

@himerus has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 0 minutes and 41 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 81676de3-3a9d-47a3-89e1-9f37647d1662

📥 Commits

Reviewing files that changed from the base of the PR and between d294078 and 9b96f43.

📒 Files selected for processing (4)
  • .changeset/css-api-resolver.md
  • packages/core/src/handlers/css-api-resolver.ts
  • packages/core/src/tools/styling.ts
  • tests/handlers/css-api-resolver.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/css-api-resolver

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@himerus himerus merged commit 09b9a98 into dev Mar 21, 2026
6 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant