dsh-mindmap 0.12.0 → 0.13.1

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/CHANGELOG.md CHANGED
@@ -6,12 +6,25 @@ All notable changes to this project are documented here. Release-specific notes
6
6
 
7
7
  ### Added
8
8
 
9
+ - Default mindmap inbox and naming (036): a request without a location ("创建一个脑图", "把刚才的讨论整理成脑图", "盘点一下这个问题") now files the document in `.mindmaps/` as `YYYYMMDD-HHmmss-中文描述.md` instead of dropping it on top of the session working directory root. `mindmap_create` takes `name` when the user named the mindmap and a short `description` otherwise — the host reads the clock, so the model never guesses a time. Descriptions are whitespace-collapsed, truncated to 24 characters, and rejected outright when they carry path separators or control characters. `.mindmaps/` is created on first use (a same-named ordinary file, a symlinked-out directory, and a missing session cwd all fail closed), is never added to `.gitignore`, and shows in the directory tree as 脑图收件箱(.mindmaps) with the root/blank-space context menu offering 在脑图收件箱新建脑图. An explicit `directory` is still honoured verbatim, and the approval hook now computes the final normalized path before the first write, so a fresh inbox creation still goes through the normal confirmation. The root node title keeps equaling the filename, so a default-created mindmap temporarily shows its timestamp as the root title; splitting filename from display title is left as a separate decision.
10
+ - Approval and write now agree on one path (036 follow-up): the confirmation prompt resolves the first free `-2`/`-3` candidate before the user is asked, instead of naming a file a previous same-second capture had already taken and then silently writing a sibling. If another create claims the confirmed name during the deliberation window, the host steps to the next free suffix, the tool result reports that final path, and the session grant is recorded against it rather than the stale candidate — so an existing file is never overwritten and a confirmation never buys a write nobody was shown. Concurrent default creates are verified end to end: eight same-description creates launched in parallel produce eight distinct documents with no lost bytes.
11
+
12
+ - Node search and quick navigation: ⌘/Ctrl+F (or the 🔍 in the canvas zoom bar) opens a compact search over the current mindmap — case-insensitive substring matching on node text, a `1 / 5` counter, and Enter / ↓ / ↑ (Shift+Enter) stepping through matches with wrap-around. Every match gets a light theme-token ring and the active match a stronger double ring; jumping keeps the user's zoom, scrolls the match to the focus anchor, and auto-expands collapsed ancestors so hits inside folded subtrees are actually revealed. Search is pure view state (no markdown writes, no revision changes), reconciles on stable node ids after an AI re-render, and resets on document switch; the ⌘/Ctrl+F interception only fires while the mindmap canvas is active and never while the caret sits in another text entry.
13
+
14
+ - Canvas focus experience: clicking a node now animates the zoom/scroll transition (≤250 ms, eased) and caps each click's zoom change at ×2/÷2, so focusing into a huge map drills down progressively instead of jumping 4× in one step. The transition interpolates the node's viewport anchor from its clicked position to the left-quarter focus point (no first-frame jump), and animation frames are written directly to the canvas DOM layer without re-rendering the tree per frame. Any new interaction (drag, zoom buttons, another click) interrupts the animation instantly, and the animation self-disables for the session once the resize-observer circuit breaker trips, falling back to the previous instant behavior. When an AI edit pushes the selected node fully out of view, the canvas performs a minimal scroll to bring it back to the edge without touching the user's chosen zoom.
15
+ - Copy as markdown: a 复制全文 button now sits left of 导出图片 in both the sidebar toolbar and the standalone panel header. One click copies the current mindmap's raw markdown source to the system clipboard via the existing `copyPlainText` helper (Clipboard API with a textarea fallback) — the document state's `doc.content` is used directly instead of re-serializing the tree, so headings, nested lists, tables, and the original whitespace round-trip losslessly. Success briefly switches the button label to 已复制 ✓; failures surface in the shared export error slot. The node context-menu 复制全文 (single-node text) is unchanged.
16
+ - Narrow panels (sidebar mode, viewport under 400px) now fit the mindmap by height instead of width; the overflowing part is reachable by panning, which keeps text readable in the 280px-minimum sidebar. The canvas scroller also reserves a stable scrollbar gutter (`scrollbar-gutter: stable`), so the fit ratio no longer oscillates as scrollbars appear and disappear; hosts without the property degrade to the previous behavior.
9
17
  - Read-only document opening now renders a clicked Markdown file before asking the AI to take over editing. `mindmap_create` accepts an optional relative directory, and read/write results carry a SHA-256 revision so stale `mindmap_update` calls can be rejected instead of overwriting newer edits.
