feat: add confluence-cli skill — Confluence wiki from the terminal #7

Merged
magnus merged 1 commit from feat/confluence-cli-skill into main 2026-05-21 23:13:10 -04:00
Contributor

Summary

CLI wrapper for the Atlassian Confluence Cloud REST API. List spaces, browse pages, view content with body extraction, search with CQL, and create pages.

Files

confluence-cli/
├── SKILL.md                              # 128 lines — trigger surface, commands, gotchas
└── scripts/
    └── confluence-cli                    # 509 lines — the Python CLI binary

Commands

  • me — current user profile
  • spaces — list spaces with keys and IDs
  • pages — list pages by space with version info
  • view — full page content with HTML body extraction (stripped to plain text)
  • search — CQL search with result excerpts and highlighted snippets
  • create — create pages with HTML body and parent page support

Features

  • All cli-builder patterns: --json, --dry-run, --quiet, --verbose
  • Lazy auth: --help and --dry-run work without credentials
  • Dual-output via emit() helper
  • Structured logging with log/warn/die
  • Pre-parsed global flags (flags work in any position)
  • Dual API version support: v2 for CRUD, rest API for CQL search and user
  • Automatic space key to ID resolution (v2 API requirement)
  • HTML body stripped to plain text for display; raw HTML in --json

Setup

pip install requests
export CONFLUENCE_EMAIL="your-email@example.com"
export CONFLUENCE_API_TOKEN="your-token"
export CONFLUENCE_SERVER="https://your-domain.atlassian.net"
./scripts/confluence-cli spaces

Token is free from id.atlassian.com/manage/api-tokens. Same token works for jira-cli.

QA Gate (10/10 tests passing)

  • Syntax check ✓
  • --help on top level ✓
  • --help on all 6 subcommands ✓
  • Missing required args → error with usage ✓
  • --dry-run returns meaningful preview ✓
  • Unknown command → error ✓
  • Errors to stderr, data to stdout ✓
  • JSON dry-run output parseable ✓
  • No args → prints help ✓
  • Dry-run on chained commands (space lookup) ✓

Signed-off-by: Jasper magnus@groktop.us

## Summary CLI wrapper for the Atlassian Confluence Cloud REST API. List spaces, browse pages, view content with body extraction, search with CQL, and create pages. ## Files ``` confluence-cli/ ├── SKILL.md # 128 lines — trigger surface, commands, gotchas └── scripts/ └── confluence-cli # 509 lines — the Python CLI binary ``` ## Commands - `me` — current user profile - `spaces` — list spaces with keys and IDs - `pages` — list pages by space with version info - `view` — full page content with HTML body extraction (stripped to plain text) - `search` — CQL search with result excerpts and highlighted snippets - `create` — create pages with HTML body and parent page support ## Features - All cli-builder patterns: --json, --dry-run, --quiet, --verbose - Lazy auth: --help and --dry-run work without credentials - Dual-output via emit() helper - Structured logging with log/warn/die - Pre-parsed global flags (flags work in any position) - Dual API version support: v2 for CRUD, rest API for CQL search and user - Automatic space key to ID resolution (v2 API requirement) - HTML body stripped to plain text for display; raw HTML in --json ## Setup ```bash pip install requests export CONFLUENCE_EMAIL="your-email@example.com" export CONFLUENCE_API_TOKEN="your-token" export CONFLUENCE_SERVER="https://your-domain.atlassian.net" ./scripts/confluence-cli spaces ``` Token is free from id.atlassian.com/manage/api-tokens. Same token works for jira-cli. ## QA Gate (10/10 tests passing) - Syntax check ✓ - --help on top level ✓ - --help on all 6 subcommands ✓ - Missing required args → error with usage ✓ - --dry-run returns meaningful preview ✓ - Unknown command → error ✓ - Errors to stderr, data to stdout ✓ - JSON dry-run output parseable ✓ - No args → prints help ✓ - Dry-run on chained commands (space lookup) ✓ Signed-off-by: Jasper <magnus@groktop.us>
CLI wrapper for the Atlassian Confluence Cloud REST API. Commands:
- me: current user profile
- spaces: list spaces with keys and IDs
- pages: list pages by space with version info
- view: full page content with HTML body extraction
- search: CQL search with result excerpts
- create: create pages with HTML body and parent support

