Commit 66728a3
authored
Rewrite Initium from Go to Rust (#13)
* Rewrite Initium from Go to Rust
Complete reimplementation of all 6 subcommands in Rust:
- wait-for (TCP + HTTP/HTTPS with retries, backoff, jitter)
- migrate (command exec with lock file idempotency)
- seed (command exec with structured logging)
- render (envsubst + Jinja2 templates via minijinja)
- fetch (HTTP fetch with auth, TLS, retry)
- exec (arbitrary command with workdir support)
Key dependencies: clap, ureq+rustls, serde_json, minijinja, regex, chrono
36 unit tests covering: logging, retry, safety, render modules
All tests passing.
Binary size comparison (release, stripped, musl-linked):
- Go binary (scratch): ~7.4 MB
- Rust binary (scratch): ~1.8 MB (76% reduction)
Docker image (scratch + binary + CA certs): 1.83 MB total
* Update all build files, workflows, and docs for Rust
- CI workflow: replace setup-go with dtolnay/rust-toolchain, use
cargo test/clippy/fmt instead of go test/vet/staticcheck
- Release workflow: use dtolnay/rust-toolchain for pre-push tests
- jyq.Dockerfile: rewrite for Rust (rust:1.85-alpine builder, cargo build)
- Dockerfile: already updated in prior commit
- docs/design.md: update architecture diagram, directory structure,
and 'How to Add a Subcommand' guide for Rust/clap
- docs/usage.md: update template mode description (Go text/template -> minijinja)
- README.md, FAQ.md: update image sizes (10MB -> 2MB), tool references
- CHANGELOG.md: add Rust rewrite entry, update references
- CLAUDE.md: add project config with cargo test references
- tests/README.md: update from go test to cargo test
* Fix clippy warnings and cargo fmt formatting
- Fix dead_code warnings: allow unused Warn variant and warn() method
- Fix useless .into() conversion in logging JSON output
- Fix manual Range::contains in fetch status check
- Fix unit let-binding in command execution
- Fix lines().flatten() -> lines().map_while(Result::ok)
- Apply cargo fmt to all source files1 parent e86526c commit 66728a3
53 files changed
Lines changed: 2864 additions & 3678 deletions
File tree
- .github/workflows
- cmd/initium
- docs
- internal
- cmd
- fetch
- logging
- render
- retry
- safety
- src
- cmd
- tests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
25 | 19 | | |
26 | 20 | | |
27 | 21 | | |
28 | 22 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
| 23 | + | |
| 24 | + | |
37 | 25 | | |
38 | 26 | | |
39 | 27 | | |
40 | 28 | | |
41 | 29 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
| 30 | + | |
| 31 | + | |
46 | 32 | | |
47 | 33 | | |
48 | 34 | | |
49 | | - | |
| 35 | + | |
50 | 36 | | |
51 | 37 | | |
52 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
7 | | - | |
8 | 6 | | |
9 | 7 | | |
10 | 8 | | |
11 | 9 | | |
12 | | - | |
13 | 10 | | |
14 | 11 | | |
15 | 12 | | |
16 | 13 | | |
17 | 14 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 15 | + | |
| 16 | + | |
25 | 17 | | |
26 | 18 | | |
27 | | - | |
28 | 19 | | |
29 | 20 | | |
30 | 21 | | |
31 | 22 | | |
32 | 23 | | |
33 | | - | |
34 | 24 | | |
35 | 25 | | |
36 | 26 | | |
37 | | - | |
38 | 27 | | |
39 | 28 | | |
40 | 29 | | |
| |||
47 | 36 | | |
48 | 37 | | |
49 | 38 | | |
50 | | - | |
51 | 39 | | |
52 | 40 | | |
53 | 41 | | |
| |||
61 | 49 | | |
62 | 50 | | |
63 | 51 | | |
64 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | | - | |
4 | | - | |
| 2 | + | |
5 | 3 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
10 | 17 | | |
11 | 18 | | |
12 | 19 | | |
13 | 20 | | |
14 | 21 | | |
15 | | - | |
| 22 | + | |
16 | 23 | | |
17 | 24 | | |
18 | 25 | | |
19 | | - | |
| 26 | + | |
20 | 27 | | |
21 | 28 | | |
22 | 29 | | |
| |||
0 commit comments