@fodx/codelens 2.2.0 → 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +18 -11
  2. package/build/src/cli.js +11 -3
  3. package/build/src/cli.js.map +1 -1
  4. package/build/src/db/queries.js +40 -0
  5. package/build/src/db/queries.js.map +1 -0
  6. package/build/src/graph/edges.js +2 -2
  7. package/build/src/graph/edges.js.map +1 -1
  8. package/build/src/graph/grammars.js +8 -0
  9. package/build/src/graph/grammars.js.map +1 -1
  10. package/build/src/graph/symbols.js +1 -1
  11. package/build/src/graph/symbols.js.map +1 -1
  12. package/build/src/index/autoindex.js +95 -0
  13. package/build/src/index/autoindex.js.map +1 -0
  14. package/build/src/index/fts.js +14 -23
  15. package/build/src/index/fts.js.map +1 -1
  16. package/build/src/index/manager.js +12 -0
  17. package/build/src/index/manager.js.map +1 -1
  18. package/build/src/index/queue.js +1 -1
  19. package/build/src/index/queue.js.map +1 -1
  20. package/build/src/index/staleness.js +17 -0
  21. package/build/src/index/staleness.js.map +1 -1
  22. package/build/src/index/ttl.js +8 -12
  23. package/build/src/index/ttl.js.map +1 -1
  24. package/build/src/installer/agents.js +34 -24
  25. package/build/src/installer/agents.js.map +1 -1
  26. package/build/src/server.js +47 -29
  27. package/build/src/server.js.map +1 -1
  28. package/build/src/tools/current.js +15 -5
  29. package/build/src/tools/current.js.map +1 -1
  30. package/build/src/tools/expand.js +2 -7
  31. package/build/src/tools/expand.js.map +1 -1
  32. package/build/src/tools/explore.js +5 -10
  33. package/build/src/tools/explore.js.map +1 -1
  34. package/build/src/tools/impact.js +9 -19
  35. package/build/src/tools/impact.js.map +1 -1
  36. package/build/src/tools/map.js +5 -11
  37. package/build/src/tools/map.js.map +1 -1
  38. package/build/src/tools/refresh.js +17 -0
  39. package/build/src/tools/refresh.js.map +1 -1
  40. package/build/src/tools/registry.js +26 -6
  41. package/build/src/tools/registry.js.map +1 -1
  42. package/build/src/tools/related.js +8 -20
  43. package/build/src/tools/related.js.map +1 -1
  44. package/build/src/tools/search.js +6 -10
  45. package/build/src/tools/search.js.map +1 -1
  46. package/build/src/util/id.js +15 -0
  47. package/build/src/util/id.js.map +1 -0
  48. package/docs/agent-guide.md +1 -1
  49. package/docs/routing.md +13 -7
  50. package/docs/tools.md +4 -4
  51. package/package.json +1 -1
package/docs/routing.md CHANGED
@@ -9,8 +9,10 @@ Prefer the codelens tools for code **discovery** — they keep the context windo
9
9
  lean and are branch-scoped. They are guidance, not an absolute mandate: use the
10
10
  right tool for the job.
11
11
 
12
- 0. Call `cl_current` to confirm the index is ready; if `status` is `missing`,
13
- call `cl_refresh` to build it.
12
+ 0. Call `cl_current` to confirm the index state. Installed MCP configs auto-index
13
+ missing branch indexes in the background; if `status` is `indexing`, wait or
14
+ retry shortly and use `indexingStartedAt`/`indexingAgeMs` to decide whether it
15
+ looks stuck. If `status` remains `missing`, call `cl_refresh` explicitly.
14
16
 
15
17
  Prefer codelens when:
16
18
  - you don't know the exact name/string (semantic or conceptual search via `cl_search`)
@@ -47,9 +49,10 @@ you're looking for.
47
49
 
48
50
  Results are scoped to the **current branch/worktree index only** by default.
49
51
  After `git checkout`, results will not leak from the old branch. If you switch
50
- branches mid-task, call `cl_current` again; the tool activates/creates the new
51
- branch's index automatically. MCP clients that provide Roots let CodeLens attach
52
- to the active workspace even from a global MCP config; otherwise use `--cwd` or
52
+ branches mid-task, call `cl_current` again; installed MCP configs auto-index the
53
+ new branch in the background when its index is missing. MCP clients that provide
54
+ Roots let CodeLens attach to the active workspace even from a global MCP config;
55
+ Cursor uses `--cwd ${workspaceFolder}`, and other clients can use `--cwd` or
53
56
  project-local MCP config.
54
57
 
55
58
  ## Freshness
@@ -57,8 +60,11 @@ project-local MCP config.
57
60
  Query tools auto-refresh changed files before returning (budget-bounded). If
58
61
  the response carries `freshness: "partial"`, `pendingFiles > 0`, or per-result
59
62
  `stale:true`, some recent edits were not reindexed within the budget. Read those
60
- files directly with `cl_expand`/raw read, then call `cl_refresh` or re-query when
61
- you need indexed relationships to catch up.
63
+ files directly with `cl_expand`/raw read. Call `cl_refresh` when you need indexed
64
+ relationships to catch up, after large branch/file changes, when `cl_current`
65
+ remains `missing`, or when the user explicitly asks for a rebuild. If `cl_refresh`
66
+ returns `status:"indexing"`, a background auto-index is already running; wait or
67
+ retry instead of launching more indexing work.
62
68
 
63
69
  ## Tool quick reference
64
70
 
package/docs/tools.md CHANGED
@@ -5,13 +5,13 @@ JSON-serialized text content.
5
5
 
6
6
  ## cl_current
7
7
  - **Input**: none
8
- - **Returns**: `{ repo, branch, headSha, indexId, status, dirtyFiles, lastIndexedAt, inGitRepo }`
9
- - **Use**: first call to check index readiness.
8
+ - **Returns**: `{ repo, branch, headSha, indexId, status, dirtyFiles, lastIndexedAt, indexingStartedAt, indexingAgeMs, inGitRepo }`
9
+ - **Use**: first call to check index readiness. `status` is `active`, `missing`, `stale`, or `indexing` (background auto-index in progress). When `indexing`, use `indexingStartedAt`/`indexingAgeMs` to decide whether to wait, retry, or investigate a stuck index.
10
10
 
11
11
  ## cl_refresh
12
12
  - **Input**: none
13
- - **Returns**: `{ indexId, branch, indexedFiles, totalChunks, skipped, status }`
14
- - **Use**: build/update the current branch index.
13
+ - **Returns**: `{ indexId, branch, indexedFiles, totalChunks, skipped, status, indexingStartedAt?, indexingAgeMs? }`
14
+ - **Use**: build/update the current branch index. If background auto-index is already running, returns `status:"indexing"` instead of duplicating work.
15
15
 
16
16
  ## cl_search
17
17
  - **Input**: `{ query: string, limit?: number=5, cursor?: string, contentType?: "code"|"prose", related?: boolean, snippet?: "none"|"headline"|"compact"|"full" }`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fodx/codelens",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
4
4
  "description": "Local, branch-aware code search & relation graph. SQLite FTS5 + tree-sitter symbols + source-graph edges, exposed as an MCP server and CLI. No chat LLM required.",
5
5
  "license": "MIT",
6
6
  "type": "module",