### Development Setup for Confluence CLI Source: https://github.com/pchuri/confluence-cli/blob/main/CONTRIBUTING.md Installs dependencies, sets up environment variables for testing, and runs a help command to verify the CLI setup. ```bash git clone https://github.com/your-username/confluence-cli.git cd confluence-cli npm install export CONFLUENCE_DOMAIN="your-test-domain.atlassian.net" export CONFLUENCE_API_TOKEN="your-test-token" node bin/confluence.js --help ``` -------------------------------- ### Initialize Confluence CLI Configuration Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/cli-reference.md Run the init command to start an interactive setup for configuring the confluence-cli. This process prompts for necessary details to create a new profile. ```bash confluence init ``` -------------------------------- ### Install and Initialize Confluence CLI Source: https://github.com/pchuri/confluence-cli/blob/main/plugins/confluence/README.md Install the confluence-cli globally and initialize its configuration. Ensure this is done before using the plugin. ```bash npm install -g confluence-cli confluence init ``` -------------------------------- ### Install Claude Code Skill Documentation Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/cli-reference.md Installs the Claude Code skill documentation, creating a specific file in the .claude/skills/confluence directory. No setup is required. ```bash confluence install-skill ``` -------------------------------- ### Example Configuration Precedence Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/configuration.md Demonstrates how command-line flags, environment variables, and profile configurations interact to determine the final settings. This example overrides the domain using an environment variable while specifying a profile. ```bash # Uses 'staging' profile, overrides domain with env var CONFLUENCE_DOMAIN=staging2.atlassian.net confluence read 123 --profile staging ``` -------------------------------- ### Install and Run Confluence CLI Locally Source: https://github.com/pchuri/confluence-cli/blob/main/README.md Clone the repository, install dependencies, and run the CLI locally. Use the `--help` flag to see available commands. ```bash git clone https://github.com/pchuri/confluence-cli.git cd confluence-cli npm install npm start -- --help ``` ```bash npm test ``` ```bash npm run lint ``` -------------------------------- ### Markdown to Storage Conversion Example Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/utility-modules.md Example demonstrating markdownToStorage conversion, including a warning admonition. ```javascript const storage = converter.markdownToStorage(` # Project [!warning] This is a warning `); ``` -------------------------------- ### Install and Verify Confluence CLI Source: https://github.com/pchuri/confluence-cli/blob/main/plugins/confluence/skills/confluence/SKILL.md Install the confluence-cli globally using npm and verify the installation by checking the version. ```sh npm install -g confluence-cli confluence --version # verify install ``` -------------------------------- ### Local Testing Setup Source: https://github.com/pchuri/confluence-cli/blob/main/CONTRIBUTING.md Environment variables and commands for testing the CLI against a live Confluence instance. ```bash # Test against your Confluence instance export CONFLUENCE_DOMAIN="your-domain.atlassian.net" export CONFLUENCE_API_TOKEN="your-token" # Test commands node bin/confluence.js spaces node bin/confluence.js search "test" node bin/confluence.js read 123456789 ``` -------------------------------- ### Install Confluence CLI via npm Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/README.md Install the package globally using npm. ```bash # Via npm npm install -g confluence-cli ``` -------------------------------- ### confluence install-skill Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/cli-reference.md Install Claude Code skill documentation. ```APIDOC ## confluence install-skill ### Description Install Claude Code skill documentation. This command creates `.claude/skills/confluence/SKILL.md` with skill documentation. ### Command ```bash confluence install-skill ``` ``` -------------------------------- ### Full HTML to Confluence Storage Conversion Example Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/format-converters.md Provides a comprehensive example of converting a multi-element HTML string, including headings, paragraphs, emphasis, lists, and links, to Confluence storage format using the 'wiki' link style. ```javascript const html = `

Title

This is bold and italic.

