crates/lucisv_mcp/src/apply.rs is the one write path every edit tool uses: every file's new text is computed first (edits applied last-first; overlap, past-the-end and split-character edits refused), every target must lie inside a root (a created file's directory too, symlinked dirs resolved), every file is re-read and compared byte for byte with the text the plan was computed against before the first write — one mismatch refuses the whole edit — then write_atomic in path order, a failure part-way reported as "written N of M". dry_run returns the unified diff. Tools (tools/{format,edit,refactor}.rs): format (per-file lucisv.toml config, lines ranges, the safety net's refusal names the file, a formatter panic is caught), fix_lint (the diagnostics lint pass, safe fixes only, never inside a lucisv: off fence, refuses a result with more parse errors), rename, expand_wildcard, convert_ports, organize_imports, inline_module, propagate_ports, remove_port, add_port, extract_module (new file or same file), instantiate (text only; instance name validated). Every whole-set tool hands the engine every indexed file read at call time and re-walks the roots first (a file written in the last 5 s is in the set); a file the index skips (over 1 MiB, non-UTF-8) that spells a changed name as a whole word refuses the edit, otherwise it is named once under warnings; references carries the same warning. Annotations from an Effect table (read / edit, idempotent where a second call writes nothing).
MCP-1 delivered as a pure move: crates/lucisv/src/diff.rs::unified → lucisv_core::diff::unified, the CLI re-exports it; --diff output byte-identical (QA compared the 82bbba0 binary over the aes copy); lucisv_core still dependency-free.
QA (Opus, two rounds + two lead fixes): 38 qa_m3 tests; the write path held under a 50 ms writer race (no torn file in 650 calls), chmod 444, symlinked escapes, a concurrent lucisv --check; format/fix_lint byte-identical to the CLI on CRLF, nested configs, fences and all 124 aes files. Open and OUT of this lane: vlog_refactor::rename leaves .* and .name shorthand connections broken when a port or its bound net is renamed — a pre-existing engine corruption the LSP shares, fixed next in lane M3.5 (TODO-MCP.md); the rename tool says so until then. Engine findings filed: MCP-8 (false remove_port refusal on a same-file instantiation), MCP-10 (extract_module writes LF into a CRLF file). Gates through tools/guard.sh: fmt, clippy, workspace 4 664 passed.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
23 lines
1.1 KiB
Rust
23 lines
1.1 KiB
Rust
//! The parts of lucisv that decide *which* files are processed and *with what
|
|
//! settings*, shared by the `lucisv` CLI and the `lucisv-server` language server.
|
|
//!
|
|
//! `config` and `walk` were lifted out of `crates/lucisv` unchanged so the two
|
|
//! front ends cannot silently disagree: an editor's format-on-save must find
|
|
//! the same `lucisv.toml` and skip the same files as CI's `lucisv --check`.
|
|
//! `cache` answers the third question of the same family — whether a file
|
|
//! needs to be processed at all, and `filelist` answers the first one the way
|
|
//! an EDA project already does, from a `.f` file. `atomic` is the one write
|
|
//! path all of them share: nothing here ever truncates a file it is
|
|
//! replacing. `diff` is the unified diff the CLI's `--diff` and the MCP
|
|
//! server's `dry_run` both print. See
|
|
//! `docs/features/lucisv-core-lift/README.md`, and
|
|
//! `docs/features/{config-discovery,parallel-files,format-cache,filelist}/README.md`
|
|
//! for the rules themselves.
|
|
|
|
pub mod atomic;
|
|
pub mod cache;
|
|
pub mod config;
|
|
pub mod diff;
|
|
pub mod filelist;
|
|
pub mod walk;
|