refactor/remove-pi-agent-cleanup #14

Merged
m3tam3re merged 13 commits from refactor/remove-pi-agent-cleanup into master 2026-04-19 18:16:50 +02:00
Showing only changes of commit c6d8376dda - Show all commits

View File

@@ -26,7 +26,7 @@
# #
# The shellHook creates: # The shellHook creates:
# - A `.opencode-rules/` symlink pointing to the AGENTS repository rules directory # - 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 # The instructions list contains paths relative to the project root, all prefixed
# with `.opencode-rules/`, making them portable across different project locations. # with `.opencode-rules/`, making them portable across different project locations.
@@ -46,7 +46,7 @@
# #
# Returns: # Returns:
# An attribute set containing: # 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) # - instructions: List of rule file paths (relative to project root)
# #
# Example: # Example:
@@ -82,9 +82,8 @@
], ],
frameworks ? [], frameworks ? [],
extraInstructions ? [], extraInstructions ? [],
rulesDir ? ".opencode-rules",
}: let }: let
rulesDir = ".opencode-rules";
# Build instructions list by mapping concerns, languages, frameworks to their file paths # Build instructions list by mapping concerns, languages, frameworks to their file paths
# All paths are relative to project root via the rulesDir symlink # All paths are relative to project root via the rulesDir symlink
instructions = instructions =
@@ -93,8 +92,8 @@
++ (map (f: "${rulesDir}/frameworks/${f}.md") frameworks) ++ (map (f: "${rulesDir}/frameworks/${f}.md") frameworks)
++ extraInstructions; ++ extraInstructions;
# Generate JSON configuration for Opencode # Generate JSON configuration for coding rules
opencodeConfig = { rulesConfig = {
"$schema" = "https://opencode.ai/config.json"; "$schema" = "https://opencode.ai/config.json";
inherit instructions; inherit instructions;
}; };
@@ -102,15 +101,15 @@
inherit instructions; inherit instructions;
# Shell hook to set up rules in the project # 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 = '' shellHook = ''
# Create/update symlink to AGENTS rules directory # Create/update symlink to AGENTS rules directory
ln -sfn ${agents}/rules ${rulesDir} ln -sfn ${agents}/rules ${rulesDir}
# Generate opencode.json configuration file # Generate coding-rules.json configuration file
cat > opencode.json <<'OPENCODE_EOF' cat > coding-rules.json <<'RULES_EOF'
${builtins.toJSON opencodeConfig} ${builtins.toJSON rulesConfig}
OPENCODE_EOF RULES_EOF
''; '';
}; };