{"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":261,"sourceCode":"      { getName: (a: SetupAgent) => getAgent(a).displayName }\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  scope: Scope,\n  content: string\n): Promise<{ status: string; path: string }> {\n  const agent = getAgent(agentName);\n  const rule = agent.rule;\n\n  if (rule.kind === \"file\") {\n    const ruleContent = `${rule.contentPrefix ?? \"\"}${content}`;\n    const ruleDir =\n      scope === \"global\" ? rule.dir(\"global\") : join(process.cwd(), rule.dir(\"project\"));","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/upstash/context7/blob/4416fb855b8f752be735e34f943b5d0762701aad/packages/cli/src/commands/setup.ts#L243-L279","documentation":"In setup.ts resolveAgents(), when no agent is given via flags and --yes is not set, the CLI prompts the user to pick which agent(s) to configure with promptAgents(). Cancelling that prompt logs 'Setup cancelled' and returns an empty array, aborting setup before any files are written.","triggerScenarios":"promptAgents() resolves falsy during `context7 setup` — user pressed Esc/Ctrl+C or chose cancel in the agent-selection prompt; detected agents existed but --yes was not passed so prompting still occurred, or nothing was detected and a prompt was shown.","commonSituations":"Abandoning a Context7 setup midway; running setup in a non-interactive shell where the picker aborts; pressing the wrong key in the agent multi-select.","solutions":["Rerun `context7 setup` and select an agent in the prompt","Use `context7 setup --yes` to accept all detected agents without prompting","Pass an explicit agent flag (e.g. --cursor) to skip the picker"],"exampleFix":"// before\n// $ context7 setup        # cancel at agent picker\n// after\n// $ context7 setup --cursor","handlingStrategy":"validation","validationCode":"if (!process.stdout.isTTY) {\n  args.push(\"--yes\"); // or pass an explicit agent flag\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run setup interactively, or pass --yes / --<agent> flags in scripts","Keep an agent selection in mind before starting setup","Abort deliberately only if you intend to stop setup"],"tags":["cli","user-cancelled","interactive-prompt"],"backgroundTag":"user-cancelled-operation","analyzedSha":"4416fb855b8f752be735e34f943b5d0762701aad","analyzedAt":"2026-09-16T20:28:07.148Z","contentChangedAt":"2026-09-16T20:28:07.148Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}