entropy-machines 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/LICENSE +93 -0
  2. package/README.md +68 -0
  3. package/agents/isolated-worker.md +128 -0
  4. package/agents/verifier.md +158 -0
  5. package/bin/dispatch +700 -0
  6. package/bin/doclint +460 -0
  7. package/bin/drain +507 -0
  8. package/bin/drain-pick.py +168 -0
  9. package/bin/drain-prompt.md +67 -0
  10. package/bin/drain-run.sh +342 -0
  11. package/bin/entropy-machines-init +285 -0
  12. package/bin/handoff +1151 -0
  13. package/bin/init +232 -0
  14. package/bin/post-fold-audit +377 -0
  15. package/bin/serve +724 -0
  16. package/bin/status +208 -0
  17. package/bin/tracker +153 -0
  18. package/docs/AGENT-QUICKSTART.md +86 -0
  19. package/docs/CONFIG.md +68 -0
  20. package/docs/NPM.md +91 -0
  21. package/docs/SERVE.md +74 -0
  22. package/docs/TRACKER-ADAPTER.md +66 -0
  23. package/doctrine/HANDOFF-PROMPT.md +63 -0
  24. package/doctrine/README.md +62 -0
  25. package/doctrine/ROLES.md +27 -0
  26. package/doctrine/WORKFLOW.md +87 -0
  27. package/hooks/commit-msg +24 -0
  28. package/hooks/post-checkout +354 -0
  29. package/hooks/pre-commit +33 -0
  30. package/lib/PRD-001-orientation.html +1180 -0
  31. package/lib/REPORT-TEMPLATE.html +413 -0
  32. package/lib/changelog-collate.mjs +328 -0
  33. package/lib/changelog-guard.sh +157 -0
  34. package/lib/changelog-new.mjs +70 -0
  35. package/lib/config.mjs +283 -0
  36. package/lib/config.py +317 -0
  37. package/lib/doc-template.html +807 -0
  38. package/lib/entropy-drain.plist.in +59 -0
  39. package/lib/entropy-drain.service.in +53 -0
  40. package/lib/entropy-drain.timer.in +36 -0
  41. package/lib/fail-first.mjs +901 -0
  42. package/lib/handoff-guard.sh +623 -0
  43. package/lib/install-hooks.sh +169 -0
  44. package/lib/notes.py +675 -0
  45. package/lib/preflight-tree.mjs +82 -0
  46. package/lib/roots.sh +212 -0
  47. package/lib/themes/daylight.css +84 -0
  48. package/lib/themes/high-contrast.css +36 -0
  49. package/lib/tracker-file +333 -0
  50. package/lib/tracker-view.py +784 -0
  51. package/package.json +38 -0
