---
name: kd-ttsr-no-hallucinated-api
description: 禁止苍穹幻觉 API（setReadOnly/queryAll/refresh/getEntryCount 等）
condition: "setReadOnly\\s*\\(|QueryServiceHelper\\.queryAll\\s*\\(|afterCreateControl\\s*\\(|getView\\(\\)\\.refresh\\s*\\(|\\.getEntryCount\\s*\\(|model\\.deleteRow\\s*\\(|model\\.addRow\\s*\\(|model\\.getRowCount\\s*\\(|model\\.getEntry\\s*\\(|\\bBillHelper\\b|\\bFormHelper\\b|\\bListHelper\\b|\\bPluginHelper\\b"
scope: "tool:edit(*.java), tool:write(*.java), text"
alwaysApply: false
---

禁止使用苍穹不存在或错误的 API。对照：

| 错误 | 正确 |
|------|------|
| setReadOnly | **`getView().setEnable(false, key)`（合法 API）** |
| queryAll | QueryServiceHelper.query(...) |
| afterCreateControl | registerListener / afterBindData |
| getView().refresh() | getView().updateView(key) |
| getEntryCount / getRowCount | getEntryRowCount(entryKey) |
| model.addRow / deleteRow | createNewEntryRow / deleteEntryRow |
| model.getEntry | getEntryRowEntity / DynamicObjectCollection |
| BillHelper/FormHelper/ListHelper/PluginHelper | 对应 *ServiceHelper / FormUtils |

**注意**：`setEnable` / `updateView` / `loadFromCache` / `QueryServiceHelper.query` / **`createNewEntryRow` / `deleteEntryRow` / `getEntryRowCount` / `getEntryRowEntity`** **都存在**，不要判成幻觉。  
单参 `createNewEntryRow(entryKey)` 属于合法 API 族，不要因某重载签名差异就说「整个方法不存在」。

详见 skill `ok-cosmic/rules/anti-patterns.md`。
