Skip to content

feat: Add CLI flags to confluence init for non-interactive setup#30

Merged
pchuri merged 4 commits intomainfrom
feature/non-interactive-init
Feb 6, 2026
Merged

feat: Add CLI flags to confluence init for non-interactive setup#30
pchuri merged 4 commits intomainfrom
feature/non-interactive-init

Conversation

@pchuri
Copy link
Copy Markdown
Owner

@pchuri pchuri commented Feb 6, 2026

Closes

Fixes #29

Description

Adds support for non-interactive configuration via CLI flags to confluence init command. This enables usage in CI/CD pipelines, Docker builds, and AI coding agents that cannot respond to interactive prompts.

Changes

  • ✨ Add 5 new CLI options to init command:

    • --domain / -d: Confluence domain
    • --api-path / -p: REST API path
    • --auth-type / -a: Authentication type (basic or bearer)
    • --email / -e: Email for basic auth
    • --token / -t: API token
  • 🔄 Support three operational modes:

    1. Interactive Mode (no flags): Existing behavior unchanged
    2. Non-interactive Mode (all required flags): Validates and saves immediately
    3. Hybrid Mode (partial flags): Prompts for missing values with provided values as defaults
  • 🧠 Smart inference:

    • If --email provided without --auth-type: infers basic
    • If neither provided: infers bearer
    • If --api-path missing: infers from domain (e.g., /wiki/rest/api for .atlassian.net)
  • ✅ Full backward compatibility: confluence init (no flags) works exactly as before

Testing

  • ✅ All existing tests pass (40/40)
  • ✅ Validates CLI options with clear error messages
  • ✅ Tested modes: interactive, non-interactive, and hybrid

Documentation

  • Updated README.md with new Option 2: Non-interactive Setup
  • Added examples for all three usage modes
  • Added security note about token handling

- Add CLI options: --domain, --api-path, --auth-type, --email, --token
- Support three modes:
  - Interactive (no flags): existing behavior
  - Non-interactive (all flags): validates and saves immediately
  - Hybrid (some flags): prompts for missing values
- Infer authType from email when not explicitly provided
- Infer apiPath from domain when not provided
- Clear error messages for validation failures
- Update README with new setup options and examples
@pchuri pchuri changed the title [FEATURE] Add CLI flags to confluence init for non-interactive setup feat: Add CLI flags to confluence init for non-interactive setup Feb 6, 2026
@pchuri pchuri requested a review from Copilot February 6, 2026 00:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds CLI flag support to the confluence init command, enabling non-interactive configuration for CI/CD pipelines, Docker builds, and AI coding agents that cannot handle interactive prompts.

Changes:

  • Added 5 new CLI flags (--domain, --api-path, --auth-type, --email, --token) to support non-interactive setup
  • Implemented three operational modes: fully interactive (no flags), fully non-interactive (all required flags), and hybrid (partial flags with prompts for missing values)
  • Added validation helpers and smart inference logic for authentication type and API path defaults

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
lib/config.js Core implementation of CLI option parsing, validation, and multi-mode configuration flow
README.md Documentation updates showing the new non-interactive setup options and examples

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/config.js Outdated
Comment thread lib/config.js Outdated
- Fix default authType to 'bearer' when no email provided (was incorrectly 'basic')
- Simplify canBeNonInteractive condition (remove redundant check)
- Fix hybrid mode email prompt to use 'when' for dynamic authType check
- Fix saveConfig to safely handle undefined email (prevent trim() error)
- Enhance validateCliOptions to use normalizeApiPath for proper validation
@pchuri pchuri requested a review from Copilot February 6, 2026 00:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/config.js
Comment thread lib/config.js Outdated
Comment thread lib/config.js Outdated
- Remove redundant canBeNonInteractive variable, use hasRequiredValues directly
- Remove || 'basic' fallback to let normalizeAuthType handle undefined properly
@pchuri pchuri merged commit 09b6b85 into main Feb 6, 2026
5 checks passed
github-actions Bot pushed a commit that referenced this pull request Feb 6, 2026
# [1.15.0](v1.14.0...v1.15.0) (2026-02-06)

### Features

* Add CLI flags to confluence init for non-interactive setup ([#30](#30)) ([09b6b85](09b6b85))
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 6, 2026

🎉 This PR is included in version 1.15.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

bestend pushed a commit to bestend/confluence-cli that referenced this pull request Feb 9, 2026
…uri#30)

* feat: add CLI flags to confluence init for non-interactive setup

- Add CLI options: --domain, --api-path, --auth-type, --email, --token
- Support three modes:
  - Interactive (no flags): existing behavior
  - Non-interactive (all flags): validates and saves immediately
  - Hybrid (some flags): prompts for missing values
- Infer authType from email when not explicitly provided
- Infer apiPath from domain when not provided
- Clear error messages for validation failures
- Update README with new setup options and examples

* fix: address Copilot AI review feedback

- Fix default authType to 'bearer' when no email provided (was incorrectly 'basic')
- Simplify canBeNonInteractive condition (remove redundant check)

* fix: improve robustness and validation logic

- Fix hybrid mode email prompt to use 'when' for dynamic authType check
- Fix saveConfig to safely handle undefined email (prevent trim() error)
- Enhance validateCliOptions to use normalizeApiPath for proper validation

* refactor: simplify non-interactive mode logic

- Remove redundant canBeNonInteractive variable, use hasRequiredValues directly
- Remove || 'basic' fallback to let normalizeAuthType handle undefined properly
bestend pushed a commit to bestend/confluence-cli that referenced this pull request Feb 9, 2026
# [1.15.0](pchuri/confluence-cli@v1.14.0...v1.15.0) (2026-02-06)

### Features

* Add CLI flags to confluence init for non-interactive setup ([pchuri#30](pchuri#30)) ([4074014](pchuri@4074014))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add CLI flags to confluence init for non-interactive setup

2 participants