TypeScript-based documentation generator for E2B SDKs with automatic versioning, caching, and CI/CD integration.
- Multi-SDK Support: JS, Python, CLI, Code Interpreter, Desktop SDKs
- Automatic Version Discovery: Detects and generates missing versions
- Intelligent Caching: Skips reinstalling dependencies when lockfile unchanged
- Idempotent: Safe to run repeatedly, only generates what's missing
- Full Visibility: Complete logging of all subcommands for debugging
- Verification: Validates generated docs before finalizing
- CI/CD Ready: GitHub Actions integration with safety checks
# generate all SDKs, all versions pnpm run generate # generate specific SDK, latest version pnpm run generate --sdk js-sdk --version latest # generate specific version pnpm run generate --sdk python-sdk --version v2.8.0 # limit to last N versions (useful for testing) pnpm run generate --sdk all --version all --limit 5 # force regenerate existing versions (useful after config changes) pnpm run generate --sdk js-sdk --version all --force # combine flags pnpm run generate --sdk all --version all --limit 3 --forcesrc/ ├── cli.ts # Entry point with CLI argument parsing ├── generator.ts # Core SDK generation orchestration ├── navigation.ts # Mintlify navigation builder ├── types.ts # TypeScript interfaces ├── lib/ │ ├── constants.ts # Centralized magic strings │ ├── utils.ts # Pure utility functions │ ├── git.ts # Git operations (clone, tags) │ ├── checkout.ts # Manages repo checkouts and version switching │ ├── versions.ts # Version comparison and filtering │ ├── files.ts # Markdown processing and flattening │ ├── install.ts # Package manager abstraction │ └── verify.ts # Post-generation validation └── generators/ ├── typedoc.ts # JavaScript/TypeScript docs ├── pydoc.ts # Python docs └── cli.ts # CLI command docs SDKs are configured in sdks.json:
{ "sdks": { "js-sdk": { "displayName": "SDK (JavaScript)", "icon": "square-js", "order": 1, "repo": "https://github.com/e2b-dev/e2b.git", "tagPattern": "e2b@", "tagFormat": "e2b@{version}", "generator": "typedoc", "required": true, "minVersion": "1.0.0", "sdkPath": "packages/js-sdk" } } }- Required SDKs: Any failure aborts workflow
- Optional SDKs: All versions failing aborts workflow
- Partial failures: Non-required SDK with some successes continues
- Verification: Post-generation validation ensures quality
For maximum compatibility across SDK versions:
- Try pnpm install - Primary package manager with caching
- Try npm fallback - Uses npm with
--forceand--legacy-peer-deps
Each strategy visible in logs for debugging. If both strategies fail, workflow aborts.
- ✅ Package manager output (pnpm/npm/poetry/pip)
- ✅ Build tool output (TypeDoc, pydoc-markdown, CLI builds)
- ✅ File operations (copying, flattening)
- ✅ Validation results (empty files, missing frontmatter)
- ✅ Final statistics (files, SDKs, versions)
Before finalizing, the generator verifies:
- Generated Files: No empty MDX files
- Frontmatter: All files have proper frontmatter
- Structure: Valid directory structure
- docs.json: Valid JSON with correct navigation structure
# run unit tests pnpm test # run with watch mode pnpm test:watch # type check npx tsc --noEmitTests cover:
- Version comparison and filtering (10 tests)
- File operations and title casing (5 tests)
- Verification logic (7 tests)
The generator runs in GitHub Actions on:
- Manual workflow dispatch
- Automatic repository dispatch from SDK repos on release
- Scheduled sync every 15 minutes
- Go to Actions → Sync SDK Reference Documentation
- Click Run workflow
- Fill in:
- SDK:
all, or specific SDK key (e.g.,js-sdk,python-sdk,cli) - Version:
all,latest, or specific version (e.g.,v2.9.0)
- SDK:
# generate all SDKs, all versions gh workflow run sdk-reference-sync.yml -f sdk=all -f version=all # generate specific SDK, latest version gh workflow run sdk-reference-sync.yml -f sdk=js-sdk -f version=latest # generate specific version gh workflow run sdk-reference-sync.yml -f sdk=python-sdk -f version=v2.8.0SDK repositories can trigger doc generation on release:
curl -X POST \ -H "Authorization: token $GITHUB_TOKEN" \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/repos/e2b-dev/docs/dispatches \ -d '{"event_type": "sdk-release", "client_payload": {"sdk": "js-sdk", "version": "v2.9.0"}}'The sync workflow also runs on a 15-minute cron interval:
*/15 * * * * Scheduled runs default to:
- SDK:
all - Version:
all - Limit:
3 - Force:
false
This acts as a polling safety net if an SDK release event is missed, while keeping the scheduled scan bounded to the latest three versions per SDK.
The sync workflow no longer pushes directly to main.
When generated docs change, the workflow now:
- Creates or updates an automation branch
- Opens a structured pull request with trigger metadata, generation parameters, and a link to the workflow run
- Limits committed paths to
docs/sdk-reference/**anddocs.json
- Validates all generated files before committing
- Only creates a pull request if changes are detected
- Full logging visible in workflow runs
- User inputs passed via environment variables (prevents script injection)
- Checkout Reuse: Repository cloned once, versions switched via git checkout
- Version Deduplication: Batch comparison skips already-generated versions
- Parallel Generation: Could process multiple versions concurrently (future enhancement)
# install dependencies pnpm install # run generator locally pnpm run generate --sdk js-sdk --limit 1 # run tests pnpm test