--- name: "confluence-publish" description: "Publish generated design documents (DD, SD, TD) to Confluence. Use when the user approves a generated artifact and requests Confluence publish, or explicitly asks to push a document to Confluence." license: "MIT" metadata: author: "Srinivas K, Mahesvaran S, Srikanth Y, Thirukumaran V, Vignesh V R" version: "1.0.0" --- # Confluence Publish Workflow ## Overview Shared workflow for publishing generated design documents to Confluence. Called after user approves a generated artifact. Uses the Rovo MCP to create or update Confluence pages directly from brainstorm files and design templates. ## Prerequisites Checklist - [ ] Confluence MCP server (Rovo) available - [ ] A generated and approved design document - [ ] The brainstorm file (`{workspace}/output/{artifact-name}-brainstorm.md`) — authoritative source for all content - [ ] Optional: Lucid diagram to attach/link ## When to Use - User approves a generated DD/SD/TD and requests Confluence publish - User explicitly requests: "Push this to Confluence" - User requests: "Publish this document" ## Template Strategy Templates are stored as **live Confluence pages** (not local files). This ensures templates always match the latest governance-approved format. **ALWAYS FOLLOW THE TEMPLATE EXACTLY. DO NOT CONDENSE OR LEAVE OUT ANY SECTIONS.** **Template Pages:** - DD Template: page ID `4769349731` (space: ID1) - SD Template: page ID `4769251461` (space: ID1) - TD Template: page ID `4769349990` (space: ID1) ## Step-by-Step Guide ### Step 1: Determine Publish Target Ask the user (if not already known): 1. **Confluence space** — Which space should this be published to? 2. **Parent page** — Should this be a child of an existing page? 3. **Page title** — What should the page be titled? 4. **Update or create** — Is this a new page or an update to an existing page? Search for existing pages if needed, then present: ``` Publishing to Confluence: - Space: [space key] - Parent page: [parent title] (ID: [id]) - Title: [proposed title] - Action: [Create new / Update existing] Proceed? ``` --- ### Step 2: Prepare Content #### Fetch Template and Build Page Body 1. Read the brainstorm file (`{workspace}/output/{artifact-name}-brainstorm.md`) 2. **Fetch the template page** using `getConfluencePage` with `contentFormat: "html"`: - DD Template page ID: `4769349731` - SD Template page ID: `4769251461` - TD Template page ID: `4769349990` 3. The fetched HTML body IS the template structure 4. **Build the populated page body** as HTML: - Replace orange instructional text (`rgb(255,153,31)`) with actual content - Fill empty table cells with data - Add additional table rows for multi-entry tables - Preserve all Confluence macros, emoticons, links, and structural elements exactly #### Content Population Rules - Every section with orange instructional text MUST be replaced with actual design content - Leave governance tables (approval, endorsement) with empty cells — filled post-review - Tables with one template row need additional `` rows for each entry - Preserve all `ac:structured-macro`, `ac:emoticon`, `ac:link` elements exactly - Do NOT add sections that don't exist in the template - Do NOT wrap content in ``, ``, or `` tags #### Handle Diagrams If a Lucid diagram was created, include the Lucid link in the appropriate element. --- ### Step 3: Publish Use the Rovo MCP Confluence tools directly: #### Create New Page Call `createConfluencePage` with: - `cloudId`: Site URL (e.g., `idpchange.atlassian.net`) - `spaceId`: Target space ID - `title`: Page title - `body`: The populated HTML body - `contentFormat`: `"html"` - `parentId` (optional): Parent page ID #### Update Existing Page Call `updateConfluencePage` with: - `cloudId`: Site URL - `pageId`: Page ID to update - `body`: The populated HTML body - `contentFormat`: `"html"` - `title`: Page title #### After Publishing Add labels appropriate to the document type: - DD: `design-direction`, `architecture` - SD: `solution-design`, `architecture` - TD: `technical-design`, `architecture` --- ### Step 4: Confirm Publication #### MCP Session Note The Rovo MCP session may drop after extended idle periods. If a session error occurs: 1. Inform the user the MCP needs reconnection 2. Wait for confirmation before retrying 3. Re-verify the connection with `getAccessibleAtlassianResources` before publishing Present the result: ``` ✅ Published to Confluence Page: [title] URL: [confluence page URL] Space: [space key] Labels: [list of labels] The page is now live. You can view and edit it directly in Confluence. ``` ## Troubleshooting ### Issue: Template cannot be fetched **Solution:** STOP. Never publish without fetching the template first in the same session. ### Issue: MCP session dropped **Solution:** Inform user, wait for reconnection confirmation, re-verify with `getAccessibleAtlassianResources`. ### Issue: Page already exists with same title **Solution:** Ask user whether to update the existing page or create with a different title. ## Best Practices - **HARD RULE:** Never publish unless the template has been fetched in the SAME session - Always confirm the target space and parent page before publishing - If the page already exists, warn the user that content will be overwritten - Include a "Generated by AIDA" label for traceability - The brainstorm file is the single source of truth — always read from it, not chat memory ## Output Directory Convention The `{workspace}/output/` directory is a workspace-level scratch area (NOT inside the power directory). It should be `.gitignore`d. Files typically found: - `{type}-{name}-brainstorm.md` — Brainstorm content (source of truth) - `{type}-{name}.md` — Generated Markdown for human review