cladogram 0.5.5-beta.4 → 0.5.5-beta.5

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/docs/release.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # 版本更新说明
2
2
 
3
+ ## 0.5.5-beta.5 · 单色透明毛玻璃 UI、PC/移动端适配与统一语义 Tag 锚点(灰度版)
4
+
5
+ - **克制单色透明毛玻璃视觉与 AI 体感柔光**:移除卡片、决策卡与插件弹窗上的四周边彩框与不透明底色,升级为浅/深双色统一透明毛玻璃;仅在 AI 活跃处理或生成时,于卡片 / 灵感面板底部中央呈现延伸至 ≥80% 宽度的渐隐羽化呼吸柔光(普通点击与静止卡片零打扰)。
6
+ - **PC / 移动端通用响应式布局与触控手势**:完整保留桌面端四角悬浮控件,小屏(`≤ 680px`)自动适配安全区(紧凑顶栏、底栏防重叠截断、灵感对话/文档目录/插件管理自动切换为底部抽屉 Bottom Sheet 与 44px 触控热区),画布原生支持双指捏合缩放与单指平滑拖拽。
7
+ - **统一语义 Tag 锚点(卡片 + Tag 二元连线模型)**:支持 6 色语义 Tag(有字低饱和胶囊 `[新增]{#id .green}` 与无字 `5.5px` 极简纯色圆点 `[]{#id .amber}`,无冗余外圈,视觉自动归左),同步支持代码块行尾注释 Tag(`// {#id .blue}` 视觉自动提取至左侧边槽)与 Mermaid 注释 Tag(`%% {#id .green}`);同文档 `[文案](#id)` 与跨文档 `[文案](other.md#id)` 统一连线,解析器新增 `MD_TAG_DUPLICATE_ID` 唯一性校验并兼容既有 `clado:code:` / `clado:to:` 语法与模板五色标记。
8
+
3
9
  ## 0.5.5-beta.4 · 轻量插件市场底座、`clado plugin` CLI 与权限审计(灰度版)
4
10
 
5
11
  - 新增 `clado plugin <list|create|install|remove|search>` 完整命令行插件管理:支持一键生成可运行的 UI 能力插件(`--kind ui`)与 ACP 外包执行器插件(`--kind executor`)脚手架、本地安全打包安装与卸载。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cladogram",
3
- "version": "0.5.5-beta.4",
3
+ "version": "0.5.5-beta.5",
4
4
  "description": "MDC 三视图工作区与 MCP 文档服务:模板、节点、链接、批量操作和单文件交付",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -24,41 +24,44 @@
24
24
  灵感
25
25
  </button>
26
26
  <section id="clado-agent-panel" class="clado-ui-glass clado-ui-glass-panel clado-agent-panel" aria-labelledby="clado-agent-title" hidden>
27
- <header>
28
- <div class="clado-agent-heading"><h2 id="clado-agent-title">灵感</h2><small class="clado-agent-provider"></small></div>
29
- <div class="clado-agent-header-actions">
30
- <button type="button" class="clado-ui-button clado-agent-follow" aria-pressed="${initialFollowAi ? 'true' : 'false'}" title="跟随 AI 视角:AI 定位或修改卡片时平滑平移镜头">跟随</button>
31
- <button type="button" class="clado-ui-button clado-agent-history" aria-expanded="false" title="切换历史会话">历史</button>
32
- <button type="button" class="clado-ui-button clado-agent-new">新对话</button>
33
- <button type="button" class="clado-ui-button clado-agent-close" aria-label="关闭 灵感 对话">×</button>
27
+ <span class="clado-ai-aura" aria-hidden="true"></span>
28
+ <div class="clado-agent-panel-body">
29
+ <header>
30
+ <div class="clado-agent-heading"><h2 id="clado-agent-title">灵感</h2><small class="clado-agent-provider"></small></div>
31
+ <div class="clado-agent-header-actions">
32
+ <button type="button" class="clado-ui-button clado-agent-follow" aria-pressed="${initialFollowAi ? 'true' : 'false'}" title="跟随 AI 视角:AI 定位或修改卡片时平滑平移镜头">跟随</button>
33
+ <button type="button" class="clado-ui-button clado-agent-history" aria-expanded="false" title="切换历史会话">历史</button>
34
+ <button type="button" class="clado-ui-button clado-agent-new">新对话</button>
35
+ <button type="button" class="clado-ui-button clado-agent-close" aria-label="关闭 灵感 对话">×</button>
36
+ </div>
37
+ </header>
38
+ <div class="clado-agent-sessions" hidden></div>
39
+ <div class="clado-agent-modes" role="group" aria-label="工作模式">
40
+ <button type="button" class="clado-ui-button clado-agent-chip" data-workflow="design" aria-pressed="true">架构设计</button>
41
+ <button type="button" class="clado-ui-button clado-agent-chip" data-workflow="qa" aria-pressed="false">测试用例</button>
42
+ <button type="button" class="clado-ui-button clado-agent-chip" data-workflow="audit" aria-pressed="false">Diff 验收</button>
43
+ <button type="button" class="clado-ui-button clado-agent-chip" data-workflow="dispatch" aria-pressed="false">派发开发</button>
34
44
  </div>
