run

js/commands/run.ts

fino:commands/run — reusable fino run command task.

Implements script execution for both fino run <script> and the root shortcut fino <script> — the root command delegates here, so both paths behave identically. The script positional is normalized to a file:// URL (relative paths resolve against the current working directory; specifiers that already carry a scheme pass through unchanged) and handed to the orchestrator (internal:orchestrator), which runs it as a supervised app-workload child realm.

With --otlp-endpoint or the OTEL_EXPORTER_OTLP_ENDPOINT environment variable, the endpoint travels to the child as realm bootstrap metadata so the child installs its own CLI OpenTelemetry providers around the entry import. With --watch, the script instead runs in a watched Realm that re-runs whenever an imported file changes, using the same metadata path.

import runCommand from 'fino:commands/run';

// Equivalent to `fino run ./server.ts` on the command line.
await runCommand.parse(['./server.ts']);

Constants

const command

The run command task, exported as the module default.

The command requires a script positional and supports --watch plus --otlp-endpoint. Option parsing stops after the script positional, so any later tokens — flags included — are collected as args for the script rather than parsed as run options. Runtime behavior is delegated to the same private script runner the root shortcut uses, so root-level and subcommand script execution stay consistent.

import run from 'fino:commands/run';

// `fino run --watch server.ts --port 8080` — the trailing flag
// belongs to server.ts, not to the run command.
await run.parse(['--watch', 'server.ts', '--port', '8080']);