|
2 | 2 |
|
3 | 3 | > **Important:** Prefer the `mise` tasks for installs, builds, tests, and formatting. Only use raw toolchain commands when no `mise` wrapper exists, and call that out explicitly. |
4 | 4 | > |
5 | | -> **CRITICAL: Prefer the Rust LSP for Rust code navigation.** The Rust LSP is the primary tool for Rust files because it is accurate, fast, and type-aware. That said, other tools (rg/find/manual browsing) are still acceptable when they are faster for the task, the LSP is unavailable, or you're working outside Rust code. See the "Code Navigation (Use Rust LSP!)" section for detailed commands. |
6 | | -> |
7 | | -> **CRITICAL: Do NOT run git mutations without explicit approval from the user** Do NOT ever run git checkout/revert/restore/reset without EXPLICIT APPROVAL from the USER |
8 | | -> |
9 | 5 | > **CRITICAL: DO NOT ASK KNOWABLE QUESTIONS** Do not ask the user for information that you can look up. |
10 | 6 |
|
11 | 7 |
|
12 | 8 | ## Build, Test, and Development Commands |
13 | 9 | Always default to the `mise` tasks below; only run direct toolchain commands if no `mise` wrapper exists and note the deviation. |
14 | 10 |
|
15 | | -**For Rust code navigation and understanding, use the Rust LSP first.** For non-Rust code or quick searches, it is fine to use rg/find/manual browsing when it is more appropriate. |
16 | | - |
17 | 11 | - `mise install`: Install pinned Rust, Bun, Wrangler, etc. |
18 | 12 | - `mise build:debug`: Build Rust |
19 | 13 | - `mise test`: All tests (Rust nextest + Workers via bun test). |
20 | 14 |
|
21 | | -## Code Navigation (Use Rust LSP!) |
22 | | - |
23 | | -**IMPORTANT: Prefer the Rust LSP for Rust code navigation.** The Rust LSP should be your primary tool for: |
24 | | -- Finding symbols and definitions |
25 | | -- Navigating to references |
26 | | -- Getting function signatures and documentation |
27 | | -- Understanding code structure |
28 | | -- Finding implementations and usages |
29 | | - |
30 | | -**Prefer Rust LSP over:** grep/find/rg, manual file browsing, or any other navigation method **for Rust files**. Use other tools when they are faster for the task, the LSP is unavailable, or the code is not Rust. |
31 | | - |
32 | | -### Rust LSP Commands Available |
33 | | - |
34 | | -Use these `mcp__rust-lsp__*` tools for navigation: |
35 | | - |
36 | | -```bash |
37 | | -# Get file structure and symbols |
38 | | -mcp__rust-lsp__outline <file_path> |
39 | | - |
40 | | -# Search for symbols across the codebase |
41 | | -mcp__rust-lsp__search <query> |
42 | | - |
43 | | -# Find all references to a symbol |
44 | | -mcp__rust-lsp__references <file_path> <line> <character> |
45 | | - |
46 | | -# Get detailed info about a symbol at cursor position |
47 | | -mcp__rust-lsp__inspect <file_path> <line> <character> |
48 | | - |
49 | | -# Get code completions at a position |
50 | | -mcp__rust-lsp__completion <file_path> <line> <character> |
51 | | - |
52 | | -# Rename a symbol across the codebase |
53 | | -mcp__rust-lsp__rename <file_path> <line> <character> <new_name> |
54 | | - |
55 | | -# Get diagnostics (errors/warnings) for a file |
56 | | -mcp__rust-lsp__diagnostics <file_path> |
57 | | -``` |
58 | | - |
59 | | -### Navigation Examples |
60 | | - |
61 | | -```bash |
62 | | -# Find all search-related services |
63 | | -mcp__rust-lsp__search "SearchService" |
64 | | - |
65 | | -# Explore the main application structure |
66 | | -mcp__rust-lsp__outline "crates/slipstreamd/src/lib.rs" |
67 | | - |
68 | | -# Find all references to AppState |
69 | | -mcp__rust-lsp__references "crates/slipstreamd/src/app.rs" 16 1 |
70 | | - |
71 | | -# Inspect a function to get its documentation |
72 | | -mcp__rust-lsp__inspect "crates/embedding/src/lib.rs" 127 1 |
73 | | - |
74 | | -# Get completions for method calls |
75 | | -mcp__rust-lsp__completion "crates/slipstreamd/src/routes.rs" 42 20 |
76 | | -``` |
77 | | - |
78 | | -### Why Use Rust LSP? |
79 | | - |
80 | | -- **Accurate**: Understands Rust's type system and module resolution |
81 | | -- **Fast**: Instant navigation without scanning files |
82 | | -- **Context-aware**: Knows about imports, traits, generics |
83 | | -- **Complete**: Shows parameters, return types, documentation |
84 | | -- **IDE-quality**: Same experience as modern IDEs |
85 | | - |
86 | | -**Remember: For Rust code, reach for the Rust LSP first; for everything else, use the best tool for the job.** |
87 | | - |
88 | | - |
89 | | -> REMINDER: |
90 | | -> ALWAYS get approval from the user for git checkout/reset/restore/revert/... |
91 | | -> NEVER run destructive git commands without explicit approval |
92 | | -
|
93 | | - |
94 | 15 | ## Code Style & Formatting |
95 | 16 |
|
96 | 17 | - Refactor, don't keep adding to the technical debt |
|
0 commit comments