A dependency-free, agent-native CLI that drives Raycast from the terminal — fire deeplinks, read on-disk state, scaffold Script Commands, and wrap the official ray extension CLI, with stable exit codes and --json/--print output.
- What: a single-binary CLI wrapper around Raycast's deeplink scheme and on-disk state, plus a thin passthrough to Raycast's own
rayextension tooling. - How: builds
raycast://…URLs and fires them via macOSopen; reads extension manifests and prefs straight off disk; never touches Raycast's encrypted stores. - Stack: Bun + TypeScript, zero runtime dependencies (Node stdlib + Bun APIs only). macOS only.
- Agent-friendly: every trigger action has a
--printdry run, list commands emit--json, and exit codes are stable (0/1/2) — see AGENTS.md. - Run:
bun install && bun link, thenrayc doctor.
rayc gives you terminal (and script/agent) access to Raycast across four pillars:
| Pillar | Commands |
|---|---|
| Trigger actions | open, link, ai, run, shortcut |
| Read data (unencrypted only) | list extensions, list scripts, list prefs |
| Script Commands | script new, script list, script install |
| Extension authoring | ext new, ext dev/build/lint/publish/migrate, ray-install |
| Diagnostics | doctor, help, version |
Deeplink paths use the schema <author-or-owner>/<extension>/<command> (exactly 3 segments); built-in commands use raycast as the author. The reliable workflow is discover → preview → fire: enumerate exact deeplinks with rayc list extensions --json, preview with --print, then fire.
Two honest constraints are baked in:
- Encrypted stores are off-limits. Raycast's clipboard history, snippets, and activity log live in OpenPGP-encrypted SQLite (
raycast-enc.sqlite, …). No external tool can read them, andraycnever pretends to — it only surfaces what is genuinely in the clear. openexits0on handoff, not on success. macOSopenreturns0the moment it hands a URL to Raycast, even for a bogus slug (a silent no-op). Validate slugs againstlist extensionsor eyeball with--printfirst.
- Runtime: Bun — the
raycshebang is#!/usr/bin/env bun; process spawning usesBun.spawnSync. - Language: TypeScript 5,
strictmode, ESNext modules,moduleResolution: bundler,.tsimports allowed. - Dependencies: none at runtime. Everything imports from the Node stdlib (
node:fs,node:os,node:path) plus Bun globals. Dev deps are onlytypescriptand@types/bun. - Platform: macOS only — it shells out to
open,defaults, and Raycast's~/.config/raycast/~/Library/Application Support/com.raycast.macospaths.
cd dev-tools/rayc
bun install
bun link # puts `rayc` on PATH via ~/.bun/bin
rayc doctor # sanity-check Raycast, bun, ray, config dirs, and what's readableTo ship a standalone binary instead of the linked source entry:
bun run build # bun build src/index.ts --compile --outfile dist/rayc
./dist/rayc doctor# Discover, then fire (the safe loop)
rayc list extensions --json # exact deeplinks for installed extensions
rayc open gebeto/translate/quick-translate --arg text="hola" --print # preview the URL
rayc open gebeto/translate/quick-translate --arg text="hola" # actually fire it
rayc link "raycast://confetti" # raw deeplink escape hatch
rayc run confetti # fire a saved shortcut
rayc shortcut add cliphist "raycast://extensions/raycast/clipboard-history/clipboard-history"
rayc list prefs # preferences, secrets redacted aggressively
rayc script new deploy --lang bash --mode compact # scaffold a Script Command with @raycast.* header
rayc ext new # scaffold an extension (bun create raycast-extension)Trigger-action flags: --print (dry run — build/print the URL, fire nothing), --background (launchType=background), --fallback TEXT, --context JSON (must be valid JSON or exit 2), and repeatable --arg k=v. Boolean flags stand alone; every other flag takes a value (--flag value or --flag=value).
RAYC_AI_COMMAND— override the built-in Raycast AI command slug used byrayc ai(the defaultraycast/raycast-ai-chat/ai-chatis version-dependent and unverified;--command <author/ext/cmd>overrides it inline).rayc aiis experimental and requires Raycast Pro.
No other environment configuration is required.
| Script | Command | What it does |
|---|---|---|
typecheck |
tsc --noEmit |
Type-check the source without emitting. |
build |
bun build src/index.ts --compile --outfile dist/rayc |
Compile a standalone single-file binary to dist/rayc. |
There is no test suite, lint step, or bundler config beyond these two scripts.
Single small entry point with a flat command dispatch table; each command is its own module, and shared logic lives in three lib files.
src/
index.ts # arg[0] → handler dispatch table, --help/--version, exit-code plumbing
commands/
open.ts # open / link / ai / run / shortcut (trigger actions + shortcuts.json CRUD)
list.ts # list extensions | scripts | prefs (reads on-disk state, --json/--filter)
script.ts # script new | list | install (scaffold + manage Script Commands)
ext.ts # ext new|dev|build|lint|publish|migrate + ray-install (wraps `ray`)
doctor.ts # environment + readability diagnostics
lib/
args.ts # dependency-free flag parser (booleans stand alone; others take values; `--` ends flags)
deeplink.ts # buildCommandDeeplink() assembles URLs; fire() runs `open <url>`
raycast.ts # Raycast paths, scanExtensions()/scanScripts(), run()/which(), secret redaction
Key behaviors:
- Deeplinks are built by
buildCommandDeeplink(validates the 3-segment path, URL-encodes each segment, appendslaunchType/arguments/context/fallbackText) and fired byfireviaopen. - On-disk reads are pure filesystem scans: extension manifests under
~/.config/raycast/extensions, Script Command@raycast.*header metadata, anddefaults read com.raycast.macosfor prefs — the last passed throughredactSecrets(masks token/secret/password/api-key patterns and any 32+ char opaque blob). ext *maps verbs to the officialrayCLI and runs it in-place, requiring a directory whosepackage.jsondepends on@raycast/api; it prefers a globalray, falling back tonpx ray.
Files rayc writes: ~/.config/rayc/shortcuts.json (named-shortcut map) and ~/.config/raycast/scripts/ (managed Script Commands — register that directory once in Raycast → Settings → Extensions → Script Commands → Add Directories).
Exit codes (stable — branch on them): 0 success/handoff, 1 runtime error, 2 usage error.
Version 0.1.0, macOS only, MIT © Eric Baruch. All five command pillars are implemented and functional. Known rough edges, both documented in-tool: rayc ai is experimental (needs Raycast Pro; the AI slug is unverified), and open returning 0 is a handoff, not proof the command ran. There is no automated test suite. See AGENTS.md for the full agent-facing contract.
MIT © Eric Baruch