@zackees/soldr 0.7.89 → 0.7.90

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +64 -21
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -198,18 +198,56 @@ soldr rustfmt src/main.rs
198
198
 
199
199
  ## How it works
200
200
 
201
- ```text
202
- soldr cargo build --release
203
- +-- resolve the real cargo binary
204
- +-- on Windows, re-run from a soldr-owned runtime copy when needed
205
- +-- fetch/start managed zccache when cache is enabled
206
- +-- set soldr as the compiler wrapper for this build
207
- +-- have soldr wrapper mode delegate to managed zccache
208
- +-- delegate to cargo with your existing flags
201
+ soldr is a **chameleon binary**: one executable that picks its role from `argv[1]` on every invocation. Three roles:
202
+
203
+ ```mermaid
204
+ flowchart TD
205
+ A["soldr <argv[1]> ..."] --> B{"classify argv[1]"}
206
+ B -->|"path to rustc"| C["<b>Cache mode</b><br/>invoked as RUSTC_WRAPPER by cargo.<br/>hash inputs, query cache,<br/>forward to real rustc on miss."]
207
+ B -->|"built-in verb<br/>cargo · rustup · status · cache · ..."| D["<b>Dispatch mode</b><br/>run internal handler,<br/>or exec a toolchain binary<br/>resolved via rustup."]
208
+ B -->|"anything else<br/>maturin · cargo-nextest · cbindgen · ..."| E["<b>Tool-fetch mode</b><br/>resolve via known_tools,<br/>download from GitHub Releases,<br/>exec the fetched binary."]
209
+ ```
210
+
211
+ When you run `soldr cargo build`, the two other modes both come into play. soldr acts as the dispatch-mode front door, then cargo re-invokes soldr once per crate as the RUSTC_WRAPPER — that second soldr is the cache-mode instance that talks to the managed zccache daemon:
212
+
213
+ ```mermaid
214
+ sequenceDiagram
215
+ autonumber
216
+ participant U as User
217
+ participant S1 as soldr (front door)
218
+ participant C as cargo
219
+ participant S2 as soldr (RUSTC_WRAPPER)
220
+ participant Z as zccache daemon
221
+ participant R as real rustc
222
+
223
+ U->>S1: soldr cargo build --release
224
+ S1->>S1: dispatch mode: cargo verb
225
+ S1->>Z: start managed zccache if needed
226
+ S1->>C: exec cargo (RUSTC_WRAPPER=soldr)
227
+ loop per crate
228
+ C->>S2: soldr [path-to-rustc] [args]
229
+ S2->>Z: query cache (hash of inputs)
230
+ alt cache hit
231
+ Z-->>S2: cached artifact
232
+ S2-->>C: emit artifact, exit 0
233
+ else cache miss
234
+ Z->>R: forward to rustc
235
+ R-->>Z: fresh artifact
236
+ Z->>Z: store keyed by input hash
237
+ Z-->>S2: artifact
238
+ S2-->>C: emit artifact, exit 0
239
+ end
240
+ end
241
+ C-->>S1: build complete
242
+ S1-->>U: exit
243
+ ```
244
+
245
+ Tool fetches are much simpler — no cargo, no rustc, no wrapper handshake:
209
246
 
247
+ ```text
210
248
  soldr maturin build --release
211
- +-- maturin cached? --> run instantly
212
- +-- not cached? --> download pre-built binary (2s) --> run
249
+ +-- maturin cached? --> run instantly
250
+ +-- not cached? --> download pre-built binary (2s) --> run
213
251
  ```
214
252
 
215
253
  ## Linker speed (the other half of fast CI)
@@ -256,25 +294,30 @@ If you also have many separate test binaries, consider consolidating them under
256
294
 
257
295
  ## Architecture
258
296
 
297
+ **Monocrate.** A single Rust crate `soldr-cli` under `crates/soldr-cli/`, with four module trees inside it. The earlier four-crate workspace (`soldr-core` / `soldr-fetch` / `soldr-cache` / `soldr-cli`) was collapsed in 2026-05; the regression guard `crates/soldr-cli/tests/monocrate_guard.rs` fails the build if anyone reintroduces a second crate.
298
+
259
299
  ```
260
300
  soldr/
261
301
  |-- crates/
262
- | |-- soldr-core/ # Shared types, config, cache directory layout
263
- | |-- soldr-fetch/ # Binary resolution + download (the crgx half)
264
- | |-- soldr-cache/ # Compilation caching (the zccache half)
265
- | `-- soldr-cli/ # CLI entry point + wrapper mode
266
- |-- src/soldr/ # Python package (maturin bin bindings)
302
+ | `-- soldr-cli/
303
+ | |-- src/
304
+ | | |-- core/ # Shared types, config, cache paths (formerly soldr-core)
305
+ | | |-- fetch/ # Binary resolution + download (formerly soldr-fetch)
306
+ | | |-- cache_lib/ # RUSTC_WRAPPER + daemon IPC (formerly soldr-cache)
307
+ | | `-- main.rs + cli/ # Mode detection, dispatch, cargo front door
308
+ | `-- tests/
309
+ |-- src/soldr/ # Python package (maturin bin bindings)
267
310
  `-- tests/
268
311
  ```
269
312
 
270
- | Crate | Role |
313
+ | Module | Role |
271
314
  |---|---|
272
- | `soldr-core` | Cache paths, config, version types |
273
- | `soldr-fetch` | Resolve crate binaries from crates.io metadata and GitHub Releases. Download and cache. |
274
- | `soldr-cache` | zccache integration helpers, cache policy, session plumbing. |
275
- | `soldr-cli` | Mode detection, cargo front door, built-in commands (`status`, `clean`, `config`, `cache`), tool fetch dispatch. |
315
+ | `src/core/` | Shared types, config (`~/.soldr/config.toml`), target-triple resolution (MSVC default on Windows), cache paths, error types. No I/O beyond config files. |
316
+ | `src/fetch/` | Binary resolution. `known_tools` registry, `trust` (SHA-256 pins + `SOLDR_TRUST_MODE` enforcement), rustup auto-bootstrap, resolution chain (local cache → repo lookup → GitHub Releases extract). |
317
+ | `src/cache_lib/` | `RUSTC_WRAPPER` mode: hash inputs (blake3), check `~/.soldr/cache/`, daemon IPC (Unix socket / Windows named pipe), LRU eviction, `soldr save` / `soldr load` archive transport, auto-GC. |
318
+ | `src/main.rs` + cli/ | Mode detection (chameleon dispatch), clap for built-ins, exec for tool fetch, cargo front door (`soldr cargo ...`). |
276
319
 
277
- These workspace crates are implementation details. They are not a supported public Rust library API.
320
+ A thin `src/lib.rs` re-exports `pub mod core; pub mod fetch; pub mod cache_lib;` so the library integration tests can keep `use soldr_cli::core::*`-style imports. This is not a supported public Rust library API.
278
321
 
279
322
  ## Prior art
280
323
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zackees/soldr",
3
- "version": "0.7.89",
3
+ "version": "0.7.90",
4
4
  "description": "Instant Rust tools and builds from one command.",
5
5
  "license": "BSD-3-Clause",
6
6
  "homepage": "https://github.com/zackees/soldr",