@cat-factory/app 0.9.1 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/app/components/board/AddTaskModal.vue +209 -21
  2. package/app/components/board/nodes/BlockNode.vue +2 -2
  3. package/app/components/focus/BlockFocusView.vue +2 -2
  4. package/app/components/layout/CommandBar.vue +7 -33
  5. package/app/components/layout/IntegrationsHub.vue +230 -0
  6. package/app/components/layout/SideBar.vue +8 -170
  7. package/app/components/panels/GenericStructuredResultView.vue +131 -0
  8. package/app/components/panels/InspectorPanel.vue +6 -2
  9. package/app/components/panels/StepResultViewHost.vue +4 -0
  10. package/app/components/panels/inspector/ServiceReleaseHealthConfig.vue +148 -0
  11. package/app/components/settings/IssueTrackerWritebackPanel.vue +45 -57
  12. package/app/components/settings/MergeThresholdsPanel.vue +189 -226
  13. package/app/components/settings/ObservabilityConnectionPanel.vue +151 -0
  14. package/app/components/settings/ServiceFragmentDefaultsPanel.vue +46 -61
  15. package/app/components/settings/WorkspaceSettingsPanel.vue +136 -63
  16. package/app/composables/api/releaseHealth.ts +11 -10
  17. package/app/pages/index.vue +4 -8
  18. package/app/stores/agents.ts +27 -2
  19. package/app/stores/releaseHealth.ts +48 -12
  20. package/app/stores/ui.ts +34 -42
  21. package/app/stores/workspace.ts +4 -0
  22. package/app/types/domain.ts +33 -1
  23. package/app/types/execution.ts +6 -0
  24. package/app/types/releaseHealth.ts +19 -11
  25. package/app/utils/catalog.spec.ts +10 -0
  26. package/app/utils/catalog.ts +20 -6
  27. package/package.json +1 -1
  28. package/app/components/board/ContextPicker.vue +0 -367
  29. package/app/components/settings/DatadogPanel.vue +0 -213
@@ -1,367 +0,0 @@
1
- <script setup lang="ts">
2
- // A self-contained picker for attaching external context (imported docs +
3
- // tracker issues) to a task. It surfaces the existing integrations — Confluence /
4
- // Notion / GitHub repo docs (documents) and Jira / GitHub issues (tasks) — behind
5
- // one control: pick a source, then either search its catalogue by title/content
6
- // (when the source is searchable) or paste a page/issue URL or id, and pick from
7
- // what's already been imported. Chosen items are collected into a v-model list of
8
- // `PendingContext`; the parent links them once the block exists (see
9
- // useContextLinking). Connection/availability gating mirrors the sidebar: a
10
- // source that isn't connected shows a connect affordance instead of an input.
11
- import type { DropdownMenuItem } from '@nuxt/ui'
12
- import type {
13
- DocumentSearchResult,
14
- DocumentSourceKind,
15
- TaskSearchResult,
16
- TaskSourceKind,
17
- } from '~/types/domain'
18
-
19
- const model = defineModel<PendingContext[]>({ required: true })
20
-
21
- const documents = useDocumentsStore()
22
- const tasks = useTasksStore()
23
- const ui = useUiStore()
24
- const toast = useToast()
25
-
26
- interface SourceOption {
27
- kind: 'document' | 'task'
28
- source: DocumentSourceKind | TaskSourceKind
29
- label: string
30
- icon: string
31
- searchable: boolean
32
- connected: boolean
33
- refLabel: string
34
- refPlaceholder: string
35
- }
36
-
37
- // Every configured source across both integrations, tagged by kind. Documents
38
- // first, then trackers — the order the sidebar uses.
39
- const sources = computed<SourceOption[]>(() => {
40
- const docs: SourceOption[] = documents.available
41
- ? documents.sources.map((s) => ({
42
- kind: 'document',
43
- source: s.source,
44
- label: s.label,
45
- icon: s.icon,
46
- searchable: s.searchable ?? false,
47
- connected: documents.isConnected(s.source),
48
- refLabel: s.refLabel,
49
- refPlaceholder: s.refPlaceholder,
50
- }))
51
- : []
52
- const issues: SourceOption[] = tasks.available
53
- ? tasks.sources.map((s) => ({
54
- kind: 'task',
55
- source: s.source,
56
- label: s.label,
57
- icon: s.icon,
58
- searchable: s.searchable ?? false,
59
- connected: tasks.isConnected(s.source),
60
- refLabel: s.refLabel,
61
- refPlaceholder: s.refPlaceholder,
62
- }))
63
- : []
64
- return [...docs, ...issues]
65
- })
66
-
67
- const selectedKey = ref('')
68
- const selected = computed(() =>
69
- sources.value.find((s) => `${s.kind}:${s.source}` === selectedKey.value),
70
- )
71
-
72
- // Default the selection to the first connected source (else the first source),
73
- // once the source list resolves.
74
- watch(
75
- sources,
76
- (list) => {
77
- if (selected.value || list.length === 0) return
78
- selectedKey.value = `${(list.find((s) => s.connected) ?? list[0]!).kind}:${(list.find((s) => s.connected) ?? list[0]!).source}`
79
- },
80
- { immediate: true },
81
- )
82
-
83
- const sourceMenu = computed<DropdownMenuItem[][]>(() => [
84
- sources.value.map((s) => ({
85
- label: s.connected ? s.label : `${s.label} (not connected)`,
86
- icon: s.icon,
87
- onSelect: () => {
88
- selectedKey.value = `${s.kind}:${s.source}`
89
- query.value = ''
90
- results.value = []
91
- },
92
- })),
93
- ])
94
-
95
- // The "set up a new integration" menu: every configured source, so the user can
96
- // connect (or reconnect) one without leaving the add-task popup. Unconnected
97
- // sources come first — those are the ones you'd typically be setting up here.
98
- const connectMenu = computed<DropdownMenuItem[][]>(() => [
99
- [...sources.value]
100
- .sort((a, b) => Number(a.connected) - Number(b.connected))
101
- .map((s) => ({
102
- label: s.connected ? `${s.label} (reconnect)` : `Connect ${s.label}`,
103
- icon: s.icon,
104
- onSelect: () => connect(s),
105
- })),
106
- ])
107
-
108
- // ---- search / import-by-ref ----------------------------------------------
109
-
110
- const query = ref('')
111
- const results = ref<(DocumentSearchResult | TaskSearchResult)[]>([])
112
- const searching = ref(false)
113
- let searchTimer: ReturnType<typeof setTimeout> | undefined
114
-
115
- watch([query, selectedKey], () => {
116
- results.value = []
117
- if (searchTimer) clearTimeout(searchTimer)
118
- const src = selected.value
119
- const q = query.value.trim()
120
- if (!src || !src.searchable || !src.connected || q.length < 2) return
121
- searchTimer = setTimeout(() => void runSearch(src, q), 300)
122
- })
123
-
124
- async function runSearch(src: SourceOption, q: string) {
125
- searching.value = true
126
- try {
127
- results.value =
128
- src.kind === 'document'
129
- ? await documents.search(src.source as DocumentSourceKind, q)
130
- : await tasks.search(src.source as TaskSourceKind, q)
131
- } catch {
132
- // A search failure (e.g. the source can't search, or a transient API error)
133
- // just yields no results — paste-a-URL still works.
134
- results.value = []
135
- } finally {
136
- searching.value = false
137
- }
138
- }
139
-
140
- const selectedKeys = computed(() => new Set(model.value.map(contextKey)))
141
-
142
- function toggle(item: PendingContext) {
143
- const key = contextKey(item)
144
- if (selectedKeys.value.has(key)) {
145
- model.value = model.value.filter((c) => contextKey(c) !== key)
146
- } else {
147
- model.value = [...model.value, item]
148
- }
149
- }
150
-
151
- /** Attach the raw input as a page/issue ref (URL or id) — imported on commit. */
152
- function addByRef() {
153
- const src = selected.value
154
- const ref = query.value.trim()
155
- if (!src || !ref) return
156
- toggle({
157
- kind: src.kind,
158
- source: src.source,
159
- externalId: ref,
160
- title: ref,
161
- subtitle: `${src.label} · imports on add`,
162
- icon: src.icon,
163
- needsImport: true,
164
- })
165
- query.value = ''
166
- results.value = []
167
- }
168
-
169
- function pickResult(src: SourceOption, r: DocumentSearchResult | TaskSearchResult) {
170
- toggle({
171
- kind: src.kind,
172
- source: src.source,
173
- externalId: r.externalId,
174
- title: r.title,
175
- subtitle: 'status' in r && r.status ? r.status : src.label,
176
- icon: src.icon,
177
- needsImport: true,
178
- })
179
- }
180
-
181
- // Already-imported items for the selected source, for quick re-attaching without
182
- // a round-trip. Excludes anything already pending.
183
- const imported = computed<PendingContext[]>(() => {
184
- const src = selected.value
185
- if (!src) return []
186
- const items: PendingContext[] =
187
- src.kind === 'document'
188
- ? documents.documents
189
- .filter((d) => d.source === src.source)
190
- .map((d) => ({
191
- kind: 'document' as const,
192
- source: d.source,
193
- externalId: d.externalId,
194
- title: d.title,
195
- subtitle: src.label,
196
- icon: src.icon,
197
- needsImport: false,
198
- }))
199
- : tasks.tasks
200
- .filter((t) => t.source === src.source)
201
- .map((t) => ({
202
- kind: 'task' as const,
203
- source: t.source,
204
- externalId: t.externalId,
205
- title: `${t.externalId} · ${t.title}`,
206
- subtitle: t.status || src.label,
207
- icon: src.icon,
208
- needsImport: false,
209
- }))
210
- return items.filter((i) => !selectedKeys.value.has(contextKey(i)))
211
- })
212
-
213
- function connect(src: SourceOption) {
214
- if (src.kind === 'document') ui.openDocumentConnect(src.source as DocumentSourceKind)
215
- else ui.openTaskConnect(src.source as TaskSourceKind)
216
- toast.add({
217
- title: `Connect ${src.label} — it'll be ready here once connected`,
218
- icon: 'i-lucide-plug',
219
- })
220
- }
221
- </script>
222
-
223
- <template>
224
- <div v-if="sources.length" class="space-y-2">
225
- <div class="flex items-center gap-2">
226
- <UDropdownMenu :items="sourceMenu" class="shrink-0">
227
- <UButton
228
- color="neutral"
229
- variant="subtle"
230
- size="sm"
231
- :icon="selected?.icon ?? 'i-lucide-link'"
232
- trailing-icon="i-lucide-chevron-down"
233
- >
234
- {{ selected?.label ?? 'Source' }}
235
- </UButton>
236
- </UDropdownMenu>
237
-
238
- <UInput
239
- v-if="selected?.connected"
240
- v-model="query"
241
- :placeholder="
242
- selected?.searchable
243
- ? `Search ${selected?.label} or paste a URL…`
244
- : selected?.refPlaceholder
245
- "
246
- class="flex-1"
247
- :loading="searching"
248
- icon="i-lucide-search"
249
- @keydown.enter.prevent="addByRef"
250
- />
251
-
252
- <UDropdownMenu :items="connectMenu" class="ml-auto shrink-0">
253
- <UButton
254
- color="neutral"
255
- variant="ghost"
256
- size="sm"
257
- icon="i-lucide-plus"
258
- trailing-icon="i-lucide-chevron-down"
259
- title="Connect an integration"
260
- >
261
- Connect a source
262
- </UButton>
263
- </UDropdownMenu>
264
- </div>
265
-
266
- <!-- not-connected affordance -->
267
- <div
268
- v-if="selected && !selected.connected"
269
- class="flex items-center justify-between rounded-md border border-slate-800 bg-slate-900/60 px-2 py-1.5 text-xs text-slate-400"
270
- >
271
- <span>{{ selected.label }} isn't connected yet.</span>
272
- <UButton
273
- color="neutral"
274
- variant="soft"
275
- size="xs"
276
- icon="i-lucide-plug"
277
- @click="connect(selected)"
278
- >
279
- Connect
280
- </UButton>
281
- </div>
282
-
283
- <!-- search results + paste-by-URL -->
284
- <div v-if="selected?.connected && query.trim()" class="space-y-1">
285
- <button
286
- type="button"
287
- class="flex w-full items-center gap-1.5 rounded-md border border-dashed border-slate-700 bg-slate-900/40 px-2 py-1.5 text-left text-xs text-slate-300 hover:bg-slate-800/60"
288
- @click="addByRef"
289
- >
290
- <UIcon name="i-lucide-link" class="h-3.5 w-3.5 shrink-0 text-indigo-400" />
291
- <span class="truncate">Link “{{ query.trim() }}” by URL or id</span>
292
- </button>
293
- <button
294
- v-for="r in results"
295
- :key="`${r.source}:${r.externalId}`"
296
- type="button"
297
- class="w-full rounded-md border border-slate-800 bg-slate-900/60 px-2 py-1.5 text-left text-xs text-slate-300 hover:bg-slate-800/60"
298
- @click="pickResult(selected!, r)"
299
- >
300
- <span class="flex items-center gap-1.5">
301
- <UIcon
302
- :name="selected?.icon ?? 'i-lucide-file-text'"
303
- class="h-3.5 w-3.5 shrink-0 text-indigo-400"
304
- />
305
- <span class="truncate">{{ r.title }}</span>
306
- <UBadge
307
- v-if="'status' in r && r.status"
308
- color="neutral"
309
- variant="soft"
310
- size="xs"
311
- class="ml-auto shrink-0"
312
- >
313
- {{ r.status }}
314
- </UBadge>
315
- </span>
316
- <span v-if="r.excerpt" class="mt-0.5 block truncate pl-5 text-[11px] text-slate-500">
317
- {{ r.excerpt }}
318
- </span>
319
- </button>
320
- <p
321
- v-if="selected?.searchable && !searching && !results.length"
322
- class="px-1 text-[11px] text-slate-500"
323
- >
324
- No matches — or paste the exact URL/id above.
325
- </p>
326
- </div>
327
-
328
- <!-- already-imported quick pick -->
329
- <div v-if="imported.length" class="space-y-1">
330
- <span class="px-1 text-[10px] font-semibold uppercase tracking-wide text-slate-500">
331
- Already imported
332
- </span>
333
- <button
334
- v-for="item in imported"
335
- :key="contextKey(item)"
336
- type="button"
337
- class="flex w-full items-center gap-1.5 rounded-md border border-slate-800 bg-slate-900/60 px-2 py-1.5 text-left text-xs text-slate-300 hover:bg-slate-800/60"
338
- @click="toggle(item)"
339
- >
340
- <UIcon
341
- :name="item.icon ?? 'i-lucide-file-text'"
342
- class="h-3.5 w-3.5 shrink-0 text-indigo-400"
343
- />
344
- <span class="truncate">{{ item.title }}</span>
345
- </button>
346
- </div>
347
-
348
- <!-- chosen items -->
349
- <div v-if="model.length" class="flex flex-wrap gap-1.5">
350
- <span
351
- v-for="item in model"
352
- :key="contextKey(item)"
353
- class="flex max-w-full items-center gap-1 rounded-full border border-indigo-500/60 bg-indigo-500/10 px-2 py-0.5 text-[11px] text-slate-200"
354
- >
355
- <UIcon :name="item.icon ?? 'i-lucide-link'" class="h-3 w-3 shrink-0 text-indigo-400" />
356
- <span class="truncate">{{ item.title }}</span>
357
- <button
358
- type="button"
359
- class="shrink-0 text-slate-400 hover:text-slate-200"
360
- @click="toggle(item)"
361
- >
362
- <UIcon name="i-lucide-x" class="h-3 w-3" />
363
- </button>
364
- </span>
365
- </div>
366
- </div>
367
- </template>
@@ -1,213 +0,0 @@
1
- <script setup lang="ts">
2
- // Datadog post-release-health settings. Two sections:
3
- // - Connection (per-workspace): site + API/app keys (write-only, never read back).
4
- // - Monitor/SLO mappings (per service-frame block): which monitors/SLOs the
5
- // `post-release-health` gate watches after that service's PRs ship.
6
- import { computed, reactive, ref, watch } from 'vue'
7
-
8
- const ui = useUiStore()
9
- const store = useReleaseHealthStore()
10
- const toast = useToast()
11
-
12
- const open = computed({
13
- get: () => ui.datadogOpen,
14
- set: (v: boolean) => (v ? ui.openDatadog() : ui.closeDatadog()),
15
- })
16
-
17
- const conn = reactive({ site: 'datadoghq.com', apiKey: '', appKey: '' })
18
- const busy = ref(false)
19
-
20
- // New-mapping form.
21
- const draft = reactive({ blockId: '', monitorIds: '', sloIds: '', envTag: '' })
22
-
23
- function notifyError(title: string, e: unknown) {
24
- toast.add({
25
- title,
26
- description: e instanceof Error ? e.message : String(e),
27
- icon: 'i-lucide-triangle-alert',
28
- color: 'error',
29
- })
30
- }
31
-
32
- watch(
33
- () => open.value,
34
- async (isOpen) => {
35
- if (!isOpen) return
36
- try {
37
- await store.load()
38
- if (store.connection.site) conn.site = store.connection.site
39
- } catch (e) {
40
- notifyError('Could not load Datadog settings', e)
41
- }
42
- },
43
- )
44
-
45
- function parseIds(csv: string): string[] {
46
- return csv
47
- .split(',')
48
- .map((s) => s.trim())
49
- .filter((s) => s.length > 0)
50
- }
51
-
52
- async function saveConnection() {
53
- busy.value = true
54
- try {
55
- await store.saveConnection({ site: conn.site, apiKey: conn.apiKey, appKey: conn.appKey })
56
- conn.apiKey = ''
57
- conn.appKey = ''
58
- toast.add({ title: 'Datadog connected', icon: 'i-lucide-check', color: 'success' })
59
- } catch (e) {
60
- notifyError('Could not save the Datadog connection', e)
61
- } finally {
62
- busy.value = false
63
- }
64
- }
65
-
66
- async function disconnect() {
67
- busy.value = true
68
- try {
69
- await store.removeConnection()
70
- } catch (e) {
71
- notifyError('Could not disconnect Datadog', e)
72
- } finally {
73
- busy.value = false
74
- }
75
- }
76
-
77
- async function addMapping() {
78
- if (!draft.blockId.trim()) return
79
- busy.value = true
80
- try {
81
- await store.saveConfig(draft.blockId.trim(), {
82
- monitorIds: parseIds(draft.monitorIds),
83
- sloIds: parseIds(draft.sloIds),
84
- envTag: draft.envTag.trim() || null,
85
- })
86
- draft.blockId = ''
87
- draft.monitorIds = ''
88
- draft.sloIds = ''
89
- draft.envTag = ''
90
- } catch (e) {
91
- notifyError('Could not save the mapping', e)
92
- } finally {
93
- busy.value = false
94
- }
95
- }
96
-
97
- async function removeMapping(blockId: string) {
98
- busy.value = true
99
- try {
100
- await store.removeConfig(blockId)
101
- } catch (e) {
102
- notifyError('Could not remove the mapping', e)
103
- } finally {
104
- busy.value = false
105
- }
106
- }
107
- </script>
108
-
109
- <template>
110
- <UModal v-model:open="open" title="Datadog post-release health" :ui="{ content: 'max-w-2xl' }">
111
- <template #body>
112
- <div class="space-y-6">
113
- <p class="text-sm text-slate-400">
114
- After a release ships, the <code>post-release-health</code> gate watches the configured
115
- Datadog monitors/SLOs. On a regression it spawns an on-call agent to investigate (a human
116
- decides whether to revert).
117
- </p>
118
-
119
- <!-- Connection -->
120
- <section class="space-y-3 rounded-lg border border-slate-700 p-3">
121
- <div class="flex items-center justify-between">
122
- <h3 class="text-sm font-semibold">Connection</h3>
123
- <UBadge :color="store.connection.connected ? 'success' : 'neutral'" variant="soft">
124
- {{
125
- store.connection.connected
126
- ? `Connected (${store.connection.site})`
127
- : 'Not connected'
128
- }}
129
- </UBadge>
130
- </div>
131
- <UFormField label="Datadog site">
132
- <UInput v-model="conn.site" placeholder="datadoghq.com" />
133
- </UFormField>
134
- <UFormField label="API key">
135
- <UInput v-model="conn.apiKey" type="password" placeholder="DD-API-KEY" />
136
- </UFormField>
137
- <UFormField label="Application key">
138
- <UInput v-model="conn.appKey" type="password" placeholder="DD-APPLICATION-KEY" />
139
- </UFormField>
140
- <div class="flex gap-2">
141
- <UButton
142
- :loading="busy"
143
- :disabled="!conn.apiKey || !conn.appKey"
144
- @click="saveConnection"
145
- >
146
- Save connection
147
- </UButton>
148
- <UButton
149
- v-if="store.connection.connected"
150
- color="error"
151
- variant="soft"
152
- :loading="busy"
153
- @click="disconnect"
154
- >
155
- Disconnect
156
- </UButton>
157
- </div>
158
- </section>
159
-
160
- <!-- Monitor/SLO mappings -->
161
- <section class="space-y-3 rounded-lg border border-slate-700 p-3">
162
- <h3 class="text-sm font-semibold">Monitor / SLO mappings</h3>
163
- <p class="text-xs text-slate-400">
164
- Map a service frame's block id to the Datadog monitor and SLO ids that gate its
165
- releases. Comma-separate multiple ids.
166
- </p>
167
- <div
168
- v-for="c in store.configs"
169
- :key="c.blockId"
170
- class="flex items-start justify-between gap-2 rounded border border-slate-800 p-2 text-xs"
171
- >
172
- <div class="space-y-0.5">
173
- <div class="font-mono text-slate-300">{{ c.blockId }}</div>
174
- <div class="text-slate-400">
175
- monitors: {{ c.monitorIds.join(', ') || '—' }} · slos:
176
- {{ c.sloIds.join(', ') || '—' }}
177
- <span v-if="c.envTag"> · env: {{ c.envTag }}</span>
178
- </div>
179
- </div>
180
- <UButton
181
- icon="i-lucide-trash-2"
182
- color="error"
183
- variant="ghost"
184
- size="xs"
185
- :loading="busy"
186
- @click="removeMapping(c.blockId)"
187
- />
188
- </div>
189
-
190
- <div class="space-y-2 rounded border border-dashed border-slate-700 p-2">
191
- <UFormField label="Service frame block id">
192
- <UInput v-model="draft.blockId" placeholder="blk_…" />
193
- </UFormField>
194
- <div class="grid grid-cols-2 gap-2">
195
- <UFormField label="Monitor ids">
196
- <UInput v-model="draft.monitorIds" placeholder="123, 456" />
197
- </UFormField>
198
- <UFormField label="SLO ids">
199
- <UInput v-model="draft.sloIds" placeholder="abc, def" />
200
- </UFormField>
201
- </div>
202
- <UFormField label="Env tag (optional)">
203
- <UInput v-model="draft.envTag" placeholder="prod" />
204
- </UFormField>
205
- <UButton :loading="busy" :disabled="!draft.blockId" @click="addMapping">
206
- Add mapping
207
- </UButton>
208
- </div>
209
- </section>
210
- </div>
211
- </template>
212
- </UModal>
213
- </template>