@quicktvui/ai 1.0.2 → 1.0.4

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 CHANGED
@@ -11,7 +11,7 @@ QuickTVUI 官方提供的 AI 辅助开发规范包。
11
11
  - `.clinerules` (供 Cline/Roo-Code 使用)
12
12
  - `.github/copilot-instructions.md` (供 GitHub Copilot 使用)
13
13
  - `GEMINI.md` / `CLAUDE.md` / `AGENTS.md` (供其他模型使用)
14
- - `.docs/` (本地轻量级 QuickTVUI 知识库)
14
+ - `node_modules/@quicktvui/ai/rules/.docs/` (本地轻量级 QuickTVUI 知识库)
15
15
 
16
16
  这些规则会强制 AI:
17
17
  1. **停止捏造标签**(如禁止使用 `qt-web-view`,强制使用 `qt-web`)。
@@ -33,4 +33,4 @@ yarn add @quicktvui/ai --dev
33
33
 
34
34
  ## 验证
35
35
 
36
- 安装完毕后,请检查你的项目根目录是否多出了 `.cursorrules` 等文件以及 `.docs` 目录。如果有,说明注入成功,尽情享受不踩坑的 AI 编程体验吧!
36
+ 安装完毕后,请检查你的项目根目录是否多出了 `.cursorrules` 等文件。如果有,说明注入成功,尽情享受不踩坑的 AI 编程体验吧!(注:`.docs` 文档库现在直接引用 `node_modules` 路径,不再复制到根目录)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quicktvui/ai",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "QuickTVUI AI 开发规范与脚手架注入工具",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/postinstall.js CHANGED
@@ -41,7 +41,7 @@ function copyDirectorySync(src, dest) {
41
41
  }
42
42
 
43
43
  try {
44
- const rootItems = fs.readdirSync(rulesDir);
44
+ const rootItems = fs.readdirSync(rulesDir).filter((item) => item !== ".docs");
45
45
  let backupNeeded = false;
46
46
 
47
47
  // 1. 检查并备份现有配置
@@ -69,7 +69,15 @@ try {
69
69
  }
70
70
 
71
71
  // 2. 注入新规则
72
- copyDirectorySync(rulesDir, projectRoot);
72
+ rootItems.forEach((item) => {
73
+ const srcPath = path.join(rulesDir, item);
74
+ const destPath = path.join(projectRoot, item);
75
+ if (fs.lstatSync(srcPath).isDirectory()) {
76
+ copyDirectorySync(srcPath, destPath);
77
+ } else {
78
+ fs.copyFileSync(srcPath, destPath);
79
+ }
80
+ });
73
81
  console.log("🎉 [@quicktvui/ai] AI 规范注入成功!");
74
82
 
75
83
  // 3. 更新 .gitignore
@@ -12,7 +12,7 @@
12
12
  - 子元素跟随焦点状态:`:duplicateParentState="true"`
13
13
  - 文字用 `<span>` 或 `<qt-text>` 包裹
14
14
  - 所有元素显式指定 width/height(px)
15
- - 不用写 `display: flex`,默认就是 flex,默认 flex-direction: column
15
+ - 必须声明 `display: flex;`,QuickTVUI 仅支持 flex 布局,默认 flex-direction: column
16
16
  - 不支持 %、auto、vh/vw、grid、动画、阴影、CSS 简写属性
17
17
  - 横向列表用 `<ul :horizontal="true">`
18
18
  - 设置 border 必须同时设置 border-color
package/rules/.clinerules CHANGED
@@ -6,14 +6,14 @@
6
6
 
7
7
  **AI MUST refer to the official documentation and source code below BEFORE generating any code. NEVER hallucinate component names, attribute names, or APIs. These are the ONLY authorities.**
8
8
 
9
- 1. **Local Documentation (PRIMARY)**: The `.docs/` folder in the project root. Contains detailed MD documentation for all components, CSS, and native modules. **AI MUST use `grep_search` or `read_file` to retrieve relevant content from the `.docs/` directory before generating code.**
9
+ 1. **Local Documentation (PRIMARY)**: The `node_modules/@quicktvui/ai/rules/.docs/` folder. Contains detailed MD documentation for all components, CSS, and native modules. **AI MUST use `grep_search` or `read_file` to retrieve relevant content from the `node_modules/@quicktvui/ai/rules/.docs/` directory before generating code.**
10
10
  2. **Official Docs**: https://quicktvui.com
11
11
  3. **Core Library Samples**: https://github.com/quicktvui/quicktvui.git
12
12
  4. **Cross-platform Framework Samples**: https://github.com/quicktvui/es-vue3.git
13
13
  5. **Best Practice App**: https://github.com/quicktvui/hellotv.git
14
14
 
15
15
  **STRICT RULES:**
16
- - **VERIFY CAPABILITIES FIRST**: Before implementing features like "video playback," search the `.docs/` directory to verify component capabilities. DO NOT assume web behavior. **For example, `qt-web-view` does NOT support video playback; you MUST use the native `es-video-player` and `es-player-manager` components.**
16
+ - **VERIFY CAPABILITIES FIRST**: Before implementing features like "video playback," search the `node_modules/@quicktvui/ai/rules/.docs/` directory to verify component capabilities. DO NOT assume web behavior. **For example, `qt-web-view` does NOT support video playback; you MUST use the native `es-video-player` and `es-player-manager` components.**
17
17
  - **NOT A BROWSER & NO HTML**: **This framework does NOT support HTML. Standard HTML tags (like `p`, `img`, `a`, `ul`, `li`, `h1`) are STRICTLY PROHIBITED. It does NOT support `window`, `document` (DOM), or DOM APIs. You must exclusively use framework tags (like `qt-text`, `qt-image`) and Vue `ref`s.**
18
18
  - **NO HALLUCINATED TAGS**: e.g. `qt-web` is wrong, it is `qt-web-view`.
19
19
  - **NO HALLUCINATED APIs**: e.g. `onBack` is wrong, it must be `onBackPressed`.
@@ -126,7 +126,7 @@ Other CSS rules:
126
126
  - **CRITICAL: Static styles MUST be in `<style>` (kebab-case), Dynamic styles MUST be in `:style` attributes.**
127
127
  - **CRITICAL: NO `-webkit-font-smoothing: antialiased;`**. This is not supported.
128
128
  - **CRITICAL: ONLY use `div` and `span` for standard tags.** Do NOT use `p`, `h1-h6`, `section`, etc.
129
- - **CRITICAL: DEFAULT LAYOUT IS `flex-direction: column`**. Unlike web browsers, QuickTVUI defaults to vertical layout. You rarely need to specify `display: flex`.
129
+ - **CRITICAL: MANDATORY `display: flex;`**. QuickTVUI exclusively supports Flexbox layout. Every styled element MUST explicitly include `display: flex;`. The default orientation is `flex-direction: column;`.
130
130
  - Only use properties listed in "Supported Style Properties" section below
131
131
  - Do NOT use `<style scoped>` (unreliable in native rendering)
132
132
  - Only `px` units (no %, auto, vh, vw, rem, em). No CSS shorthand.
@@ -147,7 +147,7 @@ Other CSS rules:
147
147
 
148
148
  当用户通过以下方式表达困惑时:
149
149
  - **关键词触发**:用户提到“问题上报”、“碰到问题”、“反馈”、“Bug 反馈”、“还是没改好”、“运行报错”、“API 报错”等。
150
- - **自动检测触发**:同一段代码逻辑在 3 次修复后仍然报错,或 AI 确认生成的代码符合 `.docs` 规范但无法在用户端运行。
150
+ - **自动检测触发**:同一段代码逻辑在 3 次修复后仍然报错,或 AI 确认生成的代码符合 `node_modules/@quicktvui/ai/rules/.docs/` 规范 but 无法在用户端运行。
151
151
 
152
152
  **AI 执行协议:**
153
153
  1. **脱敏诊断 (Sanitized Diagnosis)**:
@@ -174,7 +174,7 @@ Other CSS rules:
174
174
 
175
175
  Only properties listed below are supported. Default layout: flexbox, flex-direction: column.
176
176
 
177
- Rules: px units only (no %, auto, vh/vw/rem/em). No CSS shorthand. No CSS variables. No `display: flex` needed. All elements MUST have explicit width/height.
177
+ Rules: px units only (no %, auto, vh/vw/rem/em). No CSS shorthand. No CSS variables. MANDATORY `display: flex;` for all elements. All elements MUST have explicit width/height.
178
178
 
179
179
  ### Layout & Size
180
180
  `width`, `height`, `left`, `top`, `overflow`, `direction`, `z-index`, `visibility`, `opacity`, `transform`
@@ -6,14 +6,14 @@
6
6
 
7
7
  **AI MUST refer to the official documentation and source code below BEFORE generating any code. NEVER hallucinate component names, attribute names, or APIs. These are the ONLY authorities.**
8
8
 
9
- 1. **Local Documentation (PRIMARY)**: The `.docs/` folder in the project root. Contains detailed MD documentation for all components, CSS, and native modules. **AI MUST use `grep_search` or `read_file` to retrieve relevant content from the `.docs/` directory before generating code.**
9
+ 1. **Local Documentation (PRIMARY)**: The `node_modules/@quicktvui/ai/rules/.docs/` folder. Contains detailed MD documentation for all components, CSS, and native modules. **AI MUST use `grep_search` or `read_file` to retrieve relevant content from the `node_modules/@quicktvui/ai/rules/.docs/` directory before generating code.**
10
10
  2. **Official Docs**: https://quicktvui.com
11
11
  3. **Core Library Samples**: https://github.com/quicktvui/quicktvui.git
12
12
  4. **Cross-platform Framework Samples**: https://github.com/quicktvui/es-vue3.git
13
13
  5. **Best Practice App**: https://github.com/quicktvui/hellotv.git
14
14
 
15
15
  **STRICT RULES:**
16
- - **VERIFY CAPABILITIES FIRST**: Before implementing features like "video playback," search the `.docs/` directory to verify component capabilities. DO NOT assume web behavior. **For example, `qt-web-view` does NOT support video playback; you MUST use the native `es-video-player` and `es-player-manager` components.**
16
+ - **VERIFY CAPABILITIES FIRST**: Before implementing features like "video playback," search the `node_modules/@quicktvui/ai/rules/.docs/` directory to verify component capabilities. DO NOT assume web behavior. **For example, `qt-web-view` does NOT support video playback; you MUST use the native `es-video-player` and `es-player-manager` components.**
17
17
  - **NOT A BROWSER & NO HTML**: **This framework does NOT support HTML. Standard HTML tags (like `p`, `img`, `a`, `ul`, `li`, `h1`) are STRICTLY PROHIBITED. It does NOT support `window`, `document` (DOM), or DOM APIs. You must exclusively use framework tags (like `qt-text`, `qt-image`) and Vue `ref`s.**
18
18
  - **NO HALLUCINATED TAGS**: e.g. `qt-web` is wrong, it is `qt-web-view`.
19
19
  - **NO HALLUCINATED APIs**: e.g. `onBack` is wrong, it must be `onBackPressed`.
@@ -126,7 +126,7 @@ Other CSS rules:
126
126
  - **CRITICAL: Static styles MUST be in `<style>` (kebab-case), Dynamic styles MUST be in `:style` attributes.**
127
127
  - **CRITICAL: NO `-webkit-font-smoothing: antialiased;`**. This is not supported.
128
128
  - **CRITICAL: ONLY use `div` and `span` for standard tags.** Do NOT use `p`, `h1-h6`, `section`, etc.
129
- - **CRITICAL: DEFAULT LAYOUT IS `flex-direction: column`**. Unlike web browsers, QuickTVUI defaults to vertical layout. You rarely need to specify `display: flex`.
129
+ - **CRITICAL: MANDATORY `display: flex;`**. QuickTVUI exclusively supports Flexbox layout. Every styled element MUST explicitly include `display: flex;`. The default orientation is `flex-direction: column;`.
130
130
  - Only use properties listed in "Supported Style Properties" section below
131
131
  - Do NOT use `<style scoped>` (unreliable in native rendering)
132
132
  - Only `px` units (no %, auto, vh, vw, rem, em). No CSS shorthand.
@@ -147,7 +147,7 @@ Other CSS rules:
147
147
 
148
148
  当用户通过以下方式表达困惑时:
149
149
  - **关键词触发**:用户提到“问题上报”、“碰到问题”、“反馈”、“Bug 反馈”、“还是没改好”、“运行报错”、“API 报错”等。
150
- - **自动检测触发**:同一段代码逻辑在 3 次修复后仍然报错,或 AI 确认生成的代码符合 `.docs` 规范但无法在用户端运行。
150
+ - **自动检测触发**:同一段代码逻辑在 3 次修复后仍然报错,或 AI 确认生成的代码符合 `node_modules/@quicktvui/ai/rules/.docs/` 规范但无法在用户端运行。
151
151
 
152
152
  **AI 执行协议:**
153
153
  1. **脱敏诊断 (Sanitized Diagnosis)**:
@@ -174,7 +174,7 @@ Other CSS rules:
174
174
 
175
175
  Only properties listed below are supported. Default layout: flexbox, flex-direction: column.
176
176
 
177
- Rules: px units only (no %, auto, vh/vw/rem/em). No CSS shorthand. No CSS variables. No `display: flex` needed. All elements MUST have explicit width/height.
177
+ Rules: px units only (no %, auto, vh/vw/rem/em). No CSS shorthand. No CSS variables. MANDATORY `display: flex;` for all elements. All elements MUST have explicit width/height.
178
178
 
179
179
  ### Layout & Size
180
180
  `width`, `height`, `left`, `top`, `overflow`, `direction`, `z-index`, `visibility`, `opacity`, `transform`
@@ -5,7 +5,8 @@ lang: zh-CN
5
5
 
6
6
  # display
7
7
 
8
- QuickTVUI 默认采用 Flex 布局。同时,因为仅支持 Flex 布局,所以不需要手写 `display: flex` 即可使用。
8
+ QuickTVUI 默认采用 Flex 布局。同时, 因为仅支持 Flex 布局,所以必须手写 `display: flex` 才能生效。
9
+
9
10
 
10
11
  | Name | Description | Type | Default |
11
12
  |--------------------|------------------|------------------------------| ------- |
@@ -28,7 +28,7 @@ lang: zh-CN
28
28
  ## 布局(Flex)
29
29
 
30
30
  默认采用现在移动端最流行的 `Flex` 布局。
31
- 因为仅支持 `Flex` 布局,所以不需要手写 `display: flex` 即可使用。
31
+ 因为仅支持 `Flex` 布局,所以必须手写 `display: flex` 才能生效。
32
32
  `Flex` 布局与 `Web` 的 `Flex` 类似,它们都旨在提供一个更加有效的方式制定、调整和分布一个容器里的项目布局,即使他们的大小是未知或者是动态的。
33
33
  `Flex` 规定了弹性元素如何伸长或缩短,以适应`flex容器`中的可用空间。
34
34
 
@@ -6,14 +6,14 @@
6
6
 
7
7
  **AI MUST refer to the official documentation and source code below BEFORE generating any code. NEVER hallucinate component names, attribute names, or APIs. These are the ONLY authorities.**
8
8
 
9
- 1. **Local Documentation (PRIMARY)**: The `.docs/` folder in the project root. Contains detailed MD documentation for all components, CSS, and native modules. **AI MUST use `grep_search` or `read_file` to retrieve relevant content from the `.docs/` directory before generating code.**
9
+ 1. **Local Documentation (PRIMARY)**: The `node_modules/@quicktvui/ai/rules/.docs/` folder. Contains detailed MD documentation for all components, CSS, and native modules. **AI MUST use `grep_search` or `read_file` to retrieve relevant content from the `node_modules/@quicktvui/ai/rules/.docs/` directory before generating code.**
10
10
  2. **Official Docs**: https://quicktvui.com
11
11
  3. **Core Library Samples**: https://github.com/quicktvui/quicktvui.git
12
12
  4. **Cross-platform Framework Samples**: https://github.com/quicktvui/es-vue3.git
13
13
  5. **Best Practice App**: https://github.com/quicktvui/hellotv.git
14
14
 
15
15
  **STRICT RULES:**
16
- - **VERIFY CAPABILITIES FIRST**: Before implementing features like "video playback," search the `.docs/` directory to verify component capabilities. DO NOT assume web behavior. **For example, `qt-web-view` does NOT support video playback; you MUST use the native `es-video-player` and `es-player-manager` components.**
16
+ - **VERIFY CAPABILITIES FIRST**: Before implementing features like "video playback," search the `node_modules/@quicktvui/ai/rules/.docs/` directory to verify component capabilities. DO NOT assume web behavior. **For example, `qt-web-view` does NOT support video playback; you MUST use the native `es-video-player` and `es-player-manager` components.**
17
17
  - **NOT A BROWSER & NO HTML**: **This framework does NOT support HTML. Standard HTML tags (like `p`, `img`, `a`, `ul`, `li`, `h1`) are STRICTLY PROHIBITED. It does NOT support `window`, `document` (DOM), or DOM APIs. You must exclusively use framework tags (like `qt-text`, `qt-image`) and Vue `ref`s.**
18
18
  - **NO HALLUCINATED TAGS**: e.g. `qt-web` is wrong, it is `qt-web-view`.
19
19
  - **NO HALLUCINATED APIs**: e.g. `onBack` is wrong, it must be `onBackPressed`.
@@ -133,7 +133,7 @@ Other CSS rules:
133
133
  - **CRITICAL: Static styles MUST be in `<style>` (kebab-case), Dynamic styles MUST be in `:style` attributes.**
134
134
  - **CRITICAL: NO `-webkit-font-smoothing: antialiased;`**. This is not supported.
135
135
  - **CRITICAL: ONLY use `div` and `span` for standard tags.** Do NOT use `p`, `h1-h6`, `section`, etc.
136
- - **CRITICAL: DEFAULT LAYOUT IS `flex-direction: column`**. Unlike web browsers, QuickTVUI defaults to vertical layout. You rarely need to specify `display: flex`.
136
+ - **CRITICAL: MANDATORY `display: flex;`**. QuickTVUI exclusively supports Flexbox layout. Every styled element MUST explicitly include `display: flex;`. The default orientation is `flex-direction: column;`.
137
137
  - Only use properties listed in "Supported Style Properties" section below
138
138
  - Do NOT use `<style scoped>` (unreliable in native rendering)
139
139
  - Only `px` units (no %, auto, vh, vw, rem, em). No CSS shorthand.
@@ -166,7 +166,7 @@ Android clips child views outside parent bounds by default. When using `focusSca
166
166
 
167
167
  Only properties listed below are supported. Default layout: flexbox, flex-direction: column.
168
168
 
169
- Rules: px units only (no %, auto, vh/vw/rem/em). No CSS shorthand. No CSS variables. No `display: flex` needed. All elements MUST have explicit width/height.
169
+ Rules: px units only (no %, auto, vh/vw/rem/em). No CSS shorthand. No CSS variables. MANDATORY `display: flex;` for all elements. All elements MUST have explicit width/height.
170
170
 
171
171
  ### Layout & Size
172
172
 
@@ -6,14 +6,14 @@
6
6
 
7
7
  **AI MUST refer to the official documentation and source code below BEFORE generating any code. NEVER hallucinate component names, attribute names, or APIs. These are the ONLY authorities.**
8
8
 
9
- 1. **Local Documentation (PRIMARY)**: The `.docs/` folder in the project root. Contains detailed MD documentation for all components, CSS, and native modules. **AI MUST use `grep_search` or `read_file` to retrieve relevant content from the `.docs/` directory before generating code.**
9
+ 1. **Local Documentation (PRIMARY)**: The `node_modules/@quicktvui/ai/rules/.docs/` folder. Contains detailed MD documentation for all components, CSS, and native modules. **AI MUST use `grep_search` or `read_file` to retrieve relevant content from the `node_modules/@quicktvui/ai/rules/.docs/` directory before generating code.**
10
10
  2. **Official Docs**: https://quicktvui.com
11
11
  3. **Core Library Samples**: https://github.com/quicktvui/quicktvui.git
12
12
  4. **Cross-platform Framework Samples**: https://github.com/quicktvui/es-vue3.git
13
13
  5. **Best Practice App**: https://github.com/quicktvui/hellotv.git
14
14
 
15
15
  **STRICT RULES:**
16
- - **VERIFY CAPABILITIES FIRST**: Before implementing features like "video playback," search the `.docs/` directory to verify component capabilities. DO NOT assume web behavior. **For example, `qt-web-view` does NOT support video playback; you MUST use the native `es-video-player` and `es-player-manager` components.**
16
+ - **VERIFY CAPABILITIES FIRST**: Before implementing features like "video playback," search the `node_modules/@quicktvui/ai/rules/.docs/` directory to verify component capabilities. DO NOT assume web behavior. **For example, `qt-web-view` does NOT support video playback; you MUST use the native `es-video-player` and `es-player-manager` components.**
17
17
  - **NOT A BROWSER & NO HTML**: **This framework does NOT support HTML. Standard HTML tags (like `p`, `img`, `a`, `ul`, `li`, `h1`) are STRICTLY PROHIBITED. It does NOT support `window`, `document` (DOM), or DOM APIs. You must exclusively use framework tags (like `qt-text`, `qt-image`) and Vue `ref`s.**
18
18
  - **NO HALLUCINATED TAGS**: e.g. `qt-web` is wrong, it is `qt-web-view`.
19
19
  - **NO HALLUCINATED APIs**: e.g. `onBack` is wrong, it must be `onBackPressed`.
@@ -126,7 +126,7 @@ Other CSS rules:
126
126
  - **CRITICAL: Static styles MUST be in `<style>` (kebab-case), Dynamic styles MUST be in `:style` attributes.**
127
127
  - **CRITICAL: NO `-webkit-font-smoothing: antialiased;`**. This is not supported.
128
128
  - **CRITICAL: ONLY use `div` and `span` for standard tags.** Do NOT use `p`, `h1-h6`, `section`, etc.
129
- - **CRITICAL: DEFAULT LAYOUT IS `flex-direction: column`**. Unlike web browsers, QuickTVUI defaults to vertical layout. You rarely need to specify `display: flex`.
129
+ - **CRITICAL: MANDATORY `display: flex;`**. QuickTVUI exclusively supports Flexbox layout. Every styled element MUST explicitly include `display: flex;`. The default orientation is `flex-direction: column;`.
130
130
  - Only use properties listed in "Supported Style Properties" section below
131
131
  - Do NOT use `<style scoped>` (unreliable in native rendering)
132
132
  - Only `px` units (no %, auto, vh, vw, rem, em). No CSS shorthand.
@@ -147,7 +147,7 @@ Other CSS rules:
147
147
 
148
148
  当用户通过以下方式表达困惑时:
149
149
  - **关键词触发**:用户提到“问题上报”、“碰到问题”、“反馈”、“Bug 反馈”、“还是没改好”、“运行报错”、“API 报错”等。
150
- - **自动检测触发**:同一段代码逻辑在 3 次修复后仍然报错,或 AI 确认生成的代码符合 `.docs` 规范但无法在用户端运行。
150
+ - **自动检测触发**:同一段代码逻辑在 3 次修复后仍然报错,或 AI 确认生成的代码符合 `node_modules/@quicktvui/ai/rules/.docs/` 规范但无法在用户端运行。
151
151
 
152
152
  **AI 执行协议:**
153
153
  1. **脱敏诊断 (Sanitized Diagnosis)**:
@@ -174,7 +174,7 @@ Other CSS rules:
174
174
 
175
175
  Only properties listed below are supported. Default layout: flexbox, flex-direction: column.
176
176
 
177
- Rules: px units only (no %, auto, vh/vw/rem/em). No CSS shorthand. No CSS variables. No `display: flex` needed. All elements MUST have explicit width/height.
177
+ Rules: px units only (no %, auto, vh/vw/rem/em). No CSS shorthand. No CSS variables. MANDATORY `display: flex;` for all elements. All elements MUST have explicit width/height.
178
178
 
179
179
  ### Layout & Size
180
180
  `width`, `height`, `left`, `top`, `overflow`, `direction`, `z-index`, `visibility`, `opacity`, `transform`
package/rules/AGENTS.md CHANGED
@@ -6,14 +6,14 @@
6
6
 
7
7
  **AI MUST refer to the official documentation and source code below BEFORE generating any code. NEVER hallucinate component names, attribute names, or APIs. These are the ONLY authorities.**
8
8
 
9
- 1. **Local Documentation (PRIMARY)**: The `.docs/` folder in the project root. Contains detailed MD documentation for all components, CSS, and native modules. **AI MUST use `grep_search` or `read_file` to retrieve relevant content from the `.docs/` directory before generating code.**
9
+ 1. **Local Documentation (PRIMARY)**: The `node_modules/@quicktvui/ai/rules/.docs/` folder. Contains detailed MD documentation for all components, CSS, and native modules. **AI MUST use `grep_search` or `read_file` to retrieve relevant content from the `node_modules/@quicktvui/ai/rules/.docs/` directory before generating code.**
10
10
  2. **Official Docs**: https://quicktvui.com (390+ docs)
11
11
  3. **Core Library Samples**: https://github.com/quicktvui/quicktvui.git (Core library + samples)
12
12
  4. **Cross-platform Framework Samples**: https://github.com/quicktvui/es-vue3.git (Cross-platform framework + samples)
13
13
  5. **Best Practice App**: https://github.com/quicktvui/hellotv.git (Complete video app)
14
14
 
15
15
  **STRICT RULES:**
16
- - **VERIFY CAPABILITIES FIRST**: Before implementing features like "video playback," search the `.docs/` directory to verify component capabilities. DO NOT assume web behavior. **For example, `qt-web-view` does NOT support video playback; you MUST use the native `es-video-player` and `es-player-manager` components.**
16
+ - **VERIFY CAPABILITIES FIRST**: Before implementing features like "video playback," search the `node_modules/@quicktvui/ai/rules/.docs/` directory to verify component capabilities. DO NOT assume web behavior. **For example, `qt-web-view` does NOT support video playback; you MUST use the native `es-video-player` and `es-player-manager` components.**
17
17
  - **NOT A BROWSER & NO HTML**: **This framework does NOT support HTML. Standard HTML tags (like `p`, `img`, `a`, `ul`, `li`, `h1`) are STRICTLY PROHIBITED. It does NOT support `window`, `document` (DOM), or DOM APIs. You must exclusively use framework tags (like `qt-text`, `qt-image`) and Vue `ref`s.**
18
18
  - **NO HALLUCINATED TAGS**: e.g. `qt-web` is wrong, it is `qt-web-view`.
19
19
  - **NO HALLUCINATED APIs**: e.g. `onBack` is wrong, it must be `onBackPressed`.
@@ -133,7 +133,7 @@ CORRECT — `<template>` tag attributes use camelCase:
133
133
 
134
134
  Other CSS rules:
135
135
 
136
- - **CRITICAL: DEFAULT LAYOUT IS `flex-direction: column`**. Unlike web browsers, QuickTVUI defaults to vertical layout. You rarely need to specify `display: flex`.
136
+ - **CRITICAL: MANDATORY `display: flex;`**. QuickTVUI exclusively supports Flexbox layout. Every styled element MUST explicitly include `display: flex;`. The default orientation is `flex-direction: column;`.
137
137
  - Only use properties listed in "Supported Style Properties" section below
138
138
  - Do NOT use `<style scoped>` (unreliable in native rendering)
139
139
  - Only `px` units (no %, auto, vh, vw, rem, em). No CSS shorthand.
@@ -158,7 +158,7 @@ Android clips child views outside parent bounds by default. When using `focusSca
158
158
 
159
159
  当用户通过以下方式表达困惑时:
160
160
  - **关键词触发**:当用户提到“问题上报”、“碰到问题”、“反馈”、“Bug 反馈”、“还是没改好”、“运行报错”、“API 报错”等。
161
- - **自动检测触发**:同一段代码逻辑在 3 次修复后仍然报错,或 AI 确认生成的代码符合 `.docs` 规范但无法在用户端运行。
161
+ - **自动检测触发**:同一段代码逻辑在 3 次修复后仍然报错,或 AI 确认生成的代码符合 `node_modules/@quicktvui/ai/rules/.docs/` 规范但无法在用户端运行。
162
162
 
163
163
  **AI 执行协议 (Execution Protocol):**
164
164
  1. **脱敏诊断 (Sanitized Diagnosis)**:
@@ -186,7 +186,7 @@ Android clips child views outside parent bounds by default. When using `focusSca
186
186
 
187
187
  Only properties listed below are supported. Default layout: flexbox, flex-direction: column.
188
188
 
189
- Rules: px units only (no %, auto, vh/vw/rem/em). No CSS shorthand. No CSS variables. No `display: flex` needed. All elements MUST have explicit width/height.
189
+ Rules: px units only (no %, auto, vh/vw/rem/em). No CSS shorthand. No CSS variables. MANDATORY `display: flex;` for all elements. All elements MUST have explicit width/height.
190
190
 
191
191
  ### Layout & Size
192
192
 
@@ -6,14 +6,14 @@
6
6
 
7
7
  **AI 在生成任何代码前,必须严格参考以下权威来源,严禁凭空想象任何组件名、属性名或 API。这是所有开发工作的唯一依据。**
8
8
 
9
- 1. **本地文档 (PRIMARY)**:项目根目录下的 `.docs/` 文件夹。包含所有组件、CSS、原生模块的详细 MD 文档。**AI 必须在生成代码前使用 `grep_search` 或 `read_file` 检索 `.docs/` 目录中的相关内容。**
9
+ 1. **本地文档 (PRIMARY)**:`node_modules/@quicktvui/ai/rules/.docs/` 目录。包含所有组件、CSS、原生模块的详细 MD 文档。**AI 必须在生成代码前使用 `grep_search` 或 `read_file` 检索 `node_modules/@quicktvui/ai/rules/.docs/` 目录中的相关内容。**
10
10
  2. **官方文档**:https://quicktvui.com (包含约 390 个详细文档)
11
11
  3. **核心库示例**:https://github.com/quicktvui/quicktvui.git (Core library + samples)
12
12
  4. **跨平台框架示例**:https://github.com/quicktvui/es-vue3.git (Cross-platform framework + samples)
13
13
  5. **最佳实践应用**:https://github.com/quicktvui/hellotv.git (Complete video app)
14
14
 
15
15
  **要求:**
16
- - **检索与能力验证优先**:在实现任何功能(如“视频播放”)前,必须先在 `.docs/` 目录中检索相关文档,验证组件是否支持该功能。切勿想当然!**例如:`qt-web-view` 绝对不支持视频播放,视频播放必须使用框架提供的专用视频组件和管理器(如 `es-video-player` 和 `es-player-manager`)。**
16
+ - **检索与能力验证优先**:在实现任何功能(如“视频播放”)前,必须先在 `node_modules/@quicktvui/ai/rules/.docs/` 目录中检索相关文档,验证组件是否支持该功能。切勿想当然!**例如:`qt-web-view` 绝对不支持视频播放,视频播放必须使用框架提供的专用视频组件和管理器(如 `es-video-player` 和 `es-player-manager`)。**
17
17
  - **非浏览器与无 HTML 环境**:**本框架绝对不支持标准 HTML 标签(如 `p`, `img`, `a`, `ul`, `li`, `h1` 等),严禁在模板中使用!绝对不支持 `window`、`document` (DOM) 对象或任何 DOM 操作 API。必须使用框架专属标签(如 `qt-text`, `qt-image`)和 Vue `ref`。**
18
18
  - **严禁自造标签**:如 `qt-web` 是错的,官方示例中是 `qt-web-view`。
19
19
  - **严禁自造 API**:如 `onBack` 是错的,必须是 `onBackPressed`。
@@ -64,7 +64,7 @@ QuickTVUI 是基于 Vue 3 的 Android TV/大屏端 UI 框架,运行在 Hippy-b
64
64
 
65
65
  1. 自动理解 QuickTVUI 框架的核心概念和约束
66
66
  2. 生成符合框架规范的 Vue 代码(焦点系统、CSS 子集、TV 交互)
67
- 3. 所有配置文件自包含、可移植,拷贝到任何 QuickTVUI 应用项目即可使用
67
+ 3. 所有配置文件引用 `@quicktvui/ai` 包内的文档库,安装包后即可使用。
68
68
 
69
69
  ## 三、已创建的文件清单
70
70
 
@@ -134,9 +134,9 @@ CSS 属性列表由框架作者直接提供,优先级高于文档推断。已
134
134
 
135
135
  ### 1. 自包含 vs 引用本地文档路径
136
136
 
137
- 最初版本引用了 `docs/zh-CN/component/<name>.md` 等本地路径,但这些路径只存在于框架源码仓库中,不存在于用户的应用项目中。
137
+ 最初版本引用了 `docs/zh-CN/component/<name>.md` 等本地路径,但这些路径只存在于框架源码仓库中,不存 在于用户的应用项目中。
138
138
 
139
- **最终方案**:所有 AI 指令文件完全自包含,将核心知识直接嵌入文件内容,不依赖任何本地文件路径。用户只需将文件拷贝到自己的项目根目录即可使用。
139
+ **最终方案**:AI 指令文件引用 `node_modules/@quicktvui/ai/rules/.docs/` 目录。用户通过安装 `@quicktvui/ai` 包即可获得这些文档。这样既保持了知识的实时性,又避免了在用户项目根目录下生成大量冗余文件。
140
140
 
141
141
  ### 2. 分层详略
142
142
 
@@ -354,7 +354,7 @@ onESCreate(params) → onESStart() → onESResume() → onESPause() → onESStop
354
354
  3. 根据"后续改进建议"选择优先级高的任务开始改进
355
355
 
356
356
  4. 改进时的关键原则:
357
- - 保持所有文件自包含、可移植
357
+ - 保持配置文件引用的路径正确、可移植
358
358
  - 从 `docs/zh-CN/` 提取知识,不要编造
359
359
  - 使用用户提供的权威 CSS 属性列表
360
360
  - 参考 3 个外部代码仓库的实际代码风格
package/rules/CLAUDE.md CHANGED
@@ -6,18 +6,18 @@
6
6
 
7
7
  **AI 在生成代码前,必须严格参考以下权威来源,严禁凭空想象任何组件名、属性名或 API。这是所有代码的唯一依据。**
8
8
 
9
- 1. **本地文档 (PRIMARY)**:项目根目录下的 `.docs/` 文件夹。包含所有组件、CSS、原生模块的详细 MD 文档。**AI 必须在生成代码前使用 `grep_search` 或 `read_file` 检索 `.docs/` 目录中的相关内容。**
9
+ 1. **本地文档 (PRIMARY)**:`node_modules/@quicktvui/ai/rules/.docs/` 目录。包含所有组件、CSS、原生模块的详细 MD 文档。**AI 必须在生成代码前使用 `grep_search` 或 `read_file` 检索 `node_modules/@quicktvui/ai/rules/.docs/` 目录中的相关内容。**
10
10
  2. **官方文档**:https://quicktvui.com (官网 390+ 篇详细文档)
11
11
  3. **核心库示例**:https://github.com/quicktvui/quicktvui.git (Core library + samples)
12
12
  4. **跨平台框架示例**:https://github.com/quicktvui/es-vue3.git (Cross-platform framework + samples)
13
13
  5. **最佳实践应用**:https://github.com/quicktvui/hellotv.git (Complete video app)
14
14
 
15
15
  **要求:**
16
- - **检索与能力验证优先**:在实现任何功能(如“视频播放”)前,必须先在 `.docs/` 目录中检索相关文档,验证组件是否支持该功能。切勿想当然!**例如:`qt-web-view` 绝对不支持视频播放,视频播放必须使用框架提供的专用视频组件和管理器(如 `es-video-player` 和 `es-player-manager`)。**
16
+ - **检索与能力验证优先**:在实现任何功能(如“视频播放”)前,必须先在 `node_modules/@quicktvui/ai/rules/.docs/` 目录中检索相关文档,验证组件是否支持该功能。切勿想当然!**例如:`qt-web-view` 绝对不支持视频播放,视频播放必须使用框架提供的专用视频组件和管理器(如 `es-video-player` 和 `es-player-manager`)。**
17
17
  - **非浏览器与无 HTML 环境**:**本框架绝对不支持标准 HTML 标签(如 `p`, `img`, `a`, `ul`, `li`, `h1` 等),严禁在模板中使用!绝对不支持 `window`、`document` (DOM) 对象或任何 DOM 操作 API。必须使用框架专属标签(如 `qt-text`, `qt-image`)和 Vue `ref`。**
18
18
  - **严禁自造标签**:如 `qt-web` 是错的,官方示例中是 `qt-web-view`。
19
19
  - **严禁自造 API**:如 `onBack` 是错的,必须是 `onBackPressed`。
20
- - **参考优先**:遇到不确定的组件用法,必须先在上述仓库中搜索同名组件的实际用法。
20
+ - **参考优先**:遇到不确定的组件用法,必须先在上述仓库或 `node_modules/@quicktvui/ai/rules/.docs/` 中搜索同名组件的实际用法。
21
21
 
22
22
  ## 快速创建项目 (Scaffolding)
23
23
 
@@ -151,9 +151,9 @@ https://quicktvui.com
151
151
  - **CRITICAL: Static styles MUST be in `<style>` (kebab-case), Dynamic styles MUST be in `:style` attributes.**
152
152
  - **CRITICAL: NO `-webkit-font-smoothing: antialiased;`**. This is not supported.
153
153
  - **CRITICAL: ONLY use `div` and `span` for standard tags.** Do NOT use `p`, `h1-h6`, `section`, etc.
154
- - **⚠️ 强制要求:默认布局为 `flex-direction: column`**。与 Web 浏览器不同,QuickTVUI 默认就是垂直布局。你几乎不需要写 `display: flex`。
154
+ - **⚠️ 强制要求:必须声明 `display: flex;`**。QuickTVUI 仅支持 Flexbox 布局,所有样式化的元素必须显式包含 `display: flex;`。默认布局方向为 `flex-direction: column;`。
155
155
  - 只有本文档"二、样式属性"章节中列出的属性才能使用
156
- - `display: flex` 和 `flex-direction: column` 是支持的,但它们是默认值,通常不需要写
156
+ - `display: flex` 和 `flex-direction: column` 是强制要求的。
157
157
  - 不要用 `<style scoped>`(在原生渲染中不可靠,直接用 `<style>`)
158
158
  - 不支持 `%`、`auto`、`vh`、`vw`、`rem`、`em` 单位,只支持 `px`
159
159
  - 不支持 CSS 简写如 `margin: 5px 10px`,必须拆写为 `margin-top: 5px; margin-right: 10px`
@@ -182,7 +182,7 @@ Android 默认裁切超出父容器边界的子元素。TV 端使用 `focusScale
182
182
 
183
183
  当用户通过以下方式表达困惑时:
184
184
  - **关键词触发**:用户提到“问题上报”、“碰到问题”、“反馈”、“Bug 反馈”、“还是没改好”、“运行报错”、“API 报错”等。
185
- - **自动检测触发**:同一段代码逻辑在 3 次修复后仍然报错,或 AI 确认生成的代码符合 `.docs` 规范但无法在用户端运行。
185
+ - **自动检测触发**:同一段代码逻辑在 3 次修复后仍然报错,或 AI 确认生成的代码符合 `node_modules/@quicktvui/ai/rules/.docs/` 规范但无法在用户端运行。
186
186
 
187
187
  **AI 执行协议:**
188
188
  1. **脱敏诊断 (Sanitized Diagnosis)**:
@@ -286,7 +286,7 @@ QuickTVUI 的样式是 Web CSS 的子集,默认 Flexbox 布局,默认 flex-d
286
286
  - 只支持 px 单位(不支持 %、auto、vh/vw/rem/em)
287
287
  - 不支持 CSS 简写属性(如 `margin: 5px 10px`,必须拆写)
288
288
  - 不支持 CSS 变量 `var(--xxx)`、`!important`
289
- - 不需要写 `display: flex`(默认就是)
289
+ - **强制要求:必须声明 `display: flex;`**
290
290
  - 所有元素必须显式指定 width 和 height
291
291
  - 文字必须用 `<span>` 或 `<qt-text>` 包裹
292
292
 
package/rules/GEMINI.md CHANGED
@@ -6,18 +6,18 @@
6
6
 
7
7
  **AI 在生成代码前,必须严格参考以下权威来源,严禁凭空想象任何组件名、属性名或 API。这是所有代码的唯一依据。**
8
8
 
9
- 1. **本地文档 (PRIMARY)**:项目根目录下的 `.docs/` 文件夹。包含所有组件、CSS、原生模块的详细 MD 文档。**AI 必须在生成代码前使用 `grep_search` 或 `read_file` 检索 `.docs/` 目录中的相关内容。**
9
+ 1. **本地文档 (PRIMARY)**:`node_modules/@quicktvui/ai/rules/.docs/` 目录。包含所有组件、CSS、原生模块的详细 MD 文档。**AI 必须在生成代码前使用 `grep_search` 或 `read_file` 检索 `node_modules/@quicktvui/ai/rules/.docs/` 目录中的相关内容。**
10
10
  2. **官方文档**:https://quicktvui.com (官网 390+ 篇详细文档)
11
11
  3. **核心库示例**:https://github.com/quicktvui/quicktvui.git (Core library + samples)
12
12
  4. **跨平台框架示例**:https://github.com/quicktvui/es-vue3.git (Cross-platform framework + samples)
13
13
  5. **最佳实践应用**:https://github.com/quicktvui/hellotv.git (Complete video app)
14
14
 
15
15
  **要求:**
16
- - **检索与能力验证优先**:在实现任何功能(如“视频播放”)前,必须先在 `.docs/` 目录中检索相关文档,验证组件是否支持该功能。切勿想当然!**例如:`qt-web-view` 绝对不支持视频播放,视频播放必须使用框架提供的专用视频组件和管理器(如 `es-video-player` 和 `es-player-manager`)。**
17
- - **非浏览器与无 HTML 环境**:**本框架绝对不支持标准 HTML 标签(如 `p`, `img`, `a`, `ul`, `li`, `h1` 等),严禁在模板中使用!绝对不支持 `window`、`document` (DOM) 对象或任何 DOM 操作 API。必须使用框架专属标签(如 `qt-text`, `qt-image`)和 Vue `ref`。**
16
+ - **检索与能力验证优先**:在实现任何功能(如“视频播放”)前,必须先在 `node_modules/@quicktvui/ai/rules/.docs/` 目录中检索相关文档,验证组件是否支持该功能。切勿想当然!**例如:`qt-web-view` 绝对不支持视频播放,视频播放必须使用框架提供的专用视频组件和管理器(如 `es-video-player` 和 `es-player-manager`)。**
17
+ - **非浏览器与无 HTML 环境**:**本框架绝对不支持标准 HTML 标签(如 `p`, `img`, `a`, `ul`, `li`, `h1` 等),严禁在模板中使用!绝对不支持 `window`、`document` (DOM) 对象或任何 DOM 操作 API。必须使用框架专属标签(如 `qt-text`, `qt-image`) and Vue `ref`。**
18
18
  - **严禁自造标签**:如 `qt-web` 是错的,官方示例中是 `qt-web-view`。
19
19
  - **严禁自造 API**:如 `onBack` 是错的,必须是 `onBackPressed`。
20
- - **参考优先**:遇到不确定的组件用法,必须先在上述仓库或本地 `.docs` 中搜索同名组件的实际用法。
20
+ - **参考优先**:遇到不确定的组件用法,必须先在上述仓库或 `node_modules/@quicktvui/ai/rules/.docs/` 中搜索同名组件的实际用法。
21
21
 
22
22
  ## 快速创建项目 (Scaffolding)
23
23
 
@@ -136,9 +136,9 @@ CORRECT — `<template>` tag attributes use camelCase:
136
136
 
137
137
  Other CSS rules:
138
138
 
139
- - **CRITICAL: DEFAULT LAYOUT IS `flex-direction: column`**. Unlike web browsers, QuickTVUI defaults to vertical layout. You rarely need to specify `display: flex`.
139
+ - **CRITICAL: MANDATORY `display: flex;`**. QuickTVUI exclusively supports Flexbox layout. Every styled element MUST explicitly include `display: flex;`. The default orientation is `flex-direction: column;`.
140
140
  - Only use properties listed in "Supported Style Properties" section below
141
- - `display: flex` and `flex-direction: column` are supported but are defaults, usually unnecessary
141
+ - `display: flex` and `flex-direction: column` are supported and MANDATORY for all layouts.
142
142
  - Do NOT use `<style scoped>` (unreliable in native rendering, use `<style>` only)
143
143
  - Only `px` units (no %, auto, vh, vw, rem, em)
144
144
  - No CSS shorthand like `margin: 5px 10px` — must split: `margin-top: 5px; margin-right: 10px`
@@ -163,7 +163,7 @@ Android clips child views outside parent bounds by default. When using `focusSca
163
163
 
164
164
  当用户通过以下方式表达困惑时:
165
165
  - **关键词触发**:用户提到“问题上报”、“碰到问题”、“反馈”、“Bug 反馈”、“还是没改好”、“运行报错”、“API 报错”等。
166
- - **自动检测触发**:同一段代码逻辑在 3 次修复后仍然报错,或 AI 确认生成的代码符合 `.docs` 规范但无法在用户端运行。
166
+ - **自动检测触发**:同一段代码逻辑在 3 次修复后仍然报错,或 AI 确认生成的代码符合 `node_modules/@quicktvui/ai/rules/.docs/` 规范但无法在用户端运行。
167
167
 
168
168
  **AI 执行协议:**
169
169
  1. **脱敏诊断 (Sanitized Diagnosis)**:
@@ -191,7 +191,7 @@ Android clips child views outside parent bounds by default. When using `focusSca
191
191
 
192
192
  Only properties listed below are supported. Default layout: flexbox, flex-direction: column.
193
193
 
194
- Rules: px units only (no %, auto, vh/vw/rem/em). No CSS shorthand. No CSS variables. No `display: flex` needed. All elements MUST have explicit width/height.
194
+ Rules: px units only (no %, auto, vh/vw/rem/em). No CSS shorthand. No CSS variables. MANDATORY `display: flex;` for all elements. All elements MUST have explicit width/height.
195
195
 
196
196
  ### Layout & Size
197
197