`; const storage = htmlToStorage(html, { linkStyle: 'wiki' }); ``` -------------------------------- ### Install Confluence CLI via Homebrew Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/README.md Install the package using Homebrew for macOS and Linux systems. ```bash # Via Homebrew (macOS/Linux) brew install pchuri/tap/confluence-cli ``` -------------------------------- ### Show CLI Usage Statistics Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/cli-reference.md Use this command to display statistics about the CLI usage. No setup is required. ```bash confluence stats ``` -------------------------------- ### Reverse-Proxy / No-Auth Profile Setup Source: https://github.com/pchuri/confluence-cli/blob/main/README.md Configure the CLI for environments where authentication is handled by a reverse proxy. The `--auth-type` is set to `none`. ```bash confluence --profile proxy init \ --domain "confluence.internal" \ --api-path "/rest/api" \ --auth-type "none" ``` -------------------------------- ### Install Confluence CLI Plugin in Claude Code Source: https://github.com/pchuri/confluence-cli/blob/main/README.md Install the confluence-cli plugin from the marketplace within Claude Code. ```bash /plugin install confluence@pchuri-confluence-cli ``` -------------------------------- ### Complete Non-interactive Setup with CLI Flags Source: https://github.com/pchuri/confluence-cli/blob/main/README.md Use this command to provide all required configuration via command-line flags. This is ideal for CI/CD pipelines, Docker builds, and AI coding agents. ```bash confluence init \ --domain "company.atlassian.net" \ --api-path "/wiki/rest/api" \ --auth-type "basic" \ --email "user@example.com" \ --token "your-api-token" ``` -------------------------------- ### Install Confluence CLI Plugin Source: https://github.com/pchuri/confluence-cli/blob/main/plugins/confluence/README.md Install the Confluence CLI plugin from the marketplace. This command adds the plugin to your Claude Code environment. ```bash /plugin marketplace add pchuri/confluence-cli /plugin install confluence@pchuri-confluence-cli ``` -------------------------------- ### Named Profile Setup Source: https://github.com/pchuri/confluence-cli/blob/main/README.md Save configurations to a specific named profile for easy management of different environments or settings. ```bash confluence --profile staging init \ --domain "staging.example.com" \ --api-path "/rest/api" \ --auth-type "bearer" \ --token "your-personal-access-token" ``` -------------------------------- ### profile add Source: https://github.com/pchuri/confluence-cli/blob/main/plugins/confluence/skills/confluence/SKILL.md Adds a new configuration profile. It supports the same options as the `init` command for interactive, non-interactive, or hybrid setup. ```APIDOC ## `profile add ` Add a new configuration profile. Supports the same options as `init` (interactive, non-interactive, or hybrid). ```sh confluence profile add [--domain ] [--api-path ] [--auth-type basic|bearer] [--email ] [--token ] [--protocol http|https] [--read-only] ``` Profile names may contain letters, numbers, hyphens, and underscores only. ### Example ```sh confluence profile add staging --domain "staging.example.com" --auth-type bearer --token "xyz" ``` ``` -------------------------------- ### Confluence CLI Configuration File Example Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/config.md A JSON configuration file with profile objects keyed by name. The 'default' profile includes domain, email, token, authType, and protocol. ```json { "default": { "domain": "company.atlassian.net", "email": "user@company.com", "token": "ATATT...", "authType": "basic", "protocol": "https" }, "staging": { "domain": "staging.confluence.internal", "token": "TOKEN...", "authType": "bearer" } } ``` -------------------------------- ### Example: Basic Storage to Markdown Conversion Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/format-converters.md Demonstrates a simple conversion of Confluence storage format XML containing bold, italic, and a list into Markdown. The output is logged to the console. ```javascript const storageXml = `

Bold and italic

  • Item 1
  • Item 2
