Skip to main content

Crate qk_cache

Crate qk_cache 

Source
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.
InputChanges
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.
JsonFields
What a json input 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.
SourceIgnore
Compiled root ignore rules used by input discovery and project watching.
TaskResult
TsConfig
A root tsconfig split as Nx hashes it: everything but compilerOptions.paths, and the paths apart. None when it cannot be read as JSON or JSONC, or a paths entry is not a list of strings.

Enums§

CacheStatus
Where a task’s result came from.
InputChange
A changed input’s meaning, independent of revision loading and task reports.

Constants§

ROOT_TSCONFIG_FILES
The root tsconfig files, in the order Nx picks one.

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.json cacheDirectory, then the default runner’s tasksRunnerOptions.default.options.cacheDirectory, relative to the workspace root, with qk’s entries in qk/v1 inside so they never mix with Nx’s; otherwise cache_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=summary kept and any restores or sandboxes left behind.
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.
keys
The key each task in graph would 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.json as 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. None when it cannot be read as a JSON object.
max_size
The size limit: NX_MAX_CACHE_SIZE, then nx.json maxCacheSize, then, as in Nx, a tenth of the disk holding the cache, or 100GB when the disk’s size cannot be read. None when the limit is 0, which means unlimited.
parse_size
Nx’s parseMaxCacheSize: a number of bytes with an optional KB, MB or GB unit, in powers of 1024.
prune
Evicts entries unused for a week and, when the cache holds more than limit bytes, 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. extra paths 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. Without outputs, Nx’s defaults: options.outputPath, and for build and prepare targets dist/<root>, <root>/dist, <root>/build and <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 --runner or NX_TASKS_RUNNER names when nx.json configures it, or else from default.
source_files
Source files visible to Nx, with runner state and root ignore rules removed.
without_resolution
A pnpm-workspace.yaml text 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 .qk at the workspace root.

Type Aliases§

Keyed
A task’s key, and the inputs it is computed from, or why it has none.