|
| 1 | +--- |
| 2 | +name: migrate-cppref-page |
| 3 | +description: Migrate a requested cppreference page into this cppdoc repository. Use when the user asks to port a specific cppreference slug or URL such as `cpp/memory` into `src/content/docs`, preserving technical meaning while rewriting the page into CppDoc MDX with existing components, revision metadata, and internal links. |
| 4 | +--- |
| 5 | + |
| 6 | +# Migrate Cppref Page |
| 7 | + |
| 8 | +Migrate one cppreference page into the local `cppdoc` checkout. |
| 9 | + |
| 10 | +Resolve the destination from `migrate/slug_map.json`, study nearby migrated pages, then write or update the corresponding MDX page under `src/content/docs`. |
| 11 | + |
| 12 | +## Workflow |
| 13 | + |
| 14 | +1. Parse the requested cppreference page slug or URL. |
| 15 | +2. Read [`references/workflow.md`](./references/workflow.md). |
| 16 | +3. Find the destination slug in `migrate/slug_map.json`. |
| 17 | +4. Stop and ask the user if the slug map entry is missing or `null`. |
| 18 | +5. Fetch or read the cppreference source page, then inspect existing cppdoc pages in the same area before writing anything. |
| 19 | +6. Create or update the target MDX page with repo-native structure and components. |
| 20 | +7. Run `npm run format` after editing files. |
| 21 | + |
| 22 | +## Working Rules |
| 23 | + |
| 24 | +- Treat this as a repo migration task, not a literal HTML-to-MDX transcription task. |
| 25 | +- Preserve technical meaning, declarations, examples, headings, notes, and revision distinctions from cppreference. |
| 26 | +- Prefer the layout and phrasing patterns already used by neighboring cppdoc pages over mechanically copying cppreference markup. |
| 27 | +- Use existing CppDoc components instead of raw HTML whenever a matching component exists. |
| 28 | +- If no matching component exists, think whether a new component is valuable and ask the user whether to create it. |
| 29 | +- Keep imports minimal and consistent with current files in the destination area. |
| 30 | +- Keep each prose paragraph on a single source line when practical. |
| 31 | +- Use double quotes and explicit semicolons in any TypeScript or JavaScript edits. |
| 32 | +- Leave `_meta.yml` alone unless a missing section label makes the new page unreachable or inconsistent. |
| 33 | + |
| 34 | +## Destination And Source |
| 35 | + |
| 36 | +- Resolve the CppDoc slug from `migrate/slug_map.json`. If you cannot find the corresponding CppDoc slug in this JSON file, stop and ask the user to update the slug map before proceeding. |
| 37 | +- Write the page to `src/content/docs/<cppdoc-slug>.mdx`. |
| 38 | +- If the user gives a slug like `cpp/memory`, infer the source URL as `https://en.cppreference.com/w/cpp/memory.html`. |
| 39 | +- If web access is unavailable, ask the user for the source page contents or a local artifact instead of guessing. |
| 40 | + |
| 41 | +## Page Construction |
| 42 | + |
| 43 | +- Start from a clean frontmatter block with `title`. |
| 44 | +- Add `cppdoc.revision` when the whole page is bounded by a language revision range. |
| 45 | +- Reuse established components such as `DocLink`, `DeclDoc`, `Decl`, `DescList`, `Desc`, `ParamDocList`, `ParamDoc`, `Revision`, `RevisionBlock`, `CHeader`, `CppHeader`, `Missing`, and `Incomplete` where appropriate. |
| 46 | +- Prefer `DocLink` for internal cross references and convert cppreference links to absolute cppdoc destinations. |
| 47 | +- Avoid native HTML tables and other raw layout tags unless no existing component or simple Markdown structure can express the content. |
| 48 | +- Mark intentionally unmigrated targets with `Missing` rather than inventing destinations. |
| 49 | +- Keep examples, return values, notes, and see-also sections when they materially help readers. |
| 50 | + |
| 51 | +## Validation |
| 52 | + |
| 53 | +- Check that the destination file path matches the slug map entry. |
| 54 | +- Check imports for unused or missing components. |
| 55 | +- Check revision annotations at both page level and block level. |
| 56 | +- Check that internal links point to plausible cppdoc paths. |
| 57 | +- Run `npm run format`. |
| 58 | +- Report any unresolved mapping gaps, missing components, or source ambiguities in the final response. |
0 commit comments