Skip to content

Commit 14f8600

Browse files
committed
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.
1 parent 47e3094 commit 14f8600

2 files changed

Lines changed: 60 additions & 20 deletions

File tree

‎pkgs/c/cmdline.lua‎

Lines changed: 59 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
-- Form B (inline mcpp = { ... }) carries the build info for ALL listed versions.
2-
-- 0.0.2+ ships an upstream `mcpp.toml`, but `mcpp` is a package-level field
3-
-- (not per-version) in xpkg.lua, so to keep 0.0.1 installable we keep the
4-
-- workaround table here. The src/**/*.cppm layout is the same across 0.0.1,
5-
-- 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;
6-
-- 0.0.6 replaces src/completions/ with src/complete.cppm; 0.0.7 changes src/cmdline.cppm only),
7-
-- so a single Form B block describes every version correctly.
8-
-- When 0.0.1 is dropped, this can be replaced with `mcpp = "*/mcpp.toml"`.
1+
import("xim.libxpkg.pkginfo")
2+
import("xim.libxpkg.log")
3+
4+
-- Form A: the upstream `mcpp.toml` carries every version from 0.0.2 on. The
5+
-- 0.1.0 manifest also carries the agent-skills feature and the
6+
-- `[build-dependencies]` path re-export of the mcpp/cmdline build package,
7+
-- which a Form B table cannot state. 0.0.1 (the only version without a
8+
-- manifest) is dropped.
99
--
10-
-- M6.x: Form B paths are globs relative to the verdir (the untouched
11-
-- xlings extract dir). The leading `*/` absorbs the GitHub tarball's
10+
-- The leading `*/` in the manifest glob absorbs the GitHub tarball's
1211
-- `cmdline-<tag>/` wrap layer.
1312
package = {
1413
spec = "1",
@@ -18,6 +17,12 @@ package = {
1817
licenses = {"Apache-2.0"},
1918
repo = "https://github.com/mcpplibs/cmdline",
2019
type = "package",
20+
extensions = {
21+
autoupdate = {
22+
tag = "v${version}",
23+
url = "https://github.com/mcpplibs/cmdline/archive/refs/tags/v${version}.tar.gz",
24+
},
25+
},
2126

2227
xpm = {
2328
linux = {
@@ -70,6 +75,11 @@ package = {
7075
},
7176
sha256 = "2e998d70953c0da856dc2131902414ab25bc9faafd0bae255290d833ad0e9b49",
7277
},
78+
["0.1.0"] = {
79+
-- No CN mirror yet: a plain-string url (see docs/cn-mirror.md).
80+
url = "https://github.com/mcpplibs/cmdline/archive/refs/tags/v0.1.0.tar.gz",
81+
sha256 = "2167b41288d7bdfcd8a22c33fb3bbfa2a9df2d5900bb00b282a4260ad615971d",
82+
},
7383
},
7484
macosx = {
7585
["0.0.1"] = {
@@ -121,6 +131,11 @@ package = {
121131
},
122132
sha256 = "2e998d70953c0da856dc2131902414ab25bc9faafd0bae255290d833ad0e9b49",
123133
},
134+
["0.1.0"] = {
135+
-- No CN mirror yet: a plain-string url (see docs/cn-mirror.md).
136+
url = "https://github.com/mcpplibs/cmdline/archive/refs/tags/v0.1.0.tar.gz",
137+
sha256 = "2167b41288d7bdfcd8a22c33fb3bbfa2a9df2d5900bb00b282a4260ad615971d",
138+
},
124139
},
125140
windows = {
126141
["0.0.1"] = {
@@ -172,16 +187,41 @@ package = {
172187
},
173188
sha256 = "2e998d70953c0da856dc2131902414ab25bc9faafd0bae255290d833ad0e9b49",
174189
},
190+
["0.1.0"] = {
191+
-- No CN mirror yet: a plain-string url (see docs/cn-mirror.md).
192+
url = "https://github.com/mcpplibs/cmdline/archive/refs/tags/v0.1.0.tar.gz",
193+
sha256 = "2167b41288d7bdfcd8a22c33fb3bbfa2a9df2d5900bb00b282a4260ad615971d",
194+
},
175195
},
176196
},
177197

178-
mcpp = {
179-
schema = "0.1",
180-
language = "c++23",
181-
import_std = true,
182-
modules = { "mcpplibs.cmdline" },
183-
sources = { "*/src/**/*.cppm" },
184-
targets = { ["cmdline"] = { kind = "lib" } },
185-
deps = { },
186-
},
198+
mcpp = "*/mcpp.toml",
187199
}
200+
201+
-- 0.0.1 is the only archive without an upstream manifest. install() writes a
202+
-- minimal one beside its sources so the `*/mcpp.toml` pointer resolves for it
203+
-- too; every newer version ships its own and is left untouched.
204+
local LEGACY_TOML = [==[
205+
[package]
206+
namespace = "mcpplibs"
207+
name = "cmdline"
208+
version = "0.0.1"
209+
standard = "c++23"
210+
211+
[build]
212+
sources = ["src/*.cppm"]
213+
214+
[modules]
215+
exports = ["mcpplibs.cmdline"]
216+
]==]
217+
218+
function install()
219+
if pkginfo.version() ~= "0.0.1" then return true end
220+
local layer = path.join(pkginfo.install_dir(), "cmdline-0.0.1")
221+
if not os.isfile(path.join(layer, "src", "cmdline.cppm")) then
222+
log.error("cmdline 0.0.1: no src/cmdline.cppm under %s after unpacking", layer)
223+
return false
224+
end
225+
io.writefile(path.join(layer, "mcpp.toml"), LEGACY_TOML)
226+
return true
227+
end

‎tests/examples/cmdline/mcpp.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ name = "cmdline-tests"
1010
version = "0.1.0"
1111

1212
[dependencies]
13-
mcpplibs.cmdline = "0.0.7"
13+
mcpplibs.cmdline = "0.1.0"

0 commit comments

Comments
 (0)