fix/pi-sync-settings #9

Merged
m3tam3re merged 14 commits from fix/pi-sync-settings into master 2026-04-17 06:08:34 +02:00
Showing only changes of commit 1f149155b4 - Show all commits

View File

@@ -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
'';
};