Add graph markdown and canvas outputs

This commit is contained in:
2026-05-06 20:00:50 +08:00
parent 1478972e53
commit f7f5e2c67c
22 changed files with 313 additions and 15 deletions

View File

@@ -34,7 +34,7 @@ GSP 是一种游戏规格协议,不是具体游戏引擎、代码框架或资
- 一个集合或范围
- 一个逐步细化中的设计对象
GSP 不预设抽象和实体的硬边界。所有对象都先被视为 GSP再由 `context``resolution``with``refines` 和当前任务共同解释。
GSP 不预设抽象和实体的硬边界。所有对象都先被视为 GSP再由 `title``context``resolution``with``refines` 和当前任务共同解释。
## GSP 用来做什么
@@ -76,6 +76,7 @@ context: 积极反馈。用于让玩家在操作后获得明确、正向、值
| 字段 | 必需 | 作用 |
|---|---|---|
| `id` | 是 | 唯一身份。 |
| `title` | 否 | 展示标题。 |
| `context` | 否 | 核心设计内容。 |
| `resolution` | 否 | 清晰度 / 细化程度。 |
| `with` | 否 | 通用设计语境关系。 |
@@ -86,6 +87,7 @@ context: 积极反馈。用于让玩家在操作后获得明确、正向、值
- GSP 是单文件、单格式的设计协议。
- `id` 是唯一强制字段。
- `title` 是展示标题。
- `context` 可选。
- `resolution` 是清晰度软指标。
- `with` 是通用设计语境关系。
@@ -109,6 +111,17 @@ context: 积极反馈。用于让玩家在操作后获得明确、正向、值
编译器可以按阶段检查 `resolution`,但 `resolution` 不证明设计质量。
## title
`title` 表示 GSP 的展示标题。
```yaml
id: page.lottery.main
title: 抽奖页面
```
工具在图形、索引和 AI 入口中优先使用 `title` 展示。没有 `title` 时使用 `id`
## with
`with` 表示当前 GSP 需要与哪些 GSP 一起进入设计语境。
@@ -163,8 +176,9 @@ context: 奖励表现要轻快、积极,但不要过度刺激。
使用 GSP 时按以下顺序理解:
1. 先读 `id`,确认身份。
2. 再读 `context`,理解核心设计语义
3. 查看 `resolution`,判断当前细化程度
4. 展开 `with`,补齐相关设计语境
5. 查看 `refines`,确认是否来自某个更早或更粗的 GSP
6. 需要严格校验时使用 `gsp.schema.json`
2. 再读 `title`,确认展示名称
3. 再读 `context`,理解核心设计语义
4. 查看 `resolution`,判断当前细化程度
5. 展开 `with`,补齐相关设计语境
6. 查看 `refines`,确认是否来自某个更早或更粗的 GSP
7. 需要严格校验时使用 `gsp.schema.json`

View File

@@ -5,6 +5,7 @@
- `.gsp` files use YAML.
- Preserve `id`; do not rename it unless explicitly requested.
- `id` is the unique identity of a GSP unit.
- `title` is display text; use `id` when `title` is missing.
- Use only fields valid for the declared GSP version.
- `with` means related design context.
- `refines` means single-source refinement.

View File

@@ -94,9 +94,20 @@ gsp pack <id> [--root .] [--depth 3] [--budget 12000] [--out context-pack.json]
Generate a relation graph.
```bash
gsp graph [id] [--root .] [--depth 3] [--format json|mermaid] [--out graph.json]
gsp graph [id] [--root .] [--depth 3] [--format json|mermaid|md|canvas] [--out graph.json]
```
Formats:
```text
json Machine-readable graph.
mermaid Mermaid graph body.
md Markdown file with Mermaid block.
canvas Obsidian JSON Canvas file.
```
Graph display uses `title` when present and falls back to `id`.
## stage-check
Check minimum resolution for a stage.

View File

@@ -12,6 +12,10 @@
"minLength": 1,
"description": "Unique GSP id in the current project."
},
"title": {
"type": "string",
"description": "Optional human-readable display title. Tools use id when title is missing."
},
"context": {
"type": "string",
"description": "Core design context. Optional. Empty or missing context means the GSP can be treated as a placeholder."