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

+51 -51
View File
@@ -2,10 +2,10 @@
## Goal
Give the `vfmt` CLI the same front door the server got in M1: `vfmt -f
Give the `lucisv` CLI the same front door the server got in M1: `lucisv -f
project.f` formats or lints exactly the files an EDA filelist names, reusing
`vfmt_core::filelist::read` unchanged. M1 deliberately stopped at the config
key and the language server — "a `vfmt -f` flag is its own change with its own
`lucisv_core::filelist::read` unchanged. M1 deliberately stopped at the config
key and the language server — "a `lucisv -f` flag is its own change with its own
exit-code questions" (`docs/features/filelist/README.md`, Status). This is that
change: the flag, the answers to those questions, and nothing else. No new
parsing, no new dependency, no version bump.
@@ -14,7 +14,7 @@ parsing, no new dependency, no version bump.
- **A filelist is an *input*, not a *mode*.** `-f` adds files to whatever the
command line already names; it does not replace, filter or reorder them. So
`vfmt -f a.f`, `vfmt rtl/` and `vfmt -f a.f rtl/ tb/top.sv` are all ordinary
`lucisv -f a.f`, `lucisv rtl/` and `lucisv -f a.f rtl/ tb/top.sv` are all ordinary
runs, and having neither positional inputs nor `-f` is still the usage error
it always was.
- **Listed paths are named paths.** `--exclude` and `.gitignore` filter
@@ -25,7 +25,7 @@ parsing, no new dependency, no version bump.
choice would mean a `.gitignore` in a generated-RTL directory could silently
shrink the build's own file set.
- **Warnings are warnings.** Everything M1's parser reports as a warning — a
listed file that no longer exists, an option vfmt has no table for, an unset
listed file that no longer exists, an option lucisv has no table for, an unset
`$VAR`, a repeated filelist, a `-f` chain past `MAX_NESTING_DEPTH` — goes to
stderr as `warning: <filelist>:<line>: <what>` and leaves the exit code
alone. This matches the server, which shows the same strings and keeps
@@ -40,19 +40,19 @@ parsing, no new dependency, no version bump.
- **Two names for one file are one file.** Dedup is by lexical absolute path
(`.`/`..` folded, symlinks deliberately not resolved — the same rule
`filelist::Reader::normalize` and `config::Discovery::absolute` already
use), and the *first* spelling seen is the one vfmt reports, so
`vfmt -f p.f rtl/a.sv` still says `rtl/a.sv` and not the absolute path the
use), and the *first* spelling seen is the one lucisv reports, so
`lucisv -f p.f rtl/a.sv` still says `rtl/a.sv` and not the absolute path the
filelist produced. This also dedups repeats that have nothing to do with
filelists (`vfmt rtl/ rtl/a.sv`), which previously formatted the file twice
filelists (`lucisv rtl/ rtl/a.sv`), which previously formatted the file twice
— see the Work log.
- **The `filelist` key in `vfmt.toml` stays server-only.** Auto-consuming it
would make `vfmt rtl/` process files that are not under `rtl/`, and
`vfmt --check .` in CI change its file set because someone added a key for
- **The `filelist` key in `lucisv.toml` stays server-only.** Auto-consuming it
would make `lucisv rtl/` process files that are not under `rtl/`, and
`lucisv --check .` in CI change its file set because someone added a key for
the editor's benefit. A CLI filelist is named on the command line, where it
is visible in the CI log. `--help` says so in the CONFIGURATION section.
- **An empty result is the existing empty-input error.** A filelist naming
nothing that exists produces its warnings and then `no Verilog files found`,
exit 2 — the same answer `vfmt empty-dir/` has always given.
exit 2 — the same answer `lucisv empty-dir/` has always given.
- **`-f` is not `-F`.** vcs's `-F` (paths relative to the *invoking*
directory rather than to the filelist) is not supported, exactly as M1 left
it. Nobody has asked.
@@ -61,15 +61,15 @@ parsing, no new dependency, no version bump.
### Consumed
- `vfmt_core::filelist::read(&Path) -> Result<Filelist, String>` — unchanged,
- `lucisv_core::filelist::read(&Path) -> Result<Filelist, String>` — unchanged,
used exactly as the server uses it. Only `files` and `warnings` are read:
`incdirs` and `defines` are meaningless to a formatter that does not
preprocess, and are dropped.
- `vfmt_core::walk::collect_files` / `config::Discovery` — unchanged. Filelist
- `lucisv_core::walk::collect_files` / `config::Discovery` — unchanged. Filelist
files skip `collect_files` entirely (they are exact paths, and running them
through it would only re-`is_file()` them), but they go through
`Discovery::for_file` in the same loop as every other file, so a listed file
is formatted with its *own* directory's `vfmt.toml`.
is formatted with its *own* directory's `lucisv.toml`.
### Promised
@@ -79,19 +79,19 @@ parsing, no new dependency, no version bump.
usage errors (an unreadable filelist, `-f` with no value, `-` or `--lines`
with `-f`).
- **stdout stays machine-readable.** Every warning goes to stderr, so
`vfmt check --output-format json -f p.f` still prints exactly one JSON array
`lucisv check --output-format json -f p.f` still prints exactly one JSON array
on stdout. Pinned by a test.
- **`Options` gains `filelists: Vec<String>`** (`crates/vfmt/src/args.rs`).
- **`Options` gains `filelists: Vec<String>`** (`crates/lucisv/src/args.rs`).
Anything constructing an `Options` literal needs the field; nothing outside
`crates/vfmt` does.
`crates/lucisv` does.
### Rejected combinations (all exit 2, all decided at parse time)
| Command line | Why |
|---|---|
| `vfmt -f p.f -` | stdin is one anonymous buffer; a filelist is a set of paths on disk. Reading both would mean ignoring one. |
| `vfmt --lines 3-9 -f p.f` | Same reason `--lines` rejects a directory: line numbers name lines of *a file*, and a filelist is a file set. |
| `vfmt -f` | Missing flag value, like every other flag. |
| `lucisv -f p.f -` | stdin is one anonymous buffer; a filelist is a set of paths on disk. Reading both would mean ignoring one. |
| `lucisv --lines 3-9 -f p.f` | Same reason `--lines` rejects a directory: line numbers name lines of *a file*, and a filelist is a file set. |
| `lucisv -f` | Missing flag value, like every other flag. |
Everything else about a run is unchanged by `-f`: the cache, `--threads`,
`--stdout`, `--diff`, `--fix`, config discovery and the summary line all
@@ -99,8 +99,8 @@ behave exactly as they do for a file named as an argument.
## Status / TODO
- [x] `-f <FILELIST>` on `vfmt`, `vfmt format`, `vfmt --check/--diff` and
`vfmt check`; repeatable; combines with positional inputs
- [x] `-f <FILELIST>` on `lucisv`, `lucisv format`, `lucisv --check/--diff` and
`lucisv check`; repeatable; combines with positional inputs
- [x] Warnings to stderr as `warning: ...`, exit code unaffected; unreadable
filelist is exit 2 with nothing processed
- [x] Listed paths bypass `--exclude` and `.gitignore`, like named files
@@ -112,9 +112,9 @@ behave exactly as they do for a file named as an argument.
server-only
- [x] `README.md`: `-f` in the CLI examples and in the configuration section
- [x] Tests: 3 unit (2 `args.rs`, 1 `main.rs`) + 10 e2e
(`crates/vfmt/tests/cli.rs`);
(`crates/lucisv/tests/cli.rs`);
`cargo fmt`, `cargo clippy --all-targets`, `cargo test --workspace`
- [ ] Not done, deliberately: the `vfmt.toml` `filelist` key is still not read
- [ ] Not done, deliberately: the `lucisv.toml` `filelist` key is still not read
by the CLI (Assumptions), and `+incdir+`/`+define+` still feed nothing
on this side — the formatter and the linter do not preprocess.
- [ ] Not done, deliberately: no `-F`, and no quoting for paths containing
@@ -124,13 +124,13 @@ behave exactly as they do for a file named as an argument.
### 2026-08-25 — dev agent, M13
Three files of code, all in `crates/vfmt`.
Three files of code, all in `crates/lucisv`.
- **`src/args.rs`** — `Options::filelists`, the `-f` arm (placed before the
`s if s.starts_with('-')` catch-all so it is a flag, not an unknown option),
the emptiness check widened to "no inputs *and* no filelists", and the two
rejected combinations. Both rejections live in `parse_from` rather than in
`gather`, so they are cheap unit tests and so `vfmt -f p.f -` cannot reach
`gather`, so they are cheap unit tests and so `lucisv -f p.f -` cannot reach
the stdin path at all: `is_stdin()` is checked before `gather` in `main`,
and a run that read stdin while ignoring `-f` would be the silent-wrong
answer this feature exists to avoid.
@@ -151,7 +151,7 @@ Decisions worth recording:
every warning is on stderr before the first file is touched.
- **Dedup is global, not filelist-vs-command-line.** It was tempting to dedup
only across the two sources, but the same `HashSet` costs nothing and fixes
a pre-existing sharp edge: `vfmt rtl/ rtl/a.sv` used to format `a.sv` twice
a pre-existing sharp edge: `lucisv rtl/ rtl/a.sv` used to format `a.sv` twice
and count it twice, and with `--threads > 1` two workers could hold the same
path. **This is a behavior change beyond the flag** — a run naming one file
twice now reports `1 file`, not `2` — and it is the only one. No existing
@@ -160,12 +160,12 @@ Decisions worth recording:
`absolute` in `main.rs` is the same twelve lines as
`filelist::Reader::normalize` and `config::Discovery::absolute`, which QA
already examined once and accepted as deliberate duplication (filelist QA
log, Finding 3). The alternative was widening `vfmt_core`'s public API with
log, Finding 3). The alternative was widening `lucisv_core`'s public API with
a `pub fn normalize(path, cwd)` for a single caller, which CLAUDE.md's
"don't build the abstraction for a second user that doesn't exist" rule and
the "don't touch files outside your feature's scope" rule both argue
against. Recorded here so a future third caller knows to extract it.
Unlike the other two, this copy is *only* a dedup key: the path vfmt reads,
Unlike the other two, this copy is *only* a dedup key: the path lucisv reads,
writes and reports is always the one it was given.
- **`--lines` with `-f` is a new error, not a new behavior.** Today
`--lines` only rejects a *directory*; a filelist would have been accepted
@@ -176,11 +176,11 @@ Decisions worth recording:
simply has no use for them. Saying "ignoring +incdir+" on every run of every
real filelist would be noise.
**Files touched outside `crates/vfmt`**: two, both documentation this change
**Files touched outside `crates/lucisv`**: two, both documentation this change
makes untrue and both edited in the style each file already uses.
`README.md` — the CLI example block and the configuration section's "the CLI
does not consume it yet". `docs/features/filelist/README.md` — its Status item
"the CLI does not consume `filelist` yet ... a `vfmt -f` flag is its own
"the CLI does not consume `filelist` yet ... a `lucisv -f` flag is its own
change", struck through and answered the same way that README already resolved
its `+incdir+` item after M10. `TODO.md` and the umbrella checklist were left
for the lead, per the brief — M13's box is still unchecked.
@@ -188,13 +188,13 @@ for the lead, per the brief — M13's box is still unchecked.
**Verification.** `cargo fmt --all -- --check` clean; `cargo clippy
--all-targets` silent; `cargo test --workspace` green — 1556 tests, 13 of them
new (2 unit in `args.rs`, 1 in `main.rs` pinning the dedup key, 10 e2e in
`tests/cli.rs`: `crates/vfmt`'s two suites went 30 → 33 and 71 → 81). The e2e
`tests/cli.rs`: `crates/lucisv`'s two suites went 30 → 33 and 71 → 81). The e2e
set covers: `-f`
alone with a nested `-f` and relative resolution; `-f` plus positional files
and a directory with triple dedup; two `-f` flags; a missing listed file
(warning on stderr, others formatted, exit 0) and an unknown option; an
unreadable filelist (exit 2, nothing written); `--check` with `-f` (exit 1,
then exit 0 once formatted); `vfmt check -f` in text and JSON form (stdout is
then exit 0 once formatted); `lucisv check -f` in text and JSON form (stdout is
one array, warnings on stderr); a filelist named from an unrelated working
directory; a listed file that both `--exclude` and `.gitignore` name; and the
four usage errors. Also hand-driven against the built binary from two
@@ -209,7 +209,7 @@ different working directories before the tests were written.
matching the Work log's count exactly (0 failed, 4 pre-existing `#[ignore]`
elsewhere, unrelated to this feature).
**Exit-code contract audit.** Built `target/release/vfmt` and drove the
**Exit-code contract audit.** Built `target/release/lucisv` and drove the
matrix by hand: clean file via `-f` → 0; would-reformat via `-f --check` →
1; lint violation via `check -f` → 1; a filelist naming only a missing file
→ warning + `no Verilog files found` → **2** (empty-after-skip, matching
@@ -226,11 +226,11 @@ exit code outside {0,1,2}.
**Claims verified directly, all pass:**
- `-f` repeatable, combines with positional inputs, `-f` alone is a valid
complete command line (`args.rs:378`, tested live).
- Dedup: `vfmt --check rtl/ rtl/a.sv` reports `a.sv` exactly once and the
- Dedup: `lucisv --check rtl/ rtl/a.sv` reports `a.sv` exactly once and the
summary reads `2 files would be reformatted` for a 2-file tree, not 3 —
confirmed the behavior change is real and works as claimed.
- First-spelling-wins is honored across sources, not just within one:
`vfmt --check -f p.f rtl/a.sv` (filelist lists `rtl/a.sv`, positional arg
`lucisv --check -f p.f rtl/a.sv` (filelist lists `rtl/a.sv`, positional arg
also names it) reports `rtl/a.sv`, never the filelist's absolute
resolution — matches the Assumptions' worked example verbatim.
- Warnings go to stderr only, never touch the exit code: missing listed
@@ -239,11 +239,11 @@ exit code outside {0,1,2}.
- `check -f --output-format json`: stdout is exactly one parseable JSON
array (piped through `python3 -m json.load`, 2 entries) with the missing-
file warning only on stderr. Text-mode `check -f` likewise.
- `vfmt.toml`'s `filelist` key: `--help`'s CONFIGURATION section says
"read by vfmt-server only" as claimed; the CLI never opens the key
- `lucisv.toml`'s `filelist` key: `--help`'s CONFIGURATION section says
"read by lucisv-server only" as claimed; the CLI never opens the key
(unchanged from before this feature — not separately re-verified beyond
reading the help text and the diff, since the CLI simply never reads
`FileConfig::filelist` anywhere in `crates/vfmt`).
`FileConfig::filelist` anywhere in `crates/lucisv`).
- `-f` + `-`, `--lines` + `-f`, bare `-f`: all three rejected at parse time,
exit 2, with the exact messages the README's Rejected-combinations table
promises.
@@ -255,12 +255,12 @@ exit code outside {0,1,2}.
- CRLF filelist: works with no special-casing needed, `str::lines()`
already strips `\r` (same as M1's own QA finding).
- `$VAR` expansion to an absolute path: works (first attempt was a shell
quoting mistake on my end, not a vfmt bug — corrected and re-run).
quoting mistake on my end, not a lucisv bug — corrected and re-run).
- A filelist that `-f`s itself: one warning, no infinite loop, its own file
still processed once.
- Usage errors: `-f` with no value → `error: -f requires a value`, exit 2.
Repeated identical `-f list.f -f list.f` → deduped, one file reported, not
two. `vfmt -- -f` → `error: unknown option: --`, exit 2 — vfmt has no `--`
two. `lucisv -- -f` → `error: unknown option: --`, exit 2 — lucisv has no `--`
end-of-options handling anywhere (pre-existing, not part of this
feature's scope; noting only because the brief asked).
@@ -276,7 +276,7 @@ two different spellings (`rtl/a.sv` positional + `alias.sv` via `-f`,
formatted independently:
```
$ vfmt --check rtl/a.sv -f list.f # list.f names alias.sv, a symlink to rtl/a.sv
$ lucisv --check rtl/a.sv -f list.f # list.f names alias.sv, a symlink to rtl/a.sv
would reformat: rtl/a.sv
would reformat: /.../alias.sv
2 files would be reformatted
@@ -288,7 +288,7 @@ open-truncate-write, **not** tempfile+rename. `cache.rs:91` sits right next
to this code and *does* the atomic tempfile+rename dance, with a doc comment
explicitly saying "Writes the cache back, atomically" — so the codebase
already has the pattern, just not applied to the file the user actually
asked vfmt to rewrite.
asked lucisv to rewrite.
Put together: two workers (`--threads > 1`) that land on the same inode
through two spellings — a symlink pair being the realistic case, since
@@ -300,13 +300,13 @@ corrupt code... no partial output"), not a hypothetical.
**Severity assessment, honestly:** this is **not new in M13** and **not
worsened by it**. Before this milestone there was no dedup at all, so
`vfmt a.sv a.sv` (no symlink needed) already put two workers on one path
`lucisv a.sv a.sv` (no symlink needed) already put two workers on one path
under `--threads > 1`, and a symlinked pair had exactly the same exposure
`collect_files` never resolves symlinks either (`walk.rs`, confirmed by
reading it — no `canonicalize`/`read_link` anywhere in `vfmt_core`). M13's
reading it — no `canonicalize`/`read_link` anywhere in `lucisv_core`). M13's
dedup is a strict improvement: it closes the common, likely case (the same
literal path named twice) that used to double-process on every run of
`vfmt rtl/ rtl/a.sv`; it was never advertised as closing the symlink case,
`lucisv rtl/ rtl/a.sv`; it was never advertised as closing the symlink case,
and the README's own Assumptions section says so precisely ("symlinks
deliberately not resolved"). What I'd push back on is only the Work log's
framing — "fixes a pre-existing sharp edge... two workers could hold the
@@ -347,14 +347,14 @@ if and when a fourth caller appears, as the Work log itself already says.
**+incdir+/+define+ silent drop: agree, reasoning holds for `check` too.**
Verified by reading `filelist_files` (`main.rs:328-338`): only `list.files`
and `list.warnings` are ever read; `list.incdirs`/`list.defines` are
untouched anywhere in `crates/vfmt`. Checked whether any M12 lint rule
untouched anywhere in `crates/lucisv`. Checked whether any M12 lint rule
(`crates/vlog_linter/src/rules/`) consults an include graph or any
cross-file state — grepped the whole crate for `incdir`/`include_graph`/
`cross-file`/`workspace`: zero hits. Every existing linter rule operates on
one file's own parse tree (confirmed by `context.rs`/`visit.rs` taking a
single source and no include resolver). `` `include`` resolution using
`incdirs` is M10's, and lives entirely in `vfmt_server` — the CLI has never
resolved includes at all, filelist-fed or not. So the reasoning "vfmt
`incdirs` is M10's, and lives entirely in `lucisv_server` — the CLI has never
resolved includes at all, filelist-fed or not. So the reasoning "lucisv
doesn't preprocess, so incdirs genuinely don't matter" holds for the linter
exactly as it does for the formatter; nothing in M12 would have consulted
them even if they were threaded through.
@@ -378,7 +378,7 @@ worsened by this milestone, and fixing it belongs to a change that touches
independently (1556 tests, 0 failures). The semantics decisions are the
right ones, each argued in place — listed paths bypassing exclude rules
matches the positional-arg precedent exactly, the `--lines` + `-f`
rejection prevents a silent 400-file surprise, and keeping the vfmt.toml
rejection prevents a silent 400-file surprise, and keeping the lucisv.toml
key server-only respects the CLI user who never asked for it. QA's
exit-code matrix confirms the frozen contract untouched, including both
ambiguous cells. QA's medium find — lexical-only dedup plus non-atomic