- Fix all 96 doctest failures across 20 files by adding hidden imports and proper test setup (68 pass, 33 intentionally ignored) - Fix set_item_tags: wrap in transaction and replace item.id.unwrap() with proper error handling - Fix get_items_matching: replace N+1 per-item meta queries with batch get_meta_for_items() call - Fix get_item_matching: apply meta filtering instead of ignoring the parameter - Remove duplicate doc comment in store_meta - Remove dead code files: plugin.rs, plugins.rs, binary_detection.rs (never declared as modules) - Apply cargo fmt formatting fixes - Add keep.db to .gitignore
2.5 KiB
2.5 KiB
Agent Configuration
IMPORTANT: Prefer to use the write_file tool if the edit is for the majority of a file, or if you are correcting previous problems made edits from other tools.
IMPORTANT: Be very careful when quoting text in tool calls to add the right amount of escaping.
IMPORTANT: When using write_file, you must provide the whole file, even the unchanged parts.
IMPORTANT: xxx | keep | zzz must be as performant as possible in all situations.
Build/Test Commands
IMPORTANT: Do not run the application, start the web server, or the trunk server.
IMPORTANT: Cargo commands cannot be run in parallel. Prefix all commands with TERM=dumb.
TERM=dumb cargo check # Fast compile check
TERM=dumb cargo build # Build project
TERM=dumb cargo test # Run all tests
TERM=dumb cargo test test_name # Run specific test by name substring
TERM=dumb cargo test -- --nocapture # Verbose test output
TERM=dumb cargo fmt --check # Check formatting
TERM=dumb cargo fmt # Apply formatting
TERM=dumb cargo clippy -- -D warnings # Lint (warnings are errors)
TERM=dumb cargo build --release # Release build
TERM=dumb cargo build --features server # With server feature
Code Conventions
anyhow::Resultfor error handling;thiserrorfor custom error types (src/services/error.rs)- Plugin traits:
CompressionEngine,FilterPlugin,MetaPlugin - Dynamic trait objects use
clone_box()forCloneonBox<dyn Trait> - Plugin registration uses
ctorconstructors at module load time - Filter plugins must implement
filter(),clone_box(), andoptions() - Meta plugins extend
BaseMetaPluginfor boilerplate reduction - Enum string representations:
#[strum(serialize_all = "snake_case")] - Lint rules:
deny(clippy::all),deny(unsafe_code)(exceptlibc::umaskin main.rs) - Feature flags:
default = ["magic", "lz4", "gzip"]; optional:server,mcp,swagger
Testing
- Tests in
src/tests/mirroringsrc/structure; shared helpers insrc/tests/common/test_helpers.rs - Key helpers:
create_temp_dir(),create_temp_db(),test_compression_engine() - Test naming:
test_<feature>_<scenario>
Procedures
Fix build problems
TERM=dumb cargo check- Read affected files, fix errors, preserve functionality, don't downgrade versions
- Prefer
write_filefor full file rewrites; repeat from step 1
Fix formatting
TERM=dumb cargo fmt- Continue with fix build problems procedure