Skip to content

feat: lockfile v2, index pin/unpin CLI, fetcher routing for custom indices#40

Merged
Sunrisepeak merged 2 commits into
mainfrom
feat/indices-lockfile-routing
May 15, 2026
Merged

feat: lockfile v2, index pin/unpin CLI, fetcher routing for custom indices#40
Sunrisepeak merged 2 commits into
mainfrom
feat/indices-lockfile-routing

Conversation

@Sunrisepeak
Copy link
Copy Markdown
Member

Summary

Builds on #39 to complete the [indices] feature with three components:

  • Lockfile v2: [indices.<name>] sections lock index commit SHA + namespace field per package entry, with automatic v1→v2 migration
  • CLI commands: mcpp index pin <name> [<rev>] and mcpp index unpin <name> for hard-locking indices in mcpp.toml
  • Fetcher routing: dependency resolution routes through local path index, project-level .mcpp/data/, or global xlings home based on the index type

Changes

File What
src/pm/lock_io.cppm LockedIndex struct, v2 schema (indices sections + namespace), v1→v2 auto-migration, updated serialize/deserialize
src/lockfile.cppm Re-export LockedIndex
src/cli.cppm cmd_index_pin (text-based mcpp.toml editing, short→long form conversion), cmd_index_unpin (rev field removal), enhanced cmd_index_update (project-level refresh), fetcher routing in prepare_build via findIndexForNs helper, v2 lockfile write with namespace + index entries
src/pm/package_fetcher.cppm read_xpkg_lua_from_project_data() for .mcpp/data/ scanning, install_path_from_project_data() for project-level xpkgs
tests/e2e/43_indices_lockfile.sh v2 lockfile structure verification, pin/unpin command testing, index list regression check

Lockfile v2 format

version = 2

[indices."acme"]
url = "git@gitlab.example.com:platform/mcpp-index.git"
rev = "abc123def0123456789abcdef0123456789abcd"

[package."gtest"]
namespace = "mcpplibs"
version = "1.15.2"
source = "index+mcpplibs@sha:<from-xlings>"
hash = "sha256:..."

Fetcher routing logic

dep (ns, name, version)
  → findIndexForNs(ns) → IndexSpec?
    → is_local()    → read_xpkg_lua_from_path(spec.path, name)
    → is custom git → install_path_from_project_data(.mcpp/data/)
    → default       → global xlings home (unchanged)

Test plan

  • mcpp build compiles successfully
  • E2E 43_indices_lockfile.sh passes (v2 structure, pin/unpin, index list)
  • E2E 42_custom_local_index.sh passes (no regression)
  • E2E 01_help_and_version.sh passes (no regression)

…indices

Lockfile v2: add [indices.<name>] sections with url/rev fields, add
namespace field to [package.*] entries, and v1->v2 migration on load.

CLI: add `mcpp index pin <name> [<rev>]` and `mcpp index unpin <name>`
commands for pinning/unpinning custom index revisions in mcpp.toml.
Enhance `mcpp index update` to also refresh project-level custom indices.

Fetcher routing: for deps whose namespace matches a custom git index,
check project-level .mcpp/data/ before the global xlings home. For
local path indices, read xpkg.lua directly from the index path.

E2E test covering lockfile v2 format, v1 migration, pin/unpin commands.
@Sunrisepeak Sunrisepeak force-pushed the feat/indices-lockfile-routing branch from 9a2d372 to 2e91734 Compare May 15, 2026 21:24
@Sunrisepeak Sunrisepeak changed the base branch from feat/custom-indices to main May 15, 2026 21:24
@Sunrisepeak Sunrisepeak merged commit 2e69e2d into main May 15, 2026
1 check passed
@Sunrisepeak Sunrisepeak mentioned this pull request May 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant