# Jira and Confluence

Connect an Atlassian site to link architectural decisions to the Jira tickets behind them and publish your generated wiki to Confluence on a weekly schedule.

> **Warning**
>
> Jira and Confluence are in beta. Connecting a site can fail after the
> first sign-in, so don't rely on either one yet.

A team owner or admin connects an Atlassian Cloud site once, under
**Team → Settings** (`/team/settings`). The connection is OAuth-based
(read-only Jira scopes plus Confluence page write), team-scoped, and
covers every repo shared into the team. One connection covers both Jira
and Confluence. **Settings → Integrations** lists every integration in one
place.

## Connecting your site

1. Go to **Team → Settings** and click **Connect Atlassian**.
2. Approve the consent screen on Atlassian. If your account can access
   several sites, pick which one the team uses.
3. The card shows the connected site and its status from then on. If
   Atlassian ever revokes the grant, the card flags **Needs re-auth**
   and a single reconnect heals every dependent feature.

Tokens are encrypted at rest and never leave the Repowise API. Repowise
stores no Atlassian account data, no account ids, names, or emails.

## Decisions ↔ Jira issues

Repowise's decision records carry evidence commits, the commits a
decision was extracted from. **Find Jira links** (on the decisions page)
mines those commit messages for issue keys and links the matches:

- Keys only count when their project prefix exists on your connected
  site, so `SHA-256` or a made-up `FAKE-123` never produce a link.
- Each decision page gains a **Linked Jira issues** section showing the
  ticket, its title, and a live-ish status pill (refreshed on view,
  cached for an hour).
- Manual linking by key covers tickets that never appeared in a commit
  message; unlinking is one click.
- The `get_why` MCP tool carries the same links, so your editor's agent
  sees the originating ticket next to the decision rationale.

## Publishing the wiki to Confluence

Per repo, under **repo → Settings → Confluence publication**:

1. Pick a space (and optionally a parent page id) for the wiki to live
   under.
2. Publish on demand with **Publish now**, or enable the weekly
   schedule.

Publication is idempotent and in-place:

- Every page carries a banner stating exactly which commit it was
  generated from, with a link back to the hosted wiki, and an explicit
  **STALE** warning when the repository has new commits since the last
  index.
- Unchanged pages are skipped (content-hash diff), changed pages are
  updated in place at the next version, and pages that disappear from
  the wiki are moved to Confluence's trash (reversible), and re-publishing
  never duplicates a page tree.
- Markdown that has no clean Confluence equivalent (e.g. embedded raw
  HTML) is rendered as a visible code block instead of dropped.
- The last run's outcome (created / updated / unchanged / removed, plus
  any per-page failures) is shown on the card.

> **Note**
>
> The Jira and Confluence integration is available on the Teams plan. The
> connection is made by a team owner or admin; decision links and
> publication work for every member after that.
