@imp/core

BUILD

The BUILD workflow slot key.

Source: docs/core_api.luau:7.

Expansion.all(workflow, facet)

Select the requested workflow of every expansion child. Use as a workflow root, not a task input.

Source: docs/core_api.luau:275.

Expansion.get(key, workflow, facet)

Select one named expansion child and its workflow handle.

Source: docs/core_api.luau:272.

PACKAGE

The PACKAGE workflow slot key.

Source: docs/core_api.luau:11.

TEST

The TEST workflow slot key.

Source: docs/core_api.luau:15.

Task.outputs

Named output handles of a declared task. Artifacts and JSON-compatible values have distinct output declarations.

Source: docs/core_api.luau:299.

all_unowned(options)

Find workspace files not owned by loaded graph source declarations or test roots.

Source: docs/core_api.luau:19.

bind_tool_resolver(resolver)

Bind the callback used by the CLI to resolve registered tool names.

Source: docs/core_api.luau:23.

builtin_files(options)

Capture files from the installed rules tree, independent of the workspace.

Source: docs/core_api.luau:27.

configuration(namespace, fallback)

Read the effective configuration namespace, or the supplied fallback.

Source: docs/core_api.luau:31.

configuration_schemas()

Return the registered configuration schemas.

Source: docs/core_api.luau:35.

configure(namespace, value)

Deep-merge a declaration into a registered configuration namespace.

Source: docs/core_api.luau:39.

configured(source, overrides)

Bind rebuild-axis values to a graph handle.

Source: docs/core_api.luau:43.

define_config_schema(namespace, shape)

Register the fields that a configuration namespace accepts.

Source: docs/core_api.luau:47.

define_mode_axis(name, options)

Declare a mode axis with values, a default, and scope.

Source: docs/core_api.luau:51.

define_profile(name, values)

Declare a named profile that selects mode values.

Source: docs/core_api.luau:55.

diff_digests(before, after)

Compares two CAS tree digests and returns a list of { type, path } entries. type is added, removed, or modified. When all of a directory is added or removed, the list has one entry for the directory and no entries for its files. When a path changes between a file, a directory, and a symbolic link, the list has one modified entry for that path.

Source: docs/core_api.luau:59.

digest_from_text(files)

Create a CAS tree digest from a map of relative paths to text.

Source: docs/core_api.luau:63.

exec.action(options)

Run a sandboxed argv action with declared inputs, tools, environment, and outputs. Return declared outputs and exit status.

Source: docs/core_api.luau:278.

exec.digest(handle)

Return the CAS digest of a captured file set or artifact.

Source: docs/core_api.luau:290.

exec.file(options)

Capture { path, contents } as a content artifact. Available only in task callbacks.

Source: docs/core_api.luau:281.

exec.path(handle)

Return the sandbox-relative path of a declared artifact or path handle.

Source: docs/core_api.luau:284.

exec.paths(handle)

Return the sorted captured paths of a declared file-set input.

Source: docs/core_api.luau:287.

exec.tool_dir(handle)

Return the absolute named-cache directory for a declared acquired tool.

Source: docs/core_api.luau:293.

exec.worker_start(options)

Start or reuse a declared persistent worker.

Source: docs/core_api.luau:296.

expand(options)

Declare dynamic graph children with inputs and a create(inputs) callback. Select children through get(key, workflow, facet?) or all(workflow, facet?).

Source: docs/core_api.luau:67.

field.array(item, options)

Describe an array configuration field.

Source: docs/core_api.luau:71.

field.bool(options)

Describe a bool configuration field. Options can declare a default and whether the field is required.

Source: docs/core_api.luau:75.

field.enum(values, options)

Describe a configuration field constrained to the listed enum values.

Source: docs/core_api.luau:79.

field.int(options)

Describe a int configuration field. Options can declare a default and whether the field is required.

Source: docs/core_api.luau:83.

field.map(key, value, options)

Describe a configuration map with key and value field descriptors.

Source: docs/core_api.luau:87.

field.object(shape, options)

Describe a nested configuration object.

Source: docs/core_api.luau:91.

field.string(options)

Describe a string configuration field. Options can declare a default and whether the field is required.

Source: docs/core_api.luau:95.

files(options)

Capture workspace files from paths, or from root, include, and exclude globs. Exact paths omit missing files and reject directories and symbolic links.

Source: docs/core_api.luau:99.

generate_build(check)

Requires an active goal callback in both check and write modes; otherwise fails with core.generate_build() can only run in a goal callback. Runs the registered BUILD generators. When check is false, writes the changed BUILD.luau files. Returns { changed, checked }: the paths that changed or are stale, and the paths that the generators produced. The workflow reports the result. In check mode, the workflow fails the goal when a path is stale.

Source: docs/core_api.luau:103.

glob(options)

Declare a workspace glob without claiming source ownership.

Source: docs/core_api.luau:107.

goal(name, run, options)

Register a goal callback. Each root has a result and an immutable address with target, child_key, facet, and spec fields. tostring(address) returns spec. Return the workflow slot key. Options declare flags and target-selection policy.

Source: docs/core_api.luau:111.

goal_error(message)

Fails the goal with message as the full user-facing error, without a stack trace or engine context. If the goal catches this error and then raises a different error, Imp reports the different error with its full context.

Source: docs/core_api.luau:115.

goal_flags()

Returns the flags of the running goal. Declared flags are booleans. For test, the table also holds the case and suite strings when they are set. Fails outside a goal invocation with core.goal_flags() can only run while a goal executes.

