mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-10 04:09:40 +00:00
Replace hand-constructed openrouter.json path with getSpawnCloudConfigPath("openrouter")
for single-source-of-truth path resolution. Remove unused _cloudName parameter since
the function delegates ALL cloud credentials unconditionally.
Agent: ux-engineer
Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| agent-setup-cov.test.ts | ||
| agent-tarball.test.ts | ||
| auto-update.test.ts | ||
| aws-cov.test.ts | ||
| aws.test.ts | ||
| billing-guidance.test.ts | ||
| check-entity-messages.test.ts | ||
| check-entity.test.ts | ||
| clear-history.test.ts | ||
| cloud-credentials.test.ts | ||
| cloud-init.test.ts | ||
| cmd-connect-cov.test.ts | ||
| cmd-delete-cov.test.ts | ||
| cmd-feedback.test.ts | ||
| cmd-fix-cov.test.ts | ||
| cmd-fix.test.ts | ||
| cmd-interactive-cov.test.ts | ||
| cmd-interactive.test.ts | ||
| cmd-link-cov.test.ts | ||
| cmd-link.test.ts | ||
| cmd-list-cov.test.ts | ||
| cmd-listing-output.test.ts | ||
| cmd-pick-cov.test.ts | ||
| cmd-run-cov.test.ts | ||
| cmd-status-cov.test.ts | ||
| cmd-uninstall-cov.test.ts | ||
| cmd-update-cov.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 | ||
| config-priority.test.ts | ||
| credential-hints.test.ts | ||
| custom-flag.test.ts | ||
| delete-spinner.test.ts | ||
| digitalocean-token.test.ts | ||
| do-cov.test.ts | ||
| do-min-size.test.ts | ||
| do-payment-warning.test.ts | ||
| do-snapshot.test.ts | ||
| download-and-failure.test.ts | ||
| fs-sandbox.test.ts | ||
| fuzzy-key-matching.test.ts | ||
| gateway-resilience.test.ts | ||
| gcp-cov.test.ts | ||
| gcp-shellquote.test.ts | ||
| hetzner-cov.test.ts | ||
| hetzner-pagination.test.ts | ||
| history-corruption.test.ts | ||
| history-cov.test.ts | ||
| history-spawn-id.test.ts | ||
| history-trimming.test.ts | ||
| history.test.ts | ||
| icon-integrity.test.ts | ||
| junie-agent.test.ts | ||
| kill-with-timeout.test.ts | ||
| manifest-cache-lifecycle.test.ts | ||
| manifest-integrity.test.ts | ||
| manifest-type-contracts.test.ts | ||
| manifest.test.ts | ||
| oauth-code-validation.test.ts | ||
| oauth-cov.test.ts | ||
| oauth-pkce.test.ts | ||
| orchestrate-cov.test.ts | ||
| orchestrate.test.ts | ||
| parse.test.ts | ||
| paths.test.ts | ||
| picker-cov.test.ts | ||
| preflight-credentials.test.ts | ||
| preload.ts | ||
| prompt-file-security.test.ts | ||
| README.md | ||
| recursive-spawn.test.ts | ||
| result-helpers.test.ts | ||
| run-path-credential-display.test.ts | ||
| script-failure-guidance.test.ts | ||
| security-connection-validation.test.ts | ||
| security.test.ts | ||
| shared-helpers.test.ts | ||
| shell.test.ts | ||
| spawn-config.test.ts | ||
| spawn-skill.test.ts | ||
| sprite-cov.test.ts | ||
| sprite-keep-alive.test.ts | ||
| ssh-cov.test.ts | ||
| ssh-keys-cov.test.ts | ||
| ssh-keys.test.ts | ||
| steps-flag.test.ts | ||
| test-helpers.ts | ||
| ui-cov.test.ts | ||
| ui-utils.test.ts | ||
| unknown-flags.test.ts | ||
| update-check-cov.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),stripDangerousKeysmanifest-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—cmdCloudInfodisplaycmd-update-cov.test.ts—cmdUpdate, script download and executioncmd-feedback.test.ts—spawn feedbackcommand: empty message rejection, URL constructioncmd-fix.test.ts—spawn fixcommand: SSH connection repair via DI-injected runScriptcmd-link.test.ts—spawn linkcommand: TCP reachability check, SSH agent detection via DI
Commands: coverage tests
cmd-connect-cov.test.ts—cmdConnect,cmdEnterAgent,cmdOpenDashboardcoveragecmd-delete-cov.test.ts—cmdDeletecoveragecmd-fix-cov.test.ts—cmdFix,fixSpawncoveragecmd-interactive-cov.test.ts—cmdInteractive,cmdAgentInteractivecoveragecmd-link-cov.test.ts—cmdLinkcoveragecmd-list-cov.test.ts—cmdListcoveragecmd-pick-cov.test.ts—cmdPickcoveragecmd-run-cov.test.ts—cmdRun,cmdRunHeadlesscoveragecmd-status-cov.test.ts—cmdStatuscoveragecmd-uninstall-cov.test.ts—cmdUninstallcoverage
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 validationdelete-spinner.test.ts—confirmAndDelete: spinner messages from stderr, final result displaysteps-flag.test.ts—--stepsand--configflags:findUnknownFlag,getAgentOptionalSteps,validateStepNames
Security
security.test.ts—validateIdentifier,validateScriptContent,validatePrompt(core, boundary, encoding edge cases)security-connection-validation.test.ts—validateConnectionIP,validateUsername,validateServerIdentifier,validateLaunchCmdprompt-file-security.test.ts—validatePromptFilePath,validatePromptFileStats
Infrastructure: coverage tests
agent-setup-cov.test.ts—setupAgent,wrapSshCall, agent setup orchestration coverageaws-cov.test.ts— AWS module coveragedo-cov.test.ts— DigitalOcean module coveragegcp-cov.test.ts— GCP module coveragehetzner-cov.test.ts— Hetzner module coveragehistory-cov.test.ts— History module coverageoauth-cov.test.ts— OAuth module coverageorchestrate-cov.test.ts—runOrchestrationcoveragesprite-cov.test.ts— Sprite module coveragessh-cov.test.ts— SSH helpers coveragessh-keys-cov.test.ts— SSH key management coverageui-cov.test.ts— UI helpers coverageupdate-check-cov.test.ts— Update check coverage
Infrastructure
history.test.ts— History read/writehistory-trimming.test.ts— History trimming at size limitshistory-corruption.test.ts— History corruption recovery: malformed JSON, concurrent writesclear-history.test.ts—clearHistory,cmdListClearpaths.test.ts—getSpawnDir,getCacheDir,getHistoryPath,getSshDir, path resolutionssh-keys.test.ts— SSH key discovery, generation, fingerprintingupdate-check.test.ts— Auto-update check logicauto-update.test.ts—setupAutoUpdate: systemd service unit generation and orchestration integrationkill-with-timeout.test.ts—killWithTimeout: SIGKILL after grace period, already-exited process handlingwith-retry-result.test.ts—withRetry,wrapSshCall, Result constructorsorchestrate.test.ts—runOrchestrationshell.test.ts—getLocalShell,isWindows,getInstallCmd,getWhichCommand,getInstallScriptUrl: platform-aware shell detectionfs-sandbox.test.ts— Guardrail: verifies test preload sandbox isolates filesystem writes
Parsing and type utilities
parse.test.ts—parseJsonWithpicker-cov.test.ts—parsePickerInput: tab-separated picker input parsing,pickFallback,pickToTTY,pickToTTYWithActionsfuzzy-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—preflightCredentialCheckresult-helpers.test.ts—asyncTryCatch,asyncTryCatchIf,tryCatch,tryCatchIf,mapResult,unwrapOrconfig-priority.test.ts—loadSpawnConfigdefault values, field merging, and override priorityspawn-config.test.ts—loadSpawnConfigfile parsing, validation, size limits, and null-byte rejection
Cloud-specific
aws.test.ts— AWS credential cache, SigV4 signing helpersbilling-guidance.test.ts—isBillingError,handleBillingError,showNonBillingErrorcloud-init.test.ts—getPackagesForTier,needsNode,needsBun,NODE_INSTALL_CMDcheck-entity.test.ts/check-entity-messages.test.ts— Entity validationagent-tarball.test.ts—tryTarballInstall: GitHub Release tarball install, fallback, URL validationgateway-resilience.test.ts—startGatewaysystemd unit with auto-restart and cron heartbeatdigitalocean-token.test.ts— DigitalOcean token storage, retrieval, and API client helpersdo-min-size.test.ts— DigitalOcean minimum droplet size enforcement:slugRamGbRAM comparison,AGENT_MIN_SIZEmapdo-payment-warning.test.ts—ensureDoTokenproactive payment method reminder for first-time DigitalOcean usersdo-snapshot.test.ts—findSpawnSnapshot: DigitalOcean snapshot lookup, filtering, error handlinghetzner-pagination.test.ts— Hetzner API pagination: multi-page server listing and cursor handlingsprite-keep-alive.test.ts—installSpriteKeepAlivedownload/install, graceful failure, session script wrappingui-utils.test.ts—validateServerName,validateRegionName,toKebabCase,sanitizeTermValue,jsonEscapegcp-shellquote.test.ts—shellQuoteGCP-specific quoting edge cases
Agent-specific
junie-agent.test.ts— Junie CLI agent configuration validation
Shared helpers
shared-helpers.test.ts—generateEnvConfig,hasStatus,toObjectArray,toRecord
OAuth and auth
oauth-code-validation.test.ts—OAUTH_CODE_REGEXformat validationoauth-pkce.test.ts—generateCodeVerifier,generateCodeChallengePKCE S256 flow
History (extended)
history-spawn-id.test.ts— Unique spawn IDs,saveVmConnection/saveLaunchCmdby spawnId, concurrent spawn isolation
Manifest (extended)
icon-integrity.test.ts— Icon file existence and format 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)