l-sync-manual-index
Sync manuals page and product-manual-mapping from zmanuals project. Use when: (1) User says 'sync manuals', (2) Manual registry in zmanuals has been updated, (3) Product manual mapping needs refresh.
Sync Manuals
Sync both the manuals index page and product-manual-mapping data from the zmanuals translation project.
This command performs two operations:
- Updates the manuals listing page (
app/support/manuals/page.tsx) - Generates the product-manual-mapping data file (
src/data/product-manual-mapping.mjs)
Environment Configuration
Requires ZMANUALS_REPO_PATH environment variable in .env:
# .env
ZMANUALS_REPO_PATH=/Users/takazudo/repos/personal/zmanuals
Files Involved
Source (zmanuals project):
${ZMANUALS_REPO_PATH}/lib/manual-registry.ts- Manual registry${ZMANUALS_REPO_PATH}/public/[manual-id]/data/manifest.json- Manual metadata
Target (this project):
app/support/manuals/page.tsx- Manuals listing pagesrc/data/product-manual-mapping.mjs- Product-to-manual mapping data
Workflow
Step 1: Read Environment
- Read
ZMANUALS_REPO_PATHfrom.envfile - Verify the path exists
Step 2: Sync Manuals Page
- Read the manual registry from
${ZMANUALS_REPO_PATH}/lib/manual-registry.ts - Read current manuals list from
app/support/manuals/page.tsx - For each manual in zmanuals registry:
- Check if it exists in the current list
- If missing, read its manifest.json to get the proper title and brand
- Add missing manuals to the appropriate brand section in
manualsData
Brand Mapping:
- Manuals starting with
oxi-→ “OXI Instruments” - Manuals starting with
addac→ “ADDAC Systems” - Add new brand sections as needed for other prefixes
Manual Entry Structure:
{ title: 'Product Name', href: '/manuals/[manual-id]/' }
Step 3: Sync Product-Manual-Mapping
- List all directories in
${ZMANUALS_REPO_PATH}/public/ - For each directory (manual), read
data/manifest.json - Extract
productSlug,title, and manual ID - Skip manuals where
productSlugis null or undefined - Append
(日本語訳付き)suffix to each title - Group manuals by
productSlug - Generate
src/data/product-manual-mapping.mjs
Manifest.json Structure:
{
"title": "OXI E16 Manual",
"brand": "OXI Instruments",
"productSlug": "oxi-e16",
"version": "1.0.0",
"totalPages": 74
}
Generated File Format:
/**
* Product to Manual Mapping
*
* Auto-generated from zmanuals project manifests.
* Do not edit manually - use /sync-manual-index command to sync.
*
* @generated
*/
const productManualMapping = {
'oxi-e16': [
{
id: 'oxi-e16-manual',
title: 'OXI E16 Manual(日本語訳付き)',
href: '/manuals/oxi-e16-manual/',
},
],
// ... more mappings
};
export function getManualsForProduct(productSlug) {
return productManualMapping[productSlug] || [];
}
export function hasManuals(productSlug) {
return productSlug in productManualMapping && productManualMapping[productSlug].length > 0;
}
export { productManualMapping };
Step 4: Validate & Commit
- Run
pnpm typecheckto verify generated files - Commit and push changes
Usage
/sync-manual-index
Example Output
Reading zmanuals project from /Users/takazudo/repos/personal/zmanuals...
=== Syncing Manuals Page ===
Found 8 manuals in registry.
Current page has 5 manuals.
Missing manuals:
- addac107-acids (ADDAC107 Acid Source)
- addac106-tnoise (ADDAC106 T-Noiseworks)
Adding to app/support/manuals/page.tsx...
=== Syncing Product-Manual-Mapping ===
Found 32 manuals with productSlug:
- oxi-e16-manual → oxi-e16
- oxi-e16-quick-start → oxi-e16
- oxi-one-mk2 → oxi-one-mk2-black
Grouped into 28 product mappings.
Generating src/data/product-manual-mapping.mjs...
=== Validation ===
Running pnpm typecheck...
✓ All checks passed.
Done. Commit and push? [y/n]
Notes
- Preserve existing order of manuals in the page
- Add new manuals at the end of their brand section
- Manual order within each product group is alphabetical by ID
- Products are sorted alphabetically by slug
- The redirect configuration in
static/_redirectsandnetlify.tomlmust point totakazudomodular-manuals.netlify.app
Arguments
$ARGUMENTS - Optional: specific manual ID to process