@nuanu-ai/magicsearch-cli
v0.1.8
Published
CLI for @nuanu-ai/magicsearch
Downloads
450
Readme
@nuanu-ai/magicsearch-cli
Command-line client for MagicSearch. It resolves a refined purchase prompt to a provider, checkout, product, or public-search fallback URL through the MagicPay gateway.
Install
npm install -g @nuanu-ai/magicsearch-cliThe CLI installs the magicsearch binary and supports Node.js 18 or newer.
Configure
magicsearch uses the shared MagicPay config file under ~/.magicpay/config.json.
magicsearch init ap_your_key
magicsearch init ap_your_key --api-url https://api.example.com/functions/v1/apiEnvironment variables override persisted config:
MAGICPAY_API_KEYMAGICPAY_API_URL
Check the current config:
magicsearch doctorSessions
Session-touching commands (query, search, discover, choose-target,
choose, resolve-intent) run against the MagicPay session started with
magicpay start-session. One live session resolves automatically; with
several parallel sessions, pass the session id explicitly with
--session <id> or export MAGICPAY_SESSION=<id> — ambiguity is an error,
never a silent guess.
Query
magicsearch query "buy Claude Pro" --merchant Claude
magicsearch search "book a flight from Singapore to Istanbul" --merchant "Google Flights" --country SGBy default, the command prints only the resolved URL. Use JSON output when an agent needs provider metadata:
magicsearch query "buy Claude Pro" --merchant Claude --json
magicsearch query "buy Claude Pro" --format jsonUseful hints:
--merchant <name>--domain <domain>--product <name>--category <name>--country <code>--region <region>--place <place>
User Choices
When discovery returns status: "choice_required", share requestUrl and
immediately run the exact returned pollCommand. magicsearch choose uses the
same SDK follow_request behavior as MagicPay: a three-second default cadence,
safe 15-second heartbeats, and the same request id through interruptions and
non-terminal status changes. It claims the selected choice only after the API
reports fulfillment.
magicsearch choose --session <sessionId> --request <requestId> --jsonA diagnostic timeout or caller interruption preserves the complete handoff;
run the same command again. If original output was lost, recover once with
magicpay requests --session <sessionId>. A server-deadline overrun or client
safety deadline permits one reconciliation and then a report if the same
request remains overdue—never create a replacement choice. Safe options may
also be selected explicitly with --choice <choiceId>; never silently choose
for the user.
Commands
magicsearch init <apiKey> [--api-url <url>]magicsearch doctormagicsearch query "<refined prompt>" [options]magicsearch search "<refined prompt>" [options]magicsearch discover "<refined prompt>" [options]magicsearch choose --session <id> --request <id> [--choice <choiceId>] [--json]magicsearch --versionmagicsearch --help
Library
For programmatic use, install @nuanu-ai/magicsearch.
