The central CLI orchestration tool for the ObjectStack documentation platform.
This CLI acts as the unified interface for developing, building, and translating the ObjectStack documentation. It wraps the application logic in @objectdocs/site and adds workflow automation.
- Site Orchestration: Manages the Next.js development server and static build process.
- AI Translation: Automatically translates MDX documentation from English to Chinese using OpenAI.
- Artifact Management: Handles build output movement and directory structure organization.
- Smart Updates: Can process specific files or bulk translate the entire documentation.
This package is part of the monorepo workspace. Install dependencies from the root:
pnpm installBefore using the development or build commands, you need to initialize the site:
# Initialize ObjectDocs site in content/.fumadocs
pnpm objectdocs initThis command:
- Copies the
@objectdocs/sitepackage tocontent/.fumadocs - Installs necessary dependencies
- Automatically adds
content/.fumadocsto.gitignore - Prepares your project for local development
The CLI can also be used to run the documentation site locally with a VitePress-like experience.
# Start Dev Server
# Usage: pnpm objectdocs dev [docs-directory]
pnpm objectdocs dev ./content/docs
# Build Static Site
# Usage: pnpm objectdocs build [docs-directory]
pnpm objectdocs build ./content/docsThe translate command reads English documentation from content/docs/*.mdx and generates Chinese translations as *.cn.mdx files in the same directory using the dot parser convention.
Prerequisites:
You must set the following environment variables (in .env or your shell):
OPENAI_API_KEY=sk-...
OPENAI_BASE_URL=https://api.openai.com/v1 # OptionalCommands:
# Translate a specific file
pnpm objectdocs translate content/docs/00-intro/index.mdx
# Translate multiple files
pnpm objectdocs translate content/docs/00-intro/index.mdx content/docs/01-quickstart/index.mdx
# Translate all files in content/docs
pnpm objectdocs translate --all
# Specify a custom model (default: gpt-4o)
pnpm objectdocs translate --all --model gpt-4-turboIn CI environments, you can use the CHANGED_FILES environment variable to translate only modified files:
export CHANGED_FILES="content/docs/new-page.mdx"
pnpm objectdocs translate