{"record":{"id":"ffc69348a46d1380","repo":"affaan-m/ECC","slug":"interactive-json-requires-explicit-mode-sco","errorCode":null,"errorMessage":"Interactive --json requires explicit --mode, --scope, and --hooks values.","messagePattern":"Interactive --json requires explicit --mode, --scope, and --hooks values\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/setup.js","lineNumber":353,"sourceCode":"function isInteractiveCancellation(error) {\n  return Boolean(error && (\n    error.code === 'ABORT_ERR'\n    || /aborted with ctrl\\+d|readline was closed/i.test(error.message || '')\n  ));\n}\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","sourceCodeStart":335,"sourceCodeEnd":371,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/setup.js#L335-L371","documentation":"validateInteractiveJsonOptions throws this when the setup runs interactively with --json but needsInteractiveChoices(options) is true — i.e. mode, scope, or hooks would have to be asked via prompts. JSON output is machine-readable, so interactive prompts that would corrupt the stream are forbidden; all three values must be supplied explicitly via flags.","triggerScenarios":"Running `ecc setup --json` (or with --json plus missing flags) in a TTY where --scope or --hooks is not explicitly provided, so the tool would need to prompt for choices.","commonSituations":"Wrapping setup in a script that parses stdout while omitting flags, expecting defaults; running --json without --mode/--scope/--hooks; assuming interactive prompts and JSON output can coexist.","solutions":["Pass all three values explicitly: `ecc setup --json --mode claude-plugin --scope project --hooks minimal`.","Add --yes so no confirmation is needed (see the companion --yes error).","Use --dry-run with --json to inspect without mutations if you cannot supply every flag."],"exampleFix":"// before\nnpm run setup -- --json\n\n// after\nnpm run setup -- --json --mode claude-plugin --scope project --hooks minimal --yes","handlingStrategy":"validation","validationCode":"const needsInteractiveChoices = (o) => o.mode === undefined || o.scope === undefined || o.hooks === undefined;\nif (useJson && needsInteractiveChoices(opts)) {\n  throw new Error('Interactive --json requires explicit --mode, --scope, and --hooks values.');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await runSetup(rawArgs);\n} catch (err) {\n  if (err.message.includes('Interactive --json requires')) {\n    console.error(err.message);\n    process.exitCode = 2;\n  } else throw err;\n}","preventionTips":["Treat --json as non-prompting: always supply --mode, --scope, and --hooks with it.","Add --yes alongside --json for real mutations.","Use --json --dry-run for inspection-only automation."],"tags":["cli","json-output","interactive"],"backgroundTag":"conflicting-config-options","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"}