fix(cli): wheels routes prints route table instead of AI-docs JSON dump - #2336
Merged
Conversation
`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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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