[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-83102":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":18,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":21,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":15,"starSnapshotCount":15,"syncStatus":14,"lastSyncTime":28,"discoverSource":29},83102,"lexa","anvia-hq\u002Flexa","anvia-hq","Lexa - Fast local code intelligence for humans and AI agents. Lexa turns a codebase into a portable, queryable graph so every tool can work from the same stable view of the project.","",null,"Rust",106,4,2,0,3,28,29,64.9,"MIT License",false,"main",true,[],"2026-06-12 04:01:40","# Lexa\n\n[![License: MIT](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-blue.svg)](LICENSE)\n[![Rust](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Frust-2021-orange.svg)](Cargo.toml)\n[![MCP](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FMCP-ready-4b5563.svg)](#mcp)\n[![Status](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fstatus-ready%20to%20use-brightgreen.svg)](#development)\n\n![Lexa open source banner](docs\u002Fassets\u002Flexa-open-source.png)\n\nFast local code intelligence for humans and AI agents.\n\nLexa turns a codebase into a portable, queryable graph so every tool can work\nfrom the same stable view of the project.\n\nInstead of repeatedly scanning files ad hoc, Lexa indexes structure, text,\nsymbols, imports, content hashes, and recent edits into one local graph. That\nmethod gives agents compact context, traceable lookups, hash-aware reads, and\natomic line-based patches.\n\n```bash\nlexa index .\nlexa text-search \"handle_request\" --scope\nlexa outline src\u002Fmain.rs\nlexa audit\nlexa mcp .\n```\n\n| Project | Info |\n| --- | --- |\n| Interface | CLI and MCP server |\n| Index | `.lexa\u002Fgraph.lexa` by default |\n| Runtime | Native Rust binary |\n| License | MIT |\n\n## Why Lexa\n\nLexa is built around an index-first workflow:\n\n1. Build one local graph for the project.\n2. Query that graph for paths, symbols, text, outlines, imports, and context.\n3. Read and patch files with content hashes so edits can be checked against the\n   version that was inspected.\n\nThat makes Lexa useful as a shared context layer between a developer, a terminal\nworkflow, and an AI agent.\n\n## Install\n\nmacOS and Linux:\n\n```bash\ncurl -fsSL https:\u002F\u002Fraw.githubusercontent.com\u002Fanvia-hq\u002Flexa\u002Fmain\u002Finstall.sh | sh\n```\n\nWindows PowerShell:\n\n```powershell\nirm https:\u002F\u002Fraw.githubusercontent.com\u002Fanvia-hq\u002Flexa\u002Fmain\u002Finstall.ps1 | iex\n```\n\nInstall a specific version:\n\n```bash\ncurl -fsSL https:\u002F\u002Fraw.githubusercontent.com\u002Fanvia-hq\u002Flexa\u002Fmain\u002Finstall.sh | sh -s -- v0.5.1\n```\n\nFrom source:\n\n```bash\ncargo install --path .\n```\n\nUpgrade an installed release:\n\n```bash\nlexa upgrade\nlexa upgrade v0.5.1\nlexa upgrade --install-dir \"$HOME\u002F.local\u002Fbin\"\n```\n\n`upgrade` updates the Lexa binary in the directory containing the currently\nrunning `lexa`, unless `--install-dir` or `LEXA_INSTALL_DIR` is set. To refresh a\nproject's graph, run `lexa index .`.\n\nCheck the installed version:\n\n```bash\nlexa --version\n```\n\n`--version` prints the current binary version and, when possible, uses a short\ncached GitHub release check to report whether `lexa upgrade` is available. Set\n`LEXA_NO_UPDATE_CHECK=1` to disable this check.\n\nOr build without installing:\n\n```bash\ncargo build --release\n.\u002Ftarget\u002Frelease\u002Flexa --help\n```\n\nMake sure Cargo's bin directory is on your `PATH`:\n\n```bash\nexport PATH=\"$HOME\u002F.cargo\u002Fbin:$PATH\"\n```\n\n## Quick Start\n\n```bash\nlexa index \u002Fpath\u002Fto\u002Fproject\ncd \u002Fpath\u002Fto\u002Fproject\n\nlexa files\nlexa text-search \"handle_request\"\nlexa outline src\u002Fmain.rs\nlexa symbol-defs Engine\nlexa read src\u002Fmain.rs -L 1-80\n```\n\n`index` writes the graph to `.lexa\u002Fgraph.lexa` by default and shows a branded\nbanner in interactive terminals. Commands run from the project root will read\nthat graph automatically.\n\nUse a custom graph path:\n\n```bash\nlexa --graph \u002Ftmp\u002Fproject.graph.lexa index \u002Fpath\u002Fto\u002Fproject\nlexa --graph \u002Ftmp\u002Fproject.graph.lexa text-search \"Parser\"\n```\n\n## Commands\n\n| Command | Purpose |\n| --- | --- |\n| `index \u003Cpath>` | Index a project and write a graph |\n| `reindex [path]` | Rebuild the project graph |\n| `clear-index` | Remove the project graph |\n| `files [path]` | Show indexed files, optionally filtered |\n| `list [path]` | List directory children |\n| `glob \u003Cpattern>` | Match indexed paths |\n| `path-search \u003Cpattern>` | Fuzzy path search |\n| `text-search \u003Cquery>` | Search indexed text |\n| `outline \u003Cpath>` | Show imports and symbols |\n| `symbol-defs \u003Cname>` | Find exact symbol definitions |\n| `symbol-search \u003Cquery>` | Fuzzy symbol search |\n| `word-refs \u003Cword>` | Find exact word or identifier occurrences, including definitions |\n| `callers \u003Cname>` | Find non-definition call sites\u002Fusages |\n| `trace-deps \u003Cpath>` | Trace resolved project-file imports |\n| `brief \u003Ctask>` | Bundle context for an explicit code task |\n| `read \u003Cpath>` | Read a file or line range |\n| `patch \u003Cpath> \u003Cop>` | Apply a line-based edit |\n| `create \u003Cpath>` | Create a file safely |\n| `changes [since]` | Show session-local changes |\n| `recent` | Show recently modified files |\n| `status` | Show index status |\n| `audit` | Run a review-oriented architecture audit |\n| `upgrade [version]` | Upgrade the Lexa binary, not a project index |\n| `watch [path]` | Refresh graph on file changes |\n| `pipeline \u003Cpipeline>` | Chain query operations |\n| `mcp [path]` | Start MCP over stdio; returns text-only tool content by default |\n\nUseful search flags:\n\n```bash\nlexa text-search \"render\" --scope\nlexa text-search --regex \"render[A-Z]\\\\w+\"\nlexa text-search \"useEffect\" --path-glob \"**\u002F*.{ts,tsx}\"\nlexa text-search \"TODO\" --compact --paths-only\nlexa symbol-search createAgent\n```\n\nUseful file listing flags:\n\n```bash\nlexa files apps\u002Fdesktop --language typescript\nlexa files --path-glob \"**\u002F*.{ts,tsx}\" --max-lines 200\nlexa files packages --min-lines 100 --max-results 20\n```\n\n`files [path]` treats `path` as a project-relative prefix. Use `list [path]`\nwhen you want only immediate directory children.\n\n`word-refs` includes declarations and definitions. `callers` is narrower: it\nreturns non-definition call sites\u002Fusages and skips declaration-like occurrences\nsuch as type aliases. `trace-deps` reports resolved project files; external\npackages are not returned as dependency nodes, and unresolved local imports are\nreported separately for `depends_on`.\n\nUse `brief` as a context bundler with explicit symbols, path fragments, or\nscoped keywords. It is not a natural-language QA tool:\n\n```bash\nlexa brief createAgentRuntimeForRun\nlexa brief \"terminal session\" --path-prefix apps\u002Fdesktop\nlexa brief \"createProjectAgent packages\u002Fagents\" --path-prefix packages\u002Fagents --max 8\n```\n\nIf a brief query is vague, Lexa marks it low-confidence and suggests concrete\nnext steps such as `symbol-search`, `text-search`, or adding scope filters.\n\n`pipeline` supports `glob\u002Ffind`, `fuzzy\u002Fpath_search`, `search\u002Ftext_search`,\n`filter`, `outline`, `deps`, `read`, `sort`, `limit`, and `count`. The pipe\nstring form is intended for advanced CLI use. MCP clients should prefer the\n`steps` array form, where each array item is one pipeline step.\nFor MCP pipeline calls, put search terms inside the step itself:\n`{\"steps\":[\"search AgentRunRequest\",\"limit 3\"]}`. Alternatively, pass the full\npipe string as `pipeline`: `{\"pipeline\":\"search AgentRunRequest | limit 3\"}`.\n\nMCP omits duplicated `structuredContent` by default to reduce token use. Start with `lexa mcp . --structured-content` or `lexa mcp . --json` when a client needs JSON structured tool results.\n\nSafe edit example:\n\n```bash\nlexa read src\u002Fmain.rs --hash\nlexa patch src\u002Fmain.rs replace -L 12 --if-hash \u003Chash> --content '    println!(\"updated\");'\nlexa create src\u002Fnew_file.rs --content 'pub fn new_file() {}'\n```\n\nAudit a project for structural review risks:\n\n```bash\nlexa audit\nlexa --json audit\nlexa audit --max 50\nlexa audit --since main\nlexa audit --since main --strict\nlexa audit --config lexa.toml\nlexa audit --no-config\nlexa audit --include dead-code\n```\n\n`audit` is read-only. It flags import cycles, large files, large symbols, and\ndependency hotspots from the indexed graph. It is not a compiler, typechecker,\nlinter, test runner, or build verifier. A clean Lexa audit never means the\nproject compiles; run the repository's normal verification command before\nclaiming implementation work is complete. Use `--since` to scope findings to\nchanged files and their direct dependency context. Use `--strict` to return a\nnon-zero exit code when high-severity structural findings are present. Config is\noptional; Lexa discovers `lexa.toml` or `.lexa\u002Faudit.toml` unless `--config` or\n`--no-config` is used. Dead-code candidates are read-only and off by default;\nenable them with `--include dead-code` or config. Generated artifacts are\nignored by default across common languages and frameworks, including generated\ndirectories, protobuf\u002FgRPC outputs, Android\u002FQt\u002FDart\u002FC#\u002FOpenAPI\u002FGraphQL outputs,\nlockfiles, build output, dependency folders, and common tool-specific files like\n`worker-configuration.d.ts`, `routeTree.gen.ts`, and Drizzle metadata.\n\nFindings include an `actionability` classification and `next_steps` hints in\nJSON\u002FMCP output. `actionable` means the finding is a likely refactor target,\n`candidate` means verify before changing, `expected` means the dependency shape\nis normal for a shared primitive or composition root, and `risk_note` means edit\ncarefully but do not assume a refactor is required.\nHuman-readable audit output is grouped by actionability. When a lower-priority\nfinding appears on the same file as a stronger actionable finding, it is marked\nas `secondary` so agents keep it as context instead of treating it as another\nindependent action item.\nJSON and MCP output include both the compatibility-preserving flat `findings`\narray and grouped buckets under `groups`: `primary`, `secondary`, `actionable`,\n`candidates`, `risk_notes`, and `expected`. Agents should summarize from\n`groups` first and use `findings` only for full-detail traversal.\n\nFor MCP audit calls, `max_results` controls the number of returned findings.\n`max` is accepted as a compatibility alias, with `max_results` taking\nprecedence when both are present. `config` is a TOML file path, not a named\npreset; strict mode is a separate CLI flag.\n\nDead-code candidates are limited to source-code symbols by default. Lexa skips\nstyle sheets, data\u002Fconfig files, package manifests, common framework config\nfiles, tests, generated artifacts, and declaration files to avoid reporting\ntooling keys, CSS tokens, or framework mount selectors as unused code.\n\nMinimal audit config:\n\n```toml\n[audit]\nmax_findings = 100\n\n[audit.thresholds]\nlarge_file_warning = 800\nlarge_file_high = 1500\nlarge_symbol_warning = 120\nlarge_symbol_high = 250\nfan_in_warning = 15\nfan_in_high = 40\nfan_out_warning = 20\nfan_out_high = 50\n\n[audit.rules]\n\"architecture.cycle\" = \"high\"\n\"file.large\" = \"warning\"\n\"symbol.large\" = \"warning\"\n\"dependency.hotspot\" = \"warning\"\n\"dead_code.candidate\" = \"off\"\n\n[audit.ignore]\ngenerated = true\npaths = [\"target\u002F**\", \"vendor\u002F**\"]\nfindings = [\"dependency.hotspot:src\u002Fmain.rs\"]\n\n[audit.dead_code]\nignore_symbols = [\"main\", \"handler\", \"setup\"]\nentrypoint_globs = [\"src\u002Fmain.*\", \"src\u002Fbin\u002F**\", \"pages\u002F**\", \"app\u002F**\"]\n```\n\n## MCP\n\nExpose the same graph-backed tools to an MCP client:\n\n```bash\nlexa index \u002Fpath\u002Fto\u002Fproject\nlexa mcp \u002Fpath\u002Fto\u002Fproject\n```\n\nMCP refreshes the graph before startup and watches the project while running.\nExternal edit events are applied to the same in-memory graph before the next MCP\nrequest is handled, so tools see fresh content without restarting the server.\nRun `lexa index` first when you want MCP to start from a fully rebuilt graph\ninstead of relying on the cheaper startup freshness check.\nDisable both the startup refresh and runtime watcher when you want to trust the\nexisting graph exactly:\n\n```bash\nlexa mcp \u002Fpath\u002Fto\u002Fproject --no-refresh\n```\n\nTune the watcher debounce interval when needed:\n\n```bash\nlexa mcp \u002Fpath\u002Fto\u002Fproject --debounce 250\n```\n\nRun MCP without loading or saving a graph:\n\n```bash\nlexa --no-graph mcp \u002Fpath\u002Fto\u002Fproject\n```\n\nExample config:\n\n```json\n{\n  \"mcpServers\": {\n    \"lexa\": {\n      \"command\": \"\u002Fpath\u002Fto\u002Flexa\",\n      \"args\": [\"mcp\", \"\u002Fpath\u002Fto\u002Fproject\"]\n    }\n  }\n}\n```\n\n## Language Support\n\nTree-sitter parsers: Zig, Python, Rust, TypeScript, JavaScript, Go, C, C++,\nJava, Ruby, PHP.\n\nLightweight parsers: HCL, R, Markdown, JSON, TOML, YAML, Dart, Kotlin, Swift,\nSvelte, Vue, Astro, shell, CSS, SCSS, SQL, protobuf, Fortran, LLVM IR, MLIR,\nTableGen.\n\n## Development\n\n```bash\ncargo fmt -- --check\ncargo clippy --all-targets --all-features -- -D warnings\ncargo test\ncargo build --release\n```\n\n## Binary Releases\n\nGitHub Actions builds release artifacts for macOS Apple Silicon, macOS Intel,\nLinux x86_64, and Windows x86_64.\n\nTo publish a GitHub Release with all binaries:\n\n```bash\ngit tag v0.5.1\ngit push origin v0.5.1\n```\n\nRun the benchmark suite:\n\n```bash\ncargo bench --bench engine\n```\n\nFor a faster local smoke benchmark:\n\n```bash\ncargo bench --bench engine -- --warm-up-time 1 --measurement-time 2 --sample-size 10\n```\n\nSmoke benchmark baseline from June 3, 2026 on a generated Rust fixture corpus:\n\n| Benchmark | Corpus | Time |\n| --- | ---: | ---: |\n| `project_index\u002F100` | 100 files | ~5.7 ms |\n| `project_index\u002F500` | 500 files | ~30.8 ms |\n| `search\u002Fexact_word` | 1,000 files | ~57.6 us |\n| `search\u002Funique_token` | 1,000 files | ~192 us |\n| `search\u002Fregex` | 1,000 files | ~54.1 us |\n| `search\u002Frich_scoped` | 1,000 files | ~92.9 us |\n| `search\u002Fsymbol_defs` | 1,000 files | ~91.5 ns |\n| `search\u002Fcallers` | 1,000 files | ~97.9 us |\n| `incremental_edit\u002Fsingle_file_reindex` | 500 files | ~1.1 ms |\n| `snapshot\u002Fwrite` | 500 files | ~6.4 ms |\n| `snapshot\u002Fload_into_engine` | 500 files | ~7.6 ms |\n\nTreat these numbers as a local regression baseline. Hardware, filesystem, and full\nCriterion settings will shift absolute timings.\n\nLexa is ready to use. Graph format and output details may still evolve as the project grows.\n","Lexa 是一个用于快速本地代码智能分析的工具，适用于人类开发者和AI代理。它将代码库转换为可移植、可查询的图结构，确保所有工具都能基于同一稳定视角进行工作。核心功能包括索引代码结构、文本、符号、导入、内容哈希以及最近编辑等信息，形成一个本地图数据库，支持高效查询和原子级修改。适合需要增强代码理解能力、提高开发效率或与AI辅助工具集成的场景。采用Rust语言编写，保证了高性能运行。","2026-06-11 04:10:06","CREATED_QUERY"]