From 64796151f79e6f3834bfc55f07c5487708bb5b3f Mon Sep 17 00:00:00 2001 From: Thierry Delafontaine Date: Sun, 20 Jul 2025 12:23:15 +0200 Subject: [PATCH] opencode: add JSON schema reference to config.json output - Automatically include "$schema": "https://opencode.ai/config.json" in the generated opencode config.json file - Update documentation to mention the added schema property - Add corresponding "$schema" entry in test config.json file for validation purposes Closes #7506 --- modules/programs/opencode.nix | 8 +++++++- tests/modules/programs/opencode/config.json | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/programs/opencode.nix b/modules/programs/opencode.nix index 62a728653..92a28fd7e 100644 --- a/modules/programs/opencode.nix +++ b/modules/programs/opencode.nix @@ -39,6 +39,7 @@ in description = '' Configuration written to {file}`$XDG_CONFIG_HOME/opencode/config.json`. See for the documentation. + '"$schema": "https://opencode.ai/config.json"' is automatically added to the config. ''; }; rules = lib.mkOption { @@ -79,7 +80,12 @@ in xdg.configFile = { "opencode/config.json" = mkIf (cfg.settings != { }) { - source = jsonFormat.generate "config.json" cfg.settings; + source = jsonFormat.generate "config.json" ( + { + "$schema" = "https://opencode.ai/config.json"; + } + // cfg.settings + ); }; "opencode/AGENTS.md" = mkIf (cfg.rules != "") { text = cfg.rules; diff --git a/tests/modules/programs/opencode/config.json b/tests/modules/programs/opencode/config.json index 5e8f692ca..2ff8e5e1e 100644 --- a/tests/modules/programs/opencode/config.json +++ b/tests/modules/programs/opencode/config.json @@ -1,4 +1,5 @@ { + "$schema": "https://opencode.ai/config.json", "autoshare": false, "autoupdate": true, "model": "anthropic/claude-sonnet-4-20250514",