Skip to content

Commit 277792f

Browse files
committed
docs: chapter 00 is what mcpp is, not how it works
The review's verdict on the previous 00 was that it scored zero, and it was right. `How mcpp Works` was accurate and was the wrong chapter: a general user does not care about the operating principle. It failed two of the design's own rules -- R2, because "understand the machinery" is a maintainer's task and already has chapters in 9x; and R7, because a model chapter explains how an advantage is produced and never demonstrates it. `00 — What mcpp Is` replaces it with what a first reader actually wants: the definition mcpp = build system + build plugins + package manager + toolchain management + the environment and runtime (xlings) an analogy CMake, xmake rules, Conan, GCC/LLVM/MSVC, Nix/conda -- so a reader with existing tools can place each part, with the disclaimer that places rather than equates the guarantee clone any mcpp project and `mcpp build` works, without installing a compiler, configuring an environment or hunting dependencies -- and the two boundaries that make it credible a real session a five-line manifest with no compiler and no standard declared, `import std` compiling on a machine whose own g++ is 13.3.0 and cannot, `mcpp self env` showing the GCC 16 mcpp installed, 1.25s wall clock including the first run what it is for modules and the newest features, and the ecosystems that follow: embedded, heterogeneous and GPU, graphics, kernel The one part of the old chapter a user wanted -- the table from a message's shape to the stage that produced it -- moves to 09 beside the other diagnosis scenarios. The rest is deleted. The style skill gains the distinction this needed: an ANALOGY places a part against a tool the reader knows and is admissible in user documentation; a COMPARISON claims mcpp is better on some axis and belongs to a design record. An analogy carries a disclaimer, or the placement is read as equivalence.
1 parent f9711d1 commit 277792f

14 files changed

Lines changed: 402 additions & 272 deletions

.agents/docs/2026-09-08-the-documentation-as-a-book.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,3 +455,51 @@ preference**, and that is the sentence a reader of scenario 10 leaves with.
455455
31 now, and the reason is that the tool is four things rather than three: a
456456
build system, a package manager, a toolchain provisioner, **and an ecosystem
457457
other people publish into**. The fourth had no chapters at all.
458+
459+
---
460+
461+
## 13. Chapter 00 was designed wrong, and the review said so
462+
463+
§4.1 specified `00 — How mcpp Works`: five nouns, three seams, where state lives
464+
on disk. It was written, it was accurate, and it was the wrong chapter.
465+
466+
**The review's verdict was that a general user does not care about the operating
467+
principle.** What a reader opening the first chapter wants is what mcpp is, what
468+
it can do, what its advantage is, and one example they can actually run.
469+
470+
The design failed two of its own rules to get there:
471+
472+
- **R2** — a chapter exists for a reader with a task. "Understand the machinery"
473+
is not a task a first-time reader has; it is a task a maintainer has, and it
474+
already has chapters in `9x`.
475+
- **R7** — an advantage is shown by the artifact, not by the mechanism. A model
476+
chapter explains how the advantage is produced and never demonstrates it.
477+
478+
`00 — What mcpp Is` replaces it:
479+
480+
1. **The definition**, in the form the reviewer gave: mcpp = build system +
481+
build plugins + package manager + toolchain management + the environment and
482+
runtime (xlings), in one program.
483+
2. **An analogy table** — CMake, xmake rules, Conan, GCC/LLVM/MSVC, Nix/conda —
484+
so a reader with existing tools can place each part. With the disclaimer that
485+
places rather than equates.
486+
3. **The guarantee, stated once**: clone any mcpp project and `mcpp build`
487+
works, without installing a compiler, configuring an environment, or hunting
488+
dependencies. Plus the two boundaries that make it trustworthy.
489+
4. **A session that was run**, with its real output: a five-line manifest, no
490+
declared compiler or standard, `import std` compiling on a machine whose own
491+
`g++` is 13.3.0 and cannot, and `mcpp self env` showing the GCC 16 mcpp
492+
installed. 1.25 s of wall clock including the first run.
493+
5. **What mcpp is for**: modules and the newest language features, and the
494+
ecosystems that follow — embedded, heterogeneous and GPU, graphics, kernel
495+
work.
496+
497+
The one part of the old chapter a *user* wanted — the table from a message's
498+
shape to the stage that produced it — moved to `09`, beside the other
499+
diagnosis scenarios. The rest is deleted rather than relocated.
500+
501+
**What this says about the method.** The seven-cell spec was filled for the old
502+
chapter and it still produced the wrong chapter, because the cell that decides
503+
everything — the reader — was answered with "anyone" and then served as if that
504+
meant "someone who wants the model". A reader cell that names no task is not
505+
filled in.

.agents/skills/mcpp-docs-style/SKILL.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,18 @@ mcpp 在很多场景支持不止一种做法,但它有自己的设计风格与
408408
**判据:把所有形容词删掉,读者还能不能看出优势?** 能 → 对。删掉之后只剩机制
409409
描述 → 那份「感受」本来就只在形容词里。
410410

411-
**不要在用户文档里与别的工具比较。** 对照属于设计记录(第一节)。用户文档展示的是
412-
**这一件事在这里要写多少、跑出什么**,读者自己会比较。
411+
**类比可以,对照不可以 —— 两者的区别是它服务谁。**
412+
413+
| | 目的 | 归属 |
414+
|---|---|---|
415+
| **类比** | 让读者把新概念挂到已有认知上 | 用户文档,**可以** |
416+
| **对照** | 主张 mcpp 在某个维度上更好 | 设计记录,用户文档**不可以** |
417+
418+
「工具链管理大致相当于 rustup 在 Rust 里的角色」是类比 —— 它给一个部分定位,不作
419+
评价。「比 CMake 简洁」是对照 —— 它是一个主张,而用户文档不是提出主张的地方。
420+
421+
类比要**带一句免责**:上面每个工具在它自己的领域里做的都比 mcpp 多。少了这一句,
422+
定位会被读成等价。
413423

414424
### 渐进式叙事:最短可跑 → 常见形状 → 完整表面 → 边角
415425

docs/00-how-mcpp-works.md

Lines changed: 0 additions & 139 deletions
This file was deleted.

docs/00-what-mcpp-is.md

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
# 00 — What mcpp Is
2+
3+
**Reader:** anyone, before anything else.
4+
5+
**The question this chapter answers:** what is mcpp, what does it do for a
6+
project, and what does it cost to try.
7+
8+
**Not here:** how any of it works internally, and every field and flag. This
9+
chapter ends with a session that has been run; the chapters after it are the
10+
reference.
11+
12+
## Five things in one program
13+
14+
```
15+
mcpp = build system
16+
+ build plugins
17+
+ package manager
18+
+ toolchain management
19+
+ the environment and runtime (xlings)
20+
```
21+
22+
Most C++ projects assemble those five from separate tools, and the seams between
23+
them are where a new contributor loses an afternoon: the build file assumes a
24+
compiler the machine does not have, the package manager assumes a build file it
25+
did not write, and the environment is a paragraph in a README.
26+
27+
mcpp is one program, so there are no seams to assemble.
28+
29+
For a reader who already has tools for these jobs, the parts land roughly here:
30+
31+
| the part | in mcpp | roughly the job of |
32+
|---|---|---|
33+
| build system | `mcpp.toml`, the module graph, the ninja backend | CMake, Meson |
34+
| build plugins | `build.mcpp`, rule packages | xmake rules |
35+
| package manager | `[dependencies]`, `mcpp.lock`, the index | Conan, vcpkg |
36+
| toolchain management | the compiler as an installed, pinned payload | installing GCC / LLVM / MSVC by hand, or rustup's role in Rust |
37+
| environment and runtime | `[xlings]`, payloads, the runtime search path | Nix, conda |
38+
39+
**The table places the parts; it does not claim equivalence.** Each of those
40+
tools does more in its own area than mcpp does, and a project that needs that
41+
depth should use it. What the row is saying is which familiar job the part
42+
corresponds to, so the rest of this documentation has somewhere to attach.
43+
44+
## The guarantee
45+
46+
> **Clone any mcpp project and `mcpp build` works** — without installing a
47+
> compiler, configuring an environment, or hunting down dependencies.
48+
49+
That is the whole claim, and everything below is it being demonstrated rather
50+
than repeated.
51+
52+
Two boundaries, stated here so the claim can be trusted: a project that targets
53+
a device still downloads that device's toolkit the first time, and a target this
54+
machine cannot serve is refused by name rather than built wrongly.
55+
56+
## A first session, end to end
57+
58+
Run on a machine whose only C++ compiler is GCC 13, which cannot compile
59+
`import std`.
60+
61+
```console
62+
$ mcpp new hello
63+
Created bin package 'hello' at /tmp/zero-demo/hello
64+
Next: cd hello && mcpp build && mcpp run (or `mcpp test`)
65+
```
66+
67+
Four files, and the manifest is five lines:
68+
69+
```
70+
hello/
71+
├── mcpp.toml
72+
├── src/main.cpp
73+
├── tests/test_smoke.cpp
74+
└── .gitignore
75+
```
76+
77+
```toml
78+
[package]
79+
name = "hello"
80+
version = "0.1.0"
81+
description = "A modular C++23 package"
82+
license = "Apache-2.0"
83+
```
84+
85+
**No compiler, no language standard and no dependency is declared**, and the
86+
source uses a feature the machine's own compiler does not have:
87+
88+
```cpp
89+
import std;
90+
91+
int main() {
92+
std::println("Hello from hello!");
93+
}
94+
```
95+
96+
```console
97+
$ mcpp run
98+
Inferred target hello (bin from src/main.cpp)
99+
Compiling hello v0.1.0 (.)
100+
Finished dev [unoptimized + debuginfo] in 0.64s
101+
Running `target/x86_64-linux-gnu/0946988e9e4b52ba/bin/hello`
102+
103+
Hello from hello!
104+
Built with import std + std::println on modular C++23.
105+
```
106+
107+
1.25 seconds of wall clock, first run included.
108+
109+
The compiler that did it is not the one on the machine:
110+
111+
```console
112+
$ g++ --version
113+
g++ (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0
114+
115+
$ mcpp self env
116+
default toolchain = gcc@16.1.0
117+
```
118+
119+
mcpp installed GCC 16 and used it. Nothing on the host was changed, and a
120+
colleague who clones this project gets the same compiler rather than the one
121+
their distribution happens to ship.
122+
123+
**A dependency is one line and needs no other step:**
124+
125+
```toml
126+
[dependencies]
127+
"mcpplibs.cmdline" = "^0.0.1"
128+
```
129+
130+
`mcpp build` resolves it, fetches it, builds it and links it.
131+
132+
## What mcpp is for
133+
134+
mcpp is built around **C++20/23 modules and the newest language features**, and
135+
the ecosystem it maintains follows from that rather than from a general
136+
ambition:
137+
138+
| | |
139+
|---|---|
140+
| modular C++ | `import std` with no configuration, module scanning, a cross-project BMI cache |
141+
| embedded and bare metal | freestanding targets, board-support packages, one command from source to a running image |
142+
| heterogeneous computing and GPUs | CUDA, HIP, SYCL, Vulkan/SPIR-V and Ascend C, each a rule package rather than an engine feature |
143+
| graphics | shaders compiled as part of the build and reached as modules |
144+
| kernel and low-level work | zero-libc tiers, an explicit link model, no hidden host dependency |
145+
146+
A project that wants none of those still gets the guarantee above; a project
147+
that wants one of them does not leave the tool to get it.
148+
149+
## Where to go next
150+
151+
| | |
152+
|---|---|
153+
| put a program on the screen | [01 — Getting Started](01-getting-started.md) |
154+
| decide whether mcpp fits the work at hand | [02 — Scenarios](02-scenarios.md) |
155+
| read a project of the same shape | [03 — Examples](03-examples.md) |

docs/01-getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
running, from an empty machine.
77

88
**Not here:** what mcpp's parts are — that is
9-
[00 — How mcpp Works](00-how-mcpp-works.md), which this chapter assumes rather
9+
[00 — What mcpp Is](00-what-mcpp-is.md), which this chapter assumes rather
1010
than repeats — and every field a manifest may hold, which is
1111
[04 — The mcpp.toml Manifest](04-mcpp-toml.md). After: [03 — Examples](03-examples.md).
1212

docs/02-scenarios.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ command produces a binary that carries what it needs.
4141

4242
**The path.**
4343

44-
1. [00 — How mcpp Works](00-how-mcpp-works.md) — the five nouns.
44+
1. [00 — What mcpp Is](00-what-mcpp-is.md) — the five nouns.
4545
2. [01 — Getting Started](01-getting-started.md) — a program on the screen.
4646
3. [05 — Dependencies and Resolution](05-dependencies.md)`[dependencies]`,
4747
the lock file.

0 commit comments

Comments
 (0)