Commit graph

226 commits

Author SHA1 Message Date
A
782da8945c
feat: Add git worktree and commit marker conventions to SKILL.md (#67)
Document the mandatory git conventions for all agent team scripts:
always pull main before creating worktrees, use worktrees for parallel
branch work, include Agent: trailers in commits, and clean up worktrees
at end of cycle.

Agent: team-lead

Co-authored-by: A <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 03:16:12 -08:00
A
a61c378f4c
feat: Add branch-cleaner, commit markers, and worktrees to improve.sh (#66)
- Add branch-cleaner role that cleans stale remote branches (>4 hours):
  merges open PRs if mergeable, closes/deletes if stale
- Require Agent: trailer in all commit messages for traceability
- Switch git workflow from checkout -b to worktrees so parallel agents
  don't clobber each other's uncommitted changes
- Always git fetch origin main before creating worktrees to ensure
  branches start from latest main
- Add worktree setup/teardown to run_team_cycle and cleanup_between_cycles

Agent: team-lead

Co-authored-by: A <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 03:14:44 -08:00
A
a818de1f3e
feat: Add branch-cleaner agent, commit markers, and git worktrees (#65)
- Add branch-cleaner agent (Haiku) that cleans stale remote branches:
  merges open PRs if mergeable, closes/deletes if stale >4 hours
- Require Agent: trailer in all commit messages so we can trace which
  agent authored each change
- Switch from git checkout to git worktrees for parallel branch work,
  preventing agents from clobbering each other's uncommitted changes
- Update Issue Fix Workflow to use worktree pattern
- Update Workflow with branch cleanup passes and worktree setup/teardown

Agent: team-lead

Co-authored-by: A <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 03:12:25 -08:00
A
1bd7b1bd07
feat: Add community-coordinator agent to refactor team (#64)
* ux: Improve error messages and user guidance across CLI and shell scripts

Enhanced error messages to be more actionable and user-friendly:

CLI improvements (commands.ts):
- Made validateNonEmptyString clearer: "is required but was not provided"
- Reordered troubleshooting steps to check matrix first (most common issue)
- Simplified 404 error message: "doesn't exist yet" vs "may not be implemented"
- Changed "Troubleshooting steps" to just "Troubleshooting" (less formal)

Shared library improvements (shared/common.sh):
- OAuth cancellation now explains why API key is needed and where to get it
- safe_read non-TTY error explains what non-interactive mode is with example
- get_resource_name error shows exact env var syntax needed
- Agent verification failures now list specific possible causes
- All improvements add context and next steps rather than just stating the problem

Hetzner library improvements (hetzner/lib/common.sh):
- Replaced technical "Remediation" with friendly "How to fix"
- Changed log_warn to log_error for error conditions (consistent severity)
- Added spacing for better readability of multi-line errors
- Made server creation errors more specific about account issues

All changes focus on helping users understand WHAT went wrong and HOW to fix it.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: Replace issue-triager with community-coordinator agent

Replace the issue-triager agent in the refactor team with a
community-coordinator that actively engages with GitHub issues:
acknowledges reports, posts interim updates, delegates to relevant
teammates, and posts final resolutions — so reporters feel heard.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: A <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 02:58:26 -08:00
B
aeec170dfa feat: Add agent and cloud request issue templates
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 10:10:10 +00:00
A
25b579755d docs: Update SKILL.md with deployed refactor service details
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 10:00:37 +00:00
A
5d23bb064c
refactor: Add validatePrompt tests and improve auth cancellation UX (#61)
- Add 16 comprehensive tests for validatePrompt() covering command
  injection, backtick substitution, rm -rf chaining, pipe-to-bash,
  size limits, and safe pattern acceptance
- Add 2 edge case tests for validateScriptContent() (dd if=, wget|sh)
- Improve auth cancellation error to explain that an API key is required

Test results: 90 pass, 0 fail, 11 skip (101 total)

Co-authored-by: A <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 01:24:43 -08:00
A
68349fa5d7
fix: Replace instanceof Error checks with duck typing (#60)
Fixes #59

The instanceof operator can fail in bundled/minified code or when
errors cross execution realm boundaries, causing the error:
"instanceof called on an object with an invalid prototype property"

This commit replaces all instanceof Error checks with duck typing
(checking for object with 'message' property) which is more reliable
across different execution contexts.

Changes:
- index.ts: Updated handleError() and prompt file error handling
- commands.ts: Updated getErrorMessage() helper

Co-authored-by: A <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 01:21:37 -08:00
B
fe9b6ad449 docs: Rewrite trigger service skill for direct URL + bearer auth pattern
- Updated overview to reflect current architecture (public sprite URL
  with TRIGGER_SECRET bearer auth, not start service API)
- Added Step 5 for setting sprite URL auth to public
- Updated workflow template to use SPRITE_URL + TRIGGER_SECRET secrets
- Updated secret naming convention to match deployed services
- Added Step 10 for CLI-based end-to-end testing
- Added "Current Deployed Services" reference table
- Fixed all stale references and code samples

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 09:09:41 +00:00
B
4c456df091 fix: Switch to direct sprite URL with bearer auth
The Sprite start service API (/services/{name}/start) returns
"service name required" for all service names — appears to be an API
bug. Switched to hitting the sprite's public URL directly with
TRIGGER_SECRET bearer auth instead.

- Re-added TRIGGER_SECRET auth to trigger-server.ts
- Set sprite url_settings.auth to "public"
- Updated both workflows to use SPRITE_URL + TRIGGER_SECRET pattern
- Aligned workflow structure (both use same env vars and curl format)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 09:07:49 +00:00
B
9eb9e74295 debug: Print secret lengths and hash to verify values
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 08:35:23 +00:00
B
87e5790880 debug: Echo SVC_NAME in refactor workflow
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 08:16:52 +00:00
B
341710d1cc rename: Improve workflow to Discovery
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 08:15:19 +00:00
B
460ee25690 chore: Align improve workflow with refactor workflow
- Use env vars from secrets instead of hardcoded names
- Add issues trigger (opened, reopened)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 08:14:36 +00:00
Sprite
a361d92e13 fix: Pass env vars correctly in refactor workflow
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 08:13:09 +00:00
Sprite
15dd5e264f debug: Exact curl from docs with hyphenated service name 2026-02-09 01:14:07 +00:00
Sprite
4f78b9b172 debug: Test alternate URL path formats 2026-02-09 01:12:22 +00:00
Sprite
4c35f1db78 debug: Test start API vs direct sprite URL 2026-02-09 01:11:12 +00:00
Sprite
a433b067ad debug: Test start service with body and alternate paths 2026-02-09 01:10:03 +00:00
A
bbbe815035
refactor: Security fixes, complexity reduction, and UX improvements (#58)
Security:
- Fix command injection in modal/lib/common.sh (run_server, upload_file, interactive_session)
- Fix command injection in fly/lib/common.sh (run_server, upload_file, interactive_session)
- All container providers now use printf '%q' for proper shell escaping

Complexity:
- Extract _api_should_retry_on_error() helper in shared/common.sh (-19 lines)
- Refactor scaleway_api and upcloud_api to use shared retry helper (-24 lines)
- Extract _save_fly_token() helper in fly/lib/common.sh (-11 lines)
- Extract validateAndGetAgent() in commands.ts, reducing cmdRun/cmdAgentInfo duplication
- Refactor cmdList column width calculation to use calculateColumnWidth()

UX:
- Add actionable next steps to error messages in shared/common.sh
- Improve CLI bash fallback error messages with guidance (spawn.sh)
- Add OAuth progress indicator during browser authentication wait
- Show invalid model ID value and link to openrouter.ai/models
- Add troubleshooting steps for agent installation failures

Tests:
- Update test assertions in test/run.sh to match refactored patterns
- All tests passing: 74 TypeScript + 75 bash = 149 total, 0 failures

Co-authored-by: A <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-08 17:09:27 -08:00
Sprite
44cafc7cc5 debug: Test API at each level to isolate failure 2026-02-09 01:08:59 +00:00
Sprite
58f9e8d34d debug: Hardcode sprite/service names to isolate API issue 2026-02-09 01:07:47 +00:00
Sprite
6066afcf18 fix: Rename service to improve_trigger (underscores for API compat)
Sprite API rejects service names with hyphens. Renamed from
improve-trigger to improve_trigger.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 01:06:46 +00:00
Sprite
774c3d0cc1 debug: Add verbose logging to improve workflow 2026-02-09 01:05:33 +00:00
Sprite
758e79bb59 fix: Inline secret refs in curl URL to avoid env var issues
SERVICE_NAME env var may conflict with GitHub Actions internals.
Inline the secrets directly in the URL template instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 01:04:26 +00:00
Sprite
0295df0bf0 fix: Install to ~/.local/bin (in PATH) instead of ~/.bun/bin
~/.bun/bin is often NOT in PATH, causing 'command not found' after
install. Now picks the first dir already in PATH from:
  1. ~/.local/bin (most universal)
  2. $(bun pm bin -g)
  3. ~/.bun/bin
  4. ~/bin

Also consolidated PATH detection and instructions into shared helpers,
with clear shell-specific instructions when the dir isn't in PATH.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 00:45:18 +00:00
Sprite
d92bf66f51 fix: Install spawn binary directly instead of using bun link
bun link only registers packages for project-level linking — it does
not create global CLI binaries. bun install -g has the same issue.

New approach:
- bun: build cli.js, copy directly to $(bun pm bin -g)/spawn (55KB)
- npm: build with esbuild, copy to $(npm bin -g)/spawn
- Both methods put the binary exactly where the runtime expects it

Also replaced brittle hardcoded file downloads with git sparse-checkout
(with GitHub API fallback), so new source files never break the installer.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 00:37:55 +00:00
Sprite
c7981d626e fix: Replace hardcoded file list with dynamic clone in installer
The install script had a hardcoded list of source files to download,
which broke whenever a new file was added (e.g., security.ts). Also,
openrouter.ai/lab/spawn served a stale cached version without the fix.

Now uses git sparse-checkout (fast, gets only cli/) with a GitHub API
fallback for environments without git. Adding new source files will
never break the installer again.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 00:12:22 +00:00
Sprite
57cf080c39 chore: Run refactor workflow every 30 minutes
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 00:09:04 +00:00
Sprite
863cfbe711 fix: Add missing security.ts to CLI installer downloads
commands.ts imports ./security.js but install.sh never downloaded
security.ts, causing build to fail with "Could not resolve" error.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 00:07:58 +00:00
Sprite
7410c8ee4f fix: Build cli.js before linking in install script
package.json bin points to cli.js, but it was never built during
installation. Both bun link and npm install -g failed silently because
the file didn't exist.

- Bun path: run `bun run build` before `bun link`
- npm path: use npx esbuild to bundle cli.js with node shebang

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-08 23:50:19 +00:00
Sprite
66221dac80 fix: Use duration=0s to fire-and-forget on start service API
The Sprite start service API returns streaming NDJSON, causing curl -f
to fail with exit code 22. Use duration=0s to return immediately and
drop -f flag since the response is streaming.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-08 23:40:50 +00:00
Sprite
b7b102a352 fix: Remove curl timeout on trigger workflows
Sprite may take time to wake from pause, causing --max-time 30 to fail
with exit code 22.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-08 21:33:03 +00:00
Sprite
5b71562633 refactor: Remove TRIGGER_SECRET, auth now handled by Sprite API
- Remove TRIGGER_SECRET from trigger-server.ts and start-improve.sh
- Auth is handled at the Sprite API level via SPRITE_TOKEN
- Update SKILL.md: remove secret generation step, fix step numbering,
  update embedded code and verification examples

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-08 21:08:27 +00:00
Sprite
38ffd7ebd6 feat: Update trigger workflows to use Sprite start service API
- Replace SPRITE_URL/SPRITE_SECRET pattern with SPRITE_NAME/SERVICE_NAME
- Use Sprite start service API endpoint (api.sprites.dev)
- Share SPRITE_TOKEN across all services
- Update skill documentation to reflect new approach
- Delete deprecated URL/SECRET based secrets

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-08 20:29:19 +00:00
Sprite
3dec61336b docs: Clarify setup-trigger-service runs inside Sprite
- Add note that skill is designed to run inside Sprite VM
- Update secret setup instructions for in-Sprite usage
- Add Prerequisites section
- Add troubleshooting for new concurrency limit error
- Improve guidance for obtaining Sprite URL

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-08 20:13:24 +00:00
LAB
fe9f6f013a
test: Add command logic tests and refactor for testability (#56)
- Extract pure functions from commands.ts to commands-logic.ts
- Add 34 comprehensive tests for command logic functions
- Enable better test coverage through dependency injection pattern
- All tests passing (74 pass, 11 skip, 0 fail)

Co-authored-by: Sprite <noreply@sprite.dev>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-08 12:02:43 -08:00
LAB
298065f4ad
UX: Improve error messages, help text, and progress indicators (#55)
Enhance the spawn CLI user experience with actionable error messages,
comprehensive help documentation, and visual progress feedback.

Changes:
- Help text: Add AUTHENTICATION, TROUBLESHOOTING, and MORE INFO sections
- Error messages: Show examples of valid options when validation fails
- Progress indicators: Add spinners for script downloads
- Install flow: Provide clear alternatives when npm install requires sudo
- README: Add environment variable documentation and alternative install URL
- Security errors: Suggest workarounds for false positives

All error messages now follow the pattern:
1. What went wrong
2. Why it matters
3. What to do next

Documentation: .docs/UX_IMPROVEMENTS_20260208.md

Co-authored-by: Sprite <noreply@sprite.dev>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-08 12:00:59 -08:00
LAB
d76c8dba0f
Security: fix critical command injection vulnerabilities in container providers (#54)
* refactor: Simplify API call retry logic in generic_cloud_api

Extract duplicated retry handling into focused helper functions:
- handle_api_network_error(): Handles curl errors with retry logic
- handle_api_transient_error(): Handles 429/503 HTTP errors
- _call_cloud_api(): Internal curl wrapper separating concerns

Reduces cyclomatic complexity of generic_cloud_api from 9 to 3.
Lines reduced from 89 to 54 (40% reduction).

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

* Security: fix critical command injection vulnerabilities in container providers

CRITICAL SECURITY FIX - Command injection vulnerabilities

Fixed command injection in bash -c calls across all container/sandbox providers.
These functions were passing commands directly to bash -c without proper escaping,
allowing potential remote code execution via crafted inputs.

Files fixed:
- sprite/lib/common.sh: run_sprite(), upload_file_sprite()
- e2b/lib/common.sh: run_server(), upload_file(), interactive_session()
- daytona/lib/common.sh: run_server(), upload_file(), interactive_session()
- railway/lib/common.sh: run_server(), upload_file(), interactive_session()

Fix: Use printf %q to properly escape all command arguments before passing to bash -c.
This prevents command injection while maintaining functionality.

Severity: CRITICAL (CVSS 9.8)
Impact: Remote code execution, full system compromise
Mitigation: Proper shell escaping using printf %q

All modified files pass bash -n syntax validation.

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-08 12:00:43 -08:00
Sprite
286609c1ed feat: Add concurrency limits to trigger workflows
Add max 3 concurrent run limits:
- GitHub Actions: concurrency groups prevent workflow queue buildup
- trigger-server: tracks concurrent runs, rejects with 429 if at max
- Configurable via MAX_CONCURRENT env var (defaults to 3)
- Returns running count and max in trigger response

This prevents resource exhaustion when workflows trigger frequently.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-08 19:34:52 +00:00
Sprite
bdf4e08cc7 feat: Increase improve workflow frequency to every 30 minutes
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-08 19:30:36 +00:00
L
2ad38d6321
Update README with ALPHA software disclaimer
Added a disclaimer about the software being in ALPHA stage.
2026-02-08 11:26:00 -08:00
Sprite
1ea8218e3e refactor: Move trigger service scripts into skill directory
Reorganize setup-trigger-service skill to be self-contained:
- Move trigger-server.ts, improve.sh, refactor.sh into skill directory
- Update SKILL.md to reference skill directory paths
- Update .gitignore to ignore start-*.sh wrapper scripts in skill dir
- Add guidance for creating new service scripts in the skill directory

This makes the skill fully self-contained and establishes a clear
pattern for adding new automation services.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-08 18:50:27 +00:00
Sprite
4ba682434a fix: Correct PostToolUse hook structure in settings.json
The hook configuration had two issues:
- Invalid "dangerouslySkipPermissions" setting (not supported)
- Wrong PostToolUse hook format (missing "hooks" array with "type" field)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-08 18:46:49 +00:00
Sprite
ed137190da feat: Add setup-trigger-service skill for Claude Code
Reusable skill (/setup-trigger-service) that guides setting up:
- Bun-based HTTP trigger server on a Sprite
- GitHub Actions workflow for cron/event/manual triggers
- Secret generation and GitHub secrets configuration

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-08 18:32:00 +00:00
L
4a05b32897
Add GitHub Actions triggers for Sprite services (#53)
* refactor: Automated improvements

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

* chore: Remove __pycache__ and add to .gitignore

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Sprite <noreply@sprite.dev>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-08 10:29:18 -08:00
Sprite
3ae83aa867 fix: Fix 4 failing claude.sh tests
Root causes:
- `clear` command fails with exit 1 when TERM is not set (test env has
  no terminal), crashing the script due to set -e. Guard with || true.
- Test patterns for Claude settings/state uploads used old temp file
  naming convention (/tmp/claude_settings, /tmp/claude_global) that no
  longer matches the paths generated by upload_config_file +
  upload_file_sprite (/tmp/*settings.json, /tmp/*.claude.json).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-08 18:26:53 +00:00
L
b25626850a Improve README with better intro, how-it-works, and dev guide (#51)
- Add compelling tagline with stats (13 agents, 18 clouds, 234 combinations)
- Add "How it works" section explaining the script architecture
- Add project structure overview and contribution quick-start
- Remove internal `spawn improve` from public command table
- Clean up formatting and tighten copy
- Add Apache 2.0 LICENSE file

Co-authored-by: Sprite <noreply@sprite.dev>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-08 18:16:46 +00:00
L
803f9de9bf
Enforce PR merge-or-close-with-comment policy (#50)
PRs created by autonomous loops must always be either merged or
closed with a comment explaining why. Updates improve.sh, refactor.sh,
and CLAUDE.md to enforce this consistently.

Co-authored-by: Sprite <noreply@sprite.dev>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-07 23:12:51 -08:00
L
46e4c71f5a
docs: Update README.md matrix with all 18 clouds and 13 agents (#49)
Add RunPod, UpCloud, BinaryLane, Genesis Cloud columns and Plandex row.
Matrix is now 13 agents x 18 clouds = 234/234 implemented.

Co-authored-by: Sprite <noreply@sprite.dev>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-07 23:05:32 -08:00