@hasna/search 0.0.7 → 0.0.9
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.
- package/README.md +68 -7
- package/dist/cli/index.js +10483 -12908
- package/dist/cli/local.d.ts +3 -0
- package/dist/cli/local.d.ts.map +1 -0
- package/dist/cli/storage.d.ts +3 -0
- package/dist/cli/storage.d.ts.map +1 -0
- package/dist/db/database.d.ts +1 -0
- package/dist/db/database.d.ts.map +1 -1
- package/dist/db/index-db.d.ts +6 -0
- package/dist/db/index-db.d.ts.map +1 -0
- package/dist/db/index-migrations.d.ts +3 -0
- package/dist/db/index-migrations.d.ts.map +1 -0
- package/dist/db/migrations.d.ts.map +1 -1
- package/dist/db/pg-migrate.d.ts +8 -0
- package/dist/db/pg-migrate.d.ts.map +1 -0
- package/dist/db/pg-migrations.d.ts +1 -1
- package/dist/db/providers.d.ts.map +1 -1
- package/dist/db/remote-storage.d.ts +12 -0
- package/dist/db/remote-storage.d.ts.map +1 -0
- package/dist/db/storage-config.d.ts +26 -0
- package/dist/db/storage-config.d.ts.map +1 -0
- package/dist/db/storage-sync.d.ts +35 -0
- package/dist/db/storage-sync.d.ts.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6850 -8733
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/dedup.d.ts.map +1 -1
- package/dist/lib/local/find.d.ts +38 -0
- package/dist/lib/local/find.d.ts.map +1 -0
- package/dist/lib/local/ignore.d.ts +38 -0
- package/dist/lib/local/ignore.d.ts.map +1 -0
- package/dist/lib/local/indexer.d.ts +57 -0
- package/dist/lib/local/indexer.d.ts.map +1 -0
- package/dist/lib/local/query.d.ts +60 -0
- package/dist/lib/local/query.d.ts.map +1 -0
- package/dist/lib/local/regex.d.ts +26 -0
- package/dist/lib/local/regex.d.ts.map +1 -0
- package/dist/lib/local/walker.d.ts +30 -0
- package/dist/lib/local/walker.d.ts.map +1 -0
- package/dist/lib/providers/content.d.ts +9 -0
- package/dist/lib/providers/content.d.ts.map +1 -0
- package/dist/lib/providers/files.d.ts +9 -0
- package/dist/lib/providers/files.d.ts.map +1 -0
- package/dist/lib/providers/index.d.ts.map +1 -1
- package/dist/lib/search.d.ts.map +1 -1
- package/dist/mcp/index.js +7520 -10144
- package/dist/mcp/server.d.ts +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/storage-tools.d.ts +3 -0
- package/dist/mcp/storage-tools.d.ts.map +1 -0
- package/dist/server/index.js +13965 -16510
- package/dist/server/serve.d.ts.map +1 -1
- package/dist/storage.d.ts +7 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +5584 -0
- package/dist/types/index.d.ts +10 -2
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +18 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @hasna/search
|
|
2
2
|
|
|
3
|
-
Unified search
|
|
3
|
+
Unified search for machines and agents — a **local file index** (find files by name, path, or content in milliseconds) plus **12 web providers** (Google, SerpAPI, Exa, Perplexity, Twitter, Reddit, YouTube, Brave, Bing, Hacker News, GitHub, arXiv) and YouTube transcription. CLI + MCP + REST API + Dashboard.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@hasna/search)
|
|
6
6
|
[](LICENSE)
|
|
@@ -11,6 +11,60 @@ Unified search aggregator — 12 providers (Google, SerpAPI, Exa, Perplexity, Tw
|
|
|
11
11
|
npm install -g @hasna/search
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
+
## Local Search
|
|
15
|
+
|
|
16
|
+
Index a workspace once, then find anything in one call:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
search index add ~/workspace # register + index (gitignore-aware, incremental)
|
|
20
|
+
search find storage-config # by file name/path
|
|
21
|
+
search find "deduplicate results" # by content, with line numbers
|
|
22
|
+
search find dedup -k file -e ts # filters: kind, extension, dir, root
|
|
23
|
+
search index status # roots, file counts, staleness
|
|
24
|
+
search index update # incremental reindex (auto-runs when stale)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The index lives in SQLite (`~/.hasna/search/index.db`) using trigram FTS5 for substring
|
|
28
|
+
matching. Re-indexing only touches changed files; stale roots refresh automatically
|
|
29
|
+
before serving results. `node_modules`, `.git`, build output, binaries, and anything
|
|
30
|
+
in `.gitignore` are excluded.
|
|
31
|
+
|
|
32
|
+
Local results also join unified search as the `files` and `content` providers
|
|
33
|
+
(`search query dedup --profile local`, or blended with web providers via `--profile all`).
|
|
34
|
+
|
|
35
|
+
Regex (grep-style) search works too, Cursor-style — required literals from the
|
|
36
|
+
pattern prefilter candidates through the trigram index, then the real regex runs
|
|
37
|
+
only on those files:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
search find "export (function|const) handle\w+" -x # regex, line-based
|
|
41
|
+
search find "storage-(config|sync)\.ts$" -x -k file # regex over paths
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Performance
|
|
45
|
+
|
|
46
|
+
Measured on a 158,140-file workspace index (79GB tree, 1.8GB index), warm cache,
|
|
47
|
+
20-core Linux box — `search find -k content` vs `ripgrep -l`, wall clock per query:
|
|
48
|
+
|
|
49
|
+
| Query | ripgrep | search find |
|
|
50
|
+
|---|---|---|
|
|
51
|
+
| `contentless_delete` | 0.65s | 0.06s |
|
|
52
|
+
| `registerStorageCommands` | 0.20s | 0.07s |
|
|
53
|
+
| `IgnoreMatcher` | 0.20s | 0.06s |
|
|
54
|
+
|
|
55
|
+
CPU per query: rg ~2.2s across cores; find ~0.08s on one. Initial indexing of the
|
|
56
|
+
same tree: 166s; incremental re-index when nothing changed: ~2.7s (runs
|
|
57
|
+
automatically at most once per `indexStaleMinutes`). Results come back ranked,
|
|
58
|
+
deduplicated across file-name and content matches, and scoped to all indexed
|
|
59
|
+
roots regardless of the caller's working directory.
|
|
60
|
+
|
|
61
|
+
## Web Search
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
search query "bun sqlite fts5" --profile research
|
|
65
|
+
search exa "semantic search" # any provider directly
|
|
66
|
+
```
|
|
67
|
+
|
|
14
68
|
## CLI Usage
|
|
15
69
|
|
|
16
70
|
```bash
|
|
@@ -23,7 +77,9 @@ search --help
|
|
|
23
77
|
search-mcp
|
|
24
78
|
```
|
|
25
79
|
|
|
26
|
-
|
|
80
|
+
Agent-facing tools include `find` (one-call local file lookup), `index_add` /
|
|
81
|
+
`index_update` / `index_status` / `index_remove`, unified `search`, per-provider
|
|
82
|
+
`search_*` tools, history, saved searches, profiles, and export.
|
|
27
83
|
|
|
28
84
|
## HTTP mode
|
|
29
85
|
|
|
@@ -42,16 +98,21 @@ MCP_HTTP=1 search-mcp
|
|
|
42
98
|
search-serve
|
|
43
99
|
```
|
|
44
100
|
|
|
45
|
-
|
|
101
|
+
`/api/find`, `/api/index`, `/api/search`, and the dashboard (with a Local tab) on port 19800.
|
|
46
102
|
|
|
47
|
-
|
|
103
|
+
## Storage Sync
|
|
104
|
+
|
|
105
|
+
Storage sync is optional. By default search uses local SQLite at `~/.hasna/search/`.
|
|
48
106
|
|
|
49
107
|
```bash
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
108
|
+
search storage status
|
|
109
|
+
search storage push
|
|
110
|
+
search storage pull
|
|
111
|
+
search storage sync
|
|
53
112
|
```
|
|
54
113
|
|
|
114
|
+
Set `HASNA_SEARCH_DATABASE_URL` or `SEARCH_DATABASE_URL` to run in hybrid/remote mode with PostgreSQL. RDS host settings can be configured in `~/.hasna/search/storage/config.json`. Programmatic storage helpers are available from `@hasna/search/storage`.
|
|
115
|
+
|
|
55
116
|
## Data Directory
|
|
56
117
|
|
|
57
118
|
Data is stored in `~/.hasna/search/`.
|