compat-ui

compat-ui is a cursor rule for Cursor from wcoreing/WWorkbench. It costs 0 tokens per session (718 once invoked), scanned A, original, MIT.

A set of front-end interaction rules for Compat, a compatibility layer for Wails and WebView applications. It defines how controls, menus, dialogs, focus, and outside-click behavior should work.

In plain words
What is it for?
Use it when building or changing tabs, toolbars, dropdowns, dialogs, context menus, product navigation, terminals, or code-editor areas in a Compat application.
Why use it?
It prevents interaction bugs such as controls needing two clicks, menus closing unreliably, or embedded terminals and code editors stealing focus.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { pressProps, Select, ModalPortal, installFocusGate, chromeProps, focusHogProps } from '../components/compat'.

Good fit Use it when building or changing tabs, toolbars, dropdowns, dialogs, context menus, product navigation, terminals, or code-editor areas in a Compat application.

Compare 6 cursor rules from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/wcoreing/WWorkbench
agentmods
npx agentmods add rules/wcoreing/wworkbench/compat-ui

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for compat-ui

README.md
[![agentmods](https://agentmods.dev/badge/rules/wcoreing/wworkbench/compat-ui/github.svg)](https://agentmods.dev/rules/wcoreing/wworkbench/compat-ui)
Your own site
<a href="https://agentmods.dev/rules/wcoreing/wworkbench/compat-ui"><img src="https://agentmods.dev/badge/rules/wcoreing/wworkbench/compat-ui/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for compat-ui

Your own site · 80×15
<a href="https://agentmods.dev/rules/wcoreing/wworkbench/compat-ui"><img src="https://agentmods.dev/badge/rules/wcoreing/wworkbench/compat-ui.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 718 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.00718
Opus 5.5 $0.00000 $0.00287
Sonnet 5.5 $0.00000 $0.00144
Haiku 4.5 $0.00000 $0.00072

Measured 1mo ago against content hash bbcec69327a0, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

compat-ui scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/compat-ui.mdc · 48 lines

What it actually says

Compat 交互层

Compat 修 Wails/WebView 兼容性,不是视觉 UI 框架。长相可继续用 wn-* 或套 Ant / shadcn。

进口

import { pressProps, Select, ModalPortal, installFocusGate, chromeProps, focusHogProps } from '../components/compat'

旧路径 utils/press、components/Select、components/ModalPortal 仅为兼容 re-export,新代码不要再用。

硬契约

  1. 命令控件(Tab、工具条、弹窗取消/保存、右键菜单项、树节点命令)→ 必须 pressProps,禁止裸 onClick 做切换与提交。
  2. 业务下拉 → 必须用 Select,或自绘弹出并接 useOutsideDismiss;禁止原生 <select>(系统层会吞第一次外点)。
  3. 弹层 → 用 ModalPortal 挂到 document.body;弹窗内容区对 backdrop 做 onPointerDown stopPropagation。
  4. 菜单/下拉的外点关闭 → 必须听 pointerdown(见 useDismissOnPointerDown),禁止 click/mousedown。 pressProps 会 preventDefault(pointerdown) 从而取消后续 mouse 事件;用 click 关菜单会导致「产品轨要点两次」。
  5. 切产品线 → setActiveProduct 会 dismissOverlays();Select/菜单须 useDismissOverlays 订阅,避免隐藏页 portal 挡住产品轨。
  6. 焦点域(FocusGate):
    • 抢焦内容(xterm / Monaco)→ data-ww-focus-hog 或 focusHogProps() / registerFocusHog
    • 命令壳(产品轨、顶栏)→ data-ww-chrome 或 chromeProps()(浮层盖住时坐标转发)
    • AppShell 已 installFocusGate():内容区持焦时点到 任意命令控件(button / .wn-select-trigger / 产品轨等)先 blur,首击必达
    • 查询栏 Select、工具条、Tab 都靠这条,不必再逐个标 chrome
    • 不要再为产品轨单独写坐标 capture hack

套其他 UI 框架

// 外观用第三方,交互走 Compat
<AntButton {...pressProps(onSave)}>保存</AntButton>
<Select className="your-skin" value={v} options={opts} onChange={setV} />

不要做

  • 为每个业务再写一套 Select / press
  • 用全局事件 hack 去「修复」原生 select
  • 把颜色、布局、Form 引擎塞进 Compat
  • 在业务里重复实现「从终端失焦再点轨」逻辑(应走 FocusGate)
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 48 lines · 0 tokens per session scan A bbcec69327a0

Subscribe to this mod's changes

compat-ui is a cursor rule published in the GitHub repository wcoreing/WWorkbench (30 stars, last pushed 4d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 718 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.