@quicktvui/ai 1.1.14 → 1.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -0
- package/package.json +1 -1
- package/rules/.claude/commands/create-component.md +1 -1
- package/rules/.claude/commands/create-page.md +1 -1
- package/rules/.claude/commands/create-project.md +1 -1
- package/rules/.claude/commands/lookup-api.md +1 -1
- package/rules/.claude/commands/lookup-css.md +1 -1
- package/rules/.clinerules +141 -1
- package/rules/.cursorrules +141 -1
- package/rules/.docs/zh-CN/tool/api/overview.md +4 -0
- package/rules/.docs/zh-CN/tool/api/plugin-scaffold-mcp.md +46 -0
- package/rules/.docs/zh-CN/tool/api/plugin-server-api.md +198 -0
- package/rules/.docs/zh-CN/tool/cli/introduction.md +7 -0
- package/rules/.docs/zh-CN/tool/cli/plugin-create-component.md +101 -0
- package/rules/.docs/zh-CN/tool/cli/plugin-create-module.md +88 -0
- package/rules/.docs/zh-CN/tool/cli/plugin-create-project.md +106 -0
- package/rules/.docs/zh-CN/tool/cli/plugin-server.md +152 -0
- package/rules/.github/copilot-instructions.md +141 -1
- package/rules/.windsurfrules +141 -1
- package/rules/AGENTS.md +148 -1
- package/rules/AI_HANDOFF.md +131 -1
- package/rules/CLAUDE.md +148 -1
- package/rules/GEMINI.md +148 -1
package/README.md
CHANGED
|
@@ -66,6 +66,50 @@ quicktvui-ai prompt --lang zh
|
|
|
66
66
|
|
|
67
67
|
> 注意:全局 skills 不是对所有 AI 都自动生效。对仅读取项目文件的工具,仍需使用 `npm install @quicktvui/ai --save-dev` 注入项目内规则。
|
|
68
68
|
|
|
69
|
+
## 🧩 插件服务工作流
|
|
70
|
+
|
|
71
|
+
从当前版本开始,`@quicktvui/ai` 注入的规则也会约束 AI 如何联调电视插件服务:
|
|
72
|
+
|
|
73
|
+
1. 优先使用 `quicktvui-ai-mcp` 的插件工具:`plugin_server_check`、`plugin_server_status`、`plugin_upload_so`、`plugin_upload_plugin`
|
|
74
|
+
2. 没有 MCP 时,退回 `quicktvui-ai plugin-*`
|
|
75
|
+
3. 只有两者都不可用时,才允许 AI 手写 `adb` / `curl`
|
|
76
|
+
|
|
77
|
+
包内同时提供了可检索的插件服务文档:
|
|
78
|
+
|
|
79
|
+
- `node_modules/@quicktvui/ai/rules/.docs/zh-CN/tool/api/plugin-server-api.md`
|
|
80
|
+
- `node_modules/@quicktvui/ai/rules/.docs/zh-CN/tool/cli/plugin-server.md`
|
|
81
|
+
|
|
82
|
+
规则会强制 AI 先打开 Toolkit `RESTFUL_API`,并要求:
|
|
83
|
+
|
|
84
|
+
- 接口返回优先于 Markdown 文档
|
|
85
|
+
- ABI 必须匹配 `ro.product.cpu.abi`
|
|
86
|
+
- `uploadSo` 调用时优先同时传 `pkg` 和 `tag`
|
|
87
|
+
- 默认测试标识使用 `eskit.so.ffmpeg.command` 与 `eskit.plugin.imagequality`
|
|
88
|
+
|
|
89
|
+
## 🏗️ 插件脚手架工作流
|
|
90
|
+
|
|
91
|
+
从当前版本开始,`@quicktvui/ai` 注入的规则还会约束 AI 如何创建 Android 插件工程、原生模块与原生组件:
|
|
92
|
+
|
|
93
|
+
1. 优先使用 `quicktvui-ai-mcp`:`plugin_project_create`、`plugin_project_build`、`plugin_module_create`、`plugin_component_create`
|
|
94
|
+
2. 没有 MCP 时,退回 `quicktvui-ai plugin-create-project`、`plugin-build`、`plugin-create-module`、`plugin-create-component`
|
|
95
|
+
3. 只有两者都不可用时,才允许 AI 手工修改脚手架
|
|
96
|
+
|
|
97
|
+
包内同步提供了可检索文档:
|
|
98
|
+
|
|
99
|
+
- `node_modules/@quicktvui/ai/rules/.docs/zh-CN/tool/cli/plugin-create-project.md`
|
|
100
|
+
- `node_modules/@quicktvui/ai/rules/.docs/zh-CN/tool/cli/plugin-create-module.md`
|
|
101
|
+
- `node_modules/@quicktvui/ai/rules/.docs/zh-CN/tool/cli/plugin-create-component.md`
|
|
102
|
+
- `node_modules/@quicktvui/ai/rules/.docs/zh-CN/tool/api/plugin-scaffold-mcp.md`
|
|
103
|
+
|
|
104
|
+
规则会进一步强制 AI:
|
|
105
|
+
|
|
106
|
+
- 先根据需求区分“无界面模块”还是“有界面组件”
|
|
107
|
+
- 以 `.source/sdk/base/...` 中的真实接口为准,而不是旧版 markdown 包名
|
|
108
|
+
- 创建工程后写入 `.kyy-plugin-project.json`
|
|
109
|
+
- 子目录工程自动补 `build:android-plugin`
|
|
110
|
+
- 组件必须补 `docs/component/<kebab-name>.md`
|
|
111
|
+
- Vue 标签必须使用 `kebab-case`
|
|
112
|
+
|
|
69
113
|
---
|
|
70
114
|
|
|
71
115
|
## 🤖 支持的 AI 工具与配置
|
package/package.json
CHANGED
package/rules/.clinerules
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: .clinerules
|
|
3
|
-
version:
|
|
3
|
+
version: 1.1.14
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# .clinerules - QuickTVUI AI Development Guide
|
|
@@ -83,6 +83,146 @@ Hard requirements:
|
|
|
83
83
|
- If user asks to launch a specific ES app/version/source, run:
|
|
84
84
|
`quicktvui-ai run-esapp --project <project-path> --pkg <es-package> [options]`
|
|
85
85
|
|
|
86
|
+
## Runtime Debug Data Workflow (CRITICAL)
|
|
87
|
+
|
|
88
|
+
When the user asks AI to inspect runtime logs, native logs, screenshots, or target state:
|
|
89
|
+
|
|
90
|
+
1. Prefer connected `@quicktvui/ai-debug-mcp`
|
|
91
|
+
2. Otherwise use `quicktvui-ai debug-*`
|
|
92
|
+
3. Only ask the user to paste logs manually when neither path is available
|
|
93
|
+
|
|
94
|
+
Required CLI order:
|
|
95
|
+
|
|
96
|
+
1. `quicktvui-ai debug-targets --base-url http://127.0.0.1:38989`
|
|
97
|
+
2. resolve `clientId`
|
|
98
|
+
3. `quicktvui-ai debug-context --client-id <clientId>`
|
|
99
|
+
4. `quicktvui-ai debug-events --client-id <clientId> --limit 100`
|
|
100
|
+
5. `quicktvui-ai debug-native-logs --client-id <clientId> --limit 100`
|
|
101
|
+
6. `quicktvui-ai debug-screenshot --client-id <clientId> --project <project-path>`
|
|
102
|
+
|
|
103
|
+
AI MUST NOT claim it inspected runtime data unless MCP or `quicktvui-ai debug-*` actually returned it.
|
|
104
|
+
|
|
105
|
+
## Plugin Server Workflow (CRITICAL)
|
|
106
|
+
|
|
107
|
+
When the user asks AI to inspect, upload, or debug TV plugin server endpoints (`/hello`, `/status`, `/uploadSo`, `/uploadPlugin`):
|
|
108
|
+
|
|
109
|
+
1. Prefer connected `quicktvui-ai-mcp` plugin tools:
|
|
110
|
+
- `plugin_server_check`
|
|
111
|
+
- `plugin_server_hello`
|
|
112
|
+
- `plugin_server_status`
|
|
113
|
+
- `plugin_upload_so`
|
|
114
|
+
- `plugin_upload_plugin`
|
|
115
|
+
2. Otherwise use `quicktvui-ai plugin-*`
|
|
116
|
+
3. Only fall back to manual `adb` + `curl` when neither path is available
|
|
117
|
+
|
|
118
|
+
Required order:
|
|
119
|
+
|
|
120
|
+
1. Enable Toolkit RESTful API first:
|
|
121
|
+
- `quicktvui-ai plugin-enable-api --device <serial>`
|
|
122
|
+
- manual fallback: `adb -s <serial> shell am broadcast -a "eskit.sdk.core.ACTION_TOOLKIT_SETTING" --es "RESTFUL_API" "true"`
|
|
123
|
+
2. Probe readiness:
|
|
124
|
+
- `plugin_server_check`
|
|
125
|
+
- or `quicktvui-ai plugin-check --device <serial>`
|
|
126
|
+
3. Read current state:
|
|
127
|
+
- `plugin_server_status`
|
|
128
|
+
- or `quicktvui-ai plugin-status --device <serial>`
|
|
129
|
+
4. Upload So zip:
|
|
130
|
+
- choose the archive matching `ro.product.cpu.abi` on the service-corresponding device
|
|
131
|
+
- `quicktvui-ai plugin-upload-so --device <serial> --tag eskit.so.ffmpeg.command --pkg eskit.so.ffmpeg.command --file <zip-path>`
|
|
132
|
+
5. Upload plugin APK:
|
|
133
|
+
- `quicktvui-ai plugin-upload-plugin --device <serial> --pkg eskit.plugin.imagequality --file <apk-path>`
|
|
134
|
+
|
|
135
|
+
Hard requirements:
|
|
136
|
+
|
|
137
|
+
- Runtime endpoint behavior overrides markdown docs.
|
|
138
|
+
- Probe `/hello`, `/status`, `/uploadSo`, `/uploadPlugin` with `POST`, not `GET`.
|
|
139
|
+
- Resolve plugin server address in this order:
|
|
140
|
+
- explicit `baseUrl` / `--plugin-base-url`
|
|
141
|
+
- adb-connected device service address
|
|
142
|
+
- adb forward + `http://127.0.0.1:36366` when target host cannot be inferred
|
|
143
|
+
- If multiple adb devices are connected, ask the user to choose `serial` or provide service IP / `baseUrl`.
|
|
144
|
+
- If no adb-connected device exists, ask the user for service IP / `baseUrl` and never invent a developer-specific TV IP.
|
|
145
|
+
- If AI is working inside the `quicktvui-ai` repo and finds doc/runtime drift, AI MUST update the docs.
|
|
146
|
+
- `uploadSo` currently has `pkg` / `tag` drift. AI SHOULD send both fields and trust successful `data.tag`.
|
|
147
|
+
- Default demo identifiers:
|
|
148
|
+
- So package/tag: `eskit.so.ffmpeg.command`
|
|
149
|
+
- Plugin package: `eskit.plugin.imagequality`
|
|
150
|
+
- ABI MUST match `ro.product.cpu.abi` on the service-corresponding device, but AI SHOULD only resolve ABI when uploading So and SHOULD let CLI / MCP fill it on demand if `abi` is not explicitly provided.
|
|
151
|
+
- AI MUST NOT claim upload success unless MCP or CLI returned a success payload.
|
|
152
|
+
- `status.pluginList` may still be empty after `uploadPlugin` returns `registered: true`; report that exact state.
|
|
153
|
+
- `uploadPlugin` success or `registered: true` only means the package reached plugin service storage. If the task is to use the plugin from a Vue page, AI MUST still add Vue-side installation logic.
|
|
154
|
+
- After uploading a newly rebuilt or replaced plugin package, restart the host/runtime process before validating page-side usage or startup; the running host does not hot-swap new plugin bytes automatically.
|
|
155
|
+
- Consult:
|
|
156
|
+
- `node_modules/@quicktvui/ai/rules/.docs/zh-CN/tool/api/plugin-server-api.md`
|
|
157
|
+
- `node_modules/@quicktvui/ai/rules/.docs/zh-CN/tool/cli/plugin-server.md`
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
## Plugin Scaffold Workflow (CRITICAL)
|
|
161
|
+
|
|
162
|
+
When the user asks AI to create/update/build Android plugin projects, native modules, or native UI components, AI MUST use this priority:
|
|
163
|
+
|
|
164
|
+
1. Prefer connected `quicktvui-ai-mcp` tools:
|
|
165
|
+
- `plugin_project_create`
|
|
166
|
+
- `plugin_project_build`
|
|
167
|
+
- `plugin_module_create`
|
|
168
|
+
- `plugin_component_create`
|
|
169
|
+
2. Otherwise use `quicktvui-ai`:
|
|
170
|
+
- `plugin-create-project`
|
|
171
|
+
- `plugin-build`
|
|
172
|
+
- `plugin-create-module`
|
|
173
|
+
- `plugin-create-component`
|
|
174
|
+
3. Only if neither MCP nor CLI execution is available may AI scaffold manually
|
|
175
|
+
|
|
176
|
+
Decision rules:
|
|
177
|
+
|
|
178
|
+
- Project init / update / packaging -> `plugin_project_create` / `plugin_project_build`
|
|
179
|
+
- Non-UI native capability -> `plugin_module_create`
|
|
180
|
+
- Native View + props/events/functions -> `plugin_component_create`
|
|
181
|
+
|
|
182
|
+
Hard requirements:
|
|
183
|
+
|
|
184
|
+
- Read these packaged docs first:
|
|
185
|
+
- `node_modules/@quicktvui/ai/rules/.docs/zh-CN/tool/cli/plugin-create-project.md`
|
|
186
|
+
- `node_modules/@quicktvui/ai/rules/.docs/zh-CN/tool/cli/plugin-create-module.md`
|
|
187
|
+
- `node_modules/@quicktvui/ai/rules/.docs/zh-CN/tool/cli/plugin-create-component.md`
|
|
188
|
+
- `node_modules/@quicktvui/ai/rules/.docs/zh-CN/tool/api/plugin-scaffold-mcp.md`
|
|
189
|
+
- Source-of-truth interfaces come from `.source/sdk/base/...`:
|
|
190
|
+
- `com.quicktvui.sdk.base.module.IEsModule`
|
|
191
|
+
- `com.quicktvui.sdk.base.component.IEsComponent`
|
|
192
|
+
- `com.quicktvui.sdk.base.component.IEsComponentView`
|
|
193
|
+
- `com.quicktvui.sdk.base.component.EsComponentAttribute`
|
|
194
|
+
- Project creation MUST write `.kyy-plugin-project.json`
|
|
195
|
+
- By default, long-lived or releasable plugin projects SHOULD live under `<project-root>/plugin/<plugin-name>`
|
|
196
|
+
- Plugin projects MUST NOT default to hidden directories such as `.ai-test/*` or other dot-prefixed paths
|
|
197
|
+
- If plugin project is under a workspace subdirectory and root has `package.json`, AI MUST inject `build:android-plugin`
|
|
198
|
+
- Build order MUST be:
|
|
199
|
+
1. `npm run build:android-plugin`
|
|
200
|
+
2. `npm run build:plugin`
|
|
201
|
+
3. `npm run build`
|
|
202
|
+
4. `./gradlew assembleGeneralDebug`
|
|
203
|
+
- If plugin build reports missing Android SDK, resolve SDK generically in this order: `ANDROID_SDK_ROOT` -> `ANDROID_HOME` -> platform default SDK directories.
|
|
204
|
+
- If SDK is found and the target plugin project lacks `local.properties` / `sdk.dir`, allow CLI / MCP to create or update that local file for the current machine only.
|
|
205
|
+
- Never turn one developer's local Android SDK path into a shared rule, hardcoded project setting, or committed repository file.
|
|
206
|
+
- Module/component generation MUST require a concrete feature description first
|
|
207
|
+
- Java package segments MUST be valid identifiers; do NOT place kebab-case directly into Java package names
|
|
208
|
+
- Component generation MUST create/update `docs/component/<kebab-name>.md`
|
|
209
|
+
- Component tags MUST be kebab-case
|
|
210
|
+
- In Vue `h()`, do NOT use the fully-qualified Java class name
|
|
211
|
+
- Read plugin runtime installation references when the page must really use the plugin:
|
|
212
|
+
- `node_modules/@quicktvui/ai/rules/.docs/zh-CN/module/plugin.md`
|
|
213
|
+
- `node_modules/@quicktvui/ai/rules/.docs/examples/module/plugin/es-basic.vue`
|
|
214
|
+
- `node_modules/@quicktvui/ai/rules/.source/quicktvui/src/long-image/index.vue`
|
|
215
|
+
- Build/upload success does NOT mean the Vue page can already use the plugin.
|
|
216
|
+
- If a Vue page depends on the plugin, use `useESPlugin()` from `@extscreen/es3-core`, add listeners in `onESCreate`, and remove them in `onESDestroy`.
|
|
217
|
+
- For component plugins, call `useES().isComponentRegistered("<fully-qualified-component-class>")` before using the component, and install the plugin first when registration is still missing.
|
|
218
|
+
- Gate plugin-dependent rendering and calls on installation / registration readiness instead of assuming upload or install finishes synchronously.
|
|
219
|
+
- Scaffold structure should follow `.source/sdk/base/...`, but live device logs override the default runtime namespace when startup fails.
|
|
220
|
+
- If logs show `ClassNotFoundException: com.quicktvui.sdk.base.core.EsProxy` or missing `com.quicktvui.sdk.base.*`, treat that as runtime compatibility drift and adapt runtime-facing imports/registration to the namespace actually present on the device before rebuilding/reuploading.
|
|
221
|
+
- If logs show `java.lang.NoSuchMethodError: No static method get()Leskit/sdk/support/core/EsProxy;`, treat that as a bytecode-signature mismatch in the plugin registration entry, realign `EsProxy.get()` usage / registration to the actual device runtime signature, then rebuild/reupload.
|
|
222
|
+
- Do not confuse local stub compilation with device runtime availability.
|
|
223
|
+
- After install success, allow a short retry/recheck window if registration is still briefly missing.
|
|
224
|
+
- After reuploading a compatibility-fixed plugin build, restart the host/runtime process before retesting.
|
|
225
|
+
- If docs drift from source or implementation, AI MUST update docs
|
|
86
226
|
|
|
87
227
|
## Game Loop & Timer Constraints (CRITICAL)
|
|
88
228
|
|
package/rules/.cursorrules
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: .cursorrules
|
|
3
|
-
version:
|
|
3
|
+
version: 1.1.14
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# .cursorrules - QuickTVUI AI Development Guide
|
|
@@ -83,6 +83,146 @@ Hard requirements:
|
|
|
83
83
|
- If user asks to launch a specific ES app/version/source, run:
|
|
84
84
|
`quicktvui-ai run-esapp --project <project-path> --pkg <es-package> [options]`
|
|
85
85
|
|
|
86
|
+
## Runtime Debug Data Workflow (CRITICAL)
|
|
87
|
+
|
|
88
|
+
When the user asks AI to inspect runtime logs, native logs, screenshots, or target state:
|
|
89
|
+
|
|
90
|
+
1. Prefer connected `@quicktvui/ai-debug-mcp`
|
|
91
|
+
2. Otherwise use `quicktvui-ai debug-*`
|
|
92
|
+
3. Only ask the user to paste logs manually when neither path is available
|
|
93
|
+
|
|
94
|
+
Required CLI order:
|
|
95
|
+
|
|
96
|
+
1. `quicktvui-ai debug-targets --base-url http://127.0.0.1:38989`
|
|
97
|
+
2. resolve `clientId`
|
|
98
|
+
3. `quicktvui-ai debug-context --client-id <clientId>`
|
|
99
|
+
4. `quicktvui-ai debug-events --client-id <clientId> --limit 100`
|
|
100
|
+
5. `quicktvui-ai debug-native-logs --client-id <clientId> --limit 100`
|
|
101
|
+
6. `quicktvui-ai debug-screenshot --client-id <clientId> --project <project-path>`
|
|
102
|
+
|
|
103
|
+
AI MUST NOT claim it inspected runtime data unless MCP or `quicktvui-ai debug-*` actually returned it.
|
|
104
|
+
|
|
105
|
+
## Plugin Server Workflow (CRITICAL)
|
|
106
|
+
|
|
107
|
+
When the user asks AI to inspect, upload, or debug TV plugin server endpoints (`/hello`, `/status`, `/uploadSo`, `/uploadPlugin`):
|
|
108
|
+
|
|
109
|
+
1. Prefer connected `quicktvui-ai-mcp` plugin tools:
|
|
110
|
+
- `plugin_server_check`
|
|
111
|
+
- `plugin_server_hello`
|
|
112
|
+
- `plugin_server_status`
|
|
113
|
+
- `plugin_upload_so`
|
|
114
|
+
- `plugin_upload_plugin`
|
|
115
|
+
2. Otherwise use `quicktvui-ai plugin-*`
|
|
116
|
+
3. Only fall back to manual `adb` + `curl` when neither path is available
|
|
117
|
+
|
|
118
|
+
Required order:
|
|
119
|
+
|
|
120
|
+
1. Enable Toolkit RESTful API first:
|
|
121
|
+
- `quicktvui-ai plugin-enable-api --device <serial>`
|
|
122
|
+
- manual fallback: `adb -s <serial> shell am broadcast -a "eskit.sdk.core.ACTION_TOOLKIT_SETTING" --es "RESTFUL_API" "true"`
|
|
123
|
+
2. Probe readiness:
|
|
124
|
+
- `plugin_server_check`
|
|
125
|
+
- or `quicktvui-ai plugin-check --device <serial>`
|
|
126
|
+
3. Read current state:
|
|
127
|
+
- `plugin_server_status`
|
|
128
|
+
- or `quicktvui-ai plugin-status --device <serial>`
|
|
129
|
+
4. Upload So zip:
|
|
130
|
+
- choose the archive matching `ro.product.cpu.abi` on the service-corresponding device
|
|
131
|
+
- `quicktvui-ai plugin-upload-so --device <serial> --tag eskit.so.ffmpeg.command --pkg eskit.so.ffmpeg.command --file <zip-path>`
|
|
132
|
+
5. Upload plugin APK:
|
|
133
|
+
- `quicktvui-ai plugin-upload-plugin --device <serial> --pkg eskit.plugin.imagequality --file <apk-path>`
|
|
134
|
+
|
|
135
|
+
Hard requirements:
|
|
136
|
+
|
|
137
|
+
- Runtime endpoint behavior overrides markdown docs.
|
|
138
|
+
- Probe `/hello`, `/status`, `/uploadSo`, `/uploadPlugin` with `POST`, not `GET`.
|
|
139
|
+
- Resolve plugin server address in this order:
|
|
140
|
+
- explicit `baseUrl` / `--plugin-base-url`
|
|
141
|
+
- adb-connected device service address
|
|
142
|
+
- adb forward + `http://127.0.0.1:36366` when target host cannot be inferred
|
|
143
|
+
- If multiple adb devices are connected, ask the user to choose `serial` or provide service IP / `baseUrl`.
|
|
144
|
+
- If no adb-connected device exists, ask the user for service IP / `baseUrl` and never invent a developer-specific TV IP.
|
|
145
|
+
- If AI is working inside the `quicktvui-ai` repo and finds doc/runtime drift, AI MUST update the docs.
|
|
146
|
+
- `uploadSo` currently has `pkg` / `tag` drift. AI SHOULD send both fields and trust successful `data.tag`.
|
|
147
|
+
- Default demo identifiers:
|
|
148
|
+
- So package/tag: `eskit.so.ffmpeg.command`
|
|
149
|
+
- Plugin package: `eskit.plugin.imagequality`
|
|
150
|
+
- ABI MUST match `ro.product.cpu.abi` on the service-corresponding device, but AI SHOULD only resolve ABI when uploading So and SHOULD let CLI / MCP fill it on demand if `abi` is not explicitly provided.
|
|
151
|
+
- AI MUST NOT claim upload success unless MCP or CLI returned a success payload.
|
|
152
|
+
- `status.pluginList` may still be empty after `uploadPlugin` returns `registered: true`; report that exact state.
|
|
153
|
+
- `uploadPlugin` success or `registered: true` only means the package reached plugin service storage. If the task is to use the plugin from a Vue page, AI MUST still add Vue-side installation logic.
|
|
154
|
+
- After uploading a newly rebuilt or replaced plugin package, restart the host/runtime process before validating page-side usage or startup; the running host does not hot-swap new plugin bytes automatically.
|
|
155
|
+
- Consult:
|
|
156
|
+
- `node_modules/@quicktvui/ai/rules/.docs/zh-CN/tool/api/plugin-server-api.md`
|
|
157
|
+
- `node_modules/@quicktvui/ai/rules/.docs/zh-CN/tool/cli/plugin-server.md`
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
## Plugin Scaffold Workflow (CRITICAL)
|
|
161
|
+
|
|
162
|
+
When the user asks AI to create/update/build Android plugin projects, native modules, or native UI components, AI MUST use this priority:
|
|
163
|
+
|
|
164
|
+
1. Prefer connected `quicktvui-ai-mcp` tools:
|
|
165
|
+
- `plugin_project_create`
|
|
166
|
+
- `plugin_project_build`
|
|
167
|
+
- `plugin_module_create`
|
|
168
|
+
- `plugin_component_create`
|
|
169
|
+
2. Otherwise use `quicktvui-ai`:
|
|
170
|
+
- `plugin-create-project`
|
|
171
|
+
- `plugin-build`
|
|
172
|
+
- `plugin-create-module`
|
|
173
|
+
- `plugin-create-component`
|
|
174
|
+
3. Only if neither MCP nor CLI execution is available may AI scaffold manually
|
|
175
|
+
|
|
176
|
+
Decision rules:
|
|
177
|
+
|
|
178
|
+
- Project init / update / packaging -> `plugin_project_create` / `plugin_project_build`
|
|
179
|
+
- Non-UI native capability -> `plugin_module_create`
|
|
180
|
+
- Native View + props/events/functions -> `plugin_component_create`
|
|
181
|
+
|
|
182
|
+
Hard requirements:
|
|
183
|
+
|
|
184
|
+
- Read these packaged docs first:
|
|
185
|
+
- `node_modules/@quicktvui/ai/rules/.docs/zh-CN/tool/cli/plugin-create-project.md`
|
|
186
|
+
- `node_modules/@quicktvui/ai/rules/.docs/zh-CN/tool/cli/plugin-create-module.md`
|
|
187
|
+
- `node_modules/@quicktvui/ai/rules/.docs/zh-CN/tool/cli/plugin-create-component.md`
|
|
188
|
+
- `node_modules/@quicktvui/ai/rules/.docs/zh-CN/tool/api/plugin-scaffold-mcp.md`
|
|
189
|
+
- Source-of-truth interfaces come from `.source/sdk/base/...`:
|
|
190
|
+
- `com.quicktvui.sdk.base.module.IEsModule`
|
|
191
|
+
- `com.quicktvui.sdk.base.component.IEsComponent`
|
|
192
|
+
- `com.quicktvui.sdk.base.component.IEsComponentView`
|
|
193
|
+
- `com.quicktvui.sdk.base.component.EsComponentAttribute`
|
|
194
|
+
- Project creation MUST write `.kyy-plugin-project.json`
|
|
195
|
+
- By default, long-lived or releasable plugin projects SHOULD live under `<project-root>/plugin/<plugin-name>`
|
|
196
|
+
- Plugin projects MUST NOT default to hidden directories such as `.ai-test/*` or other dot-prefixed paths
|
|
197
|
+
- If plugin project is under a workspace subdirectory and root has `package.json`, AI MUST inject `build:android-plugin`
|
|
198
|
+
- Build order MUST be:
|
|
199
|
+
1. `npm run build:android-plugin`
|
|
200
|
+
2. `npm run build:plugin`
|
|
201
|
+
3. `npm run build`
|
|
202
|
+
4. `./gradlew assembleGeneralDebug`
|
|
203
|
+
- If plugin build reports missing Android SDK, resolve SDK generically in this order: `ANDROID_SDK_ROOT` -> `ANDROID_HOME` -> platform default SDK directories.
|
|
204
|
+
- If SDK is found and the target plugin project lacks `local.properties` / `sdk.dir`, allow CLI / MCP to create or update that local file for the current machine only.
|
|
205
|
+
- Never turn one developer's local Android SDK path into a shared rule, hardcoded project setting, or committed repository file.
|
|
206
|
+
- Module/component generation MUST require a concrete feature description first
|
|
207
|
+
- Java package segments MUST be valid identifiers; do NOT place kebab-case directly into Java package names
|
|
208
|
+
- Component generation MUST create/update `docs/component/<kebab-name>.md`
|
|
209
|
+
- Component tags MUST be kebab-case
|
|
210
|
+
- In Vue `h()`, do NOT use the fully-qualified Java class name
|
|
211
|
+
- Read plugin runtime installation references when the page must really use the plugin:
|
|
212
|
+
- `node_modules/@quicktvui/ai/rules/.docs/zh-CN/module/plugin.md`
|
|
213
|
+
- `node_modules/@quicktvui/ai/rules/.docs/examples/module/plugin/es-basic.vue`
|
|
214
|
+
- `node_modules/@quicktvui/ai/rules/.source/quicktvui/src/long-image/index.vue`
|
|
215
|
+
- Build/upload success does NOT mean the Vue page can already use the plugin.
|
|
216
|
+
- If a Vue page depends on the plugin, use `useESPlugin()` from `@extscreen/es3-core`, add listeners in `onESCreate`, and remove them in `onESDestroy`.
|
|
217
|
+
- For component plugins, call `useES().isComponentRegistered("<fully-qualified-component-class>")` before using the component, and install the plugin first when registration is still missing.
|
|
218
|
+
- Gate plugin-dependent rendering and calls on installation / registration readiness instead of assuming upload or install finishes synchronously.
|
|
219
|
+
- Scaffold structure should follow `.source/sdk/base/...`, but live device logs override the default runtime namespace when startup fails.
|
|
220
|
+
- If logs show `ClassNotFoundException: com.quicktvui.sdk.base.core.EsProxy` or missing `com.quicktvui.sdk.base.*`, treat that as runtime compatibility drift and adapt runtime-facing imports/registration to the namespace actually present on the device before rebuilding/reuploading.
|
|
221
|
+
- If logs show `java.lang.NoSuchMethodError: No static method get()Leskit/sdk/support/core/EsProxy;`, treat that as a bytecode-signature mismatch in the plugin registration entry, realign `EsProxy.get()` usage / registration to the actual device runtime signature, then rebuild/reupload.
|
|
222
|
+
- Do not confuse local stub compilation with device runtime availability.
|
|
223
|
+
- After install success, allow a short retry/recheck window if registration is still briefly missing.
|
|
224
|
+
- After reuploading a compatibility-fixed plugin build, restart the host/runtime process before retesting.
|
|
225
|
+
- If docs drift from source or implementation, AI MUST update docs
|
|
86
226
|
|
|
87
227
|
## Game Loop & Timer Constraints (CRITICAL)
|
|
88
228
|
|
|
@@ -94,6 +94,10 @@ qt.view.requestFocus(viewRef)
|
|
|
94
94
|
| `qt.brightness` | ESBrightness | [点击查看详细API](/zh-CN/module/brightness#exposes) |
|
|
95
95
|
| `qt.service` | ESService | [点击查看详细API](/zh-CN/module/service#exposes) |
|
|
96
96
|
|
|
97
|
+
## QuickTVUI AI 插件接口工作流
|
|
98
|
+
|
|
99
|
+
* 插件服务接口 [`plugin-server-api`](/zh-CN/tool/api/plugin-server-api)
|
|
100
|
+
* 插件脚手架 MCP [`plugin-scaffold-mcp`](/zh-CN/tool/api/plugin-scaffold-mcp)
|
|
97
101
|
|
|
98
102
|
|
|
99
103
|
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Plugin Scaffold MCP
|
|
3
|
+
lang: zh-CN
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 插件创建 MCP 工具
|
|
7
|
+
|
|
8
|
+
## 一、工具列表
|
|
9
|
+
|
|
10
|
+
| 工具 | 用途 |
|
|
11
|
+
| ---- | ---- |
|
|
12
|
+
| `plugin_project_create` | 创建或更新插件工程 |
|
|
13
|
+
| `plugin_project_build` | 打包插件工程 |
|
|
14
|
+
| `plugin_module_create` | 创建无界面原生模块 |
|
|
15
|
+
| `plugin_component_create` | 创建有界面原生组件 |
|
|
16
|
+
|
|
17
|
+
## 二、使用优先级
|
|
18
|
+
|
|
19
|
+
当 AI 在支持 MCP 的客户端中工作时,插件创建类任务应优先调用上述工具,而不是直接手写文件。
|
|
20
|
+
|
|
21
|
+
## 三、决策规则
|
|
22
|
+
|
|
23
|
+
1. 创建工程或打包工程:使用 `plugin_project_create` / `plugin_project_build`
|
|
24
|
+
2. 无独立原生 UI 的原生能力:使用 `plugin_module_create`
|
|
25
|
+
3. 有原生 View、属性、事件、方法的能力:使用 `plugin_component_create`
|
|
26
|
+
|
|
27
|
+
## 四、硬约束
|
|
28
|
+
|
|
29
|
+
1. 真实源码优先于 markdown 文档
|
|
30
|
+
2. `plugin_module_create` 必须按 `com.quicktvui.sdk.base.module.IEsModule` 生成
|
|
31
|
+
3. `plugin_component_create` 必须按 `com.quicktvui.sdk.base.component.IEsComponent`、`IEsComponentView`、`EsComponentAttribute` 生成
|
|
32
|
+
4. 组件必须补 `docs/component/<name>.md`
|
|
33
|
+
5. 组件标签必须使用 `kebab-case`
|
|
34
|
+
6. `plugin_project_build` 构建前应优先复用 CLI 的通用 Android SDK 探测逻辑:先看 `ANDROID_SDK_ROOT` / `ANDROID_HOME`,再看平台默认 SDK 目录
|
|
35
|
+
7. 如探测到 SDK 且目标工程缺少 `local.properties` / `sdk.dir`,允许工具在目标插件工程内自动补齐本地 `local.properties`
|
|
36
|
+
8. `local.properties` 只属于开发机本地配置,不应作为共享工程规则提交
|
|
37
|
+
9. 长期保留或准备发布的插件工程,默认应创建到项目根目录下可见的 `plugin/<plugin-name>`
|
|
38
|
+
10. 不要把插件工程默认创建到 `.ai-test/*` 等隐藏目录
|
|
39
|
+
11. 插件工程打包成功或插件包上传成功,并不代表 Vue 页面已经可直接使用插件
|
|
40
|
+
12. 如果页面里要实际使用插件,AI 还必须补齐 Vue 侧安装逻辑:`useESPlugin()`、`addListener` / `removeListener`、`installPlugin({ pkg })`
|
|
41
|
+
13. 对于组件型插件,优先参考 `module/plugin` 文档与 `quicktvui/src/long-image/index.vue`,先用 `useES().isComponentRegistered("<组件完整类名>")` 检查注册状态,再决定是否安装或渲染
|
|
42
|
+
14. 脚手架结构默认按 `.source/sdk/base/...` 生成,但一旦设备日志显示 `ClassNotFoundException: com.quicktvui.sdk.base.core.EsProxy` 或缺失 `com.quicktvui.sdk.base.*`,应立即把运行时日志视为更高优先级的兼容性信号
|
|
43
|
+
15. 这类报错通常表示本地 stub 可编译,但目标 TV 运行时只暴露旧命名空间;AI 应切换运行时侧注册/导入到设备真实存在的命名空间后重新构建、重传
|
|
44
|
+
16. 页面侧收到安装成功回调后,如注册状态仍短暂不可见,允许一个简短轮询复查窗口,再决定是否判定失败
|
|
45
|
+
17. 如果设备日志出现 `java.lang.NoSuchMethodError: No static method get()Leskit/sdk/support/core/EsProxy;`,应视为插件注册入口的字节码签名不兼容,而不是页面逻辑问题;AI 应按设备真实 runtime 的 `EsProxy.get()` 签名 / 调用路径调整注册实现后重新构建、重传
|
|
46
|
+
18. 如果是为修复运行时兼容性而重新上传的新插件版本,AI 在复测前必须先重启宿主 / runtime 进程,否则当前进程仍可能持有旧插件字节码
|