chore: update flake, agents lib, and clean up tracked dotfiles
Some checks failed
Update Nix Packages with nix-update / nix-update (push) Failing after 3m59s

- Remove .pi* and .td-root files from git index (now in .gitignore)
- Update flake.lock and flake.nix
- Add shells/coding.nix, remove shells/opencode.nix
- Update lib/agents.nix, lib/coding-rules.nix
- Update modules/home-manager/coding/agents/pi.nix
- Update tests for agents and coding-rules
- Update .gitignore
This commit is contained in:
sascha.koenig
2026-04-21 20:24:38 +02:00
parent 300ef0c28f
commit 69b736e302
21 changed files with 452 additions and 202 deletions

View File

@@ -223,7 +223,10 @@
canonical,
modelOverrides ? {},
primaryAgent ? null,
codingRules ? null,
}: let
# Import coding-rules lib for concatRulesMd when codingRules is provided
codingRulesLib = (import ./coding-rules.nix {inherit lib;});
# Find the primary agent (there should be exactly one).
primaryAgents = lib.filterAttrs (_: a: a.mode == "primary") canonical;
primaryNames = lib.attrNames primaryAgents;
@@ -306,6 +309,17 @@
"- **" + dn + "**: " + agent.description;
in
lib.mapAttrsToList mkEntry subagents;
# ── Coding rules section (optional) ────────────────────────
# When codingRules is provided, append selected rules to AGENTS.md.
# codingRules attrset: { agents, languages, concerns, frameworks }
codingRulesSection =
if codingRules != null
then let
section = codingRulesLib.mkRulesMdSection codingRules;
in
if section != "" then "\n" + section else ""
else "";
agentsMd =
"# Agent Instructions\n"
+ "\n"
@@ -320,7 +334,8 @@
if subagents == {}
then ""
else "## Available Specialists\n\n" + lib.concatStringsSep "\n" specialistEntries + "\n"
);
)
+ codingRulesSection;
agentsMdFile = pkgs.writeText "AGENTS.md" agentsMd;
systemMdFile = pkgs.writeText "SYSTEM.md" primary.systemPrompt;
@@ -346,6 +361,7 @@
agentsInput,
tool,
modelOverrides ? {},
codingRules ? null,
}: let
canonical = agentsInput.lib.loadAgents;
in
@@ -362,7 +378,7 @@
else if tool == "pi"
then
agentsLib.renderForPi {
inherit pkgs canonical modelOverrides;
inherit pkgs canonical modelOverrides codingRules;
}
else throw "lib.agents.renderForTool: unknown tool '${tool}'. Must be opencode, claude-code, or pi.";
@@ -386,9 +402,10 @@
agentsInput,
tool,
modelOverrides ? {},
codingRules ? null,
}: let
rendered = agentsLib.renderForTool {
inherit pkgs agentsInput tool modelOverrides;
inherit pkgs agentsInput tool modelOverrides codingRules;
};
in
if tool == "opencode"