atagen

roundabout

public
Star0
Watch0
e50aca5650c22545f0d99db926ab1ae120f24699
1
ssh://brewery@pls.lobotomise.me:33/atagen/roundabout.git
nix/plugin.nixNix61 lines1.7 KB
1
{
2
  lib,
3
  runCommand,
4
  writeText,
5
  roundabout,
6
}:
7
8
let
9
  hook = event: {
10
    type = "command";
11
    command = "${lib.getExe roundabout} hook ${event}";
12
  };
13
  hooks = writeText "hooks.json" (
14
    builtins.toJSON {
15
      hooks = {
16
        PreToolUse = [
17
          {
18
            matcher = "Bash";
19
            hooks = [ (hook "pre-tool-use") ];
20
          }
21
        ];
22
        PostToolUse = [ { hooks = [ (hook "post-tool-use") ]; } ];
23
        UserPromptSubmit = [ { hooks = [ (hook "prompt-submit") ]; } ];
24
        Stop = [ { hooks = [ (hook "stop") ]; } ];
25
        SubagentStop = [ { hooks = [ (hook "subagent-stop") ]; } ];
26
      };
27
    }
28
  );
29
  plugin = writeText "plugin.json" (
30
    builtins.toJSON {
31
      name = "roundabout";
32
      description = "builds wait their turn";
33
      version = roundabout.version;
34
      author.name = "atagen";
35
    }
36
  );
37
  marketplace = writeText "marketplace.json" (
38
    builtins.toJSON {
39
      name = "roundabout";
40
      owner.name = "atagen";
41
      description = "one build at a time, please";
42
      plugins = [
43
        {
44
          name = "roundabout";
45
          source = "./plugins/roundabout";
46
        }
47
      ];
48
    }
49
  );
50
in
51
# a marketplace wrapping one plugin, since claude code won't install a bare
52
# plugin dir. `claude plugin marketplace add <this>` then install roundabout@roundabout
53
runCommand "roundabout-plugin-${roundabout.version}" { } ''
54
  p=$out/plugins/roundabout
55
  mkdir -p $out/.claude-plugin $p/.claude-plugin $p/hooks $p/skills $p/bin
56
  cp ${marketplace} $out/.claude-plugin/marketplace.json
57
  cp ${plugin} $p/.claude-plugin/plugin.json
58
  cp ${hooks} $p/hooks/hooks.json
59
  cp -r ${../plugin/skills}/. $p/skills/
60
  ln -s ${lib.getExe roundabout} $p/bin/rabt
61
''