npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@h4pplness/confluence-cli

v1.0.2

Published

CLI tool de tao trang Confluence tu template va cap nhat trang qua storage HTML

Readme

confluence-cli

A CLI tool for creating Confluence pages from templates and updating existing pages through downloaded storage-format HTML files.

Installation

Install the published package globally:

npm install -g @h4pplness/confluence-cli

Or install from a local checkout:

npm install -g .

Quick Start

# 1. Configure a profile
confluence-cli config set

# 2. List available templates
confluence-cli template list

# 3. Inspect template variables
confluence-cli template detail feature-design

# 4. Create a new page
confluence-cli page create \
  --space "DEV" \
  --parent "123456" \
  --title "Authentication Module" \
  --template "feature-design" \
  --data '{"title":"Authentication Module","mo_ta_chuc_nang":"...","thiet_ke_api":"..."}'

# Or use a JSON file
confluence-cli page create --from-file ./input.json

# Download, edit, and update an existing page
confluence-cli page get --page-id "789012" --download
confluence-cli page update --file ./confluence-pages/789012-v3-page-title.html --dry-run
confluence-cli page update --file ./confluence-pages/789012-v3-page-title.html

Config

Set Up a Profile

confluence-cli config set                    # Interactive wizard
confluence-cli config set --profile dc-prod  # Specific profile name

The CLI supports 3 authentication methods:

| Method | Use case | Header | |---|---|---| | cloud_basic | Confluence Cloud | Basic base64(email:apiToken) | | server_basic | Server / Data Center | Basic base64(username:password) | | pat | Server / Data Center v7.9+ | Bearer <token> |

Config Commands

confluence-cli config list                   # List profiles
confluence-cli config show                   # Show active profile details
confluence-cli config show --profile dc-prod
confluence-cli config use dc-prod            # Switch active profile
confluence-cli config delete dc-prod         # Delete a profile
confluence-cli config test                   # Test the connection

Template

Manage Templates

confluence-cli template list                          # List templates
confluence-cli template detail feature-design         # Show details and variables
confluence-cli template detail feature-design --full  # Also show generated HTML
confluence-cli template create                        # Create a template interactively
confluence-cli template create --name my-tpl --file ./my.hbs
confluence-cli template delete my-tpl
confluence-cli template export my-tpl --output ./export/
confluence-cli template import ./my.hbs ./my.json

Template Structure

Each template contains 2 files stored in the app data directory:

feature-design.hbs - HTML content using Handlebars:

<h1>{{title}}</h1>
<h2>Feature Description</h2>
<p>{{{mo_ta_chuc_nang}}}</p>

{{var}} escapes HTML | {{{var}}} preserves raw HTML and line breaks

feature-design.json - Metadata:

{
  "name": "feature-design",
  "displayName": "Feature Design",
  "variables": [
    { "key": "mo_ta_chuc_nang", "label": "Description", "required": true, "type": "text" }
  ]
}

System variables are injected automatically and do not need to be provided:

  • {{_generated_at}} - generation time
  • {{_template_name}} - template name

Page

Create a Page

# Using flags
confluence-cli page create \
  --space "DEV" \
  --parent "123456" \
  --title "Page Title" \
  --template "feature-design" \
  --data '{"mo_ta_chuc_nang":"...", "thiet_ke_api":"..."}'

# Using a JSON file
confluence-cli page create --from-file ./input.json

# Dry run: preview HTML without calling the API
confluence-cli page create --from-file ./input.json --dry-run

Update a Page

# Download raw Confluence storage HTML and metadata
confluence-cli page get --page-id "789012" --download

# Edit the downloaded .html file, then dry-run the update
confluence-cli page update --file ./confluence-pages/789012-v3-page-title.html --dry-run

# Push the edited file back to Confluence
confluence-cli page update --file ./confluence-pages/789012-v3-page-title.html

# Optional: change the title while updating body HTML
confluence-cli page update --file ./confluence-pages/789012-v3-page-title.html --title "Page Title v2"

Downloaded pages are saved to ./confluence-pages/ by default as a .html body file plus a .meta.json file. The metadata records the page ID, title, version, URL, and profile name. page update --file checks the downloaded version against the current server version and stops if the page changed; use --force only when you intentionally want to overwrite with the local file.

Create JSON File Format (--from-file)

Create:

{
  "spaceKey": "DEV",
  "parentPageId": "123456",
  "title": "Authentication Module",
  "templateName": "feature-design",
  "data": {
    "title": "Authentication Module",
    "mo_ta_chuc_nang": "Handle login/logout with JWT",
    "thiet_ke_api": "POST /auth/login\nPOST /auth/refresh",
    "thiet_ke_database": "Tables: users, refresh_tokens"
  }
}

Get Page Details

confluence-cli page get --page-id "789012"
confluence-cli page get --page-id "789012" --raw
confluence-cli page get --page-id "789012" --download
confluence-cli page get --page-id "789012" --download --output ./docs

Data Location

| OS | Config & Templates | |---|---| | Windows | %APPDATA%\confluence-cli\ | | macOS | ~/Library/Application Support/confluence-cli/ | | Linux | ~/.config/confluence-cli/ |