Files
supabase/apps/docs/data/monitoring-agents.utils.test.ts
T
Steven EubankandClaude Opus 4.8 26010d80ce docs(observability): rename "Hire an agent" to "Agent prompts" (#51148)
The "Hire an agent" and "monitor" wording oversold the feature: it is
just a prompt you give an agent to check health, security, performance,
or resources, optionally on a schedule. Rename the group to "Agent
prompts", drop "monitor" from the four child pages (Health, Security,
Performance, Resources), and use plainer framing across the landing page
and observability hub. URL slugs are unchanged.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Documentation**
* Renamed the Observability section to “Agent prompts” and updated its
page titles and descriptions to describe project checks.
* Clarified that prompts read project data without changing it, and that
findings can be sent through existing harness connections.
* Updated setup guidance to refer to running prompts and using “checks”
in task names.
* Renamed the Health, Security, Performance, and Resources entries. The
related links, schedules, and reporting details remain unchanged.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-10-01 23:20:06 +00:00

84 lines
2.3 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { monitoringAgents } from './monitoring-agents.data'
import {
getCronExpression,
getMonitoringAgent,
getMonitoringAgentHarnesses,
getScheduleMarks,
} from './monitoring-agents.utils'
describe('getMonitoringAgent', () => {
it('returns a registered agent', () => {
expect(getMonitoringAgent('health').name).toBe('Health')
})
it('fails clearly for an unknown id', () => {
expect(() => getMonitoringAgent('missing')).toThrow('Unknown monitoring agent id: missing')
})
})
describe('getScheduleMarks', () => {
it('renders a 24-hour day for 15-minute cadence', () => {
const { window, marks } = getScheduleMarks(15)
expect(window).toBe('day')
expect(marks).toHaveLength(96)
expect(marks.filter((mark) => mark.label).map((mark) => mark.label)).toEqual([
'12am',
'6am',
'12pm',
'6pm',
])
})
it('renders a 24-hour day for hourly cadence', () => {
const { window, marks } = getScheduleMarks(60)
expect(window).toBe('day')
expect(marks).toHaveLength(24)
expect(marks[0].label).toBe('12am')
expect(marks[12].label).toBe('12pm')
})
it('renders a week for daily cadence', () => {
const { window, marks } = getScheduleMarks(1440)
expect(window).toBe('week')
expect(marks.map((mark) => mark.label)).toEqual([
'Mon',
'Tue',
'Wed',
'Thu',
'Fri',
'Sat',
'Sun',
])
})
})
describe('getCronExpression', () => {
it('maps supported intervals', () => {
expect(getCronExpression(15)).toBe('*/15 * * * *')
expect(getCronExpression(60)).toBe('0 * * * *')
expect(getCronExpression(1440)).toBe('0 9 * * *')
})
})
describe('getMonitoringAgentHarnesses', () => {
it('uses a Claude routine for hourly health checks', () => {
const claude = getMonitoringAgentHarnesses(monitoringAgents.health).find(
(harness) => harness.key === 'claude'
)
expect(claude?.intro).toContain('Create a Claude routine')
expect(claude?.note).toBeUndefined()
})
it('omits the Desktop-task note when the cadence is hourly or slower', () => {
const claude = getMonitoringAgentHarnesses(monitoringAgents.performance).find(
(harness) => harness.key === 'claude'
)
expect(claude?.intro).toContain('Create a Claude routine')
expect(claude?.note).toBeUndefined()
})
})