You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/connectors/confluence/README.md
+12-2Lines changed: 12 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -171,6 +171,14 @@ If your Confluence space has existing pages with common names, add a `titleTempl
171
171
|`(CW) %title%`| (CW) Problem |
172
172
|`CW.Core - %title%`| CW.Core - Problem |
173
173
174
+
### Duplicate titles
175
+
176
+
Confluence requires page titles to be **unique within a space**. If an AIDOS artifact's derived title collides with an existing page elsewhere in the target space (not under the AIDOS root), the connector renames the new page by appending a numeric suffix: `Title`, then `Title (1)`, then `Title (2)`.
177
+
178
+
The connector caps this at **3 total attempts** and hard-fails when all attempts are exhausted. Each rename logs two `WARNING:` lines in the publish output — one naming the collision, one explaining how to resolve it. If you see these warnings, rename the source file (or the conflicting Confluence pages) so titles are unique — the cap exists specifically to force the issue to be resolved rather than silently accumulating duplicates.
179
+
180
+
On re-publish the connector checks the same suffix ladder, so previously-renamed pages are updated in place rather than creating a new copy each run.
181
+
174
182
### Multiple publish targets
175
183
176
184
To add more targets later, add another key under `publish`:
@@ -222,7 +230,7 @@ cd aidos/src/connectors/confluence
222
230
npm install
223
231
```
224
232
225
-
Only one dependency (`marked` for markdown parsing). No test suite — the connector has been production-tested by running against real Confluence spaces.
233
+
Only one dependency (`marked` for markdown parsing). Run `npm test` from this directory to execute the unit test suite (Node's built-in `node --test` runner, no external deps).
226
234
227
235
### Local dry-run
228
236
@@ -258,12 +266,14 @@ Use this only when you need to debug publish behaviour outside CI — the canoni
258
266
```
259
267
src/connectors/confluence/
260
268
├── publish.js ← Single entry point — walks .aidos/, converts markdown, publishes
269
+
├── title-conflict.js ← Pure helpers for duplicate-title detection and suffix resolution
270
+
├── title-conflict.test.js ← Unit tests for title-conflict helpers (node --test)
261
271
├── manifest.schema.json ← JSON Schema for .aidos/manifest.json
The script is ~700 lines, self-contained, ESM, uses Node 20+ built-in fetch. Follow the structure (constants → auth → API helpers → markdown transforms → publish logic → main).
276
+
The connector is ESM, uses Node 20+ built-in fetch, and has two modules: `publish.js` (the orchestration script) and `title-conflict.js` (pure helpers for duplicate-title handling). Follow the structure (constants → auth → API helpers → markdown transforms → publish logic → main).
`Cannot publish "${baseTitle}" to Confluence: the titles "${baseTitle}", "${baseTitle} (1)", and "${baseTitle} (2)" are all taken in the target space. `+
56
+
`Confluence requires page titles to be unique within a space. `+
57
+
`Rename the source file (or the conflicting Confluence pages) and re-run the publish.`,
58
+
);
59
+
}
60
+
}
61
+
}
62
+
}
63
+
64
+
/**
65
+
* Try to find a page the connector previously created, tolerant of numeric
66
+
* suffix renames. Walks the same ladder as createWithRetryOnDuplicate — plain,
67
+
* (1), (2), up to MAX_TITLE_ATTEMPTS — and returns the first hit.
0 commit comments