`; const walker = new StorageWalker(); const markdown = walker.walk(storageXml); console.log(markdown); // Output: **Bold** and *italic* // // - Item 1 // - Item 2 ``` -------------------------------- ### Search Pages Source: https://github.com/pchuri/confluence-cli/blob/main/README.md Perform a basic search for pages. Use --limit and --start options for pagination. ```bash # Basic search confluence search "search term" # Limit results confluence search "search term" --limit 5 # Paginate results confluence search "search term" --limit 5 --start 5 ``` -------------------------------- ### Example Commit Message for Confluence CLI Source: https://github.com/pchuri/confluence-cli/blob/main/CONTRIBUTING.md Demonstrates the conventional commit format for describing changes, including a summary and detailed bullet points. ```git feat: add page creation functionality - Add create command to CLI - Implement createPage method in client - Add tests for page creation - Update README with new command ``` -------------------------------- ### Twitter/X Post Example for confluence-cli Source: https://github.com/pchuri/confluence-cli/blob/main/docs/PROMOTION.md Use this template for a concise announcement on Twitter/X, highlighting key features and relevant hashtags. Includes a link to the GitHub repository. ```text 🚀 Just released confluence-cli v1.0! A powerful CLI tool for @Atlassian Confluence: ✅ Read pages from terminal ✅ Search documentation ✅ List spaces ✅ Works with environment variables Perfect for automation & DevOps workflows! #CLI #Confluence #DevTools #OpenSource https://github.com/pchuri/confluence-cli ``` -------------------------------- ### Hybrid Mode Setup (Partial Flags) Source: https://github.com/pchuri/confluence-cli/blob/main/README.md Utilize hybrid mode by providing some fields via flags and allowing the CLI to prompt for the remaining required information. ```bash # Domain and token provided, will prompt for auth method and email confluence init --domain "company.atlassian.net" --token "your-api-token" ``` ```bash # Email indicates basic auth, will prompt for domain and token confluence init --email "user@example.com" --token "your-api-token" ``` -------------------------------- ### Install Confluence CLI Skill Source: https://github.com/pchuri/confluence-cli/blob/main/plugins/confluence/skills/confluence/SKILL.md Copies the Claude Code skill documentation into the project's .claude/skills/confluence directory to enable automatic learning of the Confluence CLI. ```sh confluence install-skill [--dest ] [--yes] ``` ```sh confluence install-skill ``` -------------------------------- ### Run Confluence CLI with npx Source: https://github.com/pchuri/confluence-cli/blob/main/README.md Execute confluence-cli commands directly without a global installation using npx. ```bash npx confluence-cli ``` -------------------------------- ### Get Default Profile Configuration Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/config.md Load the default profile configuration. Returns an object with Confluence connection settings. ```javascript const defaultConfig = config.getDefaultProfile(); ``` -------------------------------- ### Scoped API Token Setup for Agents Source: https://github.com/pchuri/confluence-cli/blob/main/README.md Configure the CLI with a scoped API token for enhanced security, following the principle of least privilege. Replace with your actual Cloud ID. ```bash # Replace with your actual Cloud ID confluence init \ --domain "api.atlassian.com" \ --api-path "/ex/confluence//wiki/rest/api" \ --auth-type "basic" \ --email "user@example.com" \ --token "your-scoped-token" ``` -------------------------------- ### LinkedIn Post Example for confluence-cli Source: https://github.com/pchuri/confluence-cli/blob/main/docs/PROMOTION.md Adapt this LinkedIn post to share the project with a professional network, emphasizing its utility for documentation workflows and CI/CD integration. Encourages feedback. ```text Excited to share my latest open-source project: confluence-cli! 🎉 As someone who works with Confluence daily, I built this CLI tool to streamline documentation workflows. Now you can: • Read Confluence pages from your terminal • Search across your wiki content • Integrate with CI/CD pipelines • Automate documentation tasks Available on NPM and fully open-source. Would love your feedback! #OpenSource #CLI #Confluence #DevTools #Automation ``` -------------------------------- ### Batch Create Confluence Pages Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/cli-reference.md Automate the creation of multiple pages by reading titles from a file and using a loop. This example creates pages with a timestamped content. ```bash while IFS= read -r title; do confluence create "$title" DOCS --content "Created: $(date)" done < titles.txt ``` -------------------------------- ### Markdown with Confluence Extensions Source: https://github.com/pchuri/confluence-cli/blob/main/CONTRIBUTING.md Example of markdown syntax supporting Confluence-specific extensions like admonitions and native storage format conversion. ```markdown # My Page [!info] This is an info admonition that will render as a Confluence info macro. ```javascript console.log("Code blocks preserve syntax highlighting"); ``` | Feature | Status | |---------|--------| | Tables | ✅ | | Lists | ✅ | ``` -------------------------------- ### Chain Confluence CLI Commands Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/cli-reference.md Combine CLI commands to perform multi-step operations. This example finds a page ID by title and then reads the page content. ```bash PAGE_ID=$(confluence find "Home" --json | jq -r '.[0].id') confluence read "$PAGE_ID" --format markdown ``` -------------------------------- ### Build Documentation Hierarchy Source: https://github.com/pchuri/confluence-cli/blob/main/plugins/confluence/skills/confluence/SKILL.md Create a root page and then add child pages under it, either with inline content or from a file. The returned ID of the root page is used for creating children. ```sh # Create root page, note the returned ID (e.g. 111222333) confluence create "Project Overview" MYSPACE --content "# Overview" --format markdown # Add children under it confluence create-child "Architecture" 111222333 --content "# Architecture" --format markdown confluence create-child "API Reference" 111222333 --file ./api.md --format markdown confluence create-child "Runbooks" 111222333 --content "# Runbooks" --format markdown ``` -------------------------------- ### install-skill Source: https://github.com/pchuri/confluence-cli/blob/main/plugins/confluence/skills/confluence/SKILL.md Copies the Claude Code skill documentation into your project's `.claude/skills/` directory, enabling Claude Code to automatically learn the confluence-cli. ```APIDOC ## `install-skill` Copy the Claude Code skill documentation into your project's `.claude/skills/` directory so Claude Code can learn confluence-cli automatically. ```sh confluence install-skill [--dest ] [--yes] ``` ### Options | Option | Default | Description | |---|---|---| | `--dest` | `./.claude/skills/confluence` | Target directory | | `--yes` | false | Skip overwrite confirmation | ### Example ```sh confluence install-skill ``` ``` -------------------------------- ### Get Page Information Source: https://github.com/pchuri/confluence-cli/blob/main/README.md Retrieve metadata for a page using its ID. Use --json to get machine-readable output. ```bash confluence info 123456789 # Emit machine-readable metadata confluence info 123456789 --json ``` -------------------------------- ### init Source: https://github.com/pchuri/confluence-cli/blob/main/README.md Initializes the CLI configuration. Supports a read-only mode. ```APIDOC ## init ### Description Initialize CLI configuration. ### Options - `--read-only` - Initialize in read-only mode. ``` -------------------------------- ### Initialize Confluence CLI Configuration Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/README.md Run this command to initialize the configuration for the Confluence CLI. ```bash # Initialize configuration confluence init ``` -------------------------------- ### Initialize Default Profile Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/configuration.md Run this command to set up the initial 'default' profile. It will prompt for your Confluence domain, email, API token, and authentication type. ```bash confluence init # Prompts: domain, email, token, auth type # Saves to 'default' profile ``` -------------------------------- ### Analytics.getStats Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/utility-modules.md Get aggregated usage statistics for command executions. ```APIDOC ## Analytics.getStats ### Description Get aggregated usage statistics. ### Method analytics.getStats() ### Response #### Success Response - **object** - Object with command counts and success rates ### Response Example ```javascript const stats = analytics.getStats(); console.log(stats); // {read: {total: 42, success: 40}, ...} ``` ``` -------------------------------- ### Initialize MacroConverter Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/format-converters.md Instantiates the `MacroConverter` with configuration options. Use this to set up the converter for Cloud or Server instances, specify URL prefixes, and define how links should be built. ```javascript const MacroConverter = require('./lib/macro-converter'); const converter = new MacroConverter({ isCloud: true, webUrlPrefix: '/wiki', buildUrl: (path) => `https://example.com${path}`, linkStyle: 'smart' }); ``` -------------------------------- ### Markdown with Triple Backticks Source: https://github.com/pchuri/confluence-cli/blob/main/tests/fixtures/storage-samples/04-code-and-mermaid.expected.md An example of text containing triple backticks, often used for code blocks in Markdown. ```markdown Some text with ```triple backticks``` inside. ``` -------------------------------- ### Import and Basic Usage of htmlToStorage Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/format-converters.md Demonstrates how to import and use the `htmlToStorage` function with a basic HTML input and a 'smart' link style option. ```javascript const { htmlToStorage } = require('./lib/html-to-storage'); const storage = htmlToStorage(html, { linkStyle: 'smart' }); ``` -------------------------------- ### View Confluence CLI Help Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/cli-reference.md Access help documentation for the Confluence CLI. Use '--help' for global commands, specific commands, or subcommands. ```bash confluence --help # Global help ``` ```bash confluence read --help # Command help ``` ```bash confluence comment --help # Subcommand help ``` -------------------------------- ### Markdown Same-Page Anchor Link Source: https://github.com/pchuri/confluence-cli/blob/main/README.md Markdown links with hrefs starting with '#' become Confluence in-page anchor links. ```markdown See [the anchor](#my-section) above. ``` -------------------------------- ### Initialize Confluence Client in Node.js Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/README.md Initialize a Confluence client instance with your domain, email, and token for authentication. ```javascript const ConfluenceClient = require('confluence-cli/lib/confluence-client'); const client = new ConfluenceClient({ domain: 'mycompany.atlassian.net', email: 'user@mycompany.com', token: 'ATATT3...', authType: 'basic' }); ``` -------------------------------- ### initializeProfile Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/config.md Initializes or updates a Confluence CLI profile. This function can be used for interactive setup or to pre-fill answers, skipping prompts. ```APIDOC ## initializeProfile ### Description Interactive setup wizard for creating or updating a profile. ### Method ```javascript async function initializeProfile(profileName = 'default', answers = null) ``` ### Parameters #### Path Parameters - **profileName** (string) - Required - Profile to create/update - **answers** (object) - Optional - Pre-filled answers (skips prompts) ### Returns Promise — Created profile configuration ### Example ```javascript const newProfile = await config.initializeProfile('production'); ``` ``` -------------------------------- ### Get All Attachments on a Confluence Page Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/confluence-client.md Retrieves all attachments from a Confluence page, handling pagination automatically. Specify pageSize for API requests. ```javascript async getAllAttachments(pageIdOrUrl, options = {}) ``` ```javascript const allAttachments = await client.getAllAttachments('123456789'); ``` -------------------------------- ### Run Tests Source: https://github.com/pchuri/confluence-cli/blob/main/CONTRIBUTING.md Commands to execute tests, including watch mode and coverage checks. Also shows how to manually test the CLI. ```bash # Run all tests npm test # Run tests in watch mode npm run test:watch # Check test coverage npm run test:coverage # Manual testing node bin/confluence.js read 123456789 ``` -------------------------------- ### List All Configured Profiles Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/config.md List all configured profiles. Returns an array of profile names. ```javascript const profiles = config.getAllProfiles(); profiles.forEach(name => console.log(name)); ``` -------------------------------- ### Property Object Definition Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/types.md Represents custom metadata associated with Confluence content. Used with methods for getting, setting, and listing properties. ```javascript { key: string, // Property key value: any // Property value (any JSON-serializable value) } ``` -------------------------------- ### Initialize MacroConverter Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/utility-modules.md Instantiate the MacroConverter with options. The converter handles markdown to Confluence storage format conversion. ```javascript const MacroConverter = require('./lib/macro-converter'); const converter = new MacroConverter(options); ``` -------------------------------- ### Confluence CLI: Initialize Configuration Source: https://github.com/pchuri/confluence-cli/blob/main/plugins/confluence/skills/confluence/SKILL.md Initializes the Confluence CLI configuration, saving credentials to `~/.confluence-cli/config.json`. Flags are optional and trigger interactive prompts if omitted. Use `--profile` for named configurations. ```sh confluence init [--domain ] [--api-path ] [--auth-type basic|bearer] [--email ] [--token ] [--read-only] ``` ```sh confluence --profile staging init --domain "staging.example.com" --auth-type bearer --token "your-token" ``` -------------------------------- ### HTML Blockquote to Confluence Callout Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/format-converters.md Shows how a blockquote starting with a bolded keyword like 'INFO' is converted into a Confluence callout macro. ```html

