Skip to content

Commit 14bdf1f

Browse files
committed
cargo-rail: readme
1 parent 4c3970a commit 14bdf1f

File tree

1 file changed

+83
-64
lines changed

1 file changed

+83
-64
lines changed

README.md

Lines changed: 83 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,136 @@
11
# cargo-rail
22

3-
**Hyper-efficient Rust monorepo orchestration.**
3+
**Rust monorepo orchestration. Zero waste.**
44

55
---
66

7-
## Status
7+
## What It Does
88

9-
**NOT READY FOR PUBLIC USE.** Active development. Internal testing only.
9+
### 1. Replace cargo-hakari
1010

11-
---
11+
```bash
12+
cargo rail unify
13+
```
1214

13-
## What It Does
15+
Native `[workspace.dependencies]` unification. No workspace-hack crates. No guppy. No maintenance.
1416

15-
### 1. Workspace Dependency Unification
17+
### 2. Distribute Crates
1618

17-
**Replaces cargo-hakari and workspace-hack crates.**
19+
```bash
20+
cargo rail split my-crate
21+
cargo rail sync my-crate
22+
```
23+
24+
Split monorepo crates to standalone repos. Sync bidirectionally. Full git history preserved.
1825

19-
- Native Cargo `[workspace.dependencies]` unification
20-
- No fake crates, no guppy, no runtime overhead
21-
- CI-enforceable via `cargo rail unify check`
22-
- Invisible after initial application
26+
**Replaces:** Copybara, git-filter-repo, bash scripts
27+
28+
### 3. Test Only What Changed
2329

2430
```bash
25-
cargo rail unify analyze # Dry-run analysis
26-
cargo rail unify apply --backup # Apply unification
27-
cargo rail unify check # CI verification (exit 0 = unified)
31+
cargo rail test
2832
```
2933

30-
### 2. Split & Sync
34+
Graph-aware change detection. Docs-only changes skip tests. Source changes test affected crates only.
35+
36+
**Nextest/Cargo native. Saves CI costs.**
3137

32-
**Split crates from monorepo to standalone repos. Sync bidirectionally.**
38+
### 4. Release & Changelog
3339

3440
```bash
35-
# Split: Monorepo → Standalone Repo (with full git history)
36-
cargo rail split my-crate --apply
41+
cargo rail release my-crate
42+
```
3743

38-
# Sync: Monorepo → Split Repo (direct push to main)
39-
cargo rail sync my-crate --to-remote --apply
44+
Validates edition, MSRV, dependencies. Publishes to crates.io. Tags releases. Generates changelogs.
4045

41-
# Sync: Split Repo → Monorepo (creates PR branch, never commits to main)
42-
cargo rail sync my-crate --from-remote --apply
43-
```
46+
---
4447

45-
**Modes:**
46-
- **Single crate** → Single repo
47-
- **Multiple crates** → Single repo
48-
- **Multiple crates** → Separate monorepo
48+
## Why It Matters
4949

50-
### 3. Centralized Configuration Management
50+
| Problem | cargo-rail |
51+
|---------|------------|
52+
| Fragmented features → slow builds | Native workspace unification |
53+
| Distributing crates from monorepo | Split/sync with full history |
54+
| Testing everything on every PR | Graph-aware test runner |
55+
| Version drift across workspace | Enforced policies |
5156

52-
**Enforce uniform policies across all workspace crates.**
57+
---
5358

54-
- Edition, MSRV, resolver version
55-
- Dependency version consistency
56-
- Workspace inheritance validation
59+
## Install
5760

58-
```toml
59-
# rail.toml
60-
[policy]
61-
edition = "2024"
62-
msrv = "1.76.0"
63-
resolver = "2"
64-
forbid_multiple_versions = ["tokio", "serde"]
61+
```bash
62+
cargo install cargo-rail
6563
```
6664

6765
---
6866

69-
## Architecture
67+
## Quick Start
7068

71-
- **Git + Cargo + Petgraph** - Core foundation
72-
- **Zero libgit2/gitoxide** - System git binary only
73-
- **Zero guppy** - Direct cargo_metadata usage
74-
- **Workspace-aware graph** - Dependency + reverse-dependency tracking
69+
```bash
70+
# Unify dependencies
71+
cargo rail unify
72+
73+
# Split a crate (one-time)
74+
cargo rail split my-crate
75+
76+
# Sync changes
77+
cargo rail sync my-crate
78+
79+
# Test what changed
80+
cargo rail test
81+
82+
# Release a crate
83+
cargo rail release my-crate
84+
```
7585

7686
---
7787

7888
## Configuration
7989

80-
`rail.toml`:
81-
8290
```toml
83-
[workspace]
84-
root = "."
85-
86-
# Split configuration
91+
# rail.toml
8792
[[splits]]
8893
name = "my-crate"
8994
remote = "[email protected]:user/my-crate.git"
90-
branch = "main"
91-
mode = "single"
9295
paths = [{ crate = "crates/my-crate" }]
9396

94-
# Unification configuration (optional)
95-
[unify]
96-
strategy = "all"
97-
normal_only = false
98-
exclude = ["some-special-dep"]
99-
100-
# Policy enforcement
10197
[policy]
10298
edition = "2024"
103-
msrv = "1.76.0"
104-
resolver = "2"
99+
msrv = "1.83.0"
105100
forbid_multiple_versions = ["tokio"]
106101
```
107102

108103
---
109104

110-
## Security
105+
## How It Works
106+
107+
- **Zero libgit2/gitoxide** - System git only
108+
- **Zero guppy** - cargo_metadata + petgraph
109+
- **Graph-first** - Dependency graph drives everything
110+
- **Minimal deps** - Supply-chain security matters
111+
- **Deterministic** - Same input = same git SHAs
112+
113+
---
114+
115+
## Safety
116+
117+
- Syncs from remote create PR branches, never commit to main
118+
- Destructive operations require explicit flags
119+
- Backups created automatically
120+
121+
---
122+
123+
## Status
124+
125+
**Beta:**
126+
127+
- ✅ Dependency unification
128+
- ✅ Split/sync with history preservation
129+
- ✅ Graph-aware change detection
111130

112-
**Split → Mono:** Creates PR branch `rail/sync/{name}/{timestamp}`. Never commits to main.
131+
**Coming soon:**
113132

114-
**Mono → Split:** Direct push. Use SSH keys + branch protection.
133+
- 🚧 Release/publish/changelog automation
115134

116135
---
117136

0 commit comments

Comments
 (0)