dsh-architecture-map 0.0.0-stage → 0.2.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/CHANGELOG.md +31 -0
- package/CODE_OF_CONDUCT.md +7 -0
- package/CONTRIBUTING.md +24 -0
- package/LICENSE +21 -0
- package/README.md +264 -2
- package/README.zh.md +247 -0
- package/THIRD_PARTY_NOTICES.md +36 -0
- package/client.js +1171 -0
- package/cordis.patch.yml +5 -0
- package/docs/DETAIL.md +76 -0
- package/docs/DETAIL.zh.md +76 -0
- package/docs/preview.svg +50 -0
- package/icon.svg +9 -0
- package/index.js +1 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +68 -4
- package/skills/architecture-map/SKILL.md +75 -0
- package/skills/architecture-map/references/bootstrap.md +100 -0
- package/skills/architecture-map/references/discussion.md +71 -0
- package/skills/architecture-map/references/incremental.md +80 -0
- package/skills/architecture-map/references/schema.md +94 -0
- package/src/README.md +34 -0
- package/src/host/content/index.js +20 -0
- package/src/host/content/local.js +250 -0
- package/src/host/export.js +228 -0
- package/src/host/graph.js +707 -0
- package/src/host/memory.js +364 -0
- package/src/host/plugin.js +1125 -0
- package/src/host/projects.js +241 -0
- package/src/host/remote/commands.js +227 -0
- package/src/host/remote/consent.js +216 -0
- package/src/host/remote/content.js +391 -0
- package/src/host/remote/indexer.js +180 -0
- package/src/host/remote/maintainer.js +85 -0
- package/src/host/remote/ssh.js +287 -0
- package/src/host/remote/state.js +65 -0
- package/src/host/remote/tools.js +162 -0
- package/src/host/signature.js +42 -0
- package/src/host/workspace.js +131 -0
- package/vendor/elkjs.LICENSE +264 -0
- package/vendor/mermaid.LICENSE +21 -0
- package/vendor/mermaid.esm.min.mjs +4343 -0
package/cordis.patch.yml
ADDED
package/docs/DETAIL.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Architecture map
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
A live, addressable architecture graph for DeepSeek Harness. The model writes nodes, edges and anchors into one canonical file; the right sidebar renders it; every node can open an isolated discussion with inherited conversation memory.
|
|
6
|
+
|
|
7
|
+
## What you get
|
|
8
|
+
|
|
9
|
+
- **Canonical graph** — `.archmap/graph.json` with a revision, schema validation, atomic writes and a one-step backup.
|
|
10
|
+
- **Right-sidebar canvas** — layered SVG layout, pan/zoom/Fit, node dragging, reset layout and node details.
|
|
11
|
+
- **Architecture memory** — a manifest of analyzed files, incremental `arch_sync`, code-vs-cosmetic detection, stale marking and a Markdown dossier (`overview`, `modules/<id>`, `notes/<id>`).
|
|
12
|
+
- **Per-node discussions** — `arch_discuss` starts a fork (inherits completed turns) or lite (fresh from graph/dossier) child; the sidebar opens it; conclusions go to `notes/<id>`.
|
|
13
|
+
- **Exports** — deterministic Mermaid, SVG and Markdown files under `.archmap/export/`.
|
|
14
|
+
- **Built-in Mermaid** — assistant ` ```mermaid ` fences render with a vendored runtime served by the plugin; no CDN and no extra Mermaid plugin.
|
|
15
|
+
- **Bundled skill** — `architecture-map` explains the sync → read → patch → dossier → commit loop.
|
|
16
|
+
- **Remote Linux repositories (developer preview)** — register a repository over SSH without cloning; the panel switches local/remote sources, content reads are consent-gated, and a 60-second fingerprint poll marks affected nodes stale while the graph/dossier stay local.
|
|
17
|
+
|
|
18
|
+
## Tools
|
|
19
|
+
|
|
20
|
+
| Tool | Purpose |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| `arch_hello` | Diagnostic activation check |
|
|
23
|
+
| `arch_graph_get` / `arch_graph_patch` | Read and batch-edit the graph (`apply:false` previews) |
|
|
24
|
+
| `arch_sync` | Full or incremental workspace comparison (`markStale` optional) |
|
|
25
|
+
| `arch_manifest_commit` | Record analyzed files in the manifest |
|
|
26
|
+
| `arch_doc_get` / `arch_doc_put` | Read/write the dossier |
|
|
27
|
+
| `arch_discuss` | Start a node/edge fork or lite discussion |
|
|
28
|
+
| `arch_export` | Write Mermaid/SVG/Markdown exports |
|
|
29
|
+
| `arch_remote_list` / `arch_remote_status` | List remote projects; metadata only, no consent needed |
|
|
30
|
+
| `arch_remote_tree` / `arch_remote_read` / `arch_remote_grep` | Consent-gated read-only remote inspection |
|
|
31
|
+
|
|
32
|
+
## Install and enable
|
|
33
|
+
|
|
34
|
+
Install the bundle in a DSH profile and enable the `architecture-map` row. The right sidebar gets an **Architecture map** tab. `/arch` opens it; the node detail has `Discuss (fork)` / `Lite`. Register a remote with `/arch remote add <id> <host> <path>`, then pick it in the panel source selector.
|
|
35
|
+
|
|
36
|
+
The model can also use the bundled `architecture-map` skill in a new session.
|
|
37
|
+
|
|
38
|
+
## Configuration
|
|
39
|
+
|
|
40
|
+
```yaml
|
|
41
|
+
- id: architecture-map
|
|
42
|
+
name: dsh-architecture-map
|
|
43
|
+
config:
|
|
44
|
+
renderMermaid: auto
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`renderMermaid: auto|on|off` controls the built-in renderer. `auto` disables it when the known conflicting `dsh-mermaid-plus` plugin is enabled; `off` also keeps fences as code blocks and does not load the 5.2 MB runtime.
|
|
48
|
+
|
|
49
|
+
## Data and permissions
|
|
50
|
+
|
|
51
|
+
- Reads/writes local state only under `<workspace>/.archmap/` (plus the browser's local position preference).
|
|
52
|
+
- No telemetry and no external network requests; Mermaid is served from the plugin's own Host route.
|
|
53
|
+
- Graph/dossier writes are bounded and atomic; source files are never edited by `arch_graph_patch` or `arch_doc_put`.
|
|
54
|
+
- Discussion children are prompt-constrained; shell and generic source-write calls are denied at execution (a fork may still display inherited tool schemas).
|
|
55
|
+
- Remote access uses the user's OpenSSH config, is read-only, and never clones or writes the remote repository. Content reads need an explicit session/always grant; remote path escapes and symlinks outside the root are rejected.
|
|
56
|
+
- Mermaid uses `securityLevel: 'strict'`.
|
|
57
|
+
|
|
58
|
+
## Known limitations
|
|
59
|
+
|
|
60
|
+
- The canvas is a hand-written SVG implementation, not React Flow.
|
|
61
|
+
- Node positions are local to the browser; shared positions are not implemented yet.
|
|
62
|
+
- The sidebar follows the **session workspace**; it does not show a graph from an explicit `workspace` argument when the two differ.
|
|
63
|
+
- Fork discussions inherit the parent request prefix, so their tool list can still show schemas that are denied at execution.
|
|
64
|
+
- If the parent agent uses `send_message` to continue a child, DSH posts a native settlement notice (with the child's closing text) in the parent conversation. The initial `arch_discuss` result is caller-only; the child transcript is not copied into the main log.
|
|
65
|
+
- Mermaid layout is Mermaid's default (dagre); a layout selector is not exposed.
|
|
66
|
+
- Remote repositories are a developer preview: auto maintenance does not start from an idle parent session (use `/arch remote update <id>`), and a maintenance run does not clear the local pending counter yet.
|
|
67
|
+
|
|
68
|
+
## Third-party
|
|
69
|
+
|
|
70
|
+
- Mermaid 12.2.0 (MIT) and ELK/elkjs 0.9.3 (EPL-2.0), vendored in `vendor/`.
|
|
71
|
+
- Static-route/renderer approach adapted from `dsh-mermaid-plus` 0.6.2 (MIT).
|
|
72
|
+
- See `THIRD_PARTY_NOTICES.md` and `vendor/*.LICENSE`.
|
|
73
|
+
|
|
74
|
+
## Status
|
|
75
|
+
|
|
76
|
+
0.2.0 developer preview. `npm test` covers graph, memory, stale-hash, export, remote content/SSH, consent, sync, polling, commands and maintenance policy (65 tests); CI runs syntax checks, tests and `npm pack --dry-run`.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# 架构地图
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
给 DeepSeek Harness 的可交互、可寻址架构图。模型把节点、边和锚点写进唯一的 canonical 文件;右侧栏渲染图;每个节点都能开一个继承主对话记忆的隔离讨论。
|
|
6
|
+
|
|
7
|
+
## 功能
|
|
8
|
+
|
|
9
|
+
- **Canonical 图**:`.archmap/graph.json`,带 rev、schema 校验、原子写入和单步备份。
|
|
10
|
+
- **右侧栏画布**:分层 SVG 布局、平移/缩放/Fit、节点拖拽、Reset layout、节点详情。
|
|
11
|
+
- **架构记忆**:manifest、增量 `arch_sync`、代码/格式改动识别、stale 标记和 Markdown dossier(`overview`、`modules/<id>`、`notes/<id>`)。
|
|
12
|
+
- **按节点讨论**:`arch_discuss` 开 fork(继承已完成轮次)或 lite(只靠图和档案);侧栏打开子会话;结论写到 `notes/<id>`。
|
|
13
|
+
- **导出**:确定性的 Mermaid、SVG、Markdown,落在 `.archmap/export/`。
|
|
14
|
+
- **内置 Mermaid**:assistant 消息里的 ` ```mermaid ` 用本插件自带的 runtime 渲染,不访问 CDN,不依赖额外 Mermaid 插件。
|
|
15
|
+
- **随包 skill**:`architecture-map` 指导 sync → 读变更 → 改图 → 档案 → commit 的循环。
|
|
16
|
+
- **远程 Linux 仓库(开发者预览)**:通过 SSH 登记仓库,不 clone;面板可切换本地/远程来源,读内容前要授权;60 秒指纹轮询把受影响节点标 stale,图和档案留在本地。
|
|
17
|
+
|
|
18
|
+
## 工具
|
|
19
|
+
|
|
20
|
+
| 工具 | 用途 |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| `arch_hello` | 诊断插件是否激活 |
|
|
23
|
+
| `arch_graph_get` / `arch_graph_patch` | 读图 / 批量改图(`apply:false` 只预览) |
|
|
24
|
+
| `arch_sync` | 全量或增量对比 workspace(`markStale` 可选) |
|
|
25
|
+
| `arch_manifest_commit` | 记录已分析文件 |
|
|
26
|
+
| `arch_doc_get` / `arch_doc_put` | 读写 dossier |
|
|
27
|
+
| `arch_discuss` | 开节点/边的 fork 或 lite 讨论 |
|
|
28
|
+
| `arch_export` | 导出 Mermaid/SVG/Markdown |
|
|
29
|
+
| `arch_remote_list` / `arch_remote_status` | 列远程项目;只读元数据,不需要授权 |
|
|
30
|
+
| `arch_remote_tree` / `arch_remote_read` / `arch_remote_grep` | 授权后只读查看远程内容 |
|
|
31
|
+
|
|
32
|
+
## 安装与启用
|
|
33
|
+
|
|
34
|
+
把 bundle 装进 DSH profile,启用 `architecture-map` 行。右侧栏会出现 **架构地图** tab。`/arch` 打开面板;节点详情有 `讨论(fork)` / `轻讨论`。用 `/arch remote add <id> <host> <path>` 登记远程,再在面板来源选择器里切换。
|
|
35
|
+
|
|
36
|
+
新会话里模型也会看到随包的 `architecture-map` skill。
|
|
37
|
+
|
|
38
|
+
## 配置
|
|
39
|
+
|
|
40
|
+
```yaml
|
|
41
|
+
- id: architecture-map
|
|
42
|
+
name: dsh-architecture-map
|
|
43
|
+
config:
|
|
44
|
+
renderMermaid: auto
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`renderMermaid: auto|on|off` 控制内置渲染。`auto` 在检测到已知冲突的 `dsh-mermaid-plus` 启用时关闭本插件渲染;`off` 时 fence 只显示代码块,也不加载 5.2 MB runtime。
|
|
48
|
+
|
|
49
|
+
## 数据与权限
|
|
50
|
+
|
|
51
|
+
- 本地状态只读写 `<workspace>/.archmap/`(以及浏览器本地的节点位置偏好)。
|
|
52
|
+
- 无遥测、无外部网络请求;Mermaid 由插件自己的 Host 路由提供。
|
|
53
|
+
- 图和档案写入有上限、原子落盘;`arch_graph_patch` / `arch_doc_put` 不修改源码。
|
|
54
|
+
- 讨论子会话受提示词约束;shell 和通用源码写调用在执行层被拒绝(fork 可能仍显示继承的工具 schema)。
|
|
55
|
+
- 远程访问使用用户自己的 OpenSSH 配置,只读,不 clone、不写远程仓库;读内容需要本次会话/始终允许授权;远程路径逃逸和 root 外符号链接会被拒绝。
|
|
56
|
+
- Mermaid 使用 `securityLevel: 'strict'`。
|
|
57
|
+
|
|
58
|
+
## 已知限制
|
|
59
|
+
|
|
60
|
+
- 画布是手写 SVG,不是 React Flow。
|
|
61
|
+
- 节点位置只存在浏览器本地;共享位置还没做。
|
|
62
|
+
- 右侧栏跟随**会话 workspace**;工具参数里的显式 `workspace` 不同时,面板不会显示那张图。
|
|
63
|
+
- fork 讨论会继承父对话 request prefix,工具列表里可能仍显示执行层已拒绝的 schema。
|
|
64
|
+
- 父 agent 用 `send_message` 继续子会话时,DSH 会在主对话里投递 settlement notice(含子会话 closing text);初次 `arch_discuss` 是 caller-only,子会话 transcript 不会复制进主日志。
|
|
65
|
+
- Mermaid 布局使用默认 dagre;尚未提供布局选择器。
|
|
66
|
+
- 远程仓库是开发者预览:父会话空闲时自动维护不启动(用 `/arch remote update <id>` 手动兜底),维护后本地 pending 计数暂未清零。
|
|
67
|
+
|
|
68
|
+
## 第三方
|
|
69
|
+
|
|
70
|
+
- Mermaid 12.2.0(MIT)与 ELK/elkjs 0.9.3(EPL-2.0),vendored 在 `vendor/`。
|
|
71
|
+
- 静态路由/渲染方案参考 `dsh-mermaid-plus` 0.6.2(MIT)。
|
|
72
|
+
- 详见 `THIRD_PARTY_NOTICES.md` 和 `vendor/*.LICENSE`。
|
|
73
|
+
|
|
74
|
+
## 状态
|
|
75
|
+
|
|
76
|
+
0.2.0 开发者预览。`npm test` 覆盖图、记忆、stale-hash、导出、远程内容/SSH、授权、同步、轮询、命令和维护策略(65 个测试);CI 跑语法检查、测试和 `npm pack --dry-run`。
|
package/docs/preview.svg
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="640" height="300" viewBox="0 0 640 300" role="img" aria-label="Architecture map panel with a graph and a side discussion">
|
|
2
|
+
<rect x="0" y="0" width="640" height="300" rx="18" fill="#111827"/>
|
|
3
|
+
<rect x="18" y="18" width="400" height="264" rx="14" fill="#0b1220" stroke="#334155"/>
|
|
4
|
+
<rect x="34" y="32" width="120" height="12" rx="6" fill="#64748b"/>
|
|
5
|
+
<rect x="34" y="54" width="70" height="16" rx="8" fill="#1e293b"/>
|
|
6
|
+
<rect x="112" y="54" width="70" height="16" rx="8" fill="#1e293b"/>
|
|
7
|
+
<circle cx="350" cy="62" r="5" fill="#22c55e"/>
|
|
8
|
+
|
|
9
|
+
<rect x="48" y="116" width="112" height="52" rx="9" fill="#172554" stroke="#3b82f6"/>
|
|
10
|
+
<rect x="60" y="130" width="58" height="8" rx="4" fill="#93c5fd"/>
|
|
11
|
+
<rect x="60" y="146" width="36" height="6" rx="3" fill="#64748b"/>
|
|
12
|
+
|
|
13
|
+
<rect x="250" y="88" width="112" height="52" rx="9" fill="#111827" stroke="#475569"/>
|
|
14
|
+
<rect x="262" y="102" width="52" height="8" rx="4" fill="#cbd5e1"/>
|
|
15
|
+
<rect x="262" y="118" width="36" height="6" rx="3" fill="#64748b"/>
|
|
16
|
+
|
|
17
|
+
<rect x="250" y="180" width="112" height="52" rx="9" fill="#111827" stroke="#475569"/>
|
|
18
|
+
<rect x="262" y="194" width="60" height="8" rx="4" fill="#cbd5e1"/>
|
|
19
|
+
<rect x="262" y="210" width="36" height="6" rx="3" fill="#64748b"/>
|
|
20
|
+
|
|
21
|
+
<rect x="48" y="210" width="112" height="52" rx="9" fill="#111827" stroke="#475569"/>
|
|
22
|
+
<rect x="60" y="224" width="54" height="8" rx="4" fill="#cbd5e1"/>
|
|
23
|
+
<rect x="60" y="240" width="36" height="6" rx="3" fill="#64748b"/>
|
|
24
|
+
|
|
25
|
+
<path d="M160 142 H250" stroke="#64748b" stroke-width="2" fill="none"/>
|
|
26
|
+
<path d="M244 137 L254 142 L244 147" fill="#64748b"/>
|
|
27
|
+
<path d="M104 168 V210" stroke="#64748b" stroke-width="2" fill="none"/>
|
|
28
|
+
<path d="M99 204 L104 214 L109 204" fill="#64748b"/>
|
|
29
|
+
<path d="M160 236 H250" stroke="#64748b" stroke-width="2" fill="none"/>
|
|
30
|
+
<path d="M244 231 L254 236 L244 241" fill="#64748b"/>
|
|
31
|
+
<path d="M306 140 V180" stroke="#64748b" stroke-width="2" fill="none"/>
|
|
32
|
+
<path d="M301 174 L306 184 L311 174" fill="#64748b"/>
|
|
33
|
+
|
|
34
|
+
<rect x="438" y="18" width="184" height="264" rx="14" fill="#0b1220" stroke="#334155"/>
|
|
35
|
+
<rect x="454" y="34" width="88" height="12" rx="6" fill="#94a3b8"/>
|
|
36
|
+
<rect x="454" y="58" width="152" height="1" fill="#334155"/>
|
|
37
|
+
<rect x="454" y="74" width="96" height="8" rx="4" fill="#64748b"/>
|
|
38
|
+
<rect x="454" y="90" width="132" height="6" rx="3" fill="#475569"/>
|
|
39
|
+
<rect x="454" y="104" width="116" height="6" rx="3" fill="#475569"/>
|
|
40
|
+
<rect x="454" y="130" width="72" height="18" rx="9" fill="#172554" stroke="#3b82f6"/>
|
|
41
|
+
<rect x="534" y="130" width="46" height="18" rx="9" fill="#1e293b"/>
|
|
42
|
+
<rect x="454" y="168" width="152" height="1" fill="#334155"/>
|
|
43
|
+
<rect x="454" y="184" width="102" height="8" rx="4" fill="#64748b"/>
|
|
44
|
+
<rect x="454" y="200" width="140" height="6" rx="3" fill="#475569"/>
|
|
45
|
+
<rect x="454" y="214" width="124" height="6" rx="3" fill="#475569"/>
|
|
46
|
+
<circle cx="464" cy="240" r="5" fill="#22c55e"/>
|
|
47
|
+
<rect x="476" y="236" width="38" height="8" rx="4" fill="#475569"/>
|
|
48
|
+
<circle cx="526" cy="240" r="5" fill="#eab308"/>
|
|
49
|
+
<rect x="538" y="236" width="38" height="8" rx="4" fill="#475569"/>
|
|
50
|
+
</svg>
|
package/icon.svg
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64" role="img" aria-label="Architecture map">
|
|
2
|
+
<rect width="64" height="64" rx="14" fill="#0f1b2d"/>
|
|
3
|
+
<path d="M17 20 L32 32 L47 20 M32 32 L17 46 M32 32 L47 46" fill="none" stroke="#6ea8fe" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" opacity="0.85"/>
|
|
4
|
+
<rect x="10" y="13" width="14" height="11" rx="3" fill="#6ea8fe"/>
|
|
5
|
+
<rect x="40" y="13" width="14" height="11" rx="3" fill="#3f74c9"/>
|
|
6
|
+
<rect x="25" y="27" width="14" height="11" rx="3" fill="#8bbcff"/>
|
|
7
|
+
<rect x="10" y="40" width="14" height="11" rx="3" fill="#3f74c9"/>
|
|
8
|
+
<rect x="40" y="40" width="14" height="11" rx="3" fill="#6ea8fe"/>
|
|
9
|
+
</svg>
|
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { name, inject, apply } from './src/host/plugin.js'
|
package/locale/en.json
ADDED
package/locale/zh.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,70 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-architecture-map",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Architecture map for DeepSeek Harness: a semantic architecture graph with per-node side conversations, incremental architecture memory and read-only remote repositories over SSH.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"dsh",
|
|
9
|
+
"dsh-plugin",
|
|
10
|
+
"deepseek-harness",
|
|
11
|
+
"architecture",
|
|
12
|
+
"diagram",
|
|
13
|
+
"subagent",
|
|
14
|
+
"ssh",
|
|
15
|
+
"remote"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"check": "node --check index.js && node --check client.js && node --check src/host/plugin.js && node --check src/host/graph.js && node --check src/host/memory.js && node --check src/host/export.js && node --check src/host/signature.js && node --check scripts/remote-smoke.mjs",
|
|
19
|
+
"test": "node --test",
|
|
20
|
+
"remote-smoke": "node scripts/remote-smoke.mjs"
|
|
21
|
+
},
|
|
22
|
+
"exports": {
|
|
23
|
+
".": "./index.js",
|
|
24
|
+
"./client": "./client.js",
|
|
25
|
+
"./locale/*.json": "./locale/*.json",
|
|
26
|
+
"./icon": "./icon.svg"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"index.js",
|
|
30
|
+
"client.js",
|
|
31
|
+
"src",
|
|
32
|
+
"skills",
|
|
33
|
+
"vendor",
|
|
34
|
+
"cordis.patch.yml",
|
|
35
|
+
"locale",
|
|
36
|
+
"icon.svg",
|
|
37
|
+
"README.md",
|
|
38
|
+
"README.zh.md",
|
|
39
|
+
"LICENSE",
|
|
40
|
+
"THIRD_PARTY_NOTICES.md",
|
|
41
|
+
"docs/DETAIL.md",
|
|
42
|
+
"docs/DETAIL.zh.md",
|
|
43
|
+
"CHANGELOG.md",
|
|
44
|
+
"docs/preview.svg",
|
|
45
|
+
"CONTRIBUTING.md",
|
|
46
|
+
"CODE_OF_CONDUCT.md"
|
|
47
|
+
],
|
|
48
|
+
"dsh": {
|
|
49
|
+
"bundle": {
|
|
50
|
+
"patch": "./cordis.patch.yml"
|
|
51
|
+
},
|
|
52
|
+
"client": {
|
|
53
|
+
"platform": "web",
|
|
54
|
+
"immediately": true,
|
|
55
|
+
"inject": [
|
|
56
|
+
"@deepseek-ai/dsh-client-locale",
|
|
57
|
+
"@deepseek-ai/dsh-client-ui-conversation",
|
|
58
|
+
"@deepseek-ai/dsh-client-ui-sidebar-right"
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"repository": {
|
|
63
|
+
"type": "git",
|
|
64
|
+
"url": "git+https://github.com/yyf-424/dsh-architecture-map.git"
|
|
65
|
+
},
|
|
66
|
+
"homepage": "https://github.com/yyf-424/dsh-architecture-map#readme",
|
|
67
|
+
"bugs": {
|
|
68
|
+
"url": "https://github.com/yyf-424/dsh-architecture-map/issues"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: architecture-map
|
|
3
|
+
description: Use when the user asks for an architecture map, module/dependency overview, or to discuss a module; also to maintain .archmap/graph.json and its dossier.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Architecture map
|
|
7
|
+
|
|
8
|
+
Maintain one canonical graph at `.archmap/graph.json` plus a dossier under `.archmap/`. The sidebar renders it; each node can open an isolated side conversation. Do not rebuild the graph every turn.
|
|
9
|
+
|
|
10
|
+
## Hard rules
|
|
11
|
+
|
|
12
|
+
1. **Sync before analysis.** Call `arch_sync` first. Use `full:true` only when there is no manifest or the user asks for a full pass; otherwise use incremental sync.
|
|
13
|
+
2. **Read before patch.** Call `arch_graph_get` and pass its `rev` as `baseRev`. Batch changes; use `apply:false` first for non-trivial edits.
|
|
14
|
+
3. **Only read what changed.** The sync result names the changed files and affected nodes. Do not re-read the whole repository for one change.
|
|
15
|
+
4. **Stable ids.** Keep node/edge ids stable; never renumber the graph.
|
|
16
|
+
5. **Anchors are evidence.** Every code node needs at least one `path#symbol` anchor. A conceptual node is allowed only if you say it is conceptual. After a review, refresh stale anchor hashes with `refreshAnchors:true`.
|
|
17
|
+
6. **Write only the map.** Graph/dossier writes go through `arch_graph_patch`, `arch_doc_put` and `arch_manifest_commit`. Do not edit source code as part of mapping.
|
|
18
|
+
7. **Commit after analysis.** `arch_manifest_commit` records files you actually read; never commit files you did not inspect.
|
|
19
|
+
8. **No general memory.** The dossier is only for this graph: overview, modules and node notes. Do not turn it into a conversation-summary store.
|
|
20
|
+
|
|
21
|
+
## Remote workspaces
|
|
22
|
+
|
|
23
|
+
A workspace can be `remote:<id>`: the code is read over SSH from a registered remote root and is not on the local disk.
|
|
24
|
+
|
|
25
|
+
- `arch_remote_list` lists projects; `arch_remote_status` reports vcs, HEAD/dirty or non-git digest, and consent scope without reading files.
|
|
26
|
+
- `arch_remote_tree`, `arch_remote_read` and `arch_remote_grep` are the only way to inspect remote code. The first content access asks the user for permission; if denied, stop and ask them to allow it. Never use local `read`, `grep`, `glob` or `bash` for these paths — they read the local machine.
|
|
27
|
+
- Paths and anchors are remote-root-relative. Graph and dossier writes stay in the local `.archmap/projects/<id>/`; never write remote files.
|
|
28
|
+
- `arch_sync` / `arch_manifest_commit` work on `remote:<id>` in 0.2.0: sync hashes only manifest files and never pulls source locally. Use `/arch remote sync <id>` for an immediate check and `/arch remote update <id>` to start maintenance; auto maintenance may skip an idle parent session.
|
|
29
|
+
|
|
30
|
+
## First pass (bootstrap)
|
|
31
|
+
|
|
32
|
+
1. `arch_sync({ full: true })` to inventory the workspace.
|
|
33
|
+
2. `arch_graph_get` to see the existing graph (possibly empty).
|
|
34
|
+
3. Plan **8–20 responsibility nodes** for a medium project; group large systems by layer/subsystem.
|
|
35
|
+
4. Read representative files: entry points, routes, stores, clients, key services. Skip generated, binary, vendored and ignored files. For a remote workspace use `arch_remote_*` instead of local reads.
|
|
36
|
+
5. Add nodes, then edges, in batches; prefer `apply:false` for the first batch.
|
|
37
|
+
6. Write `overview` and `modules/<id>` with `arch_doc_put`.
|
|
38
|
+
7. Commit analyzed files with `arch_manifest_commit`.
|
|
39
|
+
8. Tell the user which nodes/edges are **conceptual or uncertain**.
|
|
40
|
+
|
|
41
|
+
See `references/bootstrap.md`.
|
|
42
|
+
|
|
43
|
+
## Incremental pass
|
|
44
|
+
|
|
45
|
+
1. `arch_sync` (no `full`); read `changed (code)`, `changed (format/comment-only)`, `deleted`, `affected nodes`.
|
|
46
|
+
2. For real code changes, call `arch_sync` again with `markStale:true`, or patch affected nodes to `status:"stale"`.
|
|
47
|
+
3. Read only changed files and affected nodes.
|
|
48
|
+
4. Update node summary/anchors/edges and the module doc; append a note for a significant finding.
|
|
49
|
+
5. `arch_manifest_commit` the changed files.
|
|
50
|
+
6. Set the node back to `status:"fresh"` only after graph and dossier match the code.
|
|
51
|
+
|
|
52
|
+
Cosmetic changes update the manifest but do not require stale marking. See `references/incremental.md`.
|
|
53
|
+
|
|
54
|
+
## Discussions
|
|
55
|
+
|
|
56
|
+
Use `arch_discuss` for a node/edge:
|
|
57
|
+
|
|
58
|
+
- `fork` — inherits the main conversation's completed turns; use when the decision depends on conversation context.
|
|
59
|
+
- `lite` — starts fresh from the graph/dossier; cheaper; use for narrow code questions.
|
|
60
|
+
|
|
61
|
+
The child stays on its target, prefers `apply:false`, writes conclusions to `notes/<id>`, and does not message the parent. The sidebar `Discuss (fork)` / `Lite` buttons are the same operation. Remote discussions read through `arch_remote_*`; local `read`/`grep`/`glob` are denied for them. See `references/discussion.md`.
|
|
62
|
+
|
|
63
|
+
## Graph quality
|
|
64
|
+
|
|
65
|
+
- **Node**: one independently discussable responsibility, not one file. A file can feed several nodes; one node can span files.
|
|
66
|
+
- **Edge kinds**: `call`, `data`, `dependency`, `next`, `contains`. Avoid "everything talks to the database" noise.
|
|
67
|
+
- **Status**: `fresh` (verified), `stale` (anchor changed; needs review), `proposed` (not applied).
|
|
68
|
+
- **Groups**: layers/subsystems, not every folder.
|
|
69
|
+
|
|
70
|
+
## References
|
|
71
|
+
|
|
72
|
+
- `references/schema.md` — graph/dossier schema, ids, anchors, patch operations and errors.
|
|
73
|
+
- `references/bootstrap.md` — first full analysis and batching.
|
|
74
|
+
- `references/incremental.md` — sync, stale, review and commit loop.
|
|
75
|
+
- `references/discussion.md` — fork/lite, child rules, conclusions and graph edits.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Bootstrap: first architecture pass
|
|
2
|
+
|
|
3
|
+
Goal: produce a useful graph and dossier in one pass, without reading the whole repository or dumping every file.
|
|
4
|
+
|
|
5
|
+
## Deliverables
|
|
6
|
+
|
|
7
|
+
1. A graph with **8–20 nodes** for a medium project (more only when the project is genuinely large; group by layer/subsystem).
|
|
8
|
+
2. At least one anchor per code node, or an explicit "conceptual" note.
|
|
9
|
+
3. An `overview` document and one `modules/<id>` document per node.
|
|
10
|
+
4. A committed manifest for the files actually read.
|
|
11
|
+
5. A short list of uncertain/conceptual edges for the user.
|
|
12
|
+
|
|
13
|
+
## Loop
|
|
14
|
+
|
|
15
|
+
### 1. Inventory
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
arch_sync({ full: true })
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`full:true` ignores the manifest and lists every scannable file. It does **not** write the manifest. Ignore binaries, generated files and vendored directories (the tool already skips common ones).
|
|
22
|
+
|
|
23
|
+
If the workspace has a graph already, call `arch_graph_get` and decide whether this is a fresh build or an extension.
|
|
24
|
+
|
|
25
|
+
### 2. Choose the skeleton
|
|
26
|
+
|
|
27
|
+
Do not start from files. Start from responsibilities:
|
|
28
|
+
|
|
29
|
+
- entry / request dispatch
|
|
30
|
+
- transport or API boundary
|
|
31
|
+
- domain services
|
|
32
|
+
- persistence / stores
|
|
33
|
+
- UI surfaces
|
|
34
|
+
- external integrations
|
|
35
|
+
|
|
36
|
+
Use `groups` for layers/subsystems. Keep ids short and stable (`n1`, `n2`, …); they are references, not display names.
|
|
37
|
+
|
|
38
|
+
### 3. Read selectively
|
|
39
|
+
|
|
40
|
+
Read in this order, stopping when the skeleton is clear:
|
|
41
|
+
|
|
42
|
+
1. entry points and route tables
|
|
43
|
+
2. stores / data models
|
|
44
|
+
3. the modules with the most inbound/outbound edges
|
|
45
|
+
4. README / design docs for intent
|
|
46
|
+
|
|
47
|
+
Do not read every file in a large directory. The goal is a correct skeleton, not exhaustive coverage. Mark uncertain nodes/edges instead of guessing silently.
|
|
48
|
+
|
|
49
|
+
### 4. Add nodes, then edges
|
|
50
|
+
|
|
51
|
+
Use batches of roughly 10–20 operations. For a non-trivial first batch, use `apply:false` and review the diff:
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"workspace": "/abs/project",
|
|
56
|
+
"baseRev": 0,
|
|
57
|
+
"apply": false,
|
|
58
|
+
"ops": [
|
|
59
|
+
{ "op": "add_node", "node": { "id": "n1", "title": "Entry", "kind": "entry", "anchors": [{ "path": "src/index.ts", "symbol": "main" }] } },
|
|
60
|
+
{ "op": "add_node", "node": { "id": "n2", "title": "Store", "kind": "store" } },
|
|
61
|
+
{ "op": "add_edge", "edge": { "id": "e1", "from": "n1", "to": "n2", "label": "writes", "kind": "call" } }
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Then apply with the current `rev`.
|
|
67
|
+
|
|
68
|
+
### 5. Write the dossier
|
|
69
|
+
|
|
70
|
+
Use `arch_doc_put`:
|
|
71
|
+
|
|
72
|
+
- `overview` — purpose, layout, groups, key edges, caveats.
|
|
73
|
+
- `modules/<id>` — anchor, content/responsibility, relations, uncertainty.
|
|
74
|
+
- `notes/<id>` — only when a decision/finding needs a durable note.
|
|
75
|
+
|
|
76
|
+
Keep each document concise; link to anchors rather than pasting whole files.
|
|
77
|
+
|
|
78
|
+
### 6. Commit what you read
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
arch_manifest_commit({ paths: ["src/index.ts", "src/store.ts", ...] })
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Commit only files you actually inspected. Then run incremental `arch_sync` and expect `0 added / 0 changed / 0 deleted`. If not, commit the missing analyzed files or fix the manifest.
|
|
85
|
+
|
|
86
|
+
## Quality checks
|
|
87
|
+
|
|
88
|
+
- Can a reader answer "what are the main responsibilities and how do they flow?" from the graph alone?
|
|
89
|
+
- Does every edge have a direction and a reason, or is it generic noise?
|
|
90
|
+
- Are uncertain areas labeled as uncertain?
|
|
91
|
+
- Is there one node per independently discussable responsibility, not one per file?
|
|
92
|
+
- Did you avoid turning the dossier into a general memory store?
|
|
93
|
+
|
|
94
|
+
## Common mistakes
|
|
95
|
+
|
|
96
|
+
- Starting from a full directory dump and creating 100 nodes.
|
|
97
|
+
- Using one node per file; files are implementation detail, responsibilities are the unit.
|
|
98
|
+
- Adding edges because two modules are "related"; prefer observed calls/data/dependencies.
|
|
99
|
+
- Committing a file you only skimmed.
|
|
100
|
+
- Writing a huge `modules/<id>` with the whole file content instead of a summary + anchors.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Node and edge discussions
|
|
2
|
+
|
|
3
|
+
`arch_discuss` starts a managed child session for one graph target. The child runs in parallel; the parent conversation stays clean.
|
|
4
|
+
|
|
5
|
+
## Choose a mode
|
|
6
|
+
|
|
7
|
+
- **fork** — the child is seeded with the parent's completed turns. Use it when the answer depends on decisions already made in the main conversation. Costs more and has a larger context.
|
|
8
|
+
- **lite** — the child starts fresh with the graph and dossier. Use it for narrow code questions where the graph is enough; it cannot recall main-conversation facts.
|
|
9
|
+
|
|
10
|
+
Targets: `node:<id>` or `edge:<id>`. The child name is `node-<id>` (fork) or `node-<id>-lite` (lite); an existing child with the same name is reused instead of duplicated.
|
|
11
|
+
|
|
12
|
+
## Parent call
|
|
13
|
+
|
|
14
|
+
```json
|
|
15
|
+
{
|
|
16
|
+
"workspace": "/abs/project",
|
|
17
|
+
"target": "node:n3",
|
|
18
|
+
"mode": "fork",
|
|
19
|
+
"question": "What does this node own and what would break if it changed?"
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The tool returns immediately with the child name/id and a sidebar address. Do not wait for the child in the same turn; the user can open it from the subagent catalog, or the sidebar buttons open it directly.
|
|
24
|
+
|
|
25
|
+
The sidebar `Discuss (fork)` / `Lite` buttons call the same Host operation (`/arch discuss ...`) and open the mounted `subagentchat` resource.
|
|
26
|
+
|
|
27
|
+
## Child rules (already in the prompt)
|
|
28
|
+
|
|
29
|
+
- The Host denies shell and generic source-write tools at execution; `arch_graph_patch` / `arch_doc_put` remain available. A fork may still display the inherited tool schemas, so the model should treat bash/write/edit as unavailable and rely on an actual call error.
|
|
30
|
+
|
|
31
|
+
- stay on the target node/edge and its direct edges;
|
|
32
|
+
- read the graph and `modules/<id>` first;
|
|
33
|
+
- do not edit source code;
|
|
34
|
+
- graph edits go through `arch_graph_patch` with the latest `rev`, preferably `apply:false` until the user approves;
|
|
35
|
+
- do not message the parent;
|
|
36
|
+
- write conclusions to `notes/<id>` with `arch_doc_put` (`mode:"append"`);
|
|
37
|
+
- if an anchor looks stale, run `arch_sync` and say so.
|
|
38
|
+
|
|
39
|
+
## Conclusion format
|
|
40
|
+
|
|
41
|
+
1. **Conclusion** — one paragraph.
|
|
42
|
+
2. **Evidence** — anchor paths/symbols and the files inspected.
|
|
43
|
+
3. **Impact** — upstream/downstream nodes and edges.
|
|
44
|
+
4. **Open questions** — only what genuinely needs the user.
|
|
45
|
+
|
|
46
|
+
A dry-run proposal is better than a silent graph write. Example:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
proposed summary: ...
|
|
50
|
+
proposed edge: n3 -> n4 (next)
|
|
51
|
+
apply:false result: validated 2 ops; no write (rev stays 6)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Merging back
|
|
55
|
+
|
|
56
|
+
The child writes notes and may propose patches; the parent (or the user) decides whether to apply. Never let two discussions apply conflicting patches blindly:
|
|
57
|
+
|
|
58
|
+
- read the current `rev` before applying;
|
|
59
|
+
- apply one batch at a time;
|
|
60
|
+
- on `STALE_REV`, re-read and rebase;
|
|
61
|
+
- after a review, set affected nodes to `fresh` and commit analyzed files.
|
|
62
|
+
|
|
63
|
+
## Parent-visible settlement notices
|
|
64
|
+
|
|
65
|
+
The initial `arch_discuss` activation is caller-only, so its full transcript does not enter the parent log. However, if the **parent agent** later uses `send_message` to continue a child, DSH posts a native settlement notice (including the child's closing text) in the parent conversation. That is runtime behavior, not a transcript copy. For narrative follow-ups, the user should chat in the child's sidebar; the parent should not use `send_message` unless a notice is acceptable.
|
|
66
|
+
|
|
67
|
+
## Notes, not chat logs
|
|
68
|
+
|
|
69
|
+
`notes/<id>` is for durable decisions/findings, not a transcript. Append a short conclusion with anchor evidence. Do not copy the whole child conversation into the dossier.
|
|
70
|
+
|
|
71
|
+
The dossier is architecture memory, **not** a general conversation-memory store.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Incremental sync and stale review
|
|
2
|
+
|
|
3
|
+
The manifest records what has been analyzed. Incremental sync is the normal path; a full sync is only for the first pass or an explicit rebuild.
|
|
4
|
+
|
|
5
|
+
## Read the sync result
|
|
6
|
+
|
|
7
|
+
`arch_sync` (no `full`) reports:
|
|
8
|
+
|
|
9
|
+
- `added` — new files; no previous manifest entry.
|
|
10
|
+
- `changed (code)` — content signature changed; may invalidate nodes/edges.
|
|
11
|
+
- `changed (format/comment-only)` — hash changed but normalized code signature is identical; usually no graph impact.
|
|
12
|
+
- `deleted` — files in the manifest that are gone.
|
|
13
|
+
- `affected nodes` — nodes whose anchors point at added/changed-code/deleted files.
|
|
14
|
+
- `markStale` (optional) — `true` writes `status:"stale"` to affected nodes and increments the graph rev.
|
|
15
|
+
|
|
16
|
+
`full:true` lists every file as added and ignores `markStale`; never use it for an incremental review.
|
|
17
|
+
|
|
18
|
+
## Review loop
|
|
19
|
+
|
|
20
|
+
1. **Sync**
|
|
21
|
+
```
|
|
22
|
+
arch_sync({ workspace })
|
|
23
|
+
```
|
|
24
|
+
2. **Mark affected nodes stale** if you are about to review them:
|
|
25
|
+
```
|
|
26
|
+
arch_sync({ workspace, markStale: true })
|
|
27
|
+
```
|
|
28
|
+
This writes the graph; skip it if you only want a report.
|
|
29
|
+
3. **Read only the changed files** and the affected nodes. Do not re-read the repository.
|
|
30
|
+
4. **Update the graph** with the current `rev`:
|
|
31
|
+
- refresh summary/anchors/edges;
|
|
32
|
+
- remove edges that no longer exist;
|
|
33
|
+
- set `status:"stale"` while reviewing, `status:"fresh"` only when done.
|
|
34
|
+
Use `apply:false` for non-trivial edits.
|
|
35
|
+
5. **Update the dossier** with `arch_doc_put` (`modules/<id>`, append to `notes/<id>` for a significant finding).
|
|
36
|
+
6. **Commit** the files you actually read:
|
|
37
|
+
```
|
|
38
|
+
arch_manifest_commit({ workspace, paths: [...] })
|
|
39
|
+
```
|
|
40
|
+
7. **Re-sync** and expect 0/0/0. Do not mark fresh while the dossier or graph is still stale.
|
|
41
|
+
|
|
42
|
+
## Cosmetic changes
|
|
43
|
+
|
|
44
|
+
If the only change is comment/whitespace, the file is reported as `format/comment-only`:
|
|
45
|
+
|
|
46
|
+
- it does not affect nodes;
|
|
47
|
+
- `markStale:true` does not mark anything;
|
|
48
|
+
- commit the file if you reviewed it, to update the manifest signature;
|
|
49
|
+
- do not rewrite the graph for cosmetics.
|
|
50
|
+
|
|
51
|
+
The normalization is heuristic (comments/whitespace for common code extensions). If a string literal contains comment markers, review the actual diff before deciding.
|
|
52
|
+
|
|
53
|
+
## Deleted and renamed files
|
|
54
|
+
|
|
55
|
+
- **Deleted**: remove or update the affected node; remove edges that point at it; commit the manifest removal by committing the path (missing files are removed from the manifest).
|
|
56
|
+
- **Renamed**: a rename is usually delete + add. Move the anchor to the new path and keep the node id if the responsibility is unchanged; otherwise add a new node and remove the old one.
|
|
57
|
+
|
|
58
|
+
## Stale status
|
|
59
|
+
|
|
60
|
+
- `fresh` — the graph and dossier match the code you verified.
|
|
61
|
+
- `stale` — an anchored file changed; the node may be outdated.
|
|
62
|
+
- `proposed` — a change that is not applied yet.
|
|
63
|
+
|
|
64
|
+
`markStale:true` only writes code-affected nodes. A node can be stale without a sync (for example, a review found a mismatch); patch it explicitly.
|
|
65
|
+
|
|
66
|
+
Each anchor may store the normalized content signature in `hash`. Sync also reports a node when its anchor hash differs from the current file, even if the manifest has no pending delta. After reviewing, refresh the hashes with:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{ "refreshAnchors": true, "baseRev": 6, "ops": [{ "op": "update_node", "id": "n3", "patch": { "status": "fresh" } }] }
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Without `refreshAnchors`, a status-only patch keeps the old hash and the node stays stale.
|
|
73
|
+
|
|
74
|
+
## Common mistakes
|
|
75
|
+
|
|
76
|
+
- Running `full:true` on every turn and treating added files as changes.
|
|
77
|
+
- Committing a file that was not read.
|
|
78
|
+
- Setting `fresh` before updating the module doc.
|
|
79
|
+
- Leaving a deleted file's node and edges in the graph.
|
|
80
|
+
- Re-reading the whole repo after a one-line change.
|