@miniidealab/openlogos 0.3.3 → 0.3.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/dist/index.js +1 -1
- package/package.json +1 -1
- package/skills/api-designer/SKILL.en.md +16 -0
- package/skills/api-designer/SKILL.md +16 -0
- package/skills/change-writer/SKILL.en.md +1 -0
- package/skills/change-writer/SKILL.md +1 -0
- package/skills/code-reviewer/SKILL.en.md +6 -1
- package/skills/code-reviewer/SKILL.md +6 -1
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -188,6 +188,22 @@ If gaps are found, supplement them before outputting the final version.
|
|
|
188
188
|
- Error responses uniformly reference `$ref: '#/components/schemas/ErrorResponse'`
|
|
189
189
|
- Every endpoint's `description` must annotate the source sequence diagram step
|
|
190
190
|
|
|
191
|
+
## YAML Formatting Rules (MUST Follow)
|
|
192
|
+
|
|
193
|
+
YAML is whitespace- and character-sensitive. AI-generated YAML frequently breaks due to unquoted special characters. **Strictly follow these rules:**
|
|
194
|
+
|
|
195
|
+
1. **Always double-quote `description` and `summary` values** — any string containing `:`, `→`, `#`, `&`, `*`, `!`, `>`, `|`, `%`, `@`, `` ` ``, `{`, `}`, `[`, or `]` MUST be wrapped in `"..."`.
|
|
196
|
+
```yaml
|
|
197
|
+
# ❌ WRONG — colon + arrow breaks YAML parsing
|
|
198
|
+
description: Source: S05 Step 1 → Step 4.
|
|
199
|
+
|
|
200
|
+
# ✅ CORRECT
|
|
201
|
+
description: "Source: S05 Step 1 → Step 4."
|
|
202
|
+
```
|
|
203
|
+
2. **Always quote response status code keys** — use `'201'` not `201` to prevent YAML interpreting them as integers.
|
|
204
|
+
3. **Self-check after generation** — after generating each YAML file, mentally re-parse it to verify no unquoted special characters exist. Pay special attention to `description` fields that reference scenario steps (they always contain `:`).
|
|
205
|
+
4. **When in doubt, quote it** — quoting a safe string is harmless; leaving a dangerous string unquoted breaks the entire file.
|
|
206
|
+
|
|
191
207
|
## Best Practices
|
|
192
208
|
|
|
193
209
|
- **APIs emerge from sequence diagrams**: If an API cannot be traced back to a sequence diagram, it most likely should not exist. Design sequence diagrams first, then APIs — not the other way around
|
|
@@ -188,6 +188,22 @@ paths:
|
|
|
188
188
|
- 错误响应统一引用 `$ref: '#/components/schemas/ErrorResponse'`
|
|
189
189
|
- 每个端点的 `description` 必须标注来源时序图步骤
|
|
190
190
|
|
|
191
|
+
## YAML 格式规则(必须遵守)
|
|
192
|
+
|
|
193
|
+
YAML 对空白和特殊字符敏感。AI 生成的 YAML 经常因为特殊字符未加引号而导致解析失败。**必须严格遵守以下规则:**
|
|
194
|
+
|
|
195
|
+
1. **`description` 和 `summary` 的值必须用双引号包裹** — 任何包含 `:`、`→`、`#`、`&`、`*`、`!`、`>`、`|`、`%`、`@`、`` ` ``、`{`、`}`、`[`、`]` 的字符串都必须用 `"..."` 包裹。
|
|
196
|
+
```yaml
|
|
197
|
+
# ❌ 错误 — 冒号和箭头导致 YAML 解析失败
|
|
198
|
+
description: 来源:S05 Step 1 → Step 4.
|
|
199
|
+
|
|
200
|
+
# ✅ 正确
|
|
201
|
+
description: "来源:S05 Step 1 → Step 4."
|
|
202
|
+
```
|
|
203
|
+
2. **响应状态码 key 必须加引号** — 使用 `'201'` 而非 `201`,防止 YAML 将其解析为整数。
|
|
204
|
+
3. **生成后自检** — 每生成一个 YAML 文件后,重新审视是否存在未加引号的特殊字符。尤其注意引用场景步骤的 `description` 字段(它们总是包含 `:`)。
|
|
205
|
+
4. **拿不准就加引号** — 给安全字符串加引号无害,但漏掉危险字符串的引号会导致整个文件解析失败。
|
|
206
|
+
|
|
191
207
|
## 实践经验
|
|
192
208
|
|
|
193
209
|
- **API 从时序图浮现**:如果一个 API 在时序图中找不到出处,它大概率不应该存在。先画时序图再设计 API,而非反过来
|
|
@@ -99,6 +99,7 @@ Automatically break down the task checklist based on the change type and impact
|
|
|
99
99
|
## Phase 3: Technical Changes
|
|
100
100
|
- [ ] Update sequence diagram for S0x
|
|
101
101
|
- [ ] Update API YAML
|
|
102
|
+
- [ ] **Validate API YAML** — all files in `logos/resources/api/` must be valid YAML and valid OpenAPI 3.x (all `description`/`summary` values containing `:` or special chars must be double-quoted)
|
|
102
103
|
- [ ] Update DB DDL
|
|
103
104
|
- [ ] Update orchestration test cases
|
|
104
105
|
- [ ] Implement code changes
|
|
@@ -32,7 +32,11 @@ For projects without APIs (pure CLI / libraries), API consistency checks can be
|
|
|
32
32
|
|
|
33
33
|
### Step 1: Load Specification Context
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
**Pre-check — YAML Validity (before anything else):**
|
|
36
|
+
|
|
37
|
+
Before loading API specs, validate that all `logos/resources/api/*.yaml` files are syntactically valid YAML and conform to the OpenAPI 3.x schema. If any file fails parsing (e.g., unquoted special characters in `description` fields), report it as a **Critical** blocker immediately — do not proceed with the rest of the review until YAML errors are fixed.
|
|
38
|
+
|
|
39
|
+
**Then** read the following files to establish a "reference baseline" for the code review:
|
|
36
40
|
|
|
37
41
|
- **API YAML** (`logos/resources/api/*.yaml`): Extract endpoint inventory, record each endpoint's path, method, request body schema, response schema, and status codes
|
|
38
42
|
- **Scenario Sequence Diagrams** (`logos/resources/prd/3-technical-plan/2-scenario-implementation/`): Extract all EX exception case IDs and expected behaviors
|
|
@@ -64,6 +68,7 @@ Compare code implementation against API YAML specification endpoint by endpoint:
|
|
|
64
68
|
| Response Fields | Whether JSON field names and types returned by code match YAML `responses.schema` | Critical |
|
|
65
69
|
| Status Codes | Whether HTTP status codes returned in normal and error cases match YAML definitions | Critical |
|
|
66
70
|
| Error Response Format | Whether error responses follow the unified `{ code, message, details? }` format | Warning |
|
|
71
|
+
| YAML Validity | All `logos/resources/api/*.yaml` files parse as valid YAML and valid OpenAPI 3.x — unquoted special characters (`:`, `→`, `#`) in `description`/`summary` values are a common failure mode | Critical |
|
|
67
72
|
|
|
68
73
|
**Output format**:
|
|
69
74
|
|
|
@@ -32,7 +32,11 @@
|
|
|
32
32
|
|
|
33
33
|
### Step 1: 加载规格上下文
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
**前置检查 — YAML 有效性(优先于一切):**
|
|
36
|
+
|
|
37
|
+
在加载 API 规格之前,先验证所有 `logos/resources/api/*.yaml` 文件是否为有效 YAML 且符合 OpenAPI 3.x 规范。如果任何文件解析失败(例如 `description` 字段中特殊字符未加引号),立即报告为 **Critical** 阻塞项——在 YAML 错误修复前不进行后续审查。
|
|
38
|
+
|
|
39
|
+
**然后**读取以下文件,建立代码审查的"参照基准":
|
|
36
40
|
|
|
37
41
|
- **API YAML**(`logos/resources/api/*.yaml`):提取端点清单,记录每个端点的路径、方法、请求体 schema、响应 schema、状态码
|
|
38
42
|
- **场景时序图**(`logos/resources/prd/3-technical-plan/2-scenario-implementation/`):提取所有 EX 异常用例编号和预期行为
|
|
@@ -64,6 +68,7 @@
|
|
|
64
68
|
| 响应字段 | 代码返回的 JSON 字段名和类型是否与 YAML 中 `responses.schema` 一致 | Critical |
|
|
65
69
|
| 状态码 | 正常和异常情况下返回的 HTTP 状态码是否与 YAML 定义一致 | Critical |
|
|
66
70
|
| 错误响应格式 | 错误响应是否遵循 `{ code, message, details? }` 统一格式 | Warning |
|
|
71
|
+
| YAML 有效性 | `logos/resources/api/*.yaml` 所有文件是否为有效 YAML 且符合 OpenAPI 3.x 规范——`description`/`summary` 值中未加引号的特殊字符(`:`、`→`、`#`)是常见故障点 | Critical |
|
|
67
72
|
|
|
68
73
|
**输出格式**:
|
|
69
74
|
|