quiverai
v1.1.2
Published
QuiverAI CLI: add creations to React projects. For the API SDK, install @quiverai/sdk.
Readme
QuiverAI CLI
Add QuiverAI creations and SVG files to your React project as components.
This is the command-line tool. To call the QuiverAI API from code, install the TypeScript SDK, @quiverai/sdk.
npx quiverai add https://app.quiver.ai/creations/<CREATION_ID>add writes one .tsx or .jsx file that exports a self-contained React component, or one such file per icon for an icon set. It edits no other file.
Requires Node.js 22.12 or later.
Add a component
# A creation, by URL or id
npx quiverai add https://app.quiver.ai/creations/<CREATION_ID>
npx quiverai add <CREATION_ID> --name logo
# The newest creation in a chat
npx quiverai add https://app.quiver.ai/chat/<CHAT_ID> --latest
# Every icon of an icon set, into a folder named after the set
npx quiverai add https://app.quiver.ai/library/sets/<ICON_SET_ID>
# One icon of a set, by the link Studio shows while it is open
npx quiverai add https://app.quiver.ai/library/sets/<ICON_SET_ID>/artifacts/<ICON_ID>
# A public share link (no login)
npx quiverai add https://app.quiver.ai/share/<SHARE_ID>
# Any SVG file on the web (no login)
npx quiverai add https://example.com/logo.svg --name logoThe CLI prints the file it wrote and the line to import it:
Added FoxLogo to src/components/quiverai/fox-logo.tsx
import { FoxLogo } from "@/components/quiverai/fox-logo";The component takes width, height and className props:
<FoxLogo width={32} height={32} />Where the file goes
The first of these that applies:
--path <dir|file>."quiverai": { "dir": "<path>" }in yourpackage.json.- The
componentsalias incomponents.json(shadcn projects), in aquiverai/folder. src/components/quiverai/ifsrc/exists.components/quiverai/.
The file is .tsx when the project uses TypeScript and .jsx otherwise. In a monorepo, run the command in the app's folder or pass --cwd ./apps/web.
Component name
Without --name, the name comes from the creation's file name, or the SVG URL's file name (fox-logo.svg becomes FoxLogo in fox-logo.tsx). In a terminal, the CLI asks Component name? with that suggestion filled in; otherwise, or with --yes, it uses the suggestion. React is reserved and becomes ReactIcon.
Icon sets
An icon set link (/library/sets/<ID> or /icon-sets/<ID>) installs every icon in the set as its own React component, in a folder named after the set:
Added 24 icons from Audio Communication to src/components/quiverai/audio-communication/
import { Microphone } from "@/components/quiverai/audio-communication/microphone";Each file keeps its icon's real name, digits and all (number-1.tsx, arrow-left-circle-filled.tsx). When icons of a set would share a name, every one of them gets the last six hex digits of its id (arrow-left-3f9a2c.tsx). A set whose slug is not already lower-case kebab-case gets the end of its id on its folder too (my-icons-v2-4e4f86/), so two sets never share one. --path <dir> names the folder itself, --overwrite or --yes replaces files that differ, and --dry-run lists what would be written. --name, --latest and a file --path do not apply to a set.
A link to one icon of a set (/library/sets/<ID>/artifacts/<ICON_ID> or /icon-sets/<ID>/artifacts/<ICON_ID>) installs only that icon, as a creation link does, and takes the same options.
An icon QuiverAI cannot turn into a component, or one deleted since the set was listed, is skipped with a warning and counted in the summary (1 skipped: can't be converted). An icon listed twice is installed once, with a warning. If the set itself is deleted while it installs, the command fails and writes nothing. The set's listing and an install that fail for a moment (a server error, a rate limit, a dropped connection) are tried up to three times. Deleting, renaming or adding icons, or renaming the set, in QuiverAI and adding it again can leave old files next to the new ones. An added icon named like an installed one gives both an id-tagged file, and the old untagged file stays, so its imports stop getting updates: delete the old files and move those imports yourself.
Existing files
The CLI never replaces a file silently. If the file exists with different content, it asks first. When it cannot ask (see Scripts and CI), it fails with exit code 1; pass --overwrite.
Options
| Option | Description |
| --- | --- |
| --name <name> | Component name, in any case (fox logo, fox-logo, FoxLogo). |
| --latest | For a chat link, add the newest creation without asking. |
| --path <dir\|file> | Write to this folder or file. |
| --cwd <dir> | Project folder. Defaults to the current folder. |
| -o, --overwrite | Replace an existing file with different content. |
| --yes | Skip prompts: use the suggested name and replace a changed file. |
| --dry-run | Run the same steps and show what would be written, without writing. |
Authentication
Creation, chat and icon set links need a QuiverAI account. Share links and SVG URLs do not.
npx quiverai login # sign in through your browser
npx quiverai whoami # shows the signed-in account
npx quiverai logout # signs outlogin needs a terminal, and is not available with --json, --non-interactive or CI. On a machine without a browser, such as over SSH, press H at the login prompt. Open the link on any device, approve, then paste the URL your browser lands on.
login signs in as the QuiverAI CLI application, which QuiverAI hosts at https://app.quiver.ai/oauth/quiverai-cli.json, whatever --app-url is. Set QUIVERAI_CLIENT_ID to override that client ID.
The CLI stores credentials in your OS keychain when one is available, and otherwise in a file only your user can read, under quiverai/ in your config folder: $XDG_CONFIG_HOME if set, otherwise %APPDATA% on Windows and ~/.config elsewhere. Set QUIVERAI_TOKEN_STORAGE to keyring or file to choose.
Credential storage
The keychain service is quiverai and the account is the app origin. The optional @napi-rs/keyring binding uses macOS Keychain, Windows Credential Manager, or Linux Secret Service. Linux pins Secret Service so a missing service falls back to disk instead of using an in-memory kernel keyring. Installation still works where the native binding is unavailable. Forced keyring mode fails if the keychain is unavailable.
The plaintext fallback stores one file per app origin. On POSIX, the directory uses mode 0700 and each file uses 0600. On Windows, the files inherit the profile directory's ACLs. Writes rename a temporary file from the same directory into place. The first fallback write that creates the file prints its path to stderr. Forced file mode is silent. A successful keychain write removes the fallback for that origin. Reads check the file first because a remaining file holds the newest tokens.
logout clears the current origin's file and keychain entry. With no --app-url or QUIVERAI_APP_URL and exactly one saved login, it removes that login; with several, a terminal run asks which and any other run uses the given or default app URL, naming the other saved logins if it removes nothing. If the keychain refuses to delete an existing entry, logout fails and tells you that you are still signed in. The CLI uses a stored access token while it has more than one minute left, then tries to refresh it. If refresh fails, it asks you to sign in again. The fixed one-minute margin works with the application-specific token lifetime configured in WorkOS.
Scripts and CI
The CLI never prompts when it cannot. A run is non-interactive when --non-interactive or --json is passed, when CI is set to anything but empty, 0 or false, or when stdin or stderr is not a terminal. Each prompt then has an answer instead: add uses the suggested name, fails when a file differs and --overwrite is missing, and asks for --cwd or a creation id where it would have shown a picker. It never starts a login; it fails and names quiverai login. login itself needs a terminal. --yes is unchanged.
Exit codes
| Code | Meaning |
| --- | --- |
| 0 | Success. Declining the overwrite prompt (Skipped) and a logout with nothing to remove (Already logged out of QuiverAI.) are successes. |
| 1 | The command ran and failed: not logged in, not found, no access, a file in the way, the network, a request over 60 seconds, a server error, or an unexpected error. |
| 2 | The command line is wrong or input is missing: an unknown option or command, an invalid value, a missing argument, a choice that needs a terminal, or login without one. |
| 130 | A prompt or the spinner was canceled (Ctrl-C or Escape). It prints Canceled. |
A SIGINT or SIGTERM is not an exit code: the CLI removes its open temp files and ends by the signal, so a shell sees it as killed by that signal and a script stops.
JSON output
--json works with whoami, add and logout. On success, stdout holds one JSON document and stderr is empty. On failure, stdout is empty and stderr holds one line:
{
"message": "Not logged in to QuiverAI. Run `quiverai login`.",
"reason": "login_required",
"status": "action_required",
"next": [{ "argv": ["quiverai", "login"], "command": "quiverai login" }]
}reason is one of api_error, canceled, conflict, internal_error, interactive_required, invalid_arguments, login_required, missing_input, network_error, not_found, permission_denied, timeout, unknown_command or unknown_option. status is action_required when input or a step by a person would let the command run (missing_input, interactive_required, login_required) and error otherwise. next lists a command that recovers the failure, when there is one. Warnings are a warnings list of { "reason", "message" } in the document, never stderr text. Usage errors, such as add --bogus --json, use the same line.
| Command | Success document |
| --- | --- |
| whoami | {"account":{"email":"[email protected]","organizationId":"org_1"}} |
| add | {"component":{"name":"Logo","file":"/abs/path/logo.tsx","importSpecifier":"@/components/quiverai/logo"},"outcome":"added"}. outcome is added, updated or unchanged. With --dry-run it is planned, plus "change": add, update or none. |
| logout | {"outcome":"logged_out","appUrl":"https://app.quiver.ai"}, or "unchanged" when nothing was saved (then savedLogins lists any other saved logins). With --all, "all":true replaces appUrl. |
Color
Color is on in a terminal. NO_COLOR set to anything but empty, or --no-color, turns it off and wins over FORCE_COLOR.
Global options
| Option | Description |
| --- | --- |
| --app-url [url] | QuiverAI URL to use. Defaults to https://app.quiver.ai. Also QUIVERAI_APP_URL. Without a URL, in a terminal, it asks you to pick from your saved logins, production and staging, or to type another URL. |
| -H, --header "Name: value" | Send a header with every request to the app URL. Repeatable. |
| --debug | Print stack traces for unexpected errors. Also QUIVERAI_DEBUG=1. |
| --json | Print the result of whoami, add and logout as JSON, and an error as one JSON line on stderr. |
| --non-interactive | Never prompt. Also the case with --json, a truthy CI, or when stdin or stderr is not a terminal. |
| --no-color | Turn off color. Also NO_COLOR. |
| -h, --help | Show help. |
| -v, --version | Show the version. |
To send the same headers every time, save them per URL in config.json, in the same quiverai/ folder as the credentials:
{
"headers": {
"https://app.example.com": { "x-custom-header": "value" }
}
}A header is sent only to the URL it is listed under. A header value cannot contain a line break.
