mellos-mapping 0.26.1 → 0.27.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/README.md CHANGED
@@ -5,6 +5,7 @@
5
5
  [![MCP registry](https://img.shields.io/badge/MCP_registry-listed-2f6feb)](https://registry.modelcontextprotocol.io/v0/servers?search=io.github.GuangminJu/mellos-mapping)
6
6
  [![CI](https://img.shields.io/github/actions/workflow/status/GuangminJu/mellos-mapping/ci.yml?branch=main&label=CI)](https://github.com/GuangminJu/mellos-mapping/actions/workflows/ci.yml)
7
7
  [![license](https://img.shields.io/badge/license-MIT-444)](LICENSE)
8
+ [![LINUX DO](https://img.shields.io/badge/LINUX%20DO-community-ffb400?logo=discourse&logoColor=white)](https://linux.do)
8
9
 
9
10
  English | [简体中文](README.zh-CN.md)
10
11
 
@@ -120,6 +121,22 @@ split beside the session. Install it *as a plugin*: neither `omp plugin link`
120
121
  nor the npm package is a plugin, and both would leave the tools behind. See
121
122
  [omp installation and limitations](docs/distributions/omp.md).
122
123
 
124
+ **pi** reads none of that layout: it loads an extension and has no MCP of its
125
+ own, by design. So the plugin speaks MCP to itself — the extension declared in
126
+ `package.json#pi.extensions` (`dist/pi-extension.mjs`) starts the same
127
+ `dist/server.mjs` in the session's directory, which makes the eight `mmap_*`
128
+ tools the same eight, under the same names, and builds the session paragraph
129
+ from the same store and the same policy text the Claude hook prints:
130
+
131
+ ```
132
+ pi install npm:mellos-mapping
133
+ ```
134
+
135
+ Add `-l` to install it for the current project instead of every one, then start
136
+ a new session: pi discovers packages at session start. The package's `skills/`
137
+ and `commands/` travel with it — the same map discipline, and `/mmap` for the
138
+ same slash command. See [pi installation and behaviour](docs/distributions/pi.md).
139
+
123
140
  The first session after installing asks you **one** question — how eager
124
141
  mapping should be — and records the answer for every project you will ever
125
142
  open. From then on the hook carries it into each new session by itself; there
@@ -188,6 +205,18 @@ identified by its version bump rather than gated by it. Restart omp afterwards,
188
205
  and reopen a pane still showing the old bundle (`q` in it, then `mmap_open`
189
206
  again).
190
207
 
208
+ pi updates the package it installed, with no marketplace in between:
209
+
210
+ ```
211
+ pi update npm:mellos-mapping
212
+ ```
213
+
214
+ That is the npm source; a git source is reconciled to the ref your settings name
215
+ by pi's own update, and a versioned spec (`npm:mellos-mapping@0.27.0`) is pinned
216
+ and skipped. Restart the session afterwards: a session owns the map server
217
+ process it started, so one still running keeps the copy it began with until it
218
+ ends.
219
+
191
220
  ### Upgrading from 0.19
192
221
 
193
222
  0.20 moved the store out of `.claude/` — the map belongs to this tool, not to
@@ -751,6 +780,11 @@ are stored in `~/.mellos/support/star-reminder.json`; nothing is uploaded and
751
780
  GitHub is contacted only when the user follows the link. Unreadable settings
752
781
  or a busy store silently skip the reminder.
753
782
 
783
+ ## Community
784
+
785
+ This project takes part in and endorses the
786
+ [LINUX DO](https://linux.do) community.
787
+
754
788
  ## License
755
789
 
756
790
  MIT
package/README.zh-CN.md CHANGED
@@ -5,6 +5,7 @@
5
5
  [![MCP registry](https://img.shields.io/badge/MCP_registry-listed-2f6feb)](https://registry.modelcontextprotocol.io/v0/servers?search=io.github.GuangminJu/mellos-mapping)
6
6
  [![CI](https://img.shields.io/github/actions/workflow/status/GuangminJu/mellos-mapping/ci.yml?branch=main&label=CI)](https://github.com/GuangminJu/mellos-mapping/actions/workflows/ci.yml)
7
7
  [![license](https://img.shields.io/badge/license-MIT-444)](LICENSE)
8
+ [![LINUX DO](https://img.shields.io/badge/LINUX%20DO-community-ffb400?logo=discourse&logoColor=white)](https://linux.do)
8
9
 
9
10
  [English](README.md) | 简体中文
10
11
 
@@ -108,6 +109,21 @@ omp 不读 `hooks/hooks.json`,所以那段会话说明由插件的 omp 宿主
108
109
  件,用它们装会只剩适配器、没有工具。见
109
110
  [omp 安装与限制](docs/distributions/omp.md)。
110
111
 
112
+ **pi** 则完全不读那套目录:它加载的是扩展,而且出于设计考虑自己没有 MCP。
113
+ 所以这个插件自己跟自己讲 MCP——在 `package.json#pi.extensions` 里声明的扩
114
+ 展(`dist/pi-extension.mjs`)会在会话所在目录启动同一个 `dist/server.mjs`,
115
+ 八个 `mmap_*` 工具因此就是同样的八个、同名可用,会话说明也来自同一个存储、
116
+ 同一段策略文字,与 Claude 钩子打印的一样:
117
+
118
+ ```
119
+ pi install npm:mellos-mapping
120
+ ```
121
+
122
+ 加 `-l` 只装到当前项目而不是所有项目,之后开一个新会话:pi 在会话开始时才
123
+ 发现包。包里的 `skills/` 与 `commands/` 随之一并生效——同一套建图纪律,
124
+ `/mmap` 也还是同一个斜杠命令。见
125
+ [pi 安装与行为](docs/distributions/pi.md)。
126
+
111
127
  装完之后的第一个会话只会问你**一个**问题——建图要多积极——并把答案记成
112
128
  你以后打开的每一个项目的默认。此后钩子会自己把它带进每个新会话;再也没有
113
129
  "每个项目设置一遍"这回事。见
@@ -166,6 +182,16 @@ omp plugin marketplace update mellos-mapping && omp plugin upgrade mellos-mappin
166
182
  因此版本号提升是给发行**贴标签**,而不是送达的门槛。之后重启 omp,并把仍显示旧
167
183
  运行文件的面板关掉重开(面板里按 `q`,再 `mmap_open`)。
168
184
 
185
+ pi 更新的则是它装下的那个包,中间没有市场目录:
186
+
187
+ ```
188
+ pi update npm:mellos-mapping
189
+ ```
190
+
191
+ 这是 npm 来源;git 来源由 pi 自己的更新流程校准到你 settings 里写的 ref,带版本的
192
+ 写法(`npm:mellos-mapping@0.27.0`)会被跳过。之后重启会话:每个会话各自拥有它启动
193
+ 的地图服务器进程,仍在运行的会话会一直用开始时的那份副本,直到会话结束。
194
+
169
195
  ### 从 0.19 升级
170
196
 
171
197
  0.20 把地图存储从 `.claude/` 挪到了 `.mellos/`——地图属于这个工具,不属于
@@ -671,6 +697,10 @@ Star 按钮会调用系统默认浏览器打开 GitHub,方便沿用已有登
671
697
  UTC 日期、最多 3 天的计数和已提醒标记,不上传数据,不查询是否点过 Star;
672
698
  只有用户主动点击链接时才访问 GitHub。设置损坏、不可写或锁忙时静默跳过。
673
699
 
700
+ ## 社区
701
+
702
+ 本项目积极参与并认可 [LINUX DO 社区](https://linux.do)。
703
+
674
704
  ## 许可证
675
705
 
676
706
  MIT
@@ -0,0 +1,124 @@
1
+ ---
2
+ description: Open the live Mellos map in a terminal split pane beside this session
3
+ argument-hint: "[setup] [--page <slug>] [--window] [--ascii]"
4
+ allowed-tools: Bash(wt *), Bash(node *), Bash(tmux *)
5
+ ---
6
+
7
+ If `$ARGUMENTS` contains `setup`, do NOT open the pane. Run the setup
8
+ questionnaire instead: call `mmap_setup` (no arguments) to read the current
9
+ policy — the reply names the USER-level choice, this project's override if it
10
+ has one, and which of them is in effect. Then ask the user which mode they
11
+ want — `always` (map every structured task: workflows, designs, architecture,
12
+ technical dependencies), `complex` (only medium or complex tasks),
13
+ `on-request` (only when explicitly asked) — using AskUserQuestion where
14
+ available, mentioning whatever is already set.
15
+
16
+ Persist with `mmap_setup {policy, scope}`. `scope` defaults to `user`, which
17
+ is almost always right: the question is about how this person works, so it is
18
+ answered once and applies to every project they open. Use
19
+ `scope: "project"` only when they say they want THIS project to differ from
20
+ that — ask which they mean if `$ARGUMENTS` does not make it obvious. Confirm
21
+ what was saved, at which scope, and where. Then stop.
22
+
23
+ Otherwise: open the live Mellos map watcher for this project in a separate terminal pane.
24
+
25
+ The `mmap_open` tool does exactly this and is the shorter route — pass the page
26
+ this conversation is working on (`mmap_open {page: "<slug>"}`, or `window: true`
27
+ for the dedicated window). It resolves the runtime's own absolute paths and
28
+ reports back whether a pane actually came up, which is also why it is the one
29
+ route that needs no placeholder expanded: this command's text is plain text, and
30
+ `${CLAUDE_PLUGIN_ROOT}` inside it is substituted by Claude Code, NOT by omp
31
+ (omp expands that placeholder inside a plugin's MCP config, not in command
32
+ bodies) nor by a bare MCP client.
33
+ Use the platform routes below when the mmap tools are not available in this
34
+ session, or when the tool reports it could not open one. (You do not need this
35
+ command to keep the map visible day to day: every write answers with a `pane:`
36
+ line, and a `pane: CLOSED` is the assistant's cue to call `mmap_open` itself.)
37
+ The watcher is at `${CLAUDE_PLUGIN_ROOT}/dist/watch.mjs`. The store is
38
+ MULTI-PAGE: the default page lives at `.mellos/map.json` and named
39
+ pages at `.mellos/pages/<slug>.json` — the watcher takes the
40
+ default path as its base, polls ALL of these files, and redraws on change.
41
+ The default file is optional; a project whose work lives on named pages has
42
+ no `.mellos/map.json` at all. So never probe that single file to
43
+ decide whether a map exists — call `mmap_view`, which reads the real store
44
+ and ends every response with a `pages:` line naming the pages that exist
45
+ (marking the default page absent when it is) and the one it just rendered.
46
+
47
+ Follow the platform-appropriate route:
48
+
49
+ 1. **Windows with Windows Terminal** (`wt` available — the usual case, in
50
+ Claude Code and in omp alike; omp's plugin also ships this same launcher): run
51
+
52
+ ```
53
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/open-pane.mjs" "<PROJECT_DIR>" --page <PAGE_SLUG>
54
+ ```
55
+
56
+ replacing `<PROJECT_DIR>` with the absolute project directory and
57
+ `<PAGE_SLUG>` with the page THIS conversation's effort lives on — the same
58
+ slug you pass to the mmap tools. Care about what the pane actually shows:
59
+ without `--page` it opens on the most recently written page, which after a
60
+ gap or in a multi-effort project may not be the one under discussion. Omit
61
+ `--page` only when no particular page is the subject (the user just wants
62
+ the map open), or for the default page. The
63
+ launcher identifies the Windows Terminal window hosting THIS session
64
+ (console-title nonce probe), brings it to the foreground, and splits it
65
+ vertically, then returns keyboard focus to the conversation. If the session
66
+ window cannot be identified or focused, report that failure and ask the user
67
+ to activate this conversation's PowerShell tab before retrying. Do not open
68
+ a separate window unless the user explicitly asks for one.
69
+
70
+ Flags: `--page <slug>` names the page to show first. Once open, the pane
71
+ AUTO-FOLLOWS the page being written (the map the agent is operating on),
72
+ so it tracks the work by itself; the user can toggle that with the `f`
73
+ key, and `--no-follow` starts it off. When a watcher bound to this console is
74
+ ALREADY running, the launcher does not open another pane — it retargets
75
+ the existing one (output says `refocused=<slug>`, picked up within a
76
+ poll tick); rerun with `--page` when the user asks to see a specific
77
+ page. `--window` skips the split
78
+ and opens the map in the dedicated window on purpose — use it when the
79
+ user prefers the map separate from the chat (second monitor, small
80
+ screens). `--ascii` for fonts without box-drawing characters. `--force`
81
+ opens another pane even though a watcher for this project is already
82
+ running (default is to skip). The remaining watcher flags are forwarded
83
+ verbatim: `--no-color`, `--no-mouse`, `--interval <ms>` (default 250,
84
+ floored at 50). An unknown flag is a usage error, never dropped in
85
+ silence — relay the message rather than retrying blind.
86
+
87
+ A page the user is done with they can close from the pane itself: `x`, or
88
+ the `×` on the active tab, asks, and a second press within the window
89
+ deletes that page's file. `mmap_remove {pages: [...]}` does the same from
90
+ a tool call — with the user behind it, never on your own initiative.
91
+
92
+ The user also has the pane on a toggle of their own: `mmap` typed in the
93
+ current console opens its pane, and `mmap` again closes that pane. So a pane
94
+ that disappears mid-session is a decision, not a crash — say so rather
95
+ than reopening it uninvited.
96
+
97
+ 2. **Linux/macOS with tmux**: use the same `mmap_open` tool or launcher command
98
+ as route 1. It targets the inherited session/pane, or discovers the single
99
+ attached session even when the tool shell has no `TMUX`. It creates a right
100
+ split without moving input focus; `--window` requests a new tmux window.
101
+ Repeated opens reuse and retarget this session's watcher. If several sessions
102
+ are attached, set `MELLOS_MAPPING_TMUX_TARGET` in the MCP server environment
103
+ to a session or pane (for example `work:2.1`). For a custom server socket,
104
+ also set `MELLOS_MAPPING_TMUX_SOCKET` to its absolute path, then restart the
105
+ MCP server. Do not guess a session or open a detached window.
106
+
107
+ 3. **Neither**: print the watcher command and tell the user to run it in any
108
+ second terminal themselves (add `--ascii` if their font lacks box-drawing
109
+ characters). The launcher's own failure message quotes it in full, with
110
+ absolute paths — relay that one verbatim. Written by hand it is
111
+ `node "<plugin root>/dist/watch.mjs" --file "<PROJECT_DIR>/.mellos/map.json" --page <PAGE_SLUG>`,
112
+ where `<plugin root>` is `${CLAUDE_PLUGIN_ROOT}` inside Claude Code and the
113
+ installed runtime's own directory everywhere else (omp and bare MCP
114
+ clients: take the path from the tool's message rather than inventing one).
115
+
116
+ If launching fails, relay its reason and the complete quoted fallback command.
117
+ Do not repeatedly call `mmap_open` on later writes; retry only after the terminal
118
+ environment changes or the user asks. `mmap_view` remains available inline. After
119
+ the pane is up, confirm briefly; only when neither the default file nor any
120
+ page file exists does the pane sit on its standby screen ("waiting for the
121
+ first mmap_declare ...", or "waiting for &lt;file&gt; ..." when `--page` named a
122
+ page that does not exist yet), until the first `mmap_declare`.
123
+
124
+ $ARGUMENTS
@@ -1,6 +1,5 @@
1
1
  // src/host/omp/extension.ts
2
- import { homedir as homedir2 } from "node:os";
3
- import { dirname as dirname5, join as join5 } from "node:path";
2
+ import { dirname as dirname5 } from "node:path";
4
3
  import { fileURLToPath as fileURLToPath2 } from "node:url";
5
4
 
6
5
  // src/hook/session-start.ts
@@ -288,7 +287,9 @@ if (launchedAsEntry(process.argv[1], import.meta.url)) {
288
287
  main().catch(() => process.exit(0));
289
288
  }
290
289
 
291
- // src/host/omp/extension.ts
290
+ // src/host/session-context.ts
291
+ import { homedir as homedir2 } from "node:os";
292
+ import { join as join5 } from "node:path";
292
293
  var SESSION_CONTEXT_TYPE = "mellos-mapping.session-context";
293
294
  function sessionParagraph(projectDir) {
294
295
  const stateFile = join5(projectDir, STATE_FILE_RELATIVE_PATH);
@@ -296,6 +297,12 @@ function sessionParagraph(projectDir) {
296
297
  if (!scopes.ok) return void 0;
297
298
  return sessionStartContext({ policy: scopes.value.effective, hasStore: hasMap(stateFile) });
298
299
  }
300
+ function storeIsReadable(projectDir) {
301
+ const stateFile = join5(projectDir, STATE_FILE_RELATIVE_PATH);
302
+ return effectiveMappingPolicy(configFilePath(stateFile), userConfigFilePath(homedir2())).ok;
303
+ }
304
+
305
+ // src/host/omp/extension.ts
299
306
  function mellosMappingOmp(pi) {
300
307
  const pluginRoot = dirname5(dirname5(fileURLToPath2(import.meta.url)));
301
308
  let armed = true;
@@ -348,12 +355,6 @@ function mellosMappingOmp(pi) {
348
355
  return { message };
349
356
  });
350
357
  }
351
- function storeIsReadable(projectDir) {
352
- const stateFile = join5(projectDir, STATE_FILE_RELATIVE_PATH);
353
- return effectiveMappingPolicy(configFilePath(stateFile), userConfigFilePath(homedir2())).ok;
354
- }
355
358
  export {
356
- SESSION_CONTEXT_TYPE,
357
- mellosMappingOmp as default,
358
- sessionParagraph
359
+ mellosMappingOmp as default
359
360
  };