MCPcopy Create free account
hub / github.com/TestSprite/testsprite-cli / runSetupAction

Function runSetupAction

src/commands/init.ts:496–513  ·  view source on GitHub ↗

Shared action for `setup` and the deprecated `init` alias.

(
  cmdOpts: SetupCmdOpts,
  command: Command,
  deps: InitDeps,
  defaultAgent: AgentTarget,
)

Source from the content-addressed store, hash-verified

494
495/** Shared action for `setup` and the deprecated `init` alias. */
496async function runSetupAction(
497 cmdOpts: SetupCmdOpts,
498 command: Command,
499 deps: InitDeps,
500 defaultAgent: AgentTarget,
501): Promise<void> {
502 const opts = buildSetupOptions(cmdOpts, command, defaultAgent);
503
504 // When --yes is supplied without a key source, force isTTY=false so runInit
505 // emits exit 5 with a clear message rather than hanging on a prompt in a
506 // headless CI environment where a TTY fd happens to be open.
507 const effectiveDeps: InitDeps = {
508 ...deps,
509 ...(opts.yes && !opts.apiKey && !opts.fromEnv ? { isTTY: false } : {}),
510 };
511
512 await runInit(opts, effectiveDeps);
513}
514
515export function createSetupCommand(deps: InitDeps = {}): Command {
516 const validTargets = Object.keys(TARGETS) as AgentTarget[];

Callers 3

createSetupCommandFunction · 0.85
runConfigureViaSetupFunction · 0.85

Calls 2

buildSetupOptionsFunction · 0.85
runInitFunction · 0.85

Tested by

no test coverage detected