Expand description
Environment-repair engine for limit fix.
Models an actionable repair as a Fix (a description of what changes
and how), then applies it through execute_fix:
- Validate the fix is safe (source exists / PID is plausible).
- Preview the before/after state.
- Execute the underlying command or file operation.
- Capture stdout/stderr into the result logs.
- Verify the fix actually worked (re-check the file system / process).
- Roll back automatically when a reversible fix fails.
The four built-in fixes are:
copy_env_from_example—.env.example→.env(reversible).kill_ghost_process— terminate a process stuck on a port.install_fix_for_stack—npm install/pip install/cargo build.missing_config_files— create.gitignoreand.editorconfig.
All file operations are non-destructive by default: execute_fix
refuses to overwrite an existing target; pass an overwrite-acknowledging
variant (see execute_fix_with) after the user has been asked.
Structs§
- Fix
- A single, idempotent repair with enough metadata for safe auto-application.
Enums§
- FixCommand
- The concrete action a
Fixperforms, expressed against the repo root.
Constants§
- DEFAULT_
EDITORCONFIG - Default
.editorconfigwith sensible cross-editor settings. - DEFAULT_
GITIGNORE - Default
.gitignorecoverage for common stacks.
Functions§
- copy_
env_ from_ example - Builds the reversible
.env.example → .envcopy fix, if applicable. - execute_
fix - Applies
fixinsiderepo_path, refusing to overwrite existing files. - execute_
fix_ with - Applies
fix, allowing overwrite whenallow_overwriteis set. - install_
fix_ for_ stack - Builds the missing-dependencies install fix for a detected stack.
- kill_
ghost_ process - Builds the kill-ghost-process fix for a blocked port.
- missing_
config_ files - Builds [fixes] that create well-known config files when they are missing
(
.gitignoreand.editorconfig). Existing files are never offered for recreation. - preview_
fix - Renders a before/after preview of what
fixwill do inrepo_path. - process_
exists - Whether a process with
pidcurrently exists (best effort). - recommended_
fixes - Collects every fix applicable to an
EnvironmentStatesnapshot: - run_fix
- Runs
limit fix: scans for issues, builds the concrete fixes, asks for approval and applies them. - verify_
copy - Verifies
dstis a file whose bytes matchsrc. - verify_
deleted - Verifies
pathno longer exists. - verify_
process_ gone - Verifies the process with
pidis gone. - verify_
written - Verifies
pathis a file with exactlyexpectedcontent.