Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .agents/docs/2026-11-14-add-julixian-tomlkitpp-plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Add `julixian.tomlkitpp` (v1.0.0)

## 1. Source & Package Shape

- **Upstream Repository**: `https://github.com/julixian/tomlkitpp`
- **Package Identity**: `namespace = "julixian"`, `name = "tomlkitpp"` (`pkgs/j/julixian.tomlkitpp.lua`)
- **Version & Tag**: `1.0.0` (`v1.0.0`, SHA256 `0a242d7eed2bf1fc785b6becf45b78f948c07c4e36097f4b898e300239691979`, verified across repeated downloads)
- **License**: `Apache-2.0`
- **Shape**: **Form A** native `mcpp` C++23 module library (`export module tomlkitpp;`).
- Upstream ships a `[workspace]` manifest at the repository root (`mcpp.toml`) covering both the library (`tomlkitpp/`) and the `toml-test` compliance adapter (`tools/toml-test-adapter/`).
- The self-contained library package manifest lives at `tomlkitpp/mcpp.toml`, referenced via `mcpp = "*/tomlkitpp/mcpp.toml"`.
- Ships a default starter template at `templates/quickstart/` for `mcpp new <name> --template julixian.tomlkitpp`.

## 2. Mirror & Autoupdate

- **CN Mirror**: Author submission without `gitcode.com/mcpp-res` write access; uses plain-string upstream GitHub archive URL per `docs/cn-mirror.md` fallback rules.
- **Autoupdate**: Configured `extensions.autoupdate` with `tag = "v${version}"` and `url = "https://github.com/julixian/tomlkitpp/archive/refs/tags/${tag}.tar.gz"`.

## 3. Feature Assessment

- Pure C++23 standard library module library (`import std;`), cross-platform across Linux, macOS, and Windows with zero external dependencies and no optional compiled components; no `features` gating required.

## 4. Consumer Smoke Test

- Added workspace member `tests/examples/julixian.tomlkitpp` exercising `import tomlkitpp;`, TOML v1.1.0 parsing (optional seconds, `\xHH` escapes, multiline/trailing-comma inline tables), multidimensional subscript edits, and comment/radix-preserving serialization round-trip.
1 change: 1 addition & 0 deletions mcpp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ members = [
"tests/examples/imgui-module",
"tests/examples/imgui-window",
"tests/examples/jwt-cpp",
"tests/examples/julixian.tomlkitpp",
"tests/examples/libstdcxx-llvm",
"tests/examples/marzer.tomlplusplus",
"tests/examples/marzer.tomlplusplus-build-mcpp",
Expand Down
48 changes: 48 additions & 0 deletions pkgs/j/julixian.tomlkitpp.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
-- Form A descriptor: tomlkitpp ships its own native mcpp.toml under tomlkitpp/.
-- The archive root mcpp.toml is the upstream [workspace] manifest (which also
-- covers the toml-test compliance adapter), so `mcpp = "*/tomlkitpp/mcpp.toml"`
-- points directly at the library package manifest.
--
-- Pure C++23 standard library implementation (`export module tomlkitpp;`),
-- cross-platform across Linux, macOS, and Windows with no external dependencies.
-- No mcpp-res mirror is configured yet (no CN write access); the plain GLOBAL
-- URL is used until a maintainer mirrors the tarball.
package = {
spec = "1",
namespace = "julixian",
name = "tomlkitpp",
description = "C++23 module-only format-preserving TOML v1.1.0 parser, editor, and serializer (import tomlkitpp;)",
licenses = {"Apache-2.0"},
repo = "https://github.com/julixian/tomlkitpp",
type = "package",

extensions = {
autoupdate = {
tag = "v${version}",
url = "https://github.com/julixian/tomlkitpp/archive/refs/tags/${tag}.tar.gz",
},
},

xpm = {
linux = {
["1.0.0"] = {
url = "https://github.com/julixian/tomlkitpp/archive/refs/tags/v1.0.0.tar.gz",
sha256 = "0a242d7eed2bf1fc785b6becf45b78f948c07c4e36097f4b898e300239691979",
},
},
macosx = {
["1.0.0"] = {
url = "https://github.com/julixian/tomlkitpp/archive/refs/tags/v1.0.0.tar.gz",
sha256 = "0a242d7eed2bf1fc785b6becf45b78f948c07c4e36097f4b898e300239691979",
},
},
windows = {
["1.0.0"] = {
url = "https://github.com/julixian/tomlkitpp/archive/refs/tags/v1.0.0.tar.gz",
sha256 = "0a242d7eed2bf1fc785b6becf45b78f948c07c4e36097f4b898e300239691979",
},
},
},

mcpp = "*/tomlkitpp/mcpp.toml",
}
15 changes: 15 additions & 0 deletions tests/examples/julixian.tomlkitpp/mcpp.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# julixian.tomlkitpp test project: consumes the native Form A C++23 module
# `tomlkitpp` and verifies TOML v1.1.0 parsing, multidimensional subscript edits,
# and comment/format-preserving round-trip serialization under `mcpp test`.
#
# Overrides the workspace-root `compat` redirect with `julixian` so the package
# resolves from this checkout.
[indices]
julixian = { path = "../../.." }

[package]
name = "julixian-tomlkitpp-tests"
version = "0.1.0"

[dependencies.julixian]
tomlkitpp = "1.0.0"
42 changes: 42 additions & 0 deletions tests/examples/julixian.tomlkitpp/tests/parse_edit_roundtrip.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Behavioral test for julixian.tomlkitpp:
// TOML v1.1.0 parsing (optional seconds, multiline inline table, \xHH escape),
// typed lookup, in-place surgical edit, and comment/radix preservation.
import std;
import tomlkitpp;

int main() {
constexpr std::string_view input =
"# Header comment\n"
"mask = 0xff_00\n"
"\n"
"[server]\n"
"endpoint = { host = \"127.0.0.1\", port = 8080, }\n"
"window = 07:30 # TOML 1.1 optional seconds\n"
"tag = \"\\x41B\"\n";

auto doc = tomlkit::tryParse(input);
if (!doc) return 1;

if (tomlkit::findOr(*doc, "mask", std::int64_t{0}) != 0xff00) return 2;
if ((*doc)["server", "endpoint", "host"].get<std::string>() != "127.0.0.1") return 3;
if ((*doc)["server", "endpoint", "port"].get<int>() != 8080) return 4;
if ((*doc)["server", "tag"].get<std::string>() != "AB") return 5;

const auto lt = (*doc)["server", "window"].tryGet<tomlkit::LocalTime>();
if (!lt || lt->hour != 7 || lt->minute != 30 || lt->hasSeconds) return 6;

// Surgical edit: modify port while keeping comments, 0xff_00 literal, and optional seconds intact.
(*doc)["server", "endpoint", "port"] = 9090;
const std::string emitted = tomlkit::format(*doc);

if (emitted.find("# Header comment\n") == std::string::npos) return 7;
if (emitted.find("mask = 0xff_00\n") == std::string::npos) return 8;
if (emitted.find("# TOML 1.1 optional seconds\n") == std::string::npos) return 9;
if (emitted.find("window = 07:30") == std::string::npos) return 10;

auto reparsed = tomlkit::tryParse(emitted);
if (!reparsed) return 11;
if ((*reparsed)["server", "endpoint", "port"].get<int>() != 9090) return 12;

return 0;
}
Loading