@@ -0,0 +1,59 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ Template. `bin/drain install` substitutes __RUNNER__ / __STATE__ / __LABEL__
4
+ and writes the result to ~/Library/LaunchAgents/<unattended.label>.plist.
5
+
6
+ HOURLY, not pinned to a boundary. There is generally no API for an agent
7
+ CLI's own rate-limit window, so predicting the reset means guessing, and a
8
+ job pinned to one fixed time sits idle through a window that opened hours
9
+ earlier. An hourly probe that exits in milliseconds when disarmed, dirty,
10
+ or walled costs effectively nothing and catches every window within an
11
+ hour of it opening.
12
+
13
+ The job is INERT until `bin/drain on` — StartCalendarInterval fires,
14
+ drain-run.sh reads the armed flag, and exits 2. Keeping the on/off switch
15
+ out of the plist is deliberate: arming must not require a launchctl reload.
16
+ -->
17
+ <plist version="1.0">
18
+ <dict>
19
+ <key>Label</key>
20
+ <string>__LABEL__</string>
21
+
22
+ <key>ProgramArguments</key>
23
+ <array>
24
+ <string>/bin/sh</string>
25
+ <string>__RUNNER__</string>
26
+ </array>
27
+
28
+ <!-- Top of every hour. Minute 7 rather than 0: every scheduled job on the
29
+ planet fires at :00, and nothing here needs the boundary. -->
30
+ <key>StartCalendarInterval</key>
31
+ <dict>
32
+ <key>Minute</key>
33
+ <integer>7</integer>
34
+ </dict>
35
+
36
+ <!-- launchd coalesces missed fires while asleep into ONE catch-up run, which
37
+ is what we want: waking to six queued fires would run six sessions. -->
38
+ <key>RunAtLoad</key>
39
+ <false/>
40
+
41
+ <key>StandardOutPath</key>
42
+ <string>__STATE__/launchd.out.log</string>
43
+ <key>StandardErrorPath</key>
44
+ <string>__STATE__/launchd.err.log</string>
45
+
46
+ <!-- A login shell's PATH is not inherited by launchd. Whatever agent CLI,
47
+ runtime, and VCS tools this project's suites need all have to be
48
+ reachable from here — adjust if your toolchain does not live under
49
+ Homebrew or /usr/local. -->
50
+ <key>EnvironmentVariables</key>
51
+ <dict>
52
+ <key>PATH</key>
53
+ <string>/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
54
+ </dict>
55
+
56
+ <key>ProcessType</key>
57
+ <string>Background</string>
58
+ </dict>
59
+ </plist>
@@ -0,0 +1,53 @@
1
+ # Template. `bin/drain install` substitutes __RUNNER__ / __STATE__ / __LABEL__
2
+ # — the same three placeholders, substituted by the same sed, as
3
+ # lib/entropy-drain.plist.in — and writes the result to
4
+ # ${XDG_CONFIG_HOME:-~/.config}/systemd/user/<unattended.label>.service.
5
+ #
6
+ # A USER unit, not a system one. The fire runs the operator's own agent CLI
7
+ # against the operator's own checkout and credentials; a system unit would run
8
+ # it as root out of a different HOME and read none of that. `systemctl --user`
9
+ # also needs no sudo, which keeps the installer non-privileged the way the
10
+ # launchd LaunchAgent is.
11
+ #
12
+ # THIS UNIT IS NOT SCHEDULED. It is oneshot, and the .timer beside it is what
13
+ # fires it hourly — the split is systemd's, and it is why the schedule lives in
14
+ # entropy-drain.timer.in rather than here.
15
+ #
16
+ # The job is INERT until `bin/drain on` — the timer fires, drain-run.sh reads
17
+ # the armed flag, and exits 2. Keeping the on/off switch out of the unit is
18
+ # deliberate: arming must not require a daemon-reload.
19
+
20
+ [Unit]
21
+ Description=entropy-machines unattended drain (__LABEL__)
22
+
23
+ [Service]
24
+ Type=oneshot
25
+ ExecStart=/bin/sh __RUNNER__
26
+
27
+ # NOT AN ERROR, JUST NOTHING TO DO. Unlike launchd, systemd records a non-zero
28
+ # exit as a FAILED unit and shows it in `systemctl --user status` until the next
29
+ # success — so drain-run.sh's benign guard codes would leave a permanently
30
+ # alarming unit for the ordinary case of "disarmed" or "nothing eligible". The
31
+ # codes listed here are drain-run.sh's documented guards, in its own order:
32
+ # 2 disarmed 3 wrong branch 4 tree not clean
33
+ # 5 quota wall 6 nothing eligible 7 timed out
34
+ # 1 (internal error) and 8 (touched a protected path) are deliberately NOT
35
+ # listed: those two are real failures and should surface as failures.
36
+ SuccessExitStatus=2 3 4 5 6 7
37
+
38
+ # A systemd unit does not inherit a login shell's PATH. Whatever agent CLI,
39
+ # runtime, and VCS tools this project's suites need all have to be reachable
40
+ # from here — adjust if your toolchain does not live under /usr/local or /usr.
41
+ Environment=PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
42
+
43
+ # Logged to files beside the launchd job's, rather than to the journal, so that
44
+ # `__STATE__` is the one place to look whichever scheduler installed the job.
45
+ # The journal still has a copy of everything by default; `journalctl --user -u
46
+ # __LABEL__.service` is the other way to read it. `append:` needs systemd 240+
47
+ # (Dec 2018); on anything older, delete these two lines and use journalctl.
48
+ StandardOutput=append:__STATE__/systemd.out.log
49
+ StandardError=append:__STATE__/systemd.err.log
50
+
51
+ # The launchd job runs as ProcessType=Background, which deprioritises it against
52
+ # whatever the operator is doing. Nice is the closest user-unit equivalent.
53
+ Nice=10
@@ -0,0 +1,36 @@
1
+ # Template. `bin/drain install` substitutes __LABEL__ (and passes __RUNNER__ /
2
+ # __STATE__ through the same sed, which this file simply does not use) and
3
+ # writes the result to
4
+ # ${XDG_CONFIG_HOME:-~/.config}/systemd/user/<unattended.label>.timer.
5
+ #
6
+ # HOURLY, not pinned to a boundary. There is generally no API for an agent
7
+ # CLI's own rate-limit window, so predicting the reset means guessing, and a
8
+ # job pinned to one fixed time sits idle through a window that opened hours
9
+ # earlier. An hourly probe that exits in milliseconds when disarmed, dirty, or
10
+ # walled costs effectively nothing and catches every window within an hour of
11
+ # it opening. Same reasoning, same schedule, as the launchd plist beside this.
12
+
13
+ [Unit]
14
+ Description=Hourly entropy-machines drain probe (__LABEL__)
15
+
16
+ [Timer]
17
+ # Top of every hour. Minute 7 rather than 0: every scheduled job on the planet
18
+ # fires at :00, and nothing here needs the boundary.
19
+ OnCalendar=*-*-* *:07:00
20
+
21
+ # ONE catch-up run for however many fires were missed while the machine was
22
+ # off or asleep, which is what we want: waking to six queued fires would run
23
+ # six sessions. This is the systemd spelling of launchd's own coalescing.
24
+ Persistent=true
25
+
26
+ # systemd's default is already 1 minute; stated so the schedule does not change
27
+ # if that default ever does. Nothing here needs second accuracy.
28
+ AccuracySec=1m
29
+
30
+ # Implied by the name (<x>.timer activates <x>.service), stated because the
31
+ # name is substituted rather than written, and a __LABEL__ that ever picked up
32
+ # a suffix would otherwise activate a unit nobody wrote.
33
+ Unit=__LABEL__.service
34
+
35
+ [Install]
36
+ WantedBy=timers.target