@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.
Files changed (59) hide show
  1. package/README.md +68 -7
  2. package/dist/cli/index.js +10483 -12908
  3. package/dist/cli/local.d.ts +3 -0
  4. package/dist/cli/local.d.ts.map +1 -0
  5. package/dist/cli/storage.d.ts +3 -0
  6. package/dist/cli/storage.d.ts.map +1 -0
  7. package/dist/db/database.d.ts +1 -0
  8. package/dist/db/database.d.ts.map +1 -1
  9. package/dist/db/index-db.d.ts +6 -0
  10. package/dist/db/index-db.d.ts.map +1 -0
  11. package/dist/db/index-migrations.d.ts +3 -0
  12. package/dist/db/index-migrations.d.ts.map +1 -0
  13. package/dist/db/migrations.d.ts.map +1 -1
  14. package/dist/db/pg-migrate.d.ts +8 -0
  15. package/dist/db/pg-migrate.d.ts.map +1 -0
  16. package/dist/db/pg-migrations.d.ts +1 -1
  17. package/dist/db/providers.d.ts.map +1 -1
  18. package/dist/db/remote-storage.d.ts +12 -0
  19. package/dist/db/remote-storage.d.ts.map +1 -0
  20. package/dist/db/storage-config.d.ts +26 -0
  21. package/dist/db/storage-config.d.ts.map +1 -0
  22. package/dist/db/storage-sync.d.ts +35 -0
  23. package/dist/db/storage-sync.d.ts.map +1 -0
  24. package/dist/index.d.ts +11 -0
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +6850 -8733
  27. package/dist/lib/config.d.ts.map +1 -1
  28. package/dist/lib/dedup.d.ts.map +1 -1
  29. package/dist/lib/local/find.d.ts +38 -0
  30. package/dist/lib/local/find.d.ts.map +1 -0
  31. package/dist/lib/local/ignore.d.ts +38 -0
  32. package/dist/lib/local/ignore.d.ts.map +1 -0
  33. package/dist/lib/local/indexer.d.ts +57 -0
  34. package/dist/lib/local/indexer.d.ts.map +1 -0
  35. package/dist/lib/local/query.d.ts +60 -0
  36. package/dist/lib/local/query.d.ts.map +1 -0
  37. package/dist/lib/local/regex.d.ts +26 -0
  38. package/dist/lib/local/regex.d.ts.map +1 -0
  39. package/dist/lib/local/walker.d.ts +30 -0
  40. package/dist/lib/local/walker.d.ts.map +1 -0
  41. package/dist/lib/providers/content.d.ts +9 -0
  42. package/dist/lib/providers/content.d.ts.map +1 -0
  43. package/dist/lib/providers/files.d.ts +9 -0
  44. package/dist/lib/providers/files.d.ts.map +1 -0
  45. package/dist/lib/providers/index.d.ts.map +1 -1
  46. package/dist/lib/search.d.ts.map +1 -1
  47. package/dist/mcp/index.js +7520 -10144
  48. package/dist/mcp/server.d.ts +1 -1
  49. package/dist/mcp/server.d.ts.map +1 -1
  50. package/dist/mcp/storage-tools.d.ts +3 -0
  51. package/dist/mcp/storage-tools.d.ts.map +1 -0
  52. package/dist/server/index.js +13965 -16510
  53. package/dist/server/serve.d.ts.map +1 -1
  54. package/dist/storage.d.ts +7 -0
  55. package/dist/storage.d.ts.map +1 -0
  56. package/dist/storage.js +5584 -0
  57. package/dist/types/index.d.ts +10 -2
  58. package/dist/types/index.d.ts.map +1 -1
  59. package/package.json +18 -5
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAkB,MAAM,mBAAmB,CAAC;AAyBtE,wBAAgB,SAAS,IAAI,YAAY,CAYxC;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,YAAY,CAMtE;AAED,wBAAgB,WAAW,IAAI,YAAY,CAI1C;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,YAAY,GAAG,OAAO,CAG/D;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,YAAY,EAAE,KAAK,EAAE,OAAO,GAAG,YAAY,CAKpF"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAkB,MAAM,mBAAmB,CAAC;AAatE,wBAAgB,SAAS,IAAI,YAAY,CAYxC;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,YAAY,CAMtE;AAED,wBAAgB,WAAW,IAAI,YAAY,CAI1C;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,YAAY,GAAG,OAAO,CAG/D;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,YAAY,EAAE,KAAK,EAAE,OAAO,GAAG,YAAY,CAKpF"}
@@ -1 +1 @@
1
- {"version":3,"file":"dedup.d.ts","sourceRoot":"","sources":["../../src/lib/dedup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CA0BhD;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CA+C1E"}
1
+ {"version":3,"file":"dedup.d.ts","sourceRoot":"","sources":["../../src/lib/dedup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CA6BhD;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CA+C1E"}
@@ -0,0 +1,38 @@
1
+ import type { Database } from "bun:sqlite";
2
+ import { type LineMatch, type LocalQueryOptions } from "./query.js";
3
+ export type FindKind = "file" | "content" | "both";
4
+ export interface FindMatch {
5
+ /** Absolute path. */
6
+ path: string;
7
+ root: string;
8
+ kind: FindKind;
9
+ score: number;
10
+ /** First matching line (content matches only). */
11
+ line?: number;
12
+ snippet?: string;
13
+ matches?: LineMatch[];
14
+ }
15
+ export interface FindOptions extends LocalQueryOptions {
16
+ kind?: FindKind;
17
+ /** Refresh stale roots before searching (default: config-driven). */
18
+ refresh?: boolean;
19
+ /** Treat the query as a regular expression (grep-style, line-based). */
20
+ regex?: boolean;
21
+ /** Case-sensitive matching (regex mode only; plain queries are always case-insensitive). */
22
+ caseSensitive?: boolean;
23
+ }
24
+ export interface FindResponse {
25
+ query: string;
26
+ kind: FindKind;
27
+ /** False when no index roots are ready — results will be empty. */
28
+ indexed: boolean;
29
+ roots: number;
30
+ total: number;
31
+ results: FindMatch[];
32
+ }
33
+ /**
34
+ * One-call local lookup: ranked file-path and content matches across all
35
+ * indexed roots. Designed for agents — replaces glob/grep/ls round trips.
36
+ */
37
+ export declare function findLocal(query: string, opts?: FindOptions, db?: Database): FindResponse;
38
+ //# sourceMappingURL=find.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../src/lib/local/find.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAML,KAAK,SAAS,EACd,KAAK,iBAAiB,EACvB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;AAEnD,MAAM,WAAW,SAAS;IACxB,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,WAAY,SAAQ,iBAAiB;IACpD,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,qEAAqE;IACrE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wEAAwE;IACxE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,4FAA4F;IAC5F,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,CAAC;IACf,mEAAmE;IACnE,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,SAAS,EAAE,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,WAAgB,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,YAAY,CA2E5F"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Gitignore-style pattern matching for the local file indexer.
3
+ *
4
+ * Semantics follow git: last matching pattern wins, `!` negates, trailing `/`
5
+ * matches directories only, patterns containing a non-trailing `/` are anchored
6
+ * to the directory holding the ignore file, bare patterns match basenames at
7
+ * any depth. Re-including files under an ignored directory is not supported
8
+ * (same as git: the walker never descends into ignored directories).
9
+ */
10
+ export declare class IgnoreMatcher {
11
+ private patterns;
12
+ /** Directory the ignore file lives in, relative to the walk root ("" = root). */
13
+ readonly base: string;
14
+ constructor(lines: string[], base?: string);
15
+ /**
16
+ * Returns true/false if a pattern matched (last match wins), or undefined
17
+ * if no pattern in this matcher applies to the path.
18
+ */
19
+ ignores(relPath: string, isDir: boolean): boolean | undefined;
20
+ }
21
+ /**
22
+ * Stack of ignore matchers built up as the walker descends. The `hard`
23
+ * matcher (DEFAULT_EXCLUDES + per-root excludes) is consulted first and its
24
+ * verdict is final — a `.gitignore` inside the tree must never be able to
25
+ * re-include `.git/` or `node_modules/` via negation. Within the soft layer
26
+ * (nested .gitignore files), deeper matchers take precedence.
27
+ */
28
+ export declare class IgnoreStack {
29
+ private hard;
30
+ private stack;
31
+ constructor(hard?: IgnoreMatcher | null);
32
+ push(matcher: IgnoreMatcher): void;
33
+ pop(): void;
34
+ ignores(relPath: string, isDir: boolean): boolean;
35
+ }
36
+ /** Directories and files that are never worth indexing, regardless of .gitignore. */
37
+ export declare const DEFAULT_EXCLUDES: string[];
38
+ //# sourceMappingURL=ignore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ignore.d.ts","sourceRoot":"","sources":["../../../src/lib/local/ignore.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAsHH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAoB;IACpC,iFAAiF;IACjF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,SAAK;IAOtC;;;OAGG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS;CAe9D;AAED;;;;;;GAMG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,IAAI,CAAuB;IACnC,OAAO,CAAC,KAAK,CAAuB;gBAExB,IAAI,GAAE,aAAa,GAAG,IAAW;IAI7C,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAIlC,GAAG,IAAI,IAAI;IAIX,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO;CAWlD;AAED,qFAAqF;AACrF,eAAO,MAAM,gBAAgB,UAmB5B,CAAC"}
@@ -0,0 +1,57 @@
1
+ import type { Database } from "bun:sqlite";
2
+ export interface IndexRoot {
3
+ id: string;
4
+ path: string;
5
+ name: string;
6
+ exclude: string[];
7
+ contentIndexing: boolean;
8
+ maxFileSize: number;
9
+ status: "pending" | "indexing" | "ready" | "error";
10
+ error: string | null;
11
+ fileCount: number;
12
+ lastIndexedAt: string | null;
13
+ lastDurationMs: number | null;
14
+ createdAt: string;
15
+ }
16
+ export interface IndexStats {
17
+ rootId: string;
18
+ added: number;
19
+ updated: number;
20
+ deleted: number;
21
+ contentIndexed: number;
22
+ fileCount: number;
23
+ /** Unreadable directories (permissions, IO) skipped during the scan. */
24
+ skippedDirs: number;
25
+ durationMs: number;
26
+ }
27
+ export declare function normalizeRootPath(path: string): string;
28
+ export declare function listRoots(db?: Database): IndexRoot[];
29
+ export declare function getRoot(ref: string, db?: Database): IndexRoot | null;
30
+ export declare function hasReadyRoot(db?: Database): boolean;
31
+ export declare function addRoot(path: string, opts?: {
32
+ name?: string;
33
+ contentIndexing?: boolean;
34
+ exclude?: string[];
35
+ maxFileSize?: number;
36
+ }, db?: Database): IndexRoot;
37
+ export declare function removeRoot(idOrPath: string, db?: Database): boolean;
38
+ /**
39
+ * Index (or incrementally re-index) a root: scan the tree, diff against the
40
+ * stored file list by (size, mtime), and apply inserts/updates/deletes.
41
+ * Content indexing reads only new/changed text files.
42
+ */
43
+ export declare function indexRoot(idOrPath: string, opts?: {
44
+ force?: boolean;
45
+ }, db?: Database): IndexStats;
46
+ export declare function indexAllRoots(opts?: {
47
+ force?: boolean;
48
+ }, db?: Database): IndexStats[];
49
+ /**
50
+ * Incrementally refresh roots whose index is older than `staleMinutes`.
51
+ * Synchronous (an incremental pass on an unchanged tree is fast); guarded
52
+ * against concurrent refreshes of the same root within this process.
53
+ */
54
+ export declare function refreshStaleRoots(staleMinutes: number, db?: Database): IndexStats[];
55
+ /** Refresh stale roots according to the user's config (called before local searches). */
56
+ export declare function autoRefreshStaleRoots(db?: Database): IndexStats[];
57
+ //# sourceMappingURL=indexer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"indexer.d.ts","sourceRoot":"","sources":["../../../src/lib/local/indexer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAe3C,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,M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nE;AAYD;;;;GAIG;AACH,wBAAgB,SAAS,CACvB,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,EAC9B,EAAE,CAAC,EAAE,QAAQ,GACZ,UAAU,CA6GZ;AAED,wBAAgB,aAAa,CAAC,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,UAAU,EAAE,CAEzF;AAID;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,UAAU,EAAE,CAoBnF;AAED,yFAAyF;AACzF,wBAAgB,qBAAqB,CAAC,EAAE,CAAC,EAAE,QAAQ,GAAG,UAAU,EAAE,CAIjE"}
@@ -0,0 +1,60 @@
1
+ import type { Database } from "bun:sqlite";
2
+ export interface FileHit {
3
+ rootId: string;
4
+ rootName: string;
5
+ rootPath: string;
6
+ relPath: string;
7
+ absPath: string;
8
+ name: string;
9
+ ext: string;
10
+ dir: string;
11
+ size: number;
12
+ mtimeMs: number;
13
+ isBinary: boolean;
14
+ score: number;
15
+ }
16
+ export interface LineMatch {
17
+ line: number;
18
+ text: string;
19
+ }
20
+ export interface ContentHit extends FileHit {
21
+ line: number;
22
+ lineText: string;
23
+ matches: LineMatch[];
24
+ }
25
+ export interface LocalQueryOptions {
26
+ root?: string;
27
+ ext?: string;
28
+ dir?: string;
29
+ limit?: number;
30
+ }
31
+ export declare function tokenize(query: string): string[];
32
+ /** Build an FTS5 MATCH expression from query tokens (trigram needs >= 3 chars). */
33
+ export declare function buildFtsQuery(query: string): string | null;
34
+ /** Clamp a caller-supplied limit to something SQLite-safe and sane. */
35
+ export declare function clampLimit(limit: number | undefined, fallback?: number): number;
36
+ /** Search indexed file paths/names. Trigram FTS when possible, LIKE fallback for short queries. */
37
+ export declare function searchFilePaths(query: string, opts?: LocalQueryOptions, db?: Database): FileHit[];
38
+ /**
39
+ * Regex search over indexed file paths. Required literals extracted from the
40
+ * pattern prefilter candidates via trigram FTS; the real RegExp then runs
41
+ * against rel_path and name. Throws when the pattern has no usable literals.
42
+ */
43
+ export declare function searchFilePathsRegex(pattern: string, opts?: LocalQueryOptions & {
44
+ caseSensitive?: boolean;
45
+ }, db?: Database): FileHit[];
46
+ /**
47
+ * Regex search over indexed file content (line-based, like grep). Trigram FTS
48
+ * prefilters candidate files from the pattern's required literals; the real
49
+ * RegExp runs per line on the actual file text. Throws when the pattern has
50
+ * no usable literals.
51
+ */
52
+ export declare function searchFileContentRegex(pattern: string, opts?: LocalQueryOptions & {
53
+ caseSensitive?: boolean;
54
+ }, db?: Database): ContentHit[];
55
+ /**
56
+ * Search indexed file content. FTS narrows to candidate files; the actual
57
+ * files are re-read to produce exact, current line numbers and snippets.
58
+ */
59
+ export declare function searchFileContent(query: string, opts?: LocalQueryOptions, db?: Database): ContentHit[];
60
+ //# sourceMappingURL=query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/lib/local/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAM3C,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,M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AAE,QAAQ,GACZ,UAAU,EAAE,CAyDd"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Regex search over the local index, Cursor/codesearch style: required literal
3
+ * substrings are extracted from the pattern and used as a trigram FTS prefilter,
4
+ * then the real RegExp runs only on the candidate files. The index layer may
5
+ * produce false positives; verification against actual text is authoritative.
6
+ */
7
+ interface BranchLiterals {
8
+ /** Literals that must all appear for this alternation branch to match. */
9
+ literals: string[];
10
+ }
11
+ /**
12
+ * Extract required literals from a regex pattern, as an OR-of-ANDs across
13
+ * top-level alternation branches. Conservative: any construct we don't fully
14
+ * understand simply breaks the current literal run (weaker prefilter, never
15
+ * wrong). Returns null when any branch lacks a literal of >= 3 chars, since
16
+ * the index could not narrow candidates for that branch.
17
+ */
18
+ export declare function extractRegexLiterals(pattern: string): BranchLiterals[] | null;
19
+ /**
20
+ * Build an FTS5 MATCH expression prefiltering candidates for a regex, or null
21
+ * when the pattern has no required literals long enough for the trigram index.
22
+ */
23
+ export declare function buildFtsQueryFromRegex(pattern: string): string | null;
24
+ export declare function compileSearchRegex(pattern: string, caseSensitive?: boolean): RegExp;
25
+ export {};
26
+ //# sourceMappingURL=regex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regex.d.ts","sourceRoot":"","sources":["../../../src/lib/local/regex.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,UAAU,cAAc;IACtB,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,EAAE,GAAG,IAAI,CAW7E;AAiND;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAgBrE;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,UAAQ,GAAG,MAAM,CAEjF"}
@@ -0,0 +1,30 @@
1
+ export interface ScannedFile {
2
+ relPath: string;
3
+ name: string;
4
+ ext: string;
5
+ dir: string;
6
+ size: number;
7
+ mtimeMs: number;
8
+ }
9
+ export interface ScanResult {
10
+ files: ScannedFile[];
11
+ /** Directories that could not be read (EACCES, EIO, ...) — not ENOENT races. */
12
+ skippedDirs: string[];
13
+ }
14
+ export declare function hasBinaryExtension(ext: string): boolean;
15
+ export declare function isContentExcluded(name: string): boolean;
16
+ /** Sniff the first 8KB for a null byte. */
17
+ export declare function isBinaryFile(absPath: string): boolean;
18
+ export declare function extOf(name: string): string;
19
+ /**
20
+ * Walk a root directory, honoring DEFAULT_EXCLUDES, per-root exclude patterns,
21
+ * and nested .gitignore files. Default and per-root excludes are hard:
22
+ * a .gitignore negation inside the tree cannot re-include them (and `.git`
23
+ * is never descended into, period). Symlinks are skipped entirely. Files are
24
+ * sorted by rel_path for deterministic diffs.
25
+ *
26
+ * Known limitation: a file edited without changing its size or mtime (e.g.
27
+ * mtime-preserving copies) is not detected as changed — use a force reindex.
28
+ */
29
+ export declare function scanRoot(rootPath: string, extraExcludes?: string[]): ScanResult;
30
+ //# sourceMappingURL=walker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"walker.d.ts","sourceRoot":"","sources":["../../../src/lib/local/walker.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,gFAAgF;IAChF,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAeD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED,2CAA2C;AAC3C,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAiBrD;AAUD,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG1C;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,GAAE,MAAM,EAAO,GAAG,UAAU,CA0DnF"}
@@ -0,0 +1,9 @@
1
+ import type { SearchOptions } from "../../types/index.js";
2
+ import type { SearchProvider, RawSearchResult } from "./types.js";
3
+ export declare class ContentProvider implements SearchProvider {
4
+ name: "content";
5
+ displayName: string;
6
+ isConfigured(): boolean;
7
+ search(query: string, options?: SearchOptions): Promise<RawSearchResult[]>;
8
+ }
9
+ //# sourceMappingURL=content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../src/lib/providers/content.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAIlE,qBAAa,eAAgB,YAAW,cAAc;IACpD,IAAI,EAAG,SAAS,CAAU;IAC1B,WAAW,SAAmB;IAE9B,YAAY,IAAI,OAAO;IAIjB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;CAoBjF"}
@@ -0,0 +1,9 @@
1
+ import type { SearchOptions } from "../../types/index.js";
2
+ import type { SearchProvider, RawSearchResult } from "./types.js";
3
+ export declare class FilesProvider implements SearchProvider {
4
+ name: "files";
5
+ displayName: string;
6
+ isConfigured(): boolean;
7
+ search(query: string, options?: SearchOptions): Promise<RawSearchResult[]>;
8
+ }
9
+ //# sourceMappingURL=files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../../src/lib/providers/files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAIlE,qBAAa,aAAc,YAAW,cAAc;IAClD,IAAI,EAAG,OAAO,CAAU;IACxB,WAAW,SAAiB;IAE5B,YAAY,IAAI,OAAO;IAIjB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;CAoBjF"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AA+BjD,wBAAgB,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,cAAc,CASpE;AAED,wBAAgB,eAAe,IAAI,cAAc,EAAE,CAIlD;AAED,wBAAgB,sBAAsB,IAAI,cAAc,EAAE,CAEzD;AAED,wBAAgB,gBAAgB,IAAI,kBAAkB,EAAE,CAEvD;AAED,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAmCjD,wBAAgB,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,cAAc,CASpE;AAED,wBAAgB,eAAe,IAAI,cAAc,EAAE,CAIlD;AAED,wBAAgB,sBAAsB,IAAI,cAAc,EAAE,CAEzD;AAED,wBAAgB,gBAAgB,IAAI,kBAAkB,EAAE,CAEvD;AAED,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/lib/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAElB,KAAK,qBAAqB,EAE3B,MAAM,mBAAmB,CAAC;AAS3B,wBAAsB,aAAa,CACjC,KAAK,EAAE,MAAM,EACb,IAAI,GAAE;IACJ,SAAS,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,EAAE,CAAC,EAAE,QAAQ,CAAC;CACV,GACL,OAAO,CAAC,qBAAqB,CAAC,CAmJhC;AAED,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,kBAAkB,EAC5B,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,aAAa,EACvB,EAAE,CAAC,EAAE,QAAQ,GACZ,OAAO,CAAC,qBAAqB,CAAC,CAOhC"}
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/lib/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAElB,KAAK,qBAAqB,EAG3B,MAAM,mBAAmB,CAAC;AAS3B,wBAAsB,aAAa,CACjC,KAAK,EAAE,MAAM,EACb,IAAI,GAAE;IACJ,SAAS,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,KAAK,CAAC,EA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