agoras.cli package

The agoras.cli package provides the command-line interface for Agoras, enabling interaction with social media platforms through a unified CLI.

Package Overview

This package provides:

  • Main entry point (agoras.cli.main) for the agoras command-line tool

  • Platform-specific command parsers for all 10 supported platforms

  • Utility commands for feed automation and scheduling

  • Legacy command support for backward compatibility

  • Platform registry for managing platform actions

Dependencies: Requires agoras-platforms>=2.0.0.

Entry Point

The CLI is installed as a console script entry point:

agoras [options] <command> [options]

See usage for detailed usage examples.

agoras.cli package

Agoras CLI Package.

This package provides the command-line interface for agoras, enabling interaction with various social media platforms through a unified CLI.

agoras.cli.main module

Main entry point for the CLI application.

agoras.cli.base module

Base utilities for CLI argument parsing and common options.

Base utilities for CLI.

This module provides common helper functions for argument parsing and CLI utilities shared across platform commands.

agoras.cli.base.add_common_content_options(parser: ArgumentParser, images: int = 0)[source]

Add common content options (text, link, images).

Args:

parser: ArgumentParser to add options to images: Number of image options to add (0-4)

agoras.cli.base.add_video_options(parser: ArgumentParser, platform: str = None)[source]

Add video-specific options.

Args:

parser: ArgumentParser to add options to platform: Optional platform key for contract-based –video-url help

agoras.cli.registry module

Platform registry for managing supported platforms and their actions.

Platform registry for CLI.

This module contains the registry of all supported platforms and their supported actions.

class agoras.cli.registry.PlatformRegistry[source]

Bases: object

Registry of all platforms and their supported actions.

PLATFORMS: Dict[str, Dict[str, Any]] = {'discord': {'actions': {'authorize', 'delete', 'post', 'video'}, 'description': 'Discord chat platform', 'module': 'agoras.cli.platforms.discord', 'name': 'Discord'}, 'facebook': {'actions': {'authorize', 'delete', 'like', 'post', 'share', 'video'}, 'description': 'Facebook social network', 'module': 'agoras.cli.platforms.facebook', 'name': 'Facebook'}, 'instagram': {'actions': {'authorize', 'post', 'video'}, 'description': 'Instagram social network', 'module': 'agoras.cli.platforms.instagram', 'name': 'Instagram'}, 'linkedin': {'actions': {'authorize', 'delete', 'like', 'post', 'share', 'video'}, 'description': 'LinkedIn professional network', 'module': 'agoras.cli.platforms.linkedin', 'name': 'LinkedIn'}, 'telegram': {'actions': {'authorize', 'delete', 'post', 'video'}, 'description': 'Telegram messaging platform', 'module': 'agoras.cli.platforms.telegram', 'name': 'Telegram'}, 'threads': {'actions': {'authorize', 'delete', 'post', 'share', 'video'}, 'description': 'Threads (Meta) social network', 'module': 'agoras.cli.platforms.threads', 'name': 'Threads'}, 'tiktok': {'actions': {'authorize', 'post', 'video'}, 'description': 'TikTok video platform', 'module': 'agoras.cli.platforms.tiktok', 'name': 'TikTok'}, 'twitter': {'actions': {'authorize', 'delete', 'like', 'post', 'share', 'video'}, 'description': 'Twitter/X social network', 'module': 'agoras.cli.platforms.x', 'name': 'Twitter'}, 'whatsapp': {'actions': {'authorize', 'post', 'template', 'video'}, 'description': 'WhatsApp Business API messaging platform', 'module': 'agoras.cli.platforms.whatsapp', 'name': 'WhatsApp'}, 'x': {'actions': {'authorize', 'delete', 'like', 'post', 'share', 'video'}, 'description': 'X (formerly Twitter) social network', 'module': 'agoras.cli.platforms.x', 'name': 'X'}, 'youtube': {'actions': {'authorize', 'delete', 'like', 'video'}, 'description': 'YouTube video platform', 'module': 'agoras.cli.platforms.youtube', 'name': 'YouTube'}}
classmethod get_platform_info(platform: str) Dict[str, Any][source]

Get platform information.

Args:

platform: Platform name

Returns:

Dictionary with platform information

classmethod get_platform_names() List[str][source]

Get list of all platform names.

Returns:

List of platform names

classmethod get_supported_actions(platform: str) Set[str][source]

Get set of actions supported by platform.

Args:

platform: Platform name

Returns:

Set of supported action names

classmethod platform_exists(platform: str) bool[source]

