Skip to content
alexthebergePublic

About

This is my solution to manage my versioning hangups.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

MVS Engine (mvs-manager)

Versioned with MVS

Cross-platform CLI implementing multidimensional versioning: [ARCH].[FEAT].[PROT].[FIX]-[CONT].

Package SemVer / release tags project to ARCH.FEAT.FIX. Protocol (PROT) stays in mvs.json for host/extension compatibility. The scheme itself is specified independently of this tool in docs/SPEC.md, so other implementations can exist.

To mark your own project's README, add the same badge:

[![Versioned with MVS](https://img.shields.io/badge/versioned%20with-MVS-6e40c9)](https://github.com/alextheberge/MVSengine)

Editor: VS Code, Cursor, VSCodium

The companion extension mvs-vscode runs mvs-manager from the editor, surfaces lint --format json in the Problems view, and exposes MVS commands. Install from a VSIX, the VS Marketplace, or Open VSX as described in that repository. Keep mvs-manager on your PATH or point the extension at the binary with mvsManager.executablePath.

Why Post-SemVer for Apps

  • Separate data breaks from integration breaks: ARCH and PROT move independently.
  • Stop silent plugin/SDK regressions: lint fails when public API or AI contract drift is unaccounted.
  • Keep compatibility explicit: protocol ranges, legacy shims, capabilities, and context live in mvs.json.

Quick Start (4 Steps)

1) Install mvs-manager

macOS/Linux

curl -fsSL https://raw.githubusercontent.com/alextheberge/MVSengine/master/scripts/install.sh | bash

Windows PowerShell

irm https://raw.githubusercontent.com/alextheberge/MVSengine/master/scripts/install.ps1 | iex

Once installed, mvs-manager can update itself with:

mvs-manager self-update

self-update downloads the release archive and checksums.txt over HTTPS inside the running binary, verifies SHA-256, extracts mvs-manager (or mvs-manager.exe), and installs next to the current executable. It does not run curl | bash or irm | iex on the install scripts. For debugging only, you can set MVS_LEGACY_SHELL_INSTALL=1 to restore that legacy path (not recommended for production).

self-update refuses Cargo target/debug|release, Nix store, or read-only locations unless you set MVS_ALLOW_UNSAFE_SELF_UPDATE=1. Forks should set MVS_REPO / MVS_UPDATE_REPO to owner/name so updates match install.sh.

See docs/SUPPLY_CHAIN.md for what is verified on upgrade and what is not.

Interactive runs of the CLI also notify on stderr when a newer stable release is available (GitHub releases/latest only—prereleases are not advertised there).

Diagnostics and install troubleshooting:

mvs-manager doctor

See docs/INSTALL_AND_CI.md for CI env vars, the Linux/macOS/Windows PR gate, and pinned installs; docs/DISTRIBUTION.md for packaging; docs/SUPPLY_CHAIN.md for TLS, minisign, and download limits on self-update.

2) Initialize your project manifest

mvs-manager generate --root . --manifest mvs.json --context cli

3) Add decorators in your code

Decorator syntax can be function-style or : style:

// @mvs-feature("offline_storage")
// @mvs-protocol("auth-api-v1")
export function login(user: string): string {
  return user;
}
/// @mvs-feature("runtime_bridge")
/// @mvs-protocol("host_extension_handshake")
pub fn handshake(version: u32) -> bool {
    version > 0
}

Only actual source comments are scanned. Examples embedded in string literals, test fixtures, or documentation blobs inside source files do not count as decorators.

4) Run the initialize/verify/reconcile loop

# verify current code matches mvs.json
mvs-manager lint --root . --manifest mvs.json

# after code/decorator/API changes, reconcile and persist rationale/history
mvs-manager generate --root . --manifest mvs.json --context cli

# bug fix / minor release with no FEAT or PROT drift
mvs-manager generate --root . --manifest mvs.json --context cli --fix

Pin the CLI as a CI/tool dependency (GitHub Action, npm wrapper, or install.sh) — see docs/INSTALL_AND_CI.md. The stable 2.x identity contract is in docs/CONTRACT_2X.md.

Or keep it running as a maintenance loop while you work:

mvs-manager watch --root . --manifest mvs.json --remediate --interval-secs 30

For schedulers such as cron, launchd, or systemd, use one-shot mode:

mvs-manager watch --root . --manifest mvs.json --once --remediate

Keep Package Versions in Sync

mvs-manager derives the registry-facing SemVer projection (ARCH.FEAT.FIX) from mvs.json, but package managers each read that version from their own file. sync keeps those files in lock-step without hand-editing them:

# Auto-detects Cargo.toml, package.json, pyproject.toml, pom.xml, and other
# well-known version files when release.version_files is empty.
mvs-manager sync --root . --manifest mvs.json --check   # CI gate: fails on drift
mvs-manager sync --root . --manifest mvs.json            # writes the projection in place
mvs-manager sync --root . --manifest mvs.json --save-detected  # persist what was auto-detected

