Skip to main content
zerotal

Documentation


Documentation / @zerotal/core / index / Artisan

Variable: Artisan

const Artisan: object

Defined in: facade/facades/Artisan.ts:35

Artisan facade — run any registered command from inside the application. Output is captured; nothing is written to the server terminal. Safe to call from controllers, services, scheduled tasks.

Only use for fast commands. For long-running work, use Bun.spawn or worker.ts.

See: plans/boot-modes.md §6

Type Declaration

call()

call(commandName, parameters?): Promise<ArtisanResult>

Parameters

commandName

string

parameters?

Record<string, string | boolean | number> = {}

Returns

Promise<ArtisanResult>

Throws

From Artisan.call when no CommandRunner is registered in the container (commands are only registered for env='web').

Example

const { code, output } = await Artisan.call('cache:clear');
const { code, output } = await Artisan.call('migrate', { '--fresh': true });
return Response.json({ output, success: code === 0 });