Skip to content

feat: add richer automation templates to choose from#2405

Open
janburzinski wants to merge 3 commits into
mainfrom
jan/eng-1533-add-richer-automation-templates-to-choose-from
Open

feat: add richer automation templates to choose from#2405
janburzinski wants to merge 3 commits into
mainfrom
jan/eng-1533-add-richer-automation-templates-to-choose-from

Conversation

@janburzinski

Copy link
Copy Markdown
Collaborator

Description

  • expand built in tempaltes
  • added templates for code quality, security, incident triage, status reporting, documentation and maintenance workflow

Screenshot/Recording (if applicable)

https://streamable.com/x5h2sf

Checklist
  • I kept this PR small and focused
  • I ran a self-review before opening this PR
  • I ran the relevant local checks or explained why not
  • I updated docs when behavior or setup changed
  • I added or updated tests when behavior changed, or explained why not
  • I only added comments where the logic is not obvious
  • I used Conventional Commits for commit
    messages and, when possible, the PR title

@greptile-apps

greptile-apps Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR replaces the small dropdown-based UseTemplateButton with a full AutomationTemplateGallery showing categorised template cards, and expands the built-in catalog from 9 to 20+ templates across six categories (Code quality, Security, Incidents & triage, Status reports, Documentation, Maintenance). The SheetState discriminated union and cleaner initialPrompt seeding replace earlier imperative workarounds.

  • builtin-catalog.ts: Restructured around builtinAutomationTemplateInputsByCategory, with CatalogTemplate and AutomationTemplateIcon literal-union types enabling type-safe icon lookups in the gallery; popularAutomationTemplates replaces pinnedAutomationTemplates/emptyStateAutomationTemplates.
  • AutomationsView.tsx: SheetState discriminated union (create | edit | null) replaces the old creating boolean; the gallery is always rendered below the list; empty-state slots cover both the zero-automations and no-search-matches cases.
  • useAutomationFormState.ts + initial-conversation-section.tsx: The render-time promptSeeded setState anti-pattern is removed in favour of passing initialPrompt to useInitialConversationState, which also now correctly restores the seed prompt (rather than '') when the user switches projects.

Confidence Score: 4/5

Safe 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.

Important Files Changed

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]
Loading
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

Comment thread src/shared/automations/builtin-catalog.ts Outdated
@janburzinski janburzinski changed the title Jan/eng 1533 add richer automation templates to choose from feat: add richer automation templates to choose from Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant