Find a file
L c09e714cc7
Add non-interactive mode for agent execution (#35)
* refactor: extract shared test helpers and utilities

Created centralized test-helpers.ts module to eliminate duplication across test files:

**Extracted Helpers:**
- createMockManifest() - Reusable mock manifest data
- createEmptyManifest() - Empty manifest for edge cases
- createConsoleMocks() - Console spy setup
- createProcessExitMock() - Process exit mock
- restoreMocks() - Mock cleanup utility
- mockSuccessfulFetch() - Simplified successful fetch mock
- mockFailedFetch() - Simplified failed fetch mock
- mockFetchWithStatus() - Fetch mock with custom status
- setupTestEnvironment() - Test directory and env setup
- teardownTestEnvironment() - Cleanup utility

**Deduplication Impact:**
- commands.test.ts: Removed 50+ lines of duplicate mock setup
- manifest.test.ts: Removed 80+ lines of duplicate manifest data and setup code
- integration.test.ts: Removed 40+ lines of duplicate setup/teardown

**Benefits:**
- Single source of truth for test fixtures
- Consistent mock patterns across all tests
- Easier maintenance - changes to test setup in one place
- Improved test readability

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* refactor: Add non-interactive mode for agent execution

Implements --prompt and --prompt-file flags to enable non-interactive
agent execution. This allows users to:

- Execute agents with a prompt and exit automatically
- Use spawn in CI/CD pipelines and automation scripts
- Pass prompts via command line or file

Changes:
- TypeScript CLI: Parse --prompt/-p and --prompt-file flags
- Security: Add validatePrompt() to prevent command injection
- Commands: Pass prompt via SPAWN_PROMPT env var to bash scripts
- Bash scripts: Detect SPAWN_PROMPT and fork interactive/non-interactive
- Help text: Document new flags with examples

Implementation:
- claude.sh: Use 'claude -p' for non-interactive execution
- aider.sh: Use 'aider -m' for non-interactive execution
- shared/common.sh: Add execute_agent_non_interactive() helper

Security:
- Validates prompts for command injection patterns
- Length limit: 10KB max
- Blocks $(), backticks, piping to bash/sh
- Uses printf %q for proper shell escaping

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* docs: Add testing guide for non-interactive mode

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Sprite <noreply@sprite.dev>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-07 21:20:34 -08:00
.claude Add guardrails: CLAUDE.md rules, hooks, pre-commit validation (#33) 2026-02-07 20:02:19 -08:00
.githooks Add guardrails: CLAUDE.md rules, hooks, pre-commit validation (#33) 2026-02-07 20:02:19 -08:00
.github/workflows ci: add shellcheck linting infrastructure 2026-02-08 01:08:34 +00:00
aws-lightsail Add Civo gptme agent script 2026-02-08 05:13:37 +00:00
civo Add Civo gptme agent script 2026-02-08 05:13:37 +00:00
cli Add non-interactive mode for agent execution (#35) 2026-02-07 21:20:34 -08:00
daytona Add Daytona cloud provider with all 12 agent scripts 2026-02-08 05:18:38 +00:00
digitalocean Add Civo interpreter script 2026-02-08 05:13:37 +00:00
e2b Add Civo gptme agent script 2026-02-08 05:13:37 +00:00
fly Add Fly.io and Civo OpenCode agent scripts 2026-02-08 05:13:37 +00:00
gcp Add Civo gptme agent script 2026-02-08 05:13:37 +00:00
hetzner Add OpenCode agent (10.8k stars, 319pt HN post) 2026-02-08 05:13:37 +00:00
lambda Add Civo interpreter script 2026-02-08 05:13:37 +00:00
linode Add Civo interpreter script 2026-02-08 05:13:37 +00:00
modal Add Civo gptme agent script 2026-02-08 05:13:37 +00:00
scaleway Add Scaleway cloud provider with all 12 agent scripts 2026-02-08 05:13:37 +00:00
shared Add non-interactive mode for agent execution (#35) 2026-02-07 21:20:34 -08:00
sprite Add non-interactive mode for agent execution (#35) 2026-02-07 21:20:34 -08:00
test Remove stale tests and fix echo -e in test harness 2026-02-08 05:13:37 +00:00
vultr Add Civo interpreter script 2026-02-08 05:13:37 +00:00
.shellcheckrc ci: add shellcheck linting infrastructure 2026-02-08 01:08:34 +00:00
CLAUDE.md refactor: Migrate tests from vitest to bun:test and add testing rules 2026-02-08 04:29:37 +00:00
improve.sh Refocus discovery: clouds over agents, require community buzz 2026-02-08 04:17:45 +00:00
manifest.json Add Daytona cloud provider with all 12 agent scripts 2026-02-08 05:18:38 +00:00
README.md Update README matrix: add Civo, Scaleway, Daytona clouds and OpenCode agent 2026-02-08 05:19:29 +00:00
SECURITY_AUDIT.md docs: add security audit report 2026-02-08 04:46:53 +00:00
TESTING_NON_INTERACTIVE.md Add non-interactive mode for agent execution (#35) 2026-02-07 21:20:34 -08:00

Spawn

Launch any agent on any cloud, powered by OpenRouter.

Install

curl -fsSL https://openrouter.ai/lab/spawn/cli/install.sh | bash

Usage

spawn                         # Interactive picker
spawn <agent> <cloud>         # Launch directly
spawn list                    # Show the full matrix

Examples

spawn claude sprite           # Claude Code on Sprite
spawn aider hetzner           # Aider on Hetzner Cloud
spawn goose digitalocean      # Goose on DigitalOcean
spawn codex vultr             # Codex CLI on Vultr

Commands

Command Description
spawn Interactive agent + cloud picker
spawn <agent> <cloud> Launch agent on cloud directly
spawn <agent> Show available clouds for an agent
spawn list Full agent x cloud matrix
spawn agents List all agents
spawn clouds List all cloud providers

Without the CLI

Every combination also works as a one-liner:

bash <(curl -fsSL https://openrouter.ai/lab/spawn/{cloud}/{agent}.sh)

Non-Interactive

Skip all prompts with environment variables:

OPENROUTER_API_KEY=sk-or-v1-xxxxx \
  spawn claude sprite

Each cloud has its own env vars for auth — see the cloud's README.

Matrix

Sprite Hetzner DigitalOcean Vultr Linode Lambda Lightsail GCP E2B Modal Fly.io Civo Scaleway Daytona
Claude Code
OpenClaw
NanoClaw
Aider
Goose
Codex CLI
Interpreter
Gemini CLI
Amazon Q
Cline
gptme
OpenCode

Development

git clone https://github.com/OpenRouterTeam/spawn.git
cd spawn
git config core.hooksPath .githooks