{"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":"validation","errorClass":null,"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/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/setup.js#L340-L376","documentation":"validateInteractiveJsonOptions throws this when an interactive --json run would perform mutations but neither --yes nor --dry-run was given. The confirmation prompt is interactive and would corrupt JSON output, so non-prompted consent (--yes) or a read-only run (--dry-run) is mandatory.","triggerScenarios":"Running `ecc setup --json --mode claude-plugin --scope project --hooks minimal` in a TTY without --yes and without --dry-run.","commonSituations":"Scripting JSON output while forgetting consent automation; CI wrappers that forward --json but not --yes; testing a dry inspection but omitting --dry-run.","solutions":["Add --yes to authorize mutations: `ecc setup --json ... --yes`.","Add --dry-run instead if you only want the JSON report without changes.","For CI, pass --yes via your automation config once the flags are verified."],"exampleFix":"// before\nnpm run setup -- --json --mode claude-plugin --scope project --hooks minimal\n\n// after\nnpm run setup -- --json --mode claude-plugin --scope project --hooks minimal --yes","handlingStrategy":"validation","validationCode":"if (useJson && !opts.yes && !opts.dryRun) {\n  throw new Error('Interactive --json mutations require --yes.');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await runSetup(rawArgs);\n} catch (err) {\n  if (err.message.includes('Interactive --json mutations require --yes')) {\n    console.error(err.message);\n    process.exitCode = 2;\n  } else throw err;\n}","preventionTips":["Always include --yes or --dry-run whenever --json is used.","Store the consent flag in your CI config next to the --json flag.","Keep --dry-run in scheduled jobs that only need reports."],"tags":["cli","json-output","confirmation"],"backgroundTag":"missing-required-flag","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}