feat: add richer automation templates to choose from#2405
Conversation
Greptile SummaryThis PR replaces the small dropdown-based
Confidence Score: 4/5Safe to merge; all changes are additive template data and UI wiring with no mutations to existing automation records. The core logic changes are clean and well-tested. The one thing worth confirming before merge is whether the five templates that moved from weekday-only to daily schedules did so intentionally — new automations created from those templates will fire on weekends, which may surprise users expecting work-hours-only notifications. src/shared/automations/builtin-catalog.ts — specifically the defaultTrigger cron expressions on critical-bug-finder, daily-change-summary, datadog-error-investigation, reported-bugs, and pagerduty-incident-investigation.
|
| Filename | Overview |
|---|---|
| src/shared/automations/builtin-catalog.ts | Major expansion from 9 to 20+ templates with new category/icon type system; five existing templates quietly changed from weekday-only (MON-FRI) to daily (*) cron schedules |
| src/renderer/features/automations/components/AutomationTemplateGallery.tsx | New gallery component with category tabs; icon mapping is type-safe via AutomationTemplateIcon literal union; keyboard and accessibility handling looks correct |
| src/renderer/features/automations/components/AutomationsView.tsx | Refactored sheet state to a discriminated union (create/edit/null); template gallery is now always visible; empty-state logic handles both no-automations and no-search-matches |
| src/renderer/features/tasks/conversations/initial-conversation-section.tsx | Added initialPrompt parameter with a default of '' preserving backward compatibility; project-switch reset now restores the seed prompt instead of clearing to empty string |
| src/renderer/features/automations/useAutomationFormState.ts | Replaced the render-time setState anti-pattern (promptSeeded flag) with a clean initialPrompt argument passed to useInitialConversationState; template seeding logic is correct |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[AutomationsView] -->|no automations| B[EmptyState]
A -->|has automations + search miss| C[No-match EmptyState]
A -->|has automations + search match| D[AutomationsList]
A --> E[AutomationTemplateGallery]
E -->|tab: Popular| F[popularAutomationTemplates]
E -->|tab: Category| G[builtinAutomationTemplatesByCategory]
F --> H[AutomationTemplateCard]
G --> H
H -->|click / Enter / Space| I[openCreate with template]
A -->|New Automation button| J[openCreate with null]
I --> K[SheetState: kind=create, template]
J --> K2[SheetState: kind=create, template=null]
K --> L[CreateAutomationView key=template.id]
K2 --> L2[CreateAutomationView key=scratch]
L --> M[useAutomationFormState seed=undefined, template]
L2 --> M2[useAutomationFormState seed=undefined, template=undefined]
M --> N[useInitialConversationState initialPrompt=template.defaultConversationConfig.initialPrompt]
M2 --> N2[useInitialConversationState initialPrompt='']
D -->|onEdit| O[openEdit]
O --> P[SheetState: kind=edit, automationId]
P --> Q[AutomationDetailView]
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
src/shared/automations/builtin-catalog.ts:49-55
Five templates that previously ran only on weekdays (`MON-FRI`) now run every day of the week. `critical-bug-finder`, `daily-change-summary`, `datadog-error-investigation`, `reported-bugs`, and `pagerduty-incident-investigation` all moved from `MON-FRI` to `*` in the day-of-week field. New automations created from these templates will fire on Saturdays and Sundays, which is likely undesirable for "work notifications" like change summaries and incident investigation. The old templates used named-day ranges; the new ones silently dropped that constraint.
```suggestion
{
id: 'critical-bug-finder',
name: 'Find critical bugs',
description:
'Analyze recent commits for high-severity correctness bugs and submit safe fixes',
icon: 'Bug',
defaultTrigger: { expr: '0 10 * * MON-FRI', tz: 'UTC' },
```
Reviews (1): Last reviewed commit: "feat(automations): add template gallery" | Re-trigger Greptile
Description
Screenshot/Recording (if applicable)
https://streamable.com/x5h2sf
Checklist
messages and, when possible, the PR title