Skip to content

fix(cli): wheels routes prints route table instead of AI-docs JSON dump - #2336

Merged
bpamiri merged 1 commit into
developfrom
claude/fix-2317-wheels-routes
Apr 27, 2026
Merged

fix(cli): wheels routes prints route table instead of AI-docs JSON dump#2336
bpamiri merged 1 commit into
developfrom
claude/fix-2317-wheels-routes

Conversation

@bpamiri

@bpamiri bpamiri commented Apr 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

`wheels routes` was hitting `/wheels/ai?context=routing` — the framework's AI-documentation endpoint, which dumps ~500KB of JSON describing routing helpers and patterns. The user expected (and the CLI help promised) the application's actual configured routes.

Two coordinated fixes:

CLI side (`cli/lucli/Module.cfc`)

Switch `routes()` to hit `/wheels/cli?command=routes&format=json` (the existing endpoint that serializes `application.wheels.routes`), parse the JSON response, and print a formatted table with auto-sized METHOD / PATTERN / CONTROLLER##ACTION columns plus the route name in parentheses where set. Leading-slash on patterns is normalised so each row has exactly one.

Framework side (`vendor/wheels/public/views/cli.cfm`)

The `case "routes":` branch was reading `application.wheels.appKey` as a property — but `appKey` is a function (`$appKey()`), not a property. The lookup failed silently and the endpoint returned `data.routes = []` with `success: false` for every fresh app. Replaced with direct `application.wheels.routes` access — the convention every other case in this file already uses (lines 5, 9, 10, 197, 206, 324, 449, ...).

Sample output

```
METHOD PATTERN CONTROLLER##ACTION

GET /wheels/info wheels.public##info (wheelsInfo)
GET /wheels/routes wheels.public##routes (wheelsRoutes)
POST /wheels/route-tester wheels.public##routetester (wheelsRouteTester)
...
GET /[controller]/[action] ## (wildcard)
GET /[controller] ##index (wildcard)
GET / main##index (root)

35 route(s)
```

Test plan

Closes #2317

`wheels routes` was hitting `/wheels/ai?context=routing` — the framework's
AI-documentation endpoint, which dumps ~500KB of JSON describing routing
patterns/helpers. The user expected (and the CLI help promised) the
application's actual route table.

Two coordinated fixes:

- cli/lucli/Module.cfc: switch `routes()` to call
  `/wheels/cli?command=routes&format=json` (the existing endpoint that
  serializes `application.wheels.routes`), parse the JSON, and print a
  formatted table with METHOD / PATTERN / CONTROLLER#ACTION columns plus
  the route name in parentheses where set. Pattern leading "/" is
  normalised so each row has exactly one.

- vendor/wheels/public/views/cli.cfm: the `case "routes":` branch was
  reading `application.wheels.appKey` as a property — but `appKey` is a
  function (`$appKey()`), not a property. The lookup failed silently and
  `data.routes` came back empty with `success: false`. Routes live at
  `application.wheels.routes` directly (the convention every other case
  in this file already uses); switch to that.

Sample output:

    METHOD  PATTERN          CONTROLLER#ACTION
    ----------------------------------------------
    GET     /wheels/info     wheels.public#info  (wheelsInfo)
    GET     /                main#index  (root)
    ...
    35 route(s)

Fixes #2317.
@bpamiri
bpamiri merged commit 992ad9d into develop Apr 27, 2026
4 checks passed
@bpamiri
bpamiri deleted the claude/fix-2317-wheels-routes branch April 27, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(cli): wheels routes dumps full API JSON instead of route table

1 participant