Skip to content

Commit 3791a23

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 3791a23

2 files changed

Lines changed: 51 additions & 20 deletions

File tree

‎pkgs/c/cmdline.lua‎

Lines changed: 50 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
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+
-- Form A: the upstream `mcpp.toml` carries every version from 0.0.2 on. The
2+
-- 0.1.0 manifest also carries the agent-skills feature and the
3+
-- `[build-dependencies]` path re-export of the mcpp/cmdline build package,
4+
-- which a Form B table cannot state. 0.0.1 (the only version without a
5+
-- manifest) is dropped.
96
--
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
7+
-- The leading `*/` in the manifest glob absorbs the GitHub tarball's
128
-- `cmdline-<tag>/` wrap layer.
139
package = {
1410
spec = "1",
@@ -70,6 +66,11 @@ package = {
7066
},
7167
sha256 = "2e998d70953c0da856dc2131902414ab25bc9faafd0bae255290d833ad0e9b49",
7268
},
69+
["0.1.0"] = {
70+
-- No CN mirror yet: a plain-string url (see docs/cn-mirror.md).
71+
url = "https://github.com/mcpplibs/cmdline/archive/refs/tags/v0.1.0.tar.gz",
72+
sha256 = "2167b41288d7bdfcd8a22c33fb3bbfa2a9df2d5900bb00b282a4260ad615971d",
73+
},
7374
},
7475
macosx = {
7576
["0.0.1"] = {
@@ -121,6 +122,11 @@ package = {
121122
},
122123
sha256 = "2e998d70953c0da856dc2131902414ab25bc9faafd0bae255290d833ad0e9b49",
123124
},
125+
["0.1.0"] = {
126+
-- No CN mirror yet: a plain-string url (see docs/cn-mirror.md).
127+
url = "https://github.com/mcpplibs/cmdline/archive/refs/tags/v0.1.0.tar.gz",
128+
sha256 = "2167b41288d7bdfcd8a22c33fb3bbfa2a9df2d5900bb00b282a4260ad615971d",
129+
},
124130
},
125131
windows = {
126132
["0.0.1"] = {
@@ -172,16 +178,41 @@ package = {
172178
},
173179
sha256 = "2e998d70953c0da856dc2131902414ab25bc9faafd0bae255290d833ad0e9b49",
174180
},
181+
["0.1.0"] = {
182+
-- No CN mirror yet: a plain-string url (see docs/cn-mirror.md).
183+
url = "https://github.com/mcpplibs/cmdline/archive/refs/tags/v0.1.0.tar.gz",
184+
sha256 = "2167b41288d7bdfcd8a22c33fb3bbfa2a9df2d5900bb00b282a4260ad615971d",
185+
},
175186
},
176187
},
177188

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-
},
189+
mcpp = "*/mcpp.toml",
187190
}
191+
192+
-- 0.0.1 is the only archive without an upstream manifest. install() writes a
193+
-- minimal one beside its sources so the `*/mcpp.toml` pointer resolves for it
194+
-- too; every newer version ships its own and is left untouched.
195+
local LEGACY_TOML = [==[
196+
[package]
197+
namespace = "mcpplibs"
198+
name = "cmdline"
199+
version = "0.0.1"
200+
standard = "c++23"
201+
202+
[build]
203+
sources = ["src/*.cppm"]
204+
205+
[modules]
206+
exports = ["mcpplibs.cmdline"]
207+
]==]
208+
209+
function install()
210+
if pkginfo.version() ~= "0.0.1" then return true end
211+
local layer = path.join(pkginfo.install_dir(), "cmdline-0.0.1")
212+
if not os.isfile(path.join(layer, "src", "cmdline.cppm")) then
213+
log.error("cmdline 0.0.1: no src/cmdline.cppm under %s after unpacking", layer)
214+
return false
215+
end
216+
io.writefile(path.join(layer, "mcpp.toml"), LEGACY_TOML)
217+
return true
218+
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)