Skip to content

feat(check): add dev environment checks to optimize and check#666

Closed
sebastianbreguel wants to merge 1 commit intotw93:mainfrom
sebastianbreguel:feat/dev-environment-checks
Closed

feat(check): add dev environment checks to optimize and check#666
sebastianbreguel wants to merge 1 commit intotw93:mainfrom
sebastianbreguel:feat/dev-environment-checks

Conversation

@sebastianbreguel
Copy link
Copy Markdown
Contributor

Summary

Adds a new Dev Environment section to mo optimize and mo check that surfaces developer-relevant system health information. These checks are purely informational — they show, don't fix.

Discussed in #659 as features that fit naturally inside existing commands.

New checks

Launch Agents

Scans ~/Library/LaunchAgents/*.plist for broken entries — plists whose ProgramArguments binary no longer exists on disk. Common after uninstalling apps.

Dev Tools

Verifies presence of common developer tools: git, node, python3, brew, docker, go, xcode-select. Only reports missing tools.

Version Mismatches

Detects conflicts between co-installed tool versions (only checked when both sides are installed):

Pair How detected
psql client vs server psql --version vs postgres --version
node vs nvm default node --version vs nvm version default
python3 vs pyenv python3 --version vs pyenv version

Behavior

  • Checks only run when relevant tools are installed
  • Each check respects the existing whitelist system
  • Runs in parallel in mo check, sequentially in mo optimize
  • No new dependencies — uses only built-in macOS commands

Visual preview

All healthy:

➤ Dev Environment
  ✓ Launch Agents All healthy
  ✓ Dev Tools      All present
  ✓ Versions       No conflicts

With issues:

➤ Dev Environment
  ◎ Launch Agents  2 broken
    com.old.removed.app, com.sketch.service
  ◎ Dev Tools      2 not found (docker, xcode-select)
  ◎ Versions       psql 16.2 vs server 14.1

What changed

File Change
lib/check/dev_environment.sh New module: 3 check functions + aggregator
bin/check.sh Source new module, run in parallel, display results
bin/optimize.sh Source new module, run in run_system_checks()
tests/dev_environment.bats 8 new tests with mocked system commands

Test plan

  • bash -n lib/check/dev_environment.sh — clean syntax
  • bash -n bin/check.sh && bash -n bin/optimize.sh — clean syntax
  • bats tests/dev_environment.bats — all 8 tests pass
  • mo optimize — Dev Environment section appears after System Configuration
  • bash bin/check.sh — Dev Environment section appears after Configuration
  • Checks only display when tools are installed
  • Whitelist keys: check_launch_agents, check_dev_tools, check_version_mismatches

Add a new "Dev Environment" section to mo optimize and mo check that
surfaces developer-relevant system health: broken launch agents,
missing dev tools, and version mismatches between tool pairs.
@sebastianbreguel sebastianbreguel requested a review from tw93 as a code owner April 1, 2026 14:09
@tw93 tw93 closed this in c7e71fd Apr 2, 2026
@tw93
Copy link
Copy Markdown
Owner

tw93 commented Apr 2, 2026

Hey @sebastianbreguel, great feature and solid test coverage! Applied this to main directly (commit c7e71fd) with two small security fixes before merging:

  1. Removed the nvm version check — the original implementation sourced $NVM_DIR/nvm.sh in a subshell, which executes arbitrary shell code and $NVM_DIR can be overridden by environment. Dropping it keeps the check simple and safe; node --version alone covers the most useful signal.

  2. Replaced echo -e with printf for plist-derived strings — label values read from user-owned .plist files in ~/Library/LaunchAgents/ were being passed to echo -e, which interprets backslash escape sequences. Using printf " %s\n" treats those strings as literals.

Everything else landed as-is, including the header deduplication in bin/check.sh which was a nice cleanup. Thanks for the contribution, and to get the new version just run:

mo update --nightly

@sebastianbreguel sebastianbreguel deleted the feat/dev-environment-checks branch April 2, 2026 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants