Takazudo Modular Docs

Type to search...

to open search from anywhere

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:

  1. Updates the manuals listing page (app/support/manuals/page.tsx)
  2. 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 page
  • src/data/product-manual-mapping.mjs - Product-to-manual mapping data

Workflow

Step 1: Read Environment

  1. Read ZMANUALS_REPO_PATH from .env file
  2. Verify the path exists

Step 2: Sync Manuals Page

  1. Read the manual registry from ${ZMANUALS_REPO_PATH}/lib/manual-registry.ts
  2. Read current manuals list from app/support/manuals/page.tsx
  3. 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
  1. 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

  1. List all directories in ${ZMANUALS_REPO_PATH}/public/
  2. For each directory (manual), read data/manifest.json
  3. Extract productSlug, title, and manual ID
  4. Skip manuals where productSlug is null or undefined
  5. Append (日本語訳付き) suffix to each title
  6. Group manuals by productSlug
  7. 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

  1. Run pnpm typecheck to verify generated files
  2. 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/_redirects and netlify.toml must point to takazudomodular-manuals.netlify.app

Arguments

$ARGUMENTS - Optional: specific manual ID to process