10
18
  - Standalone panel width now remains usable on narrow viewports by clamping the initial, saved, resized, and settings-derived widths together.
11
19
  - Write approval now supports `per-operation`, `session` (default), and `off` for ordinary writes. Session mode reuses a successful approval per document, while renames, empty-content deletions, and broad rewrites stay gated; the settings page exposes the policy and the current mindmap workspace shows and revokes the current-session grant.
12
20
 
21
+ ### Changed
22
+
23
+ - `mindmap_create` without `directory` no longer writes to the root of the session working directory: the file goes into the `.mindmaps/` inbox (see above). Existing documents stay exactly where they are — only new creations move.
24
+
13
25
  ### Fixed
14
26
 
27
+ - Creating a mindmap re-checks its target against the filesystem immediately before the write (036 follow-up, P1). The path was validated when the confirmation was drawn, but the plan was then trusted as-is: renaming the target directory and replacing it with a symlink pointing outside the session working directory while the user was reading the confirmation made `mindmap_create` write the file outside the workspace. Every candidate — inbox or explicit directory — is now re-resolved through the same inside-the-cwd check right before its atomic `wx` create; a path that no longer resolves inside the session cwd aborts the create (no outside file, no session grant), and the user is asked to start it again. The path confirmed and the path written stay the same one.
15
28
  - Fixed a session-initialization race where an AI `mindmap_create` could expand the right-side tab but leave the workspace on the directory list. Session cleanup now runs before automatic document selection, and the opening-event cursor is reset when switching sessions.
16
29
  - The broad-rewrite ratio check now applies only to documents of 4 KB or more, so rewriting a few-hundred-byte mindmap end to end no longer escalates to a fresh high-risk confirmation and the session grant stays usable. Renames, cleared content, and removed blocks above 16 KB remain gated.
17
30
  - Choosing an explicit confirmation frequency in the settings page now lifts the legacy `requireApproval: false` switch. That switch takes precedence over `approvalMode` in the engine, so the previous behaviour saved the choice and then reverted it to `off`.
package/README.md CHANGED
@@ -19,19 +19,36 @@ A DeepSeek Harness plugin that turns a plain Markdown file into a live mindmap.
19
19
  - **Live panel with zero extra channels** — the panel consumes the session snapshot (`mindmap_*` tool results), so every AI edit re-renders immediately.
20
20
  - **Reliable open, recoverable loading state** — AI create/open results always expand the panel (a structural-fingerprint selector drives snapshot recomputation even when the host reuses the nodes array reference); clicking a `.md` first reads it through the local read-only route, while AI fallback loading still recovers from case-only path mismatches, inline tool errors, and a ~30s watchdog timeout with one-click retry.
21
21
  - **Floating right panel or native sidebar tab** — when `dsh-better-sidebar` is installed, the mindmap registers as a native single-instance tab (`dsh-mindmap:mindmap`) inside Better Sidebar, with a compact one-row toolbar (mindmap list, current mindmap, and export on the same line); the header 思维脑图 button opens or focuses that tab. When Better Sidebar is absent, the panel falls back to a standalone floating right panel toggled by the 思维脑图 button — drag-resizable (280px ~ 80% viewport), persisted, and pushing the chat left (layout-push) so the two never overlap. AI create/open/view intents always open or focus the panel/tab and switch to the target document, including when it is currently closed or the same document is opened again. The mode switch is fully reversible: if Better Sidebar is unloaded mid-session, the standalone panel and layout-push CSS are restored automatically.
22
- - **Directory tree tab** — a persistent tree of the session working directory (served by plugin-owned read-only routes), lazy-loaded per directory; right-click to create a mindmap at the root or inside a directory; left-click a `.md` renders it through the read-only route first, then hands it to the AI for editing when the draft is empty. Labeled 目录 in standalone mode and 脑图列表 in sidebar mode.
22
+ - **Directory tree tab** — a persistent tree of the session working directory (served by plugin-owned read-only routes), lazy-loaded per directory; right-click to create a mindmap in the inbox or inside a directory; left-click a `.md` renders it through the read-only route first, then hands it to the AI for editing when the draft is empty. Labeled 目录 in standalone mode and 脑图列表 in sidebar mode.
23
23
  - **Single-mindmap mode** — two tabs only: the tree/list tab and 脑图 (the current mindmap); opening another `.md` replaces the previous one.
24
24
  - **"What you see is what the AI edits"** — when the visible mindmap differs from the AI's working document, the panel automatically asks the AI to open it, keeping the chat focus in sync.
25
25
  - **MarkGrove-style mapping** — heading hierarchy, nested lists (empty items become placeholder nodes), code blocks as leaf nodes, paragraphs promoted to their own nodes (019 block concept), stable structural IDs, and orthogonal connector lines between nodes.
26
- - **Centered canvas with zoom and pan** — the mindmap opens centered in the canvas (scrollable without edge clipping when larger); a floating zoom bar at the canvas top-right (zoom out / percent / zoom in / fit) applies auto fit-to-view on open (small maps stay at 100%), steps through 25%–300% with a stable view center, and keeps re-fitting as the AI edits — until you zoom manually. Click any node to zoom in on it and its whole subtree, with the node pinned at the left-center of the canvas. The canvas also pans by drag: the **middle button** anywhere (even over a node), the **left button on blank canvas** (the Mac trackpad「click and drag」path), or **Space + left button** when the drag must start on a card. Panning works in both directions even when content does not overflow; content follows the pointer 1:1, blank space shows a grab hand, and a 4px threshold separates drag from click — so clicking blank space still clears the selection and clicking a node still focuses it, while a real drag never wipes the selection ring.
26
+ - **Centered canvas with zoom and pan** — the mindmap opens centered in the canvas (scrollable without edge clipping when larger); a floating zoom bar at the canvas top-right (zoom out / percent / zoom in / fit) applies auto fit-to-view on open (small maps stay at 100%), steps through 25%–300% with a stable view center, and keeps re-fitting as the AI edits — until you zoom manually. Click any node to zoom in on it and its whole subtree, with the node pinned at the left-center of the canvas. The focus transition glides the node from its clicked position to the left-quarter anchor with no first-frame jump, animates the zoom over ≤250 ms (capped at ×2/÷2 per click, so a huge map drills down progressively instead of jumping 4× in one step), and writes frames directly to the canvas DOM layer without re-rendering the tree per frame; any new interaction interrupts it instantly. When an AI edit pushes the selected node fully out of view, the canvas performs a minimal scroll to bring it back to the edge without touching your chosen zoom. Narrow panels (sidebar mode) fit by height instead of width — the overflowing part is reachable by panning — and the scrollbar gutter is reserved, so the fit ratio no longer oscillates as scrollbars appear. The canvas also pans by drag: the **middle button** anywhere (even over a node), the **left button on blank canvas** (the Mac trackpad「click and drag」path), or **Space + left button** when the drag must start on a card. Panning works in both directions even when content does not overflow; content follows the pointer 1:1, blank space shows a grab hand, and a 4px threshold separates drag from click — so clicking blank space still clears the selection and clicking a node still focuses it, while a real drag never wipes the selection ring.
27
27
  - **Collapsible subtrees** — every node with children carries a small toggle on its connector: collapsing hides the whole subtree and reports how many nodes are hidden, so large maps stay navigable. It is view state only — the markdown file is untouched, image export still covers the full subtree, and switching documents expands everything again.
