{"record":{"id":"de57920a7e0955f8","repo":"upstash/context7","slug":"setup-cancelled","errorCode":null,"errorMessage":"Setup cancelled","messagePattern":"Setup cancelled","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"packages/cli/src/commands/setup.ts","lineNumber":222,"sourceCode":"      { getName: (a: SetupAgent) => SETUP_AGENT_NAMES[a] }\n    );\n  } catch {\n    return null;\n  }\n}\n\nasync function resolveAgents(options: SetupOptions, scope: Scope): Promise<SetupAgent[]> {\n  const explicit = getSelectedAgents(options);\n  if (explicit.length > 0) return explicit;\n\n  const detected = await detectAgents(scope);\n\n  if (detected.length > 0 && options.yes) return detected;\n\n  log.blank();\n  const selected = await promptAgents();\n  if (!selected) {\n    log.warn(\"Setup cancelled\");\n    return [];\n  }\n  return selected;\n}\n\n/** Install a rule for an agent, handling both \"file\" (standalone) and \"append\" (AGENTS.md) types. */\nasync function installRule(\n  agentName: SetupAgent,\n  mode: SetupMode,\n  scope: Scope\n): Promise<{ status: string; path: string }> {\n  const agent = getAgent(agentName);\n  const rule = agent.rule;\n  const content = await getRuleContent(mode, agentName);\n\n  if (rule.kind === \"file\") {\n    const ruleDir =\n      scope === \"global\" ? rule.dir(\"global\") : join(process.cwd(), rule.dir(\"project\"));","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/upstash/context7/blob/5284672feb575908efead6fcf1b5e542f8d607bb/packages/cli/src/commands/setup.ts#L204-L240","documentation":"In `context7 setup`, when no agent flags are given and detection/auto-accept (--yes with detected agents) does not apply, promptAgents() shows the agent chooser. A null result — Ctrl+C/Esc or empty selection — makes resolveAgents() warn 'Setup cancelled' and return [], ending the command before anything is installed.","triggerScenarios":"Cancelling the interactive 'which agents to configure?' prompt at the start of `context7 setup` when no --claude/--cursor/... flags were supplied.","commonSituations":"First-time user launches setup to look around and aborts; accidental Esc; running setup in a non-interactive shell where the inquirer prompt throws immediately.","solutions":["Re-run `context7 setup` and pick at least one agent, or pass explicit flags (e.g. `context7 setup --claude`) to skip the prompt.","Run setup in a real terminal (TTY); for scripts combine flags with --yes."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Skip the agent prompt with explicit flags\n// context7 setup --claude        (promptAgents is never reached)","typeGuard":"function hasAgents(list: SetupAgent[] | null): list is SetupAgent[] {\n  return list !== null && list.length > 0;\n}","tryCatchPattern":null,"preventionTips":["Pass agent flags for scripted/non-interactive setup.","Gate on process.stdin.isTTY before launching the interactive chooser.","Treat a cancelled prompt as a clean exit (empty agent list) rather than an error."],"tags":["cli","setup","interactive-prompt","user-cancel"],"backgroundTag":"prompt-cancelled-by-user","analyzedSha":"5284672feb575908efead6fcf1b5e542f8d607bb","analyzedAt":"2026-08-18T18:00:18.510Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}