Skip to content

Commit 332fea7

Browse files
authored
2026.12.4.1: the ecosystem's boundary: toolchains named by path, library packages for other build systems, plan locks, CPS (#1033)
Release 2026.12.4.1 (design 2026-11-27, ecosystem boundary, v12). - Toolchains named by path take what they can do from their statement or a probe (archiver, response files, linker, modules); build programs take the table a toolchain is named by (mcpp#1034); the std module source is taken inside the toolchain's tree (mcpp#1039). - A link follows its compiles (mcpp#1031); the ABI members reach every unit (mcpp#1029); a test that would overwrite a program is refused (mcpp#1028); on Windows a started program is named as mcpp was given its directories (mcpp#1032). - A library package describes itself for other build systems: mcpp-package.json, a .pc and a .cps per leg, and its index entry (`mcpp emit xpkg --package`); `mcpp::cps_package` reads an installed CPS package into existing directives. - Workspace selections build one configuration at once under plan locks; every lock wait reports and is bounded (`--lock-wait`, `[build] lock_wait`; mcpp#1040). - Fetching: the version table read as the installer reads it, one writer of standard error, one line per dependency, waves (mcpp#1042). - The command line as its own guide: help from the command tree, `--agent-skill-doc` sheets, usage errors with next steps, one `mcpp explain` registry, `mcpp info`, `mcpp add` writing full identities; `mcpp new` makes a git repository (mcpp#1038). - The mirror is chosen where the home is made and checked against the network; a network problem is one warning with one advice and a closing tip; `mcpp self config` shows mcpp's configuration and the provider it chooses (`mcpp.config`), not the provider's record. - xlings 2026.12.5.2 is the pinned provider (protocol 1.20); mcpplibs.os 0.4.9, mcpplibs.cmdline 0.2.0.
1 parent 30fcd5a commit 332fea7

277 files changed

Lines changed: 15103 additions & 2758 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.agents/docs/2026-11-27-ecosystem-boundary-design.md‎

Lines changed: 1802 additions & 0 deletions
Large diffs are not rendered by default.

‎.agents/docs/README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ superseded_by: 2026-09-07-....md # when status is superseded
1818
---
1919
```
2020

21-
375 records.
21+
376 records.
2222

2323
## By subject
2424

@@ -95,6 +95,7 @@ Records that declare one. Everything else is listed by date below.
9595

9696
### ecosystem
9797

98+
- [生态与外部的交界:工具链的事实、二进制库交付物、被启动的外部程序、名字的拼写与共享的状态](2026-11-27-ecosystem-boundary-design.md) — active
9899
- [包的特性作为机器可读的回答:一个目录项,两种来源,三种状态(mcpp#992)](2026-11-21-package-features-query-design.md) — active
99100
- [离线、宿主输入与工具链的缺省:按内容取归档的来源、项目的取齐、宿主输入的声明、工具链的解析与锁、缺省版本的规则(mcpp#988、#989、#990)](2026-11-21-offline-host-inputs-and-toolchain-defaults-design.md) — active
100101
- [生态规则收敛方案:2026.11.18.1 之后十个 issue 的五类成因、七项决定与实施范围](2026-11-19-ecosystem-rule-convergence-design.md) — landed
@@ -218,6 +219,7 @@ Records that declare one. Everything else is listed by date below.
218219
### 2026-11
219220

220221
- [陈述的闭包、单一读者与六项功能:十四项缺陷的收敛设计](2026-11-27-stated-closure-single-reader-and-feature-designs.md) — landed
222+
- [生态与外部的交界:工具链的事实、二进制库交付物、被启动的外部程序、名字的拼写与共享的状态](2026-11-27-ecosystem-boundary-design.md) — active
221223
- [clang BMI 的截断与私有模块片段判定的收窄](2026-11-26-clang-bmi-cutoff-and-private-fragment-refinement-design.md) — active
222224
- [测试与 CI 一轮的收尾:平台列未命中的刷新条件(mcpp#996)、`i686-windows-msvc` 行、工作区索引与引号键的迁移、索引的全量验证](2026-11-22-test-round-wrap-up-plan.md) — active
223225
- [生态级方案:内核接口的供给与能力,派生状态的核对,存储的引用](2026-11-22-kernel-interface-and-derived-state-ecosystem-design.md) — active

‎.agents/skills/mcpp-usage/SKILL.md‎

Lines changed: 10 additions & 180 deletions
Original file line numberDiff line numberDiff line change
@@ -1,189 +1,19 @@
11
---
22
name: mcpp-usage
3-
description: Use when helping users install, configure, or use mcpp — the C++23 modular build tool. Covers installation, project creation, building, dependency management, toolchain management, workspace setup, packaging, diagnostics, and troubleshooting.
3+
description: Use when helping users install, configure, or use mcpp - the C++23 modular build tool. The usage lives in docs/mcpp-skills and in the binary.
44
---
55

6-
# mcpp 基础用法
6+
# mcpp usage
77

8-
## Overview
8+
How to use mcpp is stated once, in the sheets under
9+
[`docs/mcpp-skills/`](../../../docs/mcpp-skills/mcpp/SKILL.md), which the build renders into
10+
the binary:
911

10-
mcpp 是一个现代 C++ 模块化构建工具,纯 C++23 模块编写,已实现自举。一条命令安装,`import std` 开箱即用。
11-
12-
- 仓库:https://github.com/mcpp-community/mcpp
13-
- 文档:https://github.com/mcpp-community/mcpp/tree/main/docs
14-
- 包索引:https://github.com/mcpp-community/mcpp-index
15-
- 模块化库:https://github.com/mcpplibs
16-
17-
## Quick Reference
18-
19-
| 命令 | 用途 |
20-
|---|---|
21-
| `mcpp new <name>` | 创建项目 |
22-
| `mcpp build` | 构建 |
23-
| `mcpp run [-- args]` | 构建并运行 |
24-
| `mcpp test [pattern] [-- args]` | 发现并运行 `tests/**/*.cpp` 测试 |
25-
| `mcpp add <pkg>[@ver]` | 添加依赖 |
26-
| `mcpp remove <pkg>` | 移除依赖 |
27-
| `mcpp update [pkg]` | 更新依赖 |
28-
| `mcpp search <keyword>` | 搜索包 |
29-
| `mcpp toolchain list` | 查看工具链 |
30-
| `mcpp toolchain install gcc 16` | 安装工具链 |
31-
| `mcpp pack` | 打包 |
32-
| `mcpp why [toolchain|runtime|deps]` | 解释解析出的构建决策 |
33-
| `mcpp --offline` | 只使用已有本地状态 |
34-
| `mcpp self doctor` | 环境诊断 |
35-
| `mcpp explain <CODE>` | 错误码解释 |
36-
37-
## 安装
38-
39-
```bash
40-
# 推荐;Windows 请在 PowerShell 中运行
41-
xlings install mcpp -y
42-
43-
# 或 Unix release 一键脚本(仅 Linux x86_64/aarch64 与 macOS ARM64)
44-
curl -fsSL https://github.com/mcpp-community/mcpp/releases/latest/download/install.sh | bash
45-
```
46-
47-
一键脚本不支持 Windows;Windows 使用 PowerShell 的 xlings 安装命令。安装到
48-
`~/.mcpp/` 后会自动加入 PATH。首次使用时,mcpp 按宿主选择默认工具链并
49-
安装到隔离沙盒:Linux 通常为 GCC,macOS 为 LLVM,Windows 在有可用 MSVC
50-
时为 LLVM,否则为面向 `x86_64-windows-gnu` 的 MinGW-w64 GCC。
51-
52-
## 创建项目
53-
54-
```bash
55-
mcpp new hello && cd hello
56-
mcpp build
57-
mcpp run
58-
```
59-
60-
生成的项目包含最小 manifest 和可立即运行的 smoke test:
61-
62-
```toml
63-
[package]
64-
name = "hello"
65-
version = "0.1.0"
66-
description = "A modular C++23 package"
67-
license = "Apache-2.0"
68-
```
69-
70-
`src/main.cpp` 会自动推断为 binary target,`tests/test_smoke.cpp` 会由
71-
`mcpp test` 自动发现;无需手写 `[targets.hello]`。
72-
73-
## mcpp.toml 配置
74-
75-
### 传统头文件库的模块化封装
76-
77-
`mcpplibs.mwrap.<库名>` 为传统 C/C++ 库提供模块入口;API namespace 保留上游,例如
78-
`import mcpplibs.mwrap.opencv.core;` 后仍使用 `cv::Mat`。包版本对齐上游,封装修订最多追加一个数字尾号。
79-
具体已发布的版本/feature 先查索引,不把文档中的候选库当已发布包。
80-
81-
每个新建或重构的 -m 库提供包自带快捷模板:
82-
83-
```bash
84-
mcpp new vision --template mcpplibs.mwrap.opencv@5.0.0.1
85-
mcpp new --list-templates mcpplibs.mwrap.opencv@5.0.0.1
86-
```
87-
88-
模板语法为 `[namespace.]name[@version][:template]`,只有一个默认模板时可以省略模板名。
89-
包模板中的 `{{self.name}}` 是完整包选择器,应用 `"{{self.name}}"` 作为单个依赖 key,
90-
不要放到另一层 namespace 表下。模板必须实际创建、构建、运行,而不只做字符串检查。
91-
92-
feature 是加法并集;消费者可在依赖声明中使用 `default-features = false` 关闭该边的默认集合,
93-
显式 features 仍会启用,其他依赖边的请求不会被取消。根项目没有 `--no-default-features` 命令行选项。
94-
可选大依赖由包作者显式门控。模块可导入不等于实际后端已启用,窗口/推理/设备能力需分别验证。
95-
宏不能经 import 传递;`.macros` 只提供可保持语义的常量/函数映射,原始宏仍需兼容头。
96-
97-
维护规范与包装流程见 [mcpp-index mwrap 规范](https://github.com/mcpplibs/mcpp-index/blob/main/docs/mwrap.md)。
98-
修改普通消费者项目时按现有包契约使用,不自动替用户迁移其他依赖。
99-
100-
```toml
101-
[package]
102-
name = "myapp"
103-
version = "0.1.0"
104-
105-
[targets.myapp]
106-
kind = "bin" # bin / lib / shared; tests are discovered from tests/**/*.cpp
107-
main = "src/main.cpp"
108-
109-
[dev-dependencies]
110-
gtest = "1.15.2" # 仅测试使用;SemVer: ^, ~, 范围, 精确
111-
112-
[toolchain]
113-
default = "gcc@16.1.0"
114-
```
115-
116-
更多配置:https://github.com/mcpp-community/mcpp/blob/main/docs/04-mcpp-toml.md
117-
118-
## 工具链
119-
120-
```bash
121-
mcpp toolchain list # 查看已装
122-
mcpp toolchain install gcc 16 # 装 GCC 16
123-
mcpp toolchain install llvm 20 # 装 LLVM 20
124-
mcpp toolchain default gcc@16.1.0 # 设默认
125-
mcpp build --target x86_64-linux-musl # 需要全静态 Linux 产物时显式选择
126-
```
127-
128-
## 测试结果与按用例运行
129-
130-
`mcpp test --message-format json` 每个测试一条 NDJSON 记录(通过的也带 `run_output`),最后是每个成员的
131-
`summary`。`status` 取 `pass`、`compile_fail`、`run_fail`(`timed_out` 为真即超时)、`not_run`(带 `reason`)、
132-
`built`(`--no-run`);退出码 0 为全部通过,1 为有测试失败,2 为有测试未能运行。
133-
134-
mcpp 的单位是测试程序;用例属于测试框架。按用例运行时,把框架的参数放在 `--` 之后:
135-
136-
```bash
137-
mcpp test unit/math -- --gtest_filter='Math.Adds:Math.Spans' # GoogleTest 只跑这两个用例
138-
mcpp test unit/math -- --gtest_output=json:"$PWD/math-report.json" # 每个用例的结果写成 JSON 报告
139-
mcpp test unit/math --print-launch -- --gtest_filter='Math.Adds' # 只构建,打印启动方式(argv、cwd、环境),供调试器使用
140-
```
141-
142-
读取用例结果时以框架报告为准(GoogleTest 的 `--gtest_output=json`、Catch2 的 `--reporter json`),程序输出中
143-
`[ RUN ] X` 与 `[ OK ] X` / `[ FAILED ] X` 之间是用例 X 的输出。
144-
145-
## 工作空间
146-
147-
```toml
148-
[workspace]
149-
members = ["libs/*", "apps/*"]
150-
151-
[workspace.dependencies]
152-
gtest = "1.15.2"
15312
```
154-
155-
```bash
156-
mcpp build -p member-name # 构建指定成员
13+
mcpp --agent-skill-doc # the root sheet and an index of the commands' sheets
14+
mcpp <command> --agent-skill-doc # one command's sheet
15715
```
15816

159-
## 自定义索引
160-
161-
```toml
162-
[indices]
163-
my-index = "git@gitlab.example.com:team/index.git"
164-
local = { path = "/path/to/index" }
165-
166-
[dependencies.my-index]
167-
internal-lib = "1.0.0"
168-
```
169-
170-
## 常见问题
171-
172-
| 问题 | 解决 |
173-
|---|---|
174-
| 首次构建慢 | 正常,需下载工具链。后续使用缓存 |
175-
| command not found | 重开终端。Unix release 安装脚本应确认 `~/.mcpp/bin` 在当前 shell 的 `PATH` 中;经 xlings 安装则确认 xlings 当前激活的 bin 目录。Windows 不要执行 `source`,重开 PowerShell 后用 `Get-Command mcpp.exe` 验证命令已激活。 |
176-
| 编译错误 | `mcpp clean && mcpp build`,确认 `mcpp toolchain list` |
177-
| 依赖找不到 | `mcpp index update`,确认 `mcpp search <name>` |
178-
| 需要无网络构建 | 使用 `mcpp --offline` 或设置 `MCPP_OFFLINE=1`;缺失的工具链/依赖会直接报错 |
179-
180-
## 问题反馈
181-
182-
1. **项目 Issue**:https://github.com/mcpp-community/mcpp/issues
183-
- 描述复现步骤、期望/实际行为、mcpp 版本和 OS
184-
- 可用 `gh issue create` 提交
185-
186-
2. **社区论坛**:https://forum.d2learn.org/category/20
187-
- 使用疑问和讨论
188-
189-
如果 AI Agent 无法直接创建 Issue,请提示用户手动创建并提供整理好的问题描述。
17+
Install mcpp with `xlings install mcpp -y`, or on Linux and macOS with
18+
`curl -fsSL https://github.com/mcpp-community/mcpp/releases/latest/download/install.sh | bash`.
19+
The user documentation is [`docs/`](../../../docs/README.md).

‎.github/actions/bootstrap-mcpp/action.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ inputs:
3333
# `package.name`, so one of the two was simply unreachable — and which one
3434
# depended on the machine, which is why CI failed on `compat:lua` on
3535
# Windows and `mcpplibs.capi:lua` on Linux. Never pin below that.
36-
default: '2026.11.23.1'
36+
default: '2026.12.5.2'
3737

3838
outputs:
3939
sandbox-key:

‎.github/actions/setup-macos-llvm/action.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ inputs:
1515
# Floor imposed by the index, not a routine bump — see
1616
# .github/actions/bootstrap-mcpp/action.yml for why 0.4.69 is required
1717
# (two packages named `lua` in one repo need openxlings/xlings#381).
18-
default: '2026.11.23.1'
18+
default: '2026.12.5.2'
1919
image:
2020
description: >
2121
The runner label the job runs on (macos-15, xcode-27). It is part of the

‎.github/tools/build_examples.sh‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ BUILD=(
7070
# vocabulary, and the example's README records the measured artifacts and
7171
# the emulator run for the binary it describes.
7272
examples/13-platform-targets
73+
# A package another build system installed, read through its CPS
74+
# description by `mcpp::cps_package`: header-only, so the prefix is text.
75+
examples/14-cps/app
7376
)
7477

7578
# `key|reason`.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env bash
2+
# The narrative stream has one writer (design 2026-11-27, ecosystem boundary §3.11.2 point 4).
3+
#
4+
# A line written to standard error outside mcpp.ui and mcpp.log does not erase the live region
5+
# first and does not redraw it: the region's bookkeeping is one line short, and the line above it
6+
# (a progress bar) stays on the screen. Measured 2026-12-04: the provider's `Source <package>
7+
# <host>` line, written once per download, left one stale progress bar per dependency.
8+
#
9+
# Each file's count of direct writes to standard error is at most its line in
10+
# stderr-writers.baseline, and a file not listed has none. The baseline only falls; the
11+
# fetch, prepare and build paths of the process that draws the live region are not on it.
12+
# The programs ninja starts (compiler supervisors, link-output and the other internal
13+
# commands) write to their own standard error, which the build captures; they are listed.
14+
set -u
15+
cd "$(dirname "$0")/../.."
16+
17+
baseline=.github/tools/stderr-writers.baseline
18+
[ -f "$baseline" ] || { echo "::error::missing $baseline"; exit 1; }
19+
20+
pattern='libc::stderr\(\)|std::cerr|[(,][[:space:]]*stderr[[:space:]]*[,)]|STDERR_FILENO'
21+
current=$(grep -rnE "$pattern" src modules --include='*.cppm' --include='*.cpp' \
22+
| grep -vE '^(src/ui\.cppm|src/ui/[^:]*|modules/log/src/[^:]*|modules/[^/]+/tests/[^:]*):' \
23+
| grep -vE '^[^:]+:[0-9]+:[[:space:]]*//' \
24+
| cut -d: -f1 | sort | uniq -c | awk '{ print $2, $1 }')
25+
26+
rc=0
27+
while read -r file n; do
28+
[ -n "$file" ] || continue
29+
allowed=$(awk -v f="$file" '$1 == f { print $2 }' "$baseline")
30+
if [ -z "$allowed" ]; then
31+
echo "::error::$file writes to standard error directly $n time(s); write through mcpp::ui (status, info, block, error) or mcpp::diag"
32+
rc=1
33+
elif [ "$n" -gt "$allowed" ]; then
34+
echo "::error::$file writes to standard error directly $n times, more than the $allowed of $baseline"
35+
rc=1
36+
elif [ "$n" -lt "$allowed" ]; then
37+
echo "::error::$file writes to standard error directly $n times, fewer than the $allowed of $baseline; lower its line"
38+
rc=1
39+
fi
40+
done <<< "$current"
41+
while read -r file allowed; do
42+
case "$file" in ''|'#'*) continue ;; esac
43+
if ! grep -q "^$file " <<< "$current"; then
44+
echo "::error::$file no longer writes to standard error directly; remove its line from $baseline"
45+
rc=1
46+
fi
47+
done < "$baseline"
48+
[ "$rc" = 0 ] && echo "OK: standard error is written through mcpp.ui and mcpp.log, and $baseline is exact"
49+
exit "$rc"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# One line per source file that writes to standard error without mcpp.ui or mcpp.log: its count
2+
# (.github/tools/check_stderr_writers.sh). The numbers only fall.
3+
src/build/execute.cppm 47
4+
src/build/schedule/compiler_transaction.cppm 1
5+
src/build/schedule/detach_codegen.cppm 41
6+
src/cli/cmd_build.cppm 53
7+
src/cli/cmd_cache.cppm 1
8+
src/cli/cmd_new.cppm 1
9+
src/cli/cmd_publish.cppm 4
10+
src/cli/cmd_registry.cppm 2
11+
src/cli/cmd_self.cppm 7
12+
src/cli/cmd_toolchain.cppm 1
13+
src/cli/cmd_xpkg.cppm 1
14+
src/cli.cppm 15
15+
src/doctor.cppm 5
16+
src/fallback/xlings_binary.cppm 4
17+
src/main.cpp 1
18+
src/pack/distribution.cppm 5
19+
src/publish/pipeline.cppm 6
20+
src/run/run.cpp 6

‎.github/workflows/bootstrap-macos.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
# Dormant (workflow_dispatch only), but kept in step with the rest —
1818
# check_version_pins.sh holds it there. Floor: 0.4.69, below which the
1919
# index cannot resolve two packages that share a short name.
20-
XLINGS_VERSION: '2026.11.23.1'
20+
XLINGS_VERSION: '2026.12.5.2'
2121
steps:
2222
- uses: actions/checkout@v4
2323

‎.github/workflows/ci-bootstrap.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
os: [ubuntu-24.04, macos-15, windows-2025]
4242
env:
4343
XLINGS_NON_INTERACTIVE: '1'
44-
XLINGS_VERSION: '2026.11.23.1'
44+
XLINGS_VERSION: '2026.12.5.2'
4545
steps:
4646
- uses: actions/checkout@v4
4747

@@ -50,7 +50,7 @@ jobs:
5050
shell: bash
5151
run: |
5252
set -euo pipefail
53-
curl -fsSL https://raw.githubusercontent.com/openxlings/xlings/main/tools/other/quick_install.sh | bash -s v2026.11.23.1
53+
curl -fsSL https://raw.githubusercontent.com/openxlings/xlings/main/tools/other/quick_install.sh | bash -s v2026.12.5.2
5454
echo "$HOME/.xlings/subos/current/bin" >> "$GITHUB_PATH"
5555
echo "$HOME/.xlings/bin" >> "$GITHUB_PATH"
5656
@@ -124,7 +124,7 @@ jobs:
124124
shell: bash
125125
run: |
126126
set -euo pipefail
127-
curl -fsSL https://raw.githubusercontent.com/openxlings/xlings/main/tools/other/quick_install.sh | bash -s v2026.11.23.1
127+
curl -fsSL https://raw.githubusercontent.com/openxlings/xlings/main/tools/other/quick_install.sh | bash -s v2026.12.5.2
128128
echo "$HOME/.xlings/subos/current/bin" >> "$GITHUB_PATH"
129129
130130
- name: Install the newest release and build the tree with it (mcpp build --strict)

0 commit comments

Comments
 (0)