SDK docs generated-content pipeline
Thesdk/ section has a sync script (sync-sdk-docs.ts) that auto-generates certain documentation files from source files. This prevents manual drift and ensures code examples are type-checked.
Writing standards: Follow the canonical standards in writing-standards-dev-docs. Do not use em-dashes or Title Case headings even if older SDK pages do.
When to use
- Editing anything under
sdk/,snippets/sdk/, orsrc/sdk/ - Adding a new code example to SDK docs
- Troubleshooting why an SDK doc edit was reverted
- Understanding what can and cannot be hand-edited
The one rule
Any file whose first line is:Regeneration command
@zapier/zapier-sdk or @zapier/zapier-sdk-cli packages are behind the latest npm release. Follow its advice (pnpm update --latest <pkg>, re-run sync) when freshness matters. Treat package updates as dependency changes — get approval before running installs.
Source to output map
Output in snippets/sdk/ | Source | To change it |
|---|---|---|
example-*.mdx, cli-*.mdx (code snippets), installation.mdx, init-*.mdx | src/sdk/snippets/<same-name>.ts or .sh | Edit the source, run pnpm run sync-sdk |
api-reference.mdx, experimental-api-reference.mdx | README of node_modules/@zapier/zapier-sdk | Upstream: change the SDK package’s README, publish, update the package here, re-sync |
cli-commands.mdx, experimental-cli-commands.mdx | README of node_modules/@zapier/zapier-sdk-cli | Same upstream path, CLI package |
setup-prompt-cards.mdx, setup-prompt-display.mdx | src/sdk/setup-prompt.txt + src/sdk/web-setup-prompt.txt | Edit the .txt prompts, re-sync |
cli-setup-prompt-cards.mdx, cli-setup-prompt-display.mdx | src/sdk/cli-prompt.txt + src/sdk/cli-web-prompt.txt | Edit the .txt prompts, re-sync |
snippets/sdk/ (no DO NOT EDIT header):
vars.mdx— re-exportsappCount/appCountExactfrom/snippets/app-directory-stats.mdx. Editable, rarely needs it.
sdk/*.mdx (the actual pages) is hand-written and freely editable. sdk/reference.mdx and sdk/cli-reference.mdx are thin shells that import generated snippets — edit their framing prose, but never inline reference content into them.
How the experimental split works
sync-sdk-docs.ts splits the package READMEs by H2 section: headings ending in (Experimental) route to the experimental-* outputs; everything else goes to the stable outputs. Whether a method or command appears in the stable or experimental reference is decided upstream in the package README, not in this repo.
Adding a new code example
- Create a new source file in
src/sdk/snippets/(e.g.,example-foo.tsorexample-foo.sh). - File extension determines the code fence language (
.ts→typescript,.sh→bash). - Run
pnpm run sync-sdk— this type-checks.tsfiles and generatessnippets/sdk/example-foo.mdx. - Import the generated component in the consuming page:
Pre-flight before any edit
head -1the target file.DO NOT EDITheader → find the source in the table above.- If the source is a package README → the change is upstream; report it in your summary instead of editing locally.
- After regenerating,
git diffand confirm only the intended snippets changed. A stale installed package version can produce unrelated reference churn — flag it instead of committing the churn.
App count variables
Do not hardcode “8,000+ apps” in prose. Import from/snippets/sdk/vars.mdx: