|
| 1 | +# Local File Search |
| 2 | + |
| 3 | +Search for files on the local filesystem by fuzzy name matching. |
| 4 | + |
| 5 | +## Installation |
| 6 | + |
| 7 | +```bash |
| 8 | +npm install @framers/agentos-ext-local-file-search |
| 9 | +``` |
| 10 | + |
| 11 | +## Usage |
| 12 | + |
| 13 | +```typescript |
| 14 | +import { createExtensionPack } from '@framers/agentos-ext-local-file-search'; |
| 15 | + |
| 16 | +const pack = createExtensionPack({ |
| 17 | + config: { |
| 18 | + denylist: ['/proc', '/sys', 'node_modules', '.git', '.ssh', '*.key'], |
| 19 | + maxResults: 10, |
| 20 | + maxDepth: 10, |
| 21 | + timeoutMs: 10000, |
| 22 | + }, |
| 23 | +}); |
| 24 | +``` |
| 25 | + |
| 26 | +## Tool: `local_file_search` |
| 27 | + |
| 28 | +| Parameter | Type | Required | Description | |
| 29 | +|-----------|------|----------|-------------| |
| 30 | +| `query` | string | Yes | Filename or partial filename to search for | |
| 31 | +| `directory` | string | No | Specific directory to search (defaults to full filesystem) | |
| 32 | + |
| 33 | +### Example |
| 34 | + |
| 35 | +``` |
| 36 | +User: "Find pic.png in my Downloads folder" |
| 37 | +Tool call: local_file_search({ query: "pic.png", directory: "/Users/me/Downloads" }) |
| 38 | +Result: [{ path: "/Users/me/Downloads/pic.png", size: 2100000, mimeType: "image/png" }] |
| 39 | +``` |
| 40 | + |
| 41 | +## Relevance Ranking |
| 42 | + |
| 43 | +Results are ranked by match quality: |
| 44 | + |
| 45 | +| Match Type | Score | Example | |
| 46 | +|-----------|-------|---------| |
| 47 | +| Exact match | 1.0 | `pic.png` matches `pic.png` | |
| 48 | +| Without extension | 0.95 | `pic` matches `pic.png` | |
| 49 | +| Starts with | 0.8 | `pic` matches `picture.jpg` | |
| 50 | +| Contains | 0.6 | `report` matches `quarterly-report.pdf` | |
| 51 | +| Fuzzy (Levenshtein ≤ 3) | 0.06-0.30 | `rprt` matches `report` | |
| 52 | + |
| 53 | +## Denylist |
| 54 | + |
| 55 | +The denylist filters both directories and files: |
| 56 | + |
| 57 | +- **Directory patterns**: `/proc`, `/sys`, `node_modules`, `.git`, `.ssh` |
| 58 | +- **Glob patterns**: `*.key`, `*.pem`, `*.secret` |
| 59 | + |
| 60 | +Configurable via `agent.config.json`: |
| 61 | + |
| 62 | +```json |
| 63 | +{ |
| 64 | + "fileSearch": { |
| 65 | + "denylist": ["/proc", "/sys", "node_modules", ".git", ".ssh", "*.key"], |
| 66 | + "maxResults": 10 |
| 67 | + } |
| 68 | +} |
| 69 | +``` |
| 70 | + |
| 71 | +## License |
| 72 | + |
| 73 | +MIT |
0 commit comments