feat(pkgs): add cJSON (compat) + nlohmann.json (C++23 module) + per-pkg CI#48
Conversation
…kg CI - compat.cjson @1.7.19 — pure-C source build like compat.zlib; cJSON.c core, cJSON_Utils gated behind feature `utils`. CN mirror mcpp-res/cjson. - nlohmann.json @3.12.0 — exposes `import nlohmann.json;` out of the box. Released v3.12.0 ships no module unit, so we provide upstream's official src/modules/json.cppm (develop) VERBATIM via generated_files; headers pinned to the v3.12.0 release tarball. CN mirror mcpp-res/nlohmann-json. - tests/examples/<pkg>/ minimal projects + tests/run_example.sh runner. - validate.yml: PRs run only the example(s) for changed packages; full smoke regression runs on push/nightly/dispatch or scaffolding changes. mcpp 0.0.67. - Both packages verified locally: real mcpp fetch (CN mirror) → generate → compile → run. Design: .agents/docs/2026-06-27-add-cjson-and-nlohmann-json-plan.md
…ump) The whole-suite portable/full smoke fails on 0.0.67 because that mcpp honors the gtest `main` feature gating (gtest_main.cc excluded by default → the legacy gtest smoke link-errors on undefined main). That is pre-existing drift unrelated to cJSON/nlohmann; updating those smoke scripts belongs in its own PR. Scope the version: new example jobs run on current 0.0.67 (what users have, already green), legacy regression stays on its authored 0.0.46.
…rent mcpp
Root cause of the 0.0.67 macos/windows smoke failure (ld64.lld: undefined
symbol: main): smoke_compat_{core,portable}.sh build gtest TEST() cases with
no main() of their own, relying on gtest_main. mcpp 0.0.67 honors the
compat.gtest 'main' feature gating (#168) and excludes gtest_main.cc by
default, so the link fails. 0.0.46 ignored features and always linked it.
Proper fix (verified locally on 0.0.66): declare the dependency as
gtest = { version = "1.15.2", features = ["main"] } — the intended opt-in
that re-includes gtest_main. Smoke now links and runs on the latest mcpp, so
validate.yml is back to a single 0.0.67 across all jobs.
CI runs on the current release (0.0.67), incl. legacy smoke — root cause of an initial macOS/Windows failureFirst CI run bumped mcpp Root cause: Fix (not a version pin): declare the intended opt-in |
These two legacy smokes depend on compat.glfw (abi=glibc) + GLX runtime. On mcpp 0.0.67 the window demo resolves a clang/libc++ toolchain for compat.glfw despite a gcc@16.1.0 pin → 'ABI mismatch: requires abi=glibc'. Same scripts pass on 0.0.66 locally and glfw builds fine on 0.0.67 elsewhere (linux imgui smoke, mac/windows portable), so it's an mcpp toolchain-resolution regression unrelated to package descriptors. Keep them off the PR-blocking path (already optional, display/ABI-sensitive) but still run on nightly + manual dispatch. Blocking full-linux keeps core/imgui/archive on 0.0.67.
… glfw ABI regression)
Codifies the full process used for cjson/nlohmann/eigen into a reusable skill under .agents/skills/add-mcpp-index-package/: - SKILL.md — 12-step SOP, the sources-only feature gate (+ mandatory negative test), version-matched local verification, red-flags/common mistakes. - package-types.md — descriptor templates for the four shapes (C-source compat / header-only / C++23 module via generated wrapper / external Form-A module repo), each with real sample paths. - cn-mirror.md — gtc/gitcode mcpp-res mirror closed loop + every known gotcha. - references.md — repo layout, descriptor schema cheat-sheet, validate.yml CI behavior, one-shot local lint, real worked examples (#48 / #50).
Codifies the full process used for cjson/nlohmann/eigen into a reusable skill under .agents/skills/add-mcpp-index-package/: - SKILL.md — 12-step SOP, the sources-only feature gate (+ mandatory negative test), version-matched local verification, red-flags/common mistakes. - package-types.md — descriptor templates for the four shapes (C-source compat / header-only / C++23 module via generated wrapper / external Form-A module repo), each with real sample paths. - cn-mirror.md — gtc/gitcode mcpp-res mirror closed loop + every known gotcha. - references.md — repo layout, descriptor schema cheat-sheet, validate.yml CI behavior, one-shot local lint, real worked examples (#48 / #50).
* docs(skills): add `add-mcpp-index-package` agent skill (SOP) Codifies the full process used for cjson/nlohmann/eigen into a reusable skill under .agents/skills/add-mcpp-index-package/: - SKILL.md — 12-step SOP, the sources-only feature gate (+ mandatory negative test), version-matched local verification, red-flags/common mistakes. - package-types.md — descriptor templates for the four shapes (C-source compat / header-only / C++23 module via generated wrapper / external Form-A module repo), each with real sample paths. - cn-mirror.md — gtc/gitcode mcpp-res mirror closed loop + every known gotcha. - references.md — repo layout, descriptor schema cheat-sheet, validate.yml CI behavior, one-shot local lint, real worked examples (#48 / #50). * docs(readme): slim down to intro + usage + contribution + links Drop the package tables/dependency tree/smoke breakdown/Form-A-B examples from the index README — the browsable site (mcpplibs.github.io/mcpp-index) is the package list, and the how-to detail lives in the add-mcpp-index-package skill. README now = what it is, mcpp add/build usage, the two package categories (native module libs / third-party compat) with a pointer to the skill, and related tools / community. * docs: add docs/, README example table + agent prompt; skill mirror fallback - Move the skill's reference files into a human-facing docs/ folder (single source): package-types.md, cn-mirror.md, repository-and-schema.md (+ index docs/README.md). SKILL.md now links to ../../../docs/*; the skill dir keeps just SKILL.md (the agent SOP). - README: add a "参考示例" table linking typical descriptors by shape (Form-A module / C-source compat / header-only / module wrapper), a copy-paste agent prompt that drives the skill end-to-end, and links to docs/. - skill + docs: document the no-`mcpp-res`-permission fallback — use a plain-string upstream `url` (lint forbids a {GLOBAL,CN} table whose CN isn't gitcode/mcpp-res; plain strings are unconstrained). Real precedent: pkgs/t/tensorvia-cpu.lua. - skill step 1 now distinguishes the two sources: a third-party upstream lib vs. the user's own mcpp-based library (Form A, lighter research). * docs: rewrite README/docs/skill in a formal declarative register Rewrite all prose across README.md, docs/*, and the add-mcpp-index-package skill into declarative, academic-style Chinese: remove colloquial terms (一把梭 / 踩坑 / 丢给 / 硬凑 / 藏不住 …) and decorative emoji (⚠️ ✅❌📘✓), and reformulate fragments as complete declarative sentences. The red-flag table becomes a "错误做法 / 正确做法" table; section headings are normalized (e.g. "本地 lint 一把梭" → "本地 lint 复现(等价于 CI lint job)", "踩坑" → "注意事项", "CI 兜底" → "CI 保障"). Technical content, commands, code samples, and links are unchanged.
What
Adds two third-party JSON libraries to the index, plus a per-changed-package CI mechanism.
compat.cjson@ 1.7.19Pure-C source build, same shape as
compat.zlib: compilescJSON.cinto a lib, exposescJSON.hviainclude_dirs. The optionalcJSON_Utilsextension is gated behind featureutils(mirrors howcompat.gtestgatesgtest_mainbehindmain).nlohmann.json@ 3.12.0 →import nlohmann.json;out of the boxReleased
v3.12.0is header-only and ships no module interface unit. Upstream has authored an official one atsrc/modules/json.cppm(export module nlohmann.json;) but it lives ondeveloponly (not in any release tag yet). So this package provides it ourselves via mcppgenerated_files, embedding upstream's officialjson.cppmverbatim (literals + the MSVC #3970detailre-exports); base headers stay pinned to the reproduciblev3.12.0tarball.CN mirrors
Both tarballs mirrored to GitCode via
tools/gtc, byte-identical to source (sha256 verified):mcpp-res/cjson1.7.19→ CN url 200mcpp-res/nlohmann-json3.12.0→ CN url 200Per-changed-package CI
tests/examples/<pkg>/holds a minimal, self-contained project per library (also runnable by hand:cd tests/examples/cjson && mcpp run).validate.ymlnow:tests/run_example.sh);lint+mirror-cn-reachablealways run over all descriptors.0.0.46 → 0.0.67.Verification (local, real mcpp pipeline)
Both packages were built+run through real mcpp (fetch from the CN mirror → generate → compile → link → run):
cjson ok=1 json={"answer":42,"lib":"cJSON"}nlohmann.json ok=true dump={"answer":42,"list":[1,2,3]}Design doc
.agents/docs/2026-06-27-add-cjson-and-nlohmann-json-plan.md