@pmelab/gtd 7.4.0 → 7.4.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.
- package/README.md +1 -1
- package/bin/gtd +22 -4
- package/docs/loop.md +9 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -196,7 +196,7 @@ Both halves are enforced by `gtd validate` and the `gtd step` gate.
|
|
|
196
196
|
|
|
197
197
|
Herdr integration: a workflow state can declare an optional `label:` — a
|
|
198
198
|
human-readable display name surfaced in `gtd next --json`/`gtd status`. The
|
|
199
|
-
reference `bin/gtd
|
|
199
|
+
reference `bin/gtd` driver uses it to report its lifecycle
|
|
200
200
|
(working/blocked/idle) to a [Herdr](https://herdr.dev) pane sidebar via the
|
|
201
201
|
`herdr` CLI when running under Herdr (`HERDR_ENV=1`, a pane ID, and `herdr` on
|
|
202
202
|
`$PATH`); outside Herdr this is a complete no-op. See
|
package/bin/gtd
CHANGED
|
@@ -67,20 +67,38 @@ fi
|
|
|
67
67
|
# `--resume`/`--session-id`. An adapter that ignores them keeps working.
|
|
68
68
|
herdr_ok() { [ "${HERDR_ENV:-}" = 1 ] && [ -n "${HERDR_PANE_ID:-}" ] && command -v herdr >/dev/null 2>&1; }
|
|
69
69
|
|
|
70
|
+
# Run a `herdr` invocation best-effort. Normally output is discarded and a
|
|
71
|
+
# failure is swallowed (`|| true`) so a missing/incompatible herdr never blocks
|
|
72
|
+
# the loop. Set GTD_HERDR_DEBUG=1 to instead surface every call and its exit
|
|
73
|
+
# code on stderr — the escape hatch that makes a silent CLI-signature mismatch
|
|
74
|
+
# (e.g. an arg herdr rejects) visible again.
|
|
75
|
+
herdr_run() {
|
|
76
|
+
if [ "${GTD_HERDR_DEBUG:-}" = 1 ]; then
|
|
77
|
+
printf 'gtd/herdr: %s\n' "$*" >&2
|
|
78
|
+
herdr "$@" >&2
|
|
79
|
+
printf 'gtd/herdr: exit=%s\n' "$?" >&2
|
|
80
|
+
else
|
|
81
|
+
herdr "$@" >/dev/null 2>&1 || true
|
|
82
|
+
fi
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
# NOTE: herdr requires the positional <PANE_ID> BEFORE the options for
|
|
86
|
+
# `pane` subcommands — passing it last makes herdr reject the first option as
|
|
87
|
+
# `unknown option` (exit 2). Keep the pane id first here.
|
|
70
88
|
herdr_report() { # $1=state (working|blocked|idle) $2=message
|
|
71
89
|
herdr_ok || return 0
|
|
72
|
-
|
|
73
|
-
--state "$1" --message "$2"
|
|
90
|
+
herdr_run pane report-agent "$HERDR_PANE_ID" \
|
|
91
|
+
--source herdr:gtd --agent gtd --state "$1" --message "$2"
|
|
74
92
|
}
|
|
75
93
|
|
|
76
94
|
herdr_notify() { # $1=title $2=body
|
|
77
95
|
herdr_ok || return 0
|
|
78
|
-
|
|
96
|
+
herdr_run notification show "$1" --body "$2" --sound request
|
|
79
97
|
}
|
|
80
98
|
|
|
81
99
|
herdr_release() { # hand the pane back to Herdr's normal detection
|
|
82
100
|
herdr_ok || return 0
|
|
83
|
-
|
|
101
|
+
herdr_run pane release-agent "$HERDR_PANE_ID" --source herdr:gtd --agent gtd
|
|
84
102
|
}
|
|
85
103
|
|
|
86
104
|
trap 'code=$?; if [ "$code" -ne 0 ]; then
|
package/docs/loop.md
CHANGED
|
@@ -183,18 +183,21 @@ GTD_LOOP_AGENT_CMD='my-agent-cli --prompt "$GTD_LOOP_PROMPT"' gtd
|
|
|
183
183
|
|
|
184
184
|
## Herdr integration (optional)
|
|
185
185
|
|
|
186
|
-
`bin/gtd
|
|
186
|
+
`bin/gtd` optionally reports its lifecycle to [Herdr](https://herdr.dev) (a
|
|
187
187
|
terminal multiplexer for coding agents) via a `herdr` CLI binary, entirely at
|
|
188
188
|
the driver's edge — gtd core never talks to Herdr. Every call is best-effort
|
|
189
189
|
(guarded, output discarded, `|| true`), so a missing/failing `herdr` binary
|
|
190
|
-
never blocks, slows, or fails the loop.
|
|
190
|
+
never blocks, slows, or fails the loop. Because that guard also hides a herdr
|
|
191
|
+
CLI-signature mismatch, set `GTD_HERDR_DEBUG=1` to surface every `herdr` call
|
|
192
|
+
and its exit code on stderr instead.
|
|
191
193
|
|
|
192
194
|
The reporting is a no-op unless all three guard conditions hold: `HERDR_ENV=1`,
|
|
193
|
-
a non-empty `$HERDR_PANE_ID`, and `herdr` on `$PATH`. When they do, `gtd
|
|
194
|
-
|
|
195
|
+
a non-empty `$HERDR_PANE_ID`, and `herdr` on `$PATH`. When they do, `gtd` makes
|
|
196
|
+
three kinds of calls (note the positional `<PANE_ID>` comes BEFORE the options —
|
|
197
|
+
herdr's `pane` subcommands reject a trailing pane id):
|
|
195
198
|
|
|
196
|
-
- `herdr pane report-agent --source herdr:gtd --agent gtd --state <state> --message <label
|
|
197
|
-
- `herdr pane release-agent --source herdr:gtd --agent gtd
|
|
199
|
+
- `herdr pane report-agent "$HERDR_PANE_ID" --source herdr:gtd --agent gtd --state <state> --message <label>`
|
|
200
|
+
- `herdr pane release-agent "$HERDR_PANE_ID" --source herdr:gtd --agent gtd`
|
|
198
201
|
- `herdr notification show <title> --body <label> --sound request`
|
|
199
202
|
|
|
200
203
|
mapped onto the loop's states like this:
|