Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions extensions/jaskiringg/confluence-ai/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
SUPERDOCS_API_KEY=your-key-here
SUPERDOCS_API_BASE=https://api.superdocs.app

# Optional — real Confluence Cloud (sidecar fallback). Leave unset to use the demo page.
CONFLUENCE_BASE_URL=https://your-site.atlassian.net
CONFLUENCE_EMAIL=you@example.com
CONFLUENCE_API_TOKEN=your-confluence-api-token
CONFLUENCE_PAGE_ID=
CONFLUENCE_SPACE_ID=

SIDECAR_PORT=8787
10 changes: 10 additions & 0 deletions extensions/jaskiringg/confluence-ai/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules/
static/ui/node_modules/
static/ui/build/
.env
.env.*
!.env.example
.DS_Store
*.log
.forge/
dist/
57 changes: 57 additions & 0 deletions extensions/jaskiringg/confluence-ai/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Confluence in-page AI edit and review

Built by **Jaskirat Singh** for the SuperDocs task.

Edits the Confluence page you are on instead of exporting it away. Select a section, give an instruction, review SuperDocs diffs inline, send a named approver if you want a second gate, then write **only accepted ranges** back as ADF. Tables, code blocks, and macros are placeholders SuperDocs is not allowed to rewrite. Space normalisation is a page-by-page queue. Publish for people who never open Confluence is a branded PDF via SuperDocs export.

## What SuperDocs is used for

- upload / `document_html`
- `POST /v1/chat/async` with `approval_mode=ask_every_time`
- approve / reject each proposed change
- `POST /v1/documents/export` (PDF)

Proposed-change payloads are parsed twice (JSON string → object). Large edits that pause with `awaiting_kind=continue_prompt` are resumed, not retried as a new job.

## Run (sidecar demo, no Forge required)

```bash
cd extensions/jaskiringg/confluence-ai
cp .env.example .env # put SUPERDOCS_API_KEY here
npm install
npm --prefix static/ui install
npm run ui:build
npm run sidecar
```

Open http://127.0.0.1:8787 — demo IT policy page with a table + code block.

To hit a real Confluence Cloud site from the sidecar, set `CONFLUENCE_BASE_URL`, `CONFLUENCE_EMAIL`, `CONFLUENCE_API_TOKEN`, and a page id.

## Run (Forge, sideload)

1. Create a free Confluence Cloud site.
2. `npm i -g @forge/cli` then `forge login`.
3. In this folder: `forge register` (writes a real `app.id` into `manifest.yml` — re-register if you fork).
4. `forge variables set SUPERDOCS_API_KEY "$SUPERDOCS_API_KEY" --encrypt`
5. `FORGE=1 npm --prefix static/ui run build && forge deploy && forge install --product Confluence --site YOUR-SITE.atlassian.net`

Page byline: **AI review**. Space page: **SuperDocs space queue**. Page menu → Apps → **SuperDocs AI edit**.

This copy is sideloaded on `jaskiring.atlassian.net` (personal site, not public). Reviewers should run the sidecar or sideload their own site.

Marketplace listing is out of scope; sideload is enough.

## Honest limits

- Native Confluence **Publish** cannot be fully intercepted from a content-action modal. We block **our** write-back until the named approver accepts, and store that state on a content property. That is the gate we can actually keep.
- Sidecar without Confluence credentials uses a synthetic page so the SuperDocs loop can be demoed.
- ADF mapping covers headings, paragraphs, lists, quotes. Unknown/opaque nodes stay byte-stable on the original ADF.

## Tests

```bash
npm test
```

No live SuperDocs key required for unit tests.
89 changes: 89 additions & 0 deletions extensions/jaskiringg/confluence-ai/fixtures/demo-page.adf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"type": "doc",
"version": 1,
"content": [
{
"type": "heading",
"attrs": { "level": 1 },
"content": [{ "type": "text", "text": "IT Change Policy — North Region" }]
},
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "All production changes require a CAB ticket before cutover. Emergency changes still need a follow-up ticket within 24 hours."
}
]
},
{
"type": "heading",
"attrs": { "level": 2 },
"content": [{ "type": "text", "text": "Freeze windows" }]
},
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "North region freeze is 02:00-06:00 IST on release nights. No master-data edits during freeze."
}
]
},
{
"type": "table",
"attrs": { "isNumberColumnEnabled": false, "layout": "default" },
"content": [
{
"type": "tableRow",
"content": [
{
"type": "tableHeader",
"attrs": {},
"content": [{ "type": "paragraph", "content": [{ "type": "text", "text": "System" }] }]
},
{
"type": "tableHeader",
"attrs": {},
"content": [{ "type": "paragraph", "content": [{ "type": "text", "text": "Owner" }] }]
}
]
},
{
"type": "tableRow",
"content": [
{
"type": "tableCell",
"attrs": {},
"content": [{ "type": "paragraph", "content": [{ "type": "text", "text": "Order API" }] }]
},
{
"type": "tableCell",
"attrs": {},
"content": [{ "type": "paragraph", "content": [{ "type": "text", "text": "Platform" }] }]
}
]
}
]
},
{
"type": "heading",
"attrs": { "level": 2 },
"content": [{ "type": "text", "text": "Rollback" }]
},
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "If error rate exceeds 2% after cutover, roll back within 15 minutes and page the on-call."
}
]
},
{
"type": "codeBlock",
"attrs": { "language": "bash" },
"content": [{ "type": "text", "text": "kubectl rollout undo deploy/order-api" }]
}
]
}
57 changes: 57 additions & 0 deletions extensions/jaskiringg/confluence-ai/manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
modules:
confluence:contentAction:
- key: ai-edit-review
resource: main
resolver:
function: resolver
title: SuperDocs AI edit
viewportSize: large
confluence:contentBylineItem:
- key: ai-review-status
resource: main
resolver:
function: resolver
title: SuperDocs AI edit
confluence:globalPage:
- key: superdocs-home
resource: main
resolver:
function: resolver
title: SuperDocs AI
route: superdocs-ai
confluence:spacePage:
- key: space-normalise
resource: main
resolver:
function: resolver
title: SuperDocs space queue
route: superdocs-queue
function:
- key: resolver
handler: index.handler

resources:
- key: main
path: static/ui/build

app:
runtime:
name: nodejs22.x
memoryMB: 256
id: ari:cloud:ecosystem::app/7f17f3ef-6f7f-4c69-a213-590e8cacdfcc

permissions:
scopes:
- read:page:confluence
- write:page:confluence
- read:space:confluence
- read:user:confluence
- search:confluence
- read:content.property:confluence
- write:content.property:confluence
external:
fetch:
backend:
- address: api.superdocs.app
client:
- address: api.superdocs.app
Loading