Only the version span inside each file is touched; every other byte of formatting is preserved. Declare files explicitly instead of relying on auto-detection by adding a release.version_files array to mvs.json:

{
  "release": {
    "version_files": [
      { "path": "Cargo.toml", "kind": "cargo_toml" },
      { "path": "packages/mvs-manager/package.json", "kind": "npm_package_json" }
    ]
  }
}

Supported kind values: cargo_toml, npm_package_json, pyproject_pep621, pyproject_poetry, composer_json, pubspec_yaml, gradle_properties, build_gradle, pom_xml, csproj, gemspec_literal, ruby_version_constant, lua_rockspec, plain_version_file. An optional projection of full writes the complete identity.mvs string instead of the default semver projection.

Migrating From Another Versioning Scheme

mvs-manager semver prints the SemVer projection for scripts and CI (2.6.1), with --for git-tag|npm|cargo|pep440|go|maven|docker|all for ecosystem-specific syntax, --prerelease, and --with-prot to carry PROT as build metadata (2.6.1+prot.6) so it isn't lost in places that only see a version string. See docs/USAGE.md section 10.

convert-version parses a legacy version string (SemVer, ZeroVer, PEP 440, Maven/Gradle, .NET four-part, Go module tags, CalVer, a bare build number, Debian/RPM epoch:version-revision, or a custom regex) and maps it onto MVS axes, so you can see what a migrated identity would look like before touching mvs.json:

mvs-manager convert-version --version 1.4.2                 # -> 1.4.0.2-cli (SemVer default mapping)
mvs-manager convert-version --version 0.3.1                 # ZeroVer: flags minor bumps as often-breaking
mvs-manager convert-version --version 24.04                 # CalVer: rebases to 1.0.0.0-cli by default
mvs-manager convert-version --version 24.04 --map year=arch,month=feat,patch=fix  # date-passthrough instead
mvs-manager convert-version --version "2:1.4.2-3ubuntu1" --scheme debian-rpm      # epoch folds into ARCH
mvs-manager convert-version --version "1.2.3.4" --scheme dotnet4                  # 4th component flagged, not silently dropped
mvs-manager convert-version --version "R7-F12-P3" --scheme custom \
  --scheme-regex '(?P<arch>\d+)-F(?P<feat>\d+)-P(?P<prot>\d+)'                    # fully custom mapping

