Scaffold and initialize a Docusaurus project with the specific structure for the Physical AI textbook. Agent: BookArchitect
Agent: BookArchitect
Scaffold and initialize a Docusaurus project with the specific structure for the Physical AI textbook. Creates a complete documentation site with chapters, i18n support, and GitHub Pages deployment configuration.
# Full setup with defaults
.claude/skills/docusaurus-scaffold/scripts/setup.sh
# Custom configuration
.claude/skills/docusaurus-scaffold/scripts/setup.sh \
--title "Physical AI Book" \
--github-org faiqahm \
--repo hackathon_I_book \
--locales "en,ur" \
--chapters 5
# Initialize and install dependencies
.claude/skills/docusaurus-scaffold/scripts/setup.sh --install
# Initialize, install, and start dev server
.claude/skills/docusaurus-scaffold/scripts/setup.sh --install --start
| Option | Description | Default |
|---|---|---|
--title TITLE |
Site title | Physical AI Book |
--github-org ORG |
GitHub org/username | faiqahm |
--repo NAME |
Repository name | hackathon_I_book |
--locales LOCALES |
Comma-separated locales | en,ur |
--chapters N |
Number of chapters | 3 |
--install |
Run npm install after setup | off |
--start |
Start dev server (requires --install) | off |
-h, --help |
Show help message | - |
project/
โโโ docs/
โ โโโ intro.md # Introduction/Welcome page
โ โโโ chapter-1/
โ โ โโโ _category_.json # Chapter metadata
โ โ โโโ index.md # Chapter overview
โ โ โโโ lesson-1.md # Lesson content
โ โ โโโ lesson-2.md
โ โโโ chapter-2/
โ โ โโโ ...
โ โโโ chapter-3/
โ โโโ ...
โโโ i18n/
โ โโโ ur/
โ โโโ docusaurus-theme-classic/
โ โ โโโ navbar.json
โ โ โโโ footer.json
โ โโโ docusaurus-plugin-content-docs/
โ โโโ current/
โ โโโ intro.md
โ โโโ chapter-1/
โ โโโ ...
โโโ src/
โ โโโ css/
โ โ โโโ custom.css # RTL support for Urdu
โ โโโ pages/
โ โโโ index.js # Homepage redirect
โโโ static/
โ โโโ img/
โ โโโ favicon.svg
โโโ docusaurus.config.js # Main configuration
โโโ sidebars.js # Sidebar configuration
โโโ package.json
docusaurus.config.js
sidebars.js
Each chapter follows this structure:
# Chapter N: Title
## Learning Objectives
- Objective 1
- Objective 2
## Prerequisites
- Prerequisite 1
## Content
(Main lesson content)
## Exercises
1. Exercise 1
2. Exercise 2
## Summary
Key takeaways from this chapter.
## Next Steps
Link to next chapter or related content.
File: docusaurus.config.js
const config = {
title: 'Physical AI Book',
tagline: 'Learn Physical AI, ROS 2, and Robotics',
favicon: 'img/favicon.svg',
// GitHub Pages deployment
url: 'https://faiqahm.github.io',
baseUrl: '/hackathon_I_book/',
organizationName: 'faiqahm',
projectName: 'hackathon_I_book',
// Enable Mermaid for Diagrams
markdown: {
mermaid: true,
},
themes: ['@docusaurus/theme-mermaid'],
// i18n configuration
i18n: {
defaultLocale: 'en',
locales: ['en', 'ur'],
localeConfigs: {
en: { label: 'English', direction: 'ltr' },
ur: { label: 'ุงุฑุฏู', direction: 'rtl', htmlLang: 'ur-PK' },
},
},
// ... rest of config
};
File: src/css/custom.css
/* RTL Support for Urdu */
html[dir='rtl'] {
direction: rtl;
}
html[dir='rtl'] .navbar__items {
flex-direction: row-reverse;
}
html[dir='rtl'] .markdown {
text-align: right;
}
/* Urdu font family */
html[lang='ur'] {
font-family: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', serif;
}
File: docs/chapter-N/index.md
---
sidebar_position: N
---
# Chapter N: [Title]
## Learning Objectives
By the end of this chapter, you will be able to:
- [ ] Objective 1
- [ ] Objective 2
- [ ] Objective 3
## Prerequisites
Before starting this chapter, ensure you understand:
- Prerequisite 1
- Prerequisite 2
## Introduction
[Chapter introduction content]
## Key Concepts
### Concept 1
[Explanation]
### Concept 2
[Explanation]
## Hands-On Exercise
```python
# Example code
print("Hello, Physical AI!")
In this chapter, we covered:
### 4. Input Variables
| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| `site_title` | No | `Physical AI Book` | Site title in navbar |
| `github_org` | No | `faiqahm` | GitHub organization |
| `repo_name` | No | `hackathon_I_book` | Repository name |
| `locales` | No | `en,ur` | Supported locales |
| `num_chapters` | No | `3` | Chapters to scaffold |
## Usage Instructions
### Step 1: Run Setup
```bash
.claude/skills/docusaurus-scaffold/scripts/setup.sh --install
Edit the generated chapter files in docs/:
docs/intro.md - Welcome pagedocs/chapter-1/index.md - Chapter 1docs/chapter-2/index.md - Chapter 2For Urdu translations, edit files in i18n/ur/docusaurus-plugin-content-docs/current/:
# English
npm start
# Urdu
npm start -- --locale ur
# Build all locales
npm run build
# Deploy to GitHub Pages
npm run deploy
docusaurus.config.js exists with correct settingsdocs/ folder has intro and chaptersi18n/ur/ folder has translation structuresrc/css/custom.css has RTL stylesnpm start works without errorsnpm run build completes successfullyRun the test suite to validate skill functionality:
# Run all tests
.claude/skills/docusaurus-scaffold/scripts/test.sh
| Test | Description | Validates |
|---|---|---|
| 1 | --help flag works | CLI help output |
| 2 | package.json created | Basic scaffold |
| 3 | docusaurus.config.js created | Configuration |
| 4 | sidebars.js created | Sidebar config |
| 5 | docs/intro.md created | Introduction page |
| 6 | Chapter 1 with index.md | Chapter structure |
| 7 | Chapter 2 with index.md | Chapter structure |
| 8 | Chapter 3 with index.md | Chapter structure |
| 9 | Urdu navbar.json created | i18n translations |
| 10 | Urdu intro.md created | i18n content |
| 11 | RTL styles in custom.css | RTL support |
| 12 | Homepage redirect configured | Redirect component |
| 13 | Favicon created | Static assets |
| 14 | --chapters 5 creates 5 chapters | Custom chapter count |
| 15 | GitHub Actions workflow created | CI/CD pipeline |
| 16 | Mermaid in config and package.json | Diagram support |
| 17 | Chapter template has Mermaid | Diagram examples |
| 18 | --no-workflow skips workflow | Flag functionality |
/tmp/docusaurus-scaffold-test-$$โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐งช Docusaurus Scaffold Test Suite
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
[TEST] Test 1: --help flag works
[PASS] --help displays usage information
...
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Test Results
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Passed: 18
Failed: 0
โ All tests passed!
| Issue | Solution |
|---|---|
| Build fails with broken links | Check internal links use relative paths |
| Urdu text not RTL | Verify direction: 'rtl' in config |
| Sidebar not showing | Check _category_.json in each chapter folder |
| npm start fails | Delete node_modules, run npm install |
| Locale not switching | Clear browser cache, check i18n config |
The default scaffold creates these chapters:
| Chapter | Title | Topics |
|---|---|---|
| Intro | Welcome to Physical AI | Overview, prerequisites, how to use |
| 1 | Introduction to Physical AI & ROS 2 | What is Physical AI, ROS 2 basics |
| 2 | Simulation with Gazebo | Virtual environments, robot simulation |
| 3 | Vision-Language-Action Models | VLA concepts, integration |
github-pages-deploy - Deploy the siteurdu-rtl-styler - Enhanced RTL stylingvercel-fastapi-link - Backend APITest Suite & Bug Fixes
scripts/test.sh) with 18 assertions/tmp directory with automatic cleanupset -e compatibility((PASSED++)) to PASSED=$((PASSED + 1)).github directory* doesn't match dot-prefix directoriesrm -rf "$DIR" instead of rm -rf "$DIR"/*Enhanced Deployment & Diagrams
--deploy flag for automated GitHub Pages deployment--build flag to run build after install.github/workflows/deploy.yml)@docusaurus/theme-mermaid)--no-workflow and --no-mermaid flags to skip featuresInitial Release