Commit 4f9f778
feat: scheduled boards — define & schedule auto-refreshing boards (#221)
* docs: spec for scheduled boards (agent-refreshed, host-agnostic)
* feat(scheduled-boards): define & schedule auto-refreshing boards
A scheduled board is a normal project/agent board that an agent re-refreshes
on a schedule. termchart owns two portable pieces — a committed YAML definition
(.termchart/boards/<id>.yaml) and a host-agnostic `termchart run <id>` primitive
that hands the board's assembled prompt to an agent which gathers data and pushes.
- core: validateBoardDef() — pure, dependency-free structural validator
- cli: `termchart board create|list|show|prompt|scaffold-workflow|delete`
`termchart run <id>` — assemble prompt + spawn agentCommand (prompt on
stdin to avoid E2BIG/shell-quoting), exit-code propagation, disabled skip
- cli: scaffold-workflow generates a GitHub Actions workflow; tz->UTC cron
conversion for the single-hour case with DST/day-cross warnings
- plugin: /termchart:schedule-board command + scheduled-boards skill
(session-cron v1, GH Actions turnkey, system cron compatible)
Build: esbuild ESM bundle now injects a createRequire banner so bundled CJS
deps (yaml) resolve node builtins instead of throwing "Dynamic require".
Version bumps: cli 0.5.0->0.6.0, plugin 0.12.0->0.13.0, marketplace ->0.13.0.
Tests: core validator (10), board CRUD, prompt assembly, run primitive,
scaffold-workflow + tz conversion, and a built-bundle regression guard.
* fix(scheduled-boards): address new-user testing — lifecycle, GH Actions, UX
Agent-tester dogfooding (4 fresh "new user" agents) surfaced real gaps; fixes:
Correctness / honesty:
- Lifecycle is now actually enforced by `termchart run`: skip past `until`;
persistent `lifecycle.runs` counter enforces `maxRuns` (written back to YAML).
assembleBoardPrompt now always includes a self-unschedule clause for bounded
OR frequent (sub-daily) boards — the job-tracker case the docs promised.
- `run` pre-flights the viewer env and exits 4 (was: swallowed the failure in
the agent subprocess and returned 0). Rejects unknown flags; one-line verbosity.
- Version: bump 0.6.0 -> 0.7.0 (0.6.0 was already published to npm without this
feature); scaffolded workflow pins `@ivanmkc/termchart@0.7.0`.
GitHub Actions turnkey + DST-correct:
- DST handled via two seasonal UTC crons + a local-time guard step (GH cron is
UTC-only) so the board fires at the intended local time year-round.
- Day-of-week is correctly shifted on UTC midnight crossing (was: emitted a
knowingly-wrong cron with a warning); restricted day-of-month is warned, not
mis-shifted.
- Workflow now installs the agent CLI, sets permissions + GH_TOKEN, timeout-
minutes, and a concurrency guard. Non-claude agentCommand omits the Anthropic
secret + claude install (gets a TODO note).
CLI/UX:
- Per-subcommand `--help`; `--enabled/--until/--max-runs` flags; create always
writes a visible lifecycle block. `board list` warns about skipped invalid
files instead of hiding them. Unknown top-level command says so (instead of
trying to open it as a file); unknown flag names the flag, not its value;
missing-required-flag names which; `board delete` shows the expected path;
YAML parse errors carry the board id.
Docs: skill + command truthed-up (lifecycle enforcement + GH-Actions maxRuns
caveat, turnkey workflow, component payload pointer, run exit-4).
Tests: core 11, cli 228 (incl. built-bundle smoke); re-verified live against the
remote viewer (pre-flight exit 4, maxRuns stop, DST workflow, full push loop).
* fix(scheduled-boards): code-review fixes — DST guard, dow wrap, hardening
Senior-review pass on the branch found 2 critical defects in the GH Actions
scaffolding plus hardening gaps; all fixed with tests.
Critical:
- DST guard was exact-minute wall-clock equality — GitHub's routinely-late cron
starts (3-20+ min) would skip nearly every run, and workflow_dispatch was
swallowed too. Now keyed on WHICH cron fired (github.event.schedule via an
EVENT_SCHEDULE env) vs the zone's CURRENT UTC offset (date +%z): delay-immune,
fail-open, dispatch always runs. Behavioral test executes the generated shell.
- shiftDow emitted an invalid descending range when a day-of-week shift wrapped
past Saturday ("4-6"+1 -> "5-0", which GitHub rejects — silent dead schedule).
Wrapping ranges now split ("5-6,0").
Hardening:
- Board ids are validated (BOARD_ID_RE, exported from core) before any path
join — no traversal via `board delete ../../x` etc.
- agentCommand containing quotes is rejected at validation (whitespace-split,
no-shell contract documented in the skill); filename stem must match id
(loadBoard error + scanBoards issue); saveBoard writes tmp+rename (atomic).
- Cron field values validated in core (charset, per-field bounds, step>0,
numeric-only) so typos fail at create, not on GitHub.
- scaffold-workflow warns when lifecycle.maxRuns can't persist on an ephemeral
runner (suggests until) and when the board's host isn't github-actions; the
bounded-lifecycle prompt clause no longer overclaims enforcement.
- --enabled accepts only true|false; removed unused cronToUtc export.
Also: regenerate package-lock for 0.7.0; spec truth-ups (drop the never-built
{prompt} placeholder, record run-enforced lifecycle, note next-run deferral);
sessionCronId write-back instruction in the schedule-board command.
Tests: core 13, cli 234, viewer 492 — all green; live run->push->viewer loop
re-verified against the remote viewer.
* docs: verify skill — runtime-verification recipe for CLI changes
* refactor(scheduled-boards): coding-standards audit — single-source, predicate narrowing
Applied the transferable /dev-coding-standards rules to the branch:
- Single source of truth: "claude -p" default was duplicated in run.ts,
board.ts (show), and scaffold-workflow.ts — now one DEFAULT_AGENT_COMMAND
exported from core alongside the BoardDef domain.
- Correct-by-construction: added isBoardDef() type predicate in core; the six
`as BoardDef` casts in board-store.ts are gone — narrowing is structural.
- Version dual-source (version.ts vs package.json is forced by the standalone
bundle): added a tripwire test asserting they match, since scaffolded
workflows pin @ivanmkc/termchart@VERSION.
- Dead code: removed unused BoardDeps.env field and the unconsumed
BOARDS_SUBDIR export.
- No function-scoped imports: hoisted a require() in scaffold-workflow.test.ts
to a top-level import.
Behavior unchanged: core 14, cli 235 green (viewer-stub files re-run serially
under load-114 box contention); built binary spot-checked.
* docs: verify skill — default-agent resolution probe recipe
* refactor(scheduled-boards): standards pass 2 — remove type lie in --max-runs parsing
Deep second audit against /dev-coding-standards. One real violation found:
create() smuggled a non-numeric --max-runs value through
`as unknown as number` so the core validator would report it — a deliberate
type-system lie (hidden from grep by its own trailing comment). Now validated
at the flag edge with an error that names --max-runs (test added, RED→GREEN).
Also: JSDoc on BOARD_ID_RE. Everything else audited clean: catch-(e as Error)
is idiomatic TS, cron "*" literals are domain vocabulary, host comparison is
compile-checked via the BoardHost literal type, planSchedule's early returns
are graceful degradation (one strategy), spawn injection is DI not patching.
* fix(scheduled-boards): run --timeout (kill hung agents) + --force dropped-field warning
Closes the two findings left open by runtime verification:
- `termchart run` now kills a hung agent: --timeout <secs> (default 600),
SIGTERM then SIGKILL after 5s, exit 124 (GNU timeout convention). A stuck
default `claude -p` previously wedged a session-cron/local-cron scheduler
indefinitely (only GH Actions had a timeout-minutes backstop). Verified
against the built bundle: `sleep 60` agent killed at 1s → exit 124.
- `board create --force` REPLACES the definition; it now warns on stderr with
the exact previously-set fields that were dropped because they weren't
re-passed (description, tz, host, agentCommand, sessionCronId,
lifecycle.until/maxRuns). This bit live testing when a --force re-create
silently lost --tz.
Docs updated (skill CLI reference, top-level usage, verify-skill gotchas).
Tests: run 18, board 24, bundle incl. real-process timeout kill — green.
---------
Co-authored-by: Ivan Cheung <ivanmkc@google.com>1 parent 5a671f5 commit 4f9f778
26 files changed
Lines changed: 2321 additions & 10 deletions
File tree
- .claude-plugin
- .claude/skills/verify
- docs/superpowers/specs
- packages
- cli
- src
- test
- core
- src
- test
- plugin
- .claude-plugin
- commands
- skills/scheduled-boards
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
Lines changed: 240 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
0 commit comments