Skip to content

📚 ZSHAND Library¶

Internal library modules in lib/ that support the build system. These define the canonical framework directory list, manage per-directory dependency manifests, and provide dependency-aware rebuild checks.


lib/rebuild/¶

The rebuild library provides four modules used by the build system and CLI tools like zr-deps.

dirs.zsh¶

Defines _ZSHAND_FRAMEWORK_DIRS, the canonical ordered list of framework directories: startup, shared_functions, core, functions, widgets, hooks, private_functions. Also provides _zshand_get_framework_dirs [base] to resolve full paths. Every build and loading operation uses this list to ensure consistent ordering.

manifest.zsh¶

Reads and writes .zshand-deps files — plain text manifests listing which other framework directories a given directory depends on (one name per line). Provides _zshand_read_manifest_deps dir (populates reply array) and _zshand_write_manifest_deps dir dep1 dep2 ....

update_manifest_dependencies.zsh¶

Scans .zsh files in framework directories for references to other directories (patterns like $ZSHAND/<dir>/) and automatically updates .zshand-deps manifests. Called by the zr-deps CLI tool. Accepts an optional directory name to update only one directory.

check_with_deps.zsh¶

Provides _zshand_check_needs_rebuild_directory_with_deps dir [base_dir] — returns 0 (needs rebuild) if the directory itself is stale or if any of its declared dependencies have changed. This enables transitive rebuild detection: changing core/ triggers rebuilds of functions/, widgets/, and any other directory that declares core as a dependency.

Dependency Manifests¶

Each framework directory may contain an .zshand-deps file. For example, widgets/.zshand-deps might contain:

shared_functions
core

This tells the build system that if shared_functions/ or core/ changes, the widgets/ bundle should also be rebuilt.

Load Order¶

The canonical load order defined in dirs.zsh is:

  1. startup
  2. shared_functions
  3. core
  4. functions
  5. widgets
  6. hooks
  7. private_functions

See Also¶

  • BUILD.md — Full build system documentation
  • bin/zr-deps — CLI tool for updating dependency manifests
  • bin/zr — Standard rebuild command