spawn/sprite
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/rules Sprite setup scripts for Claude Code and OpenClaw 2026-02-05 13:25:30 -06:00
lib refactor: complete trap cleanup in sprite provider - remove manual rm calls 2026-02-08 03:31:24 +00:00
aider.sh Add non-interactive mode for agent execution (#35) 2026-02-07 21:20:34 -08:00
amazonq.sh refactor: Extract ENV_TEMP pattern to provider-specific inject functions 2026-02-08 04:15:02 +00:00
claude.sh Add non-interactive mode for agent execution (#35) 2026-02-07 21:20:34 -08:00
cline.sh refactor: Extract ENV_TEMP pattern to provider-specific inject functions 2026-02-08 04:15:02 +00:00
codex.sh refactor: add pipefail to error handling flags 2026-02-08 02:34:45 +00:00
gemini.sh refactor: Extract ENV_TEMP pattern to provider-specific inject functions 2026-02-08 04:15:02 +00:00
goose.sh refactor: add pipefail to error handling flags 2026-02-08 02:34:45 +00:00
gptme.sh Add guardrails: CLAUDE.md rules, hooks, pre-commit validation (#33) 2026-02-07 20:02:19 -08:00
interpreter.sh refactor: add pipefail to error handling flags 2026-02-08 02:34:45 +00:00
nanoclaw.sh Fix config file paths and missing OPENROUTER_API_KEY env check 2026-02-08 05:13:37 +00:00
openclaw.sh Fix config file paths and missing OPENROUTER_API_KEY env check 2026-02-08 05:13:37 +00:00
opencode.sh Add OpenCode agent (10.8k stars, 319pt HN post) 2026-02-08 05:13:37 +00:00
README.md Add E2B + Modal sandbox providers, restructure README (#22) 2026-02-07 14:11:04 -08:00

Sprite

Sprites.dev managed VMs with CLI. Sprite

Agents

Claude Code

bash <(curl -fsSL https://openrouter.ai/lab/spawn/sprite/claude.sh)

OpenClaw

bash <(curl -fsSL https://openrouter.ai/lab/spawn/sprite/openclaw.sh)

NanoClaw

bash <(curl -fsSL https://openrouter.ai/lab/spawn/sprite/nanoclaw.sh)

Aider

bash <(curl -fsSL https://openrouter.ai/lab/spawn/sprite/aider.sh)

Goose

bash <(curl -fsSL https://openrouter.ai/lab/spawn/sprite/goose.sh)

Codex CLI

bash <(curl -fsSL https://openrouter.ai/lab/spawn/sprite/codex.sh)

Open Interpreter

bash <(curl -fsSL https://openrouter.ai/lab/spawn/sprite/interpreter.sh)

Gemini CLI

bash <(curl -fsSL https://openrouter.ai/lab/spawn/sprite/gemini.sh)

Amazon Q CLI

bash <(curl -fsSL https://openrouter.ai/lab/spawn/sprite/amazonq.sh)

Cline

bash <(curl -fsSL https://openrouter.ai/lab/spawn/sprite/cline.sh)

Non-Interactive Mode

SPRITE_NAME=dev-mk1 \
OPENROUTER_API_KEY=sk-or-v1-xxxxx \
  bash <(curl -fsSL https://openrouter.ai/lab/spawn/sprite/claude.sh)