mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
Some checks are pending
Cachix / Publish Flake (push) Waiting to run
Check / clippy (push) Waiting to run
Check / rustfmt (push) Waiting to run
Check / stylua (push) Waiting to run
Draft / build-unix (gcc-aarch64-linux-gnu, ubuntu-latest, aarch64-unknown-linux-gnu) (push) Waiting to run
Draft / build-unix (gcc-i686-linux-gnu, ubuntu-latest, i686-unknown-linux-gnu) (push) Waiting to run
Draft / build-unix (gcc-riscv64-linux-gnu, ubuntu-latest, riscv64gc-unknown-linux-gnu) (push) Waiting to run
Draft / build-unix (gcc-sparc64-linux-gnu, ubuntu-latest, sparc64-unknown-linux-gnu) (push) Waiting to run
Draft / build-unix (macos-latest, aarch64-apple-darwin) (push) Waiting to run
Draft / build-unix (macos-latest, x86_64-apple-darwin) (push) Waiting to run
Draft / build-unix (ubuntu-latest, x86_64-unknown-linux-gnu) (push) Waiting to run
Draft / build-windows (windows-latest, aarch64-pc-windows-msvc) (push) Waiting to run
Draft / build-windows (windows-latest, x86_64-pc-windows-msvc) (push) Waiting to run
Draft / build-musl (aarch64-unknown-linux-musl) (push) Waiting to run
Draft / build-musl (x86_64-unknown-linux-musl) (push) Waiting to run
Draft / build-snap (amd64, ubuntu-latest) (push) Waiting to run
Draft / build-snap (arm64, ubuntu-24.04-arm) (push) Waiting to run
Draft / snap (push) Blocked by required conditions
Draft / draft (push) Blocked by required conditions
Draft / nightly (push) Blocked by required conditions
Test / test (macos-latest) (push) Waiting to run
Test / test (ubuntu-latest) (push) Waiting to run
Test / test (windows-latest) (push) Waiting to run
3.6 KiB
3.6 KiB
AGENTS.md
Rules
- Applies repo-wide. Keep changes scoped; do not create issues or pull requests, or post comments.
Project
- Rust 2024 Cargo workspace containing all
yazi-*crates; default members areyazi-fm(yazi) andyazi-cli(ya).
Style
- Follow nearby code and use idiomatic Rust and Lua. Rust uses
snake_casefor modules, functions, and fields andPascalCasefor types, traits, and variants. Lua uses PascalCase component tables,local Mplugin modules,snake_casemethods/locals, and_nameprivate fields. - Preserve established terms and type families:
Url/UrlBuf/UrlCow,PathDyn/PathBufDyn/PathCow,*Ref,*Arc,*Opt,*State,*Job,*Prog,File,Folder,Tab,Mgr, andTask. UseUrlfor logical locations andPathfor filesystem paths. - Reuse established plugin and event names (
fetch,preload,peek,seek,spot,entry,setup,yank,hover, andselect) across Rust, Lua, and configuration. - Use Rust prefixes (
as_,to_,into_,try_,is_,has_) according to their usual semantics; prefer descriptive names. - Name variables, modules, methods, and other symbols simply, elegantly, and expressively. Be creative while keeping names clear, consistent with established terminology, and idiomatic.
- When passing arguments, use the parameter's conversion traits directly (such as
Into<_>orAsRef<_>); avoid eager conversions like.to_string(),.to_owned(), and.as_ref()unless ownership, type inference, or semantics require them. - Prefer general-purpose traits and conversion APIs already provided by the codebase or its dependencies over manual construction or adapter closures; for example, use
into_lua()where applicable.
Code Changes
- Search and reuse first. For new features, extend existing infrastructure or data structures with general, reusable capabilities when that keeps the final code concise.
- For refactors, inspect the whole target module and its callers first. Look for duplicated work, redundant I/O, underpowered return values, one-use wrappers, and reusable cross-platform abstractions; implement high-confidence, behavior-preserving simplifications while preserving error, fallback, and platform semantics.
- Keep diffs minimal and avoid unrelated refactors. Prefer clear code over custom patterns or comments; comment only behavior the code cannot explain.
- Put reusable code in the lowest suitable shared layer; avoid unnecessary dependencies and allocations. Prefer borrowed values and existing wrappers.
- Use stable Rust APIs; nightly is formatting-only. Use only
pub,pub(super), andpub(crate)—neverpub(in ...). - Keep async I/O non-blocking, preserve platform/fork behavior, and follow existing error boundaries with
?. - For renames or refactors, update all related variables, functions, parameters, modules, methods, types, derived types, exports, tests, configuration keys, documentation, and Lua bindings.
- Do not add or modify tests unless requested.
Validation
- Prefer targeted debug checks; use multiple
-pflags for affected crates before the whole workspace.
cargo check -p <package>
cargo test -p <package>
cargo clippy -p <package>
find . -name '*.rs' -not -path './target/*' -exec rustfmt +nightly --check {} +
stylua --color always --check .
- Use
cargo checkinstead ofcargo buildunless artifacts are needed. Do not use--releaseunless requested; usescripts/build.sh <target>for release or cross-target packaging. - Run relevant existing tests when needed, then inspect
git diffand verify that only intended files changed.