From 14f8600adff8719ef3fd0c73d889c818c0237650 Mon Sep 17 00:00:00 2001 From: Sunrisepeak Date: Fri, 4 Dec 2026 00:50:33 +0900 Subject: [PATCH] mcpplibs.cmdline 0.1.0: flags before actions, module-based Agent Skills Add 0.1.0 to the three platform tables (plain upstream url: no CN mirror yet) and switch the descriptor to the upstream mcpp.toml, which carries the agent-skills feature and the mcpp/cmdline build-package re-export. 0.0.1 predates the manifest, so install() writes a minimal one for it; no version is removed. The consumer example moves to 0.1.0. --- pkgs/c/cmdline.lua | 78 ++++++++++++++++++++++++-------- tests/examples/cmdline/mcpp.toml | 2 +- 2 files changed, 60 insertions(+), 20 deletions(-) diff --git a/pkgs/c/cmdline.lua b/pkgs/c/cmdline.lua index d5a601c1..11705764 100644 --- a/pkgs/c/cmdline.lua +++ b/pkgs/c/cmdline.lua @@ -1,14 +1,13 @@ --- Form B (inline mcpp = { ... }) carries the build info for ALL listed versions. --- 0.0.2+ ships an upstream `mcpp.toml`, but `mcpp` is a package-level field --- (not per-version) in xpkg.lua, so to keep 0.0.1 installable we keep the --- workaround table here. The src/**/*.cppm layout is the same across 0.0.1, --- 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.6 and 0.0.7 (0.0.3 adds src/completions*.cppm, which the glob takes in; --- 0.0.6 replaces src/completions/ with src/complete.cppm; 0.0.7 changes src/cmdline.cppm only), --- so a single Form B block describes every version correctly. --- When 0.0.1 is dropped, this can be replaced with `mcpp = "*/mcpp.toml"`. +import("xim.libxpkg.pkginfo") +import("xim.libxpkg.log") + +-- Form A: the upstream `mcpp.toml` carries every version from 0.0.2 on. The +-- 0.1.0 manifest also carries the agent-skills feature and the +-- `[build-dependencies]` path re-export of the mcpp/cmdline build package, +-- which a Form B table cannot state. 0.0.1 (the only version without a +-- manifest) is dropped. -- --- M6.x: Form B paths are globs relative to the verdir (the untouched --- xlings extract dir). The leading `*/` absorbs the GitHub tarball's +-- The leading `*/` in the manifest glob absorbs the GitHub tarball's -- `cmdline-/` wrap layer. package = { spec = "1", @@ -18,6 +17,12 @@ package = { licenses = {"Apache-2.0"}, repo = "https://github.com/mcpplibs/cmdline", type = "package", + extensions = { + autoupdate = { + tag = "v${version}", + url = "https://github.com/mcpplibs/cmdline/archive/refs/tags/v${version}.tar.gz", + }, + }, xpm = { linux = { @@ -70,6 +75,11 @@ package = { }, sha256 = "2e998d70953c0da856dc2131902414ab25bc9faafd0bae255290d833ad0e9b49", }, + ["0.1.0"] = { + -- No CN mirror yet: a plain-string url (see docs/cn-mirror.md). + url = "https://github.com/mcpplibs/cmdline/archive/refs/tags/v0.1.0.tar.gz", + sha256 = "2167b41288d7bdfcd8a22c33fb3bbfa2a9df2d5900bb00b282a4260ad615971d", + }, }, macosx = { ["0.0.1"] = { @@ -121,6 +131,11 @@ package = { }, sha256 = "2e998d70953c0da856dc2131902414ab25bc9faafd0bae255290d833ad0e9b49", }, + ["0.1.0"] = { + -- No CN mirror yet: a plain-string url (see docs/cn-mirror.md). + url = "https://github.com/mcpplibs/cmdline/archive/refs/tags/v0.1.0.tar.gz", + sha256 = "2167b41288d7bdfcd8a22c33fb3bbfa2a9df2d5900bb00b282a4260ad615971d", + }, }, windows = { ["0.0.1"] = { @@ -172,16 +187,41 @@ package = { }, sha256 = "2e998d70953c0da856dc2131902414ab25bc9faafd0bae255290d833ad0e9b49", }, + ["0.1.0"] = { + -- No CN mirror yet: a plain-string url (see docs/cn-mirror.md). + url = "https://github.com/mcpplibs/cmdline/archive/refs/tags/v0.1.0.tar.gz", + sha256 = "2167b41288d7bdfcd8a22c33fb3bbfa2a9df2d5900bb00b282a4260ad615971d", + }, }, }, - mcpp = { - schema = "0.1", - language = "c++23", - import_std = true, - modules = { "mcpplibs.cmdline" }, - sources = { "*/src/**/*.cppm" }, - targets = { ["cmdline"] = { kind = "lib" } }, - deps = { }, - }, + mcpp = "*/mcpp.toml", } + +-- 0.0.1 is the only archive without an upstream manifest. install() writes a +-- minimal one beside its sources so the `*/mcpp.toml` pointer resolves for it +-- too; every newer version ships its own and is left untouched. +local LEGACY_TOML = [==[ +[package] +namespace = "mcpplibs" +name = "cmdline" +version = "0.0.1" +standard = "c++23" + +[build] +sources = ["src/*.cppm"] + +[modules] +exports = ["mcpplibs.cmdline"] +]==] + +function install() + if pkginfo.version() ~= "0.0.1" then return true end + local layer = path.join(pkginfo.install_dir(), "cmdline-0.0.1") + if not os.isfile(path.join(layer, "src", "cmdline.cppm")) then + log.error("cmdline 0.0.1: no src/cmdline.cppm under %s after unpacking", layer) + return false + end + io.writefile(path.join(layer, "mcpp.toml"), LEGACY_TOML) + return true +end diff --git a/tests/examples/cmdline/mcpp.toml b/tests/examples/cmdline/mcpp.toml index 10390347..19b13135 100644 --- a/tests/examples/cmdline/mcpp.toml +++ b/tests/examples/cmdline/mcpp.toml @@ -10,4 +10,4 @@ name = "cmdline-tests" version = "0.1.0" [dependencies] -mcpplibs.cmdline = "0.0.7" +mcpplibs.cmdline = "0.1.0"