All cli-builder patterns: --json, --dry-run, --quiet, --verbose,
lazy auth, emit() dual-output, structured logging, pre-parsed
global flags. Auth via CONFLUENCE_EMAIL + CONFLUENCE_API_TOKEN.
Handles v2 API for CRUD, rest API for search and user.

Signed-off-by: Jasper <magnus@groktop.us>
magnus merged commit 8dd456d046 into main 2026-05-21 23:13:10 -04:00
jasper left a comment

First-Pass Code Review: confluence-cli skill

Automated review by Jasper. 4 issues found.

1. import re inside function body (line 339)

import re is called inside cmd_view() rather than at module level. Python caches imports, so this works, but static-analysis tools and linters expect imports at the top of the file.

Fix: Move import re to line 10 (with the other stdlib imports).

2. --force flag declared but never implemented (lines 54, 60)

The --force global flag is parsed and stored, but no command handler ever reads it. Users who try --force will get a silent no-op. Either implement a behavior for it (force-create, skip confirmation) or remove it from the flag definitions.

3. Error message suggests non-existent --server flag (line 120)

The connection error message says Check CONFLUENCE_SERVER or use --server, but there is no --server CLI flag anywhere in the parser. The server is only configurable via CONFLUENCE_SERVER env var. Fix: drop or use --server or add the flag.

4. cmd_pages silently falls back when space not found (lines 268-272)

When --space BADSPACE doesn't resolve, space_id stays None and list_pages() returns pages from all spaces without warning the user. Compare with cmd_create (lines 426-431) which correctly calls die() on the same condition. cmd_pages should also error out.


Overall the CLI is well-structured and follows cli-builder conventions. These are all minor issues — none are blockers.

## First-Pass Code Review: confluence-cli skill Automated review by Jasper. 4 issues found. ### 1. `import re` inside function body (line 339) `import re` is called inside `cmd_view()` rather than at module level. Python caches imports, so this works, but static-analysis tools and linters expect imports at the top of the file. **Fix:** Move `import re` to line 10 (with the other stdlib imports). ### 2. `--force` flag declared but never implemented (lines 54, 60) The `--force` global flag is parsed and stored, but no command handler ever reads it. Users who try `--force` will get a silent no-op. Either implement a behavior for it (force-create, skip confirmation) or remove it from the flag definitions. ### 3. Error message suggests non-existent `--server` flag (line 120) The connection error message says `Check CONFLUENCE_SERVER or use --server`, but there is no `--server` CLI flag anywhere in the parser. The server is only configurable via `CONFLUENCE_SERVER` env var. Fix: drop `or use --server` or add the flag. ### 4. `cmd_pages` silently falls back when space not found (lines 268-272) When `--space BADSPACE` doesn't resolve, `space_id` stays `None` and `list_pages()` returns pages from **all** spaces without warning the user. Compare with `cmd_create` (lines 426-431) which correctly calls `die()` on the same condition. `cmd_pages` should also error out. --- Overall the CLI is well-structured and follows cli-builder conventions. These are all minor issues — none are blockers.
jasper left a comment

Inline code comments (supplemental to previous review).

Inline code comments (supplemental to previous review).
Author
Contributor

Style: import re inside function body. Move to module-level imports.

**Style:** `import re` inside function body. Move to module-level imports.
Author
Contributor

--force declared but never used by any command handler.

`--force` declared but never used by any command handler.
Author
Contributor

Error message references non-existent --server flag.

Error message references non-existent `--server` flag.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
magnus/agent-skills!7
No description provided.