How cree1116/lancet works
Lancet is a Rust CLI and MCP server for searching, reading, understanding, and safely changing code and documents through shared indexing and line coordinates. The main workflow dispatches a command, plans candidate files, searches or inspects extracted content, then optionally applies revision-checked edits. The graph preserves documented command branches and core runtime layers. Some command implementations were not excerpted; those links rely on README statements or the CLI dispatch excerpt, not inspection of unsampled source.
Main entry points: cli/mod.rs CLI Dispatch · rg.rs Text Search · index/mod.rs Trigram Index · change.rs Change Planning
Components 32
Interfaces
- CLI Dispatch
src/cli/mod.rs - MCP Server
src/mcp.rs - fd Command
src/cli/fd.rs - rg Command
src/cli/rg.rs - read Command
src/cli/read.rs - edit and write
src/cli/edit.rs - index Command
src/cli/index.rs - Other Commands
src/cli
Discovery and Index
- File Traversal
src/walk.rs - Candidate Planning
src/scope.rs - Trigram Index
src/index/mod.rs - Index Segments
src/index/segment.rs - Index Queries
src/index/req.rs
Search and Inspection
- Text Search
src/rg.rs - File Search
src/fd.rs - AST Search and Rewrite
src/ast_grep.rs - Range and Symbol Read
src/read_cmd.rs - Outline
src/outline.rs - References
src/refs.rs - Scoped Rename
src/rename.rs - Syntax Structure
src/code.rs - Scope Resolution
src/scopes.rs
Safe Changes
- Edit Operations
src/edit_cmd.rs - Multi-file Patch
src/patch.rs - Change Planning
src/change.rs - Revision-checked Writes
src/edit.rs
Shared Runtime
- Content Loading
src/content.rs - Document Adapters
src/adapters.rs - Index Folding
src/fold.rs - Query Filters
src/query - Status and Output
src/output.rs
Other components
- User or Agent
Connections 41
- User or Agent → CLI Dispatch: invokes
- User or Agent → MCP Server: connects
- CLI Dispatch → fd Command: dispatches
src/cli/mod.rs - CLI Dispatch → rg Command: dispatches
src/cli/mod.rs - CLI Dispatch → read Command: dispatches
src/cli/mod.rs - CLI Dispatch → edit and write: dispatches
src/cli/mod.rs - CLI Dispatch → index Command: dispatches
src/cli/mod.rs - CLI Dispatch → Other Commands: dispatches
src/cli/mod.rs - fd Command → File Search: calls
src/cli/fd.rs - rg Command → Text Search: calls
src/cli/rg.rs - read Command → Range and Symbol Read: calls
- edit and write → Edit Operations: calls
src/cli/edit.rs - index Command → Trigram Index: calls
src/cli/index.rs - File Search → Candidate Planning: plans files
src/fd.rs - Text Search → Candidate Planning: plans files
src/rg.rs - Candidate Planning → File Traversal: walks fresh files
src/scope.rs - Candidate Planning → Trigram Index: checks candidates
src/scope.rs - Trigram Index → Index Segments: opens segments
src/index/mod.rs - Trigram Index → Index Queries: uses queries
src/index/mod.rs - File Search → Query Filters: filters paths
src/fd.rs - Text Search → Query Filters: filters matches
src/rg.rs - Text Search → Content Loading: searches content
src/rg.rs - Range and Symbol Read → Content Loading: loads content
src/read_cmd.rs - Content Loading → Document Adapters: extracts documents
src/content.rs - Range and Symbol Read → Syntax Structure: reads symbols
src/read_cmd.rs - Outline → Syntax Structure: extracts structure
src/outline.rs - References → Syntax Structure: finds symbols
src/refs.rs - Scoped Rename → Scope Resolution: resolves bindings
src/rename.rs - References → Scope Resolution: resolves bindings
src/scopes.rs - AST Search and Rewrite → Syntax Structure: parses syntax
src/ast_grep.rs - AST Search and Rewrite → Change Planning: plans rewrites
src/ast_grep.rs - Edit Operations → Change Planning: plans edits
src/edit_cmd.rs - Multi-file Patch → Change Planning: plans patches
src/patch.rs - Change Planning → Revision-checked Writes: writes changes
src/change.rs - Scoped Rename → Revision-checked Writes: writes rename
src/rename.rs - Edit Operations → Range and Symbol Read: checks current content
src/edit_cmd.rs - Trigram Index → File Traversal: indexes files
src/index/mod.rs - Index Queries → Index Folding: folds index data
src/index/req.rs - Text Search → Status and Output: formats results
src/rg.rs - Change Planning → Status and Output: reports changes
src/change.rs - AST Search and Rewrite → Status and Output: formats results
src/ast_grep.rs