atxtechbro / atxtechbro/dotfiles

macOS setup.sh prints entire function definitions during MCP configuration

Open
#405 0 comments 0 reactions 0 assignees View on GitHub
bug macOS mcp setup
Dominant language
Shell
Stars
27
Forks
2
PR merge metrics
No merged PRs in 30d

Description

## Problem
The `setup.sh` script prints approximately 45 lines of function definitions to the terminal during the MCP configuration step on macOS. This breaks the clean, color-coded output flow and clutters the terminal with code that should be silently sourced.

## Current Behavior
- Script runs normally until "Creating symlinks for config files..."
- Then prints the entire `filter_mcp_config()` function definition (~20 lines)
- Followed by the entire `detect_environment()` function definition (~25 lines)
- This disrupts the expected clean, formatted output of the setup script

## Expected Behavior (Spilled Coffee Principle)
Following our "spilled coffee principle" - the setup should run cleanly with only intentional, formatted output:
- Function definitions should be sourced silently
- Only meaningful status messages should appear
- Maintain consistent color-coded formatting
- No code should be printed to terminal during normal operation

## Root Cause Analysis
The issue occurs during this section of setup.sh:
```bash
if [[ -f "$DOT_DEN/utils/mcp-environment.sh" ]]; then
source "$DOT_DEN/utils/mcp-environment.sh" # <- Function definitions being printed here
CURRENT_ENV=$(detect_environment)
filter_mcp_config ~/.aws/amazonq/mcp.json "$CURRENT_ENV"
filter_mcp_config ~/.config/Claude/claude_desktop_config.json "$CURRENT_ENV"
fi
```

## Solution Requirements
- [ ] Ensure `utils/mcp-environment.sh` sources silently
- [ ] Redirect any unwanted output during sourcing
- [ ] Maintain function availability after sourcing
- [ ] Test on both macOS and Linux
- [ ] Preserve existing MCP configuration functionality

## Technical Details
- Affects macOS specifically (may be bash version or environment related)
- Functions are still working correctly, just printing definitions
- May need to redirect stderr/stdout during sourcing
- Could be related to bash settings or script execution context

This aligns with our dotfiles philosophy of clean, automated setup without unexpected output.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the MCP configuration block in setup.sh and inspect utils/mcp-environment.sh, then reproduce the setup while capturing output on macOS and Linux. Trace why sourcing emits function definitions and verify that the functions remain available and MCP filtering still works. Done means normal setup prints only intentional formatted status messages without changing existing configuration behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.