Skip to content

C0003 cli-subprocess

Rule: Workspace crates call each other as libraries, never by running the workspace's own binaries.

Code C0003 (stable, never reused)
Id cli-subprocess
Category code
Source spirit_level
Fix by hand

Level per tier

Tier Level Reason
small off
small-workspace off
medium deny components call each other as libraries, not through their CLIs
big deny components call each other as libraries, not through their CLIs
ai off
embedded off
ui off
egui off
units-strict off
units-paranoid off

Why

Libraries are the integration surface between the parts of a workspace; the CLI is for people, agents, hooks and recipes. A component that runs Command::new("our-cli") depends on whatever version of the binary is on PATH, parses text meant for people, and hides an edge the crate graph cannot see. tpm's records MCP server ran a tpm records mcp-tools child under a lock for every call.

The lint reports Command::new("<name>") where <name> is a binary target of the same workspace.

How to fix

Call the library the binary is built on.

Configure

[lints.cli-subprocess]
level = "deny"
reason = "why this project wants it at this level"

Allow one finding in the code with // spirit-level: allow(cli-subprocess) <reason> (waivers); the code works there too, as in [lints.C0003].