28
28
  - **PNG export** — one click on 导出图片 exports the current mindmap.
29
+ - **Copy as markdown** — one click on 复制全文 (left of 导出图片) copies the current mindmap's raw markdown source to the system clipboard, so pasting into markdown-aware editors restores headings, nested lists, and tables, while plain-text targets keep the literal `#`/`-` source. The button shows 已复制 ✓ for about two seconds on success; failures reuse the export error slot.
30
+ - **Node search and quick navigation** — search the current mindmap by text (⌘/Ctrl+F, or the 🔍 in the zoom bar), jump through matches with Enter / ↑ ↓ (wrap-around), and automatically reveal matches inside collapsed subtrees. Jumping keeps your zoom and only scrolls; search is view-only, so the markdown never changes.
29
31
  - **Safety** — write approval defaults to “once per session/document”: after the first confirmation, ordinary `mindmap_update` calls for that document in the same session do not interrupt the flow. The settings page also offers “every write” and “disable ordinary confirmations”. Renames, deletes, and broad rewrites still require a separate confirmation; the current workspace shows and can revoke the current-session grant. Trusted automation can explicitly set `requireApproval: false` to skip ordinary confirmations; high-risk writes remain gated. The client has **no write path** to the filesystem — every edit goes through the AI tools.
30
32
 
31
33
  Inside Better Sidebar, the mindmap list uses the host's 14px body typography. Markdown files carry a compact M badge; folders and other files use 14px outline icons. Other file formats are display-only, without hover feedback, opening, dragging, or context menus; folders remain expandable. Tabs, actions, and hints use the host's 12px typography role. Standalone mode retains its original appearance, and mindmap node typography, zoom, and image export are unchanged.
32
34
 
33
35
  The embedded M badge uses a transparent background and inherits the filename's theme color for both its bold letter and outline, so it follows light/dark themes and custom skins without relying on accent-color contrast.
34
36
 
37
+ ## Where new mindmaps go
38
+
39
+ When you ask for a mindmap without naming a location — "创建一个脑图", "把刚才的讨论整理成脑图", "盘点一下这个问题" — the file lands in **`.mindmaps/`**, the mindmap inbox:
40
+
41
+ ```text
42
+ .mindmaps/20260918-155230-项目盘点.md
43
+ ```
44
+
45
+ - The `YYYYMMDD-HHmmss` stamp is read by the host from the real clock; the model only supplies the short description (cleaned and truncated to 24 characters). Two captures in the same second get `-2`, `-3`, … suffixes — an existing file is never overwritten, and the write-confirmation names the exact file it is about to create.
46
+ - The path is checked twice: once when the confirmation is drawn, and again against the filesystem right before the write. If the target directory moved or was swapped for a symlink while you were reading the confirmation, the create is refused instead of writing outside the session working directory.
47
+ - `.mindmaps/` is created on first use, not at install time. The directory tree shows it as **脑图收件箱(.mindmaps)**, because a dotted folder otherwise reads as tool residue.
48
+ - Nothing is added to `.gitignore` for you. A mindmap stays an ordinary Markdown file: review it, diff it, commit it, or move it somewhere permanent.
49
+ - Say the location instead and it is respected: `docs/架构脑图.md`, `planning/迭代计划.md`, or right-click a folder in the tree and choose 在此目录新建 Markdown 脑图. An explicit directory is never rewritten into the inbox (and still has to stay inside the session working directory).
50
+ - Because the root node title *is* the filename, a default-created mindmap shows its own timestamp as the root title for now. Splitting filename from display title is a separate decision, so rename the root when you want a clean title.
51
+
35
52
  ## Requirements
