Rename the tool to lucisv (Language Utility for Coding In SystemVerilog)

This commit is contained in:
lucio committed 2026-08-25 23:36:00 -07:00
1 parent a284e33110
commit eeaffafd56
188 files changed
+2825 -2802

No files matched your search

+26 -26
View File
@@ -2,7 +2,7 @@
## Goal
The small ruff-inspired CLI items from `TODO.md` §1–§3 that make `vfmt`
The small ruff-inspired CLI items from `TODO.md` §1–§3 that make `lucisv`
usable in CI and in editors: `--diff` (print a unified diff instead of
rewriting), `--stdin-filename` (name the buffer an editor piped in),
`--exclude` (skip generated files during directory walks), a frozen and
@@ -63,7 +63,7 @@ hand-rolled argument parsing style of `main.rs` is kept.
directory inputs), identically on both header lines. Files that would
not change print nothing.
- The end-of-run summary (`N files would be reformatted, …`) goes to
**stderr**, as with `--check`, so `vfmt --diff … > patch.txt` captures
**stderr**, as with `--check`, so `lucisv --diff … > patch.txt` captures
only diff text.
- Exit code: `1` if any file would change, `0` if none would, `2` if any
file errored (error wins over "would change").
@@ -118,7 +118,7 @@ Each per-file (and stdin) call into `format_source` runs inside
`std::panic::catch_unwind`. The default panic hook is swapped for a
no-op around that call (`take_hook`/`set_hook`, restored immediately
after) so the contained panic prints no backtrace noise; the payload
message is re-reported in vfmt's own error style:
message is re-reported in lucisv's own error style:
```
error: rtl/bad.sv: panicked while formatting: <payload>
@@ -164,7 +164,7 @@ summary, and the run continues and exits 2. A panic that aborts (e.g.
- [x] `main.rs` split into `args.rs` / `walk.rs` / `diff.rs` + driver
(it would otherwise have passed ~400 lines).
- [x] Unit tests for the glob matcher, the diff renderer and
`catch_panic`; integration tests in `crates/vfmt/tests/cli.rs`.
`catch_panic`; integration tests in `crates/lucisv/tests/cli.rs`.
- [x] `cargo test --workspace`, `cargo clippy --all-targets`,
`cargo fmt --check` clean.
- [x] TODO.md: §1 panic containment, §2 `--diff` and `--stdin-filename`,
@@ -181,7 +181,7 @@ summary, and the run continues and exits 2. A panic that aborts (e.g.
`cargo clippy --all-targets` has 5 pre-existing warnings, all in
`vlog_parser`/`vlog_formatter` (2× `if_same_then_else`,
`manual_repeat_n`, `dead_code` on `ListItem.blank_before`) and none in
`vfmt`.
`lucisv`.
- Split `main.rs` (was 220 lines; the five items would have taken it
past 400) into `args.rs` (option struct, parsing, help), `walk.rs`
(file collection + the exclude matcher), `diff.rs` (unified diff) and
@@ -218,8 +218,8 @@ summary, and the run continues and exits 2. A panic that aborts (e.g.
- Top-level `README.md`: added the new flags to the usage block and an
exit-code table, per TODO.md §3's "document it in README and freeze
it".
- Tests: `crates/vfmt/tests/cli.rs` drives the real binary via
`env!("CARGO_BIN_EXE_vfmt")`, with a hand-rolled tempdir under
- Tests: `crates/lucisv/tests/cli.rs` drives the real binary via
`env!("CARGO_BIN_EXE_lucisv")`, with a hand-rolled tempdir under
`std::env::temp_dir()` (unique name from pid + a counter, removed by a
`Drop` guard) so no `tempfile` dependency is needed. All fixtures use
trivial Verilog (`module m;endmodule` → `module m;\nendmodule\n`) so
@@ -245,14 +245,14 @@ summary, and the run continues and exits 2. A panic that aborts (e.g.
**Results** (workspace root, final):
- `cargo test --workspace`: **69 passed, 0 failed** — 18 `vfmt` unit
(args 4, walk 4, diff 6, panic/format 4), 12 `vfmt` CLI integration,
- `cargo test --workspace`: **69 passed, 0 failed** — 18 `lucisv` unit
(args 4, walk 4, diff 6, panic/format 4), 12 `lucisv` CLI integration,
3 + 1 + 2 `vlog_formatter`, 19 `vlog_formatter` verification, 14
`vlog_parser`.
- `cargo clippy --all-targets`: no warnings from `vfmt`. The 5
- `cargo clippy --all-targets`: no warnings from `lucisv`. The 5
pre-existing warnings in `vlog_parser`/`vlog_formatter` are unchanged
from the baseline taken before this work.
- `cargo fmt --check`: clean (ran `cargo fmt -p vfmt` only, so no file
- `cargo fmt --check`: clean (ran `cargo fmt -p lucisv` only, so no file
owned by the other agent was reformatted).
- Sizes: `main.rs` 231, `args.rs` 156, `diff.rs` 199, `walk.rs` 129,
`tests/cli.rs` 261 lines. No `Cargo.toml` change was needed.
@@ -261,18 +261,18 @@ summary, and the run continues and exits 2. A panic that aborts (e.g.
### 2026-08-18 — QA agent
Scope: `crates/vfmt/**` and this README only. Nothing in `vlog_parser` /
Scope: `crates/lucisv/**` and this README only. Nothing in `vlog_parser` /
`vlog_formatter` was touched in the repo (a concurrent dev agent was
active there; the workspace failed to build on the first attempt with
errors in `vlog_formatter::format.rs` unrelated to `vfmt` — waited and
errors in `vlog_formatter::format.rs` unrelated to `lucisv` — waited and
retried, second attempt built clean, confirming the failure was transient
and outside this feature's scope).
**Build / lint / test — all green:**
- `cargo test -p vfmt`: **30 passed, 0 failed** — 18 unit (main 4, args 4,
- `cargo test -p lucisv`: **30 passed, 0 failed** — 18 unit (main 4, args 4,
walk 4, diff 6) + 12 CLI integration (`tests/cli.rs`). Matches the
claimed counts exactly.
- `cargo clippy -p vfmt --all-targets`: zero warnings from `vfmt`. Full
- `cargo clippy -p lucisv --all-targets`: zero warnings from `lucisv`. Full
`cargo clippy --all-targets` still shows exactly 4 warnings, all in
`vlog_parser`/`vlog_formatter` (2× `if_same_then_else` in
`vlog_parser/src/parser.rs:573,715`, `manual_repeat_n` in
@@ -280,7 +280,7 @@ and outside this feature's scope).
in `vlog_formatter/src/format.rs:94`) — **note:** the Work log above
says "5 pre-existing warnings" but lists only 4; today's run confirms 4.
Nit, not fixed (not my log entry to edit).
- `cargo fmt -p vfmt --check`: clean, exit 0.
- `cargo fmt -p lucisv --check`: clean, exit 0.
- Module sizes, no-unwrap-outside-tests/main, doc comments: all comply
with CLAUDE.md as of this read. `main.rs` 231, `args.rs` 156, `diff.rs`
199, `walk.rs` 129, `tests/cli.rs` 261 lines.
@@ -293,8 +293,8 @@ and outside this feature's scope).
**Diff correctness (patch round-trip), verified in scratchpad:**
- Nontrivial multi-construct file (module + always block + assign):
`vfmt --diff` output applied cleanly with `patch -p0` and byte-matched
`vfmt --stdout` output.
`lucisv --diff` output applied cleanly with `patch -p0` and byte-matched
`lucisv --stdout` output.
- >200-line gap between two independent single-line changes (256-line
file, 250 filler lines between them): 2 separate hunks emitted, both
applied cleanly via `patch -p0`, round-tripped correctly. Bounded
@@ -310,7 +310,7 @@ and outside this feature's scope).
- Already-formatted file: `--diff` correctly prints nothing, exit 0.
**FINDING (should-fix) — `\ No newline at end of file` breaks `patch`
applicability.** `crates/vfmt/src/diff.rs:40-46` (`split_lines`) pushes
applicability.** `crates/lucisv/src/diff.rs:40-46` (`split_lines`) pushes
the `NO_NEWLINE` pseudo-line into the same line stream as ordinary
content, so `render_one_hunk` (`diff.rs:129-144`) tags it with a regular
`-`/`+` sign like any other line. Real unified diff / GNU `patch` expect
@@ -318,7 +318,7 @@ this marker as a **bare, unprefixed** line immediately following its
associated content line. Repro:
```
printf 'module m;endmodule' > old.sv # no trailing newline
vfmt --diff old.sv
lucisv --diff old.sv
```
produces:
```
@@ -339,10 +339,10 @@ but it directly undercuts the dev work log's "bonus" observation that
evidently didn't include a missing-final-newline case. Worth a follow-up
fix: don't tag `NO_NEWLINE` rows with a sign in `render_one_hunk`.
**FINDING (should-fix, likely out of vfmt's scope) — stack overflow
**FINDING (should-fix, likely out of lucisv's scope) — stack overflow
aborts the whole batch, not just one file.** A syntactically valid but
deeply nested input (150 levels of `if (clk) begin ... end`, 454 lines,
built in scratchpad — not committed anywhere) crashes the whole `vfmt`
built in scratchpad — not committed anywhere) crashes the whole `lucisv`
process with `thread 'main' has overflowed its stack` / SIGABRT (exit
134), reproduced with plain format, `--check`, and `--diff` alike (i.e.
not a `--diff`-specific bug — it's in the parser/formatter's recursive
@@ -413,14 +413,14 @@ feature's and this QA pass's scope.
the error. Not documented explicitly either way, but seems like the
right behavior and is not a finding.
- `--` (bare double dash) is **not** treated as an end-of-options
marker — `vfmt -- file.sv` errors with `unknown option: --` (exit 2),
marker — `lucisv -- file.sv` errors with `unknown option: --` (exit 2),
since `args.rs:110` rejects any unrecognized token starting with `-`.
Not a regression from this feature (pre-existing hand-rolled parser
behavior, `args.rs` review confirms this pattern predates the diff/
exclude/stdin-filename additions) and not claimed anywhere in the
feature contract, so not filed as a finding against this feature —
noting only because it means a file whose name starts with `-` can
never be passed to `vfmt`. Nit, out of this feature's scope.
never be passed to `lucisv`. Nit, out of this feature's scope.
- Unknown flag (`--bogus-flag`): clear `error: unknown option:
--bogus-flag`, exit 2.
@@ -430,7 +430,7 @@ ways:**
fully contained within one function call and the process is single-
threaded (confirmed: `run_files`/`run_stdin` call `format_contained`
in a plain sequential `for` loop, no threads spawned anywhere in
`crates/vfmt`), so there is no possible interleaving between two
`crates/lucisv`), so there is no possible interleaving between two
calls — each call's take_hook always sees the hook the previous call
restored. The existing `catch_panic_is_reusable` unit test
(`main.rs:218-224`) covers this directly.
@@ -497,7 +497,7 @@ including the doc comment, close enough).
6. Test counts — **PASS**, 12 CLI integration + 18 unit tests, all
green, exact match to the claim.
No fixes were made directly to `crates/vfmt/**` — nothing rose to the
No fixes were made directly to `crates/lucisv/**` — nothing rose to the
"typo / missing assertion" bar for a QA-agent-authored fix; both
findings above are implementation decisions (diff renderer sign
handling; documenting an uncontainable-panic edge case) that belong to