mellos-mapping 0.12.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mellos
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,286 @@
1
+ # Mellos Mapping
2
+
3
+ [![CI](https://github.com/GuangminJu/mellos-mapping/actions/workflows/ci.yml/badge.svg)](https://github.com/GuangminJu/mellos-mapping/actions/workflows/ci.yml)
4
+
5
+ English | [简体中文](README.zh-CN.md)
6
+
7
+ A live, terminal-native map of bottom-up development for
8
+ [Claude Code](https://claude.com/claude-code) and Codex CLI.
9
+
10
+ <p align="center">
11
+ <picture>
12
+ <source media="(prefers-color-scheme: light)" srcset="docs/demo-light.svg">
13
+ <img alt="A Mellos map building itself: ghost design first, spinners climbing the layers, a cracked foundation spreading upward, honest recovery" src="docs/demo.svg" width="620">
14
+ </picture>
15
+ </p>
16
+
17
+ While Claude builds your system, a split pane beside the conversation shows
18
+ the system's **layered dependency map**: primitive layers at the bottom,
19
+ dependency edges that may only point downward, ghost nodes for what is
20
+ designed, a spinner on what is being built right now, and solid green for
21
+ what is built *and verified*.
22
+
23
+ ```
24
+ Mellos Mapping · the plugin itself
25
+
26
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━ orchestration
27
+
28
+ ╭╌╌╌╌╌╌╌╌╌╌╌╌╌╌╮
29
+ ╎ · MCP Server ╎
30
+ ╰╌╌╌╌┬╌┬╌╌┬╌╌╌╌╯
31
+ │ │ │
32
+ └─┼──┼─────────────┐
33
+ │ └──────┐ │
34
+ │ │ │
35
+ ━━━━━━━━━┿━━━━━━━━━┿━━━━━━┿━━━ contracts
36
+ │ │ │
37
+ ┏━━━━━━┷━━━━━━━━┓│ ╭╌╌╌╌┴╌╌╌╌╌╌╮
38
+ ┃ ■ State Store ┃│ ╎ · Watcher ╎
39
+ ┗━━━━━┯━━━━━━━━━┛│ ╰╌╌╌╌╌┬╌╌╌╌╌╯
40
+ │ │ │
41
+ │ ┌────────┘ │
42
+ │ │ │
43
+ ━━━━━━━━┿━┿━━━━━━━━━━━━━━━━┿━ primitives
44
+ │ │ │
45
+ ┏━━━━━┷━┷━━━━━━┓ ╭──────┴───────────╮
46
+ ┃ ■ Map Domain ┃ │ ⠋ ASCII Renderer │
47
+ ┗━━━━━━━━━━━━━━┛ ╰──────────────────╯
48
+
49
+ · planned ⠋ in-progress ■ done ✗ regressed
50
+ ```
51
+
52
+ In a real terminal the wiring and band bars render FAINT while node boxes
53
+ glow in their status colors with bold labels — a dark circuit board where
54
+ the components are the bright things. Skip-level edges thread through gaps
55
+ between boxes (watch the line dive between State Store and Watcher above);
56
+ non-overlapping wire segments share track rows to keep the bands close.
57
+
58
+ *(This is the plugin's own map, mid-development. The spinner really spins.)*
59
+
60
+ ## Why
61
+
62
+ Most progress reporting is a task list — a top-down worldview. A Mellos map
63
+ grows the other way: an upper node can only stand on nodes below it, and the
64
+ picture makes the discipline visible:
65
+
66
+ - **The ghost design appears before any code.** Claude declares the whole
67
+ intended structure as dashed ghost nodes first; you can veto a bad design
68
+ while it is still only a picture.
69
+ - **The spinner is where Claude's attention is.** One glance answers "what is
70
+ it doing right now, and on top of what?"
71
+ - **Done means verified.** A node turns solid green only with evidence (a
72
+ passing test run). If later work cracks a foundation, the node turns red —
73
+ a cracked foundation under a spinning upper floor is the most honest status
74
+ report there is.
75
+ - **The map is a ledger, not a judge.** The tools refuse only structural
76
+ corruption (an edge pointing upward, a duplicate rank). Workflow is
77
+ Claude's discipline, defined in the bundled skill; violations are made
78
+ *visible*, never silently blocked.
79
+
80
+ ## Install
81
+
82
+ Two lines inside any Claude Code conversation:
83
+
84
+ ```
85
+ /plugin marketplace add GuangminJu/mellos-mapping
86
+ /plugin install mellos-mapping@mellos-mapping
87
+ ```
88
+
89
+ Or one line in a terminal:
90
+
91
+ ```
92
+ claude plugin marketplace add GuangminJu/mellos-mapping && claude plugin install mellos-mapping@mellos-mapping
93
+ ```
94
+
95
+ Requires Node.js 18+ on PATH (Claude Code itself requires Node, so you
96
+ already have it). No build step: the MCP server and watcher ship pre-bundled.
97
+
98
+ ## Update
99
+
100
+ ```
101
+ claude plugin marketplace update mellos-mapping && claude plugin update mellos-mapping@mellos-mapping
102
+ ```
103
+
104
+ Two steps because `plugin update` compares against the locally cached
105
+ marketplace clone — the first command is what actually pulls this repo.
106
+ Restart Claude Code to apply. Releases are version bumps on `master`.
107
+ (In-app, `/plugin` opens the same management UI.)
108
+
109
+ ## Codex CLI
110
+
111
+ The same repo doubles as a Codex plugin (codex-cli 0.147+). Three lines:
112
+
113
+ ```
114
+ codex plugin marketplace add GuangminJu/mellos-mapping
115
+ codex plugin add mellos-mapping@mellos-mapping
116
+ node ~/.codex/plugins/cache/mellos-mapping/mellos-mapping/<version>/scripts/codex-register.mjs
117
+ ```
118
+
119
+ The first two install the skill (the map discipline) as a Codex plugin. The
120
+ third registers the MCP server at user level — needed because Codex spawns
121
+ plugin-bundled MCP servers inside the plugin cache with no way to see your
122
+ workspace, so a bundled server would write the map into the cache. A
123
+ user-level `codex mcp add` entry (which the script writes) inherits each
124
+ session's working directory instead: the state file lands in your project,
125
+ same as under Claude Code. The registered path is version-specific — re-run
126
+ the script after updating the plugin.
127
+
128
+ To watch the live pane beside a Codex session, run
129
+ `node <plugin root>/dist/watch.mjs` from the project directory in a second
130
+ terminal (or any terminal split).
131
+
132
+ ## Any MCP client
133
+
134
+ The server ships on npm, so any MCP client (Cursor, Windsurf, Zed,
135
+ Gemini CLI, …) can run it with a standard stdio entry:
136
+
137
+ ```
138
+ npx -y mellos-mapping
139
+ ```
140
+
141
+ The map file lands in the client session's working directory
142
+ (`.claude/mellos-mapping.json`). Open the live pane from the same project:
143
+
144
+ ```
145
+ npx -y -p mellos-mapping mellos-mapping-watch
146
+ ```
147
+
148
+ The skill/discipline layer is Claude Code + Codex specific; other clients
149
+ get the four `mmap_*` tools and the pane, and bring their own prompting.
150
+
151
+ ## Use
152
+
153
+ 1. Ask Claude to build something non-trivial. The bundled skill has Claude
154
+ declare the ghost design and keep the map current as it works.
155
+ 2. Run `/mellos-mapping:mmap` to open the live pane (Windows Terminal split
156
+ on Windows, tmux split inside tmux, or a printed command to run in any
157
+ second terminal). Prefer `--ascii` if your font lacks box-drawing glyphs.
158
+ 3. Watch nodes light up from the bottom. Interrupt when the picture worries
159
+ you — that is what it is for.
160
+
161
+ The pane is mouse-aware (xterm SGR any-event tracking — the same protocol
162
+ htop and tmux speak):
163
+
164
+ | Input | Action |
165
+ | --- | --- |
166
+ | hover a node | spotlight its wires; preview its details below the map |
167
+ | click a node | pin it — details stay resident after the mouse leaves |
168
+ | click empty space / `Esc` | unpin; with nothing pinned, `Esc` climbs out of a dive |
169
+ | wheel / `+` `-` | zoom, anchored on the focused node (see the ladder below) |
170
+ | left-drag | grab and pan when the map outgrows the pane |
171
+ | shift+wheel | scroll vertically |
172
+ | `hjkl` / arrows | nudge the view |
173
+ | `Tab` / `Shift+Tab` / `1-9` / click a tab | switch pages (parallel maps) |
174
+ | double-click a `⊞` node | dive into its sub-map (a child page) |
175
+ | `Backspace` / `Esc` | climb back out of the last dive |
176
+ | drag the `⋯` divider | resize the detail panel — pull it up to read long design notes in full |
177
+ | `0` | reset pan and zoom |
178
+ | `q` | quit the pane |
179
+
180
+ Zooming scales the picture first and switches display mode only at the ends
181
+ of the ladder, so every level still shows meaningful data:
182
+
183
+ ```
184
+ detail ← 100% ← 85% ← 70% ← 55% ← overview
185
+ ```
186
+
187
+ - **zoom in past 100%** — evidence and design notes unfold inside the boxes;
188
+ - **85–55%** — whitespace tightens and labels truncate proportionally, boxes
189
+ stay boxes;
190
+ - **below 55%** — labels would stop meaning anything, so the map AGGREGATES:
191
+ each declared group (a labeled subsystem within a band) becomes one box
192
+ named `foundation subsystem 1/2` with its status derived from the members, edges
193
+ collapse onto the groups, ungrouped nodes stay themselves. Like a real
194
+ map, zooming out shows province names — not anonymous dots. (A map with
195
+ no groups falls back to a pure glyph constellation with per-band counts.)
196
+ The footer always names the level.
197
+
198
+ The two detail rows live at a fixed spot between map and hint line, showing
199
+ the focused node's status, layer, evidence and both wire directions
200
+ (`uses → … · used by ← …`) — nothing ever floats over the map.
201
+
202
+ `--no-mouse` disables mouse reporting if your terminal multiplexer wants the
203
+ mouse for itself.
204
+
205
+ ### Pages
206
+
207
+ A project can keep several maps side by side — **one effort = one page**.
208
+ Claude targets a page by passing `page` to any `mmap_*` tool; the pane grows
209
+ a tab bar as soon as a second page exists. The active tab is bold in its
210
+ map's aggregate status color; when a background page's file changes, its tab
211
+ lights up in status color instead of stealing your view. Each page remembers
212
+ its own pan, zoom and pinned node. Because every page is its own file, two
213
+ Claude sessions writing two pages can never clobber each other — this is
214
+ also the answer to running several Claude sessions in one project.
215
+
216
+ State lives in `.claude/mellos-mapping.json` (the default page) plus
217
+ `.claude/mellos-mapping.pages/<page>.json` for named pages — plain JSON,
218
+ safe to commit if you want the maps' history in git.
219
+
220
+ ### Diagram kinds
221
+
222
+ The default kind, `dev`, is the living progress ledger described above. The
223
+ same layered-DAG machinery also draws documentation diagrams: pass `kind`
224
+ in `mmap_declare` and the page renders neutrally — plain solid boxes, no
225
+ ghosts, no spinners, no progress counts.
226
+
227
+ | Kind | Reading | Extras |
228
+ | --- | --- | --- |
229
+ | `architecture` | layered components (also module deps, call graphs) | edge labels for protocols |
230
+ | `dataflow` | pipeline stages as layers, sources at the bottom | edge labels for the data |
231
+ | `behavior-tree` | leaves (actions) at the bottom, root on top (also mind maps, WBS) | node kinds `selector` `sequence` `parallel` `decorator` `condition` `action` render as glyphs |
232
+ | `sequence` | classic call/return: time flows top-down, participants as lane headers; every call and every return is an event in the acting participant's lane | `lanes` are participants; edge labels are messages |
233
+
234
+ Node kinds and edge labels work on `dev` maps too. State machines are out
235
+ of scope on purpose: transitions cycle, and edges here only point downward.
236
+
237
+ ### Sub-maps
238
+
239
+ A node can link a child page with `submap: <page-slug>` — the pane badges it
240
+ `⊞`; double-click dives into the child map, `Backspace` climbs back out. A
241
+ map of maps, built entirely from pages: no new storage, no new invariants.
242
+ Whether a node deserves a sub-map is the AI's judgment call — most don't.
243
+
244
+ Sub-maps are interior detail, not siblings: a page referenced as a submap
245
+ never occupies a tab. Inside a dive the tab row becomes a breadcrumb —
246
+ `⌫ parent map ▸ node` — and clicking it (or `Backspace`) climbs back out.
247
+ When a hidden sub-map changes in the background, the footer says so.
248
+
249
+ ## MCP tools
250
+
251
+ | Tool | Purpose |
252
+ | --- | --- |
253
+ | `mmap_declare` | Grow the map: title, diagram kind, layer bands, lanes, groups (subsystems), nodes, edges — optionally labeled (all-or-nothing batch) |
254
+ | `mmap_update` | Record progress: `planned → in-progress → done` (+evidence), `regressed`, group/lane membership, node kind |
255
+ | `mmap_remove` | Revise: drop edges, nodes, groups, lanes, empty bands |
256
+ | `mmap_view` | Render the current map as text inline (optional `zoom`) |
257
+
258
+ Structural invariants enforced by the tools: layers form a total order by
259
+ rank; every node lives in exactly one layer; edges point **strictly
260
+ downward** — which makes the graph acyclic by construction; nodes may not
261
+ depend on same-layer siblings (if A needs sibling B, either B is really a
262
+ lower concept or A and B are one node).
263
+
264
+ ## Development
265
+
266
+ ```
267
+ npm install
268
+ npm run verify # typecheck + tests + bundle
269
+ ```
270
+
271
+ The repo is itself layered bottom-up, and each layer has its spec:
272
+
273
+ | Layer | Code | Owns |
274
+ | --- | --- | --- |
275
+ | 0 domain | `src/domain/` | the map value, structural invariants, pure ops |
276
+ | 1 store | `src/store/` | atomic state-file persistence, boundary validation |
277
+ | 2 apply | `src/server/apply.ts` | tool inputs → transactional op sequences |
278
+ | 3 server | `src/server/server.ts` | the four MCP tools over stdio |
279
+ | 4 render | `src/render/`, `src/watch/` | ASCII renderer and the polling pane |
280
+
281
+ `dist/` is committed deliberately: plugin installation clones this repo and
282
+ runs nothing, so entry points ship bundled.
283
+
284
+ ## License
285
+
286
+ MIT
@@ -0,0 +1,263 @@
1
+ # Mellos Mapping · 梅勒斯地图
2
+
3
+ [![CI](https://github.com/GuangminJu/mellos-mapping/actions/workflows/ci.yml/badge.svg)](https://github.com/GuangminJu/mellos-mapping/actions/workflows/ci.yml)
4
+
5
+ [English](README.md) | 简体中文
6
+
7
+ 给 [Claude Code](https://claude.com/claude-code) 与 Codex CLI 的自下而上
8
+ 开发实况地图,原生运行在终端里。
9
+
10
+ <p align="center">
11
+ <picture>
12
+ <source media="(prefers-color-scheme: light)" srcset="docs/demo-light.svg">
13
+ <img alt="一张梅勒斯地图的自我构建:幽灵设计先行,spinner 逐层攀升,地基开裂向上传染,诚实修复" src="docs/demo.svg" width="620">
14
+ </picture>
15
+ </p>
16
+
17
+ Claude 为你构建系统时,对话旁边的分屏实时显示这个系统的**分层依赖地图**:
18
+ 最底层是原语,依赖边只允许向下指;虚线幽灵节点是已设计未实现的部分,
19
+ 转圈的是此刻正在构建的模块,实心绿色代表已构建**且已验证**。
20
+
21
+ ```
22
+ 梅勒斯地图 · mellos-mapping 插件
23
+
24
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 编排层
25
+
26
+ ╭╌╌╌╌╌╌╌╌╌╌╌╌╌╌╮
27
+ ╎ · MCP Server ╎
28
+ ╰╌╌╌┬┬╌╌╌╌┬╌╌╌╌╯
29
+ ││ │
30
+ └┼────┼───────────┐
31
+ │ └───┐ │
32
+ │ │ │
33
+ ━━━━━━━┿━━━━━━━━┿━━━━━━━┿━━━ 契约层
34
+ │ │ │
35
+ ┏━━━━┷━━━━━━━┓│ ╭╌╌╌╌╌┴╌╌╌╌╌╮
36
+ ┃ ■ 状态存储 ┃│ ╎ · Watcher ╎
37
+ ┗━━━━━┯━━━━━━┛│ ╰╌╌╌╌╌╌┬╌╌╌╌╯
38
+ │ │ │
39
+ │ ┌─────┘ │
40
+ │ │ │
41
+ ━━━━━━━━┿━┿━━━━━━━━━━━━━━┿━━ 原语层
42
+ │ │ │
43
+ ┏━━━━━┷━┷━━━━━━┓ ╭────┴────────╮
44
+ ┃ ■ 图领域模型 ┃ │ ⠋ ASCII渲染 │
45
+ ┗━━━━━━━━━━━━━━┛ ╰─────────────╯
46
+
47
+ · planned ⠋ in-progress ■ done ✗ regressed
48
+ ```
49
+
50
+ 在真实终端里,连线和层级横条以暗色渲染,节点盒子按状态发光、标签加粗——
51
+ 像一块黑色电路板,元件是亮的。跨层的边会从中间层的盒子缝隙里穿过去
52
+ (看上图 状态存储 和 Watcher 之间下潜的那根线);互不重叠的走线段共享
53
+ 轨道行,让层与层贴得更近。
54
+
55
+ *(这就是本插件自己的地图,开发中途的样子。转圈的 spinner 是真的在转。)*
56
+
57
+ ## 为什么
58
+
59
+ 大多数进度汇报是一张任务清单——那是自上而下的世界观。梅勒斯地图反过来生长:
60
+ 上层节点只能站在下层节点之上,这张图让纪律变得可见:
61
+
62
+ - **代码写出来之前,幽灵设计先出现。** Claude 先把完整的设计声明成虚线
63
+ 幽灵节点;你可以在它还只是一张图的时候就否掉一个坏设计。
64
+ - **spinner 在哪,Claude 的注意力就在哪。** 一眼回答"它现在在做什么、
65
+ 站在什么之上?"
66
+ - **done 意味着已验证。** 节点只有带着证据(一次通过的测试)才会变成
67
+ 实心绿色。如果后续工作弄裂了地基,那个节点会变红——转圈的上层楼板
68
+ 下面压着一块红色地基,是最诚实的状态汇报。
69
+ - **地图是账本,不是法官。** 工具只拒绝结构性破坏(向上指的边、重复的
70
+ rank)。工作流是 Claude 的纪律,写在随插件捆绑的 skill 里;违反纪律
71
+ 会被*看见*,而不是被悄悄拦截。
72
+
73
+ ## 安装
74
+
75
+ 在 Claude Code 对话里输入两行:
76
+
77
+ ```
78
+ /plugin marketplace add GuangminJu/mellos-mapping
79
+ /plugin install mellos-mapping@mellos-mapping
80
+ ```
81
+
82
+ 或者在终端里一条命令装完:
83
+
84
+ ```
85
+ claude plugin marketplace add GuangminJu/mellos-mapping && claude plugin install mellos-mapping@mellos-mapping
86
+ ```
87
+
88
+ 需要 PATH 上有 Node.js 18+(Claude Code 本身就依赖 Node,所以你已经有了)。
89
+ 没有构建步骤:MCP 服务器和 watcher 都已预打包在 `dist/` 里,克隆即用。
90
+
91
+ ## 更新
92
+
93
+ ```
94
+ claude plugin marketplace update mellos-mapping && claude plugin update mellos-mapping@mellos-mapping
95
+ ```
96
+
97
+ 要两步是因为 `plugin update` 只对比本地缓存的 marketplace 克隆——真正
98
+ 拉取本仓库的是第一条命令。重启 Claude Code 生效。发布即 `master` 分支
99
+ 上的版本号提升。(在对话里输入 `/plugin` 也能打开同一个管理界面。)
100
+
101
+ ## Codex CLI
102
+
103
+ 同一个仓库也是 Codex 插件(codex-cli 0.147+)。三行装完:
104
+
105
+ ```
106
+ codex plugin marketplace add GuangminJu/mellos-mapping
107
+ codex plugin add mellos-mapping@mellos-mapping
108
+ node ~/.codex/plugins/cache/mellos-mapping/mellos-mapping/<版本>/scripts/codex-register.mjs
109
+ ```
110
+
111
+ 前两行把技能(地图纪律)装成 Codex 插件。第三行在用户级注册 MCP
112
+ 服务器——必须这么做,因为 Codex 把插件自带的 MCP 服务器拉起在插件缓存里,
113
+ 且不给它任何感知工作区的途径,捆绑的服务器会把地图写进缓存。脚本写入的
114
+ 用户级 `codex mcp add` 条目会继承每个会话的工作目录:状态文件落在你的
115
+ 项目里,与 Claude Code 下行为一致。注册的是版本相关的绝对路径——插件
116
+ 更新后重跑一次脚本即可。
117
+
118
+ 要在 Codex 会话旁边看实况面板,在项目目录下的第二个终端(或任意分屏)
119
+ 运行 `node <插件根>/dist/watch.mjs`。
120
+
121
+ ## 任意 MCP 客户端
122
+
123
+ 服务器已发布到 npm,任何 MCP 客户端(Cursor、Windsurf、Zed、Gemini
124
+ CLI……)都能用标准 stdio 条目接入:
125
+
126
+ ```
127
+ npx -y mellos-mapping
128
+ ```
129
+
130
+ 地图文件落在客户端会话的工作目录(`.claude/mellos-mapping.json`)。在同
131
+ 一项目里打开实况面板:
132
+
133
+ ```
134
+ npx -y -p mellos-mapping mellos-mapping-watch
135
+ ```
136
+
137
+ 技能/纪律层是 Claude Code 与 Codex 专属的;其他客户端获得四个 `mmap_*`
138
+ 工具和面板,提示词自备。
139
+
140
+ ## 使用
141
+
142
+ 1. 让 Claude 构建一个非平凡的东西。捆绑的 skill 会让 Claude 先声明幽灵
143
+ 设计,并在工作过程中保持地图与现实一致。
144
+ 2. 运行 `/mellos-mapping:mmap` 打开实况分屏(Windows 上是 Windows
145
+ Terminal 分屏,tmux 里是 tmux 分屏,其他环境会打印一条命令让你在
146
+ 第二个终端里运行)。字体缺少制表符字形时用 `--ascii`。
147
+ 3. 看着节点从底部一路亮起。图让你不安的时候就打断它——这正是它存在的
148
+ 意义。
149
+
150
+ 分屏支持鼠标(xterm SGR any-event 协议——htop 和 tmux 说的同一种话):
151
+
152
+ | 输入 | 动作 |
153
+ | --- | --- |
154
+ | 悬停节点 | 高亮它的关系线;在地图下方预览节点详情 |
155
+ | 点击节点 | 钉住——鼠标移开后详情仍然常驻 |
156
+ | 点击空白 / `Esc` | 取消钉住;无钉住时 `Esc` 从下潜返回 |
157
+ | 滚轮 / `+` `-` | 缩放,以焦点节点为锚(阶梯见下) |
158
+ | 按住左键拖动 | 地图超出面板时抓取平移 |
159
+ | shift+滚轮 | 垂直滚动 |
160
+ | `hjkl` / 方向键 | 微移视口 |
161
+ | `Tab` / `Shift+Tab` / `1-9` / 点击标签 | 切换页(并行的多张地图) |
162
+ | 双击带 `⊞` 的节点 | 下潜进它的子图(一个子页面) |
163
+ | `Backspace` / `Esc` | 从上一次下潜爬回父图 |
164
+ | 拖动 `⋯` 分隔线 | 调整详情面板高度——向上拉,完整阅读长设计笔记 |
165
+ | `0` | 重置平移和缩放 |
166
+ | `q` | 退出面板 |
167
+
168
+ 缩放先做几何缩小,只在阶梯两端才切换显示模式——每一级都能看到有意义的
169
+ 数据:
170
+
171
+ ```
172
+ 细读 ← 100% ← 85% ← 70% ← 55% ← 概览
173
+ ```
174
+
175
+ - **放大过 100%**——验证证据和设计笔记直接在盒子里展开;
176
+ - **85–55%**——留白收紧、标签按比例截断,盒子还是盒子;
177
+ - **低于 55%**——标签已短到无意义,此时地图**聚合**:每个已声明的分组
178
+ (层内的具名子系统)变成一个盒子,如 `地基子系统 1/2`,状态由成员推导,
179
+ 边收拢到分组上,未分组节点保持原样。就像真地图缩小后显示省名,而不是
180
+ 把城市变成无名光点。(没有声明分组的地图退化为纯字形星座 + 每层计数。)
181
+ 页脚始终显示当前级别。
182
+
183
+ 详情面板固定在地图和提示行之间,显示焦点节点的状态、所在层、验证证据、
184
+ 两个方向的连线(`uses → … · used by ← …`)以及设计笔记——任何东西都
185
+ 不会悬浮遮挡地图。
186
+
187
+ `--no-mouse` 关闭鼠标上报,把鼠标留给你的终端复用器。
188
+
189
+ ### 页
190
+
191
+ 一个项目可以并排保有多张地图——**一个工作努力 = 一页**。Claude 在任何
192
+ `mmap_*` 工具里传 `page` 参数即可定向到某页;出现第二页时面板顶部自动长出
193
+ 标签栏。当前页加粗、按整图状态着色;后台页的文件有变化时,它的标签会亮起
194
+ 状态色提示你,而不是抢走你的视线。每页记住自己的平移/缩放/钉住状态。因为
195
+ 每页就是一个独立文件,两个 Claude 会话各写各页永远不会互相覆盖——这也是
196
+ 同一项目里跑多个 Claude 会话的正确姿势。
197
+
198
+ 地图状态存在 `.claude/mellos-mapping.json`(默认页)和
199
+ `.claude/mellos-mapping.pages/<页名>.json`(命名页)——纯 JSON,想在 git
200
+ 里留下地图的历史就把它们提交进去。
201
+
202
+ ### 图种
203
+
204
+ 缺省图种 `dev` 就是上文那本活的进度账本。同一套分层 DAG 机器也能画文档型
205
+ 图:在 `mmap_declare` 里传 `kind`,该页即以中性方式渲染——素色实线盒子,
206
+ 没有幽灵、没有 spinner、不数进度。
207
+
208
+ | 图种 | 读法 | 专属能力 |
209
+ | --- | --- | --- |
210
+ | `architecture` | 分层组件(也适合模块依赖、调用图) | 边标签标协议 |
211
+ | `dataflow` | 管线阶段即层,源头在最底 | 边标签标数据 |
212
+ | `behavior-tree` | 叶子(动作)在最底,根在顶(也适合思维导图、WBS) | 节点 kind `selector` `sequence` `parallel` `decorator` `condition` `action` 渲染为字形 |
213
+ | `sequence` | 经典的调用/返回时序:时间自上而下流,参与者是顶部泳道表头;每次进入和每次返回都是"当事参与者泳道里"的一个事件 | `lanes` 即参与者泳道;边标签即消息 |
214
+
215
+ 节点 kind 和边标签在 `dev` 图上同样可用。状态机是有意不支持的:状态迁移
216
+ 成环,而这里的边只许向下。
217
+
218
+ ### 子图
219
+
220
+ 节点可以用 `submap: <页名>` 链接一个子页面——面板给它戴上 `⊞` 徽标;双击
221
+ 下潜进子图,`Backspace` 爬回父图。图中图,完全由页组合而成:没有新存储、
222
+ 没有新不变量。一个节点值不值得配子图,由 AI 自行判断——大多数不需要。
223
+
224
+ 子图是节点的内部细节,不是兄弟页:被引用为子图的页**不占标签栏**。下潜
225
+ 之后标签行变成面包屑——`⌫ 父图 ▸ 节点`——点击它(或按 `Backspace`)爬
226
+ 回去。隐藏的子图在后台有变化时,底栏会提示。
227
+
228
+ ## MCP 工具
229
+
230
+ | 工具 | 用途 |
231
+ | --- | --- |
232
+ | `mmap_declare` | 生长地图:标题、图种、层级横条、泳道、分组(子系统)、节点、边(可带标签;批量,全有或全无) |
233
+ | `mmap_update` | 记录进度:`planned → in-progress → done`(附证据)、`regressed`、分组/泳道归属、节点 kind |
234
+ | `mmap_remove` | 修订:删除边、节点、分组、泳道、空层 |
235
+ | `mmap_view` | 把当前地图渲染成文本,直接在对话里看(可选 `zoom` 参数) |
236
+
237
+ 工具强制的结构不变量:层按 rank 构成全序;每个节点恰好属于一层;边**严格
238
+ 向下**——因此图从构造上就是无环的;节点不能依赖同层兄弟(如果 A 需要
239
+ 兄弟 B,要么 B 其实是更低层的概念,要么 A 和 B 本来就是一个节点)。
240
+
241
+ ## 开发
242
+
243
+ ```
244
+ npm install
245
+ npm run verify # 类型检查 + 测试 + 打包
246
+ ```
247
+
248
+ 这个仓库本身就是自下而上分层的,每一层都有自己的规格测试:
249
+
250
+ | 层 | 代码 | 职责 |
251
+ | --- | --- | --- |
252
+ | 0 domain | `src/domain/` | 地图值、结构不变量、纯操作 |
253
+ | 1 store | `src/store/` | 原子化状态文件持久化、边界校验 |
254
+ | 2 apply | `src/server/apply.ts` | 工具输入 → 事务性操作序列 |
255
+ | 3 server | `src/server/server.ts` | stdio 上的四个 MCP 工具 |
256
+ | 4 render | `src/render/`、`src/watch/` | ASCII 渲染器和轮询面板 |
257
+
258
+ `dist/` 是刻意提交的:插件安装就是克隆本仓库、不运行任何东西,所以入口
259
+ 文件以打包形式随仓库分发。
260
+
261
+ ## 许可证
262
+
263
+ MIT