import { BaseCommand, flags } from '@adonisjs/core/ace' import type { CommandOptions } from '@adonisjs/core/types/ace' import StatusService from '#services/status' /** * What the indexer is doing (app/services/status.ts): the catalog's room, the ranges by band, the last hour's * rates, the held groups and their snapshots, the phase-2 backlogs. Reads only. */ export default class CoordinatorStatus extends BaseCommand { static commandName = 'coordinator:status' static description = 'Prints what the indexer is doing: catalog room, ranges by band, rates, held groups, backlogs' static options: CommandOptions = { startApp: true } @flags.boolean({ description: 'JSON instead of the text panel' }) declare json: boolean async run() { const status = await StatusService.collect() this.logger.log(this.json ? JSON.stringify(status, null, 2) : StatusService.render(status)) } }