@crypto512/jicon-mcp 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -3
- package/TOOL_LIST.md +261 -140
- package/dist/config/constants.d.ts +2 -0
- package/dist/config/constants.d.ts.map +1 -1
- package/dist/config/constants.js +2 -0
- package/dist/config/constants.js.map +1 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +2 -0
- package/dist/config/loader.js.map +1 -1
- package/dist/config/types.d.ts +6 -0
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js +4 -0
- package/dist/config/types.js.map +1 -1
- package/dist/confluence/client.d.ts +11 -2
- package/dist/confluence/client.d.ts.map +1 -1
- package/dist/confluence/client.js +29 -12
- package/dist/confluence/client.js.map +1 -1
- package/dist/confluence/tools.d.ts +2 -2
- package/dist/confluence/tools.d.ts.map +1 -1
- package/dist/confluence/tools.js +145 -59
- package/dist/confluence/tools.js.map +1 -1
- package/dist/index.js +17 -2
- package/dist/index.js.map +1 -1
- package/dist/jira/client.d.ts.map +1 -1
- package/dist/jira/client.js +3 -13
- package/dist/jira/client.js.map +1 -1
- package/dist/jira/tools.d.ts.map +1 -1
- package/dist/jira/tools.js +9 -30
- package/dist/jira/tools.js.map +1 -1
- package/dist/permissions/tool-registry.d.ts +4 -2
- package/dist/permissions/tool-registry.d.ts.map +1 -1
- package/dist/permissions/tool-registry.js +14 -2
- package/dist/permissions/tool-registry.js.map +1 -1
- package/dist/tempo/formatters.d.ts.map +1 -1
- package/dist/tempo/formatters.js +1 -16
- package/dist/tempo/formatters.js.map +1 -1
- package/dist/tempo/tools.d.ts +2 -2
- package/dist/tempo/tools.d.ts.map +1 -1
- package/dist/tempo/tools.js +5 -13
- package/dist/tempo/tools.js.map +1 -1
- package/dist/utils/buffer-tools.d.ts +115 -63
- package/dist/utils/buffer-tools.d.ts.map +1 -1
- package/dist/utils/buffer-tools.js +385 -330
- package/dist/utils/buffer-tools.js.map +1 -1
- package/dist/utils/content-buffer.d.ts +24 -1
- package/dist/utils/content-buffer.d.ts.map +1 -1
- package/dist/utils/content-buffer.js +49 -39
- package/dist/utils/content-buffer.js.map +1 -1
- package/dist/utils/jicon-help.d.ts +5 -5
- package/dist/utils/jicon-help.d.ts.map +1 -1
- package/dist/utils/jicon-help.js +259 -536
- package/dist/utils/jicon-help.js.map +1 -1
- package/dist/utils/plantuml/client.d.ts +1 -1
- package/dist/utils/plantuml/client.d.ts.map +1 -1
- package/dist/utils/plantuml/client.js +34 -59
- package/dist/utils/plantuml/client.js.map +1 -1
- package/dist/utils/plantuml/docker-manager.d.ts +3 -1
- package/dist/utils/plantuml/docker-manager.d.ts.map +1 -1
- package/dist/utils/plantuml/docker-manager.js +6 -2
- package/dist/utils/plantuml/docker-manager.js.map +1 -1
- package/dist/utils/plantuml/include-expander.d.ts +32 -0
- package/dist/utils/plantuml/include-expander.d.ts.map +1 -0
- package/dist/utils/plantuml/include-expander.js +129 -0
- package/dist/utils/plantuml/include-expander.js.map +1 -0
- package/dist/utils/plantuml/index.d.ts +2 -1
- package/dist/utils/plantuml/index.d.ts.map +1 -1
- package/dist/utils/plantuml/index.js +3 -1
- package/dist/utils/plantuml/index.js.map +1 -1
- package/dist/utils/plantuml/service.d.ts +32 -8
- package/dist/utils/plantuml/service.d.ts.map +1 -1
- package/dist/utils/plantuml/service.js +108 -15
- package/dist/utils/plantuml/service.js.map +1 -1
- package/dist/utils/plantuml/tools.d.ts +4 -4
- package/dist/utils/plantuml/tools.d.ts.map +1 -1
- package/dist/utils/plantuml/tools.js +50 -5
- package/dist/utils/plantuml/tools.js.map +1 -1
- package/dist/utils/plantuml/types.d.ts +4 -4
- package/dist/utils/plantuml/validation-helper.d.ts +33 -0
- package/dist/utils/plantuml/validation-helper.d.ts.map +1 -0
- package/dist/utils/plantuml/validation-helper.js +97 -0
- package/dist/utils/plantuml/validation-helper.js.map +1 -0
- package/dist/utils/response-formatter.js +7 -7
- package/dist/utils/response-formatter.js.map +1 -1
- package/dist/utils/time-formatter.d.ts +10 -0
- package/dist/utils/time-formatter.d.ts.map +1 -0
- package/dist/utils/time-formatter.js +22 -0
- package/dist/utils/time-formatter.js.map +1 -0
- package/dist/utils/url-tools.d.ts.map +1 -1
- package/dist/utils/url-tools.js +11 -4
- package/dist/utils/url-tools.js.map +1 -1
- package/dist/utils/xhtml/error-locator.d.ts +70 -0
- package/dist/utils/xhtml/error-locator.d.ts.map +1 -0
- package/dist/utils/xhtml/error-locator.js +229 -0
- package/dist/utils/xhtml/error-locator.js.map +1 -0
- package/dist/utils/xhtml/index.d.ts +6 -3
- package/dist/utils/xhtml/index.d.ts.map +1 -1
- package/dist/utils/xhtml/index.js +7 -3
- package/dist/utils/xhtml/index.js.map +1 -1
- package/dist/utils/xhtml/operations.d.ts +54 -0
- package/dist/utils/xhtml/operations.d.ts.map +1 -1
- package/dist/utils/xhtml/operations.js +205 -0
- package/dist/utils/xhtml/operations.js.map +1 -1
- package/dist/utils/xhtml/plantuml.d.ts +1 -1
- package/dist/utils/xhtml/plantuml.d.ts.map +1 -1
- package/dist/utils/xhtml/plantuml.js +19 -30
- package/dist/utils/xhtml/plantuml.js.map +1 -1
- package/dist/utils/xhtml/serializer.d.ts +5 -0
- package/dist/utils/xhtml/serializer.d.ts.map +1 -1
- package/dist/utils/xhtml/serializer.js +18 -4
- package/dist/utils/xhtml/serializer.js.map +1 -1
- package/dist/utils/xhtml/types.d.ts +3 -3
- package/dist/utils/xhtml/types.d.ts.map +1 -1
- package/dist/utils/xhtml/validator.d.ts.map +1 -1
- package/dist/utils/xhtml/validator.js +87 -4
- package/dist/utils/xhtml/validator.js.map +1 -1
- package/package.json +1 -1
package/dist/utils/jicon-help.js
CHANGED
|
@@ -7,159 +7,74 @@
|
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import { formatSuccess, formatError } from "./response-formatter.js";
|
|
9
9
|
// Available topics
|
|
10
|
-
const TOPICS = ["jql", "cql", "storage", "plantuml"];
|
|
10
|
+
const TOPICS = ["jql", "cql", "storage", "plantuml", "buffers"];
|
|
11
11
|
// Default workflow guide (shown when no topic specified)
|
|
12
12
|
const WORKFLOW_GUIDE = `# Jicon Quick Reference
|
|
13
13
|
|
|
14
|
-
##
|
|
15
|
-
\`help(topic="jql|cql|storage|plantuml")\`
|
|
14
|
+
## Decision Tree - Which Topic?
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
help(topic="
|
|
24
|
-
|
|
25
|
-
Returns: draftId, bufferId, url
|
|
26
|
-
-> User publishes via Confluence UI
|
|
27
|
-
\`\`\`
|
|
28
|
-
|
|
29
|
-
### Create Page with Diagram
|
|
30
|
-
\`\`\`
|
|
31
|
-
help(topic="plantuml") <- GET DIAGRAM SYNTAX FIRST
|
|
32
|
-
help(topic="storage") <- GET PAGE SYNTAX
|
|
33
|
-
-> confluence_draft_create(...)
|
|
34
|
-
-> User publishes via Confluence UI
|
|
35
|
-
\`\`\`
|
|
36
|
-
|
|
37
|
-
### Draft Workflow (iterative editing)
|
|
38
|
-
\`\`\`
|
|
39
|
-
help(topic="storage") <- if syntax needed
|
|
40
|
-
-> confluence_draft_create(spaceKey, title, content)
|
|
41
|
-
Returns: draftId, bufferId, url (click to preview)
|
|
42
|
-
-> buffer_edit_xhtml(...) or buffer_edit(...) [repeat]
|
|
43
|
-
-> confluence_draft_save(draftId, bufferId) [checkpoint]
|
|
44
|
-
-> User publishes manually via Confluence UI
|
|
45
|
-
\`\`\`
|
|
46
|
-
|
|
47
|
-
### Update Page
|
|
48
|
-
\`\`\`
|
|
49
|
-
confluence_get_page(pageId) -> bufferId
|
|
50
|
-
-> buffer_edit_xhtml(...) or buffer_edit(...)
|
|
51
|
-
-> confluence_draft_create(spaceKey, title, bufferId=bufferId)
|
|
52
|
-
-> User publishes via Confluence UI
|
|
53
|
-
\`\`\`
|
|
54
|
-
|
|
55
|
-
### Search Pages
|
|
56
|
-
\`\`\`
|
|
57
|
-
help(topic="cql") <- GET QUERY SYNTAX FIRST
|
|
58
|
-
-> confluence_search_content(cql)
|
|
59
|
-
\`\`\`
|
|
60
|
-
|
|
61
|
-
### Write-Home Restriction
|
|
62
|
-
When enabled, writes restricted to personal space only.
|
|
63
|
-
\`\`\`
|
|
64
|
-
confluence_get_current_user_space() <- GET YOUR SPACE KEY FIRST
|
|
65
|
-
-> use spaceKey for create/update
|
|
66
|
-
\`\`\`
|
|
16
|
+
| Task | First Step |
|
|
17
|
+
|------|------------|
|
|
18
|
+
| Edit Confluence page | \`help(topic="buffers")\` ← Element ID editing |
|
|
19
|
+
| Create page with diagram | \`help(topic="plantuml")\` |
|
|
20
|
+
| XHTML syntax needed | \`help(topic="storage")\` |
|
|
21
|
+
| Search Confluence | \`help(topic="cql")\` |
|
|
22
|
+
| Search Jira | \`jira_get_issue_types()\` then \`help(topic="jql")\` |
|
|
23
|
+
| Log/get time | \`tempo_get_user_info()\` first |
|
|
67
24
|
|
|
68
25
|
---
|
|
69
26
|
|
|
70
|
-
##
|
|
27
|
+
## Core Workflows
|
|
71
28
|
|
|
72
|
-
###
|
|
29
|
+
### Create/Edit Confluence Page
|
|
73
30
|
\`\`\`
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
31
|
+
1. confluence_draft_create(spaceKey, title, content) OR confluence_get_page(pageId)
|
|
32
|
+
→ Returns: bufferId, structure (element IDs)
|
|
33
|
+
2. buffer_edit(bufferId, after=ID, content="<p>text</p>")
|
|
34
|
+
→ Use IDs from structure to position content
|
|
35
|
+
3. confluence_draft_save(draftId, bufferId)
|
|
36
|
+
→ Returns: url for preview
|
|
37
|
+
4. User publishes via Confluence UI
|
|
77
38
|
\`\`\`
|
|
78
39
|
|
|
79
|
-
###
|
|
40
|
+
### Insert PlantUML Diagram
|
|
80
41
|
\`\`\`
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
42
|
+
1. plantuml_validate(code="@startuml...") ← Validate FIRST
|
|
43
|
+
2. buffer_edit(bufferId, after=ID, plantuml="@startuml...")
|
|
44
|
+
→ Auto-wraps in Confluence macro
|
|
84
45
|
\`\`\`
|
|
46
|
+
**Multiple diagrams?** See \`help(topic="plantuml")\` for direct macro embedding (fewer tool calls).
|
|
85
47
|
|
|
86
|
-
###
|
|
48
|
+
### Search
|
|
87
49
|
\`\`\`
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
-> workload_convert/workload_sum for calculations
|
|
50
|
+
Confluence: confluence_search_content(cql="space=KEY AND text~\\"term\\"")
|
|
51
|
+
Jira: jira_search_issues(jql="project=KEY AND type=Bug")
|
|
91
52
|
\`\`\`
|
|
92
53
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
## Tempo Workflows
|
|
96
|
-
|
|
97
|
-
### Log Work
|
|
98
|
-
\`\`\`
|
|
99
|
-
tempo_log_work(issueKey, hours, date, description)
|
|
100
|
-
\`\`\`
|
|
101
|
-
|
|
102
|
-
### Get Worklogs
|
|
54
|
+
### Tempo Time
|
|
103
55
|
\`\`\`
|
|
104
|
-
tempo_get_user_info()
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
\`\`\`
|
|
108
|
-
|
|
109
|
-
### Epic Analysis
|
|
110
|
-
\`\`\`
|
|
111
|
-
tempo_get_epic_worklogs(epicKey) [more efficient than Jira API]
|
|
56
|
+
tempo_get_user_info() → workerKey
|
|
57
|
+
tempo_get_worklogs(dateFrom, dateTo, workerKey=workerKey)
|
|
58
|
+
tempo_log_work(issueKey, hours, date)
|
|
112
59
|
\`\`\`
|
|
113
60
|
|
|
114
61
|
---
|
|
115
62
|
|
|
116
|
-
##
|
|
117
|
-
|
|
118
|
-
### Large Response
|
|
119
|
-
\`\`\`
|
|
120
|
-
[tool] returns bufferId when > 16KB
|
|
121
|
-
-> buffer_get_chunk(bufferId, offset, limit)
|
|
122
|
-
-> buffer_grep(bufferId, pattern) [search]
|
|
123
|
-
\`\`\`
|
|
124
|
-
|
|
125
|
-
### Edit Before Persist
|
|
126
|
-
\`\`\`
|
|
127
|
-
buffer_create(content) OR [tool that returns bufferId]
|
|
128
|
-
-> buffer_edit(bufferId, old, new)
|
|
129
|
-
-> buffer_get_chunk(bufferId, limit=50000)
|
|
130
|
-
-> confluence_draft_create(..., bufferId=bufferId)
|
|
131
|
-
-> User publishes via Confluence UI
|
|
132
|
-
\`\`\`
|
|
133
|
-
|
|
134
|
-
---
|
|
63
|
+
## Element ID System (Key Concept)
|
|
135
64
|
|
|
136
|
-
|
|
65
|
+
Every XHTML element gets a stable ID. Use IDs for precise positioning:
|
|
137
66
|
|
|
138
|
-
### fullurl - Clickable Links (display only)
|
|
139
67
|
\`\`\`
|
|
140
|
-
|
|
141
|
-
fullurl("123456") -> Confluence page URL
|
|
142
|
-
\`\`\`
|
|
143
|
-
WARNING: Never persist fullurl output to Jira/Confluence
|
|
68
|
+
structure: [{id:1, type:"h1"}, {id:2, type:"p"}, {id:3, type:"ul"}]
|
|
144
69
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
70
|
+
buffer_edit(bufferId, after=1, content="<p>New</p>") → Insert after h1
|
|
71
|
+
buffer_edit(bufferId, replace=2, content="<p>Updated</p>") → Replace p
|
|
72
|
+
buffer_edit(bufferId, remove=3) → Delete ul
|
|
73
|
+
buffer_edit(bufferId, append=true, plantuml="@startuml...") → Add at end
|
|
149
74
|
\`\`\`
|
|
150
75
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
## Decision Tree
|
|
154
|
-
|
|
155
|
-
| Need | Action |
|
|
156
|
-
|------|--------|
|
|
157
|
-
| Create page with diagram | \`help(topic="plantuml")\` then \`help(topic="storage")\` |
|
|
158
|
-
| Create/update page | \`help(topic="storage")\` |
|
|
159
|
-
| Search Confluence | \`help(topic="cql")\` |
|
|
160
|
-
| Search Jira | \`jira_get_issue_types()\` then \`help(topic="jql")\` |
|
|
161
|
-
| User's worklogs | \`tempo_get_user_info()\` first |
|
|
162
|
-
| Write to Confluence | \`confluence_get_current_user_space()\` if restricted |
|
|
76
|
+
**IDs are STABLE** - never change when content is inserted/deleted.
|
|
77
|
+
See \`help(topic="buffers")\` for full details.
|
|
163
78
|
`;
|
|
164
79
|
// JQL syntax guide
|
|
165
80
|
const JQL_HELP = `# JQL Syntax Guide
|
|
@@ -260,31 +175,25 @@ OK: (text~"term1" OR text~"term2") - Each term needs its own text~ operator
|
|
|
260
175
|
- Date functions: now(), startOfDay(), startOfWeek(), startOfMonth()
|
|
261
176
|
- Relative dates: now("-7d") = 7 days ago
|
|
262
177
|
- Results are auto-fetched (up to 5000) and buffered for large responses`;
|
|
263
|
-
// Confluence storage format (
|
|
264
|
-
const STORAGE_FORMAT_HELP = `# Confluence Storage Format
|
|
178
|
+
// Confluence storage format (XHTML syntax only)
|
|
179
|
+
const STORAGE_FORMAT_HELP = `# Confluence Storage Format (XHTML)
|
|
265
180
|
|
|
266
|
-
|
|
181
|
+
All tags must be closed (XML rules). For editing workflow, see \`help(topic="buffers")\`.
|
|
267
182
|
|
|
268
|
-
##
|
|
183
|
+
## CRITICAL: CDATA Usage
|
|
269
184
|
|
|
270
|
-
|
|
271
|
-
\`\`\`
|
|
272
|
-
confluence_draft_create(spaceKey, title, content) -> draftId, bufferId, url
|
|
273
|
-
[user previews via url]
|
|
274
|
-
buffer_edit_xhtml(bufferId, ...) [repeat as needed]
|
|
275
|
-
confluence_draft_save(draftId, bufferId) [checkpoint, returns new draftId and url]
|
|
276
|
-
[user publishes via Confluence UI]
|
|
277
|
-
\`\`\`
|
|
185
|
+
**NEVER wrap content in \`<![CDATA[...]]>\`**
|
|
278
186
|
|
|
279
|
-
|
|
280
|
-
\`\`\`
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
\`\`\`
|
|
187
|
+
CDATA is ONLY used inside \`<ac:plain-text-body>\` elements (code blocks, PlantUML):
|
|
188
|
+
\`\`\`xml
|
|
189
|
+
<!-- CORRECT: CDATA inside ac:plain-text-body -->
|
|
190
|
+
<ac:structured-macro ac:name="code">
|
|
191
|
+
<ac:plain-text-body><![CDATA[code here]]></ac:plain-text-body>
|
|
192
|
+
</ac:structured-macro>
|
|
286
193
|
|
|
287
|
-
|
|
194
|
+
<!-- WRONG: CDATA wrapping content -->
|
|
195
|
+
<![CDATA[<h1>Title</h1>]]>
|
|
196
|
+
\`\`\`
|
|
288
197
|
|
|
289
198
|
## Basic Elements
|
|
290
199
|
|
|
@@ -293,18 +202,18 @@ confluence_draft_create(spaceKey, title, bufferId=bufferId) -> draftId, url
|
|
|
293
202
|
| Paragraph | \`<p>text</p>\` |
|
|
294
203
|
| Headings | \`<h1>\`...\`<h6>\` |
|
|
295
204
|
| Bold/Italic | \`<strong>\`, \`<em>\` |
|
|
296
|
-
| Code | \`<code>text</code>\` |
|
|
205
|
+
| Code inline | \`<code>text</code>\` |
|
|
297
206
|
| Link | \`<a href="url">text</a>\` |
|
|
298
|
-
| List | \`<ul><li>item</li></ul>\` |
|
|
207
|
+
| List | \`<ul><li>item</li></ul>\` or \`<ol>\` |
|
|
299
208
|
|
|
300
209
|
## Tables
|
|
301
210
|
\`\`\`xml
|
|
302
211
|
<table><tbody>
|
|
303
|
-
<tr><th>
|
|
304
|
-
<tr><td>
|
|
212
|
+
<tr><th>Header1</th><th>Header2</th></tr>
|
|
213
|
+
<tr><td>Cell1</td><td>Cell2</td></tr>
|
|
305
214
|
</tbody></table>
|
|
306
215
|
\`\`\`
|
|
307
|
-
Merge: \`colspan="2"\`, \`rowspan="2"\`
|
|
216
|
+
Merge cells: \`colspan="2"\`, \`rowspan="2"\`
|
|
308
217
|
|
|
309
218
|
## Layouts
|
|
310
219
|
\`\`\`xml
|
|
@@ -315,507 +224,320 @@ Merge: \`colspan="2"\`, \`rowspan="2"\`
|
|
|
315
224
|
</ac:layout-section>
|
|
316
225
|
</ac:layout>
|
|
317
226
|
\`\`\`
|
|
318
|
-
Types: single
|
|
227
|
+
Types: \`single\`, \`two_equal\`, \`two_left_sidebar\`, \`two_right_sidebar\`, \`three_equal\`
|
|
319
228
|
|
|
320
229
|
## Page Links
|
|
321
230
|
\`\`\`xml
|
|
322
|
-
<ac:link><ri:page ri:content-title="Page"/>
|
|
323
|
-
<ac:plain-text-link-body><![CDATA[
|
|
231
|
+
<ac:link><ri:page ri:content-title="Page Title"/>
|
|
232
|
+
<ac:plain-text-link-body><![CDATA[Link Text]]></ac:plain-text-link-body>
|
|
324
233
|
</ac:link>
|
|
325
234
|
\`\`\`
|
|
326
|
-
Cross-space: add \`ri:space-key="KEY"\`
|
|
235
|
+
Cross-space: add \`ri:space-key="KEY"\` to ri:page
|
|
327
236
|
|
|
328
237
|
## Images
|
|
329
238
|
\`\`\`xml
|
|
330
|
-
<ac:image ac:width="300"><ri:attachment ri:filename="
|
|
331
|
-
<ac:image><ri:url ri:value="https
|
|
239
|
+
<ac:image ac:width="300"><ri:attachment ri:filename="image.png"/></ac:image>
|
|
240
|
+
<ac:image><ri:url ri:value="https://example.com/img.png"/></ac:image>
|
|
332
241
|
\`\`\`
|
|
333
242
|
|
|
334
243
|
## Task List
|
|
335
244
|
\`\`\`xml
|
|
336
245
|
<ac:task-list>
|
|
337
|
-
<ac:task>
|
|
338
|
-
<ac:task-status>incomplete</ac:task-status>
|
|
339
|
-
<ac:task-body>Todo</ac:task-body>
|
|
340
|
-
</ac:task>
|
|
246
|
+
<ac:task><ac:task-status>incomplete</ac:task-status><ac:task-body>Todo item</ac:task-body></ac:task>
|
|
341
247
|
</ac:task-list>
|
|
342
248
|
\`\`\`
|
|
343
249
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
CSS-like selectors to target elements:
|
|
349
|
-
- Tag: \`p\`, \`table\`, \`h1\`
|
|
350
|
-
- Namespaced: \`ac:structured-macro\`, \`ri:page\`
|
|
351
|
-
- Attribute: \`[ac:name="plantuml"]\`, \`ac:structured-macro[ac:name="code"]\`
|
|
352
|
-
- Pseudo: \`:nth-child(2)\`, \`:first-child\`, \`:last-child\`
|
|
353
|
-
- Descendant: \`table tbody tr\`
|
|
354
|
-
- Direct child: \`ul > li\`
|
|
355
|
-
|
|
356
|
-
### Operations
|
|
357
|
-
|
|
358
|
-
| Op | Use | Required params |
|
|
359
|
-
|----|-----|-----------------|
|
|
360
|
-
| insert | Add element | selector, position, content |
|
|
361
|
-
| update | Change content/attrs | selector, content or attributes |
|
|
362
|
-
| remove | Delete element | selector |
|
|
363
|
-
| move | Relocate element | selector, targetSelector, position |
|
|
364
|
-
| wrap | Wrap with parent | selector, content |
|
|
365
|
-
| insert-plantuml | Add diagram | selector, position, plantuml |
|
|
366
|
-
| update-plantuml | Edit diagram | selector, plantuml |
|
|
367
|
-
|
|
368
|
-
Positions: \`before\`, \`after\`, \`inside-start\`, \`inside-end\`
|
|
369
|
-
|
|
370
|
-
### Examples
|
|
371
|
-
|
|
372
|
-
**Add row to table:**
|
|
373
|
-
\`\`\`
|
|
374
|
-
buffer_edit_xhtml(bufferId,
|
|
375
|
-
operation="insert",
|
|
376
|
-
selector="table tbody tr:last-child",
|
|
377
|
-
position="after",
|
|
378
|
-
content="<tr><td>New</td><td>Row</td></tr>")
|
|
379
|
-
\`\`\`
|
|
380
|
-
|
|
381
|
-
**Update heading:**
|
|
382
|
-
\`\`\`
|
|
383
|
-
buffer_edit_xhtml(bufferId,
|
|
384
|
-
operation="update",
|
|
385
|
-
selector="h1",
|
|
386
|
-
content="<h1>New Title</h1>")
|
|
387
|
-
\`\`\`
|
|
388
|
-
|
|
389
|
-
**Insert PlantUML (auto-validates + wraps in macro):**
|
|
390
|
-
\`\`\`
|
|
391
|
-
buffer_edit_xhtml(bufferId,
|
|
392
|
-
operation="insert-plantuml",
|
|
393
|
-
selector="h2:first-child",
|
|
394
|
-
position="after",
|
|
395
|
-
plantuml="@startuml\\nA -> B: msg\\n@enduml")
|
|
396
|
-
\`\`\`
|
|
397
|
-
|
|
398
|
-
**Remove element:**
|
|
399
|
-
\`\`\`
|
|
400
|
-
buffer_edit_xhtml(bufferId,
|
|
401
|
-
operation="remove",
|
|
402
|
-
selector="ac:structured-macro[ac:name=\\"toc\\"]")
|
|
403
|
-
\`\`\`
|
|
404
|
-
|
|
405
|
-
Options: \`matchIndex=N\` (0-based) or \`matchAll=true\` for multiple matches`;
|
|
406
|
-
// PlantUML syntax guide
|
|
407
|
-
const PLANTUML_HELP = `# PlantUML in Confluence - Syntax Guide
|
|
408
|
-
|
|
409
|
-
## PlantUML Workflow
|
|
410
|
-
|
|
411
|
-
PlantUML diagrams must be inserted using \`buffer_edit_xhtml\` with the \`insert-plantuml\` operation.
|
|
412
|
-
Raw @startuml blocks in content are not supported.
|
|
413
|
-
|
|
414
|
-
### Required Workflow
|
|
415
|
-
\`\`\`
|
|
416
|
-
1. Create XHTML content (WITHOUT PlantUML)
|
|
417
|
-
2. plantuml_validate(code="@startuml...") <- Validate syntax first
|
|
418
|
-
3. buffer_edit_xhtml(bufferId, operation="insert-plantuml", plantuml=code, semanticPosition="...")
|
|
419
|
-
4. confluence_draft_create/save(bufferId)
|
|
420
|
-
5. User publishes via Confluence UI
|
|
421
|
-
\`\`\`
|
|
422
|
-
|
|
423
|
-
### Example
|
|
424
|
-
\`\`\`
|
|
425
|
-
buffer_edit_xhtml(bufferId,
|
|
426
|
-
operation="insert-plantuml",
|
|
427
|
-
semanticPosition="after-title",
|
|
428
|
-
plantuml="@startuml\\nA -> B\\n@enduml")
|
|
250
|
+
## Emoticons
|
|
251
|
+
\`\`\`xml
|
|
252
|
+
<ac:emoticon ac:name="tick"/> <!-- tick, cross, warning, information -->
|
|
253
|
+
<ac:emoticon ac:name="thumbs-up"/> <!-- thumbs-up/down, plus, minus -->
|
|
429
254
|
\`\`\`
|
|
430
|
-
Validation happens automatically during insertion.
|
|
431
255
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
plantuml_validate(code="@startuml\\nA -> B: msg\\n@enduml")
|
|
256
|
+
## Code Block Macro
|
|
257
|
+
\`\`\`xml
|
|
258
|
+
<ac:structured-macro ac:name="code" ac:schema-version="1">
|
|
259
|
+
<ac:parameter ac:name="language">python</ac:parameter>
|
|
260
|
+
<ac:plain-text-body><![CDATA[def hello(): pass]]></ac:plain-text-body>
|
|
261
|
+
</ac:structured-macro>
|
|
439
262
|
\`\`\`
|
|
440
|
-
Returns: \`valid\`, \`diagramType\`, \`errors\` with line numbers.
|
|
441
|
-
Docker container starts automatically on first use.
|
|
442
263
|
|
|
443
|
-
|
|
444
|
-
\`\`\`
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
"errors": [{"line": 3, "message": "Syntax error: unknown arrow type"}]
|
|
449
|
-
}
|
|
264
|
+
## Info/Warning Panels
|
|
265
|
+
\`\`\`xml
|
|
266
|
+
<ac:structured-macro ac:name="info" ac:schema-version="1">
|
|
267
|
+
<ac:rich-text-body><p>Info message</p></ac:rich-text-body>
|
|
268
|
+
</ac:structured-macro>
|
|
450
269
|
\`\`\`
|
|
270
|
+
Types: \`info\`, \`note\`, \`warning\`, \`tip\`
|
|
451
271
|
|
|
452
|
-
|
|
453
|
-
\`\`\`
|
|
454
|
-
plantuml_render(code="...", format="ascii|svg|png|eps")
|
|
455
|
-
\`\`\`
|
|
456
|
-
Returns: rendered content (ASCII/SVG inline, PNG/EPS as base64).
|
|
457
|
-
Large renders return \`bufferId\` for retrieval.
|
|
272
|
+
## Macro Rules
|
|
458
273
|
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
274
|
+
| Element | Content Allowed |
|
|
275
|
+
|---------|-----------------|
|
|
276
|
+
| \`ac:parameter\` | Plain text only (no child elements) |
|
|
277
|
+
| \`ac:plain-text-body\` | Raw text, wrap in \`<![CDATA[...]]>\` |
|
|
278
|
+
| \`ac:rich-text-body\` | XHTML for info/warning panels |
|
|
464
279
|
|
|
465
280
|
---
|
|
466
281
|
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
282
|
+
For element ID editing workflow, see \`help(topic="buffers")\`.
|
|
283
|
+
For PlantUML diagrams, see \`help(topic="plantuml")\`.`;
|
|
284
|
+
// PlantUML syntax guide (Confluence-specific only - LLMs know PlantUML syntax)
|
|
285
|
+
const PLANTUML_HELP = `# PlantUML in Confluence
|
|
470
286
|
|
|
287
|
+
## Workflow
|
|
471
288
|
\`\`\`
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
289
|
+
1. plantuml_validate(code="@startuml...@enduml") ← Validate FIRST
|
|
290
|
+
2. buffer_edit(bufferId, after=ID, plantuml="@startuml...@enduml")
|
|
291
|
+
→ Auto-wraps in Confluence macro, auto-validates
|
|
292
|
+
3. confluence_draft_save(draftId, bufferId)
|
|
476
293
|
\`\`\`
|
|
477
294
|
|
|
478
|
-
|
|
479
|
-
- \`after-title\`: After first h1 or h2
|
|
480
|
-
- \`after-heading\`: After first heading (h1-h6)
|
|
481
|
-
- \`before-content\`: At document start
|
|
482
|
-
- \`end\`: At document end
|
|
483
|
-
- \`after-toc\`: After table of contents macro
|
|
484
|
-
|
|
485
|
-
---
|
|
486
|
-
|
|
487
|
-
## Confluence Macro Structure
|
|
295
|
+
## Tools
|
|
488
296
|
|
|
489
|
-
|
|
297
|
+
| Tool | Use |
|
|
298
|
+
|------|-----|
|
|
299
|
+
| \`plantuml_validate(code)\` | Check syntax before insert |
|
|
300
|
+
| \`plantuml_render(code, format)\` | Preview: ascii, svg, png, eps |
|
|
301
|
+
| \`plantuml_status()\` | Check Docker container status |
|
|
490
302
|
|
|
303
|
+
## Confluence Macro Structure (auto-generated by buffer_edit)
|
|
491
304
|
\`\`\`xml
|
|
492
|
-
<ac:structured-macro ac:name="plantuml" ac:schema-version="1" ac:macro-id="
|
|
305
|
+
<ac:structured-macro ac:name="plantuml" ac:schema-version="1" ac:macro-id="uuid">
|
|
493
306
|
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
|
|
494
307
|
<ac:plain-text-body><![CDATA[
|
|
495
308
|
@startuml
|
|
496
|
-
'
|
|
309
|
+
' diagram code
|
|
497
310
|
@enduml
|
|
498
311
|
]]></ac:plain-text-body>
|
|
499
312
|
</ac:structured-macro>
|
|
500
313
|
\`\`\`
|
|
501
314
|
|
|
502
|
-
|
|
503
|
-
- \`ac:name="plantuml"\` - Macro identifier
|
|
504
|
-
- \`ac:schema-version="1"\` - Must be "1"
|
|
505
|
-
- \`ac:macro-id\` - Any unique ID (use "auto-generated" or UUID)
|
|
506
|
-
|
|
507
|
-
**Required parameter:**
|
|
508
|
-
- \`atlassian-macro-output-type=INLINE\` - Renders diagram inline
|
|
509
|
-
|
|
510
|
-
**Required body:**
|
|
511
|
-
- \`ac:plain-text-body\` with \`CDATA\` wrapping
|
|
512
|
-
- Newline before \`@startuml\` marker
|
|
315
|
+
## Critical Rules
|
|
513
316
|
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
317
|
+
1. **Always validate first**: \`plantuml_validate(code)\` before inserting
|
|
318
|
+
2. **Use plantuml parameter**: \`buffer_edit(..., plantuml="...")\` not \`content\`
|
|
319
|
+
3. **Include markers**: Always use \`@startuml\` and \`@enduml\`
|
|
517
320
|
|
|
518
|
-
|
|
519
|
-
|---------|----------|
|
|
520
|
-
| Sequence | API calls, request/response flows, message exchanges between systems |
|
|
521
|
-
| Class | Data models, entity relationships, object structures |
|
|
522
|
-
| Activity | Workflows, business processes, decision trees, algorithms |
|
|
523
|
-
| Component | System architecture, module dependencies, deployment structure |
|
|
524
|
-
| State | Lifecycle states, status transitions, finite state machines |
|
|
525
|
-
| Use Case | User requirements, system features, actor interactions |
|
|
526
|
-
| Context (C4) | High-level system overview, external dependencies |
|
|
527
|
-
| Container (C4) | Application architecture, runtime components |
|
|
528
|
-
| Component (C4) | Internal structure of a container/service |
|
|
321
|
+
## Stdlib Includes (C4, AWS, Azure)
|
|
529
322
|
|
|
530
|
-
|
|
323
|
+
C4-PlantUML, AWS icons, and Azure diagrams are supported via \`!include\`:
|
|
531
324
|
|
|
532
|
-
## Diagram Types
|
|
533
|
-
|
|
534
|
-
### Sequence Diagram
|
|
535
|
-
**Use for:** API call flows, request/response interactions, message exchanges, authentication flows
|
|
536
325
|
\`\`\`
|
|
537
326
|
@startuml
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
Bob --> Alice: Response
|
|
327
|
+
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml
|
|
328
|
+
Person(user, "User")
|
|
329
|
+
System(sys, "My System")
|
|
330
|
+
Rel(user, sys, "Uses")
|
|
543
331
|
@enduml
|
|
544
332
|
\`\`\`
|
|
545
333
|
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
class User {
|
|
551
|
-
+id: string
|
|
552
|
-
+name: string
|
|
553
|
-
+login(): boolean
|
|
554
|
-
}
|
|
334
|
+
**Supported URL prefixes (whitelisted):**
|
|
335
|
+
- \`https://raw.githubusercontent.com/plantuml-stdlib/\` - C4, Azure, Kubernetes, etc.
|
|
336
|
+
- \`https://raw.githubusercontent.com/plantuml/\` - Official PlantUML stdlib
|
|
337
|
+
- \`https://raw.githubusercontent.com/awslabs/aws-icons-for-plantuml/\` - AWS icons
|
|
555
338
|
|
|
556
|
-
|
|
557
|
-
+items: Item[]
|
|
558
|
-
+total(): number
|
|
559
|
-
}
|
|
339
|
+
**Include files are expanded client-side** before validation and Confluence upload.
|
|
560
340
|
|
|
561
|
-
|
|
562
|
-
@enduml
|
|
563
|
-
\`\`\`
|
|
341
|
+
## Quick Examples
|
|
564
342
|
|
|
565
|
-
|
|
566
|
-
**Use for:** Workflows, business processes, decision trees, algorithms, approval flows
|
|
343
|
+
**Sequence:**
|
|
567
344
|
\`\`\`
|
|
568
345
|
@startuml
|
|
569
|
-
|
|
570
|
-
:
|
|
571
|
-
if (Valid?) then (yes)
|
|
572
|
-
:Process;
|
|
573
|
-
else (no)
|
|
574
|
-
:Reject;
|
|
575
|
-
endif
|
|
576
|
-
stop
|
|
346
|
+
Alice -> Bob: Request
|
|
347
|
+
Bob --> Alice: Response
|
|
577
348
|
@enduml
|
|
578
349
|
\`\`\`
|
|
579
350
|
|
|
580
|
-
|
|
581
|
-
**Use for:** System architecture, module dependencies, package structure, deployment topology
|
|
351
|
+
**Class:**
|
|
582
352
|
\`\`\`
|
|
583
353
|
@startuml
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
package "Backend" {
|
|
590
|
-
[API Server]
|
|
591
|
-
[Database]
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
[Web App] --> [API Server]
|
|
595
|
-
[Mobile App] --> [API Server]
|
|
596
|
-
[API Server] --> [Database]
|
|
354
|
+
class User { +name: string }
|
|
355
|
+
class Order
|
|
356
|
+
User --> Order
|
|
597
357
|
@enduml
|
|
598
358
|
\`\`\`
|
|
599
359
|
|
|
600
|
-
|
|
601
|
-
**Use for:** Object lifecycle, status transitions, order states, ticket workflows
|
|
360
|
+
**C4 Context Diagram:**
|
|
602
361
|
\`\`\`
|
|
603
362
|
@startuml
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
363
|
+
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml
|
|
364
|
+
Person(user, "Customer", "Uses the system")
|
|
365
|
+
System(sys, "E-Commerce", "Online store")
|
|
366
|
+
System_Ext(pay, "Payment Gateway", "Processes payments")
|
|
367
|
+
Rel(user, sys, "Shops")
|
|
368
|
+
Rel(sys, pay, "Pays via")
|
|
610
369
|
@enduml
|
|
611
370
|
\`\`\`
|
|
612
371
|
|
|
613
|
-
|
|
614
|
-
**Use for:** User requirements, feature overview, actor roles, system boundaries
|
|
615
|
-
\`\`\`
|
|
616
|
-
@startuml
|
|
617
|
-
actor User
|
|
618
|
-
actor Admin
|
|
372
|
+
## Supported Diagram Types
|
|
619
373
|
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
374
|
+
| Type | Marker | Use Case |
|
|
375
|
+
|------|--------|----------|
|
|
376
|
+
| **sequence** | \`@startuml\` | API flows, service interactions, request/response |
|
|
377
|
+
| **class** | \`@startuml\` | OOP design, data models, inheritance |
|
|
378
|
+
| **activity** | \`@startuml\` | Workflows, business processes, flowcharts |
|
|
379
|
+
| **state** | \`@startuml\` | State machines, lifecycle, status transitions |
|
|
380
|
+
| **component** | \`@startuml\` | System architecture, modules, dependencies |
|
|
381
|
+
| **usecase** | \`@startuml\` | User stories, actors, requirements |
|
|
382
|
+
| **object** | \`@startuml\` | Instance diagrams, runtime snapshots |
|
|
383
|
+
| **deployment** | \`@startuml\` | Infrastructure, nodes, servers, containers |
|
|
384
|
+
| **timing** | \`@startuml\` | Time-based signals, hardware timing |
|
|
385
|
+
| **c4** | \`@startuml\` + \`!include C4_*.puml\` | C4 Model (requires stdlib include) |
|
|
386
|
+
| **mindmap** | \`@startmindmap\` | Brainstorming, hierarchical ideas |
|
|
387
|
+
| **gantt** | \`@startgantt\` | Project schedules, timelines |
|
|
388
|
+
| **wbs** | \`@startwbs\` | Work Breakdown Structure, task hierarchy |
|
|
389
|
+
| **json** | \`@startjson\` | JSON data visualization |
|
|
390
|
+
| **yaml** | \`@startyaml\` | YAML data visualization |
|
|
625
391
|
|
|
626
|
-
|
|
627
|
-
User --> UC2
|
|
628
|
-
Admin --> UC1
|
|
629
|
-
Admin --> UC3
|
|
630
|
-
@enduml
|
|
631
|
-
\`\`\`
|
|
392
|
+
**Note**: C4 diagrams require \`!include\` to load the C4 library. Use \`C4_Context.puml\`, \`C4_Container.puml\`, \`C4_Component.puml\`, or \`C4_Dynamic.puml\` from plantuml-stdlib.
|
|
632
393
|
|
|
633
|
-
|
|
394
|
+
## Troubleshooting
|
|
634
395
|
|
|
635
|
-
|
|
396
|
+
| Error | Fix |
|
|
397
|
+
|-------|-----|
|
|
398
|
+
| "PlantUML syntax error" | Run \`plantuml_validate\` first |
|
|
399
|
+
| "Element not found" | Check \`buffer_get_structure\` for valid IDs |
|
|
400
|
+
| "XHTML invalid" | Create fresh buffer, insert diagram |
|
|
636
401
|
|
|
637
|
-
|
|
402
|
+
## Advanced: Direct Macro Embedding
|
|
638
403
|
|
|
639
|
-
|
|
640
|
-
**Use for:** High-level system overview, stakeholders, external dependencies, system boundaries
|
|
641
|
-
\`\`\`
|
|
642
|
-
@startuml
|
|
643
|
-
title System Context
|
|
644
|
-
|
|
645
|
-
skinparam rectangle {
|
|
646
|
-
BackgroundColor<<person>> #08427B
|
|
647
|
-
FontColor<<person>> white
|
|
648
|
-
BackgroundColor<<system>> #1168BD
|
|
649
|
-
FontColor<<system>> white
|
|
650
|
-
BackgroundColor<<external>> #999999
|
|
651
|
-
FontColor<<external>> white
|
|
652
|
-
}
|
|
404
|
+
For pages with **multiple diagrams**, reduce tool calls by embedding macros directly:
|
|
653
405
|
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
406
|
+
\`\`\`
|
|
407
|
+
1. plantuml_validate(code) × N ← Validate ALL diagrams first (parallel)
|
|
408
|
+
2. buffer_create with embedded macros:
|
|
409
|
+
\`\`\`
|
|
657
410
|
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
411
|
+
\`\`\`xml
|
|
412
|
+
<h2>Architecture</h2>
|
|
413
|
+
<ac:structured-macro ac:name="plantuml" ac:schema-version="1" ac:macro-id="diag-1">
|
|
414
|
+
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
|
|
415
|
+
<ac:plain-text-body><![CDATA[@startuml
|
|
416
|
+
...validated code...
|
|
417
|
+
@enduml]]></ac:plain-text-body>
|
|
418
|
+
</ac:structured-macro>
|
|
419
|
+
<h2>Sequence Flow</h2>
|
|
420
|
+
<ac:structured-macro ac:name="plantuml" ac:schema-version="1" ac:macro-id="diag-2">
|
|
421
|
+
...second diagram...
|
|
422
|
+
</ac:structured-macro>
|
|
661
423
|
\`\`\`
|
|
662
424
|
|
|
663
|
-
### Container Diagram
|
|
664
|
-
**Use for:** Application architecture, runtime components, technology choices, data stores
|
|
665
425
|
\`\`\`
|
|
666
|
-
|
|
667
|
-
|
|
426
|
+
3. confluence_draft_create(bufferId=...)
|
|
427
|
+
\`\`\`
|
|
668
428
|
|
|
669
|
-
|
|
670
|
-
BackgroundColor<<container>> #438DD5
|
|
671
|
-
FontColor<<container>> white
|
|
672
|
-
BackgroundColor<<database>> #438DD5
|
|
673
|
-
FontColor<<database>> white
|
|
674
|
-
}
|
|
429
|
+
**Benefit**: 3 diagrams = 5 calls (vs 8 with buffer_edit per diagram)
|
|
675
430
|
|
|
676
|
-
|
|
431
|
+
For element ID editing: \`help(topic="buffers")\``;
|
|
432
|
+
// Buffers help guide (canonical element ID reference)
|
|
433
|
+
const BUFFERS_HELP = `# Buffer & Element ID Editing
|
|
677
434
|
|
|
678
|
-
|
|
679
|
-
rectangle "Web App\\n[React]" <<container>> as web
|
|
680
|
-
rectangle "API Server\\n[Node.js]" <<container>> as api
|
|
681
|
-
database "Database\\n[PostgreSQL]" <<database>> as db
|
|
682
|
-
}
|
|
435
|
+
## Element ID System (Key Concept)
|
|
683
436
|
|
|
684
|
-
|
|
685
|
-
web --> api : Calls [REST/JSON]
|
|
686
|
-
api --> db : Reads/Writes [SQL]
|
|
687
|
-
@enduml
|
|
688
|
-
\`\`\`
|
|
437
|
+
Every XHTML element gets a **stable** ID. IDs never change when content is inserted/deleted.
|
|
689
438
|
|
|
690
|
-
### Component Diagram
|
|
691
|
-
**Use for:** Internal structure of a container, code organization, module responsibilities
|
|
692
439
|
\`\`\`
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
package "API Application" {
|
|
702
|
-
component "Auth Controller" as auth
|
|
703
|
-
component "User Controller" as userCtrl
|
|
704
|
-
component "User Service" as service
|
|
705
|
-
database "User Repository" as repo
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
auth --> service : Uses
|
|
709
|
-
userCtrl --> service : Uses
|
|
710
|
-
service --> repo : Queries
|
|
711
|
-
@enduml
|
|
440
|
+
confluence_get_page(pageId) → structure: [
|
|
441
|
+
{ id: 1, type: "h1", text: "Title" },
|
|
442
|
+
{ id: 2, type: "h2", text: "Section" },
|
|
443
|
+
{ id: 3, type: "p", text: "Paragraph..." },
|
|
444
|
+
{ id: 4, type: "plantuml", text: "Diagram" }
|
|
445
|
+
]
|
|
712
446
|
\`\`\`
|
|
713
447
|
|
|
714
|
-
|
|
448
|
+
## buffer_edit Operations (XHTML)
|
|
715
449
|
|
|
716
|
-
|
|
450
|
+
| Operation | Example | Result |
|
|
451
|
+
|-----------|---------|--------|
|
|
452
|
+
| Insert after | \`after=2, content="<p>New</p>"\` | New element after h2, gets id=5 |
|
|
453
|
+
| Insert before | \`before=3, content="<p>New</p>"\` | New element before paragraph |
|
|
454
|
+
| Replace | \`replace=4, plantuml="@startuml..."\` | Replaces diagram, keeps id=4 |
|
|
455
|
+
| Remove | \`remove=3\` | Deletes paragraph |
|
|
456
|
+
| Append | \`append=true, content="<p>End</p>"\` | Adds at document end |
|
|
717
457
|
|
|
718
|
-
|
|
719
|
-
\`\`\`
|
|
720
|
-
@startuml
|
|
721
|
-
skinparam backgroundColor #FEFEFE
|
|
722
|
-
skinparam roundcorner 10
|
|
458
|
+
**Content options:** \`content="<xhtml>"\` or \`plantuml="@startuml..."\`
|
|
723
459
|
|
|
724
|
-
|
|
725
|
-
BackgroundColor #E8F4FD
|
|
726
|
-
BorderColor #2196F3
|
|
727
|
-
ArrowColor #1976D2
|
|
728
|
-
}
|
|
460
|
+
## Batch Operations (Efficient)
|
|
729
461
|
|
|
730
|
-
|
|
731
|
-
@enduml
|
|
732
|
-
\`\`\`
|
|
462
|
+
For multiple edits, use \`operations\` array - **much faster** than multiple calls:
|
|
733
463
|
|
|
734
|
-
### Notes
|
|
735
464
|
\`\`\`
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
465
|
+
buffer_edit(bufferId, operations=[
|
|
466
|
+
{ after: 6, plantuml: "@startuml...@enduml" },
|
|
467
|
+
{ after: 8, plantuml: "@startuml...@enduml" },
|
|
468
|
+
{ after: 10, content: "<p>New paragraph</p>" },
|
|
469
|
+
{ remove: 12 }
|
|
470
|
+
])
|
|
741
471
|
\`\`\`
|
|
742
472
|
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
participant A2
|
|
749
|
-
end box
|
|
473
|
+
**Benefits:**
|
|
474
|
+
- Parse once, serialize once (vs N times for N calls)
|
|
475
|
+
- Single tool call (reduces latency)
|
|
476
|
+
- All insertedIds returned together
|
|
477
|
+
- Operations execute sequentially; stops on first error
|
|
750
478
|
|
|
751
|
-
|
|
752
|
-
participant B1
|
|
753
|
-
end box
|
|
479
|
+
## Complete Workflow
|
|
754
480
|
|
|
755
|
-
A1 -> B1: Request
|
|
756
|
-
@enduml
|
|
757
481
|
\`\`\`
|
|
482
|
+
1. confluence_get_page(pageId) OR confluence_draft_create(...)
|
|
483
|
+
→ bufferId, structure
|
|
758
484
|
|
|
759
|
-
|
|
485
|
+
2. buffer_edit(bufferId, after=2, content="<p>Added</p>")
|
|
486
|
+
→ { insertedIds: [5], structure: [...] }
|
|
760
487
|
|
|
761
|
-
|
|
488
|
+
3. buffer_edit(bufferId, after=5, plantuml="@startuml...")
|
|
489
|
+
→ { insertedIds: [6], structure: [...] }
|
|
762
490
|
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
- No CDATA wrapper around diagram code
|
|
767
|
-
- No newline before \`@startuml\`
|
|
768
|
-
- Missing \`@startuml\`/\`@enduml\` markers
|
|
491
|
+
4. confluence_draft_save(draftId, bufferId)
|
|
492
|
+
→ url for preview
|
|
493
|
+
\`\`\`
|
|
769
494
|
|
|
770
|
-
|
|
771
|
-
- Use exact macro structure shown above
|
|
772
|
-
- Wrap diagram code in CDATA
|
|
773
|
-
- Include \`atlassian-macro-output-type=INLINE\` parameter
|
|
774
|
-
- Start with \`@startuml\` and end with \`@enduml\`
|
|
495
|
+
## Other Buffer Tools
|
|
775
496
|
|
|
776
|
-
|
|
497
|
+
| Tool | Use |
|
|
498
|
+
|------|-----|
|
|
499
|
+
| \`buffer_get_structure(bufferId)\` | View current element IDs |
|
|
500
|
+
| \`buffer_get_element(bufferId, elementId)\` | Get raw XHTML of specific element |
|
|
501
|
+
| \`buffer_get_chunk(bufferId, offset, limit)\` | Read content in chunks |
|
|
502
|
+
| \`buffer_grep(bufferId, pattern, "-C"=2)\` | Search with context |
|
|
503
|
+
| \`buffer_validate_xhtml(bufferId)\` | Check XHTML validity |
|
|
504
|
+
| \`buffer_list()\` | See all active buffers |
|
|
505
|
+
| \`buffer_clear(bufferId)\` | Delete buffer |
|
|
777
506
|
|
|
778
|
-
##
|
|
507
|
+
## Plain/JSON Editing (non-XHTML)
|
|
779
508
|
|
|
780
|
-
**Never use external !include statements:**
|
|
781
509
|
\`\`\`
|
|
782
|
-
|
|
510
|
+
buffer_edit(bufferId, old_string="foo", new_string="bar", replace_all=true)
|
|
783
511
|
\`\`\`
|
|
784
512
|
|
|
785
|
-
|
|
786
|
-
Use native PlantUML syntax instead (see C4-Style examples above).
|
|
513
|
+
## Common Errors & Recovery
|
|
787
514
|
|
|
788
|
-
|
|
515
|
+
| Error | Fix |
|
|
516
|
+
|-------|-----|
|
|
517
|
+
| "Element not found: N" | Check \`buffer_get_structure\` for valid IDs |
|
|
518
|
+
| "Buffer expired" | Re-fetch content, buffers expire in 10 min |
|
|
519
|
+
| Multiple occurrences | Use \`replace_all=true\` for string edit |
|
|
520
|
+
| XHTML parsing error | Check \`suggestedActions\` in error response |
|
|
789
521
|
|
|
790
|
-
|
|
522
|
+
**XHTML Error Recovery**: When \`confluence_draft_create/save\` fails with an XHTML error:
|
|
523
|
+
1. Error response includes \`errorLocation\` (element ID) and \`suggestedActions\`
|
|
524
|
+
2. Use \`buffer_get_element(bufferId, elementId)\` to inspect problematic element
|
|
525
|
+
3. Use \`buffer_edit(bufferId, replace=elementId, content="...")\` to fix
|
|
791
526
|
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
\`\`\`xml
|
|
795
|
-
<ac:structured-macro ac:name="plantuml" ac:schema-version="1" ac:macro-id="diagram-1">
|
|
796
|
-
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
|
|
797
|
-
<ac:plain-text-body><![CDATA[
|
|
798
|
-
@startuml
|
|
799
|
-
skinparam backgroundColor #FEFEFE
|
|
800
|
-
|
|
801
|
-
participant "Client" as C
|
|
802
|
-
participant "Server" as S
|
|
803
|
-
database "Database" as DB
|
|
527
|
+
## Tips
|
|
804
528
|
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
]]></ac:plain-text-body>
|
|
811
|
-
</ac:structured-macro>
|
|
812
|
-
\`\`\``;
|
|
529
|
+
- IDs are **stable**: insert between 2 and 3 → new element gets id=5, element 3 unchanged
|
|
530
|
+
- Use \`buffer_get_structure\` after edits to see updated structure
|
|
531
|
+
- Buffers expire in 10 min (24h if modified)
|
|
532
|
+
- XHTML syntax: \`help(topic="storage")\`
|
|
533
|
+
- PlantUML: \`help(topic="plantuml")\``;
|
|
813
534
|
// Topic content map
|
|
814
535
|
const TOPIC_CONTENT = {
|
|
815
536
|
jql: JQL_HELP,
|
|
816
537
|
cql: CQL_HELP,
|
|
817
538
|
storage: STORAGE_FORMAT_HELP,
|
|
818
539
|
plantuml: PLANTUML_HELP,
|
|
540
|
+
buffers: BUFFERS_HELP,
|
|
819
541
|
};
|
|
820
542
|
export function createJiconHelpTools() {
|
|
821
543
|
return {
|
|
@@ -828,18 +550,19 @@ With topic: Returns detailed syntax guide.
|
|
|
828
550
|
Available topics:
|
|
829
551
|
- jql: JQL (Jira Query Language) syntax
|
|
830
552
|
- cql: CQL (Confluence Query Language) syntax
|
|
831
|
-
- storage: Confluence storage format + structure editing (
|
|
553
|
+
- storage: Confluence storage format + structure editing (element IDs)
|
|
832
554
|
- plantuml: PlantUML diagram syntax for Confluence
|
|
555
|
+
- buffers: Buffer management and large response handling
|
|
833
556
|
|
|
834
557
|
Examples:
|
|
835
558
|
help() -> Workflow guide
|
|
836
559
|
help(topic="storage") -> Confluence format guide
|
|
837
|
-
help(topic="
|
|
560
|
+
help(topic="buffers") -> Buffer management guide`,
|
|
838
561
|
inputSchema: z.object({
|
|
839
562
|
topic: z
|
|
840
563
|
.enum(TOPICS)
|
|
841
564
|
.optional()
|
|
842
|
-
.describe('Topic for detailed help: "jql", "cql", "storage", "plantuml"'),
|
|
565
|
+
.describe('Topic for detailed help: "jql", "cql", "storage", "plantuml", "buffers"'),
|
|
843
566
|
}),
|
|
844
567
|
handler: async (args) => {
|
|
845
568
|
const { topic } = args;
|