/midnight-tooling:install-cli [install for this project | update | --directory <path>]from midnight-tooling
Installs, updates, or configures the Compact CLI tool with automatic environment setup. Supports global installation and per-project configuration with an explicit --directory option.
Ships in midnight-tooling. Installing the plugin adds it to Claude Code.
Install or update the Compact CLI tool, with intelligent handling of global vs. project-local installations.
compact): The management tool installed globally⚠️ "Latest available" is not "latest supported". A bare
compact updatedownloads the newest published compiler, which can be ahead of what any live network accepts. Everycompact updatein this command must pass an explicit version. See the compact-cli skill's version-management reference.
The network-supported version is pinned in one place so it can be bumped without editing this command:
cat "${CLAUDE_PLUGIN_ROOT}/network-supported-compiler.txt"
Store the result (a single semver string, e.g. 0.36.0) as NETWORK_COMPILER and use it in every compact update below. Shell variables do not persist between tool calls, so substitute the literal value (e.g. compact update 0.36.0) when you run the commands; "$NETWORK_COMPILER" in this file is a placeholder for that value.
If CLAUDE_PLUGIN_ROOT is not set or the file is not found there, use the midnight-plugin-utils:find-claude-plugin-root skill to locate the midnight-tooling plugin root and read network-supported-compiler.txt from that path. If the file still cannot be read, stop and tell the user: do not fall back to a bare compact update.
Analyze $ARGUMENTS to determine what the user wants:
Project-local installation if arguments contain phrases like:
--directory pathGlobal installation/update if:
which compact 2>&1
compact --version 2>&1
compact compile --version 2>&1
Determine whether the CLI is already installed and what versions are present.
If compact is not found on PATH:
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/midnightntwrk/compact/releases/latest/download/compact-installer.sh | sh
grep "compact" ~/.zshrc 2>/dev/null || grep "compact" ~/.bashrc 2>/dev/null
echo 'export PATH="$HOME/.compact/bin:$PATH"' >> ~/.zshrc
Adjust for the user's shell (check $SHELL to determine zsh vs bash).
Remind the user to reload their shell or open a new terminal.
Download the network-supported compiler (not the latest):
compact update "$NETWORK_COMPILER"
compact --version
compact compile --version
Then run the check in Step 3D.
If compact is already on PATH:
Report current versions:
compact --versioncompact compile --versionCheck for updates:
compact self check 2>&1
compact check 2>&1
Report findings:
compact self updatecompact compile --version. Compiler 0.36.0 and later print the commit after the version, for example 0.36.0 (b5d9e4dfc 2026-11-03).$NETWORK_COMPILER has the same major and minor version and a higher patch, for example 0.36.1 for 0.36.0. It keeps the same language and runtime versions, so treat it as supported, the same way the compact-core SessionStart hook does.compact check reports a later patch of $NETWORK_COMPILER: tell the user it is a patch release with the same language and runtime versions, safe to use, and offer to install it.compact check reports any other compiler newer than $NETWORK_COMPILER: tell the user it is published but not yet network-supported, and do not offer to install it. Link the compatibility matrix.$NETWORK_COMPILER nor a later patch of it: offer to run compact update "$NETWORK_COMPILER"$NETWORK_COMPILER or a later patch of it, and no CLI update is available: report that everything is currentIf updates are applied, verify the new versions, then run the check in Step 3D.
When the user wants a project-specific toolchain:
Determine the target directory:
$PWD/.compact (the project root)--directory path from arguments, resolved to an absolute pathAlways pass --directory an absolute path. With a relative path (./.compact) the CLI changes into the version directory and then looks for artifact.zip by the same relative path again, so extraction fails (unzip: cannot find or open ./.compact/versions/<ver>/<target>/artifact.zip). The absolute form works. This is a CLI bug, tracked separately in midnightntwrk/compact.
Install the network-supported compiler into the project directory:
compact --directory "$PWD/.compact" update "$NETWORK_COMPILER"
If the CLI is not installed globally, install it first (Step 3A), then proceed with the project-local setup.
# Check for direnv
which direnv 2>/dev/null
ls .envrc 2>/dev/null
# Check for mise
which mise 2>/dev/null
ls .mise.toml 2>/dev/null
# Check for dotenv
ls .env 2>/dev/null
ls package.json 2>/dev/null
# Check for Claude settings
ls .claude/settings.json 2>/dev/null
ls .claude/settings.local.json 2>/dev/null
For each tool found, offer to add COMPACT_DIRECTORY configuration:
direnv (if direnv is on PATH or .envrc exists):
Check if .envrc already contains COMPACT_DIRECTORY. If not, append:
export COMPACT_DIRECTORY="${PWD}/.compact"
Then run direnv allow.
mise (if mise is on PATH or .mise.toml exists):
Check if .mise.toml already contains COMPACT_DIRECTORY. If not, add:
[env]
COMPACT_DIRECTORY = "{{config_root}}/.compact"
Claude Code settings (always offer):
Check if .claude/settings.json exists and already has COMPACT_DIRECTORY in the env field. If not, create or update the file:
{
"env": {
"COMPACT_DIRECTORY": "./.compact"
}
}
Use AskUserQuestion if the file already exists and has other settings, to confirm merging. If .claude/settings.json does not exist, create the .claude/ directory and write the file.
Check if .gitignore exists and contains .compact/. If not, offer to add it:
.compact/
Compiler binaries and proving keys should not be committed to version control.
compact --directory "$PWD/.compact" list --installed
compact --directory "$PWD/.compact" compile --version
Then run the check in Step 3D against the project-local compiler.
Summarize all changes made:
./.compact/.gitignore updatedcompact compile normally (env var handles the directory)Run this after any install or update, global or project-local:
compact compile --version
# project-local:
compact --directory "$PWD/.compact" compile --version
Compare the first field of the reported version (0.36.0 and later add the commit after it) to $NETWORK_COMPILER.
<version> is the current network-supported version".0.36.1 for 0.36.0): report that it is a patch release of the network-supported version with the same language and runtime versions. No action needed.compact update "$NETWORK_COMPILER" (with --directory for project-local installs) and link the compatibility matrix.Do not skip this step because the install "succeeded"; a successful download of the wrong version is exactly the case it exists to catch.
Present a summary of what was done:
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
npx claudepluginhub midnightntwrk/midnight-expert --plugin midnight-tooling5 commands in this plugin
/devnetmidnight-tooling:devnetManage a local Midnight devnet — generate compose files, start/stop the network, check status and health, view logs and configuration/doctormidnight-tooling:doctorComprehensive diagnostic and health report for the Compact CLI installation, compiler versions, PATH configuration, custom directory setup, proof server status, and plugin dependencies/install-statusline-scriptmidnight-tooling:install-statusline-scriptInstall, update, or uninstall the Midnight statusline script. Displays proof server and Compact CLI status in the Claude Code status bar./view-release-notesmidnight-tooling:view-release-notesView Midnight component release notes from the official documentationOther plugins' commands for the same job