starcm

command module
v0.0.0-...-88618f3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2026 License: MIT Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Static Badge

starcm

"star-cm" ⭐

  • A rudimentary configuration management language that utilizes Starlark instead of Ruby, json, or yaml.
  • Why Starlark? Starlark provides variables, functions, loops, and lots more "for free" inside of the configuration files!

Goal

Starcm is intended to become a viable alternative for tools like macadmins/installapplications, facebookincubator/go2chef, and google/glazier.

Installation

  1. Download starcm from https://github.com/discentem/starcm/releases and install it somewhere in your path, such as /usr/local/bin/starcm.

If you want to compile yourself, install Bazelisk and run make install.

Quick start

starcm runs .star files. Here is an example of a .star file that installs a .pkg file on macOS: dockutil. It downloads the package, checks it against a pinned sha256, and installs it only if it's signed by dockutil's developer and notarized by Apple.

Save the code below as install_dockutil.star. (The same file is in this repository at examples/quickstart/install_dockutil.star.) The package is kept in starcm's local store, so nothing is left in the directory you run it from.

# examples/quickstart/install_dockutil.star
load("starcm", "download", "install_mac_pkg")

# dockutil 3.1.3. download() checks the sha256 and keeps the package in
# starcm's local store.
pkg = download(
    label  = "fetch dockutil",
    url    = "https://github.com/kcrawford/dockutil/releases/download/3.1.3/dockutil-3.1.3.pkg",
    sha256 = "f60db8273fe80d7c4824588bedb538a5387675c3917edb0010dab9f52d3f2582",
)

# Install it only if dockutil's developer signed it and Apple notarized it.
r = install_mac_pkg(
    pkg,
    signer  = "Developer ID Installer: Kyle Crawford (Z5J8CJBUWC)",
    id      = "dockutil.cli.tool",
    version = "3.1.3",
    label   = "install dockutil",
)
if r.changed:
    print("installed dockutil, signed by %s" % r.value.signer)
else:
    print(r.message)

Installing a package needs root, so run it with sudo:

$ sudo starcm install_dockutil.star
installed dockutil, signed by Developer ID Installer: Kyle Crawford (Z5J8CJBUWC)

Run it again and nothing changes:

$ sudo starcm install_dockutil.star
dockutil.cli.tool 3.1.3 is already installed

Documentation

docs/ lists every function starcm provides, each with its arguments, return value and tested examples:

Tests

The docs double as tests: every page in docs/ is a scrut test, and CI runs every command on it on Linux, macOS and Windows and checks the output shown. The .star files the pages run are in examples/, one folder per function.

tests/integration/ holds the tests that need more than that, which only run in CI:

  • tests/integration/s3/chain.md is worth reading through as a walkthrough. It publishes a few signed .star files and a script to an S3 bucket on a real S3-compatible server, then runs them with starcm from a single local bootstrap.star. Along the way it shows a new release being picked up, and tampered files and bad credentials being refused.
  • tests/integration/macos/ installs a real signed package with install_mac_pkg, and this README's quick start installs dockutil, on a macOS runner.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
