# Prompt: Generate a ReqTone import file from this backend

Paste everything below into an AI agent that has access to the backend
project's source code.

---

You have access to a backend project's source code. Your job is to scan its
controllers/routes and produce a single JSON file that can be imported into
**ReqTone**, a desktop API client. Follow this spec exactly — ReqTone will
reject or mis-import anything that doesn't match it.

## 1. What to extract

Walk every controller/route file and, for each endpoint, collect:

- HTTP method (GET, POST, PUT, PATCH, DELETE, etc.)
- Path, including path params (e.g. `/users/{id}` or `/users/:id` — use the
  framework's own placeholder syntax)
- Query parameters, if declared or evident from the handler
- Headers the endpoint expects (auth headers, content-type, custom headers)
- Request body shape for POST/PUT/PATCH — build a **realistic example JSON
  body** from the DTO/model/validator, using plausible placeholder values
  (not just empty strings), matching the real field names and types
- Auth requirement (none, bearer token, API key, basic) if it's visible from
  middleware/guards/decorators

Group endpoints by controller (or by resource/module if there's no
controller-per-file convention) — each controller becomes a **folder**, each
endpoint becomes a **request** inside it.

## 2. Output format — ReqTone JSON (schema v2)

Produce exactly one JSON file: a single envelope wrapping one **project**
node that contains one **folder** per controller, each folder containing
**request** nodes for its endpoints.

```json
{
  "format": "reqtone/v2",
  "scope": "project",
  "exportedAt": "<current ISO 8601 timestamp>",
  "data": {
    "id": "pj-<unique-string>",
    "type": "project",
    "name": "<name of the backend project>",
    "baseUrls": [
      { "id": "bu-1", "name": "Default", "value": "<the backend's base URL, e.g. http://localhost:8080/api>" }
    ],
    "tokens": [
      { "id": "tk-1", "name": "Default", "authType": "bearer", "username": "", "value": "" }
    ],
    "variables": [],
    "children": [
      {
        "id": "fd-<unique-string>",
        "type": "folder",
        "name": "<Controller name, e.g. Users>",
        "children": [
          {
            "id": "rq-<unique-string>",
            "type": "request",
            "name": "<Human-readable action, e.g. \"Get user by id\">",
            "method": "GET",
            "endpoint": "/users/{id}",
            "body": "",
            "bodyType": "json",
            "params": [
              { "id": "r-1", "key": "page", "value": "1", "enabled": true }
            ],
            "headers": [
              { "id": "r-2", "key": "Content-Type", "value": "application/json", "enabled": true }
            ],
            "formData": [],
            "urlEncodedFields": [],
            "rawMime": "text/plain",
            "rawBinaryBase64": "",
            "graphQlQuery": "",
            "graphQlVariables": "{}",
            "graphQlOperationName": "",
            "authMode": "project",
            "authTokenId": null,
            "auth": null,
            "baseUrlMode": "project",
            "baseUrlId": null,
            "baseUrl": "",
            "variables": []
          }
        ]
      }
    ]
  }
}
```

### Field rules (do not deviate)

- **Every node** needs `id` (any unique string), `type`, and `name`.
  IDs just need to be unique within the file — ReqTone regenerates them on
  import, so their exact form doesn't matter, but every node must have one.
- **`type`** is exactly one of `project`, `folder`, `request` — nothing else.
- **project** node: `baseUrls` and `tokens` are arrays (even if you only fill
  one entry), `children` holds folders and/or requests directly.
- **folder** node: only `id`, `type`, `name`, `children`. No other fields.
- **request** node: include *all* the fields shown in the example above, even
  when empty — don't omit fields that don't apply to a given endpoint, just
  leave them at their default (`""`, `[]`, `null`, or `"{}"` as shown).
- **`endpoint`**: path only (no scheme/host) — it's appended to the
  project's base URL. Keep the path's own placeholder syntax for path params
  (`{id}`, `:id`, `<id>` — whatever the framework uses).
- **`bodyType`**: one of `json`, `raw`, `x-www-form-urlencoded`, `form-data`,
  `graphql`, `file`. Use `json` for typical REST JSON bodies and put the
  example payload (as a JSON string) in `body`.
- **`body`**: a JSON **string** (not a nested object) containing your example
  payload, e.g. `"{\"email\":\"user@example.com\",\"name\":\"Jane Doe\"}"`.
- **`params`** / **`headers`** / **`urlEncodedFields`**: arrays of
  `{ id, key, value, enabled }`.
- **`formData`**: array of `{ id, key, value, enabled, type }` where `type`
  is `"text"` or `"file"`.
- **`authMode`**: use `"project"` to inherit the project's default token
  (the common case), or `"none"` if the endpoint is explicitly public/
  unauthenticated. Don't invent other auth mode values.
- Leave `auth`, `authTokenId`, `baseUrlId` as `null`, and `baseUrlMode` as
  `"project"` unless an endpoint genuinely needs a different base URL, in
  which case use `"custom"` and put the full URL in `baseUrl`.

## 3. Constraints

- Output **must be valid JSON** — no comments, no trailing commas.
- Do not invent endpoints that aren't in the code. Do not skip endpoints
  because they look trivial.
- If an endpoint's request body shape is ambiguous, make a reasonable
  best-effort example and don't block on it.
- Don't add fields beyond what's specified above — ReqTone ignores or may
  choke on unrecognized shapes.

## 4. Deliverable

Save the result as a single file named `reqtone-import.json` at the root of
your working directory, and tell me how many controllers and endpoints you
found and mapped.
