This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is the HAMi documentation website built with Docusaurus 3. HAMi is an open-source GPU virtualization solution for heterogeneous AI computing. The site serves as the primary documentation portal and official website.
Key URLs:
- Website: https://project-hami.io/
- GitHub Repo: https://github.com/Project-HAMi/HAMi
- Docs Repository: https://github.com/Project-HAMi/website
npm run startStarts a local development server with hot-reloading. Opens a browser window automatically.
npm run buildGenerates static content into the build directory. Used for deployment.
npm run serveServes the built site locally to test production output before deploying.
npm run fetch-changelog <version>Example:
npm run fetch-changelog 2.6.0Fetches release information from GitHub API and updates changelog files. Requires GH_PAT environment variable for authentication.
npm run clearClears Docusaurus cache and generated files. Useful when troubleshooting build issues.
npm run write-translationsExtracts translatable strings for i18n.
GIT_USER=<Your GitHub username> USE_SSH=true yarn deployBuilds and deploys the website to the gh-pages branch for GitHub Pages hosting.
- Config file:
docusaurus.config.js - Node version: 18 (required - see
netlify.tomland.github/workflows/pr-test.yml) - Default locale: English (
en) - Supported locales: English, Chinese (
zh)
Documentation (docs/):
- Organized by categories defined in
sidebars.js - Main sections:
- Core Concepts
- Key Features
- Get Started
- Installation (including device-specific guides for NVIDIA, Cambricon, Hygon, Mthreads, Iluvatar, Enflame, AWS Neuron, Kunlunxin, Metax, Ascend)
- User Guide (with monitoring and device-specific subsections)
- Developer Guide
- Contributor Guide
- Troubleshooting
- FAQ
Multi-version documentation:
- Current version in
docs/ - Historical versions in
versioned_docs/version-vX.Y.Z/ - Version list in
versions.json - When adding new versions, use
npm run docusaurus docs:version <version>
Blog (blog/):
- Standard Docusaurus blog with YYYY-MM-DD-title directory structure
Changelog:
- Source file:
CHANGELOG.mdin root - Custom plugin:
src/plugins/changelog/index.js - Parses CHANGELOG.md and generates blog posts at
/changelog - Extracts committers and creates author profiles
- Generated files go to
changelog/source/
Chinese translations:
- Location:
i18n/zh/ - Structure mirrors
docs/but with translated content - Sidebar labels:
i18n/zh/docusaurus-plugin-content-docs/current.json - When editing English docs, consider if Chinese translation needs updating
Location: src/components/
button.js- Custom button componentfeaturesList.js- Features displaygitHubButton.js- GitHub integration buttonsupportersList.js- Supporters/community displaywhatIs.js- "What is HAMi" content component
Custom Pages:
src/pages/index.js- Homepagesrc/pages/adopters.mdx- Adopters page
src/css/custom.css- Global CSS overridessrc/pages/styles.module.css- Homepage styles
Algolia:
- App ID: IWSUKSVX6L
- Index: project-hami
- Contextual search enabled for version/language awareness
- Configured in
docusaurus.config.js
Location: static/
img/- Images (logos, diagrams, screenshots)favicons/- Website favicons in multiple sizesCNAME- Custom domain record for project-hami.io
-
Create markdown file in appropriate
docs/subdirectory -
Add entry to
sidebars.jsin the relevant category -
Follow existing frontmatter patterns:
--- title: Page Title sidebar_label: Short Title ---
-
If updating Chinese content, mirror changes in
i18n/zh/docusaurus-plugin-content-docs/current/
The documentation follows a consistent pattern for each hardware device type (NVIDIA, Cambricon, Hygon, etc.):
- Main guide:
userguide/<Device>-device/enable-<device>-sharing.md - Resource specification:
specify-device-memory-usage.md,specify-device-core-usage.md - Type selection:
specify-device-type-to-use.md,specify-device-uuid-to-use.md - Examples:
examples/subdirectory with common use cases
When releasing a new HAMi version:
- Run
npm run fetch-changelog <version>to update changelog - Use
npm run docusaurus docs:version <version>to version current docs - Update
versions.jsonif needed
Important: Do NOT edit files in changelog/source/ directly. They are auto-generated.
Edit CHANGELOG.md in the root directory instead. The changelog plugin will:
- Parse sections starting with
## - Extract committers from
#### Committers:sections - Generate blog posts with proper frontmatter
- Create author profiles with GitHub images
The site uses Prism.js with additional languages:
- bash
- diff
- json
Add more in docusaurus.config.js under prism.additionalLanguages.
The changelog plugin (src/plugins/changelog/index.js) is a customized Docusaurus blog plugin that:
- Reads
CHANGELOG.mdfrom repository root - Parses markdown sections into blog posts
- Extracts GitHub author information from commit references
- Generates custom blog list and post components
- Watches
CHANGELOG.mdfor changes in development
Pull Request Tests (.github/workflows/pr-test.yml):
- Triggers on PR to
masterbranch - Runs
npm installandnpm run build - Uploads build artifact for preview
- Uses Node.js 18
- Production: Netlify (configured in
netlify.toml) - Custom domain: project-hami.io (via
static/CNAME) - Build command:
npm run build - Node version: 18
Each device vendor has a dedicated section under userguide/<Vendor>-device/:
- NVIDIA - Most comprehensive with MIG, DRA, and Volcano vGPU support
- Cambricon (MLU) - Chinese chipmaker
- Hygon (DCU) - Chinese GPU
- Mthreads - Moore Threads GPU
- Iluvatar - Chinese AI GPU
- Enflame (GCU) - Chinese AI accelerator
- AWS Neuron - AWS Inferentia/Trainium
- Kunlunxin (XPU) - Chinese AI chip
- Metax - Chinese GPU with topology-aware scheduling
- Ascend - Huawei NPU
When updating documentation:
- English content is the source of truth in
docs/ - Chinese translations in
i18n/zh/may lag behind - Check
i18n/zh/docusaurus-plugin-content-docs/current.jsonfor translated sidebar labels - Blog posts have separate i18n structure in
i18n/zh/docusaurus-plugin-content-blog/
Documentation often references external resources:
- Helm charts
- GitHub repositories
- Device vendor documentation
- Example YAML manifests
Ensure all external links are correct and use HTTPS where applicable.