Expand description
Local content-addressed cache shared by linked Git worktrees.
Modules§
- expectations
- What tasks are expected to take, shared through the remote store, so that a machine without local history, such as a CI job on a fresh clone, can order tasks and size their shares of the cores.
- profile
- Opt-in elapsed timings for cache operations, written to stderr.
- recorded
- Path sets: what a task did to the workspace when it last ran, kept so a
later run can key it by how those paths are now. See
crate::ultracachefor the target field that opts a task in. - ultracache
qk:ultracache: key a task by what it read when it last ran, rather than by its declared file inputs.- warm
- Warm state: scratch state a task runs faster with, kept between runs of
the same task and restored before it runs, but never part of a result.
A target opts in with
qk:warm:
Structs§
- Cache
- The cache for one run; its workspace snapshot is taken on first use.
- Check
- Whether a task that ran where a recording would have taken a result from the cache gave that result: it succeeded, with the same output files. Its terminal output is not compared, since timings and the like differ from run to run.
- Dependency
Glob - What one task’s
dependentTasksOutputFilesglob selects of the outputs it reads. - Execution
- One actual keyed execution, independent of reusable cache entries.
- Input
Changes - Matches one revision change set against any number of resolved tasks, sharing linked-path traversal across tasks. Env and runtime values are not evaluated; the caller supplies lockfile revisions and the workspace-file comparison.
- Json
Fields - What a
jsoninput keys of its file. - Outputs
- Pattern
- Pruned
- Resolution
- Every task’s resolved inputs, or why they could not be resolved, with the workspace files they were chosen from.
- Resolved
- A task’s inputs, before cache-key evaluation: what its declared inputs select, and what qk adds to every task on its own.
- Source
Ignore - Compiled root ignore rules used by input discovery and project watching.
- Task
Result - TsConfig
- A root tsconfig split as Nx hashes it: everything but
compilerOptions.paths, and the paths apart.Nonewhen it cannot be read as JSON or JSONC, or a paths entry is not a list of strings.
Enums§
- Cache
Status - Where a task’s result came from.
- Input
Change - A changed input’s meaning, independent of revision loading and task reports.
- Recorded
- How a task with
qk:ultracachewas keyed. - Selects
- Shadow
- What the recordings of a task keyed by its declared inputs would have done.
Constants§
- ROOT_
TSCONFIG_ FILES - The root tsconfig files, in the order Nx picks one.
- UNCOVERED
- How many uncovered paths a
Shadow::WouldMissnames.
Functions§
- cache_
directory - The cache’s default place, in the repository’s common git directory.
- cache_
location - Where the cache is: as in Nx,
NX_CACHE_DIRECTORY, then nx.jsoncacheDirectory, then the default runner’stasksRunnerOptions.default.options.cacheDirectory, relative to the workspace root, with qk’s entries inqk/v1inside so they never mix with Nx’s; otherwisecache_directory, shared by the repository’s worktrees. - clear_
worktree_ state - Removes a worktree’s state: its file digests, the outputs it records
holding, its warm directories, the logs
--output-style=summarykept and any restores or sandboxes left behind. - dependency_
globs - What each
dependentTasksOutputFilesglob ofgraph‘s tasks selects of its dependencies’ outputs as they are on disk, without running anything. - expand_
project_ path - Expands
{projectRoot}and{workspaceRoot}in a project’s path or glob. A fileset path with its tokens replaced, as Nx resolves an input’s:{projectRoot}and{projectName}anywhere, and{workspaceRoot}only at the start. Anywhere else{workspaceRoot}is glob text, as it is in Nx, and so is any other brace group. - keyed_
definition - A task’s definition as its key holds it. Warm state configuration never changes a result, and as in Nx a target’s metadata, such as the run command shown for a script, is description only.
- keys
- The key each task in
graphwould be cached under if it ran now, and what it is computed from, without running a task. Runtime inputs are executed, and the dependency outputs a task reads are taken as they are on disk. - manifest_
for_ dependents - A dependency’s
package.jsonas its dependents’ keys read it: without fields that cannot change what they read or run, and, when the lockfile records the installs, without the declarations it resolved.Nonewhen it cannot be read as a JSON object. - max_
size - The size limit:
NX_MAX_CACHE_SIZE, then nx.jsonmaxCacheSize, then, as in Nx, a tenth of the disk holding the cache, or 100GB when the disk’s size cannot be read.Nonewhen the limit is 0, which means unlimited. - parse_
size - Nx’s
parseMaxCacheSize: a number of bytes with an optionalKB,MBorGBunit, in powers of 1024. - prune
- Evicts entries unused for a week and, when the cache holds more than
limitbytes, least recently used entries until it holds at most 90% of it, and removes what no entry needs. Another prune in progress makes this one return without doing anything. - prune_
automatic - Enforces the limit after a run, reusing size accounting while the cache’s directories are unchanged. Normal publication replaces records atomically and blobs are immutable, so directory changes invalidate the memo. A full reconciliation still runs at least once an hour.
- resolve_
each - resolve_
tasks - Each task’s resolved inputs, for affected selection.
extrapaths are candidates beside the workspace’s files, so a deleted file still matches the inputs that named it. Env and runtime inputs are not evaluated. - resolved_
outputs - A task’s outputs as Nx lists them: workspace-relative paths and globs,
!for a negated one, with their tokens read as [interpolate_output] reads them; an output naming what has no value is left out. Withoutoutputs, Nx’s defaults:options.outputPath, and forbuildandpreparetargetsdist/<root>,<root>/dist,<root>/buildand<root>/public. The flag tells whether the target declared them. - selectively_
hash_ tsconfig - Whether nx.json’s runner options set
selectivelyHashTsConfig, which Nx reads from the runner--runnerorNX_TASKS_RUNNERnames when nx.json configures it, or else fromdefault. - source_
files - Source files visible to Nx, with runner state and root ignore rules removed.
- task_
configuration - What a task’s key holds of its project’s configuration beside its
definition and resolved inputs: the project’s keyed settings, such as its
root, the paths its outputs resolve to, which
{project.*}tokens can read from anywhere in the configuration, and all of the configuration when a forwarded argument holds such a token, as the task reads it then. - without_
resolution - A
pnpm-workspace.yamltext without its resolution keys. - workspace_
git - Git run at
root, which must not inherit repository selection from a Git hook: Git’srev-parse --local-env-varsare removed. - worktree_
state - Where qk keeps what belongs to one worktree: digests of its files, records
of the outputs it holds, and restores in progress. Inside Git that is the
worktree’s own git directory, so nothing appears in the working tree;
outside Git it is
.qkat the workspace root.
Type Aliases§
- Keyed
- A task’s key, and the inputs it is computed from, or why it has none.