INFO

This is informational

``` -------------------------------- ### CLI Scripting: Batch Create Pages Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/README.md Demonstrates batch creation of pages using a CSV file where each line contains the title and content for a new page. ```bash # Batch create while IFS= read -r title content; confluence create "$title" DOCS --content "$content" done < pages.csv ``` -------------------------------- ### Get All Confluence Page Properties Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/confluence-client.md Retrieve all content properties for a given page. This method automatically handles pagination to ensure all properties are fetched. ```javascript const allProps = await client.getAllProperties('123456789'); ``` -------------------------------- ### List Attachments on a Confluence Page Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/confluence-client.md Use this method to list attachments for a specific Confluence page. It supports pagination with limit and start options. ```javascript async listAttachments(pageIdOrUrl, options = {}) ``` ```javascript const attachments = await client.listAttachments('123456789'); ``` -------------------------------- ### listComments Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/confluence-client.md Lists comments on a specific Confluence page with support for pagination. You can control the number of results per page and the starting index for pagination. ```APIDOC ## listComments ### Description List comments on a page (single page with pagination). ### Method `async listComments(pageIdOrUrl, options = {})` ### Parameters #### Path Parameters - **pageIdOrUrl** (string | number) - Required - Page ID or URL #### Query Parameters - **options.limit** (number) - Optional - Results per page (default: `500`) - **options.start** (number) - Optional - Pagination start index (default: `0`) ### Returns object with `results` array of comment objects and `nextStart` ### Request Example ```javascript const comments = await client.listComments('123456789', { limit: 50 }); ``` ``` -------------------------------- ### Filter Response with jq Source: https://github.com/pchuri/confluence-cli/blob/main/README.md Filters the JSON output of an API request using jq. Requires jq to be installed and available in the system's PATH. ```bash confluence api group --jq '.results[].name' ``` -------------------------------- ### Get Specific Confluence Page Property Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/confluence-client.md Fetch a single content property from a page using its unique key. The 'value' of the property is logged to the console. ```javascript const prop = await client.getProperty('123456789', 'customMetadata'); console.log(prop.value); ``` -------------------------------- ### Get All Comments on a Page Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/confluence-client.md This method automatically handles pagination to fetch all comments associated with a given page. Specify the page size for API requests. ```javascript const allComments = await client.getAllComments('123456789'); ``` -------------------------------- ### Create a Confluence Page using CLI Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/README.md Create a new Confluence page with a title, space key, and content using the CLI. ```bash # Create a page confluence create "My Page" DOCS --content "Hello World" ``` -------------------------------- ### Import Configuration Module Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/config.md Import the configuration module to access its functions. ```javascript const config = require('./lib/config'); ``` -------------------------------- ### Get All Spaces Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/confluence-client.md Use getSpaces to retrieve all spaces, with options for maximum results and page size. Set maxResults to null to fetch all available spaces. ```javascript async getSpaces(maxResults = 500, options = {}) ``` ```javascript const allSpaces = await client.getSpaces(null); ``` -------------------------------- ### Get All Descendant Pages Confluence Client Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/confluence-client.md Recursively retrieves all descendant pages up to a specified depth limit. Useful for comprehensive content audits or migrations. ```javascript async getAllDescendantPages(pageId, maxDepth = 10, currentDepth = 0, options = {}) ``` ```javascript const allChildren = await client.getAllDescendantPages('123456789', 20); ``` -------------------------------- ### Get Analytics Statistics Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/utility-modules.md Retrieve aggregated usage statistics, including command counts and success rates. Useful for understanding CLI usage patterns. ```javascript analytics.getStats() ``` ```javascript const stats = analytics.getStats(); console.log(stats); // {read: {total: 42, success: 40}, ...} ``` -------------------------------- ### Confluence Reverse Proxy (No Auth) Configuration Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/configuration.md Configuration for connecting to Confluence through a reverse proxy that handles authentication. The CLI does not need authentication credentials in this setup. ```json { "domain": "confluence.internal.com", "authType": "none", "protocol": "https" } ``` -------------------------------- ### confluence init Source: https://github.com/pchuri/confluence-cli/blob/main/plugins/confluence/skills/confluence/SKILL.md Initializes the Confluence CLI configuration, saving credentials to `~/.confluence-cli/config.json`. Flags are optional and trigger interactive prompts if omitted. A `--profile` flag can be used to save named configurations. ```APIDOC ## init ### Description Initialize configuration. Saves credentials to `~/.confluence-cli/config.json`. ### Synopsis ```sh confluence init [--domain ] [--api-path ] [--auth-type basic|bearer] [--email ] [--token ] [--read-only] ``` ### Options * `--domain ` - The Confluence domain. * `--api-path ` - The API path for Confluence. * `--auth-type basic|bearer` - The authentication type (basic or bearer). * `--email ` - The email address for authentication. * `--token ` - The API token for authentication. * `--read-only` - Sets the configuration to read-only mode. ### Examples ```sh confluence init [--domain ] [--api-path ] [--auth-type basic|bearer] [--email ] [--token ] [--read-only] confluence --profile staging init --domain "staging.example.com" --auth-type bearer --token "your-token" ``` ``` -------------------------------- ### List Comments on a Page Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/confluence-client.md Use this method to retrieve comments for a specific page. You can control the number of results per page and the starting index for pagination. ```javascript const comments = await client.listComments('123456789', { limit: 50 }); ``` -------------------------------- ### Create Local Converter Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/confluence-client.md Instantiate a local converter for client-side markdown to storage format conversion without network access. ```javascript static ConfluenceClient.createLocalConverter() ``` ```javascript const converter = ConfluenceClient.createLocalConverter(); const storage = converter.markdownToStorage('# Heading'); ``` -------------------------------- ### List Spaces with Pagination Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/confluence-client.md Retrieve a paginated list of spaces using the listSpaces method. You can control the number of results per page and the starting index. ```javascript async listSpaces(options = {}) ``` ```javascript const page = await client.listSpaces({ limit: 10 }); console.log(page.results); // [{key, name, type}, ...] ``` -------------------------------- ### profile use Source: https://github.com/pchuri/confluence-cli/blob/main/README.md Sets the active configuration profile for subsequent commands. ```APIDOC ## profile use ### Description Set the active configuration profile. ### Parameters #### Path Parameters - **name** (string) - Required - The name of the profile to use. ``` -------------------------------- ### MacroConverter Configuration Options Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/types.md Configuration options for the MacroConverter constructor. Includes target environment (Cloud), URL prefix, URL builder, and link styling. ```javascript { isCloud: boolean, // Target is Cloud (default: false) webUrlPrefix: string, // URL prefix buildUrl: function, // URL builder linkStyle: string // 'smart', 'plain', 'wiki' } ``` -------------------------------- ### Create Page from File Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/cli-reference.md Creates a Confluence page using content from a local file. Ensure the file exists at the specified path. ```bash # Read from file confluence create "Page" DOCS --file page.md ``` -------------------------------- ### Initialize Analytics Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/utility-modules.md Instantiate the Analytics class. This constructor takes no parameters and tracks events to a local file. ```javascript const Analytics = require('./lib/analytics'); const analytics = new Analytics(); ``` -------------------------------- ### Get Confluence Page Information Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/cli-reference.md Fetch detailed metadata for a Confluence page using its ID. Outputs information such as ID, title, space, version, and dates. ```bash confluence info ``` ```bash confluence info 123456789 ``` ```bash confluence info 123456789 --json ``` -------------------------------- ### Initialize Profile Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/config.md Use this function to create or update a profile configuration. It can be used interactively or with pre-filled answers to skip prompts. ```javascript async function initializeProfile(profileName = 'default', answers = null) ``` ```javascript const newProfile = await config.initializeProfile('production'); ``` -------------------------------- ### CLI Scripting: Find and Read Pages Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/README.md Example of using the Confluence CLI to find a page by title, extract its ID, and then read the page content in Markdown format. ```bash # Find and read pages PAGE_ID=$(confluence find "Release Notes" --json | jq -r '.[0].id') confluence read "$PAGE_ID" --format markdown > release-notes.md ``` -------------------------------- ### walk Method Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/format-converters.md Converts Confluence storage format XML to Markdown. ```APIDOC ## walk Method ### Description Converts Confluence storage format XML to markdown. ### Method `walker.walk(storageXml)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters | Parameter | Type | Description | |-----------|------|-------------| | storageXml | string | Confluence storage format XML | ### Returns string — Markdown source ### Warnings `walker.warnings` contains array of issues (implicit tag closes, malformed XML, etc.) ### Request Example ```javascript const storageXml = `

