Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/cli/src/CLI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ Learn more at ${link('https://pris.ly/cli/pdp')}`
format Format your Prisma schema
version Displays Prisma version info
debug Displays Prisma debug info
platform Prisma Data Platform commands
mcp Starts an MCP server to use with AI development tools

${bold('Flags')}
Expand Down
53 changes: 53 additions & 0 deletions packages/cli/src/Status.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import type { PrismaConfigInternal } from '@prisma/config'
import type { Command } from '@prisma/internals'
import { arg, format, HelpError, isError } from '@prisma/internals'
import { bold, dim, red } from 'kleur/colors'

import { fetchStatus } from './status-page'

/** $ prisma platform status */
export class Status implements Command {
static new(): Status {
return new Status()
}

private static help = format(`
Show Prisma Data Platform service status

${bold('Usage')}

${dim('$')} prisma platform status [options]

${bold('Options')}

-h, --help Display this help message
--json Output raw JSON from the status API
`)

public help(error?: string): string | HelpError {
if (error) {
return new HelpError(`\n${bold(red(`!`))} ${error}\n${Status.help}`)
}

return Status.help
}

async parse(argv: string[], _config: PrismaConfigInternal): Promise<string | Error> {
const args = arg(argv, {
'--help': Boolean,
'-h': '--help',
'--json': Boolean,
'--telemetry-information': String,
})

if (isError(args)) {
return this.help(args.message)
}

if (args['--help']) {
return this.help()
}

return fetchStatus(args['--json'] ?? false)
}
}
Loading
Loading