@lark-apaas/coding-steering 0.1.53 → 0.1.54-alpha.20260918074819

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/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@lark-apaas/coding-steering",
3
- "version": "0.1.53",
3
+ "version": "0.1.54-alpha.20260918074819",
4
4
  "description": "Stack-specific steering content for miaoda-coding templates",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "steering"
8
8
  ],
9
+ "scripts": {
10
+ "lint:md": "markdownlint 'steering/**/*.md' --ignore 'steering/**/skills/**' --ignore 'steering/**/skills_common/**' --ignore 'steering/**/skills_local/**'"
11
+ },
9
12
  "devDependencies": {
10
13
  "markdownlint-cli": "^0.47.0"
11
14
  },
@@ -17,8 +20,5 @@
17
20
  "miaoda",
18
21
  "coding-steering"
19
22
  ],
20
- "license": "MIT",
21
- "scripts": {
22
- "lint:md": "markdownlint 'steering/**/*.md' --ignore 'steering/**/skills/**' --ignore 'steering/**/skills_common/**' --ignore 'steering/**/skills_local/**'"
23
- }
24
- }
23
+ "license": "MIT"
24
+ }
@@ -359,15 +359,7 @@ await db.select().from(users).where(eq(users.adminUser, userId));
359
359
  | 按月 / 按天筛 date、timestamptz | 半开区间 `and(gte(col, "2026-08-01"), lt(col, "2026-09-01"))`;日期列不能用 `like(col, "2026-08%")` |
360
360
  | 数字列过滤(`@Query` 取到的是 string) | 先 `Number(q)` 再进 `eq` |
361
361
 
362
- - **区分 Drizzle helper 与原生 SQL `COUNT()`**:当前模板的 `drizzle-orm@0.44.6` 中,`count()` helper 返回 `number`;原生 SQL `COUNT()` 返回 PostgreSQL `bigint`,驱动结果可能是 `string`。需要保留超过 `Number.MAX_SAFE_INTEGER` 的精确值时,使用 `BigInt` 或保留字符串,不要转成 `Number`。
363
-
364
- ```typescript
365
- const [{ total }] = await db.select({ total: count() }).from(users); // total: number
366
-
367
- const rawTotal = '9007199254740993';
368
- const exactTotal = BigInt(rawTotal); // ✅ 9007199254740993n
369
- const unsafeTotal = Number(rawTotal); // ❌ 9007199254740992,精度丢失
370
- ```
362
+ - **`count()` 返回 string**(PostgreSQL bigint)。
371
363
 
372
364
  - **UUID 多值过滤不要直接插值数组到 `ANY(...::uuid[])`**:在 sql 模板中直接插入 ids 这类 JS 数组,可能被展开成 `($1, $2, ...)::uuid[]`,运行时报 `42846: cannot cast type record to uuid[]`。
373
365
 
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: mcp-ui-guide
3
+ description: "创建或修改 MCP Apps 的 TSX 界面、UI 检查配置及 shared 依赖时使用。Use when working on server/mcp/ui, MCP Apps UI, TypeScript or ESLint checks."
4
+ steering: true
5
+ steering-topic: mcp_ui_guide
6
+ match-template-name: nestjs-react-fullstack
7
+ ---
8
+
9
+ # MCP Apps UI 开发与检查
10
+
11
+ UI 是独立浏览器代码,入口为 `server/mcp/ui/<entry>/index.html`,交互逻辑使用独立 TS/TSX 文件。Vite 预设将每个入口构建为单文件 HTML,由 MCP 资源读取。不要将 UI 引入 NestJS 模块,也不要引用 client 业务代码、服务端模块或 Node.js API;可引用不依赖应用 Provider/Router/登录态的 shared 模块。
12
+
13
+ ## 创建配置
14
+
15
+ 只有创建 UI 时才生成下列两个文件;没有 UI 的应用不生成。已有配置应保留并按需调整,不能覆盖用户自定义规则。主工程 tsconfig.node.json 应排除 `server/mcp/ui`,原有 exclude 与继承语义必须保留;主工程 ESLint 排除由平台预设提供。不要为 UI 修改根目录 npm 检查命令或 scripts/lint.js。
16
+
17
+ `server/mcp/ui/tsconfig.json`:
18
+
19
+ ```json
20
+ {
21
+ "compilerOptions": {
22
+ "target": "ES2020",
23
+ "module": "ESNext",
24
+ "moduleResolution": "Bundler",
25
+ "jsx": "react-jsx",
26
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
27
+ "types": [],
28
+ "strict": true,
29
+ "allowJs": true,
30
+ "checkJs": true,
31
+ "skipLibCheck": true,
32
+ "noEmit": true,
33
+ "baseUrl": "../../..",
34
+ "paths": { "@shared/*": ["shared/*"] }
35
+ },
36
+ "include": ["./**/*"],
37
+ "exclude": ["node_modules", "dist", "eslint.config.cjs"]
38
+ }
39
+ ```
40
+
41
+ `server/mcp/ui/eslint.config.cjs`:
42
+
43
+ ```js
44
+ module.exports = require('@lark-apaas/fullstack-presets/lib/mcp/eslint-ui');
45
+ ```
46
+
47
+ ## 修改后必须执行
48
+
49
+ 从工程根目录依次运行;修改 UI 使用的 shared 模块时也必须运行:
50
+
51
+ ```bash
52
+ npx --no-install tsc --noEmit --project server/mcp/ui/tsconfig.json
53
+ npx --no-install eslint --config server/mcp/ui/eslint.config.cjs "server/mcp/ui/**/*.{ts,tsx,js,jsx}" --max-warnings 0
54
+ npm run build:prod
55
+ ```
56
+
57
+ 检查命令退出码;失败必须修复并重新运行,不能通过关闭规则、增加 ignore 或跳过检查交付。确认 `dist/mcp-ui/<entry>.html` 已生成,继续在 MCP 宿主中验证资源加载、工具结果展示和交互。主工程 lint 通过不代表 UI 检查通过,构建成功也不代表类型检查通过。
58
+
59
+ 旧版平台提供的 type:check:mcp-ui / eslint:mcp-ui 聚合或辅助脚本已弃用;使用上面的标准命令,无需新建辅助脚本。已有用户自定义检查命令可以保留。
@@ -316,15 +316,7 @@ await db.select().from(users).where(eq(users.adminUser, userId));
316
316
 
317
317
  ### 使用侧边界陷阱
318
318
 
319
- - **区分 Drizzle helper 与原生 SQL `COUNT()`**:当前模板的 `drizzle-orm@0.44.6` 中,`count()` helper 返回 `number`;原生 SQL `COUNT()` 返回 PostgreSQL `bigint`,驱动结果可能是 `string`。需要保留超过 `Number.MAX_SAFE_INTEGER` 的精确值时,使用 `BigInt` 或保留字符串,不要转成 `Number`。
320
-
321
- ```typescript
322
- const [{ total }] = await db.select({ total: count() }).from(users); // total: number
323
-
324
- const rawTotal = '9007199254740993';
325
- const exactTotal = BigInt(rawTotal); // ✅ 9007199254740993n
326
- const unsafeTotal = Number(rawTotal); // ❌ 9007199254740992,精度丢失
327
- ```
319
+ - **`count()` 返回 string**(PostgreSQL bigint)。
328
320
 
329
321
  - **UUID 列 `inArray` 必须显式 `::uuid[]`**:标准 `inArray(col, ids)` 会运行时报 `42809: op ANY/ALL (array) requires array on right side`。
330
322