mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 01:45:10 +03:00
## Problem on monitoring agent pages the prompt lives in a "prompt" tab next to agent ones, while each agent tab ended with "paste the prompt" users have to work out that the prompt is sitting in that previous tab ## Solution this pr is a proposal to set agent setup as a two stepper `1` for the prompt panel `2` holds the agent tabs: - extracts prompt into a first step - moves agent tabs within their own step - polishes agent docs to match recent ui updates - sets `prompt` as an anchor link within agent tabs | state | preview | | -------|------| | before | <img width="823" height="452" alt="image" src="https://github.com/user-attachments/assets/a6a01832-ea73-48c1-b31d-25a0ef970e4e" /> | | after | <img width="823" height="716" alt="image" src="https://github.com/user-attachments/assets/f5014ad0-1555-4578-b4b1-5bf2733b4d37" /> | <!-- ## Preview links If relevant, include links to changed pages for easy review access. Copy the preview base URL from the Vercel bot comment on this PR. Use the following table as an example template. | Site | Live | Preview | Search for | | -------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | ----------------------------- | | WWW | [/blog/your-post](https://supabase.com/blog/your-post) | [/blog/your-post](https://zone-www-dot-com-git-branch-name-supabase.vercel.app/blog/your-post) | unique phrase from the change | | Docs | [/docs/guides/your-page](https://supabase.com/docs/guides/your-page) | [/docs/guides/your-page](https://docs-git-branch-name-supabase.vercel.app/docs/guides/your-page) | unique phrase from the change | | Studio | [/dashboard](https://supabase.com/dashboard) | [/dashboard](https://studio-git-branch-name-supabase.vercel.app/dashboard) | unique phrase from the change | | Design system | [/design-system](https://supabase.com/design-system) | [/design-system](https://design-system-git-branch-name-supabase.vercel.app/design-system) | unique phrase from the change | | UI library | [/library](https://supabase.com/library) | [/library](https://ui-library-git-branch-name-supabase.vercel.app/library) | unique phrase from the change | | Knowledge base | [/kb/guides/your-page](https://supabase.com/kb/guides/your-page) | [/kb/guides/your-page](https://kb-git-branch-name-supabase.vercel.app/kb/guides/your-page) | unique phrase from the change | --> <!-- ## Additional context Optionally add any other context or screenshots. --> ## Review instructions Provide a clear numbered procedure that the PR reviewer can walk through. 1. visit [/automate-with-agents/health](https://docs-git-docs-agent-setup-stepper-supabase.vercel.app/docs/guides/observability/automate-with-agents/health#set-up-the-agent) ## Checklist Check all before review: - [x] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [x] If I wrote a new docs topic or edited an existing topic, I used the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs [style guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Agent setup instructions are organized into prompt-copying and scheduling steps, with links to harness documentation. * Code tabs support icons and controlled selection. * Source code samples support adjustable footer notches. * **Bug Fixes** * Step numbers now display the correct shadow. * Links to page anchors now scroll to, focus, and highlight their targets, while respecting reduced-motion preferences. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
53 lines
2.1 KiB
TypeScript
53 lines
2.1 KiB
TypeScript
import { getMonitoringAgent, getMonitoringAgentPrompt } from '~/data/monitoring-agents.utils'
|
|
import { fromMarkdown } from 'mdast-util-from-markdown'
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
import { AgentSetup } from './AgentSetup'
|
|
|
|
describe('AgentSetup markdown schema', () => {
|
|
it.each(['health', 'security', 'performance', 'usage'])(
|
|
'preserves the complete %s prompt in one code block',
|
|
(id) => {
|
|
const markdown = AgentSetup({ props: { id } })
|
|
const codeBlocks = fromMarkdown(markdown).children.filter((node) => node.type === 'code')
|
|
expect(codeBlocks).toHaveLength(1)
|
|
expect(codeBlocks[0]).toMatchObject({
|
|
lang: 'text',
|
|
value: getMonitoringAgentPrompt(getMonitoringAgent(id)),
|
|
})
|
|
}
|
|
)
|
|
|
|
it('serializes the prompt and harness setup for a registered agent', () => {
|
|
const markdown = AgentSetup({ props: { id: 'health' } })
|
|
|
|
expect(markdown).toContain('**Step 1: Copy the prompt**')
|
|
expect(markdown).toContain('**Step 2: Schedule it in your agent**')
|
|
expect(markdown).toContain('You are "Health monitor"')
|
|
expect(markdown).toContain('```text')
|
|
expect(markdown).toContain('**Claude**')
|
|
expect(markdown).toContain('**Codex**')
|
|
expect(markdown).toContain('**Cursor**')
|
|
expect(markdown).toContain('claude.ai/code/routines')
|
|
expect(markdown).toContain('`0 * * * *`')
|
|
expect(markdown).toContain('Paste the prompt.')
|
|
expect(markdown).not.toContain('](#')
|
|
expect(markdown).toContain('[Claude docs](https://code.claude.com/docs/en/routines)')
|
|
expect(markdown).toContain('[Codex docs](https://developers.openai.com/codex/app/automations)')
|
|
expect(markdown).toContain('[Cursor docs](https://cursor.com/docs/cloud-agent/automations)')
|
|
})
|
|
|
|
it('points hourly agents at Claude cloud routines', () => {
|
|
const markdown = AgentSetup({ props: { id: 'performance' } })
|
|
|
|
expect(markdown).toContain('claude.ai/code/routines')
|
|
expect(markdown).not.toContain('Desktop scheduled task')
|
|
})
|
|
|
|
it('fails clearly for an unknown agent', () => {
|
|
expect(() => AgentSetup({ props: { id: 'missing' } })).toThrow(
|
|
'Unknown monitoring agent id: missing'
|
|
)
|
|
})
|
|
})
|