/**
 * CLI error codes
 */
export const CLI_ERROR_CODES = {
  // Init errors (E001-E009)
  INIT_DIR_EXISTS: "CLI_E001",
  INIT_BUN_NOT_FOUND: "CLI_E002",
  INIT_TEMPLATE_NOT_FOUND: "CLI_E003",

  // Dev errors (E010-E019)
  DEV_PORT_IN_USE: "CLI_E010",
  DEV_MANIFEST_NOT_FOUND: "CLI_E011",
  DEV_NO_ROUTES: "CLI_E012",

  // Guard errors (E020-E029)
  GUARD_CONFIG_INVALID: "CLI_E020",
  GUARD_PRESET_NOT_FOUND: "CLI_E021",
  GUARD_VIOLATION_FOUND: "CLI_E022",

  // Build errors (E030-E039)
  BUILD_ENTRY_NOT_FOUND: "CLI_E030",
  BUILD_BUNDLE_FAILED: "CLI_E031",
  BUILD_OUTDIR_NOT_WRITABLE: "CLI_E032",

  // Config errors (E040-E049)
  CONFIG_PARSE_FAILED: "CLI_E040",
  CONFIG_VALIDATION_FAILED: "CLI_E041",

  // Skills generator errors (E050-E059) — Wave R3 L-02
  SKILLS_OUTPUT_ESCAPE: "CLI_E050",

  // Test errors (E060-E069) — Phase 12.1
  TEST_NO_MATCH: "CLI_E060",
  TEST_RUNNER_FAILED: "CLI_E061",
  TEST_UNKNOWN_TARGET: "CLI_E062",

  // CLI usage errors (E100+)
  UNKNOWN_COMMAND: "CLI_E100",
  UNKNOWN_SUBCOMMAND: "CLI_E101",
  MISSING_ARGUMENT: "CLI_E102",

  // Deploy errors (E200-E229) — Phase 13.1
  DEPLOY_UNSUPPORTED_TARGET: "CLI_E200",
  DEPLOY_CONFIG_INVALID: "CLI_E201",
  DEPLOY_BUILD_FAILED: "CLI_E202",
  DEPLOY_GUARD_FAILED: "CLI_E203",
  DEPLOY_ARTIFACT_WRITE_FAILED: "CLI_E204",
  DEPLOY_PROVIDER_CLI_MISSING: "CLI_E205",
  DEPLOY_PROVIDER_CLI_OUTDATED: "CLI_E206",
  DEPLOY_SECRET_MISSING: "CLI_E207",
  DEPLOY_SECRET_STORE_UNAVAILABLE: "CLI_E208",
  DEPLOY_SECRET_FORMAT_INVALID: "CLI_E209",
  DEPLOY_SECRET_LEAKED_IN_ARTIFACT: "CLI_E210",
  DEPLOY_EXECUTE_REQUIRES_CONFIRMATION: "CLI_E211",
  DEPLOY_MANIFEST_MISSING: "CLI_E212",
  DEPLOY_EDGE_RUNTIME_WARNING: "CLI_E213",
  DEPLOY_NOT_IMPLEMENTED: "CLI_E214",
  DEPLOY_UNSUPPORTED_ROUTE: "CLI_E215",
  DEPLOY_PLAN_MANIFEST_FAILED: "CLI_E216",
  DEPLOY_PLAN_CACHE_INVALID: "CLI_E217",

  // AI chat / eval errors (E300-E319) — Phase 14.2 + Wave R3 L-01
  AI_API_KEY_MISSING: "CLI_E300",
  AI_STREAM_FAILED: "CLI_E301",
  AI_HISTORY_MALFORMED: "CLI_E302",
  AI_PRESET_NOT_FOUND: "CLI_E303",
  AI_PROMPT_REQUIRED: "CLI_E304",
  AI_UNKNOWN_PROVIDER: "CLI_E305",
  AI_UNKNOWN_SLASH: "CLI_E306",
  AI_TIMEOUT: "CLI_E307",
  AI_INVALID_INPUT: "CLI_E308",
  AI_SYSTEM_FILE_NOT_FOUND: "CLI_E309",
  AI_PATH_ESCAPE: "CLI_E310",

  // Phase 12.2/12.3 — E2E/coverage/watch/heal extensions (CLI_E063-CLI_E067).
  // Placed at end-of-file per Agent E scope (avoids E300-309 conflicts).
  TEST_E2E_PLAYWRIGHT_MISSING: "CLI_E063",
  TEST_E2E_CONFIG_MISSING: "CLI_E064",
  TEST_COVERAGE_THRESHOLD: "CLI_E065",
  TEST_WATCH_NO_WATCH_DIRS: "CLI_E066",
  TEST_HEAL_NO_RESULTS: "CLI_E067",
} as const;

export type CLIErrorCode = typeof CLI_ERROR_CODES[keyof typeof CLI_ERROR_CODES];
