The Problem

Teams waste time debugging environment drift: the same code works on one developer's machine but fails on another due to missing CLIs, wrong runtime versions, or stale dependencies. Solidarity solves this by codifying environment requirements into a .solidarity file that can be committed to a repo and checked automatically.

What This Does

Solidarity is a CLI tool that reads a .solidarity (or .solidarity.json) file containing rules for required binaries, environment variables, files, directories, and shell commands. The src/commands/solidarity.ts command runs these checks and exits with a non-zero code on failure, making it usable in CI pipelines. The src/commands/snapshot.ts command generates a rules file from the current machine's state, so you can capture a known-good environment.

The project is written in TypeScript (96 files) and organizes checks into small, focused functions under src/extensions/functions/ — e.g., checkCLI.ts, checkENV.ts, checkFile.ts, checkShell.ts. Each returns a pass/fail result that printResults.ts formats for output. Plugins (like solidarity-react-native) extend this with technology-specific rules.

How To Use It

Install globally or locally, then run the check command in a project directory:

npm i -g solidarity solidarity-react-native solidarity

To create a rules file from your current environment:

solidarity snapshot

Configuration lives in the .solidarity file at the project root. Rules are JSON objects specifying things like "cli": { "binary": "node", "version": ">=8.0.0" }. The schema is defined in solidaritySchema.json. You can also author rules by hand or via solidarity onboard, an interactive wizard in src/extensions/functions/onboard/.

Real-World Use

A team maintains a React Native app. Onboarding a new developer:

git clone repo && cd repo npm i -g solidarity solidarity-react-native solidarity

The check fails because the developer has Node 10 instead of the pinned 12. They run solidarity snapshot cli node to update the rule to their version, commit the change, and the team reviews it. CI runs solidarity in .travis.yml to enforce consistency across builds.

Code Health & Issues

Med - No license file - LICENSE exists in the file listing, but the README doesn't state the license type. Verify before commercial use. Low - Global install required for CLI use - The bin/solidarity entry point works via npm i -g, but local dev dependency usage requires npx solidarity or a script alias. Not documented clearly. Low - No explicit input validation - checkENV.ts and checkShell.ts execute commands from rules; a malformed .solidarity file could pass unsafe input to exec. The JSON schema helps but doesn't enforce at runtime. Med - Abandoned upstream - This is a fork of infinitered/solidarity (639 stars). The original repo's last activity appears stale; check commit history for maintenance cadence.

Tests are extensive (64 test files, snapshots, integration tests under tests/integration/). CI is configured via .travis.yml and appveyor.yml for cross-platform coverage. No secrets or obvious config leaks found.

The Bottom Line

Solidarity is a well-tested, practical tool for teams fighting environment drift. It's simple to adopt — one config file, one CLI command — and its snapshot workflow makes rule creation painless. The main caveats are the stale upstream and the need to verify the license. If you're on a team with multiple developers or CI environments, this is worth trying. Solo projects likely won't need it.