Skip to content

Latest commit

 

History

History
100 lines (81 loc) · 5.2 KB

SKILL.md

File metadata and controls

100 lines (81 loc) · 5.2 KB
name mcpp
description Use mcpp, the build tool and package manager for C++23 modules - its architecture and concepts, which command a task needs, the project conventions, and what to do when mcpp itself is wrong - analyse it, work around it, report it, fix it.

mcpp

mcpp builds C++23 module projects that mcpp.toml describes. Every command answers --agent-skill-doc with a sheet that ends with the related commands.

Architecture

  • The engine plans a build from data: the manifest, the target's rows and providers, the indices' packages. Every default is data and has an override.
  • The home (~/.mcpp, or MCPP_HOME) holds the toolchains, the std module, the packages and the cache. A compiler of the host is used only when the project states it (mcpp why toolchain says which one was used).
  • Two kinds of package. An mcpp package (namespace.name: a library, a plugin; mcpp-index) is a dependency, resolved before planning and locked in mcpp.lock. A provider's package (xim:name: a tool, a runtime, a toolchain; xim-pkgindex) belongs to the project environment.
  • The project environment: [xlings.workspace] lists the tools and runtimes the project's build programs, tests and mcpp run find on PATH (mcpp add xim:<name>); [xlings] subos = "<name>" keeps it the project's own.
  • A build program (build.mcpp) runs before the build and states flags, generated sources and actions; plugins are libraries it imports (mcpp.plugins: rules-*, deps-*, dist-*, tools-*).

Tasks

section commands for
Project new, build, run, test, clean make, build, run and test a package
Packages search, info, add, remove, update, fetch, index find, read and use packages
Inspect why, resolve, explain understand a result or a refusal
Distribute pack, publish, emit, xpkg ship a program or a library
Machine toolchain, cache, self toolchains, the cache, the home

Ask mcpp: mcpp --help, mcpp <command> --agent-skill-doc, mcpp why <topic>.

Conventions

  • A module is one .cppm: the exported interface, then module :private; with what is not exported and the implementation. mcpp builds the private fragment as a unit of its own, so an edit there recompiles no importer.
  • Dependencies are full identities as dotted keys in name order, as mcpp add writes them: mcpplibs.cmdline = "0.3.0" under [dependencies].
  • A library is chosen in this order: a module library of mcpp-index (the mcpplibs namespace is maintained by its community); the module wrapper of an established library; a compat.* library; a CMake or vcpkg package through the deps-cmake or deps-vcpkg plugin. A module that exists is depended on, not written again.
  • An established C or C++ library (zlib, sqlite3, lua, opencv) is used through its module wrapper in mcpplibs.mwrap rather than through headers: mcpp search mwrap, https://github.com/mcpplibs/mwrap.
  • Before using a dependency's interface, read mcpp info <package> --agent-skill-doc: its author's account of it, read as its documentation.
  • A key mcpp does not know is reported, never ignored; fix it, do not mute it.

Reading a message

  • error: stopped the command; warning: and note: did not; help: is the next step; impact: is what a reduced run lost.
  • A refusal ends with its reason token ([layer-cycle]); mcpp explain layer-cycle gives the cause and the remedy, as for E0001 and MCPP_*.
  • --message-format json (build, test, pack) and --format json (queries) print JSON on standard output. Exit 0 success, 1 failed, 2 a usage error, 5 stopped by --deny, 70 an internal error.

When mcpp itself seems wrong

A defect of mcpp is an exit 70 or a crash, a remedy that does not remedy, a result the documentation states otherwise, or two runs of the same inputs that differ. An error of the compiler in the project's own code is not one.

  1. Analyse: mcpp explain <token>; mcpp why toolchain|deps|flags; mcpp build -v for each step; target/.last-result.json, the record of the last build; mcpp self doctor for the home.
  2. Reduce it to the smallest project that shows it (mcpp new repro).
  3. Unblock the work: mcpp clean, --cache off, -j 1, another --toolchain, or the switch the help: line names. A workaround kept in the project carries a comment naming the defect.
  4. Propose a report: mcpp welcomes them. Ask the user before opening it, unless they have already said to; when the cause is located, ask in the same question whether to open a pull request with the fix as well.
  5. Print the address of what was opened, for the user to review.

An issue (gh issue create -R mcpp-community/mcpp --label bug; or upstream-bug, documentation, enhancement) carries the command, its full output, mcpp --version, mcpp self env and the smallest project.

Contributing to mcpp

mcpp build and mcpp test in a checkout; AGENTS.md states the rules and .agents/skills/ the procedures; a fix is one pull request with its test.

Where to read on

https://github.com/mcpp-community/mcpp/tree/main/docs (the documentation), mcpp-index and mcpp-plugins beside it, openxlings/xim-pkgindex (tools).