36
53
 
37
54
  | Component | Baseline |
@@ -57,7 +74,7 @@ dsh plugin --profile <profile> add <pkg>#v<version>
57
74
 
58
75
  | Tool | Description |
59
76
  | --- | --- |
60
- | `mindmap_create(name, directory?)` | Create `<name>.md` in the session working directory or an optional relative directory and show it in the panel (fails if it exists). |
77
+ | `mindmap_create(name? \| description, directory?)` | Create a mindmap and show it in the panel (fails if the file already exists). With `name`, the file is `<name>.md`; without it, pass a short `description` and the host names the file `YYYYMMDD-HHmmss-<description>.md` inside the `.mindmaps/` inbox. Pass `directory` only when the user chose a location. |
61
78
  | `mindmap_open(path)` | Open an existing `.md` as a mindmap in the panel. |
62
79
  | `mindmap_get(path)` | Read the current Markdown content and revision of a mindmap document. |
63
80
  | `mindmap_update(path, content, renameRoot?, expectedRevision?)` | Write the full Markdown; pass the read revision to reject stale writes; optionally rename the root node (renames the file, collisions rejected). |
package/README.zh-CN.md CHANGED
@@ -19,19 +19,36 @@
19
19
  - **零通道实时面板**——面板直接消费会话快照里的 `mindmap_*` 工具结果,AI 每改一步面板即渲染一次。
20
20
  - **打开必达 + 加载态可恢复**——AI create/open 结果落地,面板必展开(节点结构指纹驱动快照重算,不受宿主数组引用稳定性影响);点目录树 `.md` 会先走本地只读路由直接显示,AI fallback 加载态仍支持大小写路径自动匹配、工具错误提示、约 30 秒超时和一键重试。
21
21
  - **原生侧栏 Tab 或右侧悬浮面板**——安装了 `dsh-better-sidebar` 时,脑图注册为 Better Sidebar 内的原生单实例 Tab(`dsh-mindmap:mindmap`),工具栏只有一行(脑图列表、当前脑图、导出图片在同一行);头部「思维脑图」按钮打开或聚焦该 Tab。未安装时回退为独立的右侧悬浮面板——会话头部按钮开合,宽度可拖(280px ~ 80% 视口)并持久化,打开时**聊天区向左让位**(布局推挤,互不遮挡)。AI 创建、打开或查看脑图时自动展开或聚焦面板/Tab 并切换到目标文档,即使当前收起或重复打开同一文档也能接续跟随。模式切换完全可逆:Better Sidebar 运行中卸载后,独立面板与布局推挤 CSS 自动恢复。
22
- - **常驻目录树 tab**——工作目录结构懒加载树(插件自建只读路由);空白处/目录右键新建脑图;左键点 `.md` 先通过只读路由直接显示,再在草稿为空时交给 AI 对话编辑。独立面板模式标签为「目录」,侧栏模式标签为「脑图列表」。
22
+ - **常驻目录树 tab**——工作目录结构懒加载树(插件自建只读路由);空白处右键新建到脑图收件箱、目录右键新建到该目录;左键点 `.md` 先通过只读路由直接显示,再在草稿为空时交给 AI 对话编辑。独立面板模式标签为「目录」,侧栏模式标签为「脑图列表」。
23
23
  - **单脑图模式**——面板只有树/列表和「脑图」两个 tab,打开新脑图替换旧的那颗。
24
24
  - **「所见即所编」焦点同步**——可见脑图与 AI 工作文档不一致时,面板自动让 AI 打开它,聊天焦点始终跟随你的眼睛。
25
25
  - **MarkGrove 同款映射与连线**——标题层级挂树、列表缩进(空项 = 占位节点)、代码块叶节点、段落升格为独立节点(019 块概念)、稳定结构 ID、节点间直角折线。
