MoxyMoxy
Docs contents

Package index

Status: implemented (Phase 7). The hosted index repository does not exist yet; the maintainer has to create github.com/moxylang/index before moxy search works against the default URL.

Goals

Names instead of URLs, and discovery, on top of the git dependencies goose already provides. No registry server, no accounts, no uploads: a package stays in its own git repository and the index only points at it.

The index

A git repository with one JSON file per package under packages/:

{
  "name": "geom",
  "description": "2D geometry primitives",
  "repository": "https://github.com/user/geom",
  "license": "MIT",
  "keywords": ["geometry", "math"],
  "versions": {
    "v0.1.0": "3f2c0a1d...full commit sha",
    "v0.2.0": "9b7e44c2..."
  }
}

versions maps a git tag to the commit it pointed at when published. Adding a package or a version is a pull request against the index, so review is the trust model. A tag that already exists in the index is never rewritten.

Location, in order: MOXY_INDEX in the environment, index: under build: in moxy.yaml, then https://github.com/moxylang/index. Any URL git clone accepts works, including file:// and plain paths.

Commands

  • moxy search [words] clones the index to ~/.cache/moxy/index (a hashed sibling directory for non-default URLs) or fast-forwards an existing clone, then prints packages whose name, description or keywords contain every word, case-insensitively. Name matches sort first. If the update fails and a cache exists, the cache is used with a warning.
  • moxy add <name> [--version tag] applies when the argument has no /, : or @. The name is resolved through the index to a repository and a tag (the highest version unless --version is given), then the normal moxy add <url> --name <name> --version <tag> runs. The moxy.yaml entry is an ordinary git dependency, so building never needs the index. After the fetch, the commit recorded in moxy.lock is compared with the commit in the index and a mismatch is reported.
  • moxy publish [--index-dir dir] [--keywords a,b] [--tag t] validates the project and produces the index entry. It never pushes and never opens a pull request.

Publish checks

  • moxy.yaml has a name (lowercase letters, digits, _, -, starting with a letter), version, description, and an explicit license.
  • The tree is clean (git status --porcelain is empty).
  • A tag for the version exists: v<version> or <version>, or --tag.
  • A fetchable origin remote exists; git@host:path is rewritten to https://host/path.

Output goes to stdout, or with --index-dir to <dir>/packages/<name>.json, merged with the versions already there. Publishing a tag that is already listed with a different commit is an error. Afterwards it prints the steps to commit the file in the index checkout and open a pull request.

Not covered

Yanking, ownership, signing, and checking that a published tag still resolves. Those are index-repository policy and can be added to CI there without changing the client.

Edit this page on GitHub