{"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":"exception","errorClass":"Error","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/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/setup.js#L335-L371","documentation":"Thrown by validateInteractiveJsonOptions when --json is used in an interactive context but at least one of --mode, --scope, --hooks is still undefined. The JSON output must be deterministic and not depend on prompt answers, so all three must be supplied explicitly on the command line.","triggerScenarios":"Running `node scripts/setup.js --json` in a TTY without providing all of --mode/--scope/--hooks. needsInteractiveChoices() returns true because one is missing, and the guard aborts.","commonSituations":"Wiring setup.js into CI/automation with --json but expecting prompts; providing only --scope and --hooks and forgetting --mode.","solutions":["Provide all three explicitly: `--json --mode claude-plugin --scope user --hooks standard`.","Add --yes (and optionally --dry-run) to satisfy the mutation guard.","Drop --json if you actually want the interactive prompt."],"exampleFix":"# before\nnode scripts/setup.js --json --scope user\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')) {\n  const has = name => argv.some(a => a.startsWith(name));\n  if (!(has('--mode') && has('--scope') && has('--hooks'))) {\n    console.error('Interactive --json needs --mode, --scope, and --hooks');\n    process.exit(2);\n  }\n}","typeGuard":null,"tryCatchPattern":"try { validateInteractiveJsonOptions(options, interactive); } catch (err) { console.error(err.message); process.exit(2); }","preventionTips":["Codify the full JSON automation command in CI as a single template.","Detect --json in a wrapper and assert the triad before delegating."],"tags":["cli","argument-parsing","setup","json","automation"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}