26
- - **画布居中、缩放与平移**——脑图打开后居中呈现(超出画布时可滚动、无边缘裁剪);画布右上角浮动缩放条(缩小 / 比例 / 放大 / 适配),打开时自动适配合适比例(小图保持 100%),25%–300% 逐级缩放且视图中心不跳变,AI 编辑后持续自动再适配,直到你手动缩放。点击任意节点即可聚焦:节点滚到画布左侧居中,视图放大到它和整棵子树完整可见(上限 100%)。画布还能拖着走:**中键**随处拖(含节点上)、**空白处左键拖**(Mac 触控板「点按并拖移」)、或 **Space + 左键拖**(必须从节点上起手时);无论内容是否溢出都可横纵双向拖动,内容跟手 1:1,空白处呈抓手光标,4px 阈值把拖与点分开——点空白仍取消选中、点节点仍聚焦,真拖不会误清选中圈。
26
+ - **画布居中、缩放与平移**——脑图打开后居中呈现(超出画布时可滚动、无边缘裁剪);画布右上角浮动缩放条(缩小 / 比例 / 放大 / 适配),打开时自动适配合适比例(小图保持 100%),25%–300% 逐级缩放且视图中心不跳变,AI 编辑后持续自动再适配,直到你手动缩放。点击任意节点即可聚焦:节点从被点位置平滑滑向画布左侧居中锚位(无首帧突跳),视图平滑放大到它和整棵子树完整可见(上限 100%,且单次点击缩放变化不超过 2 倍,巨图上连点渐进深入);动画期间直接操作画布层、不逐帧重绘整棵树,聚焦动画可随时被拖拽、缩放或新点击打断。AI 编辑后若聚焦的节点被顶出视野,画布只做最小滚动把它带回边缘,不打乱你选定的缩放。窄面板(侧栏模式)下自动改按高度适配,宽出的部分靠平移浏览;滚动条槽位常驻,适配比例不再因滚动条出现而反复跳变。画布还能拖着走:**中键**随处拖(含节点上)、**空白处左键拖**(Mac 触控板「点按并拖移」)、或 **Space + 左键拖**(必须从节点上起手时);无论内容是否溢出都可横纵双向拖动,内容跟手 1:1,空白处呈抓手光标,4px 阈值把拖与点分开——点空白仍取消选中、点节点仍聚焦,真拖不会误清选中圈。
27
27
  - **子树折叠**——有子节点的节点在连线起点上带一个小开关:折叠后隐藏整棵子树并提示隐藏了多少节点,超大脑图也能逐层看。折叠只是视图状态,不改 markdown 文件,导出图片仍是完整子树;切换文档自动全部展开。
28
28
  - **PNG 导出**——面板右上角「导出图片」一键导出当前脑图。
29
+ - **复制全文**——「导出图片」左侧一键把当前脑图的 Markdown 原文复制到系统剪贴板:粘到飞书文档 / Notion / Obsidian 等支持 Markdown 的目标会自动还原标题、嵌套列表和表格,粘到纯文本环境则是带 `#`、`-` 符号的源码,零信息损失。成功后按钮短暂显示「已复制 ✓」(约 2 秒),失败复用导出错误的红字提示位。
30
+ - **节点搜索与快速定位**——⌘/Ctrl+F(或缩放条上的 🔍)在当前脑图中搜索文字,Enter / ↑ ↓ 逐个跳转匹配节点(双向环绕),并自动展开被折叠分支中的搜索结果;跳转保留当前缩放、只滚动视图。搜索只改视图状态,绝不动 Markdown。
29
31
  - **安全**——写入确认默认采用“本会话一次”:同一会话内同一脑图首次写入确认后,后续普通 `mindmap_update` 不再重复弹窗;也可切换为“每次确认”或“关闭普通确认”。重命名、删除和大范围重写仍需单独确认;当前脑图工作区会显示并可撤销本会话授权。受信自动化可显式设置 `requireApproval: false` 关闭普通确认,但高风险写入仍需确认。客户端**没有任何写文件通道**,一切编辑都经 AI 工具。
