Install
Histos is one program you install once, then point a project at the version you want it to
use. It runs on macOS and Linux. On Windows, use WSL. It needs a JDK 25 or newer, and it
does not install that JDK for you. On macOS, brew install --cask temurin@25 is enough. On
Linux, install Temurin 25.
Run the install script
The installer and the histos command are the same POSIX script. From any directory:
curl -fsSL https://github.com/early-effect/histos/releases/download/dist/shim | sh
That downloads the script and runs it with no arguments. It does five things.
It fetches the script and a sha256 from the Histos release. The default place is
https://github.com/early-effect/histos/releases/download/dist. HISTOS_DIST can name
another place. That URL has to be https, or http on this machine's loopback. Anything
else is refused.
It checks the downloaded file against the sha256. A mismatch stops the install.
It writes the script to ~/.histos/bin/histos and marks it executable. Set HISTOS_HOME if
that directory should live somewhere else. The script does not edit your shell startup
files.
If ~/.histos/default is missing or empty, it records a default toolchain. It uses a
published channel file when the release has one. Otherwise it takes the newest stable
release listed there. If there is no release, it takes the newest snapshot line. If it
cannot find either, it stops and tells you to run histos toolchain install <version>.
It then prints one line and exits:
export PATH="$HOME/.histos/bin:$PATH"
Add that directory to your PATH for this shell. Add the same line to your shell startup
file if you want histos next time you open a terminal. Then run histos version. That
prints the toolchain this command is using. The first command that needs the jar downloads
it under ~/.histos/toolchains.
A project can choose a different Histos
The default under ~/.histos is what you get outside a project. Inside a project,
build.properties can name the Histos that project runs. The key is histos.version. That
pin wins over the default. A teammate who clones the repo gets the same Histos you pinned,
once they have the histos command on their PATH.
val Key = "histos.version"def read(repo: Path): IO[LauncherError, LauncherPin] =
readString(repo.resolve(file)).flatMap(text => ZIO.fromEither(parse(text)))Four ways to write the pin
A release pin is a ship number, such as 0.5.0. The shim runs that release.
A line pointer is <ship>-SNAPSHOT, such as 0.5.0-SNAPSHOT. The shim reads
channel-<ship>-SNAPSHOT and runs the timestamp that file names now. publish snapshots
moves that file.
A commit coordinate is <ship>-<12 hex>-SNAPSHOT. The shim reads the channel file for
that coordinate and runs the timestamp stored for that commit. Publishing the coordinate
does not move the line pointer.
A revision is a timestamp, <ship>-yyyyMMdd.HHmmss-<n>. The shim runs that build. It does
not read a channel file. A commit is not a revision.
histos update rewrites the pin. A release pin moves to the newest release. A pin that
ends in -SNAPSHOT, a line pointer or a commit coordinate, defaults to --follow. That
writes the newest line pointer, <line>-SNAPSHOT. --freeze writes the timestamp that
pointer's channel file names now. A timestamp pin defaults to --freeze. --follow and
--freeze are opposites.
After that update, regenerate the project's workflows and commit them:
histos update
histos workflow --update
The second command writes the workflow files for the Histos you just installed. Do this when the pin moved to a release and when it followed a snapshot. The CI page says what those files contain. A line pointer can keep the same text while the installed jar changes, and the workflows still need regenerating.
def from(raw: String): Either[LauncherError, LauncherPin] =
LauncherChannel
.from(raw)
.map(LauncherChoice.Pointer(_))
.orElse(revisionOf(raw))
.orElse(ShipNumber.from(raw).toOption.map(LauncherChoice.Release(_)))
.map(new LauncherPin(_))
.toRight(LauncherError.Version(raw))/** `revision` is the timestamp the shim reads: `<channel without -SNAPSHOT>-<yyyyMMdd.HHmmss>-<build>`. */
enum LauncherChoice /** Stored snapshots are recognized before the pointer, so `<ship>-<sha>-SNAPSHOT` is not eaten as `<ship>-SNAPSHOT`.
*/
def parse(raw: String): Either[RevisionError, Revision] =
if raw.isEmpty then Left(RevisionError.Empty)
else if raw.endsWith("-SNAPSHOT") then snapshot(raw, raw.stripSuffix("-SNAPSHOT"))
else if raw.endsWith("-ci") then compileOnly(raw, raw.stripSuffix("-ci"))
else
ShipNumber.from(raw) match
case Right(number) => Right(Revision.Release(ReleaseVersion(number)))
case Left(_) => unstored(raw) /** Resolve the channel and write the timestamp Coursier selected. */
def update(repo: Path): IO[LauncherError, LauncherPin] =
ZIO
.attempt(coursier.cache.CacheDefaults.location.toPath)
.orElseFail(LauncherError.Io(IoFailure(Path.of("coursier-cache"), IoFault.Stat)))
.flatMap(cache => updateAt(repo, cache))One command, one toolchain
HISTOS_PIN selects the toolchain for this process only. The value is a single directory
name under ~/.histos/toolchains. It does not rewrite build.properties. Use it when you
want to try a different installed Histos without changing the project. histos version
prints which one this command is actually running, and, if a server is already up, that
server's version too.
/** The version this process runs, as `histos version` prints it. The shim passes the toolchain it resolved in
* `HISTOS_VERSION`, and the native client compares the server record with that same text, so a server and a command
* under one `-SNAPSHOT` pin agree. Without it, the pin line. A pin that does not parse still fails.
*/
def versionText(repo: Path): IO[LauncherError, String] =
LauncherPin
.read(repo)
.flatMap: pin =>
zio.System
.env("HISTOS_VERSION")
.orElseSucceed(None)
.map:
case Some(passed) if passed.trim.nonEmpty => passed.trim
case _ => s"histos ${pin.version}"name: StringThe native client
Most commands run on the JVM. compile, test, run, clean, fmt, and complete can
instead go through histos-client, a native binary linked beside the jar. That binary is
optional. The install script does not build it, and it does not install clang or the
Coursier cs tool. histos toolchain client links the client for the jar you have. In CI,
./histos stays on java -jar unless the install passes --client. A generated
workflow's setup action does not pass that flag. Passing --client and --no-client
together fails.
enum CommandCommands the shim handles itself
toolchain install, toolchain list, update, and self update run in the script, before
a project is loaded. toolchain install <version> downloads one toolchain. toolchain list
prints the ones you have. self update replaces the script when the published hash differs.
The help catalog lists them with the rest of the commands.
val entries: List[Entry] = List(
Entry(
"version",
"info",
"histos version",
"Print the toolchain this command runs and, with a server up, that server's version.",
),
Entry("help", "info", "histos help [command]", "List commands, or show one command."),
Entry(
"completion",
"info",
"histos completion [install] [zsh|bash]",
"Print the completion script for this shell. zsh or bash names the shell. install writes it under ~/.histos/completions and prints the rc line. Project, module, and plugin names are offered only while a server is already listening.",
),
Entry("--explain", "info", "histos --explain <check-id>", "Print one check."),
Entry(
"--color",
"info",
"histos [--color | --no-color] [--truecolor | --no-truecolor] <command>",
"Color is on when stdout is a terminal and NO_COLOR is unset or empty. --color forces it on. --no-color forces it off. The last flag wins. --truecolor sends 24-bit color. --no-truecolor stops at the 256-color cube. --truecolor does not turn color on. A pipe stays plain unless --color is set.",
),
Entry(
"--verbose",
"info",
"histos [--verbose] <command>",
"A compile prints one line when a source finishes. --verbose prints each compiler phase instead. histos doctor --verbose lists every check.",
),
Entry("graph", "info", "histos graph", "Print each module, platform, and Scala version."),
Entry("observe", "info", "histos observe", "Print the stored compile tally."),
Entry(
"compile",
"build",
"histos compile [project ...] [--platform <jvm,js,native>] [--scala <2.13|3|version>] [--tests]",
"Compile the named projects, or every module. Repeat --platform or --scala, or use a comma list. --scala takes a series (2.13 or 3) or a full version. Named modules refuse a token that matches nothing and a series that matches two versions. Whole-build selection keeps every matching cell. Omission is every declared version. --tests also compiles test sources and does not run suites or link. A source prints when it finishes. --verbose prints each compiler phase. --color, --no-color, --truecolor, and --no-truecolor apply.",
),
Entry(
"run",
"build",
"histos run <name> [--platform <jvm|js|native>] [--scala <2.13|3|version>] [--main <class>] [-- arg ...]",
"Run a module main, inspect, versions, or doc. The command starts one process: one platform and one Scala version. --platform selects exactly one supported platform; otherwise the module default, then its sole platform, wins. --scala selects one series or one full version; omission uses the module's only version, and two declared versions require the flag. A series that matches two versions, or a comma list, is refused before anything starts. Built-in names and plugin tasks do not take --platform or --scala. Positional platforms were removed. --main selects one of multiple mains. Tokens after -- are the program's arguments. The program sees the caller's environment and working directory. Standard input is copied as a pipe, and Ctrl-C is delivered to the program. Program stdout stays byte-for-byte stdout; build and status diagnostics use stderr.",
),
Entry(
"clean",
"build",
"histos clean [project ...] [--full]",
"Delete the named projects' outputs. --full also forgets this repo in the content store and takes no project.",
),
Entry(
"assembly",
"build",
"histos assembly <module> ...",
"Write each assembly module to its asset path, or to a build output path, and print the path.",
),
Entry(
"fmt",
"build",
"histos fmt [--check] [project ... | --file <path> ...]",
"Format with the locked scalafmt the build declares. No project is every module and histos.scala. --check writes no source and rewrites .histos/format/ledger.",
),
Entry(
"test",
"test",
"histos test [project ...] [--platform <jvm,js,native>] [--scala <2.13|3|version>] [--suite <json>] [--affected <json>] [--quick] [--only <patterns>] [--test <terms>] [--tag <names>] [--ignore-tag <names>]",
"Run the selected suites, not their compilation dependencies. --platform, --scala, --only, --test, --tag, and --ignore-tag accept repeated flags and comma lists. --scala takes a series (2.13 or 3) or a full version. Named modules refuse a token that matches nothing and a series that matches two versions. Whole-build selection keeps every matching cell. Omission is every declared version. When a run covers more than one full version, the tally prints one line per version before the combined line. Escape literal commas and backslashes with a backslash; empty entries are rejected. Each flag consumes one value and may appear before or after projects. --affected remains a JSON list and intersects the original selection. Whole-suite filters exclude Verify and unsupported platforms; explicitly named invalid platforms still fail even under an empty affected filter. --suite is a JSON eligibility list for whole-suite CI rows, cannot combine with named projects, and never changes a singleton into a focused named request. --only runs suites that match. --test is a substring of a test label; any term keeps the test. --tag is exact; any listed tag keeps a test that has it. --ignore-tag is exact; a test that has one is dropped. --quick skips a suite whose stamp still matches, and a filter does not change that. --color, --no-color, --truecolor, and --no-truecolor apply.",
),
Entry(
"coverage",
"test",
"histos coverage [--scala <2.13|3|version>] [--platform jvm] [--min-stmt <n>] [--min-branch <n>] [--min-stmt-file <n>] [--min-branch-file <n>] [--min-stmt-package <n>] [--min-branch-package <n>] [--exclude-class <regex>] [--exclude-file <regex>] [project ...]",
"Instrument Scala 3 and Scala 2.13 on the JVM, run the suites, and write the report. --scala selects versions the same way test does. --platform must be jvm; omission stays on the JVM.",
),
Entry("affected", "test", "histos affected --base <sha>", "Print modules that differ from the base."),
Entry("~", "test", "histos ~ <command>", "Re-run a command when a source file is saved."),
Entry(
"new",
"project",
"histos new [--bare] [--yes] [--branch <name>] <name>",
"Write a new project in a new directory. --bare writes the build file and the sources only.",
),
Entry(
"init",
"project",
"histos init [--bare] [--yes] [--from sbt|zipx] [--branch <name>]",
"Write a project in the current directory. --from drafts histos.scala from sbt or zipx.",
),
Entry(
"publish check",
"publish",
"histos publish check [--base <sha|all>] [token ...]",
"Compile the published JVM members the diff selects and compare them. Writes no Ivy files and moves no snapshot pointer. No base, --base all, a build file, or a failed diff compares every member. A member that was not selected is named and is not reported as compatible.",
),
Entry(
"publish local",
"publish",
"histos publish local [--base <sha|all>] [token ...]",
"Publish to the local Ivy repository. The comparison follows the same selection as publish check. The three writing publish commands link the client.",
),
Entry(
"publish withdraw",
"publish",
"histos publish withdraw",
"Remove the local ivy revisions and toolchain directory for HEAD. The pin in build.properties stays.",
),
Entry(
"publish",
"publish",
"histos publish snapshots [token ...]",
"Publish the snapshot coordinate at HEAD. Every published JVM member is compared before upload. --base is accepted and does not narrow that comparison. A snapshot or pull-request session already set is kept. The pointer moves from any checkout.",
),
Entry(
"publish release",
"publish",
"histos publish release [token ...] [--automatic]",
"Publish the ship number. Every published JVM member is compared before upload. --base is accepted and does not narrow that comparison. Requires HISTOS_SESSION=release. --automatic closes the portal deployment.",
),
Entry(
"publish assets",
"publish",
"histos publish assets [token ...]",
"Upload a packaged file when the deployment is validated and the GitHub release exists.",
),
Entry("publish promote", "publish", "histos publish promote <deployment>", "Promote a held deployment."),
Entry("publish drop", "publish", "histos publish drop <deployment>", "Drop a held deployment."),
Entry(
"bump",
"publish",
"histos bump [--major | --minor | --patch] [ship ...]",
"Refresh published version metadata each time. Move .next past the newest stable only when it has caught .next; keep an ahead catalog. The default is the next patch. A maven repository wins over ivy2 local. A remote answer requires a successful metadata refresh. Does not change histos.version.",
),
Entry("portal", "publish", "histos portal", "Rehearse the Central portal on loopback."),
Entry(
"resolve",
"dependencies",
"histos resolve [--update | --check | --refresh [module ...]] [--lock=offer|update|local|frozen]",
"Check the lock, or write it. --refresh revalidates retained snapshot locators: offer by default, --lock=update commits, no selector means every retained locator, no fetch, and a dependency lock is not rewritten.",
),
Entry("deps", "dependencies", "histos deps check", "Check, update, audit, or snapshot dependencies."),
Entry(
"workflow",
"ci",
"histos workflow [--check | --update]",
"Check generated workflows, or write them. CI honors Module and Platform axes while keeping Native groups indivisible. ScalaVersion axes are refused with a typed error until test selection supports version filtering.",
),
Entry(
"doctor",
"ci",
"histos doctor [project ...] [--area <area>] [--json] [--preflight <job>] [--verbose] [--fix] [--yes]",
"Run the repository checks. The text lists errors and warnings. --verbose lists every check. Named projects are the modules that launch. With no --json and no --preflight, the whole doctor and --area toolchain also print the JDK, Node, and clang lines. --json stays plain. --color, --no-color, --truecolor, and --no-truecolor apply to the text.",
),
Entry("setup", "ci", "histos setup supply-chain [--from zipx] [--fix] [--yes]", "Write the supply-chain files."),
Entry("cache", "cache", "histos cache path", "Print, list, clean, promote, forget, or verify the cache."),
Entry(
"toolchain install",
"toolchain",
"histos toolchain install <version>",
"Download one toolchain. The installed shim runs this.",
),
Entry(
"toolchain list",
"toolchain",
"histos toolchain list",
"Print installed toolchains. The installed shim runs this.",
),
Entry(
"update",
"toolchain",
"histos update",
"Move the selected Histos version. The installed shim runs this. Inside a project it runs version on the pin it just wrote. HISTOS_PIN is ignored. A server recorded for another toolchain is stopped, and the server that starts records this one. That rewrites the BSP connection.",
),
Entry("self", "toolchain", "histos self update", "Replace the shim when the published hash differs."),
Entry("bsp", "server", "histos bsp", "Speak the build server protocol."),
Entry("mcp", "server", "histos mcp", "Speak the MCP server."),
Entry("reload", "server", "histos reload", "Reload the build file."),
Entry(
"reboot",
"server",
"histos reboot",
"Stop the running server and start one on this command's toolchain, or start one, and return when it is listening.",
),
Entry(
"stop",
"server",
"histos stop",
"Ask the running server to exit. It removes its record. No server is started.",
),
Entry("cancel", "server", "histos cancel <id>", "Cancel one run."),
Entry("preview", "preview", "histos preview compile [project ...]", "Show the plan. Nothing is compiled."),
)