cladogram 0.5.4 → 0.5.5-beta.2

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.
Files changed (54) hide show
  1. package/README.md +8 -6
  2. package/bin/clado.js +5 -5
  3. package/docs/release.md +13 -0
  4. package/package.json +1 -1
  5. package/plugins/agent/index.js +458 -25
  6. package/plugins/agent/style.css +299 -8
  7. package/plugins/directory/capabilities.json +1 -1
  8. package/plugins/directory/index.js +57 -2
  9. package/plugins/directory/style.css +11 -0
  10. package/plugins/view-controls/index.js +1 -1
  11. package/plugins/view-controls/style.css +30 -10
  12. package/skills/clado/SKILL.md +17 -16
  13. package/src/agent/executors.js +213 -0
  14. package/src/agent/probe.js +176 -0
  15. package/src/agent/providers/anthropic.js +220 -0
  16. package/src/agent/providers/index.js +52 -0
  17. package/src/agent/providers/openai.js +146 -0
  18. package/src/agent/runtime.js +557 -0
  19. package/src/agent/sessions.js +129 -0
  20. package/src/html/app-css.js +62 -9
  21. package/src/html/canvas-chain.js +2 -1
  22. package/src/html/canvas-ui.css +63 -0
  23. package/src/html/page.js +4 -0
  24. package/src/html/plugin-ui.css +12 -0
  25. package/src/html/plugin-ui.js +8 -2
  26. package/src/html/runtime-api.js +136 -5
  27. package/src/html/runtime.js +160 -290
  28. package/src/html/view-registry.js +95 -0
  29. package/src/html/views/view-cards.js +28 -0
  30. package/src/html/views/view-doc.js +51 -0
  31. package/src/html/views/view-mindmap.js +173 -0
  32. package/src/server/agent.js +335 -17
  33. package/src/server/assets/library-canvas.js +13 -3
  34. package/src/server/assets/library-plugin-bridge.js +2 -2
  35. package/src/server/assets/library-plugins.js +2 -2
  36. package/src/server/assets/library.css +5 -0
  37. package/src/server/assets/library.html +1 -1
  38. package/src/server/assets/library.js +157 -20
  39. package/src/server/events.js +189 -0
  40. package/src/server/export.js +1 -1
  41. package/src/server/mcp.js +16 -16
  42. package/src/server/plugin-capabilities.js +38 -22
  43. package/src/server/plugin-settings.js +27 -1
  44. package/src/server/plugins.js +17 -4
  45. package/src/server/workspace.js +171 -56
  46. package/src/skill/install.js +1 -1
  47. package/src/skill/targets.js +3 -3
  48. package/src/util/update.js +3 -2
  49. package/src/workspace/service.js +23 -15
  50. package/src/workspace/storage.js +88 -20
  51. package/templates/business-flow.mdc +1 -1
  52. package/templates/call-chain.mdc +1 -1
  53. package/templates/data-design.mdc +1 -1
  54. package/templates/test-cases.mdc +47 -0
@@ -22,9 +22,9 @@
22
22
  position: absolute;
23
23
  right: 0;
24
24
  bottom: calc(100% + 8px);
25
- width: min(392px, calc(100vw - 32px));
26
- height: min(545px, calc(100dvh - 184px));
27
- min-height: 220px;
25
+ width: min(410px, calc(100vw - 32px));
26
+ height: min(580px, calc(100dvh - 168px));
27
+ min-height: 240px;
28
28
  display: flex;
29
29
  flex-direction: column;
30
30
  overflow: hidden;
@@ -33,18 +33,151 @@
33
33
  display: flex;
34
34
  align-items: center;
35
35
  justify-content: space-between;
36
+ gap: 8px;
36
37
  border-bottom: 1px solid var(--clado-ui-edge);
37
- padding: 9px 11px 9px 15px;
38
+ padding: 9px 10px 9px 14px;
39
+ }
40
+ .clado-agent-heading {
41
+ min-width: 0;
42
+ display: flex;
43
+ flex-direction: column;
44
+ }
45
+ .clado-agent-header-actions {
46
+ display: flex;
47
+ align-items: center;
48
+ gap: 3px;
49
+ flex: none;
50
+ }
51
+ .clado-agent-header-actions .clado-ui-button {
52
+ min-height: 26px;
53
+ padding: 2px 7px;
54
+ font-size: 11.5px;
55
+ }
56
+ .clado-agent-follow[aria-pressed="true"] {
57
+ color: var(--clado-ui-accent);
58
+ background: var(--clado-ui-active);
38
59
  }
39
60
  .clado-agent-panel h2 { margin: 0; font-size: 14px; font-weight: 650; }