30
32
 
31
33
  内嵌 Better Sidebar 时,脑图列表采用宿主的 14px 正文字体。Markdown 文件显示紧凑的 M 徽标,文件夹与其他文件使用 14px 线框图标;其他格式文件仅展示,没有悬停反馈、打开、拖拽或右键菜单,文件夹仍可展开。标签、操作按钮和提示采用宿主的 12px 字体角色。独立模式保留原有外观;脑图节点的字体层级、缩放和图片导出保持不变。
32
34
 
33
35
  内嵌 M 徽标采用透明底、粗体字母与细描边,字母和边框跟随文件名的主题文字颜色;浅色、深色及自定义皮肤切换时同步适配,不依赖品牌色与底色的对比。
34
36
 
37
+ ## 新建的脑图放在哪
38
+
39
+ 你说「创建一个脑图」「把刚才的讨论整理成脑图」「盘点一下这个问题」这类没点目录的请求时,文件落在 **`.mindmaps/`**——脑图收件箱:
40
+
41
+ ```text
42
+ .mindmaps/20260918-155230-项目盘点.md
43
+ ```
44
+
45
+ - `YYYYMMDD-HHmmss` 由 host 读本机时钟生成,模型只给那句短描述(按文件名安全规则清理,最长 24 字)。同一秒撞名依次加 `-2`、`-3` 后缀,**已有文件永不被覆盖**;写入确认框里报出的就是它准备创建的那条路径。
46
+ - 路径校验走两遍:画确认框时一遍,真正落盘前再按当前文件系统核一遍。你还在读确认框时目标目录被改名、或被换成指向工作区外的符号链接,本次创建直接失败,绝不会把文件写到会话工作目录外面。
47
+ - `.mindmaps/` 第一次需要时才建,不在安装时预生成。目录树里它显示为 **「脑图收件箱(.mindmaps)」**,免得点号目录被当成工具残留以为内容看不见。
48
+ - 不替你写 `.gitignore`。脑图仍是普通 Markdown:可以审阅、diff、提交,也可以挪去正式目录。
49
+ - 你点了位置就尊重位置:`docs/架构脑图.md`、`planning/迭代计划.md`,或在目录树上右键选「在此目录新建 Markdown 脑图」。显式目录不会被改判进收件箱,且照样受会话工作目录边界与符号链接越界校验约束。
50
+ - 根节点标题 = 文件名,所以默认新建的脑图暂时会把时间戳显示成根标题。把「文件名」和「显示标题」拆开是独立需求,想要干净标题就用 `renameRoot` 改名(会同步重命名文件)。
51
+
35
52
  ## 环境要求
36
53
 
37
54
  | 组件 | 基线 |
@@ -57,7 +74,7 @@ dsh plugin --profile <profile> add <pkg>#v<version>
57
74
 
58
75
  | 工具 | 说明 |
59
76
  | --- | --- |
60
- | `mindmap_create(name, directory?)` | 在工作目录或指定相对目录创建 `<name>.md` 并显示到面板(已存在则报错)。 |
77
+ | `mindmap_create(name? \| description, directory?)` | 新建脑图并显示到面板(文件已存在则报错)。给了 `name` 就建 `<name>.md`;没给就传一句短 `description`,由 host 命名成 `.mindmaps/YYYYMMDD-HHmmss-<description>.md`。只有用户点了位置才传 `directory`。 |
61
78
  | `mindmap_open(path)` | 把已有 `.md` 作为脑图打开到面板。 |
62
79
  | `mindmap_get(path)` | 读取脑图文档的当前 Markdown 内容和 revision。 |
63
80
  | `mindmap_update(path, content, renameRoot?, expectedRevision?)` | 写入完整的新 Markdown;带上读取时的 revision 可避免覆盖并发修改;可选重命名根节点(重命名文件,撞名拒绝)。 |