praxis-ai-cli
v0.2.0
Published
PraxisHub CLI for submitting local Markdown articles to WeChat Official Account draft workflows.
Readme
PraxisHub CLI
Agent-facing CLI for submitting local Markdown articles to the hosted PraxisHub WeChat draft workflow.
Install
npm install -g praxis-ai-cliOr run without a global install:
npx praxis-ai-cli publish wechat-draft ./article.md --title "Article title" --jsonLocal AI and automation should call the installed praxis-ai command. Running node bin/praxis-ai.mjs is only for CLI package development.
Login
praxis-ai auth loginThe command opens the PraxisHub login page. After login, the page returns the long-lived user session token to a loopback callback owned by the CLI. The CLI stores it in ~/.praxis-ai/config.json with file mode 0600; the token is never printed in command output.
For a terminal without a browser, run praxis-ai auth login --no-browser and open the printed URL on the same device. The local callback must remain reachable until login completes.
The previous password-stdin flow remains available for CI compatibility:
printf '%s\n' "$PRAXIS_AI_PASSWORD" | praxis-ai auth login YOUR_EMAIL_OR_USERNAME --password-stdinRemove the saved device credential with:
praxis-ai auth logoutSelect a workflow
praxis-ai workflow list
praxis-ai workflow current
praxis-ai workflow select WORKFLOW_IDThe selected workflow is stored as pipeline_id and reused by later publish commands. Selection verifies that the workflow exists, is active, and is connected to a WeChat Official Account.
Configure manually
praxis-ai config set api-url https://mt-api.kakacut.cn
praxis-ai config set web-url https://praxis-ai.kakacut.cn
praxis-ai config set workspace-id cloud-wechat
praxis-ai config set pipeline-id wechat-markdown-default
praxis-ai config set cover-template-id wechat-editorial-titleEnvironment overrides are also supported:
PRAXIS_AI_API_TOKEN=YOUR_API_TOKEN \
PRAXIS_AI_COVER_TEMPLATE_ID=wechat-editorial-title \
praxis-ai publish wechat-draft ./article.md --title "Article title" --jsonThe bearer credential is the only source of actor identity. Browser login returns the existing POST /auth/login session token to the CLI; it never persists the identifier or password and never sends identity overrides in business request URLs. Trusted automation can still use auth token or PRAXIS_AI_API_TOKEN, which is an operations credential bound by the server to one service actor. It cannot select or impersonate an arbitrary user. workspace-id only selects the requested workspace, and the server verifies that the token-derived actor can access it.
The CLI creates a WeChat Official Account draft only. It does not publish publicly.
publish wechat-draft uses the canonical asynchronous publishing contract. It sends the Markdown content directly to POST /api/article-drafts, freezes layout and cover previews through the draft preview APIs, submits POST /api/publishing-tasks, and polls GET /api/publishing-tasks/:runId.
The CLI honors the selected flow's review policy. When the flow requires review, the first command freezes the article, layout, and cover, then returns review_id, preview_url, and cover_preview_url without creating a publishing task. Review the materials, approve them explicitly, and resume the same operation:
praxis-ai review approve REVIEW_ID --json
praxis-ai publish wechat-draft ./article.md --review-id REVIEW_ID --jsonPublishing operations are journaled under ~/.praxis-ai/publishing-operations.json. Retrying identical input reuses the same draft, previews, request id, and task even if a prior HTTP response was lost. Use --new-run only when a separate task is intentional, or pass --run-id to control the idempotency key. Tests and managed environments can override the journal path with PRAXIS_AI_OPERATION_JOURNAL.
The configured publishing flow must be active and bind a WeChat Official Account. The cover template can be overridden with --cover-template, PRAXIS_AI_COVER_TEMPLATE_ID, or cover_template_id; otherwise the flow setting and then wechat-editorial-title are used. JSON output identifies the canonical draft_id, preview_id, cover_preview_id, and run_id, plus the original local_article_path; it does not expose an uploaded server filesystem path.