Bold and italic

  • Item 1
  • Item 2
`; const walker = new StorageWalker(); const markdown = walker.walk(storageXml); console.log(markdown); // Output: **Bold** and *italic* // // - Item 1 // - Item 2 ``` ``` -------------------------------- ### Get Child Pages Confluence Client Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/confluence-client.md Use this method to list direct child pages of a given page. Supports pagination with a default limit of 500 results. ```javascript async getChildPages(pageId, limit = 500, options = {}) ``` ```javascript const children = await client.getChildPages('123456789'); ``` -------------------------------- ### profile use Source: https://github.com/pchuri/confluence-cli/blob/main/plugins/confluence/skills/confluence/SKILL.md Switches the active configuration profile to the one specified by name. ```APIDOC ## `profile use ` Switch the active configuration profile. ```sh confluence profile use ``` ### Example ```sh confluence profile use staging ``` ``` -------------------------------- ### Get Confluence Page for Editing Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/confluence-client.md Retrieve a page's content in edit mode, including its full storage body and version information. This is useful for making modifications. ```javascript async getPageForEdit(pageIdOrUrl) ``` ```javascript const page = await client.getPageForEdit('123456789'); console.log(page.storage.value); ``` -------------------------------- ### Configuration Module Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/README.md Methods for managing Confluence CLI profiles and settings. ```APIDOC ## getProfile(name) ### Description Load a specific Confluence CLI profile by name. ### Method `getProfile` ### Parameters - `name` (string) - The name of the profile to load. ``` ```APIDOC ## saveProfile(name, config) ### Description Save a Confluence CLI profile with the given name and configuration. ### Method `saveProfile` ### Parameters - `name` (string) - The name of the profile to save. - `config` (object) - The profile configuration object. ``` ```APIDOC ## deleteProfile(name) ### Description Delete a Confluence CLI profile by name. ### Method `deleteProfile` ### Parameters - `name` (string) - The name of the profile to delete. ``` ```APIDOC ## getAllProfiles() ### Description List all available Confluence CLI profiles. ### Method `getAllProfiles` ``` ```APIDOC ## initializeProfile(name) ### Description Start an interactive setup process to initialize a new Confluence CLI profile. ### Method `initializeProfile` ### Parameters - `name` (string, optional) - The name for the new profile. If not provided, the user will be prompted. ``` -------------------------------- ### mTLS Profile Setup for Self-Hosted APIs Source: https://github.com/pchuri/confluence-cli/blob/main/README.md Configure the CLI for mTLS authentication, suitable for self-hosted or reverse-proxied Confluence APIs. Ensure the paths to your TLS certificates are correct. ```bash confluence --profile corp init \ --domain "docs.example.com" \ --api-path "/confluence/rest/api" \ --auth-type "mtls" \ --tls-client-cert "~/.certs/client.pem" \ --tls-client-key "~/.certs/client.key" \ --tls-ca-cert "~/.certs/ca-chain.pem" ``` -------------------------------- ### Reverse-Proxy / No-Auth Environment Variables Source: https://github.com/pchuri/confluence-cli/blob/main/README.md Configure the CLI for environments with a reverse proxy or no authentication required. ```bash export CONFLUENCE_DOMAIN="confluence.internal" export CONFLUENCE_API_PATH="/rest/api" export CONFLUENCE_AUTH_TYPE="none" ``` -------------------------------- ### Get Confluence Page Information Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/confluence-client.md Retrieve detailed metadata for a Confluence page, including its space, version history, ancestors, and creator. This method accepts a page ID or URL. ```javascript async getPageInfo(pageIdOrUrl) ``` ```javascript const info = await client.getPageInfo('123456789'); console.log(info.title, info.space.key, info.version.number); ``` -------------------------------- ### Add a New Profile Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/configuration.md Use this command to add a new, named profile (e.g., 'staging'). It presents the same prompts as 'confluence init' and saves the configuration separately. ```bash confluence profile add staging # Same prompts as init # Saves as separate profile ``` -------------------------------- ### Create a New Confluence Page Source: https://github.com/pchuri/confluence-cli/blob/main/README.md Create a new Confluence page with a title, space key, and content. ```bash confluence create "My New Page" SPACEKEY --content "Hello World!" ``` -------------------------------- ### Confluence CLI: Get Page Metadata Source: https://github.com/pchuri/confluence-cli/blob/main/plugins/confluence/skills/confluence/SKILL.md Retrieves metadata for a Confluence page. Use `--format json` for machine-readable output. This command works for folders and other bodyless content. ```sh confluence info [--format text|json] ``` ```sh confluence info 123456789 ``` ```sh confluence info 123456789 --format json ``` -------------------------------- ### Read-Only Mode: Enable via Profile Source: https://github.com/pchuri/confluence-cli/blob/main/README.md Enables read-only mode for the Confluence CLI, either during initial setup or when adding a new profile, by using the --read-only flag. ```bash # During init confluence init --read-only ``` ```bash # When adding a profile confluence profile add agent --domain "company.atlassian.net" --token "xyz" --read-only ``` -------------------------------- ### Initialize StorageWalker Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/format-converters.md Instantiate StorageWalker with custom configuration options. The attachmentsDir, labels, buildUrl, webUrlPrefix, and maxDepth parameters allow for customization of the conversion process. ```javascript const { StorageWalker } = require('./lib/storage-walker'); const walker = new StorageWalker({ attachmentsDir: 'attachments', labels: { 'important': 'label-class' }, buildUrl: (path) => `https://example.com${path}`, webUrlPrefix: '/wiki', maxDepth: 256 }); const markdown = walker.walk(storageXml); ``` -------------------------------- ### File Structure Source: https://github.com/pchuri/confluence-cli/blob/main/CONTRIBUTING.md Overview of the project's directory structure, indicating the purpose of each main folder. ```text bin/ # CLI entry points lib/ # Core library code ├── confluence-client.js ├── config.js └── utils.js tests/ # Test files docs/ # Additional documentation ``` -------------------------------- ### Markdown Callout Macros Source: https://github.com/pchuri/confluence-cli/blob/main/README.md Use blockquotes starting with **INFO**, **WARNING**, or **NOTE** to create corresponding Confluence callout macros. These markers round-trip cleanly between markdown and storage format. ```markdown > **INFO** > Heads up — this is an info box. > **WARNING** > Watch out for this. > **NOTE** > Side note for the reader. ``` -------------------------------- ### Get Named Profile Configuration Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/config.md Load a named profile configuration. Accepts an optional profile name, defaulting to 'default'. Returns an object with Confluence connection settings, or null if not found. ```javascript const staging = config.getProfile('staging'); ``` -------------------------------- ### Create Page from Stdin Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/cli-reference.md Creates a Confluence page by piping content from standard input. Useful for dynamic content generation. ```bash # Read from stdin cat page.md | confluence create "Page" DOCS ``` -------------------------------- ### Instantiate ConfluenceClient with Basic Auth Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/confluence-client.md Creates an authenticated Confluence API client instance using basic authentication. Ensure you provide the domain, email, and token for authentication. ```javascript const ConfluenceClient = require('./lib/confluence-client'); const client = new ConfluenceClient({ domain: 'mycompany.atlassian.net', email: 'user@mycompany.com', token: 'ATATT...', authType: 'basic' }); ``` -------------------------------- ### profile list Source: https://github.com/pchuri/confluence-cli/blob/main/plugins/confluence/skills/confluence/SKILL.md Lists all configuration profiles with the active profile clearly marked. ```APIDOC ## `profile list` List all configuration profiles with the active profile marked. ```sh confluence profile list ``` ``` -------------------------------- ### Search Confluence Content Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/confluence-client.md Use the search method to find pages by text query or raw CQL. Specify the limit, whether the query is raw CQL, and the starting index for pagination. ```javascript async search(query, limit = 10, rawCql = false, start = 0) ``` ```javascript // Text search const results = await client.search('deployment guide', 20); ``` ```javascript // CQL search const results = await client.search( 'space.key = "DOCS" AND created >= -7d', 100, true ); ``` -------------------------------- ### Client Constructor Options Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/types.md Options object passed to the ConfluenceClient constructor to configure the connection and behavior. ```APIDOC ## Client Constructor Options Options object passed to `ConfluenceClient` constructor. ```javascript { domain: string, // Required: Confluence domain token: string, // API token/password email: string, // Email for basic auth protocol: string, // 'http' or 'https' (default: 'https') authType: string, // Auth type (default: 'bearer' if token, 'basic' if email) apiPath: string, // API path (default: '/rest/api') forceCloud: boolean, // Force cloud behavior (default: false) readOnly: boolean, // Disable writes (default: false) cookie: string, // Cookie for SSO mtls: { // mTLS config caCert: string, clientCert: string, clientKey: string }, linkStyle: string // Link style preference (default: auto) } ``` ``` -------------------------------- ### Extract Page ID from URL or String Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/confluence-client.md Use this method to get a Confluence page ID from either a direct ID or a full page URL. It handles parsing the ID from the URL if necessary. ```javascript async extractPageId(pageIdOrUrl) ``` ```javascript const id = await client.extractPageId('https://mycompany.atlassian.net/pages/viewpage.action?pageId=123456789'); // Returns: '123456789' ``` -------------------------------- ### MacroConverter Constructor Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/api-reference/format-converters.md Initializes a new MacroConverter instance with configuration options for Confluence Cloud or Server, URL prefix, URL building function, and link style. ```APIDOC ## MacroConverter Constructor ### Description Initializes a new MacroConverter instance with configuration options. ### Parameters #### Constructor Parameters - **isCloud** (boolean) - Optional - Whether target is Confluence Cloud. Defaults to `false`. - **webUrlPrefix** (string) - Optional - URL prefix for web paths (e.g., `/wiki`). Defaults to `''`. - **buildUrl** (function) - Optional - Function to build full URLs from paths. Defaults to an identity function. - **linkStyle** (string) - Optional - Link style: `smart`, `plain`, or `wiki`. Defaults to `auto`. ``` -------------------------------- ### Configuration Module Source: https://github.com/pchuri/confluence-cli/blob/main/_autodocs/INDEX.md Documentation for the configuration module, covering profile management, configuration schema, environment variable resolution, and various authentication types. ```APIDOC ## Configuration Module (`lib/config.js`) ### Description Manages the configuration for the confluence-cli, including loading settings from files, resolving environment variables, and handling different authentication methods. ### Features - Profile management - Configuration object schema definition - Environment variable resolution - Support for multiple authentication types: basic, bearer, mTLS, cookie, none - Configuration file loading and parsing - API path configuration for different Confluence versions - Initialization and validation functions ### Constants - `AUTH_TYPES`: List of supported authentication types. - `AUTH_CHOICES`: Available choices for authentication. - `VALID_LINK_STYLES`: Supported link styles for output. ```