@ianwremmel/dispatch 0.32.1-bootstrap.0

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 (165) hide show
  1. package/.claude-plugin/plugin.json +59 -0
  2. package/.mcp.json +8 -0
  3. package/LICENSE +21 -0
  4. package/README.md +93 -0
  5. package/agents/.gitkeep +0 -0
  6. package/agents/build-graph.md +99 -0
  7. package/agents/milestone-reviewer.md +50 -0
  8. package/agents/pr-worker.md +172 -0
  9. package/agents/ticket-worker.md +97 -0
  10. package/bin/dispatch +101 -0
  11. package/bin/dispatch-mcp +19 -0
  12. package/bin/pr-status +931 -0
  13. package/commands/.gitkeep +0 -0
  14. package/commands/orchestrate.md +6 -0
  15. package/hooks/.gitkeep +0 -0
  16. package/hooks/claim-guard.mts +98 -0
  17. package/hooks/hooks.json +15 -0
  18. package/package.json +46 -0
  19. package/skills/.gitkeep +0 -0
  20. package/skills/land/SKILL.md +238 -0
  21. package/skills/land/credentials-dedicated.md +33 -0
  22. package/skills/land/credentials-shared.md +76 -0
  23. package/skills/land/mode-solo.md +76 -0
  24. package/skills/land/mode-team.md +103 -0
  25. package/skills/land/reference.md +152 -0
  26. package/skills/land/ticket.md +94 -0
  27. package/skills/orchestrate/SKILL.md +87 -0
  28. package/skills/tracker-adapter-linear/SKILL.md +142 -0
  29. package/src/commands/CLAUDE.md +12 -0
  30. package/src/commands/claim/check.mts +88 -0
  31. package/src/commands/claim/guard.mts +95 -0
  32. package/src/commands/claim/status.mts +49 -0
  33. package/src/commands/edge/add.mts +44 -0
  34. package/src/commands/edge/rm.mts +44 -0
  35. package/src/commands/edge/set.mts +56 -0
  36. package/src/commands/greet.mts +34 -0
  37. package/src/commands/mcp/ack.mts +43 -0
  38. package/src/commands/mcp/ping.mts +61 -0
  39. package/src/commands/mcp/status.mts +89 -0
  40. package/src/commands/mcp.mts +155 -0
  41. package/src/commands/milestone/rm.mts +35 -0
  42. package/src/commands/milestone/set.mts +49 -0
  43. package/src/commands/outcome/rm.mts +36 -0
  44. package/src/commands/outcome/set.mts +86 -0
  45. package/src/commands/pr/rm.mts +33 -0
  46. package/src/commands/pr/set.mts +110 -0
  47. package/src/commands/pr/yield.mts +114 -0
  48. package/src/commands/project/rm.mts +33 -0
  49. package/src/commands/project/set.mts +50 -0
  50. package/src/commands/queue.mts +41 -0
  51. package/src/commands/refresh/done.mts +42 -0
  52. package/src/commands/refresh/status.mts +40 -0
  53. package/src/commands/refresh.mts +56 -0
  54. package/src/commands/review/record.mts +46 -0
  55. package/src/commands/review/release.mts +49 -0
  56. package/src/commands/status.mts +85 -0
  57. package/src/commands/ticket/missing.mts +31 -0
  58. package/src/commands/ticket/rm.mts +33 -0
  59. package/src/commands/ticket/set.mts +134 -0
  60. package/src/commands/worker/rm.mts +46 -0
  61. package/src/commands/worker/set.mts +63 -0
  62. package/src/lib/cli/CLAUDE.md +13 -0
  63. package/src/lib/cli/cli.mts +226 -0
  64. package/src/lib/cli/index.mts +1 -0
  65. package/src/lib/command/CLAUDE.md +26 -0
  66. package/src/lib/command/__fixtures__/bad-export/oops.mts +1 -0
  67. package/src/lib/command/__fixtures__/bad-name/mismatch.mts +19 -0
  68. package/src/lib/command/__fixtures__/commands/cli-only.mts +20 -0
  69. package/src/lib/command/__fixtures__/commands/greet.mts +39 -0
  70. package/src/lib/command/__fixtures__/commands/math/add.mts +32 -0
  71. package/src/lib/command/__fixtures__/commands/mcp-only.mts +20 -0
  72. package/src/lib/command/__fixtures__/commands/needs-token.mts +19 -0
  73. package/src/lib/command/__fixtures__/commands/store/get.mts +26 -0
  74. package/src/lib/command/__fixtures__/commands/store.mts +26 -0
  75. package/src/lib/command/abstract-command.mts +104 -0
  76. package/src/lib/command/discovery.mts +100 -0
  77. package/src/lib/command/env.mts +19 -0
  78. package/src/lib/command/index.mts +6 -0
  79. package/src/lib/command/parse.mts +64 -0
  80. package/src/lib/command/test-support.mts +81 -0
  81. package/src/lib/command/transports.mts +17 -0
  82. package/src/lib/command/types.mts +53 -0
  83. package/src/lib/db/CLAUDE.md +13 -0
  84. package/src/lib/db/database.mts +160 -0
  85. package/src/lib/db/index.mts +4 -0
  86. package/src/lib/db/schema.mts +195 -0
  87. package/src/lib/db/time.mts +24 -0
  88. package/src/lib/db/with-database.mts +56 -0
  89. package/src/lib/errors/CLAUDE.md +18 -0
  90. package/src/lib/errors/command-error.mts +13 -0
  91. package/src/lib/errors/data-error.mts +12 -0
  92. package/src/lib/errors/definition-error.mts +6 -0
  93. package/src/lib/errors/dispatch-error.mts +27 -0
  94. package/src/lib/errors/ensure.mts +22 -0
  95. package/src/lib/errors/environment-error.mts +7 -0
  96. package/src/lib/errors/index.mts +8 -0
  97. package/src/lib/errors/json-rpc-error.mts +18 -0
  98. package/src/lib/errors/usage-error.mts +7 -0
  99. package/src/lib/graph/CLAUDE.md +17 -0
  100. package/src/lib/graph/anomalies.mts +110 -0
  101. package/src/lib/graph/derive.mts +96 -0
  102. package/src/lib/graph/index.mts +26 -0
  103. package/src/lib/graph/pipeline.mts +410 -0
  104. package/src/lib/graph/queries.mts +207 -0
  105. package/src/lib/graph/rows.mts +99 -0
  106. package/src/lib/graph/types.mts +137 -0
  107. package/src/lib/liveness/CLAUDE.md +14 -0
  108. package/src/lib/liveness/index.mts +10 -0
  109. package/src/lib/liveness/liveness.mts +147 -0
  110. package/src/lib/liveness/retire.mts +63 -0
  111. package/src/lib/logger/CLAUDE.md +12 -0
  112. package/src/lib/logger/index.mts +2 -0
  113. package/src/lib/logger/logger.mts +58 -0
  114. package/src/lib/logger/stream-sink.mts +23 -0
  115. package/src/lib/mcp/CLAUDE.md +21 -0
  116. package/src/lib/mcp/channel.mts +41 -0
  117. package/src/lib/mcp/dispatch.mts +60 -0
  118. package/src/lib/mcp/drain.mts +83 -0
  119. package/src/lib/mcp/index.mts +5 -0
  120. package/src/lib/mcp/mcp.mts +267 -0
  121. package/src/lib/mcp/tools.mts +77 -0
  122. package/src/lib/model/CLAUDE.md +8 -0
  123. package/src/lib/model/index.mts +3 -0
  124. package/src/lib/model/repo-caps.mts +95 -0
  125. package/src/lib/model/status.mts +91 -0
  126. package/src/lib/model/types.mts +83 -0
  127. package/src/lib/refresh/index.mts +2 -0
  128. package/src/lib/refresh/placeholders.mts +43 -0
  129. package/src/lib/refresh/refresh-service.mts +203 -0
  130. package/src/lib/schedule/CLAUDE.md +18 -0
  131. package/src/lib/schedule/caps.mts +113 -0
  132. package/src/lib/schedule/correlate.mts +69 -0
  133. package/src/lib/schedule/index.mts +7 -0
  134. package/src/lib/schedule/scheduler.mts +355 -0
  135. package/src/lib/schedule/tick.mts +266 -0
  136. package/src/lib/stores/CLAUDE.md +24 -0
  137. package/src/lib/stores/coordination.mts +359 -0
  138. package/src/lib/stores/cursor.mts +41 -0
  139. package/src/lib/stores/edge.mts +138 -0
  140. package/src/lib/stores/fetch-request.mts +346 -0
  141. package/src/lib/stores/index.mts +19 -0
  142. package/src/lib/stores/materialize.mts +69 -0
  143. package/src/lib/stores/milestone.mts +74 -0
  144. package/src/lib/stores/notice.mts +57 -0
  145. package/src/lib/stores/policy.mts +48 -0
  146. package/src/lib/stores/pr-event.mts +94 -0
  147. package/src/lib/stores/pr.mts +167 -0
  148. package/src/lib/stores/project.mts +79 -0
  149. package/src/lib/stores/refresh.mts +197 -0
  150. package/src/lib/stores/review.mts +113 -0
  151. package/src/lib/stores/session.mts +170 -0
  152. package/src/lib/stores/ticket.mts +246 -0
  153. package/src/lib/stores/watch.mts +360 -0
  154. package/src/lib/stores/worker.mts +121 -0
  155. package/src/lib/watch/adopt.mts +151 -0
  156. package/src/lib/watch/arm.mts +48 -0
  157. package/src/lib/watch/cadence.mts +45 -0
  158. package/src/lib/watch/diff.mts +274 -0
  159. package/src/lib/watch/index.mts +11 -0
  160. package/src/lib/watch/marker.mts +24 -0
  161. package/src/lib/watch/payload.mts +56 -0
  162. package/src/lib/watch/poll.mts +87 -0
  163. package/src/lib/watch/render.mts +61 -0
  164. package/src/lib/watch/snapshot.mts +312 -0
  165. package/src/main.mts +18 -0
