@miniidealab/openlogos 0.4.3 → 0.5.3
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/commands/archive.d.ts.map +1 -1
- package/dist/commands/archive.js +14 -1
- package/dist/commands/archive.js.map +1 -1
- package/dist/commands/change.d.ts.map +1 -1
- package/dist/commands/change.js +7 -0
- package/dist/commands/change.js.map +1 -1
- package/dist/commands/init.d.ts +4 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +106 -42
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +25 -1
- package/dist/commands/sync.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +2 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/sql-comments.d.ts +14 -0
- package/dist/lib/sql-comments.d.ts.map +1 -0
- package/dist/lib/sql-comments.js +69 -0
- package/dist/lib/sql-comments.js.map +1 -0
- package/package.json +5 -4
- package/skills/db-designer/SKILL.en.md +53 -11
- package/skills/db-designer/SKILL.md +53 -11
- package/skills/project-init/SKILL.en.md +1 -1
- package/skills/project-init/SKILL.md +1 -1
- package/skills/test-orchestrator/SKILL.en.md +1 -1
- package/skills/test-orchestrator/SKILL.md +1 -1
- package/skills/test-writer/SKILL.en.md +1 -1
- package/skills/test-writer/SKILL.md +1 -1
- package/spec/agents-md.md +117 -0
- package/spec/change-management.md +197 -0
- package/spec/directory-convention.md +123 -0
- package/spec/logos-project.md +135 -0
- package/spec/logos.config.schema.json +147 -0
- package/spec/sql-comment-convention.md +225 -0
- package/spec/test-results.md +255 -0
- package/spec/workflow.md +277 -0
|
@@ -92,6 +92,27 @@ CREATE TABLE users (
|
|
|
92
92
|
);
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
+
**Example (SQLite — using `@comment` structured annotations)**:
|
|
96
|
+
|
|
97
|
+
```sql
|
|
98
|
+
-- Users table (source: auth.yaml → register, login)
|
|
99
|
+
CREATE TABLE users (
|
|
100
|
+
-- @comment User unique identifier, UUID v4 string
|
|
101
|
+
id TEXT PRIMARY KEY NOT NULL,
|
|
102
|
+
-- @comment User email, normalized to lowercase
|
|
103
|
+
email TEXT NOT NULL UNIQUE,
|
|
104
|
+
-- @comment Argon2id password hash, stores hash only
|
|
105
|
+
password_hash TEXT NOT NULL,
|
|
106
|
+
-- @comment Creation time, ISO 8601 format
|
|
107
|
+
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')),
|
|
108
|
+
-- @comment Last update time
|
|
109
|
+
updated_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))
|
|
110
|
+
);
|
|
111
|
+
-- @table-comment users Users table storing core registered user information
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
> **SQLite Comment Convention**: SQLite does not support `COMMENT ON` syntax. You MUST use `-- @comment` preceding annotations (for columns) and `-- @table-comment <table> <description>` trailing annotations (for tables). See `logos/spec/sql-comment-convention.md` for details.
|
|
115
|
+
|
|
95
116
|
### Step 4: Design Table Relationships
|
|
96
117
|
|
|
97
118
|
Design foreign keys based on entity relationships in the API:
|
|
@@ -153,29 +174,42 @@ Organize the DDL file in the following order:
|
|
|
153
174
|
3. Association tables (tables with foreign key dependencies after)
|
|
154
175
|
4. Indexes
|
|
155
176
|
5. Security policies (RLS / Policy)
|
|
156
|
-
6. Table and field comments
|
|
177
|
+
6. Table and field comments:
|
|
178
|
+
- PostgreSQL: use `COMMENT ON TABLE` / `COMMENT ON COLUMN`
|
|
179
|
+
- MySQL: use inline `COMMENT`
|
|
180
|
+
- SQLite: use `-- @comment` (columns) + `-- @table-comment` (tables), see SQLite comment rules below
|
|
157
181
|
|
|
158
182
|
Add a comment above each DDL block noting the source API endpoint.
|
|
159
183
|
|
|
184
|
+
**SQLite Comment Rules (MUST Follow)**:
|
|
185
|
+
|
|
186
|
+
When `tech_stack.database` is SQLite, you MUST use the following structured comment format:
|
|
187
|
+
|
|
188
|
+
1. **Column comments**: write `-- @comment <description>` on the line **immediately above** the column definition
|
|
189
|
+
- **No blank lines** allowed between `-- @comment` and the column (blank lines break the association)
|
|
190
|
+
- Multi-line: consecutive `-- @comment` lines are concatenated automatically
|
|
191
|
+
2. **Table comments**: write `-- @table-comment <table_name> <description>` on the line **immediately after** `CREATE TABLE ... ();`
|
|
192
|
+
3. Constraint lines (`FOREIGN KEY`, standalone `CHECK`, `UNIQUE`) do **not** need `-- @comment`
|
|
193
|
+
|
|
160
194
|
## Output Specification
|
|
161
195
|
|
|
162
196
|
- File format: SQL (dialect determined by `tech_stack.database`)
|
|
163
197
|
- Storage location: `logos/resources/database/`
|
|
164
198
|
- Single file output: `schema.sql` (simple projects); or split by domain: `auth.sql`, `billing.sql` (complex projects)
|
|
165
|
-
- Every table must have a comment (PostgreSQL: `COMMENT ON TABLE`; MySQL: `COMMENT = '...'`)
|
|
166
|
-
- Every field must have a comment (PostgreSQL: `COMMENT ON COLUMN`; MySQL: `COMMENT '...'` after field definition)
|
|
199
|
+
- Every table must have a comment (PostgreSQL: `COMMENT ON TABLE`; MySQL: `COMMENT = '...'`; SQLite: `-- @table-comment`)
|
|
200
|
+
- Every field must have a comment (PostgreSQL: `COMMENT ON COLUMN`; MySQL: `COMMENT '...'` after field definition; SQLite: `-- @comment`)
|
|
167
201
|
- Add a SQL comment above each DDL block noting the source API endpoint
|
|
168
202
|
|
|
169
203
|
## Database Dialect Quick Reference
|
|
170
204
|
|
|
171
|
-
| Feature | PostgreSQL | MySQL |
|
|
172
|
-
|
|
173
|
-
| UUID Primary Key | `UUID DEFAULT gen_random_uuid()` | `CHAR(36) DEFAULT (UUID())` or
|
|
174
|
-
| Timestamp Type | `TIMESTAMPTZ` | `DATETIME` / `TIMESTAMP` (mind timezone handling) |
|
|
175
|
-
| JSON Support | `JSONB` (indexable) | `JSON` (limited functionality) |
|
|
176
|
-
| Row-Level Security | RLS (`ENABLE ROW LEVEL SECURITY`) | Not supported;
|
|
177
|
-
| Table Comment | `COMMENT ON TABLE t IS '...'` | `CREATE TABLE t (...) COMMENT = '...'` |
|
|
178
|
-
| Column Comment | `COMMENT ON COLUMN t.c IS '...'` | `col_name TYPE COMMENT '...'` |
|
|
205
|
+
| Feature | PostgreSQL | MySQL | SQLite |
|
|
206
|
+
|---------|-----------|-------|--------|
|
|
207
|
+
| UUID Primary Key | `UUID DEFAULT gen_random_uuid()` | `CHAR(36) DEFAULT (UUID())` or `BINARY(16)` | `TEXT PRIMARY KEY NOT NULL` (app-generated UUID) |
|
|
208
|
+
| Timestamp Type | `TIMESTAMPTZ` | `DATETIME` / `TIMESTAMP` (mind timezone handling) | `TEXT` (ISO 8601 string) |
|
|
209
|
+
| JSON Support | `JSONB` (indexable) | `JSON` (limited functionality) | `TEXT` (app-layer JSON serialization) |
|
|
210
|
+
| Row-Level Security | RLS (`ENABLE ROW LEVEL SECURITY`) | Not supported; application layer | Not supported; application layer |
|
|
211
|
+
| Table Comment | `COMMENT ON TABLE t IS '...'` | `CREATE TABLE t (...) COMMENT = '...'` | `-- @table-comment t description` |
|
|
212
|
+
| Column Comment | `COMMENT ON COLUMN t.c IS '...'` | `col_name TYPE COMMENT '...'` | `-- @comment description` (preceding line) |
|
|
179
213
|
|
|
180
214
|
## Best Practices
|
|
181
215
|
|
|
@@ -202,6 +236,14 @@ Add a comment above each DDL block noting the source API endpoint.
|
|
|
202
236
|
- **Character set**: specify `CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci` when creating tables
|
|
203
237
|
- **Engine**: always use `ENGINE=InnoDB`
|
|
204
238
|
|
|
239
|
+
### SQLite-Specific
|
|
240
|
+
|
|
241
|
+
- **Primary key**: `TEXT PRIMARY KEY NOT NULL` (app-generated UUID v4) or `INTEGER PRIMARY KEY AUTOINCREMENT`
|
|
242
|
+
- **Timestamp type**: use `TEXT` with ISO 8601 strings, default `DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))`
|
|
243
|
+
- **Foreign keys**: must execute `PRAGMA foreign_keys = ON;` at connection time
|
|
244
|
+
- **Comments**: MUST use `-- @comment` / `-- @table-comment` structured annotations (see `logos/spec/sql-comment-convention.md`)
|
|
245
|
+
- **No triggers**: `updated_at` must be refreshed at the application layer; do not rely on `ON UPDATE` triggers
|
|
246
|
+
|
|
205
247
|
## Recommended Prompts
|
|
206
248
|
|
|
207
249
|
The following prompts can be copied directly for use with AI:
|
|
@@ -92,6 +92,27 @@ CREATE TABLE users (
|
|
|
92
92
|
);
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
+
**示例(SQLite — 使用 `@comment` 结构化注释)**:
|
|
96
|
+
|
|
97
|
+
```sql
|
|
98
|
+
-- 用户表(来源:auth.yaml → register, login)
|
|
99
|
+
CREATE TABLE users (
|
|
100
|
+
-- @comment 用户唯一标识,UUID v4 字符串
|
|
101
|
+
id TEXT PRIMARY KEY NOT NULL,
|
|
102
|
+
-- @comment 用户邮箱,已归一化为小写
|
|
103
|
+
email TEXT NOT NULL UNIQUE,
|
|
104
|
+
-- @comment Argon2id 密码哈希,仅存哈希
|
|
105
|
+
password_hash TEXT NOT NULL,
|
|
106
|
+
-- @comment 创建时间,ISO 8601 格式
|
|
107
|
+
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')),
|
|
108
|
+
-- @comment 最后更新时间
|
|
109
|
+
updated_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))
|
|
110
|
+
);
|
|
111
|
+
-- @table-comment users 用户表,存储注册用户的核心信息
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
> **SQLite 注释约定**:SQLite 不支持 `COMMENT ON` 语法,必须使用 `-- @comment` 前置注释(字段)和 `-- @table-comment <表名> <描述>` 后置注释(表)。规则详见 `logos/spec/sql-comment-convention.md`。
|
|
115
|
+
|
|
95
116
|
### Step 4: 设计表间关联
|
|
96
117
|
|
|
97
118
|
根据 API 中的实体关系设计外键:
|
|
@@ -153,29 +174,42 @@ CREATE INDEX idx_projects_owner ON projects(owner_id);
|
|
|
153
174
|
3. 关联表(有外键依赖的表后建)
|
|
154
175
|
4. 索引
|
|
155
176
|
5. 安全策略(RLS / Policy)
|
|
156
|
-
6.
|
|
177
|
+
6. 表和字段注释:
|
|
178
|
+
- PostgreSQL:使用 `COMMENT ON TABLE` / `COMMENT ON COLUMN`
|
|
179
|
+
- MySQL:使用内联 `COMMENT`
|
|
180
|
+
- SQLite:使用 `-- @comment`(字段)+ `-- @table-comment`(表),详见下方 SQLite 注释规则
|
|
157
181
|
|
|
158
182
|
每段 DDL 上方用注释标注来源 API 端点。
|
|
159
183
|
|
|
184
|
+
**SQLite 注释规则(MUST Follow)**:
|
|
185
|
+
|
|
186
|
+
当 `tech_stack.database` 为 SQLite 时,必须使用以下结构化注释格式:
|
|
187
|
+
|
|
188
|
+
1. **字段注释**:在字段定义行的**紧邻上方**写 `-- @comment <描述>`
|
|
189
|
+
- 与字段之间**不允许空行**(空行会断开关联)
|
|
190
|
+
- 多行注释:连续多个 `-- @comment` 行自动拼接
|
|
191
|
+
2. **表注释**:在 `CREATE TABLE ... ();` 语句**紧邻下方**写 `-- @table-comment <表名> <描述>`
|
|
192
|
+
3. 约束行(`FOREIGN KEY`、独立 `CHECK`、`UNIQUE`)**不需要** `-- @comment`
|
|
193
|
+
|
|
160
194
|
## 输出规范
|
|
161
195
|
|
|
162
196
|
- 文件格式:SQL(方言由 `tech_stack.database` 决定)
|
|
163
197
|
- 存放位置:`logos/resources/database/`
|
|
164
198
|
- 单文件输出:`schema.sql`(简单项目);或按领域分文件:`auth.sql`、`billing.sql`(复杂项目)
|
|
165
|
-
- 每张表必须有注释(PostgreSQL: `COMMENT ON TABLE`;MySQL: `COMMENT = '...'`)
|
|
166
|
-
- 每个字段必须有注释(PostgreSQL: `COMMENT ON COLUMN`;MySQL: 字段定义后 `COMMENT '...'`)
|
|
199
|
+
- 每张表必须有注释(PostgreSQL: `COMMENT ON TABLE`;MySQL: `COMMENT = '...'`;SQLite: `-- @table-comment`)
|
|
200
|
+
- 每个字段必须有注释(PostgreSQL: `COMMENT ON COLUMN`;MySQL: 字段定义后 `COMMENT '...'`;SQLite: `-- @comment`)
|
|
167
201
|
- 每段 DDL 上方用 SQL 注释标注来源 API 端点
|
|
168
202
|
|
|
169
203
|
## 数据库方言差异速查
|
|
170
204
|
|
|
171
|
-
| 特性 | PostgreSQL | MySQL |
|
|
172
|
-
|
|
173
|
-
| UUID 主键 | `UUID DEFAULT gen_random_uuid()` | `CHAR(36) DEFAULT (UUID())`
|
|
174
|
-
| 时间类型 | `TIMESTAMPTZ` | `DATETIME` / `TIMESTAMP`(注意时区处理) |
|
|
175
|
-
| JSON 支持 | `JSONB`(可索引) | `JSON`(功能受限) |
|
|
176
|
-
| 行级安全 | RLS (`ENABLE ROW LEVEL SECURITY`) | 不支持,需在应用层实现 |
|
|
177
|
-
| 表注释 | `COMMENT ON TABLE t IS '...'` | `CREATE TABLE t (...) COMMENT = '...'` |
|
|
178
|
-
| 字段注释 | `COMMENT ON COLUMN t.c IS '...'` | `col_name TYPE COMMENT '...'` |
|
|
205
|
+
| 特性 | PostgreSQL | MySQL | SQLite |
|
|
206
|
+
|------|-----------|-------|--------|
|
|
207
|
+
| UUID 主键 | `UUID DEFAULT gen_random_uuid()` | `CHAR(36) DEFAULT (UUID())` 或 `BINARY(16)` | `TEXT PRIMARY KEY NOT NULL`(应用层生成 UUID) |
|
|
208
|
+
| 时间类型 | `TIMESTAMPTZ` | `DATETIME` / `TIMESTAMP`(注意时区处理) | `TEXT`(ISO 8601 字符串) |
|
|
209
|
+
| JSON 支持 | `JSONB`(可索引) | `JSON`(功能受限) | `TEXT`(应用层 JSON 序列化) |
|
|
210
|
+
| 行级安全 | RLS (`ENABLE ROW LEVEL SECURITY`) | 不支持,需在应用层实现 | 不支持,需在应用层实现 |
|
|
211
|
+
| 表注释 | `COMMENT ON TABLE t IS '...'` | `CREATE TABLE t (...) COMMENT = '...'` | `-- @table-comment t 描述` |
|
|
212
|
+
| 字段注释 | `COMMENT ON COLUMN t.c IS '...'` | `col_name TYPE COMMENT '...'` | `-- @comment 描述`(紧邻字段上方) |
|
|
179
213
|
|
|
180
214
|
## 实践经验
|
|
181
215
|
|
|
@@ -202,6 +236,14 @@ CREATE INDEX idx_projects_owner ON projects(owner_id);
|
|
|
202
236
|
- **字符集**:建表时指定 `CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci`
|
|
203
237
|
- **引擎**:一律使用 `ENGINE=InnoDB`
|
|
204
238
|
|
|
239
|
+
### SQLite 特有
|
|
240
|
+
|
|
241
|
+
- **主键**:`TEXT PRIMARY KEY NOT NULL`(应用层生成 UUID v4)或 `INTEGER PRIMARY KEY AUTOINCREMENT`
|
|
242
|
+
- **时间类型**:使用 `TEXT` 存储 ISO 8601 字符串,默认值 `DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))`
|
|
243
|
+
- **外键**:须在连接时执行 `PRAGMA foreign_keys = ON;`
|
|
244
|
+
- **注释**:必须使用 `-- @comment` / `-- @table-comment` 结构化注释(见 `logos/spec/sql-comment-convention.md`)
|
|
245
|
+
- **无触发器**:`updated_at` 须在应用层刷新,不依赖 `ON UPDATE` 触发器
|
|
246
|
+
|
|
205
247
|
## 推荐提示词
|
|
206
248
|
|
|
207
249
|
以下提示词可以直接复制给 AI 使用:
|
|
@@ -141,7 +141,7 @@ Report to the user which files and directories were created, and provide next-st
|
|
|
141
141
|
|
|
142
142
|
## Output Specification
|
|
143
143
|
|
|
144
|
-
- `logos/logos.config.json`: Valid JSON, conforming to `spec/logos.config.schema.json`
|
|
144
|
+
- `logos/logos.config.json`: Valid JSON, conforming to `logos/spec/logos.config.schema.json`
|
|
145
145
|
- `logos/logos-project.yaml`: Valid YAML
|
|
146
146
|
- `AGENTS.md` / `CLAUDE.md`: Markdown format, located in the project root directory
|
|
147
147
|
- All directories under `logos/` are created; empty directories contain `.gitkeep`
|
|
@@ -141,7 +141,7 @@ Read `logos/logos-project.yaml` first to understand the project resource index.
|
|
|
141
141
|
|
|
142
142
|
## 输出规范
|
|
143
143
|
|
|
144
|
-
- `logos/logos.config.json`:有效的 JSON,符合 `spec/logos.config.schema.json`
|
|
144
|
+
- `logos/logos.config.json`:有效的 JSON,符合 `logos/spec/logos.config.schema.json`
|
|
145
145
|
- `logos/logos-project.yaml`:有效的 YAML
|
|
146
146
|
- `AGENTS.md` / `CLAUDE.md`:Markdown 格式,位于项目根目录
|
|
147
147
|
- `logos/` 下所有目录已创建,空目录包含 `.gitkeep`
|
|
@@ -130,7 +130,7 @@ Orchestration behavior for different strategies:
|
|
|
130
130
|
- **Concurrency testing**: Key scenarios should account for concurrent situations (e.g., two users registering with the same email simultaneously)
|
|
131
131
|
- **Check the external dependency list first**: Before starting orchestration design, read `external_dependencies` from `logos-project.yaml`; proactively remind the user to add any undeclared external calls
|
|
132
132
|
- **Do not decide mock strategies on your own**: Test strategies are determined during S12 technical architecture design (Phase 3 Step 0, architecture-designer); the orchestration test phase only consumes them — do not modify them unilaterally
|
|
133
|
-
- **Relationship with `openlogos verify`**: API orchestration tests can also produce JSONL results in the same format as `spec/test-results.md`. After orchestration tests run, results are also written to `logos/resources/verify/test-results.jsonl`, and `openlogos verify` reads them uniformly to determine acceptance
|
|
133
|
+
- **Relationship with `openlogos verify`**: API orchestration tests can also produce JSONL results in the same format as `logos/spec/test-results.md`. After orchestration tests run, results are also written to `logos/resources/verify/test-results.jsonl`, and `openlogos verify` reads them uniformly to determine acceptance
|
|
134
134
|
|
|
135
135
|
## Recommended Prompts
|
|
136
136
|
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
- **并发测试**:关键场景需要考虑并发情况(如:两人同时注册同一邮箱)
|
|
131
131
|
- **外部依赖先查清单**:开始设计编排前先读 `logos-project.yaml` 的 `external_dependencies`,没有声明的外部调用要主动提醒用户补充
|
|
132
132
|
- **mock 策略不要自行决定**:测试策略由 S12 技术架构设计(Phase 3 Step 0, architecture-designer)确定,编排测试阶段只负责消费,不要擅自更改
|
|
133
|
-
- **与 `openlogos verify` 的关系**:API 编排测试也可产出与 `spec/test-results.md` 相同格式的 JSONL 结果。编排测试运行后,结果同样写入 `logos/resources/verify/test-results.jsonl`,`openlogos verify` 统一读取并判定验收
|
|
133
|
+
- **与 `openlogos verify` 的关系**:API 编排测试也可产出与 `logos/spec/test-results.md` 相同格式的 JSONL 结果。编排测试运行后,结果同样写入 `logos/resources/verify/test-results.jsonl`,`openlogos verify` 统一读取并判定验收
|
|
134
134
|
|
|
135
135
|
## 推荐提示词
|
|
136
136
|
|
|
@@ -224,7 +224,7 @@ Test case IDs (`UT-S01-01`, `ST-S01-01`) serve as a **binding contract** between
|
|
|
224
224
|
- `openlogos verify` maps execution results back to test case specifications via IDs, automatically determining acceptance
|
|
225
225
|
- When modifying case IDs, the corresponding IDs in the test code must be updated simultaneously
|
|
226
226
|
|
|
227
|
-
See `spec/test-results.md` for the detailed JSONL format definition and reporter code templates for each language.
|
|
227
|
+
See `logos/spec/test-results.md` for the detailed JSONL format definition and reporter code templates for each language.
|
|
228
228
|
|
|
229
229
|
## Best Practices
|
|
230
230
|
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# AGENTS.md 生成规范
|
|
2
|
+
|
|
3
|
+
> 版本:0.3.0
|
|
4
|
+
>
|
|
5
|
+
> 本文档定义 AGENTS.md 的内容结构、生成规则和多平台适配机制。AGENTS.md 是面向 AI 助手的指令文件,让 AI 工具打开项目就知道该遵循什么规范。
|
|
6
|
+
|
|
7
|
+
## 概述
|
|
8
|
+
|
|
9
|
+
AGENTS.md 放在项目根目录。当 AI 工具(Cursor、Claude Code、OpenCode 等)打开项目时,自动读取此文件,了解项目遵循的规范和工作方式。
|
|
10
|
+
|
|
11
|
+
## 内容结构
|
|
12
|
+
|
|
13
|
+
```markdown
|
|
14
|
+
# AI Assistant Instructions
|
|
15
|
+
|
|
16
|
+
This project follows the **OpenLogos** methodology.
|
|
17
|
+
Read `logos/logos-project.yaml` first to understand the project resource index.
|
|
18
|
+
|
|
19
|
+
## Project Context
|
|
20
|
+
- Config: `logos/logos.config.json`
|
|
21
|
+
- Resource Index: `logos/logos-project.yaml`
|
|
22
|
+
- Tech Stack: [从 logos-project.yaml 读取]
|
|
23
|
+
|
|
24
|
+
## Methodology Rules
|
|
25
|
+
1. Never write code without first completing the design documents
|
|
26
|
+
2. Follow the Why → What → How progression
|
|
27
|
+
3. All API designs must originate from scenario sequence diagrams
|
|
28
|
+
4. All code changes must have corresponding API orchestration tests
|
|
29
|
+
5. Use the Delta change workflow for iterations (see logos/changes/ directory)
|
|
30
|
+
|
|
31
|
+
## Interaction Guidelines
|
|
32
|
+
When the user's request is vague or they ask "what should I do next":
|
|
33
|
+
1. Scan `logos/resources/` to determine the current project phase
|
|
34
|
+
2. Suggest the specific next step based on what's missing
|
|
35
|
+
3. Provide a ready-to-use prompt the user can directly say
|
|
36
|
+
4. Never start generating documents without confirming key information
|
|
37
|
+
|
|
38
|
+
Phase detection logic:
|
|
39
|
+
- `logos/resources/prd/1-product-requirements/` is empty → suggest Phase 1 (prd-writer)
|
|
40
|
+
- requirements exist but `2-product-design/` is empty → suggest Phase 2 (product-designer)
|
|
41
|
+
- design exists but `3-technical-plan/1-architecture/` is empty → suggest Phase 3 Step 0 (architecture-designer)
|
|
42
|
+
- architecture exists but `3-technical-plan/2-scenario-implementation/` is empty → suggest Phase 3 Step 1 (scenario-architect)
|
|
43
|
+
- scenarios exist but `logos/resources/api/` is empty → suggest Phase 3 Step 2 (api-designer + db-designer)
|
|
44
|
+
- API exists but `logos/resources/test/` is empty → suggest Phase 3 Step 3a (test-writer)
|
|
45
|
+
- test cases exist but `logos/resources/scenario/` is empty → suggest Phase 3 Step 3b (test-orchestrator, API projects only)
|
|
46
|
+
- All above exist → suggest Phase 3 Step 4 (code generation)
|
|
47
|
+
- code generated but `logos/resources/verify/` is empty → suggest Phase 3 Step 5 (run tests then `openlogos verify`)
|
|
48
|
+
|
|
49
|
+
## Active Skills
|
|
50
|
+
[根据 `logos.config.json` 的 `aiTool` 字段动态生成]
|
|
51
|
+
|
|
52
|
+
当 aiTool = "cursor" 时,列出 `.cursor/rules/` 下部署的 `.mdc` 文件:
|
|
53
|
+
- `skills/prd-writer` — `.cursor/rules/prd-writer.mdc`
|
|
54
|
+
- `skills/product-designer` — `.cursor/rules/product-designer.mdc`
|
|
55
|
+
- ...(共 12 项)
|
|
56
|
+
|
|
57
|
+
当 aiTool = "claude-code" 或 "other" 时,列出 `logos/skills/` 下部署的 `SKILL.md` 文件:
|
|
58
|
+
- `skills/prd-writer` — `logos/skills/prd-writer/SKILL.md`
|
|
59
|
+
- `skills/product-designer` — `logos/skills/product-designer/SKILL.md`
|
|
60
|
+
- ...(共 12 项)
|
|
61
|
+
|
|
62
|
+
## Conventions
|
|
63
|
+
- [从 logos-project.yaml 的 conventions 段读取]
|
|
64
|
+
- When writing Markdown files that contain triple-backtick code blocks inside other code blocks, use 4-backtick fences (````) for the outer block
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## 生成规则
|
|
68
|
+
|
|
69
|
+
### 数据来源
|
|
70
|
+
|
|
71
|
+
AGENTS.md 的内容从以下文件中自动提取:
|
|
72
|
+
|
|
73
|
+
| 字段 | 来源 |
|
|
74
|
+
|------|------|
|
|
75
|
+
| Tech Stack | `logos-project.yaml` → `tech_stack` |
|
|
76
|
+
| Active Skills | `logos.config.json` → `aiTool` 字段决定路径前缀 + 扫描项目中已部署的 Skills |
|
|
77
|
+
| Conventions | `logos-project.yaml` → `conventions` |
|
|
78
|
+
| Methodology Rules | 固定内容(OpenLogos 核心规则) |
|
|
79
|
+
|
|
80
|
+
### 核心规则(固定内容)
|
|
81
|
+
|
|
82
|
+
以下规则在所有 OpenLogos 项目中一致,不可自定义:
|
|
83
|
+
|
|
84
|
+
1. Never write code without first completing the design documents
|
|
85
|
+
2. Follow the Why → What → How progression
|
|
86
|
+
3. All API designs must originate from scenario sequence diagrams
|
|
87
|
+
4. All code changes must have corresponding API orchestration tests
|
|
88
|
+
5. Use the Delta change workflow for iterations
|
|
89
|
+
6. All generated test code must include an OpenLogos reporter (see spec/test-results.md)
|
|
90
|
+
|
|
91
|
+
### 生成时机
|
|
92
|
+
|
|
93
|
+
- `openlogos init`:初始化项目时首次生成(含 Active Skills 段,Skills 同步部署)
|
|
94
|
+
- `openlogos sync`:手动触发重新生成(当项目配置变化时,同时重新部署 Skills 并刷新 Active Skills 段)
|
|
95
|
+
- `project-init` Skill:AI 初始化项目时生成
|
|
96
|
+
|
|
97
|
+
## 多平台适配
|
|
98
|
+
|
|
99
|
+
不同 AI 工具使用不同的指令文件名,但内容一致:
|
|
100
|
+
|
|
101
|
+
| 工具 | 指令文件 | Skills 部署位置 | 处理方式 |
|
|
102
|
+
|------|---------|---------------|---------|
|
|
103
|
+
| **Cursor** | `AGENTS.md`(原生支持) | `.cursor/rules/*.mdc` | `init` / `sync` 自动部署 |
|
|
104
|
+
| **Claude Code** | `CLAUDE.md` | `logos/skills/*/SKILL.md` | `init` / `sync` 自动部署 |
|
|
105
|
+
| **OpenCode** | `AGENTS.md` | `logos/skills/*/SKILL.md` | `init` / `sync` 自动部署 |
|
|
106
|
+
| **GitHub Copilot** | `.github/copilot-instructions.md` | 规划中 | Phase 1.5 |
|
|
107
|
+
|
|
108
|
+
`openlogos sync` 命令会同时生成所有需要的指令文件,确保不同 AI 工具看到的指令一致。
|
|
109
|
+
|
|
110
|
+
## 与 logos-project.yaml 的关系
|
|
111
|
+
|
|
112
|
+
| 文件 | 格式 | 受众 | 内容 |
|
|
113
|
+
|------|------|------|------|
|
|
114
|
+
| `logos-project.yaml` | 结构化 YAML | AI + 工具 | 资源索引、技术栈、约定 |
|
|
115
|
+
| `AGENTS.md` | 自然语言 Markdown | AI 助手 | 行为指令、规则、Skill 列表 |
|
|
116
|
+
|
|
117
|
+
两者互补:AGENTS.md 引导 AI 去读 logos-project.yaml,logos-project.yaml 提供结构化数据。
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# Delta 变更管理规范
|
|
2
|
+
|
|
3
|
+
> 版本:0.3.0
|
|
4
|
+
>
|
|
5
|
+
> 本文档定义 OpenLogos 的 Delta 变更管理机制。每次功能迭代或 Bug 修复,先创建变更提案,审核通过后再合并回主文档。确保变更过程可追溯、可审核、可回滚。
|
|
6
|
+
|
|
7
|
+
## 核心原则
|
|
8
|
+
|
|
9
|
+
1. **不直接修改主文档**:每次变更先在 `logos/changes/` 中创建提案
|
|
10
|
+
2. **影响分析先行**:在 `proposal.md` 中明确变更范围
|
|
11
|
+
3. **按需传播**:不是每次都全链路更新,只更新受影响的环节
|
|
12
|
+
4. **归档留痕**:变更完成后归档,保留完整历史
|
|
13
|
+
|
|
14
|
+
## 目录结构
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
project-root/
|
|
18
|
+
└── logos/
|
|
19
|
+
├── resources/ # 主文档(当前已生效的"真相")
|
|
20
|
+
│
|
|
21
|
+
└── changes/ # 变更提案工作区
|
|
22
|
+
├── add-remember-me/ # 一个变更提案
|
|
23
|
+
│ ├── proposal.md # 变更说明
|
|
24
|
+
│ ├── tasks.md # 实现任务清单
|
|
25
|
+
│ └── deltas/ # 增量修改(Delta)
|
|
26
|
+
│ ├── prd/
|
|
27
|
+
│ ├── api/
|
|
28
|
+
│ ├── database/
|
|
29
|
+
│ └── scenario/
|
|
30
|
+
│
|
|
31
|
+
└── archive/ # 已完成变更的历史归档
|
|
32
|
+
└── add-remember-me/
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## 文件规范
|
|
36
|
+
|
|
37
|
+
### proposal.md
|
|
38
|
+
|
|
39
|
+
变更说明文档,必须包含:
|
|
40
|
+
|
|
41
|
+
```markdown
|
|
42
|
+
# 变更提案:[变更名称]
|
|
43
|
+
|
|
44
|
+
## 变更原因
|
|
45
|
+
[为什么要做这个变更?来源于哪个需求/反馈/Bug?]
|
|
46
|
+
|
|
47
|
+
## 变更范围
|
|
48
|
+
- 影响的需求文档:[列表]
|
|
49
|
+
- 影响的功能规格:[列表]
|
|
50
|
+
- 影响的业务场景:[列表]
|
|
51
|
+
- 影响的 API:[列表]
|
|
52
|
+
- 影响的 DB 表:[列表]
|
|
53
|
+
|
|
54
|
+
## 变更概述
|
|
55
|
+
[用 1-3 段话概述具体改什么]
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### tasks.md
|
|
59
|
+
|
|
60
|
+
实现任务清单,按 Phase 组织:
|
|
61
|
+
|
|
62
|
+
```markdown
|
|
63
|
+
# 实现任务
|
|
64
|
+
|
|
65
|
+
## Phase 1: 文档变更
|
|
66
|
+
- [ ] 更新需求文档的用户故事和验收条件
|
|
67
|
+
- [ ] 更新产品设计文档的功能规格
|
|
68
|
+
|
|
69
|
+
## Phase 2: 设计变更
|
|
70
|
+
- [ ] 更新 HTML 原型
|
|
71
|
+
- [ ] 更新场景时序图
|
|
72
|
+
- [ ] 更新 API YAML
|
|
73
|
+
- [ ] 更新 DB DDL
|
|
74
|
+
|
|
75
|
+
## Phase 3: 编排与代码
|
|
76
|
+
- [ ] 更新 API 编排测试用例
|
|
77
|
+
- [ ] 实现代码变更
|
|
78
|
+
- [ ] 部署到测试环境
|
|
79
|
+
- [ ] 运行编排验收
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### deltas/ 目录
|
|
83
|
+
|
|
84
|
+
增量修改文件,使用标记格式:
|
|
85
|
+
|
|
86
|
+
```markdown
|
|
87
|
+
## ADDED — [新增内容标题]
|
|
88
|
+
[新增的完整内容]
|
|
89
|
+
|
|
90
|
+
## MODIFIED — [修改内容标题]
|
|
91
|
+
[修改后的完整内容,替换主文档中同名章节]
|
|
92
|
+
|
|
93
|
+
## REMOVED — [删除内容标题]
|
|
94
|
+
[说明删除原因]
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Delta 文件的目录结构映射主文档目录:
|
|
98
|
+
- `deltas/prd/` → 对应 `logos/resources/prd/` 的变更
|
|
99
|
+
- `deltas/api/` → 对应 `logos/resources/api/` 的变更
|
|
100
|
+
- `deltas/database/` → 对应 `logos/resources/database/` 的变更
|
|
101
|
+
- `deltas/scenario/` → 对应 `logos/resources/scenario/` 的变更
|
|
102
|
+
|
|
103
|
+
## 变更工作流
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
1. 创建变更提案(CLI)
|
|
107
|
+
└── openlogos change {slug}
|
|
108
|
+
└── 生成 logos/changes/{slug}/proposal.md + tasks.md + deltas/
|
|
109
|
+
|
|
110
|
+
2. AI 辅助填写提案(change-writer Skill)
|
|
111
|
+
└── AI 分析影响范围,填写 proposal.md 和 tasks.md
|
|
112
|
+
|
|
113
|
+
3. 按 tasks.md 逐项产出 Delta 文件(各阶段 Skill)
|
|
114
|
+
└── 每完成一项任务,将增量变更写入 deltas/ 对应子目录
|
|
115
|
+
|
|
116
|
+
4. 审核变更提案
|
|
117
|
+
└── 团队/自审 proposal.md 和 delta 文件
|
|
118
|
+
|
|
119
|
+
5. 生成合并指令(CLI)
|
|
120
|
+
└── openlogos merge {slug}
|
|
121
|
+
└── 扫描 deltas/,生成 MERGE_PROMPT.md
|
|
122
|
+
|
|
123
|
+
6. AI 执行合并(merge-executor Skill)
|
|
124
|
+
└── AI 读取 MERGE_PROMPT.md,逐个 delta 合并到主文档
|
|
125
|
+
|
|
126
|
+
7. 归档变更(CLI)
|
|
127
|
+
└── openlogos archive {slug}
|
|
128
|
+
└── 将 logos/changes/{slug}/ 移入 logos/changes/archive/
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## 变更传播规则
|
|
132
|
+
|
|
133
|
+
不是每次变更都需要全链路更新。根据变更类型决定影响范围:
|
|
134
|
+
|
|
135
|
+
| 变更类型 | 最少需要更新 | 说明 |
|
|
136
|
+
|---------|------------|------|
|
|
137
|
+
| 需求级变更 | 全链路 | 需求变了,所有下游都可能受影响 |
|
|
138
|
+
| 设计级变更 | 原型 + 场景 + API/DB + 编排 + 代码 | 需求不变,实现方案调整 |
|
|
139
|
+
| 接口级变更 | API/DB + 编排 + 代码 | 设计不变,接口细节调整 |
|
|
140
|
+
| 代码级修复 | 代码 + 重新验收 | Bug 修复,不涉及设计变更 |
|
|
141
|
+
|
|
142
|
+
## Git 集成
|
|
143
|
+
|
|
144
|
+
- 每个变更提案对应一个 Git 分支:`change/{change-name}`
|
|
145
|
+
- 分支合并时,`logos/changes/{change-name}/` 同步移入 `logos/changes/archive/`
|
|
146
|
+
- 重大变更在文档顶部的"最后更新"时间戳中标注
|
|
147
|
+
- `logos/changes/archive/` 提供完整变更历史
|
|
148
|
+
|
|
149
|
+
## MERGE_PROMPT.md 文件规范
|
|
150
|
+
|
|
151
|
+
`openlogos merge` 命令自动生成的指令文件,结构如下:
|
|
152
|
+
|
|
153
|
+
```markdown
|
|
154
|
+
# Merge Instruction
|
|
155
|
+
|
|
156
|
+
## 变更提案
|
|
157
|
+
- 提案名称:{slug}
|
|
158
|
+
- 提案目录:logos/changes/{slug}/
|
|
159
|
+
|
|
160
|
+
## 提案内容
|
|
161
|
+
[从 proposal.md 中读取的完整内容]
|
|
162
|
+
|
|
163
|
+
## 需要合并的 Delta 文件
|
|
164
|
+
|
|
165
|
+
### 1. {delta-relative-path}
|
|
166
|
+
- Delta 文件:`logos/changes/{slug}/deltas/{category}/{file}`
|
|
167
|
+
- 目标目录:`logos/resources/{category}/`
|
|
168
|
+
- 操作:读取 delta 中的 ADDED / MODIFIED / REMOVED 标记,合并到目标目录中对应的主文档
|
|
169
|
+
|
|
170
|
+
## 执行要求
|
|
171
|
+
1. 逐个 Delta 文件处理,每处理完一个报告修改摘要
|
|
172
|
+
2. 对于 ADDED 标记:在主文档的指定位置插入新内容
|
|
173
|
+
3. 对于 MODIFIED 标记:替换主文档中同名章节的内容
|
|
174
|
+
4. 对于 REMOVED 标记:从主文档中删除对应章节
|
|
175
|
+
5. 保持主文档的原有格式和风格
|
|
176
|
+
6. 如果主文档有"最后更新"时间戳,同步更新
|
|
177
|
+
7. 所有变更完成后,列出修改清单
|
|
178
|
+
8. 完成后提醒用户运行 `openlogos archive {slug}`
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## CLI 命令
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
# 创建变更提案
|
|
185
|
+
openlogos change add-remember-me
|
|
186
|
+
|
|
187
|
+
# 生成合并指令(由 AI 执行实际合并)
|
|
188
|
+
openlogos merge add-remember-me
|
|
189
|
+
|
|
190
|
+
# 归档已完成的变更
|
|
191
|
+
openlogos archive add-remember-me
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## AI Skills 集成
|
|
195
|
+
|
|
196
|
+
- **change-writer**:在 `openlogos change` 后使用,辅助填写 proposal.md 和 tasks.md
|
|
197
|
+
- **merge-executor**:在 `openlogos merge` 后使用,读取 MERGE_PROMPT.md 执行实际合并
|