Skip to content

Commit b749290

Browse files
CSCSoftwareclaude
andcommitted
feat: Add global search across all indexed projects (v1.11.0)
5 new tools: global_init, global_status, global_query, global_signatures, global_refresh. Uses SQLite ATTACH DATABASE for zero-copy cross-project queries with 5-min session cache. Bulk indexing with browser-based SSE progress UI (port 3334). Extended excludes for embedded Python runtimes, fdk-aac, and other external code. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 153acba commit b749290

19 files changed

Lines changed: 2700 additions & 15 deletions

.claude/CLAUDE.md

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
MCP Server für persistentes Code-Indexing. Ermöglicht Claude Code schnelle, präzise Suchen statt Grep/Glob.
44

5-
**Version:** 1.9.0 | **Sprachen:** 11 | **Repo:** https://github.com/CSCSoftware/AiDex
5+
**Version:** 1.11.0 | **Sprachen:** 11 | **Repo:** https://github.com/CSCSoftware/AiDex
66

77
## Build & Run
88

@@ -36,7 +36,7 @@ Registriert als MCP Server `aidex` (Prefix: `mcp__aidex__aidex_*`).
3636
**Nach Änderungen:** Build ausführen, dann Claude Code neu starten.
3737
**MCP-Name:** Server muss als `"aidex"` registriert sein → Prefix wird `mcp__aidex__aidex_*`.
3838

39-
## Tools (22)
39+
## Tools (27)
4040

4141
### Suche & Index
4242
| Tool | Beschreibung |
@@ -88,6 +88,15 @@ Status: `backlog → active → done | cancelled`
8888
| `aidex_screenshot` | Screenshot aufnehmen (fullscreen/active_window/window/region) |
8989
| `aidex_windows` | Offene Fenster auflisten (Helper für window-Modus) |
9090

91+
### Global Search (v1.11+)
92+
| Tool | Beschreibung |
93+
|------|--------------|
94+
| `aidex_global_init` | Verzeichnisbaum scannen, Projekte in `~/.aidex/global.db` registrieren. `index_unindexed`: Auto-Index ≤500 Dateien. `show_progress`: Browser Progress-UI |
95+
| `aidex_global_status` | Alle registrierten Projekte mit Stats anzeigen |
96+
| `aidex_global_query` | Terme über ALLE Projekte suchen (ATTACH DATABASE, 5-Min Cache) |
97+
| `aidex_global_signatures` | Methoden/Typen nach Name über alle Projekte suchen |
98+
| `aidex_global_refresh` | Stats aktualisieren, veraltete Projekte entfernen |
99+
91100
## Sprachen
92101

93102
C# · TypeScript · JavaScript · Rust · Python · C · C++ · Java · Go · PHP · Ruby
@@ -105,11 +114,20 @@ src/
105114
│ ├── summary.ts, link.ts, scan.ts, files.ts
106115
│ ├── session.ts, note.ts, task.ts
107116
│ ├── screenshot/ # Plattform-Screenshots
108-
│ └── viewer/server.ts
117+
│ └── global/ # Global Search (v1.11)
118+
│ ├── global-init.ts # Scan + Bulk-Index
119+
│ ├── global-query.ts # ATTACH DATABASE Queries
120+
│ ├── global-signatures.ts # Methoden/Typen suchen
121+
│ ├── global-status.ts # Projekt-Übersicht
122+
│ └── global-refresh.ts # Stats aktualisieren
123+
├── viewer/
124+
│ ├── server.ts # Interactive Viewer (Port 3333)
125+
│ └── progress.ts # SSE Progress UI (Port 3334)
109126
├── db/
110127
│ ├── database.ts # SQLite (WAL)
111128
│ ├── queries.ts # Prepared Statements
112-
│ └── schema.sql
129+
│ ├── schema.sql # Projekt-DB Schema
130+
│ └── global-database.ts # ~/.aidex/global.db
113131
└── parser/
114132
├── tree-sitter.ts # Parser (1MB Buffer)
115133
├── extractor.ts # Identifier + Signaturen
@@ -190,6 +208,21 @@ aidex_windows({ filter: "chrome" }) # Fenster finden
190208
- Optional: `filename` und `save_path` für andere Pfade
191209
- Rückgabe: Dateipfad → Claude kann sofort `Read` aufrufen
192210

211+
### Global Search (v1.11)
212+
```
213+
aidex_global_init({ path: "Q:/develop" }) # Nur registrieren
214+
aidex_global_init({ path: "Q:/develop", index_unindexed: true, show_progress: true }) # Alles indexieren + Progress-UI
215+
aidex_global_query({ term: "TransparentWindow", mode: "contains" }) # Über alle Projekte suchen
216+
aidex_global_signatures({ term: "Render", kind: "method" }) # Methoden über alle Projekte
217+
aidex_global_status({ sort: "recent" }) # Projektliste
218+
aidex_global_refresh() # Stats updaten
219+
```
220+
- `~/.aidex/global.db` referenziert alle Projekt-DBs
221+
- SQLite ATTACH DATABASE — kein Daten-Kopieren
222+
- Session-Cache (5-Min TTL) für schnelle wiederholte Queries
223+
- Bulk-Index: ≤500 Code-Dateien automatisch, >500 werden dem User gezeigt
224+
- Progress-UI: SSE-basiert auf Port 3334 mit Browser-Auto-Open
225+
193226
### Auto-Cleanup (v1.3.1)
194227
`aidex_init` entfernt automatisch Dateien die jetzt excluded sind (z.B. build/).
195228
Zeigt "Files removed: N" im Ergebnis.

CHANGELOG.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,58 @@
22

33
All notable changes to AiDex will be documented in this file.
44

5+
## [1.11.0] - 2026-03-07
6+
7+
### Added
8+
- **Global Search**: Search across ALL indexed projects at once — 5 new tools
9+
- `aidex_global_init` — Scan directory tree, register indexed projects in `~/.aidex/global.db`, detect unindexed projects by project markers (`.csproj`, `package.json`, `Cargo.toml`, etc.)
10+
- `aidex_global_status` — List all registered projects with stats, sortable by name/size/recent
11+
- `aidex_global_query` — Cross-project term search (exact/contains/starts_with) with in-memory session caching (5-min TTL)
12+
- `aidex_global_signatures` — Search methods/types by name across all projects, filterable by kind
13+
- `aidex_global_refresh` — Update stats and remove stale projects
14+
- Uses SQLite `ATTACH DATABASE` for zero-copy queries — each project DB remains the single source of truth
15+
- `exclude` parameter on `global_init` to skip external repos (e.g., `["llama.cpp"]`)
16+
- Auto-updates global registry after `aidex_init` / `aidex_update`
17+
- **Bulk Indexing**: `global_init` can auto-index all unindexed projects in one call
18+
- `index_unindexed: true` — Auto-index projects with ≤500 code files
19+
- Large projects (>500 files) are listed separately for user decision
20+
- File count estimation uses code-only extensions (matches what `init()` actually processes)
21+
- **Progress UI**: Browser-based progress display for bulk indexing
22+
- `show_progress: true` — Opens `http://localhost:3334` with live progress bar
23+
- Server-Sent Events (SSE) for real-time updates
24+
- Shows per-project status (indexing/done/error), progress bar, scrolling log
25+
- Dark theme, auto-closes after completion
26+
- **Extended excludes**: Better handling of embedded runtimes and external code
27+
- `init.ts`: Added `**/site-packages/**`, `**/Lib/**`, `**/fdk-aac/**` to DEFAULT_EXCLUDE
28+
- `global-init.ts`: Added Python venvs, embedded Python runtimes (Python310-313), `.cargo`, `packages`, `fdk-aac` to DEFAULT_EXCLUDED_DIRS
29+
30+
## [1.10.1] - 2026-03-07
31+
32+
### Fixed
33+
- **npm package**: Exclude token files and `futureWork.md` from published package
34+
- **gitignore negation patterns**: Filter out `!` negation patterns in `.gitignore` to prevent excluding all files
35+
- Negation patterns (e.g., `!.vscode/settings.json`) were passed to minimatch, which interpreted `!` as "NOT this pattern" — matching ALL files
36+
- This caused the entire index to be purged after initialization in projects with negation patterns (common in monorepos)
37+
38+
## [1.10.0] - 2026-02-17
39+
40+
### Added
41+
- **Note History**: Archived notes are now searchable across sessions
42+
- Old notes are automatically archived when overwritten or cleared
43+
- `history: true` parameter to browse archived notes (newest first)
44+
- `search: "term"` parameter to search note history (case-insensitive)
45+
- `limit` parameter to control how many history entries are returned (default: 20)
46+
47+
## [1.9.1] - 2026-02-10
48+
49+
### Added
50+
- **Rect Screenshot Mode**: New `mode: "rect"` for coordinate-based screen capture
51+
- Specify exact `x`, `y`, `width`, `height` in pixels
52+
- Useful with accessibility bounds (e.g., from WinfoMCP `get_element_details`)
53+
54+
### Fixed
55+
- **Region screenshot flicker on Windows**: Fixed visual flicker during interactive region selection
56+
557
## [1.9.0] - 2026-02-06
658

759
### Added

MCP-API-REFERENCE.md

Lines changed: 146 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ Complete reference for all AiDex MCP tools.
3232
- [Task Management](#task-management)
3333
- [aidex_task](#aidex_task)
3434
- [aidex_tasks](#aidex_tasks)
35+
- [Global Search](#global-search)
36+
- [aidex_global_init](#aidex_global_init)
37+
- [aidex_global_status](#aidex_global_status)
38+
- [aidex_global_query](#aidex_global_query)
39+
- [aidex_global_signatures](#aidex_global_signatures)
40+
- [aidex_global_refresh](#aidex_global_refresh)
3541
- [Screenshots](#screenshots)
3642
- [aidex_screenshot](#aidex_screenshot)
3743
- [aidex_windows](#aidex_windows)
@@ -568,29 +574,43 @@ Read or write session notes. Persists in the database between sessions.
568574
| `note` | string | - | Note to save. If omitted, reads current note |
569575
| `append` | boolean | - | Append to existing note instead of replacing (default: false) |
570576
| `clear` | boolean | - | Clear the note (default: false) |
577+
| `history` | boolean | - | Show archived note history, newest first (default: false) |
578+
| `search` | string | - | Search term to find in note history (case-insensitive) |
579+
| `limit` | number | - | Max history/search entries to return (default: 20) |
571580

572581
**Operations:**
573582

574583
| Parameters | Action |
575584
|------------|--------|
576585
| `{ path }` | Read current note |
577-
| `{ path, note: "..." }` | Write/replace note |
586+
| `{ path, note: "..." }` | Write/replace note (old note is archived) |
578587
| `{ path, note: "...", append: true }` | Append to note |
579-
| `{ path, clear: true }` | Delete note |
588+
| `{ path, clear: true }` | Delete note (old note is archived) |
589+
| `{ path, history: true }` | Browse archived notes |
590+
| `{ path, search: "term" }` | Search note history |
580591

581592
**Examples:**
582593
```json
583594
// Read note
584595
{ "path": "." }
585596

586-
// Write note
597+
// Write note (old note auto-archived)
587598
{ "path": ".", "note": "Test glob fix after restart" }
588599

589600
// Append to note
590601
{ "path": ".", "note": "Also check edge cases", "append": true }
591602

592-
// Clear note
603+
// Clear note (old note auto-archived)
593604
{ "path": ".", "clear": true }
605+
606+
// Browse note history
607+
{ "path": ".", "history": true }
608+
609+
// Search past notes
610+
{ "path": ".", "search": "parser" }
611+
612+
// Last 5 archived notes
613+
{ "path": ".", "history": true, "limit": 5 }
594614
```
595615

596616
---
@@ -723,6 +743,119 @@ List and filter tasks in the project backlog. Returns tasks grouped by status an
723743

724744
---
725745

746+
## Global Search
747+
748+
Search across ALL indexed projects at once. Uses a global database (`~/.aidex/global.db`) that references each project's own `.aidex/index.db`. Queries use SQLite `ATTACH DATABASE` — no data copying, each project DB is the single source of truth.
749+
750+
### aidex_global_init
751+
752+
Scan a directory tree for AiDex-indexed projects and register them in the global database. Also detects unindexed projects by looking for project markers (`.csproj`, `package.json`, `Cargo.toml`, `go.mod`, `pyproject.toml`, `CMakeLists.txt`, etc.).
753+
754+
**Parameters:**
755+
756+
| Name | Type | Required | Description |
757+
|------|------|----------|-------------|
758+
| `path` | string | Yes | Root directory to scan (e.g., `"Q:/develop"`) |
759+
| `max_depth` | number | No | Maximum directory depth to scan (default: 10) |
760+
| `tags` | string | No | Comma-separated tags for all found projects (e.g., `"privat,libs"`) |
761+
| `exclude` | string[] | No | Directory names or absolute paths to exclude (e.g., `["llama.cpp", "Q:/develop/external"]`) |
762+
| `index_unindexed` | boolean | No | Auto-index all unindexed projects with ≤500 estimated code files. Large projects (>500 files) are listed separately for user decision |
763+
| `show_progress` | boolean | No | Open a browser window (`http://localhost:3334`) showing live indexing progress. Only effective with `index_unindexed: true` |
764+
765+
**Examples:**
766+
```json
767+
// Scan and register existing indexes
768+
{ "path": "Q:/develop", "exclude": ["llama.cpp", "node_modules"] }
769+
770+
// Scan, register, AND auto-index all unindexed projects with progress UI
771+
{ "path": "Q:/develop", "index_unindexed": true, "show_progress": true }
772+
```
773+
774+
**Returns:** Count of registered/new/updated/removed projects, list of unindexed projects with their markers, totals across all registered projects. When `index_unindexed` is true, also returns `indexedResults` (per-project success/failure) and `largeProjects` (projects >500 files needing user decision).
775+
776+
---
777+
778+
### aidex_global_status
779+
780+
Show overview of all projects registered in the global index.
781+
782+
**Parameters:**
783+
784+
| Name | Type | Required | Description |
785+
|------|------|----------|-------------|
786+
| `tag_filter` | string | No | Only show projects with this tag |
787+
| `sort` | string | No | Sort order: `"name"` (default), `"size"` (most files first), `"recent"` (most recently indexed first) |
788+
789+
**Example:**
790+
```json
791+
{ "sort": "recent" }
792+
```
793+
794+
**Returns:** Table of all registered projects with name, path, languages, file/method/type counts, and last indexed time.
795+
796+
---
797+
798+
### aidex_global_query
799+
800+
Search for a term across all registered projects. Results are cached in memory for 5 minutes.
801+
802+
**Parameters:**
803+
804+
| Name | Type | Required | Description |
805+
|------|------|----------|-------------|
806+
| `term` | string | Yes | Term to search for |
807+
| `mode` | string | No | `"exact"` (default), `"contains"`, or `"starts_with"` |
808+
| `tag_filter` | string | No | Only search projects with this tag |
809+
810+
**Example:**
811+
```json
812+
{ "term": "TransparentWindow", "mode": "contains" }
813+
```
814+
815+
**Returns:** Matches grouped by project, showing file paths and line numbers.
816+
817+
---
818+
819+
### aidex_global_signatures
820+
821+
Search for methods or types by name across all registered projects.
822+
823+
**Parameters:**
824+
825+
| Name | Type | Required | Description |
826+
|------|------|----------|-------------|
827+
| `name` | string | Yes | Method or type name to search for |
828+
| `kind` | string | No | Filter by kind: `"method"`, `"class"`, `"struct"`, `"interface"`, `"enum"`, `"type"` |
829+
| `tag_filter` | string | No | Only search projects with this tag |
830+
831+
**Example:**
832+
```json
833+
{ "name": "Render", "kind": "method" }
834+
```
835+
836+
**Returns:** Matching methods (with prototype, visibility, file, line) and types (with kind, file, line), grouped by project.
837+
838+
---
839+
840+
### aidex_global_refresh
841+
842+
Update statistics for all registered projects and remove projects whose paths no longer exist.
843+
844+
**Parameters:**
845+
846+
| Name | Type | Required | Description |
847+
|------|------|----------|-------------|
848+
| `tag_filter` | string | No | Only refresh projects with this tag |
849+
850+
**Example:**
851+
```json
852+
{}
853+
```
854+
855+
**Returns:** Count of updated and removed projects, plus updated totals.
856+
857+
---
858+
726859
## Screenshots
727860

728861
### aidex_screenshot
@@ -733,8 +866,12 @@ Take a screenshot of the screen, a window, or an interactive region selection. R
733866

734867
| Name | Type | Required | Description |
735868
|------|------|----------|-------------|
736-
| `mode` | string | - | `fullscreen` (default), `active_window`, `window`, `region` |
869+
| `mode` | string | - | `fullscreen` (default), `active_window`, `window`, `region`, `rect` |
737870
| `window_title` | string | for mode=window | Window title substring to match (use `aidex_windows` to find titles) |
871+
| `x` | number | for mode=rect | X coordinate of the capture rectangle |
872+
| `y` | number | for mode=rect | Y coordinate of the capture rectangle |
873+
| `width` | number | for mode=rect | Width of the capture rectangle in pixels |
874+
| `height` | number | for mode=rect | Height of the capture rectangle in pixels |
738875
| `monitor` | number | - | Monitor index (0-based, default: primary). Only for fullscreen mode |
739876
| `delay` | number | - | Seconds to wait before capturing (e.g., `3` to switch windows first) |
740877
| `filename` | string | - | Custom filename (default: `aidex-screenshot.png`). Overwrites if exists |
@@ -748,6 +885,7 @@ Take a screenshot of the screen, a window, or an interactive region selection. R
748885
| `active_window` | Currently focused window | Win32 API / screencapture / xdotool+maim |
749886
| `window` | Specific window by title substring | EnumWindows / osascript / xdotool |
750887
| `region` | User draws a rectangle interactively | WinForms overlay / screencapture -i / maim -s |
888+
| `rect` | Capture specific coordinates (x, y, width, height) | PowerShell / screencapture / maim |
751889

752890
**Returns:**
753891
- `file_path`: Absolute path to the saved PNG file
@@ -769,6 +907,9 @@ Take a screenshot of the screen, a window, or an interactive region selection. R
769907
// Interactive region selection
770908
{ "mode": "region" }
771909

910+
// Capture specific coordinates (e.g., from accessibility bounds)
911+
{ "mode": "rect", "x": 100, "y": 200, "width": 800, "height": 600 }
912+
772913
// Fullscreen with delay and custom path
773914
{ "delay": 3, "filename": "bug-report.png", "save_path": "/tmp/screenshots" }
774915

0 commit comments

Comments
 (0)