@pmelab/gtd 7.1.0 → 7.2.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.
- package/README.md +18 -2
- package/bin/gtd-loop +33 -0
- package/dist/gtd.bundle.mjs +326 -56
- package/docs/cli.md +120 -2
- package/docs/configuration.md +36 -3
- package/docs/loop.md +53 -3
- package/docs/upgrading.md +36 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -76,8 +76,8 @@ over — a `workflow:` is the whole definition). See
|
|
|
76
76
|
|
|
77
77
|
gtd is a small **pattern machine**: named states, each awaiting one actor and
|
|
78
78
|
carrying one piece of content (a script, a prompt, a message, or a squash commit
|
|
79
|
-
template), with an ordered set of change-patterns routing to the next state.
|
|
80
|
-
|
|
79
|
+
template), with an ordered set of change-patterns routing to the next state. A
|
|
80
|
+
handful of commands drive it:
|
|
81
81
|
|
|
82
82
|
- **`gtd step <actor>`** — authenticate as `<actor>` and perform the one
|
|
83
83
|
transition the pending changes match.
|
|
@@ -91,6 +91,13 @@ Four commands drive it:
|
|
|
91
91
|
- **`gtd fix`** — start a brand new process that goes straight into repairing
|
|
92
92
|
the current failing tests, then runs the shared review/squash tail (a no-op if
|
|
93
93
|
the suite is already green).
|
|
94
|
+
- **`gtd abandon`** — end the process underway without completing it: rewind to
|
|
95
|
+
the commit it started from, keeping everything it produced as uncommitted
|
|
96
|
+
changes (nothing is discarded).
|
|
97
|
+
- **`gtd restore`** — undo the last squash (or `gtd abandon`) by hard-resetting
|
|
98
|
+
HEAD back to its retained pre-squash tip, bringing the turn-by-turn history
|
|
99
|
+
back. Refuses on a dirty working tree, when there is nothing retained to
|
|
100
|
+
restore, or when HEAD has since moved past it with commits that would be lost.
|
|
94
101
|
- **`gtd visualize`** — serve an interactive diagram of the active workflow on a
|
|
95
102
|
local web server (the main flow, its sub-machines, and per-state details).
|
|
96
103
|
|
|
@@ -181,6 +188,15 @@ checkers (see
|
|
|
181
188
|
[Configuration](docs/configuration.md#modes--pluggable-steering-file-modes)).
|
|
182
189
|
Both halves are enforced by `gtd validate` and the `gtd step` gate.
|
|
183
190
|
|
|
191
|
+
Herdr integration: a workflow state can declare an optional `label:` — a
|
|
192
|
+
human-readable display name surfaced in `gtd next --json`/`gtd status`. The
|
|
193
|
+
reference `bin/gtd-loop` driver uses it to report its lifecycle
|
|
194
|
+
(working/blocked/idle) to a [Herdr](https://herdr.dev) pane sidebar via the
|
|
195
|
+
`herdr` CLI when running under Herdr (`HERDR_ENV=1`, a pane ID, and `herdr` on
|
|
196
|
+
`$PATH`); outside Herdr this is a complete no-op. See
|
|
197
|
+
[Driving the loop](docs/loop.md#herdr-integration-optional) for the full
|
|
198
|
+
reporting contract.
|
|
199
|
+
|
|
184
200
|
## Documentation
|
|
185
201
|
|
|
186
202
|
- [STATES.md](STATES.md) — the full pattern-machine specification: the model,
|
package/bin/gtd-loop
CHANGED
|
@@ -30,6 +30,29 @@ set -euo pipefail
|
|
|
30
30
|
# resume-or-fresh flag are exported as $GTD_LOOP_MEMORY / $GTD_LOOP_SESSION_ID
|
|
31
31
|
# / $GTD_LOOP_MEMORY_RESUME; the default adapter turns them into
|
|
32
32
|
# `--resume`/`--session-id`. An adapter that ignores them keeps working.
|
|
33
|
+
herdr_ok() { [ "${HERDR_ENV:-}" = 1 ] && [ -n "${HERDR_PANE_ID:-}" ] && command -v herdr >/dev/null 2>&1; }
|
|
34
|
+
|
|
35
|
+
herdr_report() { # $1=state (working|blocked|idle) $2=message
|
|
36
|
+
herdr_ok || return 0
|
|
37
|
+
herdr pane report-agent --source herdr:gtd --agent gtd \
|
|
38
|
+
--state "$1" --message "$2" "$HERDR_PANE_ID" >/dev/null 2>&1 || true
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
herdr_notify() { # $1=title $2=body
|
|
42
|
+
herdr_ok || return 0
|
|
43
|
+
herdr notification show "$1" --body "$2" --sound request >/dev/null 2>&1 || true
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
herdr_release() { # hand the pane back to Herdr's normal detection
|
|
47
|
+
herdr_ok || return 0
|
|
48
|
+
herdr pane release-agent --source herdr:gtd --agent gtd "$HERDR_PANE_ID" >/dev/null 2>&1 || true
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
trap 'code=$?; if [ "$code" -ne 0 ]; then
|
|
52
|
+
herdr_report blocked "${GTD_LAST_LABEL:-stopped}: exited $code"
|
|
53
|
+
herdr_notify "gtd stopped — $(basename "$PWD")" "${GTD_LAST_LABEL:-loop} failed (exit $code)"
|
|
54
|
+
fi' EXIT
|
|
55
|
+
|
|
33
56
|
prev_state=""
|
|
34
57
|
prev_content=""
|
|
35
58
|
# Where the last "prompt" turn's `memory` scope + session id are remembered
|
|
@@ -107,8 +130,16 @@ while true; do
|
|
|
107
130
|
content="$(jq -r .content <<<"$next_json")"
|
|
108
131
|
model="$(jq -r '.model // empty' <<<"$next_json")"
|
|
109
132
|
memory="$(jq -r '.memory // empty' <<<"$next_json")"
|
|
133
|
+
label="$(jq -r '.label // .state' <<<"$next_json")"
|
|
134
|
+
GTD_LAST_LABEL="$label"
|
|
135
|
+
|
|
136
|
+
if [[ "$kind" != "message" ]]; then
|
|
137
|
+
herdr_report working "$label"
|
|
138
|
+
fi
|
|
110
139
|
|
|
111
140
|
if [[ "$kind" == "message" ]]; then
|
|
141
|
+
herdr_report blocked "$label"
|
|
142
|
+
herdr_notify "gtd needs you — $(basename "$PWD")" "$label"
|
|
112
143
|
echo "--- Your turn ($state) ---"
|
|
113
144
|
gtd next
|
|
114
145
|
exit 0
|
|
@@ -124,6 +155,8 @@ while true; do
|
|
|
124
155
|
gtd step "$actor" >/dev/null
|
|
125
156
|
head_after="$(git rev-parse HEAD 2>/dev/null || echo none)"
|
|
126
157
|
if [[ "$head_before" == "$head_after" ]]; then
|
|
158
|
+
herdr_report idle "$label"
|
|
159
|
+
herdr_release
|
|
127
160
|
echo "--- Settled ($state: check passed, nothing to do) ---"
|
|
128
161
|
exit 0
|
|
129
162
|
fi
|