{
  "$schema": "https://json-schema.org/schema",
  "cli": "nx",
  "$id": "Configuration",
  "title": "Add Cloudflare configuration to an existing project",
  "description": "Wire wrangler.jsonc and the Cloudflare deploy/serve/types targets onto an existing Nx project. Framework-agnostic: bring your own framework adapter.",
  "type": "object",
  "properties": {
    "project": {
      "type": "string",
      "description": "The existing Nx project to add Cloudflare configuration to.",
      "$default": { "$source": "projectName" },
      "x-prompt": "Which project should Cloudflare be added to?"
    },
    "template": {
      "type": "string",
      "enum": ["worker", "spa", "fullstack"],
      "default": "worker",
      "description": "Shape of the generated wrangler.jsonc.",
      "x-prompt": {
        "message": "What kind of Cloudflare setup?",
        "type": "list",
        "items": [
          {
            "value": "worker",
            "label": "Worker — a plain Worker (your own entry)"
          },
          { "value": "spa", "label": "SPA — static assets only" },
          {
            "value": "fullstack",
            "label": "Full-stack — static assets + an API Worker"
          }
        ]
      }
    },
    "name": {
      "type": "string",
      "description": "The Worker name written to wrangler.jsonc. Defaults to a sanitized form of the project name (lowercase alphanumeric + hyphens, as Cloudflare requires)."
    },
    "main": {
      "type": "string",
      "default": "src/index.ts",
      "description": "Worker entry point (project-relative). Ignored for the 'spa' template."
    },
    "assetsDir": {
      "type": "string",
      "default": "dist",
      "description": "Static assets directory wrangler serves, relative to the project root. Must point at your build output — Nx's default output lives at the workspace root (e.g. '../../dist/apps/web'), so override this unless your framework builds into the project. Used by 'spa' and 'fullstack'."
    },
    "compatibilityDate": {
      "type": "string",
      "description": "Wrangler compatibility_date (YYYY-MM-DD). Defaults to today."
    },
    "nodejsCompat": {
      "type": "boolean",
      "default": false,
      "description": "Add compatibility_flags: [\"nodejs_compat\"]."
    },
    "skipFormat": {
      "type": "boolean",
      "default": false,
      "description": "Skip formatting files.",
      "x-priority": "internal"
    }
  },
  "required": ["project"]
}
