Add structural SystemVerilog support
Linked issue
Approved issue: #843
What changes
Implements the tree-sitter-only first version requested in the issue discussion, based on main.
- Register
tree-sitter-systemverilogfor.sv,.svh,.v, and.vh. - Extract written modules, interfaces, packages, classes, routines, and type aliases, preserving source ranges and lexical scopes for outline, zoom, and symbol edits.
- Support AST search/replace and metavariables while preserving system calls, strings, comments, and escaped identifiers.
- Connect syntax validation, embedding-search chunks, and both OpenCode/Pi AST tool schemas to the new language.
- Add a small functional ready/valid register-slice design using a package, interface/modports, and an included header, with structural and public-tool acceptance tests.
- Update only the existing README language table.
These are written-source operations; preprocessing and elaboration are not performed. The existing Slang feature branch was used only as reference; its compiler service, build-profile machinery, and slang-server integration are not part of this PR.
Opening as a draft under the contribution policy while #843 awaits design-approved.
How it was checked
cargo check -p agent-file-tools --all-targets -j 8cargo test -p agent-file-tools --lib systemverilog -j 8 -- --test-threads=8— 8 passed.cargo test -p agent-file-tools --lib ast_grep_lang::tests -j 8 -- --test-threads=8— 23 passed.cargo test -p agent-file-tools --test integration systemverilog -j 8 -- --test-threads=8— 4 passed, including scoped selection/editing, source search, AST preview/apply, exact undo, and syntax rollback/reporting.cargo test -p agent-file-tools --test integration ast_commands_test -j 8 -- --test-threads=8— 32 passed.bun test packages/opencode-plugin/src/__tests__/ast.test.ts packages/pi-plugin/src/__tests__/ast.test.ts packages/opencode-plugin/src/__tests__/subc-tool-schemas-fresh.test.ts— 16 passed.bun run typecheckin both plugin packages.bun run build:tool-schemas --checkinpackages/opencode-plugin, including the native governed hashline artifact comparison.- Changed TypeScript files pass Biome;
cargo fmt -p agent-file-tools --checkandgit diff --checkpass.
Library tests ran in an Ubuntu 24.04 container with the same Rust toolchain because existing upstream test code links mallinfo2, unavailable on the host's glibc 2.31. Real-engine integration tests ran on the host without requiring an HDL compiler or language server.
The fixture was additionally compiled and simulated with Verilator 5.052 using assertions enabled. It printed value=42, passed the buffer assertions, and finished normally. To exercise it manually from the repository root:
verilator --binary --assert --timing --top-module top \
--Mdir /tmp/aft-systemverilog-fixture -j 2 \
-Icrates/aft/tests/fixtures/systemverilog \
crates/aft/tests/fixtures/systemverilog/types_pkg.sv \
crates/aft/tests/fixtures/systemverilog/stream_if.sv \
crates/aft/tests/fixtures/systemverilog/register_slice.sv \
crates/aft/tests/fixtures/systemverilog/top.sv
/tmp/aft-systemverilog-fixture/Vtop