functions
checkmacsig
Package checkmacsig implements check_mac_signature(), which reports who signed a macOS package, binary or app, and stops the run unless it's the developer the configuration names.
Package checkmacsig implements check_mac_signature(), which reports who signed a macOS package, binary or app, and stops the run unless it's the developer the configuration names.
dedent
Package dedent implements dedent(), which lets multi-line strings be indented with the code around them.
Package dedent implements dedent(), which lets multi-line strings be indented with the code around them.
extract
Package extract implements extract(), which unpacks a .zip, .tar.gz or .tgz archive into a directory.
Package extract implements extract(), which unpacks a .zip, .tar.gz or .tgz archive into a directory.
glob
Package glob implements path.glob(), which finds the paths that match a pattern whose wildcards can appear in any path segment, directories included.
Package glob implements path.glob(), which finds the paths that match a pattern whose wildcards can appear in any path segment, directories included.
here
Package here implements the plain helper here(), which builds absolute paths to files that ship next to a .star file.
Package here implements the plain helper here(), which builds absolute paths to files that ship next to a .star file.
installbin
Package installbin implements install_binary(), which installs a command-line tool from a release archive (or a bare file) as a file.
Package installbin implements install_binary(), which installs a command-line tool from a release archive (or a bare file) as a file.
macapp
Package macapp implements install_mac_app(), install_mac_dmg() and install_mac_zip(), which install a macOS .app bundle only if it's signed, through Apple, by the developer certificate the configuration names.
Package macapp implements install_mac_app(), install_mac_dmg() and install_mac_zip(), which install a macOS .app bundle only if it's signed, through Apple, by the developer certificate the configuration names.
macpkg
Package macpkg implements install_mac_pkg(), which installs a macOS .pkg only after checking that it's signed, through Apple, by the developer certificate the configuration names.
Package macpkg implements install_mac_pkg(), which installs a macOS .pkg only after checking that it's signed, through Apple, by the developer certificate the configuration names.
pathmod
Package pathmod implements the path module: path.exists(), path.join(), path.glob() and path.list().
Package pathmod implements the path module: path.exists(), path.join(), path.glob() and path.list().
sysinfo
Package sysinfo implements the plain helpers platform(), env() and home_dir(), which describe the machine starcm runs on.
Package sysinfo implements the plain helpers platform(), env() and home_dir(), which describe the machine starcm runs on.
tempdir
Package tempdir implements temp_dir(), which returns the system's temporary directory.
Package tempdir implements temp_dir(), which returns the system's temporary directory.
libraries
globmatch
Package globmatch matches slash-separated names, such as the entries of an archive, against a glob.
Package globmatch matches slash-separated names, such as the entries of an archive, against a glob.
httpclient
Package httpclient is starcm's one place for outgoing HTTP: the shared client and the helpers built on it.
Package httpclient is starcm's one place for outgoing HTTP: the shared client and the helpers built on it.
inspect
Package inspect reports what a .star file loads and calls without running it, so tools can check configuration (e.g.
Package inspect reports what a .star file loads and calls without running it, so tools can check configuration (e.g.
local_store
Package localstore keeps downloaded files on disk under their sha256, at <dir>/sha256/<hash>/<name>, in a directory that only the current user (and root or administrators) can change.
Package localstore keeps downloaded files on disk under their sha256, at <dir>/sha256/<hash>/<name>, in a directory that only the current user (and root or administrators) can change.
macarchive
Package macarchive unpacks macOS .app bundles from .zip archives and .dmg disk images with the system's own tools, which keep what a code signature depends on (symlinks, extended attributes, resource forks) and which a pure-Go unzip does not.
Package macarchive unpacks macOS .app bundles from .zip archives and .dmg disk images with the system's own tools, which keep what a code signature depends on (symlinks, extended attributes, resource forks) and which a pure-Go unzip does not.
macsig
Package macsig reads and checks macOS code signatures: the signature of an installer package (.pkg) with pkgutil, and of a Mach-O binary or .app bundle with codesign.
Package macsig reads and checks macOS code signatures: the signature of an installer package (.pkg) with pkgutil, and of a Mach-O binary or .app bundle with codesign.
paths
Package paths implements starcm's rule for path arguments: a relative path only ever names a read-only resource that ships next to a .star file, and every other path must be absolute.
Package paths implements starcm's rule for path arguments: a relative path only ever names a read-only resource that ships next to a .star file, and every other path must be absolute.
sha256
Package sha256 is starcm's one implementation of sha256 hashing, shared by download() and sha256().
Package sha256 is starcm's one implementation of sha256 hashing, shared by download() and sha256().
signing
Package signing creates and checks detached signatures for files starcm runs or handles.
Package signing creates and checks detached signatures for files starcm runs or handles.
testhelpers

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址