Expand description
Auto-fix orchestration for limit fix --all.
run_auto_fix_all applies every non-destructive repair that is
currently applicable — terminate ghost processes, copy .env.example →
.env, then (unless --safe) install missing dependencies — in
dependency order, re-runs the full diagnostics afterwards and returns a
FixReport summarising what changed and what still needs a human.
§Ordering
Fixes run in dependency order:
- Kill ghost processes first — this frees the blocked dev ports.
- Copy
.env.example→.envsecond — the app can then start up. - Install dependencies last — the slowest, most disruptive step.
use limitless_cli::models::{EnvironmentState, ProjectStack};
use limitless_cli::modules::auto_fix::build_auto_fixes;
let mut state = EnvironmentState::default();
state.detected_stack = ProjectStack::Node {
version: "22.9.0".into(),
package_manager: "npm".into(),
};
state.env_example_exists = true;
state.dependencies_healthy = false;
state.blocked_ports = vec![(3000, 9921)];
let fixes = build_auto_fixes(&state, ".", true);
assert_eq!(fixes.len(), 3);
assert_eq!(fixes[0].id, "kill-ghost-9921");
assert_eq!(fixes[1].id, "copy-env-from-example");
assert_eq!(fixes[2].id, "install-dependencies-npm");Structs§
- FixReport
- Result summary produced by
run_auto_fix_all.
Constants§
- REPORT_
WIDTH - Width of the final auto-fix report box, measured in terminal columns.
Functions§
- build_
auto_ fixes - Builds the ordered, non-destructive fix list for a state snapshot.
- next_
steps - Concrete manual steps (remediation hints) for every non-passing check.
- remaining_
issues - Human-readable messages for every check that is not
Pass. - render_
auto_ fix_ report - Renders the
FixReportas a colorized summary box (ANSI included). - render_
auto_ fix_ report_ plain - Same layout as
render_auto_fix_reportwith all ANSI codes stripped. - run_
auto_ fix - Runs
limit fix --all: builds a fresh snapshot, applies the auto-fix suite and prints the report. Whensafeis set, dependency installs are skipped. - run_
auto_ fix_ all - Runs the full auto-fix suite: kills ghost processes, copies the env template and installs missing dependencies, then re-runs the diagnostics and reports the outcome.
- run_
auto_ fix_ safe - Like
run_auto_fix_allbut never installs dependencies (--safemode).