Skip to main content
Glama

알파(0.1.x) — 실제 프로젝트에서 작동하며 작성자가 매일 사용합니다. 다듬어지지 않은 부분이 있을 수 있습니다.

AI 어시스턴트는 한 번에 한 파일씩 코드를 수정합니다. 의존성을 보지 못하죠. grep하고, 읽고, 추측하다가 — 세 파일 떨어진 곳을 망가뜨립니다.

LensPR은 코드베이스의 의존성 그래프를 구축하고, AI가 무엇이든 변경하기 전에 구조적 이해를 제공합니다.

빠른 시작

필요 사항: Python 3.11+, macOS 또는 Linux. TypeScript/JS 프로젝트라면 **Node.js 18+**도 필요합니다.

pip install 'lenspr[all]'
lenspr init .
lenspr setup .

IDE를 재시작하세요. 끝입니다. 이제 AI에 lens_* 도구가 생깁니다.

.gitignore에 .lens/를 추가하세요 — 그래프는 로컬에 있으며 소스에서 다시 빌드됩니다.


Related MCP server: codemap

하는 일

"이 함수에 의존하는 것은 무엇인가?"

한 번의 호출로 소스 코드, 호출하는 곳, 호출하는 대상, 관련 테스트를 반환합니다:

> lens_context("auth.login_handler")

source: 42 lines
callers: auth_routes.create_routes, test_auth.test_login_success
callees: db.get_user, crypto.verify_password, jwt.create_token
tests: test_login_success, test_login_wrong_password

LensPR이 없으면 AI는 grep/read 호출을 5~7번 하고도 놓치는 부분이 있습니다. LensPR이 있으면 — 한 번의 호출로 전체 그림을 볼 수 있습니다.

"이것을 변경하면 무엇이 깨질까?"

수정 전에 AI는 영향 범위(blast radius)를 확인합니다:

> lens_check_impact("models.User")

severity: CRITICAL
direct_dependents: 15
indirect_dependents: 23
affected_modules: auth, payments, notifications
tests_covering: 3

AI가 경고하고, 접근 방식을 바꾸거나, 확인을 요청합니다. 더 이상 무작정 수정하지 않습니다.

"이 코드베이스는 얼마나 건강한가?"

> lens_vibecheck()

score: 86/100 (B)
  test_coverage:    17/25 — 67% functions tested
  dead_code:        20/20 — 0% dead code
  circular_imports: 15/15 — 0 cycles
  architecture:     12/15 — 1 violation
  documentation:     8/10 — 81% documented
  graph_confidence: 14/15 — 94% edges resolved

시간이 지남에 따라 코드베이스가 개선되고 있는지, 악화되고 있는지 추적합니다.

언어 간 가시성

LensPR은 프론트엔드와 백엔드를 하나의 그래프로 연결합니다:

LoginModal.tsx → fetch("/api/auth/login")
                        ↓ CALLS_API
Backend:  @router.post("/login") → login_handler()
            → db.query(User)        [reads: users]
            → verify_password()
            → create_jwt_token()

또한 데이터베이스 테이블, Docker 서비스, 환경 변수, CI/CD 워크플로우, SQL 마이그레이션도 추적합니다.


호환 환경

IDE

설정

Claude Code

lenspr setup . — 자동

Cursor

.mcp.json을 .cursor/mcp.json으로 복사

모든 MCP 클라이언트

lenspr serve <path>

지원 언어: Python (Jedi/Pyright로 95% 이상 해석) 및 TypeScript/JavaScript (tree-sitter + TS 컴파일러 API로 85-95% 해석).

인프라: .sql 파일, Dockerfile, docker-compose.yml, GitHub Actions 워크플로우, .env 파일 — 모두 동일한 그래프로 파싱됩니다.

모든 것이 로컬에서 실행됩니다. 코드가 머신을 벗어나지 않습니다.


주요 기능

영향 분석

변경 전에 심각도(LOW → CRITICAL) 표시

원콜 컨텍스트

한 번의 요청으로 소스 + 호출자 + 피호출자 + 테스트

크로스랭귀지

프론트엔드 HTTP → 백엔드 라우트, DB 테이블, Docker, 환경 변수, CI/CD

정밀 수정

함수 내부의 정밀한 찾기/바꾸기 — 전체 파일 재작성 없음

데드 코드

도달할 수 없는 함수 찾기 (Django, FastAPI, Celery 엔트리 포인트)

아키텍처 규칙

레이어 경계 강제 — 변경 적용 전에 위반 사항 경고

함수 단위 Git

함수 수준의 Blame, 이력, 커밋 범위

세션 메모리

컨텍스트 재설정 후에도 AI가 중단된 지점부터 이어서 작업

자동 동기화

파일 감시자가 저장할 때마다 그래프 업데이트

헬스 스코어

6개 차원에 걸친 0-100 점수 — 시간에 따른 품질 추적

60개 이상의 도구가 12개 그룹으로 구성되어 있습니다 — lenspr tools로 필요한 것만 활성화하세요.

탐색 및 검색 (8): lens_context, lens_get_node, lens_search, lens_grep, lens_find_usages, lens_get_structure, lens_list_nodes, lens_get_connections

수정 (6): lens_update_node, lens_patch_node, lens_add_node, lens_delete_node, lens_rename, lens_batch

분석 (6): lens_check_impact, lens_validate_change, lens_health, lens_dead_code, lens_dependencies, lens_diff

품질 (7): lens_vibecheck, lens_nfr_check, lens_test_coverage, lens_security_scan, lens_dep_audit, lens_fix_plan, lens_generate_test_skeleton

아키텍처 (9): lens_arch_rule_add, lens_arch_rule_list, lens_arch_rule_delete, lens_arch_check, lens_class_metrics, lens_project_metrics, lens_largest_classes, lens_compare_classes, lens_components

Git (4): lens_blame, lens_node_history, lens_commit_scope, lens_recent_changes

인프라 (5): lens_api_map, lens_db_map, lens_env_map, lens_ffi_map, lens_infra_map

테스트 및 추적 (3): lens_run_tests, lens_trace, lens_trace_stats

주석 (5): lens_annotate, lens_save_annotation, lens_batch_save_annotations, lens_annotate_batch, lens_annotation_stats

세션 (4): lens_session_write, lens_session_read, lens_session_handoff, lens_resume

시간 관련 (2): lens_hotspots, lens_node_timeline

설명 (1): lens_explain


알려진 제한 사항

  • Windows — 지원되지 않습니다. macOS 및 Linux만 지원합니다.

  • self.method() 호출 — 정적 파서는 인스턴스 메서드 디스패치를 완전히 해석할 수 없습니다. 해결 방법: lens_trace(Python 3.12+)가 런타임에 이를 해석합니다.

  • Go, Rust, Java — 아직 지원되지 않습니다. 파서 인터페이스는 기여자를 위해 준비되어 있습니다.

  • 동적 코드 — getattr, eval, 동적 임포트는 정적으로 추적할 수 없습니다.


기여하기

사용해 보세요. 문제가 생기면 알려주세요.

  • 버그 리포트 — "작동하지 않는다"는 말도 도움이 됩니다

  • 언어 파서 — Go, Rust, Java (BaseParser 인터페이스 준비 완료)

  • 아이디어 — 이슈 열기

라이선스

MIT


AI가 계속 내 코드를 망가뜨려서 만들었습니다.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    MCP server for AI coding agents that builds a complete code structure graph and semantic vector index, enabling fast querying of code entities, relationships, and impact analysis.
    20 npm
    11
    -
  • A
    license
    Not graded
    quality
    B
    maintenance
    MCP server for local-first code intelligence, providing structural code graph, semantic search, and impact analysis to AI agents.
    2
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    A persistent code-intelligence MCP server that builds a queryable knowledge graph of your codebase, enabling AI assistants to perform cross-file structural reasoning, dependency analysis, and blast radius detection.
    9
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    MCP server that provides coding agents with structured repository context, including graph-based navigation, dependency analysis, runtime flow tracing, and configuration surface across supported stacks.
    77 npm
    MIT