File size: 5,976 Bytes
5f40163
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import type { AutomationsResponse } from "#/types/automation";

/**
 * Mock automations data matching the AutomationResponse schema from the backend.
 *
 * Backend schema fields: id, user_id, org_id, name, trigger (JSONB),
 * tarball_path, setup_script_path, entrypoint, timeout, enabled,
 * last_triggered_at, created_at, updated_at.
 *
 * The frontend Automation type only uses a subset of these fields.
 * Additional backend fields are included here for API fidelity.
 */

const now = new Date().toISOString();
const daysAgo = (days: number) =>
  new Date(Date.now() - days * 86_400_000).toISOString();

export const MOCK_AUTOMATIONS_RESPONSE: AutomationsResponse = {
  automations: [
    {
      id: "a1000000-0000-0000-0000-000000000001",
      name: "PR Triage Digest",
      trigger: {
        type: "cron",
        schedule: "0 9 * * 1-5",
        schedule_human: "Weekdays at 09:00",
      },
      enabled: true,
      repository: "acme/frontend-app",
      model: "triage-fast",
      timeout: 600,
      created_at: daysAgo(90),
      updated_at: now,
      prompt:
        "Review newly opened pull requests in acme/frontend-app, identify risky changes, summarize likely impact, and prepare a concise digest with priority ordering for the engineering review channel.",
      branch: "main",
      plugins: ["GitHub", "Slack", "Linear"],
      notification: "Slack digest to #eng-reviews",
      timezone: "America/Los_Angeles",
      last_triggered_at: daysAgo(0),
    },
    {
      id: "a1000000-0000-0000-0000-000000000002",
      name: "Nightly Security Pass",
      trigger: {
        type: "cron",
        schedule: "30 1 * * *",
        schedule_human: "Daily at 01:30",
      },
      enabled: true,
      repository: "acme/backend-api",
      model: "security-careful",
      timeout: 900,
      created_at: daysAgo(60),
      updated_at: now,
      prompt:
        "Scan the acme/backend-api repository for known security vulnerabilities, outdated dependencies, and insecure code patterns. Produce a prioritized remediation summary.",
      branch: "main",
      plugins: ["GitHub"],
      notification: "Email to security-team@acme.com",
      timezone: "UTC",
      last_triggered_at: daysAgo(0),
    },
    {
      id: "a1000000-0000-0000-0000-000000000003",
      name: "Docs Sync on Push",
      trigger: {
        type: "cron",
        schedule: "*/5 * * * *",
        schedule_human: "Runs on every push",
      },
      enabled: true,
      repository: "acme/docs",
      model: "docs-fast",
      created_at: daysAgo(45),
      updated_at: now,
      prompt:
        "Monitor acme/docs for new pushes. For each push, generate a changelog-ready summary of what changed and why.",
      branch: "main",
      plugins: ["GitHub", "Slack"],
      notification: "Slack to #docs-updates",
      timezone: "America/New_York",
      last_triggered_at: daysAgo(1),
    },
    {
      id: "a1000000-0000-0000-0000-000000000004",
      name: "Release Readiness Review",
      trigger: {
        type: "cron",
        schedule: "0 11 * * 5",
        schedule_human: "Fridays at 11:00",
      },
      enabled: false,
      repository: "acme/realtime-service",
      model: "release-review",
      created_at: daysAgo(80),
      updated_at: now,
      prompt:
        "Compile a release readiness report: list open blockers, active incidents, and pending approvals for acme/realtime-service.",
      branch: "release",
      plugins: ["GitHub", "Linear"],
      notification: "Slack to #releases",
      timezone: "America/Chicago",
      last_triggered_at: daysAgo(14),
    },
    {
      id: "a1000000-0000-0000-0000-000000000005",
      name: "Incident Webhook Summary",
      trigger: {
        type: "cron",
        schedule: "0 */2 * * *",
        schedule_human: "On incident webhook",
      },
      enabled: false,
      repository: "acme/incident-service",
      model: "incident-summary",
      created_at: daysAgo(30),
      updated_at: now,
      prompt:
        "Summarize incoming incident webhooks, categorize by severity, and post a digest to the on-call Slack channel.",
      branch: "main",
      plugins: ["Slack"],
      notification: "Slack to #oncall",
      timezone: "UTC",
      last_triggered_at: null,
    },
    {
      id: "a1000000-0000-0000-0000-000000000006",
      name: "PR Review on Open",
      trigger: {
        type: "event",
        source: "github",
        on: "pull_request.opened",
        filter: "repository.full_name == 'acme/frontend-app'",
      },
      enabled: true,
      repository: "acme/frontend-app",
      model: "review-fast",
      timeout: 1800,
      created_at: daysAgo(15),
      updated_at: now,
      prompt:
        "When a new PR is opened, perform a thorough code review focusing on correctness, security, and performance. Post findings as inline comments.",
      branch: "main",
      plugins: ["GitHub"],
      notification: "GitHub PR comment",
      last_triggered_at: daysAgo(0),
      // Template provenance, as the setup flow stores it. The other mock
      // automations stay without one to exercise the no-statement path.
      preset_metadata: {
        template: { id: "github-pr-reviewer", version: "1.0.0", config: {} },
      },
    },
    {
      id: "a1000000-0000-0000-0000-000000000007",
      name: "Release Notes Generator",
      trigger: {
        type: "event",
        source: "github",
        on: "release.published",
        filter: "glob(release.tag_name, 'v*') && !release.prerelease",
      },
      enabled: true,
      repository: "acme/backend-api",
      model: "docs-fast",
      created_at: daysAgo(10),
      updated_at: now,
      prompt:
        "Generate comprehensive release notes from the commits since the last release. Include breaking changes, new features, and bug fixes.",
      branch: "main",
      plugins: ["GitHub"],
      notification: "GitHub release body update",
      last_triggered_at: daysAgo(3),
    },
  ],
  total: 7,
};