@pmelab/gtd 7.1.1 → 7.3.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 +20 -1
- package/bin/gtd-loop +33 -0
- package/dist/gtd.bundle.mjs +318 -40
- package/docs/cli.md +77 -13
- package/docs/configuration.md +32 -0
- package/docs/loop.md +40 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -94,8 +94,18 @@ handful of commands drive it:
|
|
|
94
94
|
- **`gtd abandon`** — end the process underway without completing it: rewind to
|
|
95
95
|
the commit it started from, keeping everything it produced as uncommitted
|
|
96
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.
|
|
97
101
|
- **`gtd visualize`** — serve an interactive diagram of the active workflow on a
|
|
98
|
-
local web server
|
|
102
|
+
local web server: the main flow (each sub-machine collapsed to one box, with
|
|
103
|
+
its own diagram below — pan/zoom with scroll, drag, or the corner controls),
|
|
104
|
+
per-state details including the state's own raw prompt/message/ script text,
|
|
105
|
+
and a "Current state" panel showing where the active process rests, its
|
|
106
|
+
pending changes, and which action leads where. The panel and diagram highlight
|
|
107
|
+
refresh live (~every 3s) while the page is open, so advancing the process
|
|
108
|
+
elsewhere shows up without a manual refresh.
|
|
99
109
|
|
|
100
110
|
`gtd version` (or `gtd --version`/`-v`) prints the installed version and exits;
|
|
101
111
|
`gtd help` (or `gtd --help`/`-h`) prints the command list. Both short-circuit
|
|
@@ -184,6 +194,15 @@ checkers (see
|
|
|
184
194
|
[Configuration](docs/configuration.md#modes--pluggable-steering-file-modes)).
|
|
185
195
|
Both halves are enforced by `gtd validate` and the `gtd step` gate.
|
|
186
196
|
|
|
197
|
+
Herdr integration: a workflow state can declare an optional `label:` — a
|
|
198
|
+
human-readable display name surfaced in `gtd next --json`/`gtd status`. The
|
|
199
|
+
reference `bin/gtd-loop` driver uses it to report its lifecycle
|
|
200
|
+
(working/blocked/idle) to a [Herdr](https://herdr.dev) pane sidebar via the
|
|
201
|
+
`herdr` CLI when running under Herdr (`HERDR_ENV=1`, a pane ID, and `herdr` on
|
|
202
|
+
`$PATH`); outside Herdr this is a complete no-op. See
|
|
203
|
+
[Driving the loop](docs/loop.md#herdr-integration-optional) for the full
|
|
204
|
+
reporting contract.
|
|
205
|
+
|
|
187
206
|
## Documentation
|
|
188
207
|
|
|
189
208
|
- [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
|