modules/<module>/src/controllers/<Name>Controller.ts and a mirrored modules/<module>/tests/controllers/<Name>Controller.spec.ts, registers the controller into the module’s controllers array, and installs the @ooneex/controller dependency when missing. It supports both HTTP and WebSocket (socket) controllers and configures the route name, path, and method.
Usage
Examples
Run with no flags to be prompted for the name, controller type, and route name, path, and method:Options
| Option | Description | Default |
|---|---|---|
--name | Controller name (normalized to PascalCase, the Controller suffix is appended). | Prompted if omitted |
--module | Target module. | shared |
--is-socket | Generate a WebSocket socket controller instead of an HTTP one. | Prompted if omitted |
--override | Overwrite an existing controller file without confirmation. | false |
--route-name | Route name in dot notation (e.g. user.create). | Prompted if omitted |
--route-path | Route URL path (e.g. /users). | Prompted if omitted (defaults to /) |
--route-method | HTTP route method (HTTP controllers only). | Prompted if omitted |
AI Skill
This command ships a matchingcontroller:create skill. The skill generates the controller class, route type, and test file, then completes the implementation — keeping the controller thin, wiring validation and role-based access, and refreshing any SDK that exposes the route. Your AI agent uses it when creating a new HTTP or WebSocket controller with routing, validation, and access control.
- Claude
- Codex