Repository navigation
feat(mecatui): scheduled tasks Phase 3a — /schedule slash command + overlay - #239
Conversation
…verlay (#234) Add the mecatui interactive schedule-management surface, a peer of the existing /agents, /team, and /worktrees overlays. The server-side wire (Phase 2a ScheduleService gRPC + Phase 2b settings.yaml/CLI) already shipped; this lands the client + TUI overlay. - contracts/proto: ServerCapabilities.scheduling (bool, additive) gates the overlay; independent of the --scheduler tick loop (the store-backed RPCs work without auto-firing). Regenerated via task generate. - internal/adapter/server: capabilities() sets Scheduling from scheduleStore() != nil (the RPCs are functional as long as a ScheduleStore is reachable). - cmd/mecatui/client: new schedule.go — proto-free mirror of the schedule wire surface (Schedule/ScheduleSpec/ScheduleState/ScheduleFire + Msg types + ScheduleLister interface + 8 tea.Cmd constructors); Client gains a scheduleSvc stub; Capabilities gains Scheduling. CreateSchedule/GetFire exported for the planned Phase 3b in-overlay Create form (documented as uncalled in v1). - cmd/mecatui/ui: new schedule.go — the overlay (scheduleView enum: none/panel/confirm/inspect; scheduleState; open/close/onScheduleKey/ updateScheduleMsg/renderScheduleOverlay + helpers). Panel lists schedules (name, trigger summary, enabled, next/last fire, fire count) with type-to-filter + cursor nav. Action keys: enter=inspect (loads fires via ListFires), p=pause, r=resume, f=fire-now, d=delete (confirm sub-view). All server-derived fields sanitized via sanitizeTerminal at the render boundary (triggerSummary included). /schedule builtin registered after /worktrees, gated on caps.Scheduling && deps.Sched wired. updateInventoryMsgs widened to (Model, Cmd, bool) so the action-success re-list cmd propagates. - Tests: client/schedule_test.go (mappers + RPC wrappers + Cmd constructors, success + error arms); ui/schedule_test.go (open/nil-guard/filter/pause- resume-fire-delete/inspect-loads-fires/confirm-delete-backout/error-render/ mid-run-guard/esc-close/trigger-summary); builtins_test.go caps-filter + by-name cases; help goldens refreshed. - Docs: PRODUCTION-READINESS.md flips Phase 3a to shipped (NL→cron deferred to v2); tui.md adds the /schedule section + palette entry; usage.md flips the planned line to shipped. llms.txt regenerated. In-scope scope note: the issue lists Create as a Phase 3a action; this lands list/inspect/pause/resume/fire-now/delete and defers the in-overlay Create FORM to Phase 3b (raw cron/one-shot entry via the CLI/settings.yaml already works; the composer form is the follow-up). FireNow and Delete are useful peer actions added beyond the literal pause/resume list. Co-Authored-By: Juan Osorio Ortiz <[email protected]>
… the filter Review follow-ups on #239: - The /schedule panel focused its filter input on open while also binding bare-rune action keys (p/r/f/d), so those letters could never be typed into the filter and instead fired pause/resume/fire-now/delete — f/p/r with no confirmation. Switch to a /-to-filter model: the panel opens in action mode; `/` focuses the filter, and esc/enter exit filter mode keeping the narrowed value. Render the filter line so the mode is visible, and update the footer + docs/tui.md. Add TestScheduleFilterModeDoesNotFireActions, which drives keys through onScheduleKey in both modes — the collision the old tests (SetValue-driven filter vs router-driven actions) never exercised together. - Replace the hand-rolled itoa with strconv.Itoa (the "avoids pulling in fmt" rationale was wrong: strconv.Itoa does not import fmt). - Rename misfireFromString -> misfireStringFromProto (it maps enum->string, not the reverse; its sibling misfireToProtoFromString is already named for its direction). - Correct the stale scheduleState "never mutated in place" comment (the ScheduleMsg Get-refresh updates a single element in place; filtered is always rebuilt). Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
@JAORMX did a review pass and pushed a follow-up commit (3b20266) with fixes — summary of what and why: 🔴 The one that mattered:
|
|
@jhrozek The Agreed on the Nothing else outstanding from my side — this is ready to merge. |
… the filter Review follow-ups on #239: - The /schedule panel focused its filter input on open while also binding bare-rune action keys (p/r/f/d), so those letters could never be typed into the filter and instead fired pause/resume/fire-now/delete — f/p/r with no confirmation. Switch to a /-to-filter model: the panel opens in action mode; `/` focuses the filter, and esc/enter exit filter mode keeping the narrowed value. Render the filter line so the mode is visible, and update the footer + docs/tui.md. Add TestScheduleFilterModeDoesNotFireActions, which drives keys through onScheduleKey in both modes — the collision the old tests (SetValue-driven filter vs router-driven actions) never exercised together. - Replace the hand-rolled itoa with strconv.Itoa (the "avoids pulling in fmt" rationale was wrong: strconv.Itoa does not import fmt). - Rename misfireFromString -> misfireStringFromProto (it maps enum->string, not the reverse; its sibling misfireToProtoFromString is already named for its direction). - Correct the stale scheduleState "never mutated in place" comment (the ScheduleMsg Get-refresh updates a single element in place; filtered is always rebuilt). Co-Authored-By: Claude Opus 4.8 <[email protected]>
Summary
Implements issue #234 — Scheduled tasks Phase 3a: the mecatui
/scheduleslash command + overlay. The server-side wire surface (Phase 2aScheduleServicegRPC + Phase 2bsettings.yaml/CLI) already shipped; this lands the client + TUI overlay.Closes #234.
What landed
ServerCapabilities.scheduling(bool, additive, field 15) gates the overlay. Independent of the--schedulertick loop — the store-backed RPCs work without auto-firing. Regenerated viatask generate.capabilities()setsSchedulingfromscheduleStore() != nil(the RPCs are functional as long as aScheduleStoreis reachable; the tick loop is a separate operator concern).cmd/mecatui/client/schedule.go, NEW): proto-free mirror of the schedule wire surface — plain structs (Schedule/ScheduleSpec/ScheduleState/ScheduleFire/ScheduleTrigger/ScheduleSelector), msg types (SchedulesMsg/ScheduleMsg/ScheduleFiresMsg/ScheduleActionMsg), RPC wrappers on*Client(List/Get/Create/Delete/FireNow/Pause/Resume/ListFires/GetFire), nil-safe mappers, theScheduleListerinterface, and 8tea.Cmdconstructors.Clientgains ascheduleSvcstub.CreateSchedule/GetFireexported for the planned Phase 3b in-overlay Create form (documented as uncalled in v1).cmd/mecatui/ui/schedule.go, NEW): a selecting overlay peer of/worktrees—scheduleViewenum (none/panel/confirm/inspect),scheduleState, full lifecycle (openSchedule/closeSchedule/onScheduleKey/updateScheduleMsg/renderScheduleOverlay+ helpers). The panel lists schedules (name, trigger summary, enabled, next/last fire, fire count) with type-to-filter + cursor nav. Action keys:enter=inspect (loads fires viaListFires),p=pause,r=resume,f=fire-now,d=delete (confirm sub-view). All server-derived fields sanitized viasanitizeTerminalat the render boundary./schedulebuiltin registered after/worktrees, gated oncaps.Scheduling && deps.Sched.updateInventoryMsgswidened to(Model, Cmd, bool)so the action-success re-list cmd propagates.Deps.Sched+Model.schedulefields;main.gowiresSched: cl. Help overlay gains a/schedulerow.schedule_test.go(mappers + RPC wrappers + Cmd constructors, success + error arms); uischedule_test.go(open/nil-guard/filter/pause-resume-fire-delete/inspect-loads-fires/confirm-delete-backout/action-error-render/mid-run-guard/esc-close/trigger-summary);builtins_test.gocaps-filter + by-name cases; help goldens refreshed.PRODUCTION-READINESS.mdflips Phase 3a to shipped (NL→cron deferred to v2);tui.mdadds the/schedulesection + palette entry;usage.mdflips the planned line to shipped.llms.txtregenerated.Scope note
The issue lists "Create" as a Phase 3a action and only "pause/resume" as management actions. This PR lands list/inspect/pause/resume/fire-now/delete and defers the in-overlay Create form to Phase 3b (raw cron/one-shot entry via the CLI/
settings.yamlalready works; the composer form is the follow-up). FireNow and Delete are useful peer actions added beyond the literal pause/resume list — both have tests and the delete has a confirm sub-view.Verification
task generate✅task build✅task lint✅ (0 issues, both modules)task test✅ (full offline suite, -race)go run ./cmd/mecademo✅ (full offline session prints)task docs✅ (0 broken links/anchors)task test:golden✅task api:check✅Review panel
Ran a three-axis panel review (spec + standards + domain specialists) plus a QA test-adequacy review. Findings addressed:
triggerSummaryoutput now passed throughsanitizeTerminalat the render boundary (defense-in-depth against crafted cron-expression bytes from an untrusted remote server).TestScheduleActionErrorRender(action-error line renders) andTestRunScheduleNotIdle(mid-run guard).CreateSchedule/CreateScheduleCmdmatchingGetFire's "exported for the planned form" note.Spec-axis notes (judgement calls, not blockers):