Files
muninn/python_scripts
m105andClaude Sonnet 5 9278d2e8a0 Add a Publisher abstraction and queued job to publish from the UI
Introduce Publisher/PublisherManager (WordPress + Reddit implementations)
so publishing logic is shared between the CLI, the queue, and future
network integrations. Add a "Publish" button on the Posts page that
dispatches PublishPostJob instead of blocking the request — Reddit's
publisher shells out to the existing Playwright sidecar and can take
tens of seconds, so it can't run synchronously in a web request.

Adds a `target` field (e.g. subreddit) and `publishing` status to Post,
plus a `publish_error` field so failures surface in the UI. Refactors
posts:publish to delegate to WordPressPublisher without changing its
CLI output contract (existing tests pass unchanged).

Also fixes two bugs found along the way: UpdatePostRequest was silently
dropping `published_url` from PATCH requests (never in its validation
rules, despite AI_API.md documenting it), and three Livewire index-page
tests were broken by the earlier auth change (never re-run after adding
the `auth` middleware) since they hit routes via HTTP without a logged-in
user.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-21 14:04:45 +03:00
..
2026-07-19 17:52:14 +03:00
2026-07-19 17:52:14 +03:00
2026-07-19 17:52:14 +03:00
2026-07-19 17:52:14 +03:00
2026-07-19 17:52:14 +03:00

Muninn API scripts

Thin Python CLI wrappers around this app's JSON API (see ../AI_API.md for the full API reference). Meant to be called directly by an AI agent on the machine where this app is reachable — no setup beyond Python 3's standard library (no third-party dependencies).

Default base URL: http://localhost:8001. Override with the MUNINN_API_URL environment variable if the app runs elsewhere or on a different port.

Every command prints the API's JSON response to stdout and exits 0 on success. On an HTTP error or if the server can't be reached, it prints a JSON error object to stderr and exits 1.

Sites (read-only)

python3 sites.py list [--name NAME]
python3 sites.py get SITE_ID

Social Accounts (read-only)

python3 accounts.py list [--network NETWORK] [--type TYPE]
python3 accounts.py get ACCOUNT_ID

Posts (full CRUD)

python3 posts.py list [--status STATUS] [--site-id ID] [--social-account-id ID] [--due]
python3 posts.py get POST_ID
python3 posts.py create --site-id ID --type TYPE --body BODY [--social-account-id ID] [--title TITLE] [--status STATUS] [--scheduled-at DATETIME]
python3 posts.py update POST_ID [--site-id ID] [--social-account-id ID] [--type TYPE] [--title TITLE] [--body BODY] [--status STATUS] [--scheduled-at DATETIME] [--published-url URL]
python3 posts.py delete POST_ID

--due finds posts that are scheduled and past their scheduled_at — the query to run to discover what needs publishing right now.

Publishing itself is out of scope for these scripts (they only wrap the HTTP API). See ../AI_API.md for how to actually publish a post (php artisan posts:publish for WordPress, the sidecars/reddit-post sidecar for Reddit, or your own method for anything else — then report back with posts.py update POST_ID --status ...).