> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tuturuuu.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Docs to Wiki import

> Plan a repeatable import from the docs repository into Wiki spaces in the root workspace.

## Scope and publication policy

Keep `apps/docs` as the source of record and render generated Markdown in
Wiki. Start with workspace-only mirrors. Require a separate publication
decision before creating a share-enabled mirror or changing public docs URLs.

Use `DOCS-WIKI-CLASSIFICATION.md` as a private review input. Its inventory at
`76e405a5b7` proposes 273 public candidates, 119 pages needing Iris review and
205 internal pages out of 597. The candidates include 84 end-user or learner
pages, 103 developer pages and 86 generated reference pages. The file flags
65 public candidates with links into held build content. Reconcile the old
paths against the exact import commit and review changed or new pages.
`ACK-CLASSIFY` must approve explicit public entries at the reviewed source
digest. Require an explicit `audience: public` tag on the source for the public
mirror. The candidate list, viewer audience tags such as `users` and passing
scans confer no publication permission. Missing rows or approvals,
`needs Iris review`, `build/devops` and `build/development-tools` stay
internal. Preserve the stricter held-build link checks.

Use an explicit root workspace ID and verify it against the authenticated
target before any write. Preserve navigation order and deterministic page
paths. Assign pages to these proposed spaces:

| Space | Scope and access |
| - | - |
| `platform-docs` | Workspace visibility. Product and learning pages safe for root workspace members. Pilot with a reviewed subset. |
| `developer-docs` | Restricted visibility. Explicitly approved developer and operator readers. Hold sensitive or borderline material out of the import until internal access and asset handling are reviewed. |
| `public-docs` | Optional dedicated space for explicitly approved public pages and approved navigation placeholders. Require verified share access and a fresh scan of the entire space. Never broaden a mixed space's visibility. |

Wiki permissions apply at space level. Managers retain access under the
current model. The public mode permits workspace membership or proof of
share access, so public classification alone does not create an anonymously
reachable canonical URL. Test the actual share flow before publishing links.
[Space access:52](https://github.com/tutur3u/platform/blob/4e3709499d/packages/wiki-core/src/source/access.ts#L52-L84)

## Conversion

The offline converter uses W1's Markdown and MDX syntax parser with static
component mappings for Wiki's Streamdown renderer. It resolves link
destinations through the pinned inventory and emits portable `.md` files
for the import CLI. MDX imports, executable expressions and unsupported
components hold the affected page for review.
[W1 parser:27](https://github.com/tutur3u/platform/blob/4e3709499d/packages/wiki-core/src/markdown-import.ts#L27-L55),
[W1 stringify:11](https://github.com/tutur3u/platform/blob/4e3709499d/packages/wiki-core/src/markdown.ts#L11-L24),
[Wiki storage:36](https://github.com/tutur3u/platform/blob/4e3709499d/apps/database/supabase/migrations/20261129033000_add_wiki_spaces_and_pages.sql#L36-L47),
[Streamdown view:158](https://github.com/tutur3u/platform/blob/4e3709499d/packages/ui/src/components/ui/wiki/wiki-markdown-view.tsx#L158-L169)

| Mintlify component | Portable Markdown |
| - | - |
| `Info`, `Note`, `Tip`, `Warning`, `Check` | Use `> [!NOTE]` for Info and Note, `> [!TIP]` for Tip, `> [!WARNING]` for Warning and `> [!IMPORTANT]` for Check. Keep nested content. |
| `Card`, `CardGroup` | Ordered-in-source list of linked card titles and descriptions. Render a plain title when a card intentionally has no link. |
| `Steps`, `Step` | Numbered list with bold step titles and indented content, including fenced code. |
| `Tabs`, `Tab` | Static labelled sections in source order with heading anchors. Preserve prose and code in each tab. Hold interactive tabs and explicit IDs for review. |
| `CodeGroup` | Sequential fenced blocks with language and visible labels. Keep whitespace and commands intact. |

[W1 component mapping:118](https://github.com/tutur3u/platform/blob/4e3709499d/packages/wiki-core/src/markdown-mdx.ts#L118-L203),
[Runtime callouts:114](https://github.com/tutur3u/platform/blob/4e3709499d/packages/wiki-core/src/source/hast.ts#L114-L143)

### Links and assets

Build the route map before conversion. Index normalized docs URLs, aliases
and actual output heading IDs. Resolve relative, root-relative and absolute
docs links, reference links and card destinations through that map. Carry
fragments onto the output heading or through a reviewed anchor alias. Verify
same-page fragments, duplicate headings, slug collisions, encoded paths,
locales and renamed pages. Use the Wiki router's canonical URL for internal
links. Check target visibility at each hop, including any redirect and
cross-space share scope. The public link graph must close over destinations
approved for the same reader.

A public page with a held, unknown, inaccessible or unresolved destination
fails validation. If edits are approved, replace a necessary reference with
safe generic prose and rescan. Drop both the URL and any title or path that
reveals held information. Block publication if an external redirect resolves
to held content. Keep tokens and private manifest details out of rendered
links, telemetry and redirects.
[Wiki URL builder:36](https://github.com/tutur3u/platform/blob/4e3709499d/apps/web/src/app/%5Blocale%5D/%28dashboard%29/%5BwsId%5D/wiki/_lib/routes.ts#L36-L48),
[W1 link policy:152](https://github.com/tutur3u/platform/blob/4e3709499d/packages/wiki-core/src/safety.ts#L152-L163)

Resolve assets inside the source tree with path containment and no symlink
escape. Record each file's hash, type, size, alt text, source and visibility.
Reuse reviewed canonical public assets, or copy vetted bytes to the approved
public storage path with content-addressed names. Use an authenticated asset
route for restricted bytes. Keep signed URLs out of Markdown. Validate media
type and size, strip sensitive metadata and reject active or unreviewed
content. Check rendered asset access with the same owner, member, share
reader and anonymous identities used for page tests.

## Sync and safety

Generate deterministic Markdown and a private manifest keyed by source path,
target workspace, space and page path. Include exact source and rendered
hashes, converter version, classification approval and destination graph.
Export target state before apply. Compare each imported path to its
last-applied digest. Hold pages with unexpected edits, archives or collisions
for explicit reconciliation. Treat renames as a move and redirect decision
and removals as an explicit archive or unpublish decision. Stable no-op
retries preserve revisions. Space manager access means a dry run plus digest
check alone cannot prevent concurrent editing. Use an exclusive write window
for the pilot. Establish server-side expected-revision checks before allowing
automated sync to run alongside editors.

Generate parent-first directories with at most 200 Markdown files per
invocation. Use explicit slug and parent front matter. Respect the 1,000,000-byte page
body cap and the CLI's 8 MiB serialized JSON request limit. Preview each
directory with `ttr wiki import SPACE STAGED_DIR --workspace ROOT_WS_ID --json`.
Review the complete plan, then repeat with `--apply` on the same immutable
staging output after target revalidation. Record the per-page receipts and
reconcile partial results before retrying. The import applies sequentially
and omits `base_revision`. The database treats identical content as unchanged.
Re-export and dry run again to prove convergence.
[CLI import:160](https://github.com/tutur3u/platform/blob/4e3709499d/packages/sdk/src/cli/wiki.ts#L160-L181),
[CLI directory and batching:20](https://github.com/tutur3u/platform/blob/4e3709499d/packages/sdk/src/cli/wiki-files.ts#L20-L87),
[Import schema:97](https://github.com/tutur3u/platform/blob/4e3709499d/packages/wiki-core/src/source/schemas.ts#L97-L110),
[SQL change detection:232](https://github.com/tutur3u/platform/blob/4e3709499d/apps/database/supabase/migrations/20261129033000_add_wiki_spaces_and_pages.sql#L232-L267)

Run `node scripts/docs-audit.js` for every sync. Apply the same hashed-term
and public-safety checks to staged Markdown, metadata, code fences, asset
references and redirects. Scan parsed visible content with
`scanPublicSafety` against the approved link graph as well. Adapt the
visibility lookup for the real dashboard or public route because W1 assumes
its own Wiki URL shape. Preserve normalization and scan normalized and
decoded links, titles and asset destinations. Validate output against the
renderer as well as the parser. Hold on any finding, scanner error or
incomplete coverage. Keep raw matches and the classification manifest out of
public receipts. Run scans before sharing and on each subsequent import.
Enforce the publication gate on the actual rendered revisions. Restrict
writes and review accessible older revisions, exports, search, backlinks and
caches before broadening access.
[Docs safety checks:58](https://github.com/tutur3u/platform/blob/4e3709499d/scripts/docs-audit.js#L58-L162),
[Wiki safety checks:213](https://github.com/tutur3u/platform/blob/4e3709499d/packages/wiki-core/src/safety.ts#L213-L251)

## Redirects and rollout

Keep docs URLs canonical during the pilot. After approval, generate explicit
one-to-one redirects from the same manifest only for validated, reachable
public destinations. Keep auth-only or token-gated destinations off the
public redirect map. Test anonymous access, legacy locale and deep links,
fragments, loops and search indexing. Anchor compatibility requires rendered
IDs or aliases because request handlers cannot inspect the URL fragment.
Introduce reversible temporary redirects first. Use permanent redirects only
after the acceptance window and keep a switch back to the original docs.
Leave held paths on the existing docs hosting policy. Wiki classification
does not change their availability on the docs site or in the repository.

| Phase | Acceptance |
| - | - |
| Inventory and review | Reconcile classification against the source SHA. Obtain `ACK-CLASSIFY` for public entries and review internal space membership. Report missing, changed or held pages. |
| Offline converter | Golden fixtures for every component, code and anchors. Deny held links and unreviewed assets. Run twice and obtain identical manifests and Markdown. |
| Workspace pilot | Exercise import, partial failure and retry against a test workspace, then use a reviewed root workspace subset. Verify reader permissions, Markdown rendering, assets, navigation and all-unchanged re-sync. |
| Public pilot | Gate on an explicitly classified cohort, complete safety scan and independent review. Verify anonymous/share access across page routes, search, exports, historical revisions and caches. Test unpublish and asset withdrawal before expanding. Reassess generated reference and its noindex behavior separately. |
| Redirects and recurring sync | Validate public destinations, support disabling the redirect map, and capture counts and revision receipts per run. Require new review for classification changes, archive or move operations and unexpected destination edits. |

## Generate the internal pilot seed

Run from a checkout containing the converter. Set `DOCS_SOURCE_SHA` to the
full source commit and `CLASSIFICATION_FILE` to the approved private
inventory. Choose a new `SEED_DIR` outside the repository under an existing
directory.

```sh theme={null}
node scripts/docs-audit.js
bun packages/wiki-core/tooling/docs-wiki/index.ts \
  --source "$DOCS_SOURCE_SHA" \
  --classification "$CLASSIFICATION_FILE" \
  --output "$SEED_DIR"
```

The converter reads tracked blobs at the pinned commit. It stages Section A
`platform/` pages tagged for users in `platform-docs` with Workspace
visibility. Eligible `build/` and `reference/` pages and in-scope Section B
pages go to `developer-docs` with Restricted visibility. Section C and
explicitly held directories stay out of both spaces. Unclassified pages
and eligible pages changed since the classification base require review.
The converter emits neither audience tags nor public share settings.

A held or unresolved destination blocks the source page. Links from
Workspace pages to Restricted pages also block. The converter repeats
validation until every remaining link and heading fragment resolves within
the staged graph. `--allow-unimported-link-text` allows an explicitly
reviewed run to keep the label for a known destination outside the final
seed. Held, inaccessible and unresolved destinations still block. The
pilot uses the default strict mode. Images and asset destinations become
external links, with pinned hashes and sizes recorded for tracked assets.
Verify external asset access separately before applying.

Keep `manifest.json` private. It records the classification and source
digests, proposed destinations, output digests, graph, assets, per-space
counts and page-level blockers. Each batch listed in the manifest is
parsed with the same directory planner as `ttr wiki import` and checked
for payload limits. Use the listed batch order and preview each batch
with the root workspace ID.

```sh theme={null}
ttr wiki import platform-docs "$SEED_DIR/platform-docs" --workspace "$ROOT_WS_ID" --json
ttr wiki import developer-docs "$SEED_DIR/developer-docs" --workspace "$ROOT_WS_ID" --json
```

For spaces split into batches, substitute each listed directory. Before
applying, verify the authenticated workspace ID, space visibility and
share-link state, and reconcile the target revisions against an export
during the exclusive write window. The offline seed does not establish
target access, renderer parity or revision state. Apply only after the
target dry run and rollout checks pass.

Run the focused converter tests with
`bun run --cwd packages/wiki-core test -- tooling/docs-wiki`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.