Skip to content

CLI Reference

Raiken ships as a CLI that initializes projects and starts the dashboard.

Commands

raiken init

Initialize Raiken in the current project.

Terminal
raiken init

Options:

FlagDescription
--force, -fOverwrite existing configuration files

What it does:

  1. Detects your project type and test framework
  2. Creates .raiken/ workspace directory
  3. Ensures crawler artifact paths are ignored (.raiken/, storage/)
  4. Writes raiken.config.json
  5. Creates test-results/ and test-reports/ directories
  6. Optionally generates playwright.config.ts
  7. Optionally creates an example test file
  8. Adds scripts to package.json

Example output:

Terminal
🔎 Analyzing your project...
🔍 Detected project information:
Project: my-app
Type: nextjs
Test Framework: playwright
Package Manager: pnpm
✓ Auto-detected project configuration.
nextjs + playwright → e2e/
? Use auto-detected configuration? Yes
? Install Playwright browsers now? Yes
? Generate an example test file? Yes
📁 Setting up nextjs project: my-app
✓ Created .raiken/ directory
✓ Updated .gitignore to exclude .raiken/
✓ Created test directory: e2e/
✓ Created raiken.config.json
✓ Created playwright.config.ts
✓ Updated package.json scripts
✓ Created example test: e2e/example.spec.ts
📦 Installing Playwright browsers...
✓ Playwright browsers installed successfully
✅ Project initialization complete!
Next steps:
1. Run "raiken start" to launch the dashboard
2. Open http://localhost:7101 in your browser
3. Start generating AI-powered tests!

raiken start

Start the Raiken server and dashboard.

Terminal
raiken start

Options:

FlagDescription
-p, --port <number>Set the server port (default: 7101)

Example:

Terminal
raiken start -p 8080

Example output:

Terminal
📍 Found 3 entry points
✅ Code graph built successfully: 47 files indexed
🚀 Raiken UI running at http://localhost:7101

raiken discover

Start site discovery for a target application.

Terminal
raiken discover --url http://localhost:3000

Common options:

FlagDescription
--timeout <number>Override discovery timeout for this run
--authCapture auth state before starting discovery
--continueContinue the active paused discovery session

Discovery defaults can be provided in raiken.config.json under discovery. CLI flags override config values at runtime.

Continuation behavior reuses active session metadata (including persisted limits) when available.

raiken auth

Capture auth state for protected routes.

Terminal
raiken auth

The auth command stores state in .raiken/auth-state.json and is used by discovery resume flows for authenticated navigation.

If runtime Playwright dependencies are missing, Raiken fails fast with install guidance rather than continuing with partial auth flow behavior.

API surface (local)

The CLI exposes a small local API used by the dashboard:

  • POST /api/generate-test — SSE stream for exploration and test generation output
  • POST /api/trpc/* — tRPC router for dashboard actions

Discovery runtime endpoints are exposed through tRPC procedures, including:

  • startDiscovery
  • continueDiscovery
  • getDiscoveryRuntime
  • getDiscoveryTimeline
  • authAssist
  • clearDiscoveryData

Environment variables

Raiken reads .env from your project root.

VariableRequiredDescription
OPENROUTER_API_KEYYesAPI key for AI generation
OPENROUTER_MODELNoOverride the default model
OPENROUTER_BASE_URLNoCustom API base URL

Exit codes

CodeMeaning
0Success
1Initialization failed or startup error

Quick reference

Terminal
# Initialize a new project
raiken init
# Force reinitialize (overwrites config)
raiken init --force
# Start the dashboard
raiken start
# Start on a custom port
raiken start -p 8080
# Start discovery
raiken discover --url http://localhost:3000
# Continue paused discovery
raiken discover --continue
# Check version
raiken --version
# Show help
raiken --help