MCPcopy
hub / github.com/adonisjs/core / ListCommand

Class ListCommand

modules/ace/commands.ts:167–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165 * This command extends the base Ace ListCommand with AdonisJS-specific functionality.
166 */
167export class ListCommand extends AceListCommand implements BaseCommand {
168 static options: CommandOptions = {}
169
170 get staysAlive() {
171 return (this.constructor as typeof BaseCommand).options.staysAlive
172 }
173
174 get startApp() {
175 return (this.constructor as typeof BaseCommand).options.startApp
176 }
177
178 constructor(
179 public app: ApplicationService,
180 public kernel: Kernel,
181 parsed: ParsedOutput,
182 ui: UIPrimitives,
183 prompt: Kernel['prompt']
184 ) {
185 super(kernel, parsed, ui, prompt)
186 }
187
188 /**
189 * Auto-select JSON output when running inside an AI agent
190 * and no explicit format flag is provided.
191 */
192 async run() {
193 if (!this.json && this.app.runningInAIAgent) {
194 this.json = true
195 }
196 return super.run()
197 }
198
199 /**
200 * Creates the codemods module to modify source files programmatically.
201 * This method provides access to AST-based code transformations.
202 */
203 async createCodemods() {
204 const { Codemods } = await import('./codemods.js')
205 return new Codemods(this.app, this.logger)
206 }
207
208 /**
209 * Terminate the app. A command should prefer calling this method
210 * over the "app.terminate", because this method only triggers
211 * app termination when the current command is in the charge
212 * of the process.
213 */
214 async terminate() {
215 if (this.kernel.getMainCommand() === this) {
216 await this.app.terminate()
217 }
218 }
219}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected