Expand description
Local content-addressed cache shared by linked Git worktrees.
Modules§
- profile
- Opt-in elapsed timings for cache operations, written to stderr.
- 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.
- 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.
- 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 selected file and non-file inputs, before cache-key evaluation.
- Source
Ignore - Compiled root ignore rules used by input discovery and project watching.
- Task
Result
Enums§
- Cache
Status - Where a task’s result came from.
- Input
Change - A changed input’s meaning, independent of revision loading and task reports.
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, 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 and any restores or sandboxes left behind.
- expand_
project_ path - Expands
{projectRoot}and{workspaceRoot}in a project’s path or glob. - 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. A dependency counts as having succeeded, fingerprinted by its outputs 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.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 least recently used entries until the cache holds at most
limitbytes, 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{options.name},{projectName}and the project tokens replaced; 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. - source_
files - Source files visible to Nx, with runner state and root ignore rules removed.
- without_
resolution - A
pnpm-workspace.yamltext without its resolution keys. - 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§
- Fingerprint
- A task’s output fingerprint for its dependents’ keys, or why it has none:
"<task id>: <reason>"for the task where fingerprinting first failed. - Keyed
- A task’s key, and the inputs it is computed from, or why it has none.