Skip to content

Conversation

@Mishkun
Copy link

@Mishkun Mishkun commented Dec 30, 2025

Summary

Adds support for managed settings files that take precedence over all user settings, enabling enterprise administrators to enforce configurations that users cannot override easily

Closes #6358

Changes

  • Add platform-specific path for managed settings in Global.Path
  • Load and apply managed settings as final merge in config loading

Managed Settings Locations

Platform Path
macOS /Library/Application Support/opencode/managed-settings.json
Linux /etc/opencode/managed-settings.json
Windows %ProgramData%\opencode\managed-settings.json

Testing

Generated some tests. I was using env var to inject managed config location. But I think it might compromise the settings. I'm open to suggestions on how to resolve this issue.

Manual testing was performed via these commands:

Setup

sudo mkdir -p "/Library/Application Support/opencode/"
sudo bash -c 'cat > "/Library/Application Support/opencode/managed-settings.json" << EOF                  
{                                                                                                           
  "\$schema": "https://opencode.ai/config.json",
   "tools": {                                                                                                  
        "write": false,                                                                                           
        "bash": false,
        "edit": false
    }                                                                                                       
}                                                                                                         
EOF'

Check

this command should ask for permission when managed settings are present, or simply execute otherwise.

bun dev -p "write a joke to a file in current dir"

Cleanup

sudo rm "/Library/Application Support/opencode/managed-settings.json"
sudo rmdir "/Library/Application Support/opencode/"

@Mishkun Mishkun force-pushed the feature/managed-settings branch from dbd3e36 to 515af77 Compare December 30, 2025 14:18
Add support for a managed settings file that takes precedence over all
user settings, allowing enterprise administrators to enforce configurations
that users cannot override.

Managed settings locations:
- macOS: /Library/Application Support/opencode/managed-settings.json
- Linux: /etc/opencode/managed-settings.json
- Windows: %ProgramData%\opencode\managed-settings.json

New configuration priority (highest to lowest):
1. Managed Settings (admin-controlled, read-only)
2. Environment variable overrides
3. Project settings
4. User settings
5. Schema defaults

Closes sst#6358
@Mishkun Mishkun force-pushed the feature/managed-settings branch from 515af77 to a5479a8 Compare December 30, 2025 14:25
@Mishkun Mishkun marked this pull request as ready for review December 30, 2025 14:53
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.

[FEATURE]: Managed settings with admin-controlled priority for enterprise

1 participant