Anydocs Documents
CLI Commands

import - Import Legacy Documents

Import legacy Markdown or MDX content into an Anydocs project.

`import` stages legacy source content but does not turn it into canonical pages yet. The standard path is: import first, then run `convert-import` with the resulting importId.

Steps

  1. Stage the legacy directory
  2. Inspect the staged output
  3. Continue with convert-import
  4. Clean up in Studio or MCP before publishing

Stage the legacy directory

`import` reads `.md` and `.mdx` files from the source directory and writes the staged result into `imports/<importId>/` in the target project.

npx @anydocs/cli import ./legacy-docs ./my-docs-project zh

Inspect the staged output

After the import completes, inspect `imports/<importId>/manifest.json` and `items/*.json` to confirm the language, item count, and basic inferred fields.

Continue with convert-import

Once you have the `importId`, convert that batch into canonical draft pages and a navigation section.

npx @anydocs/cli convert-import <importId> ./my-docs-project

Clean up in Studio or MCP before publishing

Converted output starts as `draft`. Fill metadata, refine navigation and body content, then publish only the pages that should ship.

Supported inputs: The current import flow targets Markdown (`.md`) and MDX (`.mdx`) directories and supports directory-level batch imports.
If this is not a directory migration: If you only need an agent to turn a single Markdown file into a page, `page_create_from_markdown` or `page_update_from_markdown` is usually the better fit.