{"record":{"id":"1166bdab49d1cb4f","repo":"affaan-m/ECC","slug":"interactive-json-mutations-require-yes","errorCode":null,"errorMessage":"Interactive --json mutations require --yes.","messagePattern":"Interactive --json mutations require --yes\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/setup.js","lineNumber":358,"sourceCode":"}\n\nfunction needsInteractiveChoices(options) {\n  return (\n    options.mode === undefined\n    || options.scope === undefined\n    || options.hooks === undefined\n  );\n}\n\nfunction validateInteractiveJsonOptions(options, interactive) {\n  if (!interactive || !options.json) return;\n  if (needsInteractiveChoices(options)) {\n    throw new Error(\n      'Interactive --json requires explicit --mode, --scope, and --hooks values.'\n    );\n  }\n  if (!options.yes && !options.dryRun) {\n    throw new Error('Interactive --json mutations require --yes.');\n  }\n}\n\nfunction reconcileClaudePlugin(options) {\n  const setupOptions = {\n    dryRun: options.dryRun,\n    hooks: options.hooks,\n    scope: options.scope,\n  };\n  if (options.moveScope) {\n    return migrateClaudePluginScope(setupOptions);\n  }\n\n  try {\n    return setupClaudePlugin(setupOptions);\n  } catch (error) {\n    const canAutoMigrate = (\n      error instanceof ClaudeSetupError","sourceCodeStart":340,"sourceCodeEnd":376,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/setup.js#L340-L376","documentation":"Thrown by validateInteractiveJsonOptions when --json is used interactively with all choices supplied, but neither --yes nor --dry-run is set. JSON mutations in non-interactive/interactive JSON mode must be explicitly authorized to avoid silently changing the filesystem.","triggerScenarios":"`node scripts/setup.js --json --mode claude-plugin --scope user --hooks standard` without --yes or --dry-run in a context flagged interactive.","commonSituations":"Setting up the full flag set for JSON output but forgetting the confirmation bypass; running in a TTY where 'interactive' is true by default.","solutions":["Add `--yes` to authorize the mutation.","Or add `--dry-run` to preview the JSON without writing.","Run in a non-TTY (piped stdin) only if you also pass --yes per the non-interactive guard."],"exampleFix":"# before\nnode scripts/setup.js --json --mode claude-plugin --scope user --hooks standard\n# after\nnode scripts/setup.js --json --mode claude-plugin --scope user --hooks standard --yes","handlingStrategy":"validation","validationCode":"const argv = process.argv.slice(2);\nif (argv.includes('--json') && !argv.includes('--dry-run') && !argv.includes('--yes')) {\n  console.error('Interactive --json mutations require --yes');\n  process.exit(2);\n}","typeGuard":null,"tryCatchPattern":"try { validateInteractiveJsonOptions(options, interactive); } catch (err) { console.error(err.message); process.exit(2); }","preventionTips":["Always pair --json with --yes or --dry-run in automation.","Add a pre-flight check in the wrapper so the mutation guard never surprises you."],"tags":["cli","argument-parsing","setup","json","automation","safety"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}