Skip to content

Add interactive Connect-Confluence that opens a browser for token creation and lets the user pick a site #18

Description

A developer running Connect-Confluence for the first time should not have to know their site name, cloud ID, or token in advance. The current command requires all three as mandatory parameters, which is fine for automation but creates unnecessary friction for interactive sessions.

Request

Desired capability

Running Connect-Confluence interactively with no parameters (or with a -Interactive switch) should:

  1. Open the Atlassian API token creation page in the default browser, so the user can create or copy a token without hunting for the URL.
  2. Prompt for credentials (Username and Token) in the terminal once the user is ready.
  3. Call Get-ConfluenceAccessibleResource with the supplied token to enumerate all sites the token can reach.
  4. If more than one site is returned, present a numbered or named menu and let the user pick one ($host.UI.PromptForChoice or Out-ConsoleGridView).
  5. Connect to the chosen site and store the context exactly as the non-interactive path does today.

If only one site is returned, skip the menu and connect directly.

The non-interactive path (-Site, -CloudId, -Username, -Token) is unchanged.

Acceptance criteria

  • Running Connect-Confluence with no mandatory parameters launches the browser and guides the user through token setup and site selection.
  • When a token can reach multiple sites, a clear choice list is shown.
  • When only one site is reachable, the user is connected without extra prompts.
  • The resulting context is identical to what a direct Connect-Confluence -Site ... -Username ... -Token ... call would produce.
  • The interactive path does not break or require changes from callers using the existing strict-parameter path.

Technical decisions

Mechanism for site discovery: Get-ConfluenceAccessibleResource already exists and returns the id (cloud ID), url, name, and scopes for every accessible site. No new API call is needed.

Browser launch: Start-Process with the token-creation URL. Wrapping it in a Write-Host message ("Opening the Atlassian token page in your browser...") so terminal-only environments degrade gracefully.

Site selection UI: $host.UI.PromptForChoice is cross-platform and works in all PowerShell hosts (terminal, VS Code, ISE). Out-ConsoleGridView (PSModule/ConsoleGridView) would be nicer but adds a dependency. Decision: use PromptForChoice by default; consider Out-ConsoleGridView as an optional enhancement if the module gains that dependency.

Parameter set design: Open question — a dedicated -Interactive switch on the existing Connect-Confluence vs. a separate parameter set with no mandatory parameters. Resolve at implementation.

Open: Should the interactive path also accept a -Site filter so a caller can say "I know I want msxorg, just handle the token part interactively"? Defer to implementation.


Implementation plan

Core changes

  • Add an Interactive parameter set to Connect-Confluence (no mandatory parameters)
  • Open https://id.atlassian.com/manage-profile/security/api-tokens in the default browser via Start-Process
  • Prompt for Username and Token via Read-Host / Read-Host -AsSecureString
  • Call Get-ConfluenceAccessibleResource to enumerate accessible sites
  • If one site: connect directly; if multiple: prompt with $host.UI.PromptForChoice and connect to the chosen site
  • Update help (param description + new .EXAMPLE interactive block)

Tests

  • Surface test: the Interactive parameter set is exported
  • Unit test (mocked): single-site path connects without prompting for selection
  • Unit test (mocked): multi-site path shows a choice and connects to the chosen site

Documentation

  • Update Connect-Confluence help with an interactive usage example
  • Add a note in the module README / getting-started guide pointing users to Connect-Confluence (no arguments) as the recommended first-run experience

Metadata

Metadata

Assignees

No one assigned

    Labels

    minorMinor change, version 0.x.0 increase

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions