{"record":{"id":"327f369092177bd7","repo":"yamadashy/repomix","slug":"skill-generation-cancelled","errorCode":null,"errorMessage":"Skill generation cancelled","messagePattern":"Skill generation cancelled","errorType":"exception","errorClass":"OperationCancelledError","httpStatus":null,"severity":"info","filePath":"src/cli/prompts/skillPrompts.ts","lineNumber":17,"sourceCode":"import fs from 'node:fs/promises';\nimport os from 'node:os';\nimport path from 'node:path';\nimport pc from 'picocolors';\nimport { OperationCancelledError, RepomixError } from '../../shared/errorHandle.js';\nimport { getDisplayPath } from '../cliReport.js';\n\nexport type SkillLocation = 'personal' | 'project';\n\nexport interface SkillPromptResult {\n  location: SkillLocation;\n  skillDir: string;\n}\n\nconst onCancelOperation = (cancelFn: (message?: string) => void): never => {\n  cancelFn('Skill generation cancelled.');\n  throw new OperationCancelledError('Skill generation cancelled');\n};\n\n/**\n * Get the base directory for skills based on location type.\n */\nexport const getSkillBaseDir = (cwd: string, location: SkillLocation): string => {\n  if (location === 'personal') {\n    return path.join(os.homedir(), '.claude', 'skills');\n  }\n  return path.join(cwd, '.claude', 'skills');\n};\n\n/**\n * Prompt user for skill location and handle overwrite confirmation.\n */\n// Lazy-load @clack/prompts (~16ms) to build default deps.\n// Only called in production; tests always pass deps directly.\nconst createPromptDeps = async () => {","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/yamadashy/repomix/blob/f465ad909315a22120636baf03fa5e28701a50cb/src/cli/prompts/skillPrompts.ts#L1-L35","documentation":"Thrown as OperationCancelledError when the user cancels any @clack/prompts interaction during skill generation. onCancelOperation first calls the clack cancel() to render 'Skill generation cancelled.' on the terminal, then throws so the CLI exits with a cancellation status instead of proceeding. It is triggered from promptSkillLocation when the location select or the overwrite confirm is cancelled or answered negatively.","triggerScenarios":"Running repomix's skill generation interactive flow: pressing Ctrl-C/Esc at the 'Where would you like to save the skill?' select, or cancelling (or answering 'no' to) the 'Skill directory already exists. Do you want to overwrite it?' confirm.","commonSituations":"User changes their mind about overwriting an existing skill; accidental Ctrl-C; automated runs that feed EOF/keystrokes into the prompt causing clack to report cancel.","solutions":["Re-run the skill generation command and complete the prompts.","If you don't want to overwrite, choose a different skill name or location when prompted instead of cancelling.","For non-interactive use, pass the skill output path explicitly (with --force as needed) so no prompts appear.","Ensure scripts that drive the CLI don't send stray keystrokes/EOF to stdin during prompts."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await promptSkillLocation(skillName, cwd);\n} catch (e) {\n  if (e instanceof OperationCancelledError && e.message === 'Skill generation cancelled') {\n    console.error('Skill generation aborted by user.');\n    return;\n  }\n  throw e;\n}","preventionTips":["Pass the output path explicitly to skip interactive prompts.","Don't pipe/redirect the CLI when prompts are expected; run it on a TTY.","Decide beforehand whether to overwrite an existing skill to avoid cancelling mid-flow.","Treat OperationCancelledError as normal user flow in wrappers."],"tags":["user-cancellation","interactive-prompt","cli","skill-generation"],"backgroundTag":"operation-cancelled-by-user","analyzedSha":"f465ad909315a22120636baf03fa5e28701a50cb","analyzedAt":"2026-08-29T01:27:42.024Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}