mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 01:45:10 +03:00
Closes DOCS-1391 ## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Docs update. ## What is the current behavior? The docs front page is the only place that still recommends a global CLI install. It shows `npm install -g supabase` in both the CLI tab and the AI prompt, and tells the agent to run `supabase init`. Everywhere else in the docs installs the CLI as a project dev dependency, so the version is pinned in `package.json` and everyone on a team runs the same one. ## What is the new behavior? - `installCli` becomes `npm install supabase --save-dev`, matching [Install and run the CLI](https://supabase.com/docs/guides/local-development/cli/getting-started). - `initialize` becomes `npx supabase init`. A dev-dependency install leaves no global `supabase` command. - The AI prompt says "as a project dev dependency" and states the reason, so an agent doesn't fall back to a global install. - Updates the same wording in the monitoring and debugging prompt, which shares the constants. - Updates the `AiPrompt` markdown schema test assertion. ## Manual testing 1. Open the [docs front page preview](https://docs-git-docs-cli-local-install-supabase.vercel.app/docs). The AI Prompt tab reads "Install the Supabase CLI as a project dev dependency with `npm install supabase --save-dev`, so the version is pinned per project" and ends with `npx supabase init`. 2. Select the **CLI** tab. It shows `npm install supabase --save-dev` on the first line and `npx plugins add supabase-community/supabase-plugin` on the second. 3. Run `pnpm run -F docs test:local:unwatch internals/markdown-schema/AiPrompt.test.ts`. All tests pass.
56 lines
2.1 KiB
TypeScript
56 lines
2.1 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import { AiPrompt } from './AiPrompt'
|
|
|
|
describe('AiPrompt markdown schema', () => {
|
|
it('omits prompts by default', () => {
|
|
expect(AiPrompt({ props: { id: 'nextjs' } })).toBe('')
|
|
})
|
|
|
|
it('serializes an opted-in prompt from the shared registry', () => {
|
|
const markdown = AiPrompt({
|
|
props: { id: 'nextjs', includeInMarkdown: true },
|
|
})
|
|
|
|
expect(markdown).toContain('**AI Prompt**')
|
|
expect(markdown).toContain('Help me add Supabase to my Next.js project.')
|
|
expect(markdown).toContain('```text')
|
|
})
|
|
|
|
it.each([
|
|
['monitoring-agent-health', 'Health monitor', 'health'],
|
|
['monitoring-agent-security', 'Security monitor', 'security'],
|
|
['monitoring-agent-performance', 'Performance monitor', 'performance'],
|
|
['monitoring-agent-usage', 'Capacity monitor', 'usage'],
|
|
])('serializes the %s agent prompt', (id, persona, detectionSection) => {
|
|
const markdown = AiPrompt({ props: { id, includeInMarkdown: true } })
|
|
|
|
expect(markdown).toContain('**AI Prompt**')
|
|
expect(markdown).toContain(persona)
|
|
expect(markdown).toContain('read-only')
|
|
expect(markdown).toContain(
|
|
`https://supabase.com/docs/guides/observability/detecting.md#${detectionSection}`
|
|
)
|
|
expect(markdown).toContain('```text')
|
|
})
|
|
|
|
it('serializes the monitoring overview prompt', () => {
|
|
const markdown = AiPrompt({
|
|
props: { id: 'monitoring-and-debugging', includeInMarkdown: true },
|
|
})
|
|
|
|
expect(markdown).toContain('Help me monitor and debug my Supabase project.')
|
|
expect(markdown).toContain('npm install supabase --save-dev')
|
|
expect(markdown).toContain('npx plugins add supabase-community/supabase-plugin')
|
|
expect(markdown).toContain('read-only')
|
|
expect(markdown).toContain('https://supabase.com/docs/guides/observability.md')
|
|
expect(markdown).toContain('```text')
|
|
})
|
|
|
|
it('fails clearly for an unknown opted-in prompt', () => {
|
|
expect(() => AiPrompt({ props: { id: 'missing-prompt', includeInMarkdown: true } })).toThrow(
|
|
'Unknown AiPrompt id: missing-prompt'
|
|
)
|
|
})
|
|
})
|