Source: docs/core_api.luau:119.

json_decode(text)

Decode a JSON string into a Luau value.

Source: docs/core_api.luau:123.

json_encode(value)

Encode a value as formatted JSON with a final newline.

Source: docs/core_api.luau:127.

log_warn(message)

Write a warning through the Imp logging system.

Source: docs/core_api.luau:131.

memo(callback)

Return the callback unchanged. This compatibility helper does not add a memo registry.

Source: docs/core_api.luau:135.

named_cache_details(options)

Register a named-cache detail callback at declaration time.

Source: docs/core_api.luau:139.

native_tool(name)

Declare an executable that Imp finds on the host PATH.

Source: docs/core_api.luau:143.

output.artifact()

Declare a task artifact output.

Source: docs/core_api.luau:147.

output.directory(path, options)

Declare a directory output, with an optional named-cache declaration.

Source: docs/core_api.luau:151.

output.file(path)

Declare one relative file output of an action.

Source: docs/core_api.luau:155.

output.value()

Declare a JSON-compatible task value output.

Source: docs/core_api.luau:159.

package_path()

Return the workspace-relative directory that owns the current module.

Source: docs/core_api.luau:163.

path(source, options)

Select a path inside a captured artifact.

Source: docs/core_api.luau:167.

platform_info()

Return the effective { os, arch } toolchain platform.

Source: docs/core_api.luau:171.

program(options)

Declare an interactive program with explicit inputs and a describe(exec, inputs) callback. The RUN workflow starts it at the goal boundary.

Source: docs/core_api.luau:175.

read_file(address)

Read text through a canonical @workspace/... or @imp/rules/... address. Return nil when no file exists.

Source: docs/core_api.luau:179.

read_file_in_digest(digest, path)

Reads one file from a CAS tree digest.

Source: docs/core_api.luau:183.

register_build_generator(options)

Register a namespace and generate callback for BUILD generation.

Source: docs/core_api.luau:187.

register_build_rule(options)

Register the module, exported rule name, and renderer metadata of a BUILD declaration.

Source: docs/core_api.luau:191.

run_args()

Returns the CLI arguments after --, or an empty array outside a goal invocation.

Source: docs/core_api.luau:195.

run_program(options)

Runs one interactive program and returns { exit_code, stdout, stderr }. inputs holds digests or artifact tables to stage, and tools holds tool handles. The host sets the run policy: the program is impure and sandboxed, starts in the real workspace, streams its output, and receives core.run_args() after argv. A nonzero exit fails the call. Outside a goal function, the call fails with core.run_program() can only run in a goal callback, except in a core.test.with_fake_run scope.

Source: docs/core_api.luau:199.

self_tool()

Declare the running Imp executable as an action tool.

Source: docs/core_api.luau:203.

semantic.mode(axis)

Declare a graph input that reads one mode axis.

Source: docs/core_api.luau:207.

sources_field(options)

Describe a source field for registered BUILD rule rendering.

Source: docs/core_api.luau:211.

task(options)

Declare a cached graph task with inputs, outputs, run, optional display, and optional cache. The callback receives (exec, inputs).

Source: docs/core_api.luau:215.

test.cache_details(name, seeded)

Read a named-cache detail callback under a toolchain fake.

Source: docs/core_api.luau:219.

test.case(name, run)

Declare one named test callback.

Source: docs/core_api.luau:223.

test.resolve(handle)

Resolve a task or program in the active test case.

Source: docs/core_api.luau:227.

test.suite(name, cases)

Group test cases under a suite name.

Source: docs/core_api.luau:231.

test.with_fake_diff(changes, callback)

Replace digest differences within a test callback.

Source: docs/core_api.luau:235.

test.with_fake_goal_flags(flags, callback)

Set goal flags within a test callback.

Source: docs/core_api.luau:239.

test.with_fake_run(callback)

Run a callback with recorded actions and programs instead of real processes.

Source: docs/core_api.luau:243.

test.with_fake_toolchain_host(platform, callback)

Run a callback with a selected platform and recorded toolchain actions.

Source: docs/core_api.luau:247.

test.with_fake_write_workspace(callback)

Record workspace publication calls during a test callback.

Source: docs/core_api.luau:251.

test_root()

Declare tests owned by the current BUILD package. Discover package-local .test.luau files.

Source: docs/core_api.luau:255.

tool(source, options)

Declare an acquired tool from an artifact. Options contain name and bin_dirs.

Source: docs/core_api.luau:259.

tool_info(handle)

Read the tool name and relative binary search directories from a tool handle.

  • Parameter handle — A tool handle from core.tool, core.native_tool, or core.self_tool. Returns: A table with the tool name and the ordered bin_dirs list.

Source: docs/core_api.luau:265.

write_workspace(path, digest, options)

Publishes a CAS artifact to the workspace. merge = true overlays files under the destination prefix and preserves unrelated files. With merge, from must select a directory; case aliases in the source tree, existing destination symlinks, and file/directory conflicts fail before publication. The default replaces the destination. Requires an active goal callback; otherwise fails with core.write_workspace() can only run in a goal callback. A core.test.with_fake_write_workspace scope records calls outside goal callbacks without writing files.

Source: docs/core_api.luau:269.

Configuration

FieldTypeDefault
fs_jobsintnull
jobsint1
js_workersint1
log_levelenum"info"
passthrough_envarray[]

Declare these fields in the corresponding namespace of the table returned by imp.workspace.luau.