@lark-apaas/coding-miaoda-sandbox-skills 0.1.60 → 0.1.61
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: authz-cli
|
|
3
|
-
description: "Use when AI Agent needs to run miaoda-auth-cli commands in sandbox to manage roles, or run `miaoda db sql` in sandbox to manage permission point tables (create, seed, add, update, delete). All commands are executed by the Agent in its sandbox terminal. NOT for writing permission control code — CanRole/@Can coding should use
|
|
3
|
+
description: "Use when AI Agent needs to run miaoda-auth-cli commands in sandbox to manage roles, or run `miaoda db sql` in sandbox to manage permission point tables (create, seed, add, update, delete). All commands are executed by the Agent in its sandbox terminal. NOT for writing permission control code — CanRole/@Can coding should use auth-guide skill instead. 触发词:miaoda-auth-cli, authz-cli, 查询角色列表, 模拟角色, 创建角色, 批量创建角色, 权限点位, 权限表, 新增点位, 更新点位, 删除点位, role mock, role list CLI"
|
|
4
4
|
control-by-feature-ab: true
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -22,8 +22,8 @@ Agent 在沙箱内直接执行的权限管理工具集,包含两部分能力
|
|
|
22
22
|
| 开发阶段新增/更新/删除权限点位 | `miaoda db sql` 执行 INSERT/UPDATE/DELETE |
|
|
23
23
|
| 开发阶段初始化或调整角色-点位映射 | `miaoda db sql` 执行 INSERT/DELETE |
|
|
24
24
|
| 运行态调整角色-点位映射(勾选/取消) | 由应用管理页面处理,**不属于** Agent 职责 |
|
|
25
|
-
| **应用前端**需要权限控制 | 使用 `<CanRole>` 或 `<Can>` 组件(参考 `
|
|
26
|
-
| **应用后端**需要权限控制 | 使用 `@CanRole` 或 `@Can` 装饰器(参考 `
|
|
25
|
+
| **应用前端**需要权限控制 | 使用 `<CanRole>` 或 `<Can>` 组件(参考 `auth-guide` skill) |
|
|
26
|
+
| **应用后端**需要权限控制 | 使用 `@CanRole` 或 `@Can` 装饰器(参考 `auth-guide` skill) |
|
|
27
27
|
|
|
28
28
|
> **禁止**在生成的应用代码(前端/后端)中调用 `miaoda-auth-cli`。CLI 命令只在 Agent 对话终端中执行。
|
|
29
29
|
|
|
@@ -51,15 +51,15 @@ Agent 在沙箱内直接执行的权限管理工具集,包含两部分能力
|
|
|
51
51
|
权限设计方案
|
|
52
52
|
│
|
|
53
53
|
├─ 推荐模式:静态角色鉴权
|
|
54
|
-
│ └─ 新建 ──→ 按角色清单逐个 CREATE ──→ 编写 CanRole 代码(
|
|
54
|
+
│ └─ 新建 ──→ 按角色清单逐个 CREATE ──→ 编写 CanRole 代码(auth-guide)
|
|
55
55
|
│
|
|
56
56
|
├─ 推荐模式:动态权限点位鉴权
|
|
57
|
-
│ ├─ 新建 ──→ CREATE 角色 → PERM_CREATE_TABLE → PERM_SEED → 编写 @Can 代码(
|
|
58
|
-
│ └─ 升级(仅限历史 CanRole 代码迁移)──→ PERM_CREATE_TABLE → PERM_SEED → CanRole 升级为 Can(
|
|
57
|
+
│ ├─ 新建 ──→ CREATE 角色 → PERM_CREATE_TABLE → PERM_SEED → 编写 @Can 代码(auth-guide)
|
|
58
|
+
│ └─ 升级(仅限历史 CanRole 代码迁移)──→ PERM_CREATE_TABLE → PERM_SEED → CanRole 升级为 Can(auth-guide)
|
|
59
59
|
│
|
|
60
60
|
├─ "给某功能加权限控制" / "新建某个角色"
|
|
61
61
|
│ └──→ QUERY(查询角色)
|
|
62
|
-
│ ├─ 角色存在 ──→ 编写鉴权代码(
|
|
62
|
+
│ ├─ 角色存在 ──→ 编写鉴权代码(auth-guide)
|
|
63
63
|
│ └─ 角色不存在 ──→ CREATE ──→ 编写鉴权代码
|
|
64
64
|
│
|
|
65
65
|
├─ "新功能上线,需要新增权限点位" ──→ PERM_ADD + 同步 @Can/<Can> 代码
|
|
@@ -75,7 +75,7 @@ Agent 在沙箱内直接执行的权限管理工具集,包含两部分能力
|
|
|
75
75
|
|
|
76
76
|
**角色设计由权限设计方案承载**,本 skill 负责角色 CLI 操作和权限点位管理。
|
|
77
77
|
|
|
78
|
-
**日常权限开发流程**:QUERY → 判断是否 CREATE → 编写鉴权代码(参考 `
|
|
78
|
+
**日常权限开发流程**:QUERY → 判断是否 CREATE → 编写鉴权代码(参考 `auth-guide`)。
|
|
79
79
|
|
|
80
80
|
**动态权限点位初始化流程**:CREATE 角色 → PERM_CREATE_TABLE → PERM_SEED → 编写鉴权代码。
|
|
81
81
|
|
|
@@ -164,7 +164,7 @@ miaoda-auth-cli role create --name "图书编辑" --biz-id "editor" --descriptio
|
|
|
164
164
|
miaoda-auth-cli role create --name "管理员" --biz-id "admin" --description "拥有所有业务管理权限" --output json
|
|
165
165
|
```
|
|
166
166
|
|
|
167
|
-
> 创建完所有角色后,按权限设计方案的功能权限映射表编写鉴权代码(参考 `
|
|
167
|
+
> 创建完所有角色后,按权限设计方案的功能权限映射表编写鉴权代码(参考 `auth-guide`)。
|
|
168
168
|
|
|
169
169
|
## 权限点位管理(`miaoda db sql`)
|
|
170
170
|
|
|
@@ -286,11 +286,11 @@ DELETE FROM authz_permissions WHERE action = 'export' AND subject = 'Task';
|
|
|
286
286
|
|
|
287
287
|
| 错误 | 正确做法 |
|
|
288
288
|
| ---- | -------- |
|
|
289
|
-
| 在应用代码中调用 `miaoda-auth-cli` | CLI 仅供 Agent 终端执行;应用代码用 CanRole 组件/装饰器(参考 `
|
|
289
|
+
| 在应用代码中调用 `miaoda-auth-cli` | CLI 仅供 Agent 终端执行;应用代码用 CanRole 组件/装饰器(参考 `auth-guide`) |
|
|
290
290
|
| 更新角色时未指定 `--from-biz-id` | 必须通过 `--from-biz-id` 指定要更新的角色 |
|
|
291
291
|
| 模拟角色时未正确格式化 `--roles` 参数 | 使用逗号分隔的角色 bizID 列表,如 `admin,ops,viewer` |
|
|
292
292
|
| 期望 JSON 输出但未指定 `--output json` | Agent 应始终添加 `--output json` 参数 |
|
|
293
|
-
| 只创建角色不编写鉴权代码 | 创建角色后必须编写鉴权代码(参考 `
|
|
293
|
+
| 只创建角色不编写鉴权代码 | 创建角色后必须编写鉴权代码(参考 `auth-guide`) |
|
|
294
294
|
| 没有设计方案就大批量创建角色 | 先确认是否有权限设计方案输出的角色清单,再按清单逐个 CREATE |
|
|
295
295
|
| 动态权限点位场景只创建角色不建表预填 | 需要执行 PERM_CREATE_TABLE + PERM_SEED |
|
|
296
296
|
| 在管理页面提供权限点位的增删改 | 权限点位的增删改由 Agent 通过 PERM_ADD/UPDATE/DELETE 操作,管理页面只做角色-点位映射 |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: correctness-review
|
|
3
|
-
description: "Correctness and maintainability audit checklist for the Reviewer agent. Covers exception handling, concurrency, resource leaks, error handling, type safety, fault tolerance, frontend-backend contract. 触发词:正确性审查, 代码质量, correctness review"
|
|
3
|
+
description: "Correctness and maintainability audit checklist for the Reviewer agent. Covers exception handling, concurrency, resource leaks, error handling, type safety, fault tolerance, frontend-backend contract, authentication and authorization. 触发词:正确性审查, 代码质量, correctness review"
|
|
4
4
|
hook: SessionStart
|
|
5
5
|
available-agents:
|
|
6
6
|
- Reviewer
|
|
@@ -158,6 +158,8 @@ For any other React-flavored correctness finding (hook deps, derived state, redu
|
|
|
158
158
|
|
|
159
159
|
## Self-Built Data Authorization Correctness (single-domain decidable)
|
|
160
160
|
|
|
161
|
+
Apply the Authentication and Authorization checks below to self-built permission code, alongside this section’s data-access checks.
|
|
162
|
+
|
|
161
163
|
**Core issue**: The platform's RBAC/PBAC is role-based and only fits feature-level authorization; apps that need per-user data authorization usually build their own (custom permission tables + application-layer allowlist filtering). Two defect classes surface directly as user-visible wrong behavior (blank screen / data over-exposure), so they are correctness issues. **Each item is decidable from a single Reviewer's own scope — no cross-Reviewer join needed.**
|
|
162
164
|
|
|
163
165
|
**⚠️ Severity is mandatory**: every item below, once matched, is 🔴 CRITICAL or 🟠 BUG — **never downgrade to 🟡 SUGGESTION**. They are user-visible functional/data defects (no-permission blank screen = feature unusable; data over-exposure = security incident), not style preferences. Phrasings like "permission failure silently swallowed / no feedback" or "no-permission notice" MUST be reported as 🔴/🟠, not SUGGESTION.
|
|
@@ -211,6 +213,21 @@ For any other React-flavored correctness finding (hook deps, derived state, redu
|
|
|
211
213
|
|
|
212
214
|
## Frontend-Backend Contract
|
|
213
215
|
|
|
216
|
+
### Authentication and Authorization
|
|
217
|
+
|
|
218
|
+
Each Reviewer checks the actual paired request's client credential writer/interceptor, server extractor/Guard/middleware, verified identity and permission predicate. Use Step 2.6's minimal direct contract reads; issue ownership stays in scope.
|
|
219
|
+
|
|
220
|
+
- App inbound platform proxies occupy/overwrite `Authorization`. Business JWT writers and Guard/middleware must pair `X-App-Auth-Token: Bearer <JWT>` with Node-normalized `x-app-auth-token`. External APIs follow their protocol; business tokens go only to the app backend.
|
|
221
|
+
- Verify business signature/expiry, issuer/audience/algorithm if configured, and existing enabled user; decoded claims alone do not authenticate.
|
|
222
|
+
- Authenticate/authorize platform and business identities separately. Business users/roles cannot overwrite `req.userContext` or platform roles; matching role names do not imply matching permissions.
|
|
223
|
+
- Server operation/data permissions bind verified identity; client visibility is insufficient. `@NeedLogin()`/context must match access policy. Verify anonymous credential injection and Guard acceptance/rejection against that policy, beyond interceptor presence.
|
|
224
|
+
- Intended anonymous writes require RLS INSERT WITH CHECK, not SELECT; RETURNING needs minimal SELECT.
|
|
225
|
+
- Follow `validateStatus`/interceptor resolve/reject. Login 201 followed by protected API 401 requires checking credential transport/extraction before blaming passwords or removing validation. Authentication 401 uses the affected platform/business login; valid-credential permission 403 keeps login state and reports denial.
|
|
226
|
+
|
|
227
|
+
Mark only missing platform transport/runtime evidence unresolved; judge independently proven validation/role/errors.
|
|
228
|
+
|
|
229
|
+
### Response Types
|
|
230
|
+
|
|
214
231
|
- Same endpoint returning different structures with different params — format must be consistent
|
|
215
232
|
- Frontend missing defensive handling of API responses (response?.data?.items || [])
|
|
216
233
|
- **Custom column types (e.g. customTimestamptz) must handle null input in fromDriver — `new Date(null)` returns epoch (1970-01-01), not null**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: lark-apps-authz
|
|
3
|
-
description: "Use when 在妙搭沙箱里用 `lark-cli apps +role-*` 管理【当前这个已存在的】妙搭应用的角色与角色成员、查询用户命中的角色,或用 `lark-cli apps +db-execute` 维护权限点位表(建表、预填、新增、更新、删除点位)。触发词:查询角色列表, 创建角色, 删除角色, 角色成员, 查询用户角色, 权限点位, 权限表, 新增点位, 更新点位, 删除点位, +role-, role-list, role-match-list. NOT for 编写权限控制代码——CanRole/@Can 编码用
|
|
3
|
+
description: "Use when 在妙搭沙箱里用 `lark-cli apps +role-*` 管理【当前这个已存在的】妙搭应用的角色与角色成员、查询用户命中的角色,或用 `lark-cli apps +db-execute` 维护权限点位表(建表、预填、新增、更新、删除点位)。触发词:查询角色列表, 创建角色, 删除角色, 角色成员, 查询用户角色, 权限点位, 权限表, 新增点位, 更新点位, 删除点位, +role-, role-list, role-match-list. NOT for 编写权限控制代码——CanRole/@Can 编码用 auth-guide skill。"
|
|
4
4
|
metadata:
|
|
5
5
|
requires:
|
|
6
6
|
bins: ["lark-cli"]
|
|
@@ -48,8 +48,8 @@ Agent 在沙箱内直接执行的权限管理工具集,包含两部分能力
|
|
|
48
48
|
| 开发阶段新增/更新/删除权限点位 | `lark-cli apps +db-execute` 执行 INSERT/UPDATE/DELETE |
|
|
49
49
|
| 开发阶段初始化或调整角色-点位映射 | `lark-cli apps +db-execute` 执行 INSERT/DELETE |
|
|
50
50
|
| 运行态调整角色-点位映射(勾选/取消) | 由应用管理页面处理,**不属于** Agent 职责 |
|
|
51
|
-
| **应用前端**需要权限控制 | 使用 `<CanRole>` 或 `<Can>` 组件(参考 `
|
|
52
|
-
| **应用后端**需要权限控制 | 使用 `@CanRole` 或 `@Can` 装饰器(参考 `
|
|
51
|
+
| **应用前端**需要权限控制 | 使用 `<CanRole>` 或 `<Can>` 组件(参考 `auth-guide` skill) |
|
|
52
|
+
| **应用后端**需要权限控制 | 使用 `@CanRole` 或 `@Can` 装饰器(参考 `auth-guide` skill) |
|
|
53
53
|
|
|
54
54
|
> **禁止**在生成的应用代码(前端/后端)中调用 `lark-cli`。CLI 命令只在 Agent 对话终端中执行。
|
|
55
55
|
|
|
@@ -79,15 +79,15 @@ Agent 在沙箱内直接执行的权限管理工具集,包含两部分能力
|
|
|
79
79
|
权限设计方案
|
|
80
80
|
│
|
|
81
81
|
├─ 推荐模式:静态角色鉴权
|
|
82
|
-
│ └─ 新建 ──→ 按角色清单逐个 CREATE ──→ 编写 CanRole 代码(
|
|
82
|
+
│ └─ 新建 ──→ 按角色清单逐个 CREATE ──→ 编写 CanRole 代码(auth-guide)
|
|
83
83
|
│
|
|
84
84
|
├─ 推荐模式:动态权限点位鉴权
|
|
85
|
-
│ ├─ 新建 ──→ CREATE 角色 → PERM_CREATE_TABLE → PERM_SEED → 编写 @Can 代码(
|
|
86
|
-
│ └─ 升级(仅限历史 CanRole 代码迁移)──→ PERM_CREATE_TABLE → PERM_SEED → CanRole 升级为 Can(
|
|
85
|
+
│ ├─ 新建 ──→ CREATE 角色 → PERM_CREATE_TABLE → PERM_SEED → 编写 @Can 代码(auth-guide)
|
|
86
|
+
│ └─ 升级(仅限历史 CanRole 代码迁移)──→ PERM_CREATE_TABLE → PERM_SEED → CanRole 升级为 Can(auth-guide)
|
|
87
87
|
│
|
|
88
88
|
├─ "给某功能加权限控制" / "新建某个角色"
|
|
89
89
|
│ └──→ QUERY(查询角色)
|
|
90
|
-
│ ├─ 角色存在 ──→ 编写鉴权代码(
|
|
90
|
+
│ ├─ 角色存在 ──→ 编写鉴权代码(auth-guide)
|
|
91
91
|
│ └─ 角色不存在 ──→ CREATE ──→ 编写鉴权代码
|
|
92
92
|
│
|
|
93
93
|
├─ "新功能上线,需要新增权限点位" ──→ PERM_ADD + 同步 @Can/<Can> 代码
|
|
@@ -103,7 +103,7 @@ Agent 在沙箱内直接执行的权限管理工具集,包含两部分能力
|
|
|
103
103
|
|
|
104
104
|
**角色设计由权限设计方案承载**,本 skill 负责角色 CLI 操作和权限点位管理。
|
|
105
105
|
|
|
106
|
-
**日常权限开发流程**:QUERY → 判断是否 CREATE → 编写鉴权代码(参考 `
|
|
106
|
+
**日常权限开发流程**:QUERY → 判断是否 CREATE → 编写鉴权代码(参考 `auth-guide`)。
|
|
107
107
|
|
|
108
108
|
**动态权限点位初始化流程**:CREATE 角色 → PERM_CREATE_TABLE → PERM_SEED → 编写鉴权代码。
|
|
109
109
|
|
|
@@ -161,7 +161,7 @@ lark-cli apps +role-create --app-id "$app_id" --name "图书编辑" --role-id "e
|
|
|
161
161
|
lark-cli apps +role-create --app-id "$app_id" --name "管理员" --role-id "admin" --description "拥有所有业务管理权限"
|
|
162
162
|
```
|
|
163
163
|
|
|
164
|
-
> 创建完所有角色后,按权限设计方案的功能权限映射表编写鉴权代码(参考 `
|
|
164
|
+
> 创建完所有角色后,按权限设计方案的功能权限映射表编写鉴权代码(参考 `auth-guide`)。
|
|
165
165
|
|
|
166
166
|
### 更新角色
|
|
167
167
|
|
|
@@ -287,10 +287,10 @@ DELETE FROM authz_permissions WHERE action = 'export' AND subject = 'Task';
|
|
|
287
287
|
|
|
288
288
|
| 错误 | 正确做法 |
|
|
289
289
|
| ---- | -------- |
|
|
290
|
-
| 在应用代码中调用 `lark-cli` | CLI 仅供 Agent 终端执行;应用代码用 CanRole 组件/装饰器(参考 `
|
|
290
|
+
| 在应用代码中调用 `lark-cli` | CLI 仅供 Agent 终端执行;应用代码用 CanRole 组件/装饰器(参考 `auth-guide`) |
|
|
291
291
|
| 用角色名称当 role_id 直接更新/删除 | 先 `+role-list --name '<exact_name>'` 精确解析出 role_id,多条命中让用户消歧 |
|
|
292
292
|
| 未授权就执行 `+role-delete --yes` / `+role-member-remove --all --yes` | 删除类操作高风险不可逆,先展示影响范围取得明确授权;exit-10 按沙箱约定处理,绝不静默补 `--yes` |
|
|
293
|
-
| 只创建角色不编写鉴权代码 | 创建角色后必须编写鉴权代码(参考 `
|
|
293
|
+
| 只创建角色不编写鉴权代码 | 创建角色后必须编写鉴权代码(参考 `auth-guide`) |
|
|
294
294
|
| 没有设计方案就大批量创建角色 | 先确认是否有权限设计方案输出的角色清单,再按清单逐个 CREATE |
|
|
295
295
|
| 动态权限点位场景只创建角色不建表预填 | 需要执行 PERM_CREATE_TABLE + PERM_SEED |
|
|
296
296
|
| 在管理页面提供权限点位的增删改 | 权限点位的增删改由 Agent 通过 PERM_ADD/UPDATE/DELETE 操作,管理页面只做角色-点位映射 |
|
|
@@ -44,17 +44,17 @@ More is NOT always better:
|
|
|
44
44
|
|
|
45
45
|
## Hard constraints when splitting
|
|
46
46
|
|
|
47
|
-
- **Mutually exclusive scopes**: a typical project splits into `server/` (incl. `server/database/`), `client/`, and `shared/`; each scope is owned by exactly ONE Reviewer. Two Reviewers MUST NOT
|
|
47
|
+
- **Mutually exclusive scopes**: a typical project splits into `server/` (incl. `server/database/`), `client/`, and `shared/`; each scope is owned by exactly ONE Reviewer. Two Reviewers MUST NOT audit the same directory. Reads of shared contracts and paired-request direct contract dependencies for contract verification do not expand review responsibility.
|
|
48
48
|
- **Each Reviewer covers all requested dimensions within its own scope** (default: performance + correctness). Do NOT make a single Reviewer the sole owner of "shared / cross-boundary consistency" — that locks its attention onto type contracts and lets performance bugs inside its scope slip through. Cross-boundary consistency is a shared check between two adjacent Reviewers (e.g. the server Reviewer audits "do shared types match what the server actually returns", the client Reviewer audits "do shared interfaces match what the frontend actually calls").
|
|
49
49
|
- **Change-type reviews (not full-project audits)**: a Reviewer MUST read every scope the change actually touches. If a commit modifies `server/`, you MUST dispatch a Reviewer for `server/` — you cannot get away with only a `client/` Reviewer.
|
|
50
50
|
- **Multiple Reviewers MUST be dispatched in parallel** (multiple tool calls in a single message). Never serially.
|
|
51
|
-
- **Each Reviewer's prompt** must spell out `scope = <specific directories or file list>` and `dimensions = <performance/correctness
|
|
51
|
+
- **Each Reviewer's prompt** must spell out `scope = <specific directories or file list>` and `dimensions = <performance/correctness/...>`. Within the `scope` field, state that out-of-scope reads are limited to shared contracts and the direct contract dependencies of paired requests required by applicable skill checklists; do not audit unrelated files or follow unrelated imports. Do not broadcast the full task to every Reviewer.
|
|
52
52
|
|
|
53
53
|
## Other rules for the dispatch
|
|
54
54
|
|
|
55
55
|
- **Wait synchronously** for all Reviewer reports before fixing. No background dispatch.
|
|
56
|
-
- **Do not pre-read code**; pass scope only (git range, directory paths, or file list). Each Reviewer discovers and reads within its scope.
|
|
57
|
-
- **REQUIRED — Reviewer prompt MUST start with** `<user-original-message>{用户原话}</user-original-message>`. Reviewer
|
|
56
|
+
- **Do not pre-read code**; pass scope only (git range, directory paths, or file list). Each Reviewer discovers and reads within its scope, with only the contract-verification reads allowed above.
|
|
57
|
+
- **REQUIRED — Reviewer prompt MUST start with** `<user-original-message>{用户原话}</user-original-message>`. Reviewer feeds this verbatim text into Step A of its mandatory ACTION block to classify the user's intent into `fix-intent` / `review-only-intent` / `ambiguous`, which decides every issue's `auto-fix` vs `AskUser` bucket; without the verbatim message the intent classification — and therefore the whole per-issue bucketing — is a guess. AskUser options never carry a preset recommendation (all are presented equal-weight), so what the verbatim text protects is correct bucketing, not a "recommended" label. ❌ FORBIDDEN: paraphrase, summarize, translate, or omit the user's message — pass it character-for-character.
|
|
58
58
|
|
|
59
59
|
## Caller anti-pattern checklist (read before dispatching Reviewer)
|
|
60
60
|
|
|
@@ -81,21 +81,21 @@ Reviewer pre-tags each issue with a `policy` field (`auto-fix` or `AskUser`) and
|
|
|
81
81
|
|
|
82
82
|
### Step 1 — Read the ACTION header
|
|
83
83
|
|
|
84
|
-
It tells you: (a) how many issues are tagged `auto-fix`, (b) how many are tagged `AskUser`, (c) the exact `options`
|
|
84
|
+
It tells you: (a) how many issues are tagged `auto-fix`, (b) how many are tagged `AskUser`, (c) the exact closed-set `options` for the `ask_user_question` call (severity decides only which option *set*; there is no `recommended` label — every option is equal-weight).
|
|
85
85
|
|
|
86
|
-
### Step 2 — Fix every `policy: auto-fix` issue immediately
|
|
86
|
+
### Step 2 — Fix every `policy: auto-fix` issue immediately (fix-before-ask)
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
Fix and verify the **entire** `auto-fix` bucket before Step 3, including the user's own reported defect when Reviewer tagged it `auto-fix`. Never ask about those items, and never let the separate `AskUser` bucket block, delay, or replace them — finish every part that does not need confirmation first, then raise what genuinely needs the user. The `AskUser` bucket is not presumed out-of-scope: Reviewer also routes in-scope high-risk fixes (the Step B shapes) there for confirmation, so treat it simply as "the issues Reviewer marked `AskUser`", never as merely extra/out-of-scope findings. If one fix fails, continue the others and report the failed item as `未处理` in the Step 3 description, or in the final report when the AskUser bucket is empty.
|
|
89
89
|
|
|
90
90
|
### Step 3 — Handle `policy: AskUser` issues (only if at least one exists)
|
|
91
91
|
|
|
92
|
-
- **STEP 3a (echo)**: emit a short user-facing summary listing the `policy: AskUser` issues, grouped by 🔴 Critical / 🟠 Bug / 🟡 Suggestion
|
|
93
|
-
- **STEP 3b (call ask_user_question)**: in the same turn, immediately call
|
|
92
|
+
- **STEP 3a (echo)**: emit a short user-facing summary listing the `policy: AskUser` issues, grouped by 🔴 Critical / 🟠 Bug / 🟡 Suggestion. Each item MUST be one concrete line shaped `file:line — 一句话问题与影响` (the locatable problem plus its user-visible effect); never emit a bare generic title that drops the file:line or the concrete problem. ≤25 lines (collapse the rest as `... (其余 N 项见下方表单)`). The user cannot see Reviewer's report directly — without this echo they cannot decide.
|
|
93
|
+
- **STEP 3b (call `ask_user_question`)**: in the same turn, immediately call it with `header: Review 确认`; `description`: the same concrete list from STEP 3a; and `questions: [{ question: "Reviewer 将以下问题标记为需确认,是否处理?", component: "Radio", isRequired: true, allowOther: false, options: <computed options> }]` — the tool defaults Radio `allowOther` to true and renders a free-text Other entry that Step 4 cannot execute, so `false` keeps the set closed. Pass the ACTION header's option set verbatim; options are equal-weight: never append `(推荐)`, mark or preselect a default, or invent/rename a label. The canonical labels (修复严重问题 / 修复所有问题 / 修复建议项 / 不修复) are a closed set. Ask only when the AskUser bucket is non-empty (these are the issues Reviewer marked `AskUser`, not presumed out-of-scope).
|
|
94
94
|
- No FINAL reply between 3a and 3b.
|
|
95
95
|
|
|
96
96
|
### Step 4 — Act on the user's choice
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
The neutral-options rule means a label should never carry `(推荐)`; as a defensive no-op for any legacy/tool-injected marker, strip a trailing `(推荐)` from the returned label before matching:
|
|
99
99
|
|
|
100
100
|
- `修复严重问题` → fix the 🔴+🟠 subset of `policy: AskUser` issues, then report.
|
|
101
101
|
- `修复所有问题` → fix every `policy: AskUser` issue, then report.
|
|
@@ -45,17 +45,17 @@ More is NOT always better:
|
|
|
45
45
|
|
|
46
46
|
## Hard constraints when splitting
|
|
47
47
|
|
|
48
|
-
- **Mutually exclusive scopes**: a typical project splits into `server/` (incl. `server/database/`), `client/`, and `shared/`; each scope is owned by exactly ONE Reviewer. Two Reviewers MUST NOT
|
|
48
|
+
- **Mutually exclusive scopes**: a typical project splits into `server/` (incl. `server/database/`), `client/`, and `shared/`; each scope is owned by exactly ONE Reviewer. Two Reviewers MUST NOT audit the same directory. Reads of shared contracts and paired-request direct contract dependencies for contract verification do not expand review responsibility.
|
|
49
49
|
- **Each Reviewer covers all requested dimensions within its own scope** (default: performance + correctness). Do NOT make a single Reviewer the sole owner of "shared / cross-boundary consistency" — that locks its attention onto type contracts and lets performance bugs inside its scope slip through. Cross-boundary consistency is a shared check between two adjacent Reviewers (e.g. the server Reviewer audits "do shared types match what the server actually returns", the client Reviewer audits "do shared interfaces match what the frontend actually calls").
|
|
50
50
|
- **Change-type reviews (not full-project audits)**: a Reviewer MUST read every scope the change actually touches. If a commit modifies `server/`, you MUST dispatch a Reviewer for `server/` — you cannot get away with only a `client/` Reviewer.
|
|
51
51
|
- **Multiple Reviewers MUST be dispatched in parallel** (multiple tool calls in a single message). Never serially.
|
|
52
|
-
- **Each Reviewer's prompt** must spell out `scope = <specific directories or file list>` and `dimensions = <performance/correctness
|
|
52
|
+
- **Each Reviewer's prompt** must spell out `scope = <specific directories or file list>` and `dimensions = <performance/correctness/...>`. Within the `scope` field, state that out-of-scope reads are limited to shared contracts and the direct contract dependencies of paired requests required by applicable skill checklists; do not audit unrelated files or follow unrelated imports. Do not broadcast the full task to every Reviewer.
|
|
53
53
|
|
|
54
54
|
## Other rules for the dispatch
|
|
55
55
|
|
|
56
56
|
- **Wait synchronously** for all Reviewer reports before fixing. No background dispatch.
|
|
57
|
-
- **Do not pre-read code**; pass scope only (git range, directory paths, or file list). Each Reviewer discovers and reads within its scope.
|
|
58
|
-
- **REQUIRED — Reviewer prompt MUST start with** `<user-original-message>{用户原话}</user-original-message>`. Reviewer
|
|
57
|
+
- **Do not pre-read code**; pass scope only (git range, directory paths, or file list). Each Reviewer discovers and reads within its scope, with only the contract-verification reads allowed above.
|
|
58
|
+
- **REQUIRED — Reviewer prompt MUST start with** `<user-original-message>{用户原话}</user-original-message>`. Reviewer feeds this verbatim text into Step A of its mandatory ACTION block to classify the user's intent into `fix-intent` / `review-only-intent` / `ambiguous`, which decides every issue's `auto-fix` vs `AskUser` bucket; without the verbatim message the intent classification — and therefore the whole per-issue bucketing — is a guess. AskUser options never carry a preset recommendation (all are presented equal-weight), so what the verbatim text protects is correct bucketing, not a "recommended" label. ❌ FORBIDDEN: paraphrase, summarize, translate, or omit the user's message — pass it character-for-character.
|
|
59
59
|
|
|
60
60
|
## Caller anti-pattern checklist (read before dispatching Reviewer)
|
|
61
61
|
|
|
@@ -82,22 +82,22 @@ Reviewer pre-tags each issue with a `policy` field (`auto-fix` or `AskUser`) and
|
|
|
82
82
|
|
|
83
83
|
### Step 1 — Read the ACTION header
|
|
84
84
|
|
|
85
|
-
It tells you: (a) how many issues are tagged `auto-fix`, (b) how many are tagged `AskUser`, (c) the exact `options`
|
|
85
|
+
It tells you: (a) how many issues are tagged `auto-fix`, (b) how many are tagged `AskUser`, (c) the exact closed-set `options` for the `ask_user_question` call (severity decides only which option *set*; there is no `recommended` label — every option is equal-weight).
|
|
86
86
|
|
|
87
|
-
### Step 2 — Fix every `policy: auto-fix` issue immediately
|
|
87
|
+
### Step 2 — Fix every `policy: auto-fix` issue immediately (fix-before-ask)
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
Fix and verify the **entire** `auto-fix` bucket before Step 3, including the user's own reported defect when Reviewer tagged it `auto-fix`. Never ask about those items, and never let the separate `AskUser` bucket block, delay, or replace them — finish every part that does not need confirmation first, then raise what genuinely needs the user. The `AskUser` bucket is not presumed out-of-scope: Reviewer also routes in-scope high-risk fixes (the Step B shapes) there for confirmation, so treat it simply as "the issues Reviewer marked `AskUser`", never as merely extra/out-of-scope findings. If one fix fails, continue the others and report the failed item as `未处理` in the Step 3 description, or in the final report when the AskUser bucket is empty.
|
|
90
90
|
|
|
91
91
|
### Step 3 — Handle `policy: AskUser` issues (only if at least one exists)
|
|
92
92
|
|
|
93
|
-
- **STEP 3a (echo)**: emit a short user-facing summary listing the `policy: AskUser` issues, grouped by 🔴 Critical / 🟠 Bug / 🟡 Suggestion
|
|
94
|
-
- **STEP 3b (call ask_user_question)**: in the same turn, immediately call
|
|
93
|
+
- **STEP 3a (echo)**: emit a short user-facing summary listing the `policy: AskUser` issues, grouped by 🔴 Critical / 🟠 Bug / 🟡 Suggestion. Each item MUST be one concrete line shaped `file:line — 一句话问题与影响` (the locatable problem plus its user-visible effect); never emit a bare generic title that drops the file:line or the concrete problem. ≤25 lines (collapse the rest as `... (其余 N 项见下方表单)`). The user cannot see Reviewer's report directly — without this echo they cannot decide.
|
|
94
|
+
- **STEP 3b (call `ask_user_question`)**: in the same turn, immediately call it with `header: Review 确认`; `description`: the same concrete list from STEP 3a; and `questions: [{ question: "Reviewer 将以下问题标记为需确认,是否处理?", component: "Radio", isRequired: true, allowOther: false, options: <computed options> }]` — the tool defaults Radio `allowOther` to true and renders a free-text Other entry that Step 4 cannot execute, so `false` keeps the set closed. Pass the ACTION header's option set verbatim; options are equal-weight: never append `(推荐)`, mark or preselect a default, or invent/rename a label. The canonical labels (修复严重问题 / 修复所有问题 / 修复建议项 / 不修复) are a closed set. Ask only when the AskUser bucket is non-empty (these are the issues Reviewer marked `AskUser`, not presumed out-of-scope).
|
|
95
95
|
- No FINAL reply between 3a and 3b.
|
|
96
96
|
- **STEP 3b applies only if `ask_user_question` is in your tool list.** Some chains deliberately omit it (no confirmation step by design). If you do not have that tool: do STEP 3a only and stop there — this bucket degrades to report-only, and Step 4 does not apply. Do NOT seek confirmation by any other means (no free-text question, no other tool), and do NOT promote these issues to auto-fix. State plainly which issues were reported but not acted on; never present "not confirmed" as "no problem".
|
|
97
97
|
|
|
98
98
|
### Step 4 — Act on the user's choice
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
The neutral-options rule means a label should never carry `(推荐)`; as a defensive no-op for any legacy/tool-injected marker, strip a trailing `(推荐)` from the returned label before matching:
|
|
101
101
|
|
|
102
102
|
- `修复严重问题` → fix the 🔴+🟠 subset of `policy: AskUser` issues, then report.
|
|
103
103
|
- `修复所有问题` → fix every `policy: AskUser` issue, then report.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/coding-miaoda-sandbox-skills",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.61",
|
|
4
4
|
"description": "Miaoda 合并沙箱 skills 包(包含原 miaoda-skills 的 miaoda / miaoda-modern / miaoda-design / shared 四条业务线);发布公网 npm,随沙箱运行时经 update-skills 同步到 .agent/skills/",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|