35
- </header>
36
- <div class="clado-agent-sessions" hidden></div>
37
- <div class="clado-agent-modes" role="group" aria-label="工作模式">
38
- <button type="button" class="clado-ui-button clado-agent-chip" data-workflow="design" aria-pressed="true">架构设计</button>
39
- <button type="button" class="clado-ui-button clado-agent-chip" data-workflow="qa" aria-pressed="false">测试用例</button>
40
- <button type="button" class="clado-ui-button clado-agent-chip" data-workflow="audit" aria-pressed="false">Diff 验收</button>
41
- <button type="button" class="clado-ui-button clado-agent-chip" data-workflow="dispatch" aria-pressed="false">派发开发</button>
42
- </div>
43
- <div class="clado-agent-persona-bar">
44
- <label for="clado-agent-persona">人设</label>
45
- <select id="clado-agent-persona" class="clado-agent-select">
46
- <option value="architect">研发架构师</option>
47
- <option value="qa">QA 测试专家</option>
48
- <option value="auditor">验收审计官</option>
49
- </select>
50
- </div>
51
- <div class="clado-agent-executor-bar" hidden>
52
- <label for="clado-agent-executor">执行器</label>
53
- <select id="clado-agent-executor" class="clado-agent-select"></select>
45
+ <div class="clado-agent-persona-bar">
46
+ <label for="clado-agent-persona">人设</label>
47
+ <select id="clado-agent-persona" class="clado-agent-select">
48
+ <option value="architect">研发架构师</option>
49
+ <option value="qa">QA 测试专家</option>
50
+ <option value="auditor">验收审计官</option>
51
+ </select>
52
+ </div>
53
+ <div class="clado-agent-executor-bar" hidden>
54
+ <label for="clado-agent-executor">执行器</label>
55
+ <select id="clado-agent-executor" class="clado-agent-select"></select>
56
+ </div>
57
+ <div class="clado-agent-log" role="log" aria-label="对话消息" aria-live="off"></div>
58
+ <p class="clado-agent-status" role="status" hidden></p>
59
+ <form>
60
+ <textarea aria-label="给 灵感 的消息" placeholder="给 灵感 发一条消息…" rows="2" maxlength="12000"></textarea>
61
+ <button class="clado-ui-button clado-agent-stop" type="button" hidden>停止</button>
62
+ <button class="clado-ui-button clado-ui-button-primary clado-agent-send" type="submit" disabled>发送</button>
63
+ </form>
54
64
  </div>
55
- <div class="clado-agent-log" role="log" aria-label="对话消息" aria-live="off"></div>
56
- <p class="clado-agent-status" role="status" hidden></p>
57
- <form>
58
- <textarea aria-label="给 灵感 的消息" placeholder="给 灵感 发一条消息…" rows="2" maxlength="12000"></textarea>
59
- <button class="clado-ui-button clado-agent-stop" type="button" hidden>停止</button>
60
- <button class="clado-ui-button clado-ui-button-primary clado-agent-send" type="submit" disabled>发送</button>
61
- </form>
62
65
  </section>`;
63
66
  host.mount('bottom-right', root, 'clado.agent');
64
67
 
@@ -95,6 +98,7 @@
95
98
  });
96
99
  const canSubmit = () => !running && (workflow === 'dispatch' || workflow === 'audit' || !!input.value.trim());
97
100
  const syncActions = () => {
101
+ panel.classList.toggle('clado-ai-working', running);
98
102
  send.disabled = !canSubmit();
99
103
  send.textContent = workflow === 'dispatch' ? '派发' : '发送';
100
104
  stop.hidden = !running;
@@ -27,7 +27,58 @@
27
27
  min-height: 240px;
28
28
  display: flex;
29
29
  flex-direction: column;
30
+ overflow: visible;
31
+ }
32
+ .clado-agent-panel-body {
33
+ display: flex;
34
+ flex-direction: column;
35
+ flex: 1;
36
+ min-height: 0;
30
37
  overflow: hidden;
38
+ border-radius: inherit;
39
+ }
40
+ @keyframes clado-agent-aura-breathe {
41
+ 0%, 100% { opacity: .64; transform: translateX(-50%) scaleX(.96) scaleY(.86); }
42
+ 50% { opacity: 1; transform: translateX(-50%) scaleX(1.03) scaleY(1.18); }
43
+ }
44
+ @keyframes clado-agent-aura-drift {
45
+ 0%, 100% { filter: blur(12px) hue-rotate(-8deg); }
46
+ 50% { filter: blur(14px) hue-rotate(12deg); }
47
+ }
48
+ .clado-ai-aura {
49
+ display: none;
50
+ position: absolute;
51
+ inset: 0;
52
+ pointer-events: none;
53
+ z-index: -1;
54
+ }
55
+ .clado-agent-panel.clado-ai-working > .clado-ai-aura { display: block; }
56
+ .clado-agent-panel.clado-ai-working > .clado-ai-aura::before {
57
+ content: "";
58
+ position: absolute;
59
+ left: 50%;
60
+ bottom: -.5px;
61
+ width: 86%;
62
+ height: 1px;
63
+ transform: translateX(-50%);
64
+ background: linear-gradient(90deg, transparent 0%, rgba(56,189,248,.22) 10%, rgba(56,189,248,.52) 28%, rgba(129,140,248,.66) 50%, rgba(232,121,249,.44) 72%, rgba(244,114,182,.18) 90%, transparent 100%);
65
+ }
66
+ .clado-agent-panel.clado-ai-working > .clado-ai-aura::after {
67
+ content: "";
68
+ position: absolute;
69
+ left: 50%;
70
+ top: calc(100% - 2px);
71
+ width: 96%;
72
+ height: 46px;
73
+ transform-origin: 50% 0%;
74
+ transform: translateX(-50%);
75
+ background:
76
+ radial-gradient(ellipse 36% 44% at 30% 6%, rgba(56,189,248,.34) 0%, rgba(56,189,248,.10) 48%, transparent 76%),
77
+ radial-gradient(ellipse 34% 52% at 50% 4%, rgba(139,92,246,.34) 0%, rgba(139,92,246,.10) 46%, transparent 74%),
78
+ radial-gradient(ellipse 34% 42% at 70% 7%, rgba(244,114,182,.26) 0%, rgba(244,114,182,.08) 44%, transparent 72%);
79
+ mask-image: linear-gradient(90deg, transparent 0%, rgba(0,0,0,.42) 12%, #000 32%, #000 68%, rgba(0,0,0,.42) 88%, transparent 100%);
80
+ -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0,0,0,.42) 12%, #000 32%, #000 68%, rgba(0,0,0,.42) 88%, transparent 100%);
81
+ animation: clado-agent-aura-breathe 2.9s ease-in-out infinite, clado-agent-aura-drift 5.5s ease-in-out infinite;
31
82
  }
32
83
  .clado-agent-panel header {
33
84
  display: flex;
@@ -119,9 +170,12 @@
119
170
  color: var(--clado-ui-muted);
120
171
  }
121
172
  .clado-agent-session-open small.waiting {
122
- color: #d97706;
173
+ color: #b45309;
123
174
  font-weight: 600;
124
175
  }
176
+ [data-theme="dark"] .clado-agent-session-open small.waiting {
177
+ color: #fbbf24;
178
+ }
125
179
  .clado-agent-session-del {
126
180
  border: 0;
127
181
  background: transparent;
@@ -233,13 +287,13 @@
233
287
  margin-top: 8px;
234
288
  padding: 8px 10px;
235
289
  border-radius: 10px;
236
- border: 1px solid color-mix(in srgb, var(--clado-ui-accent) 26%, var(--clado-ui-edge));
237
- background: color-mix(in srgb, var(--clado-ui-accent) 6%, var(--clado-ui-well));
290
+ border: 1px solid var(--clado-ui-edge);
291
+ background: color-mix(in srgb, var(--clado-ui-well) 65%, transparent);
238
292
  }
239
293
  .clado-agent-changes-title {
240
294
  font-size: 11px;
241
295
  font-weight: 600;
242
- color: var(--clado-ui-accent);
296
+ color: var(--clado-ui-muted);
243
297
  margin-bottom: 5px;
244
298
  }
245
299
  .clado-agent-changes-list {
@@ -266,37 +320,48 @@
266
320
  background: var(--clado-ui-active);
267
321
  }
268
322
  .clado-agent-change-item .dot {
269
- width: 6px;
270
- height: 6px;
323
+ width: 5.5px;
324
+ height: 5.5px;
271
325
  border-radius: 50%;
272
- background: var(--clado-ui-accent);
326
+ background: #10b981;
273
327
  flex: none;
274
328
  }
275
329
  .clado-agent-question {
276
330
  margin-top: 8px;
277
331
  padding: 10px 11px;
278
332
  border-radius: 11px;
279
- border: 1px solid rgb(217 119 6 / .42);
280
- background: rgb(217 119 6 / .06);
333
+ border: 1px solid var(--clado-ui-edge);
334
+ background: color-mix(in srgb, var(--clado-ui-well) 65%, transparent);
281
335
  display: flex;
282
336
  flex-direction: column;
283
337
  gap: 8px;
284
338
  }
285
339
  .clado-agent-question.answered {
286
340
  border-color: var(--clado-ui-edge);
287
- background: color-mix(in srgb, var(--clado-ui-well) 70%, transparent);
341
+ background: color-mix(in srgb, var(--clado-ui-well) 45%, transparent);
288
342
  }
289
343
  .clado-agent-question-badge {
344
+ display: inline-flex;
345
+ align-items: center;
346
+ gap: 6px;
290
347
  font-size: 11px;
291
- font-weight: 650;
292
- color: #b45309;
348
+ font-weight: 620;
349
+ color: var(--clado-ui-text);
293
350
  }
294
- [data-theme="dark"] .clado-agent-question-badge {
295
- color: #fbbf24;
351
+ .clado-agent-question-badge::before {
352
+ content: "";
353
+ width: 6px;
354
+ height: 6px;
355
+ border-radius: 50%;
356
+ background: #f59e0b;
357
+ flex: none;
296
358
  }
297
359
  .clado-agent-question.answered .clado-agent-question-badge {
298
360
  color: var(--clado-ui-muted);
299
361
  }
362
+ .clado-agent-question.answered .clado-agent-question-badge::before {
363
+ background: var(--clado-ui-muted);
364
+ }
300
365
  .clado-agent-question-text {
301
366
  font-size: 12.5px;
302
367
  line-height: 1.5;
@@ -311,7 +376,7 @@
311
376
  .clado-agent-option-btn {
312
377
  border: 1px solid var(--clado-ui-edge);
313
378
  border-radius: 9px;
314
- background: var(--clado-ui-well);
379
+ background: color-mix(in srgb, var(--clado-ui-well) 70%, transparent);
315
380
  color: var(--clado-ui-text);
316
381
  padding: 7px 10px;
317
382
  text-align: left;
@@ -320,11 +385,10 @@
320
385
  display: flex;
321
386
  flex-direction: column;
322
387
  gap: 2px;
323
- transition: border-color 140ms ease, background 140ms ease;
388
+ transition: background 140ms ease;
324
389
  }
325
390
  .clado-agent-option-btn:hover:not(:disabled) {
326
- border-color: #d97706;
327
- background: rgb(217 119 6 / .08);
391
+ background: var(--clado-ui-active);
328
392
  }
329
393
  .clado-agent-option-btn:disabled {
330
394
  opacity: .55;
@@ -391,6 +455,50 @@
391
455
  font: inherit;
392
456
  }
393
457
  .clado-agent-panel textarea:focus-visible { outline: 2px solid var(--clado-ui-accent); outline-offset: 1px; }
394
- @media (max-width: 460px) {
395
- .clado-agent-panel { width: min(410px, calc(100vw - 20px)); }
458
+ @media (max-width: 680px) {
459
+ .clado-agent-launch { height: 42px; padding-inline: 12px; border-radius: 15px; }
460
+ .clado-agent-panel {
461
+ position: fixed;
462
+ left: 0;
463
+ right: 0;
464
+ bottom: 0;
465
+ width: 100vw;
466
+ max-width: 100vw;
467
+ height: min(78dvh, 620px);
468
+ max-height: 78dvh;
469
+ border-radius: 22px 22px 0 0;
470
+ padding-bottom: env(safe-area-inset-bottom);
471
+ z-index: 30;
472
+ }
473
+ .clado-agent-panel-body::before {
474
+ content: "";
475
+ display: block;
476
+ width: 36px;
477
+ height: 4px;
478
+ border-radius: 99px;
479
+ background: var(--clado-ui-edge);
480
+ margin: 8px auto 2px;
481
+ flex: none;
482
+ }
483
+ /* 移动端 Bottom Sheet 贴底,AI 处理柔光自动移至抽屉顶边中央 ≥80% 处,永不被屏幕底部裁切 */
484
+ .clado-agent-panel.clado-ai-working > .clado-ai-aura::before {
485
+ bottom: auto;
486
+ top: -.5px;
487
+ }
488
+ .clado-agent-panel.clado-ai-working > .clado-ai-aura::after {
489
+ top: auto;
490
+ bottom: calc(100% - 2px);
491
+ transform-origin: 50% 100%;
492
+ background:
493
+ radial-gradient(ellipse 36% 44% at 30% 94%, rgba(56,189,248,.34) 0%, rgba(56,189,248,.10) 48%, transparent 76%),
494
+ radial-gradient(ellipse 34% 52% at 50% 96%, rgba(139,92,246,.34) 0%, rgba(139,92,246,.10) 46%, transparent 74%),
495
+ radial-gradient(ellipse 34% 42% at 70% 93%, rgba(244,114,182,.26) 0%, rgba(244,114,182,.08) 44%, transparent 72%);
496
+ }
497
+ .clado-agent-modes { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
498
+ .clado-agent-modes::-webkit-scrollbar { display: none; }
499
+ .clado-agent-chip { min-height: 32px; padding: 4px 12px; flex: none; }
500
+ .clado-agent-panel textarea { font-size: 16px; min-height: 44px; }
501
+ .clado-agent-question-custom input { font-size: 16px; min-height: 40px; }
502
+ .clado-agent-send, .clado-agent-stop { min-height: 44px; padding-inline: 16px; }
503
+ .clado-agent-option-btn { min-height: 44px; padding: 10px 12px; }
396
504
  }
@@ -84,19 +84,19 @@
84
84
  :is(.clado-plugin-manager,.clado-plugin-editor) h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
85
85
  .clado-plugin-manager-actions { display: flex; align-items: center; gap: 6px; }
86
86
  .clado-plugin-manager .clado-plugin-install-trigger {
87
- background: #242424;
88
- border-color: #242424;
89
- color: #fff;
87
+ background: var(--clado-ui-accent);
88
+ border-color: var(--clado-ui-accent);
89
+ color: var(--clado-ui-solid);
90
90
  }
91
- .clado-plugin-manager .clado-plugin-install-trigger:hover { background: #444; }
91
+ .clado-plugin-manager .clado-plugin-install-trigger:hover { opacity: .88; }
92
92
  .clado-plugin-install {
93
93
  margin-top: 12px;
94
94
  padding: 10px 12px;
95
- border: 1px solid #dedede;
95
+ border: 1px solid var(--clado-ui-edge);
96
96
  border-radius: 11px;
97
- background: #f7f7f7;
97
+ background: var(--clado-ui-well);
98
98
  }
99
- .clado-plugin-install p { margin: 0 0 8px; overflow-wrap: anywhere; color: #454545; }
99
+ .clado-plugin-install p { margin: 0 0 8px; overflow-wrap: anywhere; color: var(--clado-ui-muted); }
100
100
  .clado-plugin-install .clado-plugin-manager-actions { justify-content: end; }
101
101
  .clado-plugin-manager-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
102
102
  .clado-plugin-manager-list article {
@@ -107,13 +107,13 @@
107
107
  gap: 6px;
108
108
  min-height: 116px;
109
109
  padding: 12px;
110
- border: 1px solid #e4e4e4;
110
+ border: 1px solid var(--clado-ui-edge);
111
111
  border-radius: calc(var(--clado-ui-radius) - 4px);
112
- background: linear-gradient(150deg, #fbfbfb, #f2f2f2);
112
+ background: color-mix(in srgb, var(--clado-ui-well) 70%, transparent);
113
113
  }
114
- .clado-plugin-manager-list article:has(input:not(:checked)) { background: #fff; }
115
- .clado-plugin-card-icon { grid-area: 1 / 1; display: grid; place-items: center; width: 31px; height: 31px; border: 1px solid #e0e0e0; border-radius: 9px; background: #fff; }
116
- .clado-plugin-card-icon svg { width: 17px; height: 17px; fill: none; stroke: #343434; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
114
+ .clado-plugin-manager-list article:has(input:not(:checked)) { background: transparent; }
115
+ .clado-plugin-card-icon { grid-area: 1 / 1; display: grid; place-items: center; width: 31px; height: 31px; border: 1px solid var(--clado-ui-edge); border-radius: 9px; background: color-mix(in srgb, var(--clado-ui-solid) 75%, transparent); }
116
+ .clado-plugin-card-icon svg { width: 17px; height: 17px; fill: none; stroke: var(--clado-ui-text); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
117
117
  .clado-plugin-manager-list strong {
118
118
  grid-area: 2 / 1 / auto / -1;
119
119
  align-self: center;
@@ -140,7 +140,7 @@
140
140
  width: 13px;
141
141
  height: 13px;
142
142
  border-radius: 50%;
143
- background: white;
143
+ background: var(--clado-ui-solid);
144
144
  }
145
145
  .clado-plugin-manager-list input:checked { background: var(--clado-ui-accent); }
146
146
  .clado-plugin-manager-list input:checked::before { transform: translateX(14px); }
@@ -152,11 +152,26 @@
152
152
  box-sizing: border-box;
153
153
  width: 100%;
154
154
  padding: 10px;
155
- border: 1px solid #dfdfdf;
155
+ border: 1px solid var(--clado-ui-edge);
156
156
  border-radius: 10px;
157
- background: #f8f8f8;
157
+ background: var(--clado-ui-well);
158
+ color: var(--clado-ui-text);
158
159
  font: 13px/1.5 ui-monospace, monospace;
159
160
  resize: vertical;
160
161
  }
161
162
  .clado-plugin-editor details { padding: 10px 0; color: var(--clado-ui-muted); }
162
163
  .clado-plugin-editor pre { max-height: 180px; overflow: auto; }
164
+ @media (max-width: 680px) {
165
+ .clado-brand { width: 42px; height: 42px; padding: 6px; justify-content: center; }
166
+ .clado-brand strong { display: none; }
167
+ .clado-plugin-manager, .clado-plugin-editor {
168
+ inset: auto 0 0 0;
169
+ margin: 0;
170
+ width: 100vw;
171
+ max-width: 100vw;
172
+ max-height: 82dvh;
173
+ border-radius: 22px 22px 0 0;
174
+ padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
175
+ }
176
+ .clado-plugin-manager-list { grid-template-columns: minmax(0, 1fr); }
177
+ }
@@ -57,3 +57,40 @@
57
57
  .workspace-button small{flex:none;font-size:10px;color:var(--muted)}
58
58
  .workspace-open-tab{flex:none;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;font-size:11px;text-decoration:none;color:var(--muted)}
59
59
  .workspace-open-tab:hover{color:var(--ink)}
60
+ @media (max-width: 680px) {
61
+ .directory-toggle { max-width: calc(100vw - 116px); height: 42px; padding: 7px 11px; }
62
+ #currentWorkspaceName { max-width: 72px; }
63
+ #directory {
64
+ position: fixed;
65
+ left: 0;
66
+ right: 0;
67
+ bottom: 0;
68
+ width: 100vw;
69
+ max-width: 100vw;
70
+ border-radius: 22px 22px 0 0;
71
+ z-index: 29;
72
+ }
73
+ .directory-scroll {
74
+ max-height: 74dvh;
75
+ padding: 18px 14px calc(16px + env(safe-area-inset-bottom));
76
+ }
77
+ .directory-scroll::before {
78
+ content: "";
79
+ display: block;
80
+ width: 36px;
81
+ height: 4px;
82
+ border-radius: 99px;
83
+ background: var(--clado-ui-edge);
84
+ margin: -6px auto 12px;
85
+ }
86
+ .document-button { min-height: 44px; padding: 10px 12px; }
87
+ .directory-search input { font-size: 16px; min-height: 40px; }
88
+ .clado-directory-plugin dialog {
89
+ inset: auto 0 0 0;
90
+ margin: 0;
91
+ width: 100vw;
92
+ max-width: 100vw;
93
+ max-height: 82dvh;
94
+ border-radius: 22px 22px 0 0;
95
+ }
96
+ }
@@ -61,6 +61,6 @@
61
61
  [data-theme="dark"] .clado-view-status .clado-issue-count { color: #efb860; }
62
62
  [data-theme="dark"] .clado-view-status .has-errors { color: #ffacb6; }
63
63
 
64
- @media (max-width: 460px) {
65
- .clado-view-modes .clado-ui-button { padding-inline: 9px; }
64
+ @media (max-width: 680px) {
65
+ .clado-view-modes .clado-ui-button { padding-inline: 11px; min-height: 36px; font-size: 12.5px; }
66
66
  }
@@ -21,7 +21,7 @@ const MODE_PROMPTS = {
21
21
  '当前工作模式:【研发设计与代码架构】',
22
22
  '1. 涉及存量代码时,先调用 probe_tree / probe_search / probe_read 核对真实类名、方法名与边界,绝不编造。',
23
23
  '2. 先用 clado_templates 读取对应模板(如 call-chain / data-design / business-flow)再创建或修改 .md 画布。',
24
- '3. 同画布跨卡连线必须从具体内容行出发(sourcePoint 或行内 anchor 链接),避免卡片末尾裸卡片连卡片。',
24
+ '3. 同画布跨卡连线支持「卡片 + Tag」二元目标:可在目标行打唯一语义 Tag(有字胶囊 `[新增]{#id .green}`、无字小圆点 `[]{#id .amber}`、代码行尾 `// {#id .blue}`、Mermaid `%% {#node .green}`),再以 `[文案](#id)` 精准连线,也可兼容 `clado:code:` / `clado:to:`;避免卡片末尾裸卡片连卡片。',
25
25
  '4. 遇到需求歧义或方案二选一时,优先调用 ask_user 给出清晰选项让观察者拍板,不要替用户擅自猜测。',
26
26
  '5. 每次修改后核对 diagnostics,确保 0 error 再给 3–5 行精炼汇报。',
27
27
  ].join('\n'),
