magic-builder
CLI for Magic Builder (妙笔): publish HTML pages, deploy FaaS functions, upload files, generate links, and install the Magic Builder Codex skill.
Install
npm install -g magic-builder
With Bun:
bun add -g magic-builder
The package provides three equivalent command names:
magic-builder --help
magic-cli --help
miaobi --help
You can also run it without installing:
npx magic-builder help
bunx magic-builder help
Update the CLI:
magic-builder update
magic-builder update --manager bun
update detects npm or Bun automatically; --manager is only for overriding.
Authentication
Most write operations need a Magic developer token.
magic-builder auth login
Manual token setup:
magic-builder auth set <token>
magic-builder auth show
Token lookup order:
--token
MAGIC_TOKEN
~/.magic-builder/magic-token
- legacy
~/.magic-token
- project
.magic-token
CLI state is stored under:
~/.magic-builder/
This includes:
magic-token
magic-apps.json
Common Commands
Publish an HTML page:
magic-builder page publish app.html --title "Dashboard"
List or export pages:
magic-builder page list --scope mine
magic-builder page list --scope public --title demo
magic-builder page export --id <id> --out app.html
Delete a page:
magic-builder page delete --id <id>
Deploy a FaaS function:
magic-builder faas publish handler.js --name report-api
List or delete FaaS functions:
magic-builder faas list
magic-builder faas list --title report
magic-builder faas delete --id <id>
Upload, list, or delete files:
magic-builder file upload logo.png
magic-builder file list
magic-builder file list --title logo
magic-builder file delete --id <id>
Generate a Magic link:
magic-builder link create --title "Weekly Report"
magic-builder link create --fid <faas-id>
Submit Markdown to a People performance draft (perf is an alias):
magic-builder performance --cookie ./cookie.txt --markdown ./performance.md
magic-builder perf --cookie "$PEOPLE_COOKIE" --markdown "# Performance summary"
magic-builder perf --cookie ./cookie.txt --markdown https://example.com/performance.md --dry-run
Cookie input accepts a raw Cookie header, a local path, or a Netscape cookie file. Markdown input accepts literal content, a local path, an HTTP(S) URL, or stdin. The command extracts x-f-csrf from the Cookie and does not print the Cookie in its output.
When --cookie and --cookie-file are omitted, performance automatically reads ./cookie.txt, matching the default output of extract-cookie:
magic-builder extract-cookie --curl-file ./request.curl
magic-builder performance --markdown ./performance.md
Extract Cookie from a copied curl command. This is a top-level general-purpose command. The default output is ./cookie.txt; the file is created with mode 0600:
magic-builder extract-cookie --curl-file ./request.curl
magic-builder extract-cookie --curl "curl 'https://example.com/...' -b 'foo=bar; token=value'"
cat ./request.curl | magic-builder extract-cookie --out-dir ./secrets
Create or append a Feishu document HTML Box:
magic-builder doc create --html app.html --title "Demo"
magic-builder doc append --html app.html --doc-token <docx-token>
Install or update the Magic Builder Codex skill:
magic-builder skill install
magic-builder skill check-update
magic-builder skill update
Check local environment:
magic-builder version
magic-builder doctor
magic-builder config get
Help
All of these forms are supported:
magic-builder help
magic-builder help page
magic-builder page help
magic-builder page publish help
magic-builder man
--help, -h, and --man are also supported.
Global Options
--base-url, --magic-base-url <url> Magic service base URL
--token <token> Auth token override
--format json|table|plain Output format, default json
--quiet, -q Suppress progress messages
--version, -v Show version
Default Magic service:
https://magic.solutionsuite.cn