mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-16 02:51:10 +00:00
* fix: remove broken clone_cli() — go straight to pre-built binary The clone_cli() function (added before the monorepo migration, PR #1853) only fetches top-level .ts files via the GitHub Contents API. Since the monorepo reorganised source code into subdirectories (aws/, fly/, hetzner/, shared/, etc.), clone_cli() silently downloads an incomplete source tree. bun run build then always fails because cross-directory imports cannot resolve, and the installer falls through to the pre-built binary anyway. Every install was burning ~12 unnecessary GitHub API requests (rate-limited at 60/hr for unauthenticated clients) and several seconds of wasted bun install + failed build time. Fix: remove clone_cli() entirely, replace build_and_install() with a direct binary download. Behaviour is identical for all users (binary path was already the universal outcome); installs are now faster and cheaper on the API rate limit. Agent: code-health Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * test: update install.sh tests for simplified binary-only installer Remove tests for clone_cli() and source builds which were removed in the parent commit. Add tests verifying the direct binary download approach and asserting that the old clone/build code is gone. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * style: fix biome format errors in commands.ts and duplicate-detection test Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: B <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| aws.test.ts | ||
| check-entity-messages.test.ts | ||
| check-entity.test.ts | ||
| clear-history.test.ts | ||
| cloud-credentials.test.ts | ||
| cloud-info.test.ts | ||
| cmd-interactive.test.ts | ||
| cmd-listing-output.test.ts | ||
| cmdlast.test.ts | ||
| cmdlist-integration.test.ts | ||
| cmdrun-duplicate-detection.test.ts | ||
| cmdrun-happy-path.test.ts | ||
| commands-cloud-info.test.ts | ||
| commands-display.test.ts | ||
| commands-error-paths.test.ts | ||
| commands-exported-utils.test.ts | ||
| commands-name-suggestions.test.ts | ||
| commands-output.test.ts | ||
| commands-resolve-run.test.ts | ||
| commands-swap-resolve.test.ts | ||
| commands-update-download.test.ts | ||
| commands.test.ts | ||
| credential-hints.test.ts | ||
| custom-flag.test.ts | ||
| do-oauth.test.ts | ||
| download-and-failure.test.ts | ||
| fly.test.ts | ||
| fuzzy-key-matching.test.ts | ||
| history-trimming.test.ts | ||
| history.test.ts | ||
| install-script-validation.test.ts | ||
| integration.test.ts | ||
| manifest-cache-lifecycle.test.ts | ||
| manifest-helpers.test.ts | ||
| manifest-integrity.test.ts | ||
| manifest-type-contracts.test.ts | ||
| manifest-validation.test.ts | ||
| manifest.test.ts | ||
| matrix-compact-footer.test.ts | ||
| parse.test.ts | ||
| preflight-credentials.test.ts | ||
| preload.ts | ||
| prompt-file-security.test.ts | ||
| README.md | ||
| resolve-prompt.test.ts | ||
| run-path-credential-display.test.ts | ||
| script-failure-guidance.test.ts | ||
| security-connection-validation.test.ts | ||
| security-edge-cases.test.ts | ||
| security-encoding.test.ts | ||
| security.test.ts | ||
| ssh-keys.test.ts | ||
| test-helpers.ts | ||
| unknown-flags.test.ts | ||
| update-check.test.ts | ||
| with-retry-result.test.ts | ||
CLI Tests
This directory contains comprehensive tests for the Spawn CLI TypeScript implementation.
Test Files
manifest.test.ts
Tests for manifest loading, caching, and parsing:
- Network fetching and fallback behavior
- Disk cache TTL and invalidation
- Offline mode with stale cache
- Agent/cloud key extraction
- Matrix status checking
- Implemented combination counting
commands.test.ts
Tests for CLI command handlers:
cmdHelp- Help text displaycmdList- Matrix table renderingcmdAgents- Agent listingcmdClouds- Cloud provider listingcmdAgentInfo- Agent details with available cloudscmdRun- Script execution with validation and fallback
integration.test.ts
Integration tests for end-to-end workflows:
- Version command
- Manifest caching across loads
- Offline scenarios
- Agent/cloud key extraction
- Matrix validation
- Implementation counting
Running Tests
# Run all tests once
npm test
# Run tests in watch mode
npm run test:watch
# Run with coverage (requires coverage provider)
npm test -- --coverage
Test Coverage
Current coverage targets critical paths:
- manifest.ts: ~80% coverage of caching, fetching, and parsing logic
- commands.ts: ~70% coverage of command handlers and validation
- integration: Basic end-to-end scenarios
Notes
- Tests use vitest for fast execution with Bun/Node compatibility
- Mock manifest data is used to avoid network dependencies
- Cache directory is isolated per test to prevent interference
- Some tests account for local
manifest.jsonfallback in project directory