Check if platform exists in registry.

Args:

platform: Platform name

Returns:

True if platform exists, False otherwise

classmethod validate_action(platform: str, action: str) bool[source]

Check if platform supports action.

Args:

platform: Platform name action: Action name

Returns:

True if action is supported, False otherwise

agoras.cli.commands package

CLI command implementations.

agoras.cli.commands package

agoras.cli.commands.publish module

Publish command for posting to social networks.

agoras.cli.utils package

Utility commands for automation (feed, scheduling).

agoras.cli.utils package

agoras.cli.utils.feed module

Feed automation utilities for RSS/Atom feeds.

agoras.cli.utils.schedule module

Scheduling utilities for Google Sheets integration.

agoras.cli.validator module

Validation utilities for CLI parameters.

Action validator for CLI.

This module validates that requested actions are supported by the target platform.

class agoras.cli.validator.ActionValidator[source]

Bases: object

Validates that platform supports requested action.

static get_supported_actions(platform: str) set[source]

Get supported actions for a platform.

Args:

platform: Platform name

Returns:

Set of supported action names

static validate(platform: str, action: str) None[source]

Validate action is supported by platform.

Args:

platform: Platform name action: Action name

Raises:

ValueError: If action not supported by platform

agoras.cli.converter module

Conversion utilities for CLI data formats.

Parameter converter for CLI.

This module converts between new and legacy parameter formats. This is a skeleton implementation to be fully populated in later phases.

class agoras.cli.converter.ParameterConverter(platform: str)[source]

Bases: object

Convert between new and legacy parameter formats.

COMMON_MAPPINGS = {'feed_url': 'feed_url', 'image_1': 'status_image_url_1', 'image_2': 'status_image_url_2', 'image_3': 'status_image_url_3', 'image_4': 'status_image_url_4', 'link': 'status_link', 'loglevel': 'loglevel', 'max_count': 'feed_max_count', 'max_post_age': 'feed_max_post_age', 'post_lookback': 'feed_post_lookback', 'sheets_client_email': 'google_sheets_client_email', 'sheets_id': 'google_sheets_id', 'sheets_name': 'google_sheets_name', 'sheets_private_key': 'google_sheets_private_key', 'text': 'status_text'}
PLATFORM_MAPPINGS: Dict[str, Dict[str, str]] = {'discord': {'bot_token': 'discord_bot_token', 'channel_name': 'discord_channel_name', 'post_id': 'discord_post_id', 'server_name': 'discord_server_name', 'video_title': 'discord_video_title', 'video_url': 'discord_video_url'}, 'facebook': {'app_id': 'facebook_app_id', 'client_id': 'facebook_client_id', 'client_secret': 'facebook_client_secret', 'object_id': 'facebook_object_id', 'post_id': 'facebook_post_id', 'profile_id': 'facebook_profile_id', 'video_description': 'facebook_video_description', 'video_title': 'facebook_video_title', 'video_type': 'facebook_video_type', 'video_url': 'facebook_video_url'}, 'instagram': {'client_id': 'instagram_client_id', 'client_secret': 'instagram_client_secret', 'object_id': 'instagram_object_id', 'post_id': 'instagram_post_id', 'video_caption': 'instagram_video_caption', 'video_type': 'instagram_video_type', 'video_url': 'instagram_video_url'}, 'linkedin': {'client_id': 'linkedin_client_id', 'client_secret': 'linkedin_client_secret', 'object_id': 'linkedin_object_id', 'post_id': 'linkedin_post_id', 'video_title': 'linkedin_video_title', 'video_url': 'linkedin_video_url'}, 'telegram': {'bot_token': 'telegram_bot_token', 'chat_id': 'telegram_chat_id', 'message_id': 'telegram_message_id', 'parse_mode': 'telegram_parse_mode', 'post_id': 'telegram_message_id', 'video_title': 'video_title', 'video_url': 'video_url'}, 'threads': {'app_id': 'threads_app_id', 'app_secret': 'threads_app_secret', 'post_id': 'threads_post_id', 'video_title': 'threads_video_title', 'video_url': 'threads_video_url'}, 'tiktok': {'allow_comments': 'tiktok_allow_comments', 'allow_duet': 'tiktok_allow_duet', 'allow_stitch': 'tiktok_allow_stitch', 'auto_add_music': 'tiktok_auto_add_music', 'client_key': 'tiktok_client_key', 'client_secret': 'tiktok_client_secret', 'description': 'tiktok_description', 'privacy': 'tiktok_privacy_status', 'title': 'tiktok_title', 'username': 'tiktok_username', 'video_url': 'tiktok_video_url'}, 'twitter': {'consumer_key': 'twitter_consumer_key', 'consumer_secret': 'twitter_consumer_secret', 'oauth_secret': 'twitter_oauth_secret', 'oauth_token': 'twitter_oauth_token', 'post_id': 'tweet_id', 'video_title': 'twitter_video_title', 'video_url': 'twitter_video_url'}, 'whatsapp': {'access_token': 'whatsapp_access_token', 'business_account_id': 'whatsapp_business_account_id', 'language_code': 'whatsapp_template_language', 'message_id': 'whatsapp_message_id', 'phone_number_id': 'whatsapp_phone_number_id', 'recipient': 'whatsapp_recipient', 'template_components': 'whatsapp_template_components', 'template_name': 'whatsapp_template_name', 'video_title': 'video_title', 'video_url': 'video_url'}, 'x': {'consumer_key': 'twitter_consumer_key', 'consumer_secret': 'twitter_consumer_secret', 'oauth_secret': 'twitter_oauth_secret', 'oauth_token': 'twitter_oauth_token', 'post_id': 'tweet_id', 'video_title': 'twitter_video_title', 'video_url': 'twitter_video_url'}, 'youtube': {'category_id': 'youtube_category_id', 'client_id': 'youtube_client_id', 'client_secret': 'youtube_client_secret', 'description': 'youtube_description', 'keywords': 'youtube_keywords', 'privacy': 'youtube_privacy_status', 'title': 'youtube_title', 'video_id': 'youtube_video_id', 'video_url': 'youtube_video_url'}}
convert_from_legacy(legacy_args: Dict[str, Any]) Dict[str, Any][source]

Convert legacy args to new format.

Args:

legacy_args: Legacy format arguments

Returns:

Dictionary of new-format arguments

convert_to_legacy(args: Namespace) Dict[str, Any][source]

Convert new CLI args to legacy format for core modules.

Args:

args: Parsed arguments from new CLI

Returns:

Dictionary of legacy-format arguments

convert_to_legacy_with_validation(args: Namespace) Dict[str, Any][source]

Convert new CLI args to legacy format with validation.

Args:

args: Parsed arguments from new CLI

Returns:

Dictionary of legacy-format arguments

Raises:

ValueError: If validation fails

classmethod get_all_mappings(platform: str = None) Dict[str, Any][source]

Get complete mapping reference for debugging.

Args:

platform: Optional platform to get specific mappings

Returns:

Dictionary with all mapping information

get_conversion_report(args: Namespace) Dict[str, Any][source]

Generate detailed conversion report for debugging.

Args:

args: Parsed arguments from new CLI

Returns:

Dictionary with conversion details

get_unmapped_parameters(args: Namespace) list[source]

Get list of parameters that weren’t converted (pass-through).

Args:

args: Parsed arguments from new CLI

Returns:

List of parameter names that weren’t mapped

log_conversion(args: Namespace, legacy_args: Dict[str, Any]) None[source]

Log parameter conversion details for debugging.

Args:

args: Original new-format arguments legacy_args: Converted legacy-format arguments

validate_legacy_args(legacy_args: Dict[str, Any]) None[source]

Validate that required legacy parameters are present.

Args:

legacy_args: Legacy format arguments

Raises:

ValueError: If required parameters are missing

agoras.cli.migration module

Migration utilities for CLI configuration.

Migration guidance utilities for CLI.

This module provides utilities for helping users migrate from the legacy publish command to the new platform-specific command structure.

agoras.cli.migration.convert_legacy_params_to_new_format(network: str, action: str, args_dict: Dict[str, Any]) str[source]

Convert legacy parameter names to new format for command suggestion.

Args:

network: Target social network action: Action to perform args_dict: Dictionary of command arguments

Returns:

String with converted parameters

agoras.cli.migration.format_migration_warning(old_command_parts: Dict[str, str], new_command: str) str[source]

Format a user-friendly deprecation message.

Args:

old_command_parts: Dictionary with network, action from old command new_command: The new command syntax

Returns:

Formatted warning message

agoras.cli.migration.suggest_new_command(network: str, action: str, args_dict: Dict[str, Any]) str[source]

Generate the equivalent new command syntax from legacy arguments.

Args:

network: Target social network action: Action to perform args_dict: Dictionary of command arguments

Returns:

String with the new command format

agoras.cli.legacy module

Legacy command support for backward compatibility.