cpp26-adapter
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
**Turn your LLM coding assistant into a C++26 specialist.**
A Claude Code plugin (and standalone MCP server) that biases generation toward ISO/IEC 14882:2026 final-form idioms — reflection, contracts, senders, inplace_vector, #embed — even when your local clang hasn't caught up.
-brightgreen)
Quick Start
**Full plugin** (Claude Code — skill + MCP + reviewer + hooks + slash command):
**MCP server only** (any MCP-compatible client):
What it does
Six concrete idiom shifts on the same prompts a vanilla LLM would answer with pre-C++26 patterns:
| You ask for… | Vanilla LLM emits | cpp26-adapter emits |
|---|---|---|
| enum → string | X-macros / magic_enum | std::meta::enumerators_of(^^E) + template for |
| precondition | assert(x > 0) | pre(x > 0) / contract_assert(...) |
| async pipeline | std::async(...) | ex::just \| ex::then \| ex::sync_wait |
| fixed-capacity vector | boost::static_vector | std::inplace_vector |
| embed binary asset | objcopy / xxd / incbin | #embed "asset.bin" |
| Nth pack element | std::get (std::forward_as_tuple(args...)) | args...[N] |
The hook — ask for "enum to string"
Vanilla falls back to X-macros. With cpp26-adapter — straight from P2996 reflection + P1306 expansion statements:
No macros. No third-party dep. No codegen. More side-by-side examples (contracts, senders, #embed): docs/examples.md.
Compatible clients
| Client | Recommended path |
|---|---|
| Claude Code | /plugin install (full plugin: skill + MCP + reviewer + hooks) |
| Claude Desktop | cpp26-ref MCP server via stdio (config below) |
| Cursor | cpp26-ref MCP server via stdio |
| VS Code (Cline / Continue) | cpp26-ref MCP server via stdio |
| Any other MCP client | cpp26-ref MCP server via stdio |
Configuration
Claude Code
After /plugin install cpp26-adapter@parasxos/claude-plugins, everything wires itself up: the skill loads into context, the MCP starts on demand, the reviewer subagent is callable as @cpp26-reviewer, the hook lints on every C++ edit, and /cpp26-init is available.
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
Requires pip install cpp26-ref on a Python (≥3.11) reachable from the Claude Desktop process.
Cursor / VS Code / generic MCP client
Verify the install
After install + restart, three sanity checks:
1. Ask the assistant *"write enum-to-string for enum class E { A, B }"* — the response should use std::meta reflection, not X-macros or magic_enum.
2. (Full plugin only) Run @cpp26-reviewer src/foo.cpp — should return a YAML report with status: pass | needs-changes | compiler-lag-only.
3. (Full plugin only) Run /cpp26-init in an empty directory — the scaffolded CMakeLists.txt should build a #include + std::print("hi\n") hello-world.
MCP tools
The cpp26-ref server exposes three stdio tools over MCP, in-memory over 216 indexed C++26 papers (no SQLite, no embeddings, no build step):
| Tool | Signature | Returns |
|---|---|---|
| lookup_paper | (paper_id: str) — e.g. "P2996" | Full reference: title, problem statement, key syntax, canonical example, pre-C++26 equivalent, gotchas, related papers |
| search | (query: str, limit: int = 5) | Top-N papers ranked by rapidfuzz partial-ratio against title + frontmatter |