MCPcopy
hub / github.com/prisma/prisma / main

Function main

packages/cli/src/bin.ts:95–202  ·  view source on GitHub ↗

* Main function

()

Source from the content-addressed store, hash-verified

93 * Main function
94 */
95async function main(): Promise<number> {
96 // create a new CLI with our subcommands
97
98 const cli = CLI.new(
99 {
100 bootstrap: Bootstrap.new(),
101 init: Init.new(),
102 mcp: Mcp.new(),
103 migrate: MigrateCommand.new({
104 dev: MigrateDev.new(),
105 status: MigrateStatus.new(),
106 resolve: MigrateResolve.new(),
107 reset: MigrateReset.new(),
108 deploy: MigrateDeploy.new(),
109 diff: MigrateDiff.new(),
110 }),
111 db: DbCommand.new({
112 execute: DbExecute.new(),
113 pull: DbPull.new(),
114 push: DbPush.new(),
115 // drop: DbDrop.new(),
116 seed: DbSeed.new(),
117 }),
118 postgres: PostgresCommand.new({
119 link: PostgresLink.new(),
120 }),
121 generate: Generate.new(),
122 version: Version.new(),
123 validate: Validate.new(),
124 format: Format.new(),
125 telemetry: Telemetry.new(),
126 debug: DebugInfo.new(),
127 dev: new SubCommand('@prisma/cli-dev'),
128 studio: Studio.new(),
129 platform: Platform.$.new({ status: Status.new() }),
130 },
131 ['version', 'init', 'migrate', 'db', 'generate', 'validate', 'format', 'telemetry'],
132 download,
133 )
134
135 await loadOrInitializeCommandState().catch((err) => {
136 debug(`Failed to initialize the command state: ${err}`)
137 })
138
139 const configFile = args['--config']
140 const configDir = configFile ? path.resolve(configFile, '..') : process.cwd()
141
142 const configEither = await loadConfig(configFile)
143
144 if (configEither instanceof HelpError) {
145 console.error(configEither.message)
146 return 1
147 }
148
149 const { config, diagnostics: configDiagnostics } = configEither
150
151 // Diagnostics like informational logs and warnings are logged to stderr, to not interfere with structured output
152 // in some of the commands consuming the Prisma config.

Callers 1

bin.tsFile · 0.70

Calls 15

loadConfigFunction · 0.90
linkFunction · 0.90
isRustPanicFunction · 0.90
handlePanicFunction · 0.90
redactCommandArrayFunction · 0.90
getDatabaseVersionSafeFunction · 0.90
debugFunction · 0.85
catchMethod · 0.80
errorMethod · 0.80
warnMethod · 0.80
logMethod · 0.80

Tested by

no test coverage detected