Skip to content

Add wp datamachine auth CLI commands (connect/disconnect/config/status) #508

@chubes4

Description

@chubes4

Summary

The auth abilities already exist in core (datamachine/get-auth-status, datamachine/disconnect-auth, datamachine/save-auth-config) but there's no CLI surface for them. Need a wp datamachine auth command.

Proposed subcommands

wp datamachine auth status [<handler_slug>]

  • No arg: show table of all registered auth providers with configured/authenticated status
  • With arg: show detailed status for one provider

wp datamachine auth connect <handler_slug>

  • For OAuth providers (Twitter, Instagram, Facebook, Reddit, Threads): calls get-auth-status ability which returns oauth_url, prints it for the user to click in browser. Existing callback handlers complete the flow.
  • For non-OAuth providers (Bluesky): accepts --config flags directly (e.g. --handle=x --app-password=y), calls save-auth-config ability.

wp datamachine auth disconnect <handler_slug>

  • Wraps disconnect-auth ability. Clears stored account data.

wp datamachine auth config <handler_slug>

  • Wraps save-auth-config ability. Saves API keys / client credentials.
  • Shows required config fields via get_config_fields() on the provider.

Context

  • All three abilities are in inc/Abilities/AuthAbilities.php
  • Auth providers register via datamachine_auth_providers filter
  • Base classes: BaseAuthProvider, BaseOAuth1Provider, BaseOAuth2Provider in inc/Core/OAuth/
  • Each provider implements get_authorization_url() and handle_oauth_callback() for OAuth flow
  • New command class should go in inc/Cli/Commands/AuthCommand.php extending BaseCommand
  • Register in Bootstrap.php as wp datamachine auth

Current state

The data-machine-socials plugin has per-platform status subcommands (e.g. wp datamachine-socials twitter status) but these are convenience wrappers — the core auth management belongs in data-machine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions