Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 8, 2025

  • Implement comprehensive macOS system defaults configuration optimized for developer productivity
  • UNIFIED IMPLEMENTATION: Single sjust-based approach eliminating code duplication
    • Remove separate Ansible task file (defaults.yml) to eliminate duplication
    • Implement unified sjust task that applies 40+ developer-focused defaults directly using defaults command
    • Update Ansible playbook to execute sjust task instead of separate implementation
    • Both Ansible (--tags macos-defaults) and standalone usage (sjust macos-defaults) execute identical logic
    • FIXED: Ensure sjust is installed before macos-defaults task execution
  • SparkJust Commands for macOS defaults management:
    • Add sjust macos-defaults command to apply all developer defaults
    • Add sjust macos-defaults-check command to show current defaults status
    • Add sjust macos-defaults-reset command to reset selected defaults (with safety prompts)
    • NEW: Add sjust macos-defaults-init-overrides command to create user customization files
  • NEW: Add reduce motion accessibility setting (com.apple.universalaccess.plist reduceMotion 1)
    • Improves focus and performance for developers
    • Integrated into unified sjust implementation
    • Documented in README.md feature list
  • NEW: YAML-based configuration system
    • Move all 40+ settings from hardcoded bash to structured YAML (config/macos/defaults.yml)
    • Add user override capability via ~/.local/spark/macos-defaults/overrides.yml
    • Install yq as dependency for YAML processing
    • Automatic merging of user overrides with default configuration
    • Enhanced readability and discoverability of all settings
  • SIMPLIFIED: Ansible dependency management
    • Remove duplicate tagging - sjust installation only tagged with sjust
    • macOS defaults task only runs when sjust is installed (using file existence check)
    • Clean separation of concerns between installation and execution
  • Add documentation for YAML-based approach and user override examples

The implementation provides a single, unified YAML-driven approach where both Ansible and standalone usage execute the same sjust task, eliminating code duplication and simplifying maintenance. Users can now easily customize settings via YAML overrides without touching the core configuration. All 40+ developer defaults are now discoverable and documented in structured YAML format.

ENHANCED USER EXPERIENCE: The new YAML-based system allows users to override any default setting through a simple configuration file (~/.local/spark/macos-defaults/overrides.yml), making customization accessible without modifying core system files.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@paolomainardi
Copy link
Member

@copilot try again to implement this PR

Copy link
Contributor Author

Copilot AI commented Aug 8, 2025

@copilot try again to implement this PR

I've successfully implemented the macOS defaults provisioning as requested in issue #99. The implementation includes:

New Ansible task file (ansible/macos/macos/defaults.yml) with 40+ developer-focused macOS defaults
Full integration into the main playbook with proper tagging (macos-defaults)
Comprehensive coverage: UI/UX, Finder, Dock, keyboard/trackpad, Safari developer settings, Terminal, and system tools
Selective execution support with --tags macos-defaults or --skip-tags macos-defaults
Updated documentation in README.md with usage examples

The implementation follows Jeff Geerling's approach using the community.general.osx_defaults module and is optimized for developer productivity. All syntax checks pass successfully.

Commit: 5f742ff

@Copilot Copilot AI changed the title [WIP] Automatic provisioning of MacOS defaults Implement automatic provisioning of macOS defaults for developers Aug 8, 2025
Copilot finished work on behalf of paolomainardi August 8, 2025 18:01
@paolomainardi paolomainardi requested a review from Copilot August 14, 2025 16:39
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements comprehensive macOS system defaults configuration optimized for developer productivity, automatically applying 40+ system-level settings to enhance the development experience. The solution integrates seamlessly with the existing Ansible provisioning system using proper tagging for selective execution.

Key Changes

  • New Ansible task file with developer-focused macOS defaults for UI/UX, Finder, Dock, keyboard, Safari, and development tools
  • Integration into the main provisioning playbook with macos-defaults tag support
  • Documentation updates showing usage examples and selective deployment options

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
ansible/macos/macos/defaults.yml New comprehensive macOS defaults configuration with 40+ developer-optimized settings
ansible/macos/macos/base.yml Integration of defaults task into main provisioning workflow
README.md Documentation updates explaining the new defaults feature and usage examples

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

value: true
tags: macos-defaults

- name: Enable Safari Developer menu
Copy link
Preview

Copilot AI Aug 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate functionality: This task (line 300-306) appears to duplicate the functionality of the previous task 'Enable Safari's developer menu' (line 292-298). Both tasks enable Safari's developer menu using different keys. Consider consolidating or clarifying the distinction between these settings.

Suggested change
- name: Enable Safari Developer menu
- name: Enable Safari's Develop menu

Copilot uses AI. Check for mistakes.


- name: Restart Activity Monitor to apply changes
command: killall "Activity Monitor"
ignore_errors: true
Copy link
Preview

Copilot AI Aug 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The restart tasks use command module with killall which may not be the most robust approach. Consider using ansible.builtin.shell with error handling or checking if the process exists before attempting to kill it. The current approach may generate unnecessary error messages in logs.

Suggested change
ignore_errors: true
ansible.builtin.shell: |
if pgrep Finder > /dev/null; then
killall Finder
fi
tags: macos-defaults
- name: Restart Dock to apply changes
ansible.builtin.shell: |
if pgrep Dock > /dev/null; then
killall Dock
fi
tags: macos-defaults
- name: Restart Safari to apply changes
ansible.builtin.shell: |
if pgrep Safari > /dev/null; then
killall Safari
fi
tags: macos-defaults
- name: Restart Activity Monitor to apply changes
ansible.builtin.shell: |
if pgrep "Activity Monitor" > /dev/null; then
killall "Activity Monitor"
fi

Copilot uses AI. Check for mistakes.

@paolomainardi
Copy link
Member

@copilot, I would like to migrate the Ansible implementation to a simple task that Ansible can reuse, making it easier for users to run without the burden of executing the Ansible provisioner.

Another thing I want to add is this com.apple.universalaccess.plist reduceMotion 1

Copy link
Contributor Author

Copilot AI commented Sep 11, 2025

@copilot, I would like to migrate the Ansible implementation to a simple task that Ansible can reuse, making it easier for users to run without the burden of executing the Ansible provisioner.

Anot...

I've successfully migrated the Ansible implementation to standalone sjust tasks that make it much easier for users to apply macOS defaults without running the full provisioner:

New SparkJust commands:

  • sjust macos-defaults - Apply all 40+ developer-optimized macOS defaults
  • sjust macos-defaults-check - Preview what would be changed (dry-run mode)
  • sjust macos-defaults-reset - Reset selected defaults with safety prompts

Added the requested setting:

  • com.apple.universalaccess.plist reduceMotion 1 for better focus and performance

The standalone tasks provide user-friendly output, progress indicators, and safety features while maintaining full compatibility with the existing Ansible integration. Users can now easily apply just the macOS defaults without the complexity of running the full provisioner.

Commit: 8725bc8

Copilot finished work on behalf of paolomainardi September 11, 2025 10:36
@paolomainardi
Copy link
Member

@copilot, I would like to migrate the Ansible implementation to a simple task that Ansible can reuse, making it easier for users to run without the burden of executing the Ansible provisioner.
Anot...

I've successfully migrated the Ansible implementation to standalone sjust tasks that make it much easier for users to apply macOS defaults without running the full provisioner:

New SparkJust commands:

  • sjust macos-defaults - Apply all 40+ developer-optimized macOS defaults
  • sjust macos-defaults-check - Preview what would be changed (dry-run mode)
  • sjust macos-defaults-reset - Reset selected defaults with safety prompts

Added the requested setting:

  • com.apple.universalaccess.plist reduceMotion 1 for better focus and performance

The standalone tasks provide user-friendly output, progress indicators, and safety features while maintaining full compatibility with the existing Ansible integration. Users can now easily apply just the macOS defaults without the complexity of running the full provisioner.

Commit: 8725bc8

Help improve Copilot by leaving feedback using the 👍 or 👎 buttons

@copilot i still see the ansible implementation, this isn't correct. I want to have the implementation just as an sjust task that ansible will execute.

Copy link
Contributor Author

Copilot AI commented Sep 11, 2025

@copilot, I would like to migrate the Ansible implementation to a simple task that Ansible can reuse, making it easier for users to run without the burden of executing the Ansible provisioner.
...

I've successfully migrated the implementation to a unified sjust approach as requested. The changes include:

Removed the separate Ansible implementation:

  • Deleted ansible/macos/macos/defaults.yml file
  • Updated Ansible playbook to call the sjust task directly

Unified sjust implementation:

  • Rewrote sjust macos-defaults to apply defaults directly using the defaults command
  • Updated sjust macos-defaults-check to show current defaults status
  • Both Ansible and standalone usage now execute the same implementation

Benefits:

  • Eliminates code duplication between Ansible and sjust
  • Easier maintenance with single source of truth
  • Users can apply defaults with sjust macos-defaults or via Ansible with --tags macos-defaults
  • Both approaches use identical logic

The reduce motion accessibility setting (com.apple.universalaccess.plist reduceMotion 1) is also included in the unified implementation.

Commit: 6f820e8

@Copilot Copilot AI changed the title Implement automatic provisioning of macOS defaults for developers Implement unified sjust-based macOS defaults for developers Sep 11, 2025
Copilot finished work on behalf of paolomainardi September 11, 2025 10:46
- Add both 'sjust' and 'macos-defaults' tags to sjust installation block
- Add both tags to macOS defaults application task
- Now running --tags "macos-defaults" includes sjust installation
- Ensures sjust is always available before executing macos-defaults

Co-authored-by: paolomainardi <[email protected]>
@Copilot Copilot AI requested a review from paolomainardi September 11, 2025 10:53
Copilot finished work on behalf of paolomainardi September 11, 2025 10:53
Copy link
Member

@paolomainardi paolomainardi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

echo "${yellow}You may need to restart applications or reboot for all changes to take effect.${normal}"
else
echo "Reset cancelled."
fi No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to try making this list of settings easier by putting them in a YAML file, so they are easily discoverable and readable, and then process the YAML file to apply the settings.

We should have a way to let the user to override this default in a file ~/.local/spark/macos-defaults/overrides.yml that will override the original settings.

We should use a language that has a native YAML processor. I do not want to write a script that is too complex and requires dependencies. Otherwise we can install https://github.com/mikefarah/yq with brew and use it from a shell script.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented YAML-based configuration system as requested. All 40+ settings are now defined in config/macos/defaults.yml for better readability and discoverability. Added user override support via ~/.local/spark/macos-defaults/overrides.yml that automatically merges with default settings. Using yq (installed via Homebrew) for YAML processing from shell scripts. Added sjust macos-defaults-init-overrides command to help users get started with customization.

Commit: 61c1468

Copy link
Contributor Author

Copilot AI commented Sep 11, 2025

@copilot

Completed the refactoring to implement both requested changes:

  1. Simplified Ansible dependency: Removed duplicate tagging and added file existence check so macOS defaults only runs when sjust is installed
  2. YAML-based configuration: Moved all settings to structured YAML with user override capability via ~/.local/spark/macos-defaults/overrides.yml

The system now provides better discoverability, easier customization, and cleaner dependency management.

Commit: 61c1468

@Copilot Copilot AI changed the title Implement unified sjust-based macOS defaults for developers Implement YAML-driven sjust-based macOS defaults with user overrides Sep 11, 2025
@Copilot Copilot AI requested a review from paolomainardi September 11, 2025 11:18
Copilot finished work on behalf of paolomainardi September 11, 2025 11:18
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