cx::pm docs

Your own package index

The public index at soft-forge.dev/cxpm/index is where cxpm looks by default. For a team, a company network or a machine with no internet access, cxpm serve runs an index of your own: the same requests, the same search, fetch and publish, with accounts you make. Point cxpm at it with --index, CXPM_INDEX or ~/.config/cxpm/index.

cxpm serve --database-path /var/lib/cxpm/index --add-account ada    # prints ada's token once
cxpm serve --database-path /var/lib/cxpm/index \
           --listen unix:///run/cxpm/socket.sock \
           --host https://packages.example.org
OptionDefaultMeaning
--listenhttp://127.0.0.1:7878unix:///path/to/socket, http://host:port or host:port
--hostThe public address a proxy serves the index at; its path is accepted as a prefix of requests
--database-path/var/lib/cxpm/indexWhere packages and accounts are kept, as JSON files
--add-account NAMECreate the account (or replace its token), print the token, exit

cxpm serves plain HTTP. Put a reverse proxy in front of it for TLS and point it at the socket. The index keeps only a hash of each token, so a lost token is replaced with --add-account, not recovered.

RequestAnswer
GET / , GET /?q=textThe packages: name, description, owner, latest version
GET /<name>A package and its versions
GET /<name>/<version>One version: repository, revision, commit, dependencies
PUT /<name>/<version>Publish; needs Authorization: Bearer <token>
DELETE /<name>/<version>A publisher deletes the version (cxpm unpublish); 409 for the last one, or while another owner’s package depends on the name
DELETE /<name>The owner deletes the package: {deleted: name}; the name stays the owner’s
GET /-/whoamiThe account a token belongs to