opencode: support ordered settings entries
Use the shared DAG-aware JSON generator for programs.opencode.settings so order-sensitive permission rules can be expressed with lib.hm.dag entries. Add a focused NMT test for last-match-wins permission output and news for existing opencode users.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
{
|
||||
opencode-settings = ./settings.nix;
|
||||
opencode-settings-ordered-permissions = ./settings-ordered-permissions.nix;
|
||||
opencode-empty-settings = ./empty-settings.nix;
|
||||
opencode-context-inline = ./rules-inline.nix;
|
||||
opencode-context-path = ./rules-path.nix;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"$schema": "https://opencode.ai/config.json",
|
||||
"permission": {
|
||||
"bash": {
|
||||
"zz *": "ask",
|
||||
"aa *": "allow"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
programs.opencode = {
|
||||
enable = true;
|
||||
settings = {
|
||||
permission.bash = {
|
||||
"aa *" = lib.hm.dag.entryAfter [ "zz *" ] "allow";
|
||||
"zz *" = "ask";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/opencode/opencode.json
|
||||
assertFileContent home-files/.config/opencode/opencode.json \
|
||||
${./settings-ordered-permissions.json}
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user