Skip to content

Shoof AI CLI

shoof is the Shoof AI command line. It works with one app at a time and does from a terminal what the dashboard and the REST API do: search, ask for an answer, import records, run a resync, change settings, synonyms and rules, and read analytics. Every command takes --json, so scripts, CI jobs and AI agents can read its output.

It needs Node.js 18 or later.

Terminal window
npm install -g @shoof/cli
shoof --help

To run it once without installing it, use npx @shoof/cli <command>.

Give it your app’s ID and its admin key, both in the dashboard under API keys. See API keys.

Terminal window
shoof login --app app_123 --key shf_adm_...

login checks the key and saves both to ~/.config/shoof/config.json, which only your user can read. shoof logout deletes that file.

A search key works too, for search and ask only.

For CI and scripts, set environment variables instead of logging in:

Variable
SHOOF_APP The app ID
SHOOF_ADMIN_KEY The admin key (or a search key, for search and ask)
SHOOF_HOST The API host, if not https://api.shoofai.com

The flags --app, --key and --host come first, then the variables, then what login saved.

Terminal window
shoof search running shoes
shoof search "running shoes" -n 5 --page 1 --filters '{"brand":"Acme"}'
shoof ask "what is the return policy?"

search takes the same --lang, --mode and --filters as the search endpoint. It prints each result’s title, ID and URL; --json prints the whole response. Searches from the CLI are sent with analytics: false, so they don’t show in your analytics.

ask streams the answer as it’s written, then lists its sources.

Terminal window
shoof records import products.jsonl
cat posts.json | shoof records import -
shoof records get prod_42
shoof records delete prod_42 prod_43
shoof records clear --yes

records import reads a file of records, or standard input for -. The file is either a JSON array of records or JSON Lines, one record per line, in the format of Records:

{"id": "prod_42", "type": "product", "title": "Trail runner", "url": "https://shop.example/p/42", "price": 89}

It sends them in batches of up to 500 and prints its progress. When the API asks it to slow down (429), it waits as long as Retry-After says and tries again. Records the API rejects are listed at the end, and the command exits with status 1.

With --replace, the import is a full resync: records that aren’t in the file are removed.

Terminal window
shoof records import catalog.jsonl --replace

The CLI starts a resync, sends every record with it, then commits it, so the new records go live at once. If a record fails, it doesn’t commit, because that would remove the record from your index. Fix the file and run the import again (the resync resumes), or keep what was sent with shoof reindex commit.

The reindex commands run each step by hand:

Terminal window
shoof reindex start # --no-copy starts from an empty index
shoof reindex status
shoof reindex commit
shoof reindex cancel
Terminal window
shoof settings get
shoof settings get hitsPerPage
shoof settings set hitsPerPage 30
shoof settings set mode keyword
shoof settings set allowedReferers '["https://shop.example"]'
shoof settings preset store

settings set parses the value as JSON, and otherwise sends it as a string. It changes that one setting and leaves the others as they are. See App settings for each setting.

Terminal window
shoof synonyms list
shoof synonyms add sofa couch settee
shoof synonyms add --input phone iphone android
shoof synonyms remove syn_abc123

synonyms add with several terms makes them all find each other. With --input, searching the input finds the terms, but not the other way round. See Synonyms.

Terminal window
shoof rules list
shoof rules add '{"pattern":"sale","match":"contains","pins":[{"id":"prod_42","position":1}]}'
shoof rules add @rule.json
shoof rules remove rule_abc123

A rule is the JSON object described in Rules. @ reads it from a file.

Terminal window
shoof analytics
shoof analytics --from 2026-10-01 --to 2026-11-01
shoof analytics --no-results --json

analytics prints the totals, the top searches and the searches that found nothing for the last 14 days, or for --from to --to. --no-results prints only the searches that found nothing, the ones to fix with synonyms, rules or new content. With --json it prints the whole analytics response, including a series by --interval (hour, day or week).

Status
0 It worked.
1 The API returned an error, or records failed to import.
2 The command or its arguments are wrong.

Errors go to standard error as Error <status> <code>: <message>, the code being one of the API’s error codes. With --json, they’re the API’s error object.

An agent that can run commands, such as Claude Code or Cursor, can use the CLI with --json. Set SHOOF_APP and SHOOF_ADMIN_KEY in its environment, and tell it to run shoof --help first. To give an assistant the same abilities without a terminal, use the MCP server.