The default component -> axis mapping for each scheme, and every axis not covered by it, is documented in docs/USAGE.md. --map replaces the mapping entirely; advisories in the output call out anything a scheme's numbering can't fully represent (a dropped .NET revision, a folded PEP 440/Debian epoch, CalVer's rebase choice) so nothing is silently discarded. convert-version only prints a conversion for one version string; migrate (below) turns that into a full, reversible migration of a project.

Migrating a Whole Project

migrate takes a project from any versioning scheme to MVS in one flow, using convert-version's scheme translators under the hood:

mvs-manager migrate detect --root .                 # what version sources, git tags, and release tooling exist
mvs-manager migrate plan --root . --context cli      # preview the proposed mvs.json; writes nothing
mvs-manager migrate backfill --root . --limit 30     # replay git tag history for a SemVer-honesty report
mvs-manager migrate apply --root . --context cli     # write mvs.json, sync version files, save a snapshot
mvs-manager migrate rollback --root .                # undo the last apply from its snapshot
  • detect lists every recognized version file (flagging disagreement between them), the git tag history, the auto-detected scheme, and any release tooling it recognizes (.bumpversion.cfg and tbump.toml have their declared file lists imported directly into the proposed release.version_files; semantic-release, release-please, changesets, GitVersion, Nerdbank.GitVersioning, cargo-release, goreleaser, and lerna are detected by config presence).
  • plan converts the latest git tag (or --from-version, or a detected version file, in that order) into a proposed identity, scan policy, and release.version_files, plus a full legacy-tag -> MVS-identity preview table. It refuses to propose a SemVer projection lower than the latest published tag unless you pass --allow-non-monotonic.
  • backfill checks out each of the last --limit git tags into a disposable worktree, crawls it, and diffs consecutive snapshots to find SemVer-honesty violations: a patch release that changed the public API/protocol surface (patches should carry zero surface change), or a minor release that removed surface (additions are fine in a minor under conventional SemVer; removals aren't). This is the strongest case for switching — it shows a team its own history of quietly-breaking releases.
  • apply runs the same conversion as plan and writes it: mvs.json, plus sync-ing every declared version file, after saving everything it's about to touch to .mvs/migration-snapshot.json. Refuses to overwrite an existing manifest without --force.
  • rollback restores exactly what apply overwrote (deleting mvs.json if it didn't exist before) and removes the snapshot, so a rollback runs cleanly exactly once per apply.

Bootstrapping Decorators

Hand-placing @mvs-feature/@mvs-protocol comments is the biggest manual cost in adopting MVS. suggest-decorators proposes them from the code you already have:

mvs-manager suggest-decorators --root .          # preview; writes nothing
mvs-manager suggest-decorators --root . --write  # insert them
  • One protocol suggestion per undecorated file that has public API surface (a boundary); one feature suggestion per undecorated directory of such files (a capability cluster), placed on that directory's alphabetically-first file.
  • Names come from the file/directory path (src/auth/login.rs -> protocol auth_login), but a name is replaced with a matching Conventional Commits scope's own spelling when one exists in recent history — feat(offline-storage): ... in your log means the suggested feature is offline-storage, not a re-derived offline_storage.
  • Already-decorated files/directories are never suggested again, so --write is idempotent: run it, then run it again, and the second run finds nothing left to propose.
  • --write inserts each decorator using that file's own comment syntax (/// for Rust, // for TS/JS/Go/Java/Kotlin/C#/Swift/Dart, # for Python/Ruby, -- for Lua/Luau, right after PHP's <?php tag) right after any leading header comment/shebang — the exact same comment tokenization the crawler reads back, so a written suggestion is guaranteed to be picked up by the very next lint.
  • Non-code protocol surfaces (OpenAPI, GraphQL SDL, .proto, JSON Schema, Avro) aren't covered yet — see the Roadmap.

Trying MVS With Nothing at Stake

A team can run MVS alongside its existing release process before deciding to gate on it:

mvs-manager lint --advisory --root . --manifest mvs.json

Shadow mode runs the exact same drift checks as lint, but always exits 0 and reports what MVS would require instead of failing the build: status is advisory_clean or advisory_drift, and a shadow object gives the projected identity (MVS would require 2.5.0.1-cli, currently 2.4.4.1-cli) alongside the current one. Because PROT never appears in the SemVer projection, this is often the clearest way to show a team a protocol break their existing process would publish invisibly.

  • GitHub: .github/actions/mvs-action with mode: shadow posts (and keeps updated) a single PR comment with the shadow summary and, when the base branch's manifest is reachable, the axis diff between base and head. See docs/INSTALL_AND_CI.md.
  • GitLab CI / CircleCI / Azure Pipelines / Buildkite: ready-made snippets in docs/INSTALL_AND_CI.md.
  • pre-commit: .pre-commit-hooks.yaml exposes mvs-lint-advisory (shadow) and mvs-lint (blocking) hook IDs for the pre-commit framework.

Dependency Ranges for Non-MVS Consumers

A downstream package that depends on yours doesn't need to adopt MVS to benefit from it. range converts a PROT compatibility range into the native constraint syntax for a package manager, using the manifest's history to find which published arch.feat.fix versions actually had a PROT value in that range:

mvs-manager range --manifest mvs.json --host --for npm,cargo,pip,maven
mvs-manager semver
mvs-manager semver --for git-tag --prerelease rc.1 --with-prot
mvs-manager semver --for all --format json
mvs-manager range --manifest mvs.json --min-prot 3 --max-prot 5 --for npm

--host/--extension read compatibility.host_range/compatibility.extension_range from the manifest instead of explicit --min-prot/--max-prot. The lower bound is inclusive; the upper bound is exclusive and only present when a later published version with a different PROT is known — otherwise the range is left open, since future compatibility isn't assumed.

Enforce MVS on Commit

make install-hooks

This installs a repo-managed pre-commit hook that runs make lint-manifest.

GitHub Release Setup (Required for Installer)

  1. Enable Actions with write access:
    • Repository Settings -> Actions -> Workflow permissions -> Read and write permissions
  2. Keep dogfood versions aligned:
    make dogfood-sync-version
    make ci
  3. Push version changes to main or master:
    • Auto Tag Version workflow creates canonical tag automatically.
    • If mvs.json is 0.2.3-cli, canonical tag is v0.2.3.
  4. Wait for Auto Tag Version to dispatch Release and publish assets:
    • mvs-manager-<version>-<target>.<tar.gz|zip>
    • checksums.txt
    • If needed, run Auto Tag Version manually from GitHub Actions (Run workflow) to force tag/release dispatch.

The installer (.../scripts/install.sh) depends on these release assets.

One-command flow from repo root:

make release-github

Release-candidate flow:

make release-rc RELEASE_TAG_SUFFIX=rc1 RELEASE_ALLOW_NON_DEFAULT=true

latest installers intentionally ignore prerelease tags. To install an RC explicitly, set MVS_VERSION=vX.Y.Z-rcN.

Local Build

make ci
make build-release

Core Commands

mvs-manager generate --root . --manifest mvs.json --context cli
mvs-manager generate --root . --manifest mvs.json --context edge.mobile --backwards-compatible 3
mvs-manager generate --root . --manifest mvs.json --context cli --public-api-root src/cli.rs
mvs-manager generate --root . --manifest mvs.json --context cli --public-api-root src/api.go --go-export-following package-only
mvs-manager generate --root . --manifest mvs.json --context cli --public-api-root src/lib.rs --rust-export-following public-modules
mvs-manager generate --root . --manifest mvs.json --context cli --exclude-path src/generated
mvs-manager generate --root . --manifest mvs.json --context cli --format json
mvs-manager lint --root . --manifest mvs.json
mvs-manager lint --root . --manifest mvs.json --format json
mvs-manager lint --root . --manifest mvs.json --available-model-capabilities tool_calling,json_schema,reasoning-v1
mvs-manager watch --root . --manifest mvs.json --remediate --interval-secs 30
mvs-manager watch --root . --manifest mvs.json --once --remediate
mvs-manager validate --host-manifest host.json --extension-manifest extension.json
mvs-manager validate --host-manifest host.json --extension-manifest extension.json --format json
mvs-manager validate --host-manifest host.json --extension-manifest extension.json --host-model-capabilities tool_calling,reasoning-v1
mvs-manager report --base-manifest old-mvs.json --target-manifest new-mvs.json
mvs-manager report --base-manifest old-mvs.json --target-manifest new-mvs.json --format json
mvs-manager sync --root . --manifest mvs.json --check
mvs-manager sync --root . --manifest mvs.json --save-detected
mvs-manager sync --root . --manifest mvs.json --dry-run --format json
mvs-manager convert-version --version 1.4.2
mvs-manager convert-version --version 24.04 --map year=arch,month=feat,patch=fix
mvs-manager convert-version --version "2:1.4.2-3ubuntu1" --scheme debian-rpm
mvs-manager migrate detect --root .
mvs-manager migrate plan --root . --context cli
mvs-manager migrate backfill --root . --limit 30
mvs-manager migrate apply --root . --context cli
mvs-manager migrate rollback --root .
mvs-manager suggest-decorators --root .
mvs-manager suggest-decorators --root . --write
mvs-manager lint --root . --manifest mvs.json --advisory
mvs-manager range --manifest mvs.json --host --for npm,cargo,pip,maven
mvs-manager self-update --check
mvs-manager self-update

mvs.json persists version-change rationale in history, enabling compatibility reports to explain protocol breaks (for example, auth-flow changes tied to a specific PROT).

watch is the maintenance-oriented workflow: it repeatedly runs lint, can auto-run generate when drift is found via --remediate, skips unchanged cycles by default, and supports --once for scheduler-friendly single-pass runs.

The stable 2.x manifest and command-output contract is documented in docs/CONTRACT_2X.md (identity) with command JSON continuity from docs/CONTRACT_1X.md. Checked-in golden fixtures under tests/fixtures/contracts/ back that contract so output and canonical evidence changes stay deliberate.

Semantic Evidence Snapshots

mvs-manager now stores the semantic surfaces it reasons about, not just their hashes. The evidence block in mvs.json includes:

  • feature_inventory: sorted unique @mvs-feature(...) tag names
  • protocol_inventory: sorted unique @mvs-protocol(...) tag names
  • public_api_inventory: sorted file + canonical signature entries for detected public API surfaces

This gives you two things:

  • deterministic hashing for version-axis decisions
  • machine-readable diffs explaining exactly what changed between manifest generations
  • machine-readable boundary debugging in generate --format json and lint --format json when scan policy shapes the public surface
  • scanner precision that ignores decorator-like examples inside source string literals

Typical evidence shape:

{
  "evidence": {
    "feature_hash": "…",
    "protocol_hash": "…",
    "public_api_hash": "…",
    "feature_inventory": [
      "manifest_generation",
      "manifest_linting"
    ],
    "protocol_inventory": [
      "cli_generate_command",
      "cli_lint_command"
    ],
    "public_api_inventory": [
      {
        "file": "src/cli.rs",
        "signature": "rust:enum Command"
      }
    ]
  }
}

If an older manifest predates these inventory snapshots, lint will fail until you regenerate once. That is intentional: it brings the manifest up to the current evidence model.

Rust API entries are now AST-normalized into stable, readable forms such as:

  • rust:fn run() -> i32
  • rust:impl-fn HostAdapter::connect(&self, target: &str) -> bool
  • rust:fn async load<'a, T>(value: &'a T) -> &'a T where T: Clone

This reduces formatting noise in public_api_inventory and makes policy patterns easier to author.

Scanner Precision

The crawler now tokenizes source before matching decorators, uses AST extraction for Rust, and uses parser-backed public API adapters for every other supported language: TypeScript/JavaScript, Go, Python, Java, Kotlin, C#, PHP, Ruby, Swift, Lua, Luau, and Dart (Dart uses line-regex extraction today because the published Tree-sitter grammar targets a newer ABI than the tree-sitter 0.24 stack pinned here; see docs/USAGE.md). Shopify-style Liquid (.liquid) is scanned for decorators inside HTML comments, {% comment %}…{% endcomment %}, and {% # … %} tags; templates do not emit public_api entries.

Internally, parser-backed extraction now dispatches through dedicated language adapters under src/mvs/crawler/adapters/, with shared language metadata in src/mvs/crawler/language.rs. That keeps new language work localized instead of expanding one monolithic extractor path.

Member signatures inside class-like scopes are now owner-qualified, and Java/C#/Kotlin signatures also include declared package or namespace context so inventories stay stable across files and modules. Typical forms include python:def Worker.run_job(...), ruby:def Demo::AuthApi#login(...), java:type public class demo.AuthApi, java:field public String demo.AuthApi.status, csharp:property public string Demo.AuthApi.DisplayName { get }, kotlin:const val demo.auth.API_VERSION: String, kotlin:val demo.auth.AuthApi.token: String, php:public readonly string AuthApi.$token, and swift:public func AuthApi.login(...).

  • @mvs-feature(...) and @mvs-protocol(...) are counted only when they appear in real comments
  • block comments such as /* ... */ are supported for decorator extraction
  • string literals and embedded fixture blobs are ignored during decorator extraction
  • TypeScript/JavaScript public API extraction handles multiline exports, named export clauses, re-exports, and default exports without depending on line-based regex matching; scan_policy.ts_export_following or --ts-export-following can follow same-workspace relative barrel re-exports, and workspace_only mode also follows same-workspace package.json export maps and imports maps, including wildcard subpaths, multi-condition entries, and package-local monorepo self-references, plus root tsconfig.json or jsconfig.json baseUrl and paths aliases so facade files contribute the concrete signatures they export instead of raw export ... from statements
  • Go public API extraction tracks exported func declarations, exported methods, exported named types, exported struct fields, exported embedded struct fields, exported interface methods, embedded interface type elements, exported constants, and exported package var declarations from syntax trees; scan_policy.go_export_following or --go-export-following can expand a rooted .go facade file to same-package sibling source files while skipping _test.go files
  • Rust public API extraction still uses AST-normalized signatures, and scan_policy.rust_export_following or --rust-export-following can expand a rooted Rust facade such as src/lib.rs across same-crate pub mod graphs, including nested inline public modules, without pulling in private-module files or tests/examples/benches; direct and chained same-crate pub use facades, including grouped and glob reexports that stay inside the crate, are also resolved onto the public alias names, including associated inherent methods, and scan_policy.rust_workspace_members or --rust-workspace-member can explicitly allow selected sibling crates when a facade intentionally reexports workspace members, including chained facade crates and crates with nonstandard [lib].path roots
  • Python public API extraction tracks public class and non-underscore def declarations, public type aliases, module-level constants such as API_VERSION or __all__, and public class-level constants such as Worker.STATUS, without promoting nested local helpers or private class bodies into the API inventory; when a parseable __all__ is present it becomes the top-level export boundary, including common alias, unpacking, and += composition patterns built from parseable literals, and explicit import re-exports are stored in canonical forms such as python:from auth.core import login as authorize; for same-workspace Python modules, imported __all__ aliases and from ... import * re-exports also resolve when the source module export graph is static and parseable, and scan_policy.python_export_following plus scan_policy.python_module_roots or --python-module-root can pin how aggressively module resolution follows nonstandard repository roots
  • Java public API extraction tracks public types, public fields, interface constants, and public or interface methods while stripping leading annotations out of the stored signature; declared package plus nesting context is preserved in canonical forms such as java:type public class demo.AuthApi, java:field public String demo.AuthApi.status, java:const public static final String demo.AuthApi.Contract.STATE, and java:method public String demo.AuthApi.login(...)
  • C# public API extraction tracks public types, public fields, public constants, public properties, and public or interface methods while stripping leading attributes out of the stored signature; declared namespace plus nesting context is preserved in canonical forms such as csharp:type public class Demo.AuthApi, csharp:field public static readonly string Demo.AuthApi.Version, csharp:const public string Demo.AuthApi.STATUS_READY, csharp:property public string Demo.AuthApi.DisplayName { get }, and csharp:method public static string Demo.AuthApi.Login(...)
  • Kotlin public API extraction tracks public or default-visible class, interface, object, fun, val, var, and top-level const val declarations, preserving modifiers such as data and suspend while skipping private, protected, and internal; declared package plus nesting context is preserved in canonical forms such as kotlin:public class demo.auth.AuthApi, kotlin:const val demo.auth.API_VERSION: String, kotlin:fun demo.auth.AuthApi.login(...), and kotlin:val demo.auth.AuthApi.token: String
  • PHP public API extraction tracks top-level functions and constants, classes, interfaces, traits, enums, public properties, public or interface constants, and public or interface methods while treating # comments as decorators and ignoring attribute syntax in stored signatures; class and interface members are owner-qualified as AuthApi.run(...), AuthApi.$token, and AuthApi::STATUS_READY
  • Ruby public API extraction tracks class, module, public def, singleton methods, class << self method bodies, public attr_reader/attr_writer/attr_accessor macros, and constant assignments within public namespaces while ignoring heredoc fixture content; private_constant hides constants until public_constant re-exposes them, module_function and extend self promote module exports into singleton signatures, private_class_method removes hidden singleton methods, and member signatures use Ruby owner forms such as Demo::AuthApi#login(...) and Demo::AuthApi.connect(...); scan_policy.ruby_export_following or --ruby-export-following can keep that macro-driven export shaping enabled or reduce Ruby scanning to file-local declarations only
  • Lua public API extraction tracks global function declarations and returned module-table exports such as Api.connect = function(...) end, function Api:refresh(...), and named fields from returned tables, while -- and long-bracket comments remain decorator-aware; when a file returns a module root such as return Api, that returned root becomes the export boundary and unrelated globals stop counting; scan_policy.lua_export_following or --lua-export-following can disable returned-root following or require explicit returned roots before runtime exports are inferred
  • Swift public API extraction tracks public and open types, functions, properties, and inherited protocol requirements, and the scanner masks multiline Swift string literals so embedded examples do not pollute evidence; type and protocol members are owner-qualified as swift:public func AuthApi.login(...) and swift:public var SessionContract.token: ...
  • Luau public API extraction tracks global function declarations, export type definitions, and returned module-table exports such as Api.connect = function(...) end, function Api:refresh(...), and named fields from returned tables; when a file returns a module root such as return Api, that returned root becomes the runtime export boundary while export type declarations remain explicit API
  • Dart public API extraction uses comment-aware scanning plus line-regex heuristics for classes, mixins, enums, extensions, typedefs, fields, getters, setters, and callables; a library directive qualifies signatures with a dotted prefix, and names starting with _ are skipped as library-private. Typical stored forms include dart:type demo.class AuthApi, dart:field demo.static const String VERSION =, and dart:function demo.String login(String username)

If you already track Java, C#, or Kotlin API evidence, expect one regeneration after this change because canonical signatures now include declared package or namespace prefixes.

This matters for repositories that keep code examples, fixture payloads, or prompt templates alongside real source. Those examples no longer pollute mvs.json.evidence.

API Boundary Policy

You can persist scan policy in mvs.json so public API evidence reflects the contract you actually support instead of every reachable pub item.

The scan_policy block supports:

  • public_api_roots: relative file or directory roots that define the public API boundary
  • ts_export_following: TypeScript/JavaScript barrel-following mode: off (default), relative_only, or workspace_only
  • go_export_following: Go package expansion mode: off (default) or package_only
  • rust_export_following: Rust module-following mode: off (default) or public_modules
  • rust_workspace_members: relative crate directories or Cargo.toml paths that Rust facade following may resolve across when a facade intentionally reexports selected workspace members
  • ruby_export_following: Ruby export-shaping mode: heuristic (default) or off
  • lua_export_following: Lua/Luau runtime export mode: heuristic (default), returned_root_only, or off
  • python_export_following: Python cross-module export resolution mode: heuristic (default), roots_only, or off
  • public_api_includes: wildcard patterns for declarations that should count as public API
  • public_api_excludes: wildcard patterns for declarations that should not count as public API
  • python_module_roots: relative directory roots used to resolve same-workspace Python module names before following __all__, explicit re-exports, or from ... import * facades
  • exclude_paths: relative file or directory prefixes to skip entirely during tag and API scanning

Example:

{
  "scan_policy": {
    "public_api_roots": [
      "src/cli.rs"
    ],
    "ts_export_following": "workspace_only",
    "go_export_following": "package_only",
    "rust_export_following": "public_modules",
    "rust_workspace_members": [
      "crates/shared"
    ],
    "ruby_export_following": "off",
    "lua_export_following": "returned_root_only",
    "python_export_following": "roots_only",
    "public_api_excludes": [
      "rust:const EXIT_*",
      "rust:struct *Args",
      "rust:enum OutputFormat"
    ],
    "python_module_roots": [
      "app"
    ],
    "exclude_paths": [
      "src/generated"
    ]
  }
}

You can set these during generation:

mvs-manager generate --root . --manifest mvs.json --context cli --public-api-root src/cli.rs
mvs-manager generate --root . --manifest mvs.json --context cli --exclude-path src/generated
mvs-manager generate --root . --manifest mvs.json --context cli --public-api-exclude 'rust:const EXIT_*'
mvs-manager generate --root . --manifest mvs.json --context cli --public-api-root app/src/lib.rs --rust-export-following public-modules --rust-workspace-member shared
mvs-manager generate --root . --manifest mvs.json --context cli --public-api-include 'src/cli.rs|rust:fn *'
mvs-manager generate --root . --manifest mvs.json --context cli --public-api-root src/index.ts --ts-export-following relative-only
mvs-manager generate --root . --manifest mvs.json --context cli --public-api-root src/index.ts --ts-export-following workspace-only
mvs-manager generate --root . --manifest mvs.json --context cli --public-api-root src/api.go --go-export-following package-only
mvs-manager generate --root . --manifest mvs.json --context cli --public-api-root src/lib.rs --rust-export-following public-modules
mvs-manager generate --root . --manifest mvs.json --context cli --ruby-export-following off
mvs-manager generate --root . --manifest mvs.json --context cli --lua-export-following returned-root-only
mvs-manager generate --root . --manifest mvs.json --context cli --python-export-following roots-only --python-module-root app
mvs-manager generate --root . --manifest mvs.json --context cli --python-module-root app

Practical guidance:

  • CLI-first projects: point public_api_roots at the CLI facade such as src/cli.rs
  • SDKs and libraries: point public_api_roots at exported facades such as src/lib.rs, src/index.ts, or src/public/
  • Generated or vendor-like code under the root: add it to exclude_paths
  • Use public_api_excludes when a facade file still contains public constants, argument structs, or helper exports that are not real compatibility surface
  • Use public_api_includes when you want to pin the contract to a small explicit subset of declarations
  • TypeScript or JavaScript repos with only relative barrel facades: set ts_export_following to relative_only
  • TypeScript or JavaScript repos with package.json export maps, imports maps, package-local monorepo self-references, or tsconfig/jsconfig path aliases inside the same workspace: set ts_export_following to workspace_only
  • When workspace_only follows package.json exports or imports conditions, it prefers types, then import, module, browser, node, default, and require; any remaining custom conditions are tried after that in key order
  • When both root config files exist, workspace_only reads tsconfig.json before jsconfig.json
  • Go repos that root the contract on one .go file but ship a whole package surface: set go_export_following to package_only so same-package sibling files count without dragging _test.go helpers into public_api_inventory
  • Rust repos that root the contract on src/lib.rs or another crate facade file: set rust_export_following to public_modules so same-crate pub mod files count with that facade while private-module files stay out
  • Rust workspaces where one facade crate intentionally reexports selected sibling crates: add rust_workspace_members so only those member crates resolve across pub use member_crate::... paths instead of widening to the entire workspace
  • Ruby repos that want file-local declarations only: set ruby_export_following to off
  • Lua or Luau repos that require explicit runtime module returns: set lua_export_following to returned_root_only
  • Lua or Luau repos that want file-local globals only: set lua_export_following to off
  • Python repos with nonstandard package roots: set python_module_roots
  • Python repos that want strict facade tracking: set python_export_following to roots_only and provide python_module_roots
  • Python repos that want file-local behavior only: set python_export_following to off

This policy only scopes public API evidence. Feature and protocol tags are still gathered across the scanned codebase unless a path is explicitly excluded.

Pattern rules:

  • * matches zero or more characters
  • A plain pattern such as rust:struct *Args matches only the normalized signature
  • A selector pattern such as src/cli.rs|rust:fn * matches both the relative file path and the signature
  • If both include and exclude rules match the same declaration, the exclude rule wins
  • The easiest way to author patterns is to copy a signature from mvs.json.evidence.public_api_inventory or lint --format json
  • Legacy Rust function patterns with duplicated fn still match during migration, but regenerated manifests rewrite them to the canonical form

Embedding & Distribution (v3.0)

The Rust code is split into a small Cargo workspace so the versioning logic is embeddable outside the CLI: mvs-core (manifest, hashing, scheme translators — no network/process deps), mvs-crawler (the tree-sitter scanners), and mvs-manager (this CLI). crates/mvs-wasm binds mvs-core's convert-version logic to WASM; try it live in the interactive playground.

Distribution channels (GitHub Releases, cargo binstall, Docker, Nix, Homebrew/Scoop/winget templates) are cataloged in docs/DISTRIBUTION.md — several are templates or untested-in-CI at this point, and that document says exactly which. napi-rs/pyo3 bindings and 6 additional language crawlers (Elixir, Scala, C/C++, Zig, Haskell, OCaml) are planned but not yet built.

Roadmap

  • Usage details: docs/USAGE.md
  • Release workflow: docs/RELEASE.md
  • 1.x readiness roadmap: docs/TODO_1.0.md
  • Not yet built: crawler adapters that treat OpenAPI, GraphQL SDL, .proto, JSON Schema, and Avro files as public API/protocol surface, for teams whose real protocol is a schema rather than a function signature; crawlers for Elixir, Scala, C/C++, Zig, Haskell, and OCaml; napi-rs/pyo3 bindings; a hosted mvs.dev (schema + playground); and publishing any of the Docker/Homebrew/Scoop/winget/Nix packaging templates to their respective registries.

Machine-Readable Output

All commands support --format text|json and default to text.

Examples:

mvs-manager generate --root . --manifest mvs.json --context cli --format json
mvs-manager lint --root . --manifest mvs.json --format json
mvs-manager validate --host-manifest host.json --extension-manifest extension.json --format json

JSON responses are designed for CI, bots, editor tooling, and release automation. They include:

  • command
  • status
  • exit_code
  • semantic diff details where relevant
  • command-specific metadata such as identity changes, inventory counts, or compatibility reasons

When scan policy actively shapes the public API boundary, generate --format json and lint --format json also emit boundary_debug with included and excluded candidate declarations, excluded paths, and the matched root/include/exclude rule or follow-mode reason. Default ignored directories such as tests, target, and node_modules also show up there when they affect the crawl.

validate --format json also includes:

  • failure_count
  • degraded_count
  • checks: structured compatibility checks with stable axis, status, and code values

report --format json also includes:

  • change_count
  • changed_sections
  • comparison: structured manifest-to-manifest deltas across identity, compatibility, capabilities, AI contract, environment, scan policy, and evidence inventories

report intentionally stays manifest-only in 1.x. It does not recrawl source or emit boundary_debug.

Example lint --format json failure shape:

{
  "command": "lint",
  "status": "failed",
  "exit_code": 20,
  "failure_count": 1,
  "failures": [
    "Public API signature drift detected. Added: src/api.ts|ts/js:function rotateToken(token:string): string Build must fail until PROT is incremented and manifest is regenerated."
  ]
}

Example validate --format json incompatibility shape:

{
  "command": "validate",
  "status": "incompatible",
  "exit_code": 30,
  "compatible": false,
  "degraded": false,
  "failure_count": 1,
  "degraded_count": 0,
  "checks": [
    {
      "axis": "protocol",
      "status": "fail",
      "code": "protocol_range_mismatch",
      "message": "Protocol range mismatch: extension requires host 1-1, host exposes 2-2 and is at PROT 2.",
      "details": {
        "extension_protocol": 1,
        "host_protocol": 2,
        "required_host_range": {
          "min_prot": 1,
          "max_prot": 1
        },
        "host_extension_range": {
          "min_prot": 2,
          "max_prot": 2
        }
      }
    }
  ],
  "reasons": [
    "Protocol range mismatch: extension requires host 1-1, host exposes 2-2 and is at PROT 2."
  ]
}

Example report --format json shape:

{
  "command": "report",
  "status": "changed",
  "exit_code": 0,
  "change_count": 21,
  "changed_sections": [
    "identity",
    "compatibility",
    "evidence"
  ]
}

Stable Exit Codes

mvs-manager now uses command-stable nonzero exit codes so automation can distinguish drift from execution failures.

  • 0: success
  • 10: generate execution failure
  • 20: lint detected manifest/code drift or policy failure (never returned by lint --advisory, which always exits 0)
  • 21: lint execution failure
  • 30: validate found incompatibility
  • 40: manifest read/parse/write/validation failure
  • 70: output rendering failure
  • 80: sync --check found version files out of sync with the manifest projection
  • 81: sync failed to read or write a version file
  • 82: convert-version could not parse the input, resolve --scheme-regex, or apply --map
  • 83: a migrate subcommand failed (detect/plan/backfill/apply/rollback)
  • 84: suggest-decorators failed to crawl the source tree or write a decorator
  • 85: range was given an invalid range/ecosystem, or no recorded version has PROT in range
  • 86: semver was given an unknown --for target or an identifier that isn't valid SemVer (or that the target can't express, e.g. a non-PEP-440 prerelease)

This means CI can treat 20 as “manifest must be regenerated” and 30 as “host/extension contract is incompatible” without scraping human text.

Release + Verification

Release assets include:

  • per-platform archives
  • checksums.txt
  • optional checksums.txt.asc GPG signature

Verify checksum:

scripts/verify-release.sh dist/vX.Y.Z/mvs-manager-X.Y.Z-<target>.tar.gz dist/vX.Y.Z/checksums.txt

See docs/USAGE.md and docs/RELEASE.md for complete workflows. For the 2.x identity contract see docs/CONTRACT_2X.md; legacy 1.x surface notes remain in docs/CONTRACT_1X.md.

License

This repository is licensed under the GNU Affero General Public License v3.0 only (AGPL-3.0-only).

  • Full license text: LICENSE
  • If you modify and run this software for users over a network, AGPL requires offering corresponding source to those users.

About

This is my solution to manage my versioning hangups.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages