lancet 문서
시작하기

Lancet 공식 문서 — 설치 · 빠른 시작 · 치트시트

탐색, 트라이그램 인덱스 검색, 24개 언어 AST 치환, 정밀 읽기, CAS 편집을 하나의 Rust 바이너리로 통합합니다.

Lancet은 rg + fd + ast-grep + cat + sed + patch + pdftotext를 이어 쓰던 작업을 의존성 없는 단일 Rust 바이너리로 통합합니다. 모든 명령이 같은 .lancet 트라이그램 인덱스, 파일 필터 규칙, 1부터 시작하는 줄 번호, XXH3-64 rev 해시를 공유합니다.

한 줄로 요약한 설계 원칙

트라이그램 인덱스는 열지 않을 파일만 걸러냅니다. 후보 파일과 수정된 파일은 풀스캔과 완전히 동일한 평가기로 검증되며, 모든 쓰기는 배타적 잠금 기반 compare-and-swap으로 처리됩니다.

설치 및 빌드 변형#

릴리스마다 macOS(Apple Silicon·Intel), Linux(x86_64/arm64 glibc 및 정적 musl), Windows용 사전 빌드 바이너리를 제공합니다.

macOS / Linux (Homebrew)
brew tap CREE1116/lancet https://github.com/CREE1116/lancet
brew install CREE1116/lancet/lancet
macOS / Linux (프리빌트 설치 스크립트)
curl -fsSL https://raw.githubusercontent.com/CREE1116/lancet/main/install.sh | sh
Windows (PowerShell)
irm https://raw.githubusercontent.com/CREE1116/lancet/main/install.ps1 | iex
Cargo (전체 빌드 vs 코드 전용 경량 빌드)
# cargo-binstall로 바이너리 바로 받기
cargo binstall --git https://github.com/CREE1116/lancet lancet

# 전체 기능 소스 빌드 (~40 MB: Tree-sitter 24개 문법 + PDF/오피스/HWP/압축 어댑터)
cargo install --git https://github.com/CREE1116/lancet lancet

# 경량 빌드 (~4 MB: 문서/압축 어댑터 제외, 순수 코드·텍스트 전용)
cargo install --git https://github.com/CREE1116/lancet lancet --no-default-features

60초 전체 흐름 따라하기#

.lancet 인덱스는 선택 사항입니다. 인덱스가 없어도 모든 명령이 동작하며, 기본 auto 모드는 매 쿼리마다 디스크 메타데이터를 확인해 수정된 파일을 놓치지 않습니다.

터미널
# 1. 선택: 로컬 트라이그램 인덱스 한 번 빌드
lancet index .

# 2. 폴더 구조 파악 후 참조 수 순위로 핵심 심볼 찾기
lancet fd --tree --dirs -d 2 .
lancet refs --rank '*Service' --kind class src --limit 8

# 3. ripgrep 플래그 또는 LQL 논리·근접 쿼리로 검색
lancet rg -w execute_one src
lancet 'near("gradient", "clip", 30) in function | expand parent'

# 4. 필요한 심볼이나 줄 범위만 읽고 XXH3-64 `rev` 확보
lancet read src/search.rs --symbol execute_one --json

# 5. dry-run diff 확인 후 --rev, --apply로 원자적 반영
lancet edit src/search.rs --find 'let limit = 20;' \
  --with 'let limit = 50;' --rev <REV> --apply

한 화면 명령어 치트시트#

작업 단계명령어보장 / 특징
폴더 레이아웃lancet fd --tree --dirs -d 2 ..gitignore / .ignore 반영
최근/확장자 필터lancet fd -t f -e rs --changed-within 7d단위: s, m, h, d, w
rg 그대로 쓰기lancet rg -w -t rs 'pat' srcrg와 바이트 동일 + --docs
논리·유사 LQLlancet '("a" OR "b") NOT "c" in function'Scan == Auto
다중 쿼리 배치lancet batch src -q 'Q1' -q 'Q2'인덱스·워크 1회 공유
뼈대 추출lancet outline src/main.rs함수·마크다운 제목·시트·압축 목록
토큰 예산 읽기lancet read f.rs --lines 10:50 --budget-tokens 800rev + next_line 커서 반환
심볼 읽기lancet read f.rs --symbol my_fn문서 주석·어트리뷰트 포함
문서·압축파일lancet read r.pdf -p 2:3 · a.zip!app.log검색과 1:1 동일 줄 번호; 읽기 전용
참조 순위lancet refs --rank '*Service' --kind class src어휘 AST 참조 수 내림차순
AST 검색·치환lancet ast '$X.unwrap()' src -l rs -r '$X?'24개 언어; --apply 전엔 dry-run
원자적 다중 편집lancet edit f.rs --edits - --rev REV --apply원본 줄 번호 유지, 겹침 검증 CAS
Unified Diffgit diff | lancet patch --apply전체 파일 사전 검증 + 경합 롤백
로컬 이름 변경lancet rename f.rs:42 old new --rev REV --apply6개 언어; 스코프 재해석 증명
MCP 서버lancet mcp --root .CLI 인자를 받는 lancet 도구 하나, stdio JSON-RPC, --read-only
인덱스 진단lancet explain 'pat' · lancet status필요 트라이그램·후보 비율 출력

어디부터 볼까요?#

MIT OR Apache-2.0 · Rust 단일 바이너리 GitHub에서 Markdown 소스 보기 →