mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-01 21:30:21 +00:00
Rebased fix/issue-2083 onto main after commands.ts split (PR #2095). Key resolutions: - commands.ts: kept HEAD shim (re-exports from ./commands/index.ts) - package.json: kept PR version 0.12.0 without @openrouter/spawn-shared dep - Fixed @openrouter/spawn-shared imports in commands/shared.ts, commands/update.ts, and __tests__/orchestrate.test.ts that were added after the PR branched All 1390 tests pass, biome lint clean. Agent: pr-maintainer 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-init.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-resolve-run.test.ts | ||
| commands-swap-resolve.test.ts | ||
| commands-update-download.test.ts | ||
| credential-hints.test.ts | ||
| custom-flag.test.ts | ||
| download-and-failure.test.ts | ||
| fuzzy-key-matching.test.ts | ||
| history-trimming.test.ts | ||
| history.test.ts | ||
| manifest-cache-lifecycle.test.ts | ||
| manifest-integrity.test.ts | ||
| manifest-type-contracts.test.ts | ||
| manifest.test.ts | ||
| orchestrate.test.ts | ||
| parse.test.ts | ||
| preflight-credentials.test.ts | ||
| preload.ts | ||
| prompt-file-security.test.ts | ||
| README.md | ||
| 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 unit tests for the Spawn CLI TypeScript implementation.
Test Runner
Tests use Bun's built-in test runner (bun:test). Do NOT use vitest.
# Run all tests
bun test
# Run a specific file
bun test src/__tests__/manifest.test.ts
Test Files
Core manifest
manifest.test.ts—agentKeys,cloudKeys,matrixStatus,countImplemented,loadManifest(cache/network)manifest-integrity.test.ts— Structural validation: script files exist for implemented entries, no orphansmanifest-type-contracts.test.ts— Field type precision for every agent/cloud in the real manifestmanifest-cache-lifecycle.test.ts— Cache TTL, expiry, forced refresh
Commands: happy paths
cmdrun-happy-path.test.ts— Successful download, history recording, env var passingcmd-interactive.test.ts— Interactive agent/cloud selection flowcmd-listing-output.test.ts—cmdMatrix,cmdAgents,cmdCloudsoutput formattingcmdlast.test.ts—cmdLast: history display and resumptioncmdlist-integration.test.ts—cmdListwith real history recordscommands-display.test.ts—cmdAgentInfo(happy path),cmdHelpcommands-cloud-info.test.ts—cmdCloudInfodisplaycommands-update-download.test.ts—cmdUpdate, script download and execution
Commands: error paths
commands-error-paths.test.ts— Validation failures, unknown agents/clouds, prompt rejectioncommands-name-suggestions.test.ts— Display name typo suggestions in errorscommands-swap-resolve.test.ts—detectAndFixSwappedArgs,resolveAndLogcommands-resolve-run.test.ts— Display name resolution incmdRuncmdrun-duplicate-detection.test.ts—--namecollision detection
Commands: utilities
commands-exported-utils.test.ts—parseAuthEnvVars,getImplementedAgents,getMissingClouds,getErrorMessage, etc.script-failure-guidance.test.ts—getScriptFailureGuidance,getSignalGuidance,buildRetryCommanddownload-and-failure.test.ts— Download fallback pipeline, failure reportingrun-path-credential-display.test.ts—prioritizeCloudsByCredentials, run-path validation
Security
security.test.ts—validateIdentifier,validateScriptContent,validatePrompt(core cases)security-edge-cases.test.ts— Boundary conditions and character-level edge casessecurity-encoding.test.ts— Encoding edge cases,stripDangerousKeyssecurity-connection-validation.test.ts—validateConnectionIP,validateUsername,validateServerIdentifier,validateLaunchCmdprompt-file-security.test.ts—validatePromptFilePath,validatePromptFileStats
Infrastructure
manifest-cache-lifecycle.test.ts— Cache lifecycle: write, read, expiry, forced refreshhistory.test.ts— History read/writehistory-trimming.test.ts— History trimming at size limitsclear-history.test.ts—clearHistory,cmdListClearssh-keys.test.ts— SSH key discovery, generation, fingerprintingupdate-check.test.ts— Auto-update check logicwith-retry-result.test.ts—withRetry,wrapSshCall, Result constructorsorchestrate.test.ts—runOrchestration
Parsing and type utilities
parse.test.ts—parseJsonWith,parseJsonRawfuzzy-key-matching.test.ts—findClosestKeyByNameOrKey,levenshtein,findClosestMatch,resolveAgentKey,resolveCloudKeyunknown-flags.test.ts— Unknown flag detection,KNOWN_FLAGS,expandEqualsFlagscustom-flag.test.ts—--customflag for AWS, GCP, Hetzner, DigitalOceancredential-hints.test.ts—credentialHintscloud-credentials.test.ts—hasCloudCredentialspreflight-credentials.test.ts—preflightCredentialCheck
Cloud-specific
aws.test.ts— AWS credential cache, SigV4 signing helperscloud-init.test.ts—getPackagesForTier,needsNode,needsBun,NODE_INSTALL_CMDcheck-entity.test.ts/check-entity-messages.test.ts— Entity validation
Support files (not test files)
test-helpers.ts— Shared fixtures:createMockManifest,mockClackPrompts,setupTestEnvironment, etc.preload.ts— Global test setup (temp dir isolation, env sandboxing)