package/src/core/parse.js CHANGED
@@ -7,6 +7,7 @@
7
7
  import { parse as parseYaml } from 'yaml';
8
8
  import { markdownLinks } from './links.js';
9
9
  import { hasTargetSpec, isTargetOnlyTitle, mediaLinkLocations, mediaTargetPoint, targetPointFits } from './media-links.js';
10
+ import { extractTagsFromBody } from './tags.js';
10
11
 
11
12
  /** 开头 `---` 包的 front matter */
12
13
  const FRONT_MATTER = /^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/;
@@ -65,6 +66,7 @@ export function contentLength(md) {
65
66
  if (fence) continue;
66
67
  const visible = line
67
68
  .replace(/!?\[([^\]]*)\]\([^()\s]*(?:\s+"[^"]*")?\)/g, '$1') // [文字](url) → 文字
69
+ .replace(/\[([^\]]*)\]\{[^{}\r\n]+\}/g, '$1') // [文字]{#id .green} → 文字
68
70
  .replace(/^\s{0,3}#{1,6}\s+/, '') // 行内小标题的 #
69
71
  .replace(/^\s{0,3}>\s?/, '') // 引用
70
72
  .replace(/[*_`~]/g, '');
@@ -320,13 +322,39 @@ export function parseDocument(text, opts = {}) {
320
322
  * 字段,把线连到对方的 `## id` 上才说得清是哪个字段对哪个字段。
321
323
  * 键和 targets 一样用链接的**原文**(客户端是拿渲染出来的 href 查表的)。
322
324
  */
323
- const anchors = Object.create(null), targetNodes = Object.create(null), titleOf = new Map(), bodyOf = new Map();
325
+ const anchors = Object.create(null), targetNodes = Object.create(null), tagTargets = Object.create(null), tags = Object.create(null);
326
+ const titleOf = new Map(), bodyOf = new Map();
327
+ const collectTags = (body, cardId, nodeId, baseLine) => {
328
+ for (const tag of extractTagsFromBody(body, { cardId, nodeId, baseLine })) {
329
+ if (!tag.id) continue;
330
+ if (tags[tag.id]) {
331
+ at('error', 'MD_TAG_DUPLICATE_ID',
332
+ `Tag ID「#${tag.id}」重复定义`,
333
+ '每个文档内的 Tag ID 必须唯一,修改其中一个 ID', tag.line);
334
+ continue;
335
+ }
336
+ tags[tag.id] = {
337
+ id: tag.id,
338
+ cardId: tag.cardId,
339
+ nodeId: tag.nodeId,
340
+ color: tag.color,
341
+ text: tag.text,
342
+ kind: tag.kind,
343
+ blockIndex: tag.blockIndex || 0,
344
+ codeLine: tag.codeLine || 0,
345
+ };
346
+ }
347
+ };
324
348
  for (const c of cards) {
349
+ const cBody = c._entry.body.join('\n');
325
350
  titleOf.set(c.id, c.title);
326
- bodyOf.set(c.id, c._entry.body.join('\n'));
351
+ bodyOf.set(c.id, cBody);
352
+ collectTags(cBody, c.id, c.id, c._entry.line + 1);
327
353
  const walk = ns => ns.forEach(n => {
354
+ const nBody = n._entry.body.join('\n');
328
355
  titleOf.set(n.id, n.title);
329
- bodyOf.set(n.id, n._entry.body.join('\n'));
356
+ bodyOf.set(n.id, nBody);
357
+ collectTags(nBody, c.id, n.id, n._entry.line + 1);
330
358
  walk(n.kids);
331
359
  });
332
360
  walk(c.nodes);
@@ -401,7 +429,21 @@ export function parseDocument(text, opts = {}) {
401
429
  try { got = resolve(decodeURIComponent(t)); } catch { got = null; }
402
430
  if (got) { head = t; anchor = ''; }
403
431
  }
404
- if (!got) continue;
432
+ // 二元目标模型:若未命中卡片/小节标题,再查文档内唯一 Tag ID(支持 [文字](#tagId))。
433
+ if (!got) {
434
+ let tagHit = tags[t];
435
+ if (!tagHit && t.includes('%')) {
436
+ try { tagHit = tags[decodeURIComponent(t)]; } catch { tagHit = null; }
437
+ }
438
+ if (!tagHit) continue;
439
+ const mine = e.level === 1 ? card.id : node.id;
440
+ const theirs = tagHit.cardId;
441
+ targets[raw] = theirs;
442
+ tagTargets[raw] = tagHit.id;
443
+ if (tagHit.nodeId && tagHit.nodeId !== theirs) targetNodes[raw] = tagHit.nodeId;
444
+ edgePairs.push([mine, theirs]);
445
+ continue;
446
+ }
405
447
  if (got.ambiguous) {
406
448
  at('error', 'MD_EDGE_AMBIGUOUS',
407
449
  `「${t}」能对上 ${got.ambiguous.length} 个地方:${got.ambiguous.join('、')}`,
@@ -421,8 +463,14 @@ export function parseDocument(text, opts = {}) {
421
463
  if (got.id === mine && !anchor) continue;
422
464
  // 键用 raw —— 客户端是拿**渲染出来的 href** 去查表的,剥过 `#` 就查不到了
423
465
  targets[raw] = theirs;
424
- if (!anchor && got.id !== theirs) { anchor = titleOf.get(got.id); targetNodes[raw] = got.id; }
425
- if (anchor) anchors[raw] = anchor;
466
+ // 若 `卡片#tagId` 的 `#` 后半段命中该卡内的 Tag ID,也视为 Tag 精准落点。
467
+ if (anchor && tags[anchor] && tags[anchor].cardId === theirs) {
468
+ tagTargets[raw] = tags[anchor].id;
469
+ if (tags[anchor].nodeId && tags[anchor].nodeId !== theirs) targetNodes[raw] = tags[anchor].nodeId;
470
+ } else {
471
+ if (!anchor && got.id !== theirs) { anchor = titleOf.get(got.id); targetNodes[raw] = got.id; }
472
+ if (anchor) anchors[raw] = anchor;
473
+ }
426
474
  edgePairs.push([mine, theirs]);
427
475
  }
428
476
 
@@ -492,6 +540,8 @@ export function parseDocument(text, opts = {}) {
492
540
  targets: { ...targets },
493
541
  anchors: { ...anchors },
494
542
  targetNodes: { ...targetNodes },
543
+ tags: { ...tags },
544
+ tagTargets: { ...tagTargets },
495
545
  edges: cardEdges,
496
546
  hasMermaid,
497
547
  };