|
| 1 | +# Copilot Instructions |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +This repository contains a Rust implementation of an NFS3 protocol with server and client components. The development environment is equipped with a comprehensive Rust MCP (Model Context Protocol) server that provides specialized tools for Rust development. |
| 6 | + |
| 7 | +## Rust MCP Server Tools |
| 8 | + |
| 9 | +The following Rust-specific tools are available through the MCP server and should be used for all Rust development tasks: |
| 10 | + |
| 11 | +### Core Build & Test Tools |
| 12 | + |
| 13 | +- **Generic arguments**: |
| 14 | + - Use `package: "crate-name"` to build a specific crate |
| 15 | + - Use `all_features: true` to build with all features enabled |
| 16 | + - Use `all_targets: true` to build all targets (e.g., tests, examples) |
| 17 | + - Use `warnings_as_errors: true` for strict checking |
| 18 | + |
| 19 | +- **`Rust-cargo-build`**: Build the project using Cargo |
| 20 | + |
| 21 | +- **`Rust-cargo-check`**: Fast compilation check without code generation |
| 22 | + - Preferred for quick validation during development |
| 23 | + - Use before making code changes to understand existing issues |
| 24 | + |
| 25 | +- **`Rust-cargo-test`**: Run tests |
| 26 | + |
| 27 | +- **`Rust-cargo-clippy`**: Advanced linting with Clippy |
| 28 | + - Use `fix: true` to automatically apply fixes for Clippy warnings |
| 29 | + - Use `allow_dirty: true` to allow dirty workspaces (useful for CI/CD) |
| 30 | + |
| 31 | +- **`Rust-cargo-fmt`**: Code formatting with rustfmt |
| 32 | + - Use `all: true` to format all packages |
| 33 | + - Use `check: true` to verify formatting without applying changes |
| 34 | + |
| 35 | +### Dependency Management |
| 36 | + |
| 37 | +- **`Rust-cargo-add`**: Add dependencies to Cargo.toml |
| 38 | +- **`Rust-cargo-remove`**: Remove dependencies from Cargo.toml |
| 39 | +- **`Rust-cargo-update`**: Update dependencies in Cargo.lock |
| 40 | +- **`Rust-cargo-machete`**: Find unused dependencies |
| 41 | +- **`Rust-cargo-deny-check`**: Security and compliance checking |
| 42 | + |
| 43 | +### Development Workflow |
| 44 | + |
| 45 | +- **`Rust-cargo-metadata`**: Get project metadata in JSON format |
| 46 | +- **`Rust-cargo-search`**: Search for crates on crates.io |
| 47 | +- **`Rust-cargo-info`**: Get information about specific crates |
| 48 | + |
| 49 | +## Project Structure |
| 50 | + |
| 51 | +``` |
| 52 | +nfs3/ |
| 53 | +├── crates/ |
| 54 | +│ ├── cargo_nfs3_server/ # Lightweight NFSv3 server tool |
| 55 | +│ ├── nfs3_client/ # Async NFS3 client implementation |
| 56 | +│ ├── nfs3_server/ # Async NFS3 server implementation |
| 57 | +│ ├── nfs3_types/ # Types and utilities for NFS operations |
| 58 | +│ ├── nfs3_macros/ # Procedural macros |
| 59 | +│ └── nfs3_tests/ # Integration tests |
| 60 | +├── .github/workflows/ # CI/CD workflows |
| 61 | +└── scripts/ # Build and utility scripts |
| 62 | +``` |
| 63 | + |
| 64 | +## AI Agent Guidelines |
| 65 | + |
| 66 | +### 1. Always Use Rust MCP Tools |
| 67 | + |
| 68 | +- **DO**: Use `Rust-cargo-build` instead of `bash` commands like `cargo build` |
| 69 | +- **DO**: Use `Rust-cargo-check` for quick validation |
| 70 | +- **DO**: Use `Rust-cargo-clippy` for linting instead of manual clippy commands |
| 71 | +- **WHY**: MCP tools provide better defaults, better structured output and better error handling |
| 72 | + |
| 73 | +### 2. Development Workflow |
| 74 | + |
| 75 | +When working on code changes: |
| 76 | + |
| 77 | +1. **Check current state**: Use `Rust-cargo-check` with `all_targets: true, all_features: true` |
| 78 | +2. **Make changes**: Edit code using appropriate tools |
| 79 | +3. **Validate**: Use `Rust-cargo-clippy` with `workspace: true, all_targets: true` |
| 80 | +4. **Format**: Use `Rust-cargo-fmt` with `all: true` |
| 81 | +5. **Test**: Use `Rust-cargo-test` with `all_features: true` |
| 82 | +6. **Build**: Use `Rust-cargo-build` with `all_targets: true, all_features: true` for final verification |
| 83 | +7. **Check unused dependencies**: Use `Rust-cargo-machete` to find unused dependencies |
| 84 | +8. **Check security compliance**: Use `Rust-cargo-deny-check` to verify security and compliance |
| 85 | + |
| 86 | +### 3. Dependency Management |
| 87 | + |
| 88 | +- When adding dependencies, prefer workspace-level dependencies in the root `Cargo.toml` |
| 89 | + |
| 90 | +### 4. Code Quality Standards |
| 91 | + |
| 92 | +This project follows strict code quality standards: |
| 93 | + |
| 94 | +- **Clippy**: All clippy warnings must be addressed |
| 95 | +- **Formatting**: Code must be formatted with rustfmt using nightly toolchain |
| 96 | +- **Tests**: All changes must maintain test coverage |
| 97 | +- **Documentation**: Public APIs must be documented |
| 98 | + |
| 99 | +### 5. Common Patterns |
| 100 | + |
| 101 | +#### Checking Project Health |
| 102 | +``` |
| 103 | +1. Rust-cargo-check (all_features: true, all_targets: true) |
| 104 | +2. Rust-cargo-clippy (warnings_as_errors: true) |
| 105 | +3. Rust-cargo-test (all_features: true) |
| 106 | +4. Rust-cargo-fmt (check: true) |
| 107 | +``` |
| 108 | + |
| 109 | +#### Fixing Clippy Issues |
| 110 | +``` |
| 111 | +1. Rust-cargo-clippy (all_targets: true, fix: true, allow_dirty: true) |
| 112 | +2. Rust-cargo-fmt (all: true) |
| 113 | +3. Rust-cargo-test (all_features: true) |
| 114 | +``` |
| 115 | + |
| 116 | +#### Adding New Dependencies |
| 117 | +``` |
| 118 | +1. Rust-cargo-add (package: "dependency-name", workspace: true if workspace dep) |
| 119 | +2. Rust-cargo-deny-check (verify security compliance) |
| 120 | +``` |
| 121 | + |
| 122 | +## Repository-Specific Context |
| 123 | + |
| 124 | +### NFS3 Protocol Implementation |
| 125 | + |
| 126 | +This project implements the NFS3 protocol in Rust with the following key components: |
| 127 | + |
| 128 | +- **Types**: Core NFS3 types and RPC definitions |
| 129 | +- **Server**: Async server implementation with pluggable VFS backends |
| 130 | +- **Client**: Async client for NFS3 operations |
| 131 | +- **Testing**: Comprehensive integration tests including WASM targets |
| 132 | + |
| 133 | +### Key Files to Understand |
| 134 | + |
| 135 | +- `crates/nfs3_types/src/lib.rs`: Core NFS3 type definitions |
| 136 | +- `crates/nfs3_server/src/vfs/mod.rs`: Virtual file system traits |
| 137 | +- `crates/nfs3_client/src/lib.rs`: Client API |
| 138 | +- `crates/nfs3_tests/src/`: Integration test suites |
0 commit comments