Files
viexp/docs/sprints/sprint-01-rust-core.md
T

59 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
type: sprint
number: 1
status: planned
started:
finished:
hours-planned: 20
hours-logged: 0
tags: [sprint, rust-basics]
---
# Sprint 1 — Rust core via `vls`
## Theme
Learn 80% of everyday Rust syntax by writing a real tool: `viexp ls`, a better `ls`.
## App deliverable
`viexp ls [PATH]` with: colored entries by type (dir/symlink/exec/image/archive), human sizes
(`1.4 K`, `2.1 M`), `--sort name|size|mtime`, `--hidden` toggle, `--long` (perms, dates),
`--json` (for tests), ≥10 unit tests, clippy clean.
## Rust focus — the vital 20%
Variables & shadowing, scalar types, functions, `if let`/`match`, loops & labels, `Vec`,
`String` vs `&str`, structs + methods, enums + `match` exhaustiveness, `Option`/`Result`,
the `?` operator, modules & `use`, `#[cfg(test)]` + `#[test]`.
Resources: Rust Book ch. 1–6, 7 (modules), 9 (errors) — **in English only**; rustlings
exercises `intro…functions…if…quiz1…enums…options…errors1-3`.
## Practice drills (20–30 min each — target ≈2 per day in week 1, features in week 2+)
- [ ] D1 — `read_dir` → print bare names; handle the `Result` with `?` and `anyhow` at `main`.
- [ ] D2 — `FileEntry` struct: name, is_dir, is_symlink, size, mtime; build with `metadata()`.
- [ ] D3 — Human size formatting fn + unit tests (B→K→M→G boundary values).
- [ ] D4 — Sorting: implement 3 comparators, `--sort` flag parsing (no clap yet — `std::env`).
- [ ] D5 — Colors: ANSI escape codes by hand (no crate) — learn what crates hide from you.
- [ ] D6 — `--hidden` filter (dotfiles) + tests.
- [ ] D7 — `--long` view: permissions string (`rwxr-x---`), date formatting.
- [ ] D8 — Refactor into `src/entry.rs`, `src/render.rs`, `src/cli.rs` — modules & `pub`.
- [ ] D9 — `--json` output via serde; golden-file test.
- [ ] D10 — Adopt `clap` for flags (derive API) — your first "big" crate.
- [ ] D11 — rustlings: enums + options + errors tracks.
- [ ] D12 — Review week: read your own code, note 3 things clippy taught you.
## English focus
README usage section; draft article "Why build a file manager in Rust" (150–200 words is enough).
## Session rhythm (45 min)
5 min review → 30 min drill → 10 min DevLog + ErrorJournal.
## Definition of done
- [ ] `viexp ls ~/` is nicer than `ls` for your own eyes
- [ ] ≥10 tests green, clippy clean, CI green
- [ ] Article draft published in `docs/articles/`
- [ ] Retro filled; Sprint-2 milestone issues created
## Retrospective
### Shipped
### Frustrations
### Hours logged / English notes