nixos/slop-cannon: Reach Gitea as the bot user
Agents pushed with a write-enabled deploy key, added to each repo by hand, and had no way to open pull requests. The bot user's token now does both: Git uses HTTPS with a credential helper that sends it, and `tea` is wrapped to log in with it. Only Dev pushes and merges to `master`. A new `my.agents.rules` option gives every agent extra instructions. `slop-cannon`'s make a pull request the default way to finish work, unless a repository's own instructions allow more. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cb4937f230
commit
51c26fbcec
7 files changed
+98
-52
No files matched your search
@@ -1,16 +1,23 @@
|
||||
{ lib, pkgs, inputs, config, options, ... }:
|
||||
let
|
||||
inherit (lib) mkIf optional optionalAttrs;
|
||||
inherit (lib.my) mkBoolOpt';
|
||||
inherit (lib) mkIf optional optionalAttrs mapAttrs attrValues types;
|
||||
inherit (lib.my) mkOpt' mkBoolOpt';
|
||||
|
||||
cfg = config.my.agents;
|
||||
agentPkgs = inputs.llm-agents.packages.${pkgs.stdenv.hostPlatform.system};
|
||||
slopGuide = "${pkgs.slop-broker}/share/slop-broker/slop-tools.md";
|
||||
|
||||
# Claude takes a rule file each; Codex takes one `AGENTS.md`
|
||||
rules = optionalAttrs cfg.slop.enable { slop = slopGuide; }
|
||||
// mapAttrs (name: text: pkgs.writeText "${name}.md" text) cfg.rules;
|
||||
codexContext = pkgs.concatText "AGENTS.md" (attrValues rules);
|
||||
in
|
||||
{
|
||||
options.my.agents = {
|
||||
enable = mkBoolOpt' false "Whether to install and configure coding agents (Claude Code, Codex).";
|
||||
slop.enable = mkBoolOpt' false "Whether agents use the `slop` client for privileged operations.";
|
||||
rules = mkOpt' (types.attrsOf types.lines) { }
|
||||
"Instructions for every agent, by name: a Claude rule each, and appended to Codex's `AGENTS.md`.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
@@ -38,16 +45,14 @@ in
|
||||
};
|
||||
} // optionalAttrs (options.programs.codex ? mutableSettings) {
|
||||
mutableSettings = true;
|
||||
} // optionalAttrs cfg.slop.enable {
|
||||
context = slopGuide;
|
||||
} // optionalAttrs (rules != { }) {
|
||||
context = "${codexContext}";
|
||||
};
|
||||
|
||||
claude-code = {
|
||||
enable = true;
|
||||
package = agentPkgs.claude-code;
|
||||
rules = optionalAttrs cfg.slop.enable {
|
||||
slop = slopGuide;
|
||||
};
|
||||
inherit rules;
|
||||
settings = {
|
||||
model = "opus";
|
||||
theme = "auto";
|
||||
|
||||
Reference in new issue
Block a user