feat(domain): add scheduled workflows engine with CLI, web UI, and daemon integration#441
Open
feat(domain): add scheduled workflows engine with CLI, web UI, and daemon integration#441
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Covers cron library selection (croner), domain model design, database schema, scheduler service architecture, execution model, repository layer, use case organization, CLI structure, web UI architecture, notification integration, crash recovery, and built-in templates. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…led workflows Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Define ScheduledWorkflow entity (SoftDeletableEntity), WorkflowExecution entity (BaseEntity), WorkflowTriggerType enum, and WorkflowExecutionStatus enum in TypeSpec. Install croner v10.x for cron expression parsing and scheduling. Compile TypeSpec to generate TypeScript types. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add IClock port interface for testable time handling in the scheduler service, with RealClock infrastructure implementation and unit tests. Extend NotificationEventType enum with WorkflowStarted, WorkflowCompleted, and WorkflowFailed events. Add corresponding NotificationEventConfig fields, settings mapper columns, migration 044, defaults factory entries, web UI toggles, and update all affected test fixtures. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add SQLite migration (045), bidirectional mappers, repository port interfaces, and repository implementations for ScheduledWorkflow and WorkflowExecution entities. Includes 76 tests covering mappers (unit) and repositories (integration) with full round-trip data integrity verification. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ed workflows Implement 9 use cases (Create, Update, Delete, List, Get, Run, Schedule, GetHistory, Toggle), the WorkflowSchedulerService with polling-based execution engine, 2 built-in workflow templates, and DI container registrations. Key components: - Cron validation/nextRunAt calculation via croner (shared helper) - Sequential execution with FIFO queue in WorkflowSchedulerService - Crash recovery (marks stale running executions as failed on startup) - 30-day retention cleanup every 100 scheduler ticks - Notification events (WorkflowStarted/Completed/Failed) - Injectable IClock for deterministic testing - Issue-triage and branch-rebase workflow templates 58 tests across 10 test files covering all use cases, scheduler service lifecycle, execution, notifications, crash recovery, and retention. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add the complete 'shep workflow' CLI command group with 10 subcommands (create, list, show, run, schedule, enable, disable, history, update, delete), register it in the main CLI program, and integrate the WorkflowSchedulerService into the daemon's _serve command startup and shutdown lifecycle. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add /workflows page with server actions for listing workflows, viewing execution history, toggling enabled state, and triggering manual runs. Build client components (WorkflowsPageClient, WorkflowList, WorkflowListItem, WorkflowExecutionHistory) with colocated Storybook stories. Add Workflows nav item to sidebar. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Croner was only listed in packages/core/package.json but the compiled CLI dist runs from the workspace root. With pnpm strict mode, the root cannot resolve packages not in its own dependencies. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The _serve.command.test.ts was missing mocks for the workflow scheduler service and its DI tokens (IWorkflowRepository, IWorkflowExecutionRepository, IClock) added by the scheduled workflows feature integration. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Evidence includes: - 190 passing tests across 18 test files (unit + integration) - CLI workflow command help text and demo output - App screenshots: empty workflows page, populated workflows page, settings page with workflow notification toggles Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ature Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…er actions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a complete workflow engine to shep that lets users define reusable automation scripts (expressed as agent prompts) and execute them on demand via CLI/web UI or on a recurring cron schedule managed by the daemon process.
WorkflowandWorkflowExecutionentities with enums for trigger type and execution status. IClock port interface for testable time. Workflow notification events (started, completed, failed) integrated with notification bus.workflowsandworkflow_executionstables. Mapper functions with Row interfaces. Repository implementations with soft delete, prepared statements, and retention-based purge.shep workflowcommand group with 10 subcommands (create, list, show, run, schedule, enable, disable, history, update, delete). Includes--from-templatesupport with two built-in templates (github-issue-triage, branch-rebase).Evidence
Test plan
feature-create-drawertest has a pre-existing failure on main — not introduced by this PR)🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com