This guide gives contributors the essentials for working on Smart Tree in this repository. Keep updates concise and run the pre-commit checks before opening a PR.
src/: Main Rust crate. Key areas:main.rs/cli.rs(entry & clap args),scanner.rs(walks the filesystem),formatters/(output formats),mcp/(JSON-RPC tools),mem8/(persistence),web_dashboard/(web UI backend), andbin/targets forst,mq,m8,n8x.scripts/: Automation (manage.sh,build-and-install.sh) plus helper shell functions.tests/: Rust integration tests; fixtures live alongside intest,test_files, andtest-dirs.docs/andexamples/: User-facing guides and sample outputs.marqant/: Compression submodule;expert_prompt_engineer/: secondary workspace crate.
./scripts/manage.sh test— pre-commit bundle:cargo test+cargo clippy -D warnings+cargo fmt --check.cargo build --release— optimized binaries with TUI built-in; use--features fullfor local LLM (candle).cargo run --bin st -- --help— smoke-test the CLI; add flags like--mode ai --compressas needed.cargo testorcargo test name -- --exact --nocapture— run all or targeted tests with output.cargo fmt --all -- --checkandcargo clippy -- -D warnings— enforce style/lints when iterating../scripts/build-and-install.sh— rebuild and install locally, clearing shell command cache.
- Rust 2021, 4-space indent. Keep functions small; prefer composition over long match blocks.
- Use
anyhow::Resultwith.context(...); avoid panics in library code. - File/module names snake_case; types/enums struct PascalCase; CLI flags stay kebab-case to match
cli.rs. - Logging via
tracingmacros; keep comments brief and in the existing light, direct tone.
- Primary suite:
cargo test; async tests use#[tokio::test]. - Integration coverage in
tests/; data fixtures undertest/test_files/test-dirs. - CLI/regression scripts (
test_spicy.sh,test_feature_flags.sh, etc.) can be run directly withbash. - For verbose diagnostics:
RUST_LOG=debug cargo test -- --nocapture. - Aim for zero clippy warnings and add tests for new branches or error paths.
- Commit format:
type: short descriptionwheretype∈ {feat, fix, docs, style, refactor, test, chore}. Keep commits focused. - Before PR: ensure
./scripts/manage.sh testpasses and docs are updated when behavior changes. - PR description should summarize intent, link issues, list relevant feature flags, and include output or screenshots for UX-facing changes (TUI/dashboard).
- Run
st --cleanupafter installs andst --security-scan .before releases to detect risky MCP hooks or supply-chain issues. - Keep secrets and local settings out of the repo; confirm
.gitignorecoverage before adding new generated files. - Prefer local/offline MCP servers; discuss any new networked hooks in the PR to ensure review.