1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

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
This commit is contained in:
Thierry Delafontaine 2025-07-20 12:23:15 +02:00 committed by Austin Horstman
parent 1df662dde0
commit 64796151f7
2 changed files with 8 additions and 1 deletions

View file

@ -39,6 +39,7 @@ in
description = ''
Configuration written to {file}`$XDG_CONFIG_HOME/opencode/config.json`.
See <https://opencode.ai/docs/config/> 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;