CLI Commands Migration¶
Why the Change?¶
Problems with the old format:
Verbose:
agoras publish --network twitter --action postis unnecessarily longPoor discoverability: Hard to find which actions a platform supports
Mixed concerns: Feed automation mixed with direct platform operations
Redundant:
publishcommand doesn’t add semantic value
Benefits of the new format:
Shorter commands:
agoras x postinstead ofagoras publish --network twitter --action postBetter help:
agoras x --helpshows only X-supported actionsClearer structure: Platform commands vs utils commands
Simplified parameters:
--consumer-keyinstead of--twitter-consumer-keyTab completion: Better shell completion support
Note
X Rebrand: In Agoras 2.0+, Twitter has been rebranded to X. Use agoras x instead of agoras twitter. The agoras twitter command still works but is deprecated.
Quick Reference¶
Platform Commands¶
Legacy Format |
New Format |
|---|---|
|
|
|
|
|
|
|
|
Automation Commands¶
Legacy Format |
New Format |
|---|---|
|
|
|
|
|
|
Parameter Changes¶
Authentication Parameters¶
Within platform commands, platform prefixes are removed:
Platform |
Legacy Parameter |
New Parameter |
|---|---|---|
X (formerly Twitter) |
|
|
X (formerly Twitter) |
|
|
|
(Removed in v2.0 - use |
|
|
|
|
Discord |
|
|
YouTube |
|
|
Note: Utils commands use prefixed parameters. For X, use --x-consumer-key (--twitter-consumer-key is deprecated but still works).
Content Parameters¶
Legacy Parameter |
New Parameter |
|---|---|
|
|
|
|
|
|
|
|
|
|
Async/Await Pattern (v2.0)¶
All platform methods now use async/await instead of synchronous calls.
Before (v1.x - synchronous):
from agoras.core.facebook import Facebook
fb = Facebook(facebook_access_token='...')
fb.post(status_text='Hello', status_link='https://example.com')
After (v2.0 - asynchronous):
import asyncio
from agoras.platforms.facebook import Facebook
async def post_to_facebook():
fb = Facebook(facebook_access_token='...')
await fb._initialize_client()
try:
await fb.post(status_text='Hello', status_link='https://example.com')
finally:
await fb.disconnect()
asyncio.run(post_to_facebook())
Key Changes:
All platform methods are now
asyncYou must
awaitall platform operationsAlways call
await fb._initialize_client()before using the platformAlways call
await fb.disconnect()when done (usetry/finallyto ensure cleanup)Use
asyncio.run()to execute async functions from synchronous code
Migration Example:
# Before (v1.x)
def post_content():
fb = Facebook(facebook_access_token='...')
fb.post(status_text='Hello', status_link='https://example.com')
# After (v2.0)
import asyncio
async def post_content():
fb = Facebook(facebook_access_token='...')
await fb._initialize_client()
try:
await fb.post(status_text='Hello', status_link='https://example.com')
finally:
await fb.disconnect()
# Run it
asyncio.run(post_content())