@blueking/bkui-knowledge 0.0.1-beta.1 → 0.0.1-beta.10

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.
Files changed (50) hide show
  1. package/README.md +166 -58
  2. package/bin/bkui-knowledge.js +147 -82
  3. package/knowledge/manifest.json +38 -1
  4. package/knowledge/skills/.template/README.md +1 -1
  5. package/knowledge/skills/bk-security-redlines/SKILL.md +47 -0
  6. package/knowledge/skills/bk-security-redlines/references/auth-check.md +73 -0
  7. package/knowledge/skills/bk-security-redlines/references/data-encryption.md +78 -0
  8. package/knowledge/skills/bk-security-redlines/references/input-validation.md +96 -0
  9. package/knowledge/skills/bk-skill-creator/SKILL.md +37 -0
  10. package/knowledge/skills/bk-skill-creator/references/common-mistakes.md +43 -0
  11. package/knowledge/skills/bk-skill-creator/references/quick-start.md +42 -0
  12. package/knowledge/skills/bk-skill-creator/references/skill-checklist.md +93 -0
  13. package/knowledge/skills/bk-skill-creator/references/structure-guide.md +88 -0
  14. package/knowledge/skills/bk-skill-creator/references/writing-tips.md +153 -0
  15. package/knowledge/skills/bkui-quick-start/SKILL.md +52 -0
  16. package/knowledge/skills/bkui-quick-start/references/components-list.md +17 -0
  17. package/knowledge/skills/bkui-quick-start/references/skills-index.md +26 -0
  18. package/knowledge/skills/external/vue-skills/LICENSE +21 -0
  19. package/knowledge/skills/external/vue-skills/README.md +69 -0
  20. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/SKILL.md +42 -0
  21. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/codeactions-save-performance.md +79 -0
  22. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/data-attributes-config.md +74 -0
  23. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/deep-watch-numeric.md +102 -0
  24. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/define-model-update-event.md +79 -0
  25. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/duplicate-plugin-detection.md +102 -0
  26. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/fallthrough-attributes.md +63 -0
  27. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/hmr-vue-ssr.md +124 -0
  28. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/module-resolution-bundler.md +81 -0
  29. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/pinia-store-mocking.md +159 -0
  30. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/script-setup-jsdoc.md +85 -0
  31. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/strict-css-modules.md +68 -0
  32. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/unplugin-auto-import-conflicts.md +97 -0
  33. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/volar-3-breaking-changes.md +66 -0
  34. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/vue-directive-comments.md +73 -0
  35. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/vue-router-typed-params.md +81 -0
  36. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/vue-tsc-strict-templates.md +69 -0
  37. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/with-defaults-union-types.md +102 -0
  38. package/knowledge/skills/web-security-guide/SKILL.md +48 -0
  39. package/knowledge/skills/web-security-guide/references/access-control.md +123 -0
  40. package/knowledge/skills/web-security-guide/references/auth-session.md +99 -0
  41. package/knowledge/skills/web-security-guide/references/csrf.md +59 -0
  42. package/knowledge/skills/web-security-guide/references/data-exposure.md +108 -0
  43. package/knowledge/skills/web-security-guide/references/deserialization.md +59 -0
  44. package/knowledge/skills/web-security-guide/references/injection.md +357 -0
  45. package/knowledge/skills/web-security-guide/references/logging-monitoring.md +47 -0
  46. package/knowledge/skills/web-security-guide/references/security-config.md +73 -0
  47. package/knowledge/skills/web-security-guide/references/ssrf.md +55 -0
  48. package/knowledge/skills/web-security-guide/references/xss.md +134 -0
  49. package/package.json +3 -3
  50. package/server/mcp-core.js +48 -33
@@ -0,0 +1,153 @@
1
+ # Skill 写作技巧
2
+
3
+ ## 控制 SKILL.md 大小
4
+
5
+ ### 技巧 1: 只保留"必须知道"的内容
6
+
7
+ **问自己**:如果 AI 只读这个文件,哪些信息是绝对必要的?
8
+
9
+ - ✅ 核心规则(必须遵守)
10
+ - ✅ 最简单的使用示例
11
+ - ✅ 最常见的错误
12
+ - ❌ 详细解释(移到 references/)
13
+ - ❌ 多个完整示例(移到 references/)
14
+ - ❌ 历史背景(删除或移走)
15
+
16
+ ### 技巧 2: 使用表格代替段落
17
+
18
+ **Before(冗长)**:
19
+ ```markdown
20
+ ## 常见错误
21
+
22
+ ### 错误 1: 文件过大
23
+ 当 SKILL.md 超过 2KB 时,会导致 AI 消耗过多 token...
24
+
25
+ ### 错误 2: 缺少元数据
26
+ 如果没有 Front Matter,系统无法正确索引...
27
+ ```
28
+
29
+ **After(精简)**:
30
+ ```markdown
31
+ ## 常见错误
32
+
33
+ | 错误 | 正确做法 |
34
+ |-----|---------|
35
+ | ❌ 文件过大 | ✅ 拆分到 references/ |
36
+ | ❌ 缺少元数据 | ✅ 添加 Front Matter |
37
+ ```
38
+
39
+ ### 技巧 3: 代码示例最小化
40
+
41
+ 只展示最核心的代码,完整示例放 references/。
42
+
43
+ **Before(完整)**:
44
+ ```typescript
45
+ import axios from 'axios';
46
+ import { Message } from 'bkui-vue';
47
+
48
+ const http = axios.create({
49
+ baseURL: '/api',
50
+ timeout: 30000,
51
+ headers: { 'Content-Type': 'application/json' }
52
+ });
53
+
54
+ http.interceptors.response.use(
55
+ response => response.data,
56
+ error => {
57
+ Message.error(error.message);
58
+ return Promise.reject(error);
59
+ }
60
+ );
61
+
62
+ export default http;
63
+ ```
64
+
65
+ **After(最小)**:
66
+ ```typescript
67
+ import axios from 'axios';
68
+ const http = axios.create({ baseURL: '/api', timeout: 30000 });
69
+ export default http;
70
+ ```
71
+
72
+ > 完整实现见 `skill://api-standard/assets/http.ts`
73
+
74
+ ## 内容拆分策略
75
+
76
+ ### 拆分原则
77
+
78
+ | 内容类型 | 放置位置 |
79
+ |---------|---------|
80
+ | 核心规则 | SKILL.md |
81
+ | 快速开始 | SKILL.md |
82
+ | 常见错误 | SKILL.md |
83
+ | 详细配置 | references/advanced.md |
84
+ | 完整示例 | references/examples.md |
85
+ | 问题排查 | references/troubleshooting.md |
86
+ | 代码模板 | assets/*.ts |
87
+
88
+ ### 拆分示例
89
+
90
+ **原始内容**(3KB,需要拆分):
91
+
92
+ ```markdown
93
+ # API 封装规范
94
+
95
+ ## 核心规则
96
+ ...
97
+
98
+ ## 详细配置
99
+ ### 请求拦截器配置
100
+ (500字详细说明)
101
+
102
+ ### 响应拦截器配置
103
+ (500字详细说明)
104
+
105
+ ## 完整示例
106
+ (800字完整代码)
107
+ ```
108
+
109
+ **拆分后**:
110
+
111
+ SKILL.md(1.5KB):
112
+ ```markdown
113
+ # API 封装规范
114
+ ## 核心规则
115
+ ...
116
+ ## 📦 按需加载资源
117
+ - 详细配置: `skill://api-standard/references/advanced.md`
118
+ - 完整示例: `skill://api-standard/assets/http.ts`
119
+ ```
120
+
121
+ references/advanced.md:
122
+ ```markdown
123
+ # 详细配置
124
+ ## 请求拦截器配置
125
+ ...
126
+ ## 响应拦截器配置
127
+ ...
128
+ ```
129
+
130
+ ## 好的 Skill 示例分析
131
+
132
+ ### bkui-builder
133
+
134
+ **优点**:
135
+ 1. SKILL.md 只有 1.5KB,非常精简
136
+ 2. 使用表格展示模板选择逻辑
137
+ 3. 按需加载资源清晰列出
138
+
139
+ **值得学习**:
140
+ - 用"绝对禁令"强调最重要的规则
141
+ - 用"还原流程"提供清晰步骤
142
+ - 模板资源按场景分类
143
+
144
+ ### code-review
145
+
146
+ **优点**:
147
+ 1. 核心规则简洁明确
148
+ 2. 详细检查清单放在 references/
149
+ 3. 评分标准独立成文件
150
+
151
+ **值得学习**:
152
+ - 将复杂的评审标准拆分到多个 references 文件
153
+ - 使用 assets/ 存放可执行脚本
@@ -0,0 +1,52 @@
1
+ ---
2
+ id: bkui-quick-start
3
+ name: BKUI 快速入门
4
+ category: engineering
5
+ description: 蓝鲸前端知识库入口指南,包含规范、索引和工作流程
6
+ tags: [bkui, 规范, 索引, 入门, vue3]
7
+ updated_at: 2026-01-23
8
+ ---
9
+
10
+ # BKUI 快速入门
11
+
12
+ > 蓝鲸前端知识库入口指南。
13
+
14
+ ## 强制规范
15
+
16
+ - **组件库**: bkui-vue (前缀 `bk-`)
17
+ - **语法**: Vue 3 `<script setup lang="ts">`
18
+ - **样式**: MagicBox 原子类 (mt10, mb20)
19
+ - **布局**: 必须使用 `bk-navigation`
20
+
21
+ ## 常见错误 (必须避免)
22
+
23
+ | 组件 | 错误写法 | 正确写法 |
24
+ |------|----------|----------|
25
+ | bk-navigation | `:default-open-keys` | `default-open` |
26
+ | bk-menu | `:default-open-keys` | `:opened-keys` |
27
+ | bk-dialog | `v-model` | `v-model:isShow` |
28
+
29
+ ## 高优先级组件
30
+
31
+ - `bk-navigation` - 布局组件,易出错
32
+ - `bk-menu` - 与 navigation 配合
33
+ - `bk-table` - 列表页核心组件
34
+ - `bk-form` - 表单验证
35
+ - `bk-dialog` - v-model:isShow
36
+
37
+ ## 工作流程
38
+
39
+ 1. **分析需求** → 确定需要哪些资源
40
+ 2. **布局组件** → `get_component_api({ componentName: 'navigation' })`
41
+ 3. **模板代码** → `get_skill({ skillId: 'bkui-builder' })`
42
+
43
+ ## 触发条件
44
+
45
+ 遇到 bk- 前缀组件、bkui-vue、蓝鲸前端、设计稿还原时使用。
46
+
47
+ ---
48
+
49
+ ## 按需加载资源
50
+
51
+ - `skill://bkui-quick-start/references/skills-index.md` - 完整 Skills 索引
52
+ - `skill://bkui-quick-start/references/components-list.md` - 组件完整列表
@@ -0,0 +1,17 @@
1
+ # 组件完整列表
2
+
3
+ 通过 `get_component_api({ componentName: 'xxx' })` 获取文档。
4
+
5
+ ## 高优先级 (必须先查询)
6
+
7
+ | 组件 | 说明 |
8
+ |------|------|
9
+ | bk-navigation | 布局组件,易出错 |
10
+ | bk-menu | 与 navigation 配合 |
11
+ | bk-table | 列表页核心组件 |
12
+ | bk-form | 表单验证 |
13
+ | bk-dialog | v-model:isShow |
14
+
15
+ ## 全部组件
16
+
17
+ navigation, menu, table, form, dialog, button, input, select, checkbox, radio, date-picker, time-picker, pagination, message, notify, loading, popover, pop-confirm, tag, tag-input, alert, dropdown, tab, cascader, tree, steps, upload, sideslider, breadcrumb, card, collapse, affix, backtop, badge, divider, exception, image, link, progress, rate, slider, switcher, timeline, process, transfer, search-select, color-picker, container, resize-layout, fixed-navbar, code-diff, swiper, animate-number, overflow-title, virtual-render, scrollbar, info-box, config-provider
@@ -0,0 +1,26 @@
1
+ # 可用 Skills 索引
2
+
3
+ 通过 `get_skill({ skillId: 'xxx' })` 获取详情:
4
+
5
+ ## 工程化
6
+
7
+ | ID | 名称 | 说明 |
8
+ |----|------|------|
9
+ | bkui-builder | 设计稿还原专家 | 包含布局模版和页面模版 (assets/) |
10
+ | bkui-cheatsheet | BKUI 组件速查 | Props 速查、常见坑点 |
11
+ | api-standard | 统一网络请求封装 | Axios 封装规范 |
12
+ | pinia-setup | 全局状态管理 | Pinia Store 模板 |
13
+ | permission-directive | 前端权限控制 | IAM 权限指令 |
14
+ | vite-migration | Webpack 到 Vite 迁移 | 迁移检查脚本 |
15
+ | bundle-optimization | Vite 构建优化 | 性能优化配置 |
16
+ | vue-composables | Vue 3 Composables | 最佳实践和模板 |
17
+ | virtual-list | 长列表虚拟滚动 | 性能优化方案 |
18
+
19
+ ## 质量保障
20
+
21
+ | ID | 名称 | 说明 |
22
+ |----|------|------|
23
+ | unit-testing | 组件单元测试 | Vitest 测试模板 |
24
+ | code-review | 代码评审专家 | 评审规范和检查清单 |
25
+ | js-security-check | JavaScript 安全审查 | 前端安全检查 |
26
+ | nodejs-security-check | Node.js 安全审查 | 后端安全检查 |
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 hyf0
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,69 @@
1
+ # vue-skills
2
+
3
+ Agent skills for Vue 3 development.
4
+
5
+ > 🚧 **Early Experiment**
6
+ >
7
+ > This repository is an early experiment in creating specialized skills for AI agents to enhance their capabilities in Vue 3 development. The skills are derived from real-world issues and best practices, but might be incomplete or inaccurate due to hallucinations.
8
+ >
9
+ > Please give feedback when encountering any issues.
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ npx add-skill hyf0/vue-skills
15
+ ```
16
+
17
+ ## Available Skills
18
+
19
+ ### vue-best-practices (17 rules)
20
+
21
+ Vue 3 development best practices covering TypeScript configuration, tooling troubleshooting, and testing patterns.
22
+
23
+ | Type | Count | Examples |
24
+ |------|-------|----------|
25
+ | Capability | 15 | vue-tsc strictTemplates, Volar 3.0 breaking changes, Vue 3.5 deep watch, @vue-ignore directives |
26
+ | Efficiency | 2 | HMR in SSR, Pinia store mocking |
27
+
28
+ **Key rules that models don't know without the skill:**
29
+ - `vue-tsc-strict-templates` - vueCompilerOptions.strictTemplates config
30
+ - `deep-watch-numeric` - Vue 3.5 `deep: 1` for efficient partial-depth watching
31
+ - `vue-directive-comments` - @vue-ignore, @vue-expect-error, @vue-skip directives
32
+ - `pinia-store-mocking` - createSpy requirement in @pinia/testing 1.0+
33
+
34
+ ## Rule Types
35
+
36
+ Rules are classified into two categories:
37
+
38
+ - **Capability**: AI *cannot* solve the problem without the skill. These address version-specific issues, undocumented behaviors, recent features, or edge cases outside AI's training data.
39
+
40
+ - **Efficiency**: AI *can* solve the problem but not well. These provide optimal patterns, best practices, and consistent approaches that improve solution quality.
41
+
42
+ ## Methodology
43
+
44
+ Every skill in this repository is created through a rigorous, evidence-based process:
45
+
46
+ **1. Real-World Issue Collection**
47
+
48
+ Skills are sourced from actual developer pain points encountered in production.
49
+
50
+ **2. Multi-Model Verification**
51
+
52
+ Each skill undergoes systematic testing:
53
+ - **Baseline test**: Verify the model fails to solve the problem *without* the skill
54
+ - **Skill test**: Confirm the model correctly solves the problem *with* the skill
55
+ - **Deletion criteria**: If both Sonnet AND Haiku pass without the skill, the rule will be deleted
56
+
57
+ **3. Model Tier Validation**
58
+
59
+ | Model | Without Skill | With Skill | Action |
60
+ |-------|--------------|------------|--------|
61
+ | Haiku | Fail | Pass | Keep |
62
+ | Sonnet | Fail | Pass | Keep |
63
+ | Both | Pass | - | Delete |
64
+
65
+ **Acceptance criteria**: A skill is only kept if it enables Haiku or Sonnet to solve a problem they couldn't solve without it.
66
+
67
+ ## License
68
+
69
+ MIT
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: vue-best-practices
3
+ description: Vue 3 TypeScript, vue-tsc, Volar, Vite, component props, testing, composition API.
4
+ license: MIT
5
+ metadata:
6
+ author: hyf0
7
+ version: "7.0.0"
8
+ ---
9
+
10
+ # Vue Best Practices
11
+
12
+ ## Capability Rules
13
+
14
+ | Rule | Keywords | Description |
15
+ |------|----------|-------------|
16
+ | [vue-tsc-strict-templates](rules/vue-tsc-strict-templates.md) | undefined component, template error, strictTemplates | Catch undefined components in templates |
17
+ | [fallthrough-attributes](rules/fallthrough-attributes.md) | fallthrough, $attrs, wrapper component | Type-check fallthrough attributes |
18
+ | [strict-css-modules](rules/strict-css-modules.md) | css modules, $style, typo | Catch CSS module class typos |
19
+ | [data-attributes-config](rules/data-attributes-config.md) | data-*, strictTemplates, attribute | Allow data-* attributes |
20
+ | [volar-3-breaking-changes](rules/volar-3-breaking-changes.md) | volar, vue-language-server, editor | Fix Volar 3.0 upgrade issues |
21
+ | [module-resolution-bundler](rules/module-resolution-bundler.md) | cannot find module, @vue/tsconfig, moduleResolution | Fix module resolution errors |
22
+ | [unplugin-auto-import-conflicts](rules/unplugin-auto-import-conflicts.md) | unplugin, auto-import, types any | Fix unplugin type conflicts |
23
+ | [codeactions-save-performance](rules/codeactions-save-performance.md) | slow save, vscode, performance | Fix slow save in large projects |
24
+ | [duplicate-plugin-detection](rules/duplicate-plugin-detection.md) | duplicate plugin, vite, vue plugin | Detect duplicate plugins |
25
+ | [define-model-update-event](rules/define-model-update-event.md) | defineModel, update event, undefined | Fix model update errors |
26
+ | [with-defaults-union-types](rules/with-defaults-union-types.md) | withDefaults, union type, default | Fix union type defaults |
27
+ | [deep-watch-numeric](rules/deep-watch-numeric.md) | watch, deep, array, Vue 3.5 | Efficient array watching |
28
+ | [vue-directive-comments](rules/vue-directive-comments.md) | @vue-ignore, @vue-skip, template | Control template type checking |
29
+ | [script-setup-jsdoc](rules/script-setup-jsdoc.md) | jsdoc, script setup, documentation | Add JSDoc to script setup |
30
+ | [vue-router-typed-params](rules/vue-router-typed-params.md) | route params, typed router, unplugin | Fix route params typing |
31
+
32
+ ## Efficiency Rules
33
+
34
+ | Rule | Keywords | Description |
35
+ |------|----------|-------------|
36
+ | [hmr-vue-ssr](rules/hmr-vue-ssr.md) | hmr, ssr, hot reload | Fix HMR in SSR apps |
37
+ | [pinia-store-mocking](rules/pinia-store-mocking.md) | pinia, mock, vitest, store | Mock Pinia stores |
38
+
39
+ ## Reference
40
+
41
+ - [Vue Language Tools](https://github.com/vuejs/language-tools)
42
+ - [Vue 3 Documentation](https://vuejs.org/)
@@ -0,0 +1,79 @@
1
+ ---
2
+ title: Fix Slow Save Times with Code Actions Setting
3
+ impact: HIGH
4
+ impactDescription: fixes 30-60 second save delays in large Vue projects
5
+ type: capability
6
+ tags: performance, save-time, vscode, code-actions, volar
7
+ ---
8
+
9
+ # Fix Slow Save Times with Code Actions Setting
10
+
11
+ **Impact: HIGH** - fixes 30-60 second save delays in large Vue projects
12
+
13
+ In large Vue projects, saving files can take 30-60+ seconds due to VSCode's code actions triggering expensive TypeScript state synchronization.
14
+
15
+ ## Problem
16
+
17
+ Symptoms:
18
+ - Save operation takes 30+ seconds
19
+ - Editor becomes unresponsive during save
20
+ - CPU spikes when saving Vue files
21
+ - Happens more in larger projects
22
+
23
+ ## Root Cause
24
+
25
+ VSCode emits document change events multiple times during save cycles. Each event triggers Volar to synchronize with TypeScript, causing expensive re-computation.
26
+
27
+ ## Solution
28
+
29
+ Disable code actions or limit their timeout:
30
+
31
+ **Option 1: Disable code actions (fastest)**
32
+ ```json
33
+ // .vscode/settings.json
34
+ {
35
+ "vue.codeActions.enabled": false
36
+ }
37
+ ```
38
+
39
+ **Option 2: Limit code action time**
40
+ ```json
41
+ // .vscode/settings.json
42
+ {
43
+ "vue.codeActions.savingTimeLimit": 1000
44
+ }
45
+ ```
46
+
47
+ **Option 3: Disable specific code actions**
48
+ ```json
49
+ // .vscode/settings.json
50
+ {
51
+ "vue.codeActions.enabled": true,
52
+ "editor.codeActionsOnSave": {
53
+ "source.organizeImports": "never"
54
+ }
55
+ }
56
+ ```
57
+
58
+ ## VSCode Version Requirement
59
+
60
+ VSCode 1.81.0+ includes fixes that reduce save time issues. Upgrade if using an older version.
61
+
62
+ ## Additional Optimizations
63
+
64
+ ```json
65
+ // .vscode/settings.json
66
+ {
67
+ "vue.codeActions.enabled": false,
68
+ "editor.formatOnSave": true,
69
+ "editor.codeActionsOnSave": {},
70
+ "[vue]": {
71
+ "editor.formatOnSave": true,
72
+ "editor.defaultFormatter": "Vue.volar"
73
+ }
74
+ }
75
+ ```
76
+
77
+ ## Reference
78
+
79
+ - [Vue Language Tools Discussion #2740](https://github.com/vuejs/language-tools/discussions/2740)
@@ -0,0 +1,74 @@
1
+ ---
2
+ title: Allow Data Attributes with Strict Templates
3
+ impact: MEDIUM
4
+ impactDescription: fixes data-testid and data-* attribute errors in strict mode
5
+ type: capability
6
+ tags: dataAttributes, vueCompilerOptions, strictTemplates, data-testid, testing
7
+ ---
8
+
9
+ # Allow Data Attributes with Strict Templates
10
+
11
+ **Impact: MEDIUM** - fixes data-testid and data-* attribute errors in strict mode
12
+
13
+ With `strictTemplates` enabled, `data-*` attributes on components cause type errors. Use the `dataAttributes` option to allow specific patterns.
14
+
15
+ ## Problem
16
+
17
+ ```vue
18
+ <template>
19
+ <!-- Error: Property 'data-testid' does not exist on type... -->
20
+ <MyComponent data-testid="submit-button" />
21
+
22
+ <!-- Error: Property 'data-cy' does not exist on type... -->
23
+ <MyComponent data-cy="login-form" />
24
+ </template>
25
+ ```
26
+
27
+ ## Solution
28
+
29
+ Configure `dataAttributes` to allow specific patterns:
30
+
31
+ ```json
32
+ // tsconfig.json or tsconfig.app.json
33
+ {
34
+ "vueCompilerOptions": {
35
+ "strictTemplates": true,
36
+ "dataAttributes": ["data-*"]
37
+ }
38
+ }
39
+ ```
40
+
41
+ Now all `data-*` attributes are allowed on any component.
42
+
43
+ ## Specific Patterns
44
+
45
+ You can be more selective:
46
+
47
+ ```json
48
+ {
49
+ "vueCompilerOptions": {
50
+ "dataAttributes": [
51
+ "data-testid",
52
+ "data-cy",
53
+ "data-test-*"
54
+ ]
55
+ }
56
+ }
57
+ ```
58
+
59
+ This only allows the specified patterns, not all data attributes.
60
+
61
+ ## Common Testing Attributes
62
+
63
+ For testing libraries, allow their specific attributes:
64
+
65
+ | Library | Attribute | Pattern |
66
+ |---------|-----------|---------|
67
+ | Testing Library | `data-testid` | `"data-testid"` |
68
+ | Cypress | `data-cy` | `"data-cy"` |
69
+ | Playwright | `data-testid` | `"data-testid"` |
70
+ | Generic | All data attributes | `"data-*"` |
71
+
72
+ ## Reference
73
+
74
+ - [Vue Language Tools Wiki - Vue Compiler Options](https://github.com/vuejs/language-tools/wiki/Vue-Compiler-Options)
@@ -0,0 +1,102 @@
1
+ ---
2
+ title: Vue 3.5+ Deep Watch Numeric Depth
3
+ impact: MEDIUM
4
+ impactDescription: enables efficient array mutation watching with numeric deep option
5
+ type: capability
6
+ tags: watch, deep, vue-3.5, array, mutation, performance
7
+ ---
8
+
9
+ # Vue 3.5+ Deep Watch Numeric Depth
10
+
11
+ **Impact: MEDIUM** - enables efficient array mutation watching with numeric deep option
12
+
13
+ Vue 3.5 introduced `deep: number` for watch depth control. This allows watching array mutations without the performance cost of deep traversal.
14
+
15
+ ## Symptoms
16
+
17
+ - Array mutations not triggering watch callback
18
+ - Deep watch causing performance issues on large nested objects
19
+ - Unaware of new Vue 3.5 feature
20
+
21
+ > **Note:** TypeScript error "Type 'number' is not assignable to type 'boolean'" no longer occurs with Vue 3.5+ and current TypeScript versions. The types now correctly support numeric `deep` values.
22
+
23
+ ## The Feature
24
+
25
+ ```typescript
26
+ // Vue 3.5+ only
27
+ watch(items, (newVal) => {
28
+ // Triggered on array mutations (push, pop, splice, etc.)
29
+ }, { deep: 1 })
30
+ ```
31
+
32
+ | deep value | Behavior |
33
+ |------------|----------|
34
+ | `true` | Full recursive traversal (original behavior) |
35
+ | `false` | Only reference changes |
36
+ | `1` | One level deep - array mutations, not nested objects |
37
+ | `2` | Two levels deep |
38
+ | `n` | N levels deep |
39
+
40
+ ## Fix
41
+
42
+ **Step 1: Ensure Vue 3.5+**
43
+ ```bash
44
+ npm install vue@^3.5.0
45
+ ```
46
+
47
+ **Step 2: Update @vue/runtime-core types**
48
+ ```bash
49
+ npm install -D @vue/runtime-core@latest
50
+ ```
51
+
52
+ **Step 3: Use numeric depth**
53
+ ```typescript
54
+ import { watch, ref } from 'vue'
55
+
56
+ const items = ref([{ id: 1, data: { nested: 'value' } }])
57
+
58
+ // Watch array mutations only (push, pop, etc.)
59
+ watch(items, (newItems) => {
60
+ console.log('Array mutated')
61
+ }, { deep: 1 })
62
+
63
+ // Won't trigger on: items.value[0].data.nested = 'new'
64
+ // Will trigger on: items.value.push(newItem)
65
+ ```
66
+
67
+ ## Performance Comparison
68
+
69
+ ```typescript
70
+ const largeNestedData = ref({ /* deeply nested structure */ })
71
+
72
+ // SLOW - traverses entire structure
73
+ watch(largeNestedData, handler, { deep: true })
74
+
75
+ // FAST - only watches top-level changes
76
+ watch(largeNestedData, handler, { deep: 1 })
77
+
78
+ // FASTEST - only reference changes
79
+ watch(largeNestedData, handler, { deep: false })
80
+ ```
81
+
82
+ ## Alternative: watchEffect for Selective Tracking
83
+
84
+ ```typescript
85
+ // Only tracks properties actually accessed
86
+ watchEffect(() => {
87
+ // Only re-runs when items.value.length or first item changes
88
+ console.log(items.value.length, items.value[0]?.id)
89
+ })
90
+ ```
91
+
92
+ ## TypeScript Note
93
+
94
+ If TypeScript complains about numeric deep, ensure:
95
+ 1. Vue version is 3.5+
96
+ 2. `@vue/runtime-core` types are updated
97
+ 3. tsconfig targets correct node_modules types
98
+
99
+ ## Reference
100
+
101
+ - [Vue Watchers Docs](https://vuejs.org/guide/essentials/watchers.html)
102
+ - [Vue 3.5 Release Notes](https://blog.vuejs.org/posts/vue-3-5)