ui/server/src/coreExecutor
the executor seam: WHICH implementation runs a core activity for the Cockpit.
Cockpit server, v0.8. Source: ui/server/src/coreExecutor.mjs.
Classes#
ExecutionError#
Defined in: ui/server/src/coreExecutor.mjs:38
A failure of the cli execution path, never a silent empty result. code is one of CLI_NOT_FOUND,
CLI_START_FAILED, CLI_TIMEOUT, CLI_FAILED (non-success exit), CLI_BAD_OUTPUT (not the JSON document).
Extends#
Error
Constructors#
Constructor
new ExecutionError(
code,message):ExecutionError
Defined in: ui/server/src/coreExecutor.mjs:39
Parameters
code
any
message
any
Returns
Overrides
Error.constructor
Properties#
code
code:
any
Defined in: ui/server/src/coreExecutor.mjs:42
name
name:
string
Defined in: ui/server/src/coreExecutor.mjs:41
Inherited from
Error.name
Variables#
CLI_BIN_ENV#
constCLI_BIN_ENV:"CONSTRUCT_CLI_BIN"='CONSTRUCT_CLI_BIN'
Defined in: ui/server/src/coreExecutor.mjs:29
Env var naming the construct CLI to run in cli mode: a path to construct.mjs (source or the built
packages/cli/dist/construct.mjs). Absolute, or relative to the Cockpit server's working directory.
CLI_TIMEOUT_ENV#
constCLI_TIMEOUT_ENV:"CONSTRUCT_CLI_TIMEOUT_MS"='CONSTRUCT_CLI_TIMEOUT_MS'
Defined in: ui/server/src/coreExecutor.mjs:31
Env var overriding the subprocess timeout, in milliseconds.
DEFAULT_CLI_TIMEOUT_MS#
constDEFAULT_CLI_TIMEOUT_MS:120000=120_000
Defined in: ui/server/src/coreExecutor.mjs:32
Functions#
parseValidateOutput()#
parseValidateOutput(
__namedParameters):any
Defined in: ui/server/src/coreExecutor.mjs:153
Parse construct validate --format json output. Only the JSON document is read, never the text form.
Exit 0 with status "passed" or exit 1 with status "failed" are the two success shapes (exit 1 means
"violations found", not "the CLI broke"); every other combination is an error.
Parameters#
__namedParameters
code
any
signal
any
stderr
any
stdout
any
Returns#
any
resolveCliBin()#
resolveCliBin(
env?):string
Defined in: ui/server/src/coreExecutor.mjs:56
Which construct binary cli mode runs. Order: the CONSTRUCT_CLI_BIN env var; else this repo's
packages/cli/construct.mjs (the monorepo layout); else an installed @line/construct package (how the split
Cockpit repo will consume it, #540 -- found by walking up from the server's own node_modules, its
bin.construct entry).
Parameters#
env?
ProcessEnv = process.env
Returns#
string
An absolute path to a file that exists.
Throws#
CLI_NOT_FOUND, naming every place that was looked at.
resolveExecutionMode()#
resolveExecutionMode(
root):"engine"|"cli"
Defined in: ui/server/src/coreExecutor.mjs:177
The execution mode a project asked for (project.execution.mode, default 'engine').
Parameters#
root
string
Project root (holds architecture.yml).
Returns#
"engine" | "cli"
Throws#
A ConstructError naming the bad value when architecture.yml is unreadable or the value is unknown.
runValidate()#
runValidate(
root,opts?):Promise<{mode:string;ok:boolean;report:string;status:"passed"|"failed";violations:any[]; }>
Defined in: ui/server/src/coreExecutor.mjs:191
Run construct validate for a project root in the given mode.
Parameters#
root
string
Resolved project root (the directory holding architecture.yml).
opts?
bin?
string
env?
ProcessEnv = process.env
mode?
"engine" | "cli" = 'engine'
spawnImpl?
Function
timeoutMs?
number
Returns#
Promise<{ mode: string; ok: boolean; report: string; status: "passed" | "failed"; violations: any[]; }>
report is the JSON document exactly as construct validate --format json prints it (without the final
newline) -- built by the same formatReport in engine mode -- so both modes can be compared byte for byte.
Throws#
In cli mode: not found, not started, timed out, non-success exit, or output that is not the report.