Reference implementation behavior
Behavior that is specific to dk0 and may differ in other implementations.
Lua interpreter
Section titled “Lua interpreter”dk0 uses a pure-OCaml version of Lua (lua-ml), which is fully type-safe,
re-entrant, and can have Lua evaluations bounded in time and
sandboxed to the project directories. The internal table of packages is stored in
an OCaml analog of the Lua C registry.
- Lua scripts should minimize the use of global variables.
dk0does not yet enforce the complete removal of global variables, but it will in the future. - bug:
string.len( "a\000bc000" )is 9 indk0(https://github.com/diskuv/dk/issues/54).
Limits and platform quirks
Section titled “Limits and platform quirks”- A few internal buffers are bounded by
dk0'sSys.max_string_lengthlimit on 32-bit systems. - The byte positions, lines and columns embedded in the AST for error reporting
are Unix byte positions. On Windows the byte positions may be inaccurate if the
JSON file is checked out by
gitwith CRLF endings; this may be fixed ifdk0moves exclusively to lines and columns. dk0only recognizes theOSFamilyproperty (as of 2025-11-09).- The
execution_abiwildcard defaults to the ABI of this build executable; it can be set bydk0(see--execution-abi).
Change detection
Section titled “Change detection”The Specification does not mandate how change detection is implemented. dk0
scans all the globs at startup, with optimizations to skip directories it can
prove will never match a glob. Invalidation can be forced with the --invalidate TARGET global option.
Assets and the library cell
Section titled “Assets and the library cell”When a unified.asset declaration runs, the origin is named after the library id
and its mirrors are set to the library cell. In dk0:
- when run with a directory-based unified script (e.g.
dk0 test unifiedscript.u/), the library cell is set to the unified-script directory while the script is evaluated - when the unified script being evaluated is the workspace script, the library cell is set to the directory containing the workspace script
- the
dk0 combinecommand can adjust the mirrors permanently during distribution.
In the workspace, asset libraries are implicitly trusted, so no
--trust-local-package ASSET_LIBRARY is needed to access the workspace assets.
Distributions
Section titled “Distributions”dk0 addplaces distribution metadata in the source tree at<workspace>/etc/dk/i/<LIBRARY>-<VERSION>.values.json.dk0 addplaces lazy value files in the value store by default, to avoid the time and space to download every binary artifact from a distribution.dk0 adddownloads an internal copy of the GitHub CLI and uses it to download from GitHub releases and validate attestations.dk0accepts only the JSON request derived from command-line name-values. There is no ability today to accept the form document directly from an HTML form (per the W3C HTML JSON Forms specification) or a JSON document.
Values
Section titled “Values”- A
values.luafile added to the valuestore is an in-memory file indk0.
Other behavior
Section titled “Other behavior”- Before submitting work,
dk0prints the resolved inner argument vector (it can pass the exact argument vector to a subshell/remote engine). dk0prompts the user and asks for confirmation before running a program.