Commit 6eb193fbfa70
tarball2 files changed+121-0
@@ -0,0 +1,61 @@
1
+{2
+ lib,3
+ runCommand,4
+ writeText,5
+ roundabout,6
+}:7
+8
+let9
+ 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
+in51
+# a marketplace wrapping one plugin, since claude code won't install a bare52
+# plugin dir. `claude plugin marketplace add <this>` then install roundabout@roundabout53
+runCommand "roundabout-plugin-${roundabout.version}" { } ''54
+ p=$out/plugins/roundabout55
+ mkdir -p $out/.claude-plugin $p/.claude-plugin $p/hooks $p/skills $p/bin56
+ cp ${marketplace} $out/.claude-plugin/marketplace.json57
+ cp ${plugin} $p/.claude-plugin/plugin.json58
+ cp ${hooks} $p/hooks/hooks.json59
+ cp -r ${../plugin/skills}/. $p/skills/60
+ ln -s ${lib.getExe roundabout} $p/bin/rabt61
+''@@ -0,0 +1,60 @@
1
+---2
+name: roundabout3
+description: use before running any build, test suite or other heavy command (cargo, nix, make, npm, go, zig...), when a bash call gets denied for skipping roundabout, when reminded about an overdue build, or when told build artifacts are over their cap4
+---5
+6
+# roundabout7
+8
+this box is shared with other agents and a human who'd like their video to keep playing. builds queue through roundabout, whose cli is `rabt`, and only run when there's room.9
+10
+## running something11
+12
+```13
+rabt run --size m -- cargo build14
+rabt run --ram 6G --cores 8 --time 10m --disk 4G -- nix build .#thing15
+```16
+17
+wrap the build, not the whole pipeline. `cd x && rabt run -s m -- cargo test 2>&1 | tail` is fine.18
+19
+sizes out of the box20
+21
+| size | ram | disk | cores | time | for |22
+|---|---|---|---|---|---|23
+| s | 512M | 256M | 1 | 1m | check, one test, a script |24
+| m | 2G | 1G | 4 | 5m | ordinary debug builds and test runs |25
+| l | 6G | 5G | half | 15m | release builds, big workspaces, nix closures |26
+| xl | 12G | 20G | all | 45m | rebuilding the world |27
+28
+`rabt suggest -- <cmd>` has numbers from previous runs of that command in this project. use them.29
+30
+guess honestly. under-asking is how the box ooms, and an honest `--time` is what lets small jobs slip past big ones. it tells you afterwards if you were off.31
+32
+## waiting33
+34
+a queued build prints its place and why to stderr. bash moves slow commands to the background on its own, but for anything likely over a couple of minutes35
+36
+1. run the build with `run_in_background`37
+2. read the lease id from `rabt: lease N go`38
+3. also start `rabt watch N` with `run_in_background`. it exits when the build finishes or goes overdue, which wakes you up39
+40
+`--max-wait 10m` gives up queueing after that (exit 75). `--deadline 30m` kills the build if it's still going (exit 124). only use a deadline when a late result is useless.41
+42
+## overdue43
+44
+you'll get told when a build is well past its time estimate. decide, don't ignore it45
+46
+- `rabt kill N` if it's stuck or not worth it47
+- `rabt extend N 15m` if it's making progress48
+49
+`rabt status` shows everything running and queued.50
+51
+## artifacts52
+53
+build output is capped per project and in total. `rabt artifacts check` compares, `list` shows the offenders, `gc` clears idle stuff, `gc --cap` keeps going until under. `pin <path>` protects something you need.54
+55
+if told you're over, clean up before you finish. scratch dirs full of `target/` and `result` links count too.56
+57
+## don't58
+59
+- dodge the hook with `sh -c` games or aliases. it exists because of the video60
+- launch a pile of builds at once to go faster. they'll just queue