Files
supabase/apps/docs/internals/markdown-sources.ts
Greg Richardson 029b6faf0c docs: add post-quantum readiness checkup AI prompt (#54651)
## Problem

We need a place to host a post-quantum security agent prompt which will
act as a CTA for users when we provide advice on how to keep their
projects secure.

## Solution

Add to https://supabase.com/docs/guides/ai-tools/ai-prompts as a short
term solution to get this live today, with the longer term goal of
rolling it into our [agent
skill](https://github.com/supabase/agent-skills).

## Additional context
`/ai-prompts` pages weren't rendering with the `*.md` extension, so I
added a tiny bit of logic to include them. Also modernized the AI
prompts sections as a whole which was quite outdated (pre-skill era).

## Review priority

- [ ] Critical: needs a review as soon as possible
- [x] Urgent: the feature ships soon, or it's blocking something else
- [ ] Moderate: good to have soon, not urgent
- [ ] Low: get to it when you can

## Review instructions

Provide a clear numbered procedure that the PR reviewer can walk
through.

1. Open
[`/docs/guides/ai-tools/ai-prompts`](https://docs-git-docs-post-quantum-security-checkup-supabase.vercel.app/docs/guides/ai-tools/ai-prompts)
and review the overview. See the new post-quantum checkup item.
2. Open
[`/docs/guides/ai-tools/ai-prompts/post-quantum-security-checkup`](https://docs-git-docs-post-quantum-security-checkup-supabase.vercel.app/docs/guides/ai-tools/ai-prompts/post-quantum-security-checkup)
to review the new prompt
3. Open
[`/docs/guides/ai-tools/ai-prompts/post-quantum-security-checkup.md`](https://docs-git-docs-post-quantum-security-checkup-supabase.vercel.app/docs/guides/ai-tools/ai-prompts/post-quantum-security-checkup.md)
to confirm the `*.md` version renders

## Checklist

Check all before review:

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] 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)
2026-12-04 15:13:05 -06:00

63 lines
1.7 KiB
TypeScript

import path from 'node:path'
import { globby } from 'globby'
export type FrontmatterFormat = 'yaml' | 'toml'
export interface MarkdownSource {
sourceFile: string
slug: string
outPath: string
frontmatter: FrontmatterFormat
/**
* `mdx` runs the file through the MDX-to-markdown pipeline. `raw` copies the
* body after frontmatter as-is: AI prompts are plain markdown written for
* agents, and text such as `<ref>` in them is not valid MDX.
*/
kind: 'mdx' | 'raw'
}
const OUTPUT_ROOT = 'public/markdown/guides'
const GUIDES_GLOB = 'content/guides/**/!(_)*.mdx'
// Read from the repo root rather than the copy codegen:examples makes, so this
// task doesn't depend on that one having run.
const PROMPTS_GLOB = '../../examples/prompts/*.md'
export function guideSlug(sourceFile: string): string {
return sourceFile.replace(/^content\/guides\//, '').replace(/\.mdx$/, '')
}
export function promptSlug(sourceFile: string): string {
return `ai-tools/ai-prompts/${path.basename(sourceFile, '.md')}`
}
export async function collectMarkdownSources(): Promise<MarkdownSource[]> {
const [guideFiles, promptFiles] = await Promise.all([
globby([GUIDES_GLOB]),
globby([PROMPTS_GLOB]),
])
const guides: MarkdownSource[] = guideFiles.map((sourceFile) => {
const slug = guideSlug(sourceFile)
return {
sourceFile,
slug,
outPath: `${OUTPUT_ROOT}/${slug}.md`,
frontmatter: 'yaml',
kind: 'mdx',
}
})
const prompts: MarkdownSource[] = promptFiles.map((sourceFile) => {
const slug = promptSlug(sourceFile)
return {
sourceFile,
slug,
outPath: `${OUTPUT_ROOT}/${slug}.md`,
frontmatter: 'yaml',
kind: 'raw',
}
})
return [...guides, ...prompts]
}