|
1 | | -Photon Docs |
| 1 | +# Photon Docs |
2 | 2 |
|
3 | | -AI-assisted writing |
| 3 | +The documentation site at [photon.codes](https://photon.codes/), built with [Mintlify](https://mintlify.com/) and driven by [vellum](https://github.com/photon-hq/vellum). Vellum extracts type information from installed npm packages and renders `.mdx.vel` templates into the `.mdx` files Mintlify ships. |
4 | 4 |
|
5 | | -Set up your AI coding tool to work with Mintlify: |
| 5 | +## How to edit |
6 | 6 |
|
7 | | -```bash |
8 | | -npx skills add https://mintlify.com/docs |
9 | | -``` |
| 7 | +1. **Edit the source, not the output.** Sources live in [`docs-src/`](docs-src/) as `.mdx.vel` files. The rendered `.mdx` files at the repo root are build artifacts — gitignored on `main`, only present on the `dist` branch. Don't edit them directly; they get overwritten on every deploy. |
10 | 8 |
|
11 | | -This command installs Mintlify's documentation skill for your configured AI tools like Claude Code, Cursor, Windsurf, and others. The skill includes component reference, writing standards, and workflow guidance. |
| 9 | +2. **Render and preview locally:** |
12 | 10 |
|
13 | | -See the [AI tools guides](/ai-tools) for tool-specific setup. |
| 11 | + ```bash |
| 12 | + pnpm install |
| 13 | + pnpm docs:generate # vellum: .mdx.vel -> .mdx |
| 14 | + mint dev # preview at http://localhost:3000 |
| 15 | + ``` |
14 | 16 |
|
15 | | -Development |
| 17 | + If you don't have the Mintlify CLI: `npm i -g mint`. |
16 | 18 |
|
17 | | -Install the [Mintlify CLI](https://www.npmjs.com/package/mint) to preview your documentation changes locally. To install, use the following command: |
| 19 | +3. **Verify before opening a PR:** |
18 | 20 |
|
19 | | -``` |
20 | | -npm i -g mint |
21 | | -``` |
| 21 | + ```bash |
| 22 | + pnpm lint |
| 23 | + pnpm typecheck:docs |
| 24 | + ``` |
22 | 25 |
|
23 | | -Run the following command at the root of your documentation, where your `docs.json` is located: |
| 26 | +4. **Open the PR against `main`.** Don't commit rendered `.mdx` files — they're regenerated by CI. |
24 | 27 |
|
25 | | -``` |
26 | | -mint dev |
27 | | -``` |
| 28 | +## How deployment works |
28 | 29 |
|
29 | | -View your local preview at `http://localhost:3000`. |
| 30 | +Push to `main` → [.github/workflows/deploy-dist.yml](.github/workflows/deploy-dist.yml) runs `pnpm docs:generate` and force-pushes the rendered tree to the `dist` branch → Mintlify rebuilds from `dist`. |
30 | 31 |
|
31 | | -Publishing changes |
| 32 | +The Spectrum API reference is generated from a remote OpenAPI spec configured in [docs.json](docs.json), fetched at build time, so every rebuild picks up the latest API surface without a docs commit. |
32 | 33 |
|
33 | | -Install our GitHub app from your [dashboard](https://dashboard.mintlify.com/settings/organization/github-app) to propagate changes from your repo to your deployment. Changes are deployed to production automatically after pushing to the default branch. |
| 34 | +## Auto-updates from SDK releases |
34 | 35 |
|
35 | | -Need help? |
| 36 | +When a connected SDK ships a release (e.g., [`spectrum-ts`](https://github.com/photon-hq/spectrum-ts), [`advanced-imessage-ts`](https://github.com/photon-hq/advanced-imessage-ts)), its release workflow calls [`photon-hq/buildspace/.github/workflows/update-docs.yaml`](https://github.com/photon-hq/buildspace/blob/main/.github/workflows/update-docs.yaml). That workflow uses Claude Code to draft a `docs/update-{sdk}-v{version}` PR here, bumping the package and updating any prose or types that drifted. Older PRs for the same SDK are auto-closed by [.github/workflows/close-stale-version-prs.yml](.github/workflows/close-stale-version-prs.yml). |
36 | 37 |
|
37 | | -Troubleshooting |
| 38 | +To enroll a new SDK, add `.github/workflows/update-docs.yaml` to its repo following the pattern in [advanced-imessage-ts](https://github.com/photon-hq/advanced-imessage-ts/blob/main/.github/workflows/update-docs.yaml). |
38 | 39 |
|
39 | | -If your dev environment isn't running: Run `mint update` to ensure you have the most recent version of the CLI. |
40 | | -If a page loads as a 404: Make sure you are running in a folder with a valid `docs.json`. |
| 40 | +## Troubleshooting |
41 | 41 |
|
42 | | -Resources |
43 | | - |
44 | | -Mintlify documentation](https://mintlify.com/docs) |
| 42 | +- **`mint dev` shows 404s:** make sure you're running it at the repo root where `docs.json` lives, and that `pnpm docs:generate` completed without errors first. |
| 43 | +- **CLI behaves oddly:** `mint update`. |
| 44 | +- **OpenAPI looks stale on the live site:** trigger the docs rebuild so Mintlify re-fetches the spec — push any commit to `main`, or fire the `repository_dispatch` from the relevant backend release. |
0 commit comments