40
- .clado-agent-provider { color: var(--clado-ui-muted); font-size: 11px; }
41
- .clado-agent-close { font-size: 18px; }
61
+ .clado-agent-provider {
62
+ color: var(--clado-ui-muted);
63
+ font-size: 11px;
64
+ white-space: nowrap;
65
+ overflow: hidden;
66
+ text-overflow: ellipsis;
67
+ }
68
+ .clado-agent-close { font-size: 18px !important; padding-inline: 6px !important; }
69
+ .clado-agent-sessions {
70
+ max-height: 170px;
71
+ overflow: auto;
72
+ padding: 6px 10px;
73
+ border-bottom: 1px solid var(--clado-ui-edge);
74
+ background: color-mix(in srgb, var(--clado-ui-well) 70%, transparent);
75
+ display: flex;
76
+ flex-direction: column;
77
+ gap: 4px;
78
+ }
79
+ .clado-agent-sessions[hidden] { display: none; }
80
+ .clado-agent-sessions-empty {
81
+ padding: 10px 6px;
82
+ font-size: 11.5px;
83
+ color: var(--clado-ui-muted);
84
+ text-align: center;
85
+ }
86
+ .clado-agent-session-row {
87
+ display: flex;
88
+ align-items: center;
89
+ gap: 4px;
90
+ border-radius: 8px;
91
+ transition: background 140ms ease;
92
+ }
93
+ .clado-agent-session-row:hover, .clado-agent-session-row.active {
94
+ background: var(--clado-ui-active);
95
+ }
96
+ .clado-agent-session-open {
97
+ flex: 1;
98
+ min-width: 0;
99
+ border: 0;
100
+ background: transparent;
101
+ color: var(--clado-ui-text);
102
+ text-align: left;
103
+ padding: 5px 7px;
104
+ cursor: pointer;
105
+ display: flex;
106
+ flex-direction: column;
107
+ gap: 2px;
108
+ font: inherit;
109
+ }
110
+ .clado-agent-session-title {
111
+ font-size: 12px;
112
+ font-weight: 550;
113
+ white-space: nowrap;
114
+ overflow: hidden;
115
+ text-overflow: ellipsis;
116
+ }
117
+ .clado-agent-session-open small {
118
+ font-size: 10.5px;
119
+ color: var(--clado-ui-muted);
120
+ }
121
+ .clado-agent-session-open small.waiting {
122
+ color: #d97706;
123
+ font-weight: 600;
124
+ }
125
+ .clado-agent-session-del {
126
+ border: 0;
127
+ background: transparent;
128
+ color: var(--clado-ui-muted);
129
+ width: 24px;
130
+ height: 24px;
131
+ border-radius: 6px;
132
+ cursor: pointer;
133
+ font-size: 14px;
134
+ flex: none;
135
+ }
136
+ .clado-agent-session-del:hover {
137
+ color: var(--clado-ui-text);
138
+ background: color-mix(in srgb, var(--clado-ui-edge) 50%, transparent);
139
+ }
140
+ .clado-agent-modes {
141
+ display: flex;
142
+ flex-wrap: wrap;
143
+ gap: 5px;
144
+ padding: 8px 12px 6px;
145
+ border-bottom: 1px solid color-mix(in srgb, var(--clado-ui-edge) 70%, transparent);
146
+ }
147
+ .clado-agent-chip {
148
+ min-height: 26px;
149
+ padding: 3px 9px;
150
+ font-size: 11.5px;
151
+ border-radius: 999px;
152
+ }
153
+ .clado-agent-persona-bar,
154
+ .clado-agent-executor-bar {
155
+ display: flex;
156
+ align-items: center;
157
+ gap: 8px;
158
+ padding: 6px 12px;
159
+ border-bottom: 1px solid color-mix(in srgb, var(--clado-ui-edge) 70%, transparent);
160
+ font-size: 11.5px;
161
+ color: var(--clado-ui-muted);
162
+ }
163
+ .clado-agent-persona-bar[hidden],
164
+ .clado-agent-executor-bar[hidden] { display: none; }
165
+ .clado-agent-select {
166
+ flex: 1;
167
+ min-width: 0;
168
+ padding: 4px 8px;
169
+ border: 1px solid var(--clado-ui-edge);
170
+ border-radius: 8px;
171
+ background: var(--clado-ui-well);
172
+ color: var(--clado-ui-text);
173
+ font: inherit;
174
+ }
42
175
  .clado-agent-log {
43
176
  flex: 1;
44
177
  min-height: 0;
45
178
  overflow: auto;
46
179
  overscroll-behavior: contain;
47
- padding: 14px;
180
+ padding: 13px;
48
181
  display: flex;
49
182
  flex-direction: column;
50
183
  gap: 12px;
@@ -61,6 +194,7 @@
61
194
  background: var(--clado-ui-active);
62
195
  }
63
196
  .clado-agent-message.assistant {
197
+ width: 100%;
64
198
  padding-inline: 3px;
65
199
  }
66
200
  .clado-agent-message strong, .clado-agent-message small {
@@ -72,6 +206,163 @@
72
206
  white-space: pre-wrap;
73
207
  line-height: 1.55;
74
208
  }
209
+ .clado-agent-thinking {
210
+ margin: 5px 0 6px;
211
+ padding: 5px 9px;
212
+ border-radius: 9px;
213
+ border: 1px solid color-mix(in srgb, var(--clado-ui-edge) 75%, transparent);
214
+ background: color-mix(in srgb, var(--clado-ui-well) 70%, transparent);
215
+ font-size: 11.5px;
216
+ }
217
+ .clado-agent-thinking summary {
218
+ cursor: pointer;
219
+ color: var(--clado-ui-muted);
220
+ font-weight: 550;
221
+ user-select: none;
222
+ }
223
+ .clado-agent-thinking pre {
224
+ margin: 6px 0 2px;
225
+ white-space: pre-wrap;
226
+ overflow-wrap: anywhere;
227
+ font-family: inherit;
228
+ font-size: 11.5px;
229
+ line-height: 1.5;
230
+ color: var(--clado-ui-muted);
231
+ }
232
+ .clado-agent-changes {
233
+ margin-top: 8px;
234
+ padding: 8px 10px;
235
+ 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));
238
+ }
239
+ .clado-agent-changes-title {
240
+ font-size: 11px;
241
+ font-weight: 600;
242
+ color: var(--clado-ui-accent);
243
+ margin-bottom: 5px;
244
+ }
245
+ .clado-agent-changes-list {
246
+ display: flex;
247
+ flex-direction: column;
248
+ gap: 3px;
249
+ }
250
+ .clado-agent-change-item {
251
+ border: 0;
252
+ background: transparent;
253
+ color: var(--clado-ui-text);
254
+ font: inherit;
255
+ font-size: 11.5px;
256
+ text-align: left;
257
+ padding: 4px 6px;
258
+ border-radius: 7px;
259
+ cursor: pointer;
260
+ display: flex;
261
+ align-items: center;
262
+ gap: 7px;
263
+ transition: background 140ms ease;
264
+ }
265
+ .clado-agent-change-item:hover {
266
+ background: var(--clado-ui-active);
267
+ }
268
+ .clado-agent-change-item .dot {
269
+ width: 6px;
270
+ height: 6px;
271
+ border-radius: 50%;
272
+ background: var(--clado-ui-accent);
273
+ flex: none;
274
+ }
275
+ .clado-agent-question {
276
+ margin-top: 8px;
277
+ padding: 10px 11px;
278
+ border-radius: 11px;
279
+ border: 1px solid rgb(217 119 6 / .42);
280
+ background: rgb(217 119 6 / .06);
281
+ display: flex;
282
+ flex-direction: column;
283
+ gap: 8px;
284
+ }
285
+ .clado-agent-question.answered {
286
+ border-color: var(--clado-ui-edge);
287
+ background: color-mix(in srgb, var(--clado-ui-well) 70%, transparent);
288
+ }
289
+ .clado-agent-question-badge {
290
+ font-size: 11px;
291
+ font-weight: 650;
292
+ color: #b45309;
293
+ }
294
+ [data-theme="dark"] .clado-agent-question-badge {
295
+ color: #fbbf24;
296
+ }
297
+ .clado-agent-question.answered .clado-agent-question-badge {
298
+ color: var(--clado-ui-muted);
299
+ }
300
+ .clado-agent-question-text {
301
+ font-size: 12.5px;
302
+ line-height: 1.5;
303
+ color: var(--clado-ui-text);
304
+ font-weight: 500;
305
+ }
306
+ .clado-agent-question-options {
307
+ display: flex;
308
+ flex-direction: column;
309
+ gap: 5px;
310
+ }
311
+ .clado-agent-option-btn {
312
+ border: 1px solid var(--clado-ui-edge);
313
+ border-radius: 9px;
314
+ background: var(--clado-ui-well);
315
+ color: var(--clado-ui-text);
316
+ padding: 7px 10px;
317
+ text-align: left;
318
+ cursor: pointer;
319
+ font: inherit;
320
+ display: flex;
321
+ flex-direction: column;
322
+ gap: 2px;
323
+ transition: border-color 140ms ease, background 140ms ease;
324
+ }
325
+ .clado-agent-option-btn:hover:not(:disabled) {
326
+ border-color: #d97706;
327
+ background: rgb(217 119 6 / .08);
328
+ }
329
+ .clado-agent-option-btn:disabled {
330
+ opacity: .55;
331
+ cursor: default;
332
+ }
333
+ .clado-agent-option-label {
334
+ font-size: 12px;
335
+ font-weight: 600;
336
+ }
337
+ .clado-agent-option-btn small {
338
+ font-size: 11px;
339
+ color: var(--clado-ui-muted);
340
+ }
341
+ .clado-agent-question-custom {
342
+ display: flex;
343
+ gap: 5px;
344
+ }
345
+ .clado-agent-question-custom input {
346
+ flex: 1;
347
+ min-width: 0;
348
+ padding: 5px 8px;
349
+ border: 1px solid var(--clado-ui-edge);
350
+ border-radius: 8px;
351
+ background: var(--clado-ui-well);
352
+ color: var(--clado-ui-text);
353
+ font: inherit;
354
+ font-size: 11.5px;
355
+ }
356
+ .clado-agent-option-submit {
357
+ min-height: 28px;
358
+ padding: 2px 10px;
359
+ font-size: 11.5px;
360
+ }
361
+ .clado-agent-question-answered {
362
+ font-size: 11.5px;
363
+ color: var(--clado-ui-accent);
364
+ font-weight: 550;
365
+ }
75
366
  .clado-agent-status {
76
367
  margin: 0 14px;
77
368
  padding-block: 4px;
@@ -101,5 +392,5 @@
101
392
  }
102
393
  .clado-agent-panel textarea:focus-visible { outline: 2px solid var(--clado-ui-accent); outline-offset: 1px; }
103
394
  @media (max-width: 460px) {
104
- .clado-agent-panel { width: min(392px, calc(100vw - 20px)); }
395
+ .clado-agent-panel { width: min(410px, calc(100vw - 20px)); }
105
396
  }
@@ -18,7 +18,7 @@
18
18
  "properties": {
19
19
  "file": { "type": "string" },
20
20
  "title": { "type": "string" },
21
- "mode": { "enum": ["mindmap", "cards", "doc"] }
21
+ "mode": { "enum": ["cards", "mindmap", "doc"] }
22
22
  },
