From c6d8376ddafbe5c18e4c38136de506549ec6bdcb Mon Sep 17 00:00:00 2001 From: Chiron Date: Wed, 15 Apr 2026 18:26:02 +0000 Subject: [PATCH] refactor: tool-agnostic naming in coding-rules.nix internals --- lib/coding-rules.nix | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/lib/coding-rules.nix b/lib/coding-rules.nix index 365b9ee..2f3812a 100644 --- a/lib/coding-rules.nix +++ b/lib/coding-rules.nix @@ -26,7 +26,7 @@ # # The shellHook creates: # - A `.opencode-rules/` symlink pointing to the AGENTS repository rules directory -# - An `opencode.json` file with a $schema reference and instructions list +# - A `coding-rules.json` file with a $schema reference and instructions list # # The instructions list contains paths relative to the project root, all prefixed # with `.opencode-rules/`, making them portable across different project locations. @@ -46,7 +46,7 @@ # # Returns: # An attribute set containing: - # - shellHook: Bash code to create symlink and opencode.json + # - shellHook: Bash code to create symlink and coding-rules.json # - instructions: List of rule file paths (relative to project root) # # Example: @@ -82,9 +82,8 @@ ], frameworks ? [], extraInstructions ? [], + rulesDir ? ".opencode-rules", }: let - rulesDir = ".opencode-rules"; - # Build instructions list by mapping concerns, languages, frameworks to their file paths # All paths are relative to project root via the rulesDir symlink instructions = @@ -93,8 +92,8 @@ ++ (map (f: "${rulesDir}/frameworks/${f}.md") frameworks) ++ extraInstructions; - # Generate JSON configuration for Opencode - opencodeConfig = { + # Generate JSON configuration for coding rules + rulesConfig = { "$schema" = "https://opencode.ai/config.json"; inherit instructions; }; @@ -102,15 +101,15 @@ inherit instructions; # Shell hook to set up rules in the project - # Creates a symlink to the AGENTS rules directory and generates opencode.json + # Creates a symlink to the AGENTS rules directory and generates coding-rules.json shellHook = '' # Create/update symlink to AGENTS rules directory ln -sfn ${agents}/rules ${rulesDir} - # Generate opencode.json configuration file - cat > opencode.json <<'OPENCODE_EOF' - ${builtins.toJSON opencodeConfig} - OPENCODE_EOF + # Generate coding-rules.json configuration file + cat > coding-rules.json <<'RULES_EOF' + ${builtins.toJSON rulesConfig} + RULES_EOF ''; };