The gpm guide

gpm gets packages other people made, and puts yours on gpm.stingtype.org. Once gpm installs a package, gstc finds its files like any other library.

The GSTC installer asks if you want gpm.

Getting a package

gpm install @beanye/engine

That downloads the package and anything it needs, and puts it in GSTC's packages folder. Then you just include it:

include "engine.sth" as engine

No lib folder to copy around, nothing to set up. gstc looks in the packages folder after its own libraries.

If two packages you have both have a file called engine.sth, gstc will tell you, and you write which one you mean:

include "@beanye/engine/engine.sth" as engine

Some packages also come with commands (little programs). gpm builds those with gstc and puts them next to gstc, so you can run them from the terminal too.

Packages in a project

If your project has a gpm.toml (gpm init makes one), gpm works on the project instead of your whole computer:

  • gpm install @dev/name adds it to the project's gpm.toml and installs it.
  • gpm install with nothing after it gets everything the project needs. So when someone downloads your project, that's the one thing they run.
  • gpm.lock keeps the exact versions the project uses. gstc only uses those versions when it builds the project, so it builds the same way on every computer. Don't change it by hand, gpm writes it.

Add -g to work on your whole computer even when you're in a project, like gpm install -g @dev/name.

Versions

Versions look like 1.2.3. In gpm.toml you say which ones are okay:

You write It allows
"^1.2.0" or "1.2.0" 1.2.0 and newer, but not 2.0.0
"~1.2.0" 1.2.0 and newer, but not 1.3.0
"=1.2.0" only 1.2.0
">=1.2.0" 1.2.0 or anything newer
"*" anything

gpm install writes ^ with the newest version for you, so you usually never touch this. gpm update --all moves everything to the newest versions that still fit.

All the commands

Command What it does
gpm login log in with your stingtype.org account
gpm logout log out
gpm init make a gpm.toml in this folder
gpm publish put the package in this folder on gpm.stingtype.org
gpm install @dev/name ... get packages (you can list a few)
gpm install get everything the project's gpm.lock lists
gpm remove @dev/name take a package out
gpm update --all newer versions, where gpm.toml allows them
gpm search WORDS look for packages (with --kind, --system, --arch, --tag)
gpm info @dev/name about one package
gpm list what's installed
gpm commit -m "..." save the project's history (see Repositories)
gpm sync send commits up, bring new ones in
gpm clone @dev/name get a repository
gpm fork @dev/name your own copy of someone's repository
gpm plugin ... plugins (see Plugins)
gpm audit what the registry says about what's installed
gpm verify check the files, signatures and gpm.lock
gpm cgit / gpm fgit to and from git

You can also write a version after a name. gpm install @dev/[email protected] gets exactly 1.2.0, and gpm install @dev/name@^1.2 works like it does in gpm.toml.

Making a package

A package is just a folder with a gpm.toml in it and your .sth files. Put the files people should include at the top of the folder or in lib/.

gpm login
gpm init
gpm publish

gpm init makes this (and a .gpm folder for history, see Repositories):

[package]
name = "@beanye/engine"
version = "0.1.0"
kind = "package"
description = ""
license = "MIT"
tags = []
systems = ["linux", "windows"]
arch = ["64-bit"]

[dependencies]
  • name is @yourusername/whatever, small letters. You can only publish under your own name.
  • version goes up every time you publish. A version can't be published twice.
  • systems can be linux, windows and android. arch can be 32-bit, 64-bit and arm. These show up in the filter on the site.
  • tags are short words people can search for, like ["games", "3d"].
  • homepage (optional) is a link to your site or repo.

If it needs other packages, put them under [dependencies], or just run gpm install @dev/name in the folder and gpm adds it.

If it has commands, list them under [tools]. Each one is a name and the .st file it's built from:

[tools]
mytool = "tools/mytool.st"

A README.md in the folder becomes the package's page on the site.

What gets left out

gpm publish leaves out build/, .git/, gpm.lock and .gpk files. To leave out more, make a .gpmignore with one thing per line:

*.tmp
secret/
/notes.txt

A plain name matches anywhere, a name ending in / is a folder, and a name starting with / only counts at the top of the package.

Where things go

Windows Linux
GSTC, gpm and package commands %LOCALAPPDATA%\Programs\StingType\bin ~/.local/share/stingtype/bin
packages ...\StingType\packages ~/.local/share/stingtype/packages
your gpm login %APPDATA%\gpm\auth ~/.config/gpm/auth
plugins ...\StingType\plugins ~/.local/share/stingtype/plugins

If you use the zip instead of the installer, gpm keeps packages in a packages folder next to the lib folder.

Plugins

A plugin is a tool for something else, like your terminal or another program. It's published like a package, just with kind = "plugin" and what it's for:

[package]
name = "@beanye/greet"
version = "1.0.0"
kind = "plugin"

[plugin]
for = "terminal"

[tools]
greet = "tools/greet.st"
Command What it does
gpm plugin install @dev/name get it and turn it on
gpm plugin disable @dev/name turn it off (its commands go away, the files stay)
gpm plugin enable @dev/name turn it back on
gpm plugin remove @dev/name take it out
gpm plugin list what's installed, and what's on
gpm @dev/name the short way: turns it on, getting it first if it isn't here

Plugins are kept in a plugins folder, apart from packages, so include never picks up their files.

Repositories

gpm can keep the history of a project too. It's its own thing, not git (but it can turn into git and back, see below).

gpm init
gpm commit -m "the first one"
gpm sync
  • gpm init makes a .gpm folder next to gpm.toml. That's where the history lives.
  • gpm commit -m "..." saves everything in the folder as it is right now (.gpmignore leaves things out, same as publishing).
  • gpm sync sends your commits to gpm.stingtype.org and brings in any new ones. The name is the one in gpm.toml.
  • gpm clone @dev/name gets someone's repository (no account needed).
  • gpm fork @dev/name makes your own copy under your name, and it remembers whose it was. You can only sync to repositories that are yours, so forking is how you work on someone else's.

If you and the registry both changed things since the last sync, gpm puts them together by itself when it's different files. If it's the same file, gpm keeps yours and puts the registry's copy next to it as file.theirs. Put them together, delete the .theirs file, then gpm commit and gpm sync.

A package can have a repository too: publish versions with gpm publish, and keep the history with gpm sync. Both show up on its page.

Checking packages

  • gpm audit asks the registry about everything installed (or everything in the project's gpm.lock): was a version taken down, does it have a warning on it, is it still the same file. It also says what the code uses, like running other programs or the network. That's just what it uses, not a verdict.
  • gpm verify checks it all on your computer: every file against the hash it had when it was installed, the registry's signature on each version, and that gpm.lock matches gpm.toml.

Both stop with an error if something's wrong, so they work in scripts too.

Git

These need git installed.

  • gpm cgit SOURCE OUTPUT turns a gpm repository into a git repository, history and all. SOURCE can also be a .gpk file or a plain folder (one commit).
  • gpm fgit SOURCE OUTPUT turns a git repository into a gpm repository.

Each commit keeps its author, time and message, plus a line saying which commit it came from.