23
23
  "required": ["file", "title", "mode"],
24
24
  "additionalProperties": false
@@ -30,10 +30,15 @@
30
30
  content.innerHTML = `
31
31
  <button type="button" id="directoryButton" class="clado-ui-glass clado-ui-button directory-toggle" aria-expanded="false" aria-controls="directory" title="切换 Markdown 画布">
32
32
  <svg aria-hidden="true" viewBox="0 0 24 24"><path d="M4 7a2 2 0 0 1 2-2h4l2 2h6a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2Z"/></svg>
33
+ <span id="currentWorkspaceName" hidden></span>
33
34
  文档 <span id="fileCount">…</span><span id="currentFileName" hidden></span>
34
35
  </button>
35
36
  <aside id="directory" class="clado-ui-glass clado-ui-glass-panel" aria-label="Markdown 画布目录" hidden>
36
37
  <div class="directory-scroll">
38
+ <div id="workspaceSection" class="directory-workspaces" hidden>
39
+ <div class="directory-workspaces-title">工作区</div>
40
+ <div id="workspaceList" class="directory-workspace-list"></div>
41
+ </div>
37
42
  <div class="directory-heading"><strong>Markdown/</strong></div>
38
43
  <label class="directory-search"><input id="documentSearch" type="search" aria-label="搜索文档" placeholder="搜索名称或路径…"></label>
39
44
  <nav id="documentList" aria-label="可用 Markdown"></nav>
@@ -48,9 +53,9 @@
48
53
  ({ input }) => actions.openFromCapability(input.file)).catch(error => console.warn('Clado 目录能力注册失败', error));
49
54
  const $ = selector => content.querySelector(selector);
50
55
  const trigger = $('#directoryButton'), directory = $('#directory'), search = $('#documentSearch'), dialog = $('#details');
51
- const fileName = $('#currentFileName');
56
+ const fileName = $('#currentFileName'), workspaceName = $('#currentWorkspaceName');
52
57
  const folders = new Set();
53
- let index = { documents: [], skipped: [] }, selected = '', canGoBack = false, signature = '', request = 0;
58
+ let index = { documents: [], skipped: [] }, selected = '', canGoBack = false, signature = '', workspaceSignature = '', request = 0;
54
59
  function setOpen(open) {
55
60
  if (open && actions.isLocked()) return;
56
61
  directory.hidden = !open;
@@ -84,6 +89,55 @@
84
89
  $('#backButton').disabled = actions.isLocked() || !canGoBack;
85
90
  $('#sourceButton').disabled = actions.isLocked() || !selected;
86
91
  }
92
+ function renderWorkspaces(current = '', items = []) {
93
+ const next = JSON.stringify([current, items.map(item => [item.id, item.name, item.documents])]);
94
+ if (next === workspaceSignature) return;
95
+ workspaceSignature = next;
96
+ if (current) {
97
+ workspaceName.textContent = current.split('/').pop();
98
+ workspaceName.title = current;
99
+ workspaceName.hidden = false;
100
+ } else {
101
+ workspaceName.hidden = true;
102
+ }
103
+ const section = $('#workspaceSection'), list = $('#workspaceList');
104
+ const show = items.length > 1 || !!current;
105
+ section.hidden = !show;
106
+ if (!show) return;
107
+ list.replaceChildren();
108
+ for (const item of items) {
109
+ const row = document.createElement('div');
110
+ row.className = 'workspace-row';
111
+ const button = document.createElement('button');
112
+ button.type = 'button';
113
+ button.className = 'clado-ui-button workspace-button';
114
+ button.dataset.workspace = item.id;
115
+ if (item.id === current) button.setAttribute('aria-current', 'page');
116
+ const label = document.createElement('span');
117
+ label.className = 'workspace-label';
118
+ label.textContent = item.id || (item.name + '(根目录)');
119
+ label.title = item.workspace || item.id || item.name;
120
+ const count = document.createElement('small');
121
+ count.textContent = String(item.documents ?? 0);
122
+ button.append(label, count);
123
+ button.onclick = () => {
124
+ if (item.id === current) { setOpen(false); return; }
125
+ actions.switchWorkspace?.(item.id);
126
+ };
127
+ row.append(button);
128
+ if (actions.workspaceUrl) {
129
+ const openTab = document.createElement('a');
130
+ openTab.className = 'clado-ui-button workspace-open-tab';
131
+ openTab.href = actions.workspaceUrl(item.id);
132
+ openTab.target = '_blank';
133
+ openTab.rel = 'noopener';
134
+ openTab.title = '在新标签页打开';
135
+ openTab.textContent = '↗';
136
+ row.append(openTab);
137
+ }
138
+ list.append(row);
139
+ }
140
+ }
87
141
  trigger.onclick = () => setOpen(directory.hidden);
88
142
  search.oninput = render;
89
143
  document.addEventListener('pointerdown', event => {
@@ -116,6 +170,7 @@
116
170
  return {
117
171
  close: () => setOpen(false),
118
172
  showMessage,
173
+ updateWorkspaces: renderWorkspaces,
119
174
  update(next, file, hasHistory) {
120
175
  if (file !== selected) {
121
176
  request++;
@@ -46,3 +46,14 @@
46
46
  }
47
47
  .skip-item{padding:10px 0;border-bottom:1px solid var(--line)}.skip-item strong{font-size:12px}.skip-item p{margin:5px 0!important}.skip-item code{font-size:10px}
48
48
  .directory-search{display:block;padding:0 9px 10px}.directory-search input{box-sizing:border-box;width:100%;border:1px solid var(--line);border-radius:7px;background:var(--clado-ui-well);color:var(--ink);font:inherit;padding:8px 10px;outline-color:var(--accent)}.tree-folder>summary{cursor:pointer;padding:8px;color:var(--ink);font-size:12px;font-weight:550}.tree-children{margin-left:11px;padding-left:5px;border-left:1px solid var(--line)}.tree-empty{padding:8px;color:var(--muted);font-size:12px}
49
+ #currentWorkspaceName{max-width:120px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-inline-end:8px;border-inline-end:1px solid var(--clado-ui-edge);color:var(--clado-ui-accent);font-size:12px;font-weight:600}
50
+ .directory-workspaces{padding:0 9px 10px;margin-bottom:10px;border-bottom:1px solid var(--line)}
51
+ .directory-workspaces-title{font-size:10px;font-weight:600;color:var(--muted);margin-bottom:6px}
52
+ .directory-workspace-list{display:flex;flex-direction:column;gap:4px;max-height:160px;overflow:auto}
53
+ .workspace-row{display:flex;align-items:center;gap:4px}
54
+ .workspace-button{flex:1;min-width:0;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 8px;text-align:left;font-size:11px}
55
+ .workspace-button[aria-current="page"]{color:var(--clado-ui-accent);font-weight:600}
56
+ .workspace-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
57
+ .workspace-button small{flex:none;font-size:10px;color:var(--muted)}
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
+ .workspace-open-tab:hover{color:var(--ink)}
@@ -1,5 +1,5 @@
1
1
  (() => {
2
- const modes = [['mindmap', '脑图'], ['cards', '卡片'], ['doc', '文档']];
2
+ const modes = [['cards', '卡片'], ['mindmap', '脑图'], ['doc', '文档']];
3
3
  const button = (className, text) => {
4
4
  const element = document.createElement('button');
5
5
  element.type = 'button';
@@ -5,28 +5,39 @@
5
5
  display: grid;
6
6
  grid-template-columns: repeat(3, 1fr);
7
7
  }
8
- .clado-view-modes .clado-ui-button {
8
+ .clado-view-modes .clado-ui-button,
9
+ .clado-view-modes .clado-ui-button:hover:where(:not(:disabled)),
10
+ .clado-view-modes .clado-ui-button[aria-pressed="true"] {
9
11
  position: relative;
10
12
  min-height: 34px;
11
- padding-inline: 12px;
13
+ padding-inline: 14px;
12
14
  background: transparent;
13
15
  border-color: transparent;
14
16
  border-radius: calc(var(--clado-ui-radius) - 5px);
15
17
  }
16
- .clado-view-modes .clado-ui-button[aria-pressed="true"] { font-weight: 650; }
18
+ .clado-view-modes .clado-ui-button:hover:where(:not(:disabled):not([aria-pressed="true"])) {
19
+ color: var(--clado-ui-text);
20
+ }
21
+ .clado-view-modes .clado-ui-button[aria-pressed="true"] {
22
+ color: var(--clado-ui-text);
23
+ font-weight: 600;
24
+ }
17
25
  .clado-view-thumb {
18
26
  position: absolute;
19
27
  inset: 0 auto 0 0;
20
28
  width: calc(100% / 3);
21
29
  border-radius: calc(var(--clado-ui-radius) - 5px);
22
- border: 1px solid color-mix(in srgb, var(--clado-ui-accent) 19%, transparent);
23
- background: linear-gradient(155deg, var(--clado-ui-highlight), transparent 75%),
24
- color-mix(in srgb, var(--clado-ui-accent) 11%, transparent);
25
- box-shadow: 0 1px 5px color-mix(in srgb, var(--clado-ui-accent) 12%, transparent);
30
+ border: 1px solid color-mix(in srgb, var(--clado-ui-accent) 18%, transparent);
31
+ background: rgb(255 255 255 / .52);
32
+ box-shadow: none;
26
33
  transform: translateX(calc(var(--clado-view-index, 0) * 100%));
27
- transition: transform 240ms cubic-bezier(.22,.75,.24,1);
34
+ transition: transform 220ms cubic-bezier(.22,.75,.24,1);
28
35
  pointer-events: none;
29
36
  }
37
+ [data-theme="dark"] .clado-view-thumb {
38
+ border-color: rgb(255 255 255 / .22);
39
+ background: rgb(255 255 255 / .11);
40
+ }
30
41
  @media (prefers-reduced-motion: reduce) {
31
42
  .clado-view-thumb { transition: none; }
32
43
  }
@@ -36,11 +47,20 @@
36
47
  .clado-view-status { display: flex; gap: 6px; }
37
48
  .clado-view-bar, .clado-view-status > * { pointer-events: auto; }
38
49
  .clado-view-status .clado-ui-button { border-radius: 12px; font-size: 12px; }
39
- .clado-view-status .clado-issue-count { color: #8a5000; }
50
+ .clado-view-status .clado-issue-count {
51
+ color: #8a5000;
52
+ border-color: transparent;
53
+ background: transparent;
54
+ --clado-ui-glass-fill: var(--clado-ui-surface);
55
+ }
56
+ .clado-view-status .clado-issue-count::after { display: none; }
57
+ .clado-view-status .clado-issue-count:hover:where(:not(:disabled)) {
58
+ background: color-mix(in srgb, var(--clado-ui-accent) 6%, transparent);
59
+ }
40
60
  .clado-view-status .has-errors { color: #b72e3c; }
41
61
  [data-theme="dark"] .clado-view-status .clado-issue-count { color: #efb860; }
42
62
  [data-theme="dark"] .clado-view-status .has-errors { color: #ffacb6; }
43
63
 
44
64
  @media (max-width: 460px) {
45
- .clado-view-modes .clado-ui-button { padding-inline: 7px; }
65
+ .clado-view-modes .clado-ui-button { padding-inline: 9px; }
46
66
  }
@@ -1,21 +1,21 @@
1
1
  ---
2
2
  name: clado
3
- description: 使用 Clado MCP 按模板创建和修改需求、流程、调用链及数据设计画布,在脑图、卡片、文档视图中实时预览,并维护项目模板、系统归档和离线 HTML 交付。
3
+ description: 使用 Clado MCP 按模板创建和修改需求、流程、调用链及数据设计画布,在卡片、脑图和文档视图中实时预览,并维护项目模板、系统归档和离线 HTML 交付。
4
4
  ---
5
5
 
6
6
  # Clado 使用指南
7
7
 
8
- Clado 将本地 Markdown/MDC 内容展示为脑图、卡片和文档三个视图。用户描述需求并看效果,AI 通过 MCP 组织和修改内容,网页自动同步。本文件说明怎样操作;具体场景的内容规范读取模板 `prompt`。
8
+ Clado 将本地 Markdown/MDC 内容展示为卡片、脑图和文档三种视图(默认卡片视图)。用户描述需求并看效果,AI 通过 MCP 组织和修改内容,网页自动同步。本文件说明怎样操作;具体场景的内容规范读取模板 `prompt`。
9
9
 
10
10
  ## 1. 内容模型与文件位置
11
11
 
12
12
  | 概念 | 含义 |
13
13
  | --- | --- |
14
- | 工作区 `workspace` | 一个项目的绝对路径,每次 MCP 调用必填,须在服务允许的范围内 |
14
+ | 工作区 `workspace` | 一个项目或子工作区的绝对路径,每次 MCP 调用必填,须在服务启动目录范围内 |
15
15
  | 文档 | 一个 `.mdc` 文件就是一张画布;旧 `.md` 和无头文件也可使用 |
16
16
  | 卡片与节点 | L1 标题是卡片;L2–L6 是卡内节点,层级表示内容包含关系 |
17
17
  | 正文 | 文字、表格、代码围栏或局部 Mermaid;正文和子节点分别操作 |
18
- | 链接 | 同文档引用形成关系线,跨文档链接用于导航,外部网址是普通正文链接 |
18
+ | 链接 | 同文档引用形成关系线(从具体内容行出发),跨文档链接用于导航,外部网址是普通正文链接 |
19
19
  | 模板 | 含用途、约束、组织方式和起始正文;新文档会携带创建时的规则头 |
20
20
 
21
21
  用户模板默认在 `~/.clado/templates/`,项目模板在 `.clado/templates/`,工作文档在 `.clado/doc/`。文档实际根目录以 `inspect` 返回的 `documentRoot` 为准。`file/targetFile/newFile` 都相对这个根目录,**不是相对当前文档所在目录**。
@@ -32,7 +32,7 @@ Clado 将本地 Markdown/MDC 内容展示为脑图、卡片和文档三个视图
32
32
  | `clado install /项目路径 --list` | 列出支持的 AI 客户端与安装位置 |
33
33
  | `clado install /项目路径 --to zcode` | 给该业务项目的指定客户端安装 Skill,准备用户模板库;也可交互选择其它客户端 |
34
34
  | `clado init /项目路径` | 准备工作区,首次复制上级项目和用户模板,近处同名优先 |
35
- | `clado serve /项目路径 --mode mindmap` | 启动网页和 Streamable HTTP MCP;`--port` 指定端口,`--entry` 指定入口 |
35
+ | `clado serve /项目路径 --mode cards` | 启动网页和 Streamable HTTP MCP;`--port` 指定端口,`--entry` 指定入口 |
36
36
  | `clado build --entry overview.mdc --mode cards --out clado.html` | 从项目根构建只读离线 HTML;`--split` 可分别输出文档 |
37
37
 
38
38
  CLI 的 `--dry-run` 只预览安装,`--force` 仅在确认允许替换现有目标时使用。`--theme light/dark` 设置初始主题,build 的 `--strict` 将警告视为错误,`--json` 输出结构化结果,`--quiet` 减少构建输出。`--entry` 相对本次文档目录。
@@ -41,13 +41,13 @@ CLI 的 `--dry-run` 只预览安装,`--force` 仅在确认允许替换现有
41
41
 
42
42
  全局命令在 Clado 源码仓库安装或更新;Skill 安装目标是业务项目,明确传入项目路径。安装后核对 `clado version` 和安装输出中的版本,不重复运行仍指向旧安装的命令。
43
43
 
44
- `serve` 会自动准备工作区,日常不必先执行 `init`。模式可选 `mindmap/cards/doc`。连接启动输出的 MCP 地址,通常为 `http://127.0.0.1:4317/mcp`。网页对应启动时选定的工作区;查看另一个项目或子工作区,另起 `clado serve /另一个项目 --port 4318`。
44
+ `serve` 会自动准备工作区,日常不必先执行 `init`。模式可选 `cards/mindmap/doc`(默认 `cards`)。连接启动输出的 MCP 地址,通常为 `http://127.0.0.1:4317/mcp`。在大目录启动一个 `serve` 后,多个 Agent 可并行操作其下各自的子工作区(传各自子目录绝对路径作为 `workspace`),网页端也可在目录中切换或新标签页同时打开多个子工作区。
45
45
 
46
46
  更新全局命令后,重启原来的 `serve`,在 AI 客户端重新连接 MCP,刷新工具定义。
47
47
 
48
48
  ## 3. 从没有上下文开始
49
49
 
50
- 1. 使用服务输出的 `workspace` 绝对路径。需要查目录时用 `clado_workspace inspect`;新子工作区用 `init`。用户说“改我选的卡片”时直接查 `selection`。
50
+ 1. 使用服务允许范围内的 `workspace` 绝对路径。需要查目录时用 `clado_workspace inspect`,列举当前服务下的子工作区用 `workspaces`,新子工作区用 `init`。用户说“改我选的卡片”时直接查 `selection`。
51
51
  2. 用 `clado_documents list/read` 查看相关旧文档,保留已有内容。读节点与位置可选 `view:"nodes"`,全文改写前选 `view:"source"`,只看概要选 `view:"summary"`;默认 `full` 兼容全部字段。若任务涉及实际代码,另外读取用户业务项目的真实材料;Clado 范例不能作为实现证据。
52
52
  3. `clado_templates list` 按用途选模板,再 `read` 提示词。默认只返回 `prompt`;编辑模板用 `view:"source"`,确实需要所有字段才用 `view:"full"`。
53
53
  4. 新文档用 `clado_documents create` 指定 `.mdc` 路径、标题和 `templateId`。`source` 可直接传多行正文,不能带 front matter;模板头由服务写入。省略正文时得到模板起始内容,之后须补充完整。
@@ -64,6 +64,7 @@ CLI 的 `--dry-run` 只预览安装,`--force` 仅在确认允许替换现有
64
64
  | `data-design` | 字段、约束、数据契约、关系和迁移 |
65
65
  | `system-state` | 当前系统事实与实施后的更新归档 |
66
66
  | `mind-expansion` | 思维展开,逐层收集想法、依据、候选方案和问题 |
67
+ | `test-cases` | 测试用例脑图:正常流、边界条件、异常流与回归检查点 |
67
68
 
68
69
  ## 4. MCP 工具与主要参数
69
70
 
@@ -71,37 +72,37 @@ CLI 的 `--dry-run` 只预览安装,`--force` 仅在确认允许替换现有
71
72
 
72
73
  | 工具 | action 与使用方式 |
73
74
  | --- | --- |
74
- | `clado_workspace` | `init/inspect/search/validate/selection`;搜索用 `query`,可给 `offset/limit/includeContent` |
75
+ | `clado_workspace` | `init/inspect/search/validate/selection/workspaces`;搜索用 `query`,可给 `offset/limit/includeContent` |
75
76
  | `clado_capabilities` | `list/call` 实时发现、调用在线能力。用 `clado.directory/directory.open` 打开目标文档 |
76
- | `clado_screenshot` | 返回当前画布 PNG,默认保留展开和聚焦状态。支持 `mode`、`scope:"full"` 和 `source:"latest"`。多标签页时用能力列表返回的 `viewId` |
77
+ | `clado_screenshot` | 返回当前画布 PNG,默认保留展开和聚焦状态。支持 `mode`(`cards/mindmap/doc`)、`scope:"full"` 和 `source:"latest"`。同工作区多标签页时用能力列表返回的 `viewId` |
77
78
  | `clado_templates` | `list/read/create/update/delete/pull/push`;定位用 `templateId`,默认项目级,用户库加 `scope:"user"` |
78
79
  | `clado_documents` | `list/read/create/copy/update/rename/delete`;定位用 `file`;复制、改名用 `newFile`;全文更新传完整 `source`,可用 `metadata` 替换头部 |
79
80
  | `clado_nodes` | `read/query/create/insert/update/rename/move/delete`;定位用 `file/node`;新增用 `title/parent/content/index`;移动用 `parent/index/targetFile` |
80
- | `clado_links` | `list/connect/disconnect`;源 `file/node`,目标 `targetFile/targetNode`;可给 `label/before/after/position` |
81
+ | `clado_links` | `list/connect/disconnect`;源 `file/node`,目标 `targetFile/targetNode`;优先用 `sourcePoint` 或行内 `position:{mode:"replace",anchor}` 从内容行连出 |
81
82
  | `clado_batch` | `operations` 中顺序执行1–100个项目操作,类型如 `document.copy/node.insert/link.connect/template.pull`;最终校验后保存 |
82
83
 
83
84
  节点 `node/parent/targetNode` 使用读取返回的**标题数组**,如 `["OrderService#createOrder(UUID)","检查权限(新增)"]`。不用内部ID或手拼点号路径。新增根卡片时省略 `parent`;同级节点 `index` 从 **0** 开始,省略则追加在同级末尾。
84
85
 
85
86
  `query` 的 `relation` 支持 `parent/children/ancestors/descendants/siblings/upstream/downstream`。可给 `depth` 控制深度、`offset/limit` 分页、`includeContent` 控制是否带正文。包含层级和调用关系分别查询。
86
87
 
87
- `connect` 省略 `targetFile` 表示同文档,此时必须给 `targetNode`;跨文档可以省略 `targetNode`,跳转整份文档。省略 `label` 时取目标标题。跨文档导航不代替当前画布的跨卡关系线。
88
+ `connect` 省略 `targetFile` 表示同文档,此时必须给 `targetNode`;跨文档可以省略 `targetNode`,跳转整份文档。**建立同画布跨卡连线时,必须优先从具体内容行出发**——即通过 `sourcePoint` 从代码行、表格数据行、Mermaid 节点拉线,或通过 `position:{mode:"replace",anchor:"原文"}` 把步骤正文里具体的方法名/规则词变成行内链接;**不要在卡片末尾单独追加一条裸的 `[目标卡](目标卡)` 来做整卡连整卡**。省略 `label` 时取目标标题。跨文档导航不代替当前画布的跨卡关系线。
88
89
 
89
90
  ## 5. 选中的卡片与正文定位
90
91
 
91
- 在线画布上,Mac 用 Command 加左键点标题,其他平台用 Ctrl 加左键。可多选,再点同一标题取消,按住修饰键点画布空白清空。三种模式共用选区。内容刷新后,只保留标题路径仍可唯一定位的选中项。切换文档清空。标题下的正文和后代属于同一选中范围。
92
+ 在线画布上,Mac 用 Command 加左键点标题,其他平台用 Ctrl 加左键。可多选,再点同一标题取消,按住修饰键点画布空白清空。三种视图共用选区。内容刷新后,只保留标题路径仍可唯一定位的选中项。切换文档清空。标题下的正文和后代属于同一选中范围。
92
93
 
93
- 用户提到选区时,调用 `clado_workspace` 的 `action:"selection"`。`ready` 返回 `file`、文档 `version` 和所选节点的 `path/content/paragraphs/nodeVersion/descendants`,按用户点选的顺序排列。根据用户指示定位到具体节点,修改一句用所给正文作原文锚点,整段替换可带该节点的 `nodeVersion`。`empty/stale` 时请用户选中或重新选择。选区以最近更新选区的标签页为准。
94
+ 用户提到选区时,调用 `clado_workspace` 的 `action:"selection"`。`ready` 返回 `file`、文档 `version` 和所选节点的 `path/content/paragraphs/nodeVersion/descendants`,按用户点选的顺序排列。根据用户指示定位到具体节点,修改一句用所给正文作原文锚点,整段替换可带该节点的 `nodeVersion`。`empty/stale` 时请用户选中或重新选择。选区按各自工作区隔离,以该工作区最近更新选区的标签页为准。
94
95
 
95
96
 
96
97
  `read` 返回每个节点的 `location` 和 `paragraphs`。段落编号从 **1** 开始,以空行分块;代码围栏包含内部空行整体算一块,表格通常也是一块。段落编号用读取结果。已知原文可以直接用 `anchor`。
97
98
 
98
99
  | 需求 | 参数 |
99
100
  | --- | --- |
100
- | 在正文末尾新增一段 | `insert` 或 `connect`,省略 `position`,默认 `append` |
101
+ | 在正文末尾新增一段 | `insert` 省略 `position`,默认 `append` |
101
102
  | 在正文开头新增一段 | `position:{mode:"prepend"}` |
102
103
  | 在第二段之前或之后新增 | `position:{mode:"before",paragraph:2}` 或 `mode:"after"` |
103
104
  | 紧贴某段唯一原文插入 | `position:{mode:"before",anchor:"唯一原文"}` 或 `mode:"after"` |
104
- | 把原句里的方法名变成链接 | `connect` 加 `position:{mode:"replace",anchor:"原句中唯一的方法名"}` |
105
+ | 把原句里的方法名变成行内链接(推荐) | `connect` 加 `position:{mode:"replace",anchor:"原句中唯一的方法名"}` |
105
106
  | 只替换第二段正文 | `update` 加 `position:{mode:"replace",paragraph:2}` |
106
107
  | 替换本节点全部正文 | `update` 传 `content`,省略 `position`;孩子保持不变 |
107
108
 
@@ -113,7 +114,7 @@ CLI 的 `--dry-run` 只预览安装,`--force` 仅在确认允许替换现有
113
114
 
114
115
  写入后的 `results` 返回最终文件、节点路径、同级位置、段落和行号。文件整体写入还返回节点位置摘要。批量内后续改名/移动会更新定位;内容被覆盖或删除会标明。`contentLocationStatus:"exact"` 表示能唯一定位;`multiple_matches` 或 `changed_by_later_operation` 时重新读取,不声称已经有唯一坐标。行号和编号只对对应文件 `version` 的快照有效。`nodeVersion` 用于后续覆盖或删除同一节点。
115
116
 
116
- 精确连线用 `clado_links connect` 的 `sourcePoint`,跟普通的 `file/node/targetNode` 一起传。代码、表格、Mermaid 保持连续。标注可以写在代码注释里,链接用工具挂到具体行上。点击画布中起点处的圆点可跳到目标。
117
+ **首选内容行精确连线**:用 `clado_links connect` 的 `sourcePoint`,跟普通的 `file/node/targetNode` 一起传。代码、表格、Mermaid 保持连续。标注可以写在代码注释里,链接用工具挂到具体行上。点击画布中起点处的圆点可跳到目标。
117
118
 
118
119
  | 起点 | `sourcePoint` 示例 |
119
120
  | --- | --- |