Expand description
Pre-flight syntax check for shell-sourced files.
Runs bash -n / zsh -n against each deployed shell source so that
syntax errors in aliases.sh, profile.zsh etc. surface at
dodot up time instead of silently breaking the user’s next shell
startup. The interpreter’s stderr (which carries file: line N: error_message) is preserved verbatim into a sidecar file under the
handler datastore so dodot status can show it later (3c).
This module does not invoke the staged file. It only parses it.
bash -n / zsh -n are syntax-only — no commands run, no side
effects on the user’s environment.
Sidecar layout: <data_dir>/packs/<pack>/shell/.errors/<filename>.err
- Written on a fresh syntax failure.
- Removed on a fresh syntax success (so a fix clears the prior error).
- Untouched when the interpreter is missing (we have no info either way).
Init-script generation already filters non-symlinks, so the
.errors subdirectory does not end up sourced at shell startup.
Structs§
- Noop
Syntax Checker SyntaxCheckerthat always returnsSyntaxCheckResult::Ok. Used in tests to keep the validation pass deterministic and hermetic (no realbash/zshinvocations).- Shell
Validation Failure - One file that failed pre-flight syntax check.
- Shell
Validation Report - Summary of one validation pass over the deployed shell sources.
- System
Syntax Checker - Production
SyntaxCheckerthat spawns real subprocesses.
Enums§
Constants§
- ERRORS_
SUBDIR - Subdirectory (under each pack’s shell handler dir) where sidecar
.errfiles live. Public so 3c (status) can read it back.
Traits§
- Syntax
Checker - Run a syntax-only check on a shell file.
Functions§
- error_
sidecar_ path - Path of the sidecar error file for one source.
- validate_
shell_ sources - Iterate every deployed shell source, run a syntax check, and update the per-file sidecar files. Idempotent across runs: a previously failing file that’s been fixed gets its sidecar removed.