package/bin/dispatch ADDED
@@ -0,0 +1,101 @@
1
+ #!/usr/bin/env bash
2
+ # dispatch — entry point for the plugin's TypeScript CLI.
3
+ #
4
+ # Usage: dispatch [--log-level <level>] <command> [args...]
5
+ #
6
+ # The plugin's bin/ directory is on PATH inside Claude Code, so skills can call
7
+ # `dispatch <command>` directly. This wrapper exists to fail with a legible
8
+ # message instead of a Node syntax error when the host's Node is missing or too
9
+ # old: the CLI ships as unbuilt .mts and relies on native type stripping, which
10
+ # older Node does not enable by default. MIN_NODE_VERSION is the floor the repo
11
+ # builds and tests against, not the earliest Node that could run the CLI.
12
+ #
13
+ # Set DISPATCH_NODE to run against a specific Node binary. The wrapper's own
14
+ # records honor DISPATCH_LOG_LEVEL (the CLI's --log-level flag is parsed later,
15
+ # by the CLI itself). Set DISPATCH_ENTRY to run a different entry point through
16
+ # the same version gate — the MCP server (`src/main.mts`) is one: `bin/dispatch-mcp`
17
+ # sets it and execs this wrapper, so the server's spawn clears the same floor
18
+ # without living behind `dispatch <command>`.
19
+
20
+ set -euo pipefail
21
+
22
+ readonly MIN_NODE_VERSION='24.18.0'
23
+ readonly LOG_LEVEL="${DISPATCH_LOG_LEVEL:-info}"
24
+
25
+ here="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
26
+ readonly here
27
+ readonly cli="${DISPATCH_ENTRY:-${here}/../src/main.mts}"
28
+
29
+ # Wrapper diagnostics are logfmt on stderr, matching the CLI's own records.
30
+ # Values containing spaces must arrive already quoted by the caller.
31
+ log_debug() {
32
+ [[ "$LOG_LEVEL" == 'debug' ]] || return 0
33
+ printf 'ts=%s level=debug component=dispatch-wrapper' \
34
+ "$(date -u '+%Y-%m-%dT%H:%M:%SZ')" >&2
35
+ printf ' %s' "$@" >&2
36
+ printf '\n' >&2
37
+ }
38
+
39
+ # Failures a caller must act on are plain text, not logfmt.
40
+ die() {
41
+ printf 'error: %s\n' "$1" >&2
42
+ exit "${2:-1}"
43
+ }
44
+
45
+ # True iff $1 sorts before $2 as a dotted numeric version. Missing components
46
+ # read as 0, so 24.18 == 24.18.0.
47
+ version_lt() {
48
+ local IFS='.'
49
+ local -a lhs rhs
50
+ read -r -a lhs <<<"$1"
51
+ read -r -a rhs <<<"$2"
52
+
53
+ local i l r
54
+ for i in 0 1 2; do
55
+ l="${lhs[i]:-0}"
56
+ r="${rhs[i]:-0}"
57
+ if ((10#$l < 10#$r)); then return 0; fi
58
+ if ((10#$l > 10#$r)); then return 1; fi
59
+ done
60
+ return 1
61
+ }
62
+
63
+ node_bin="${DISPATCH_NODE:-node}"
64
+
65
+ if ! node_path="$(command -v -- "$node_bin" 2>/dev/null)"; then
66
+ die "node not found (looked for '${node_bin}'). dispatch requires Node.js >= ${MIN_NODE_VERSION}: https://nodejs.org" 127
67
+ fi
68
+
69
+ if ! node_version_raw="$("$node_path" --version 2>/dev/null)"; then
70
+ die "'${node_path}' is not runnable as node ('--version' failed)." 127
71
+ fi
72
+
73
+ # v24.18.0 -> 24.18.0; v25.0.0-nightly20260101 -> 25.0.0 + prerelease
74
+ node_version="${node_version_raw#v}"
75
+ node_prerelease='false'
76
+ if [[ "$node_version" == *-* ]]; then
77
+ node_prerelease='true'
78
+ node_version="${node_version%%-*}"
79
+ fi
80
+
81
+ if [[ ! "$node_version" =~ ^[0-9]+(\.[0-9]+)*$ ]]; then
82
+ die "could not read a version from '${node_path} --version' (got '${node_version_raw}')."
83
+ fi
84
+
85
+ # A prerelease sorts before its own release (24.18.0-rc.1 < 24.18.0), so it only
86
+ # clears the gate when its numbers are strictly above the minimum.
87
+ too_old='false'
88
+ if version_lt "$node_version" "$MIN_NODE_VERSION"; then
89
+ too_old='true'
90
+ elif [[ "$node_prerelease" == 'true' ]] && ! version_lt "$MIN_NODE_VERSION" "$node_version"; then
91
+ too_old='true'
92
+ fi
93
+
94
+ if [[ "$too_old" == 'true' ]]; then
95
+ die "node ${node_version_raw} (${node_path}) is too old. dispatch requires Node.js >= ${MIN_NODE_VERSION}, which runs TypeScript sources natively."
96
+ fi
97
+
98
+ log_debug 'msg="node resolved"' "node_bin=${node_path}" "node_version=${node_version}" "min_node_version=${MIN_NODE_VERSION}"
99
+ log_debug 'msg="exec cli"' "cli=${cli}" "argc=$#"
100
+
101
+ exec "$node_path" "$cli" "$@"
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env bash
2
+ # dispatch-mcp — the MCP server entry point declared in .mcp.json.
3
+ #
4
+ # Usage: dispatch-mcp [args...]
5
+ #
6
+ # The server lives at src/main.mts, which is not the entry `dispatch` runs by
7
+ # default, and the MCP loader's handling of a server's `env` block is not
8
+ # specified — an environment it replaces rather than merges would leave
9
+ # bin/dispatch without a PATH to find node on. So the entry is set here, and the
10
+ # exec goes through bin/dispatch to keep the Node version gate in the path.
11
+
12
+ set -euo pipefail
13
+
14
+ here="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
15
+ readonly here
16
+
17
+ export DISPATCH_ENTRY="${here}/../src/main.mts"
18
+
19
+ exec "${here}/dispatch" mcp "$@"