spck 0.3.1
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/.oxlintrc.json +49 -0
- package/LICENSE +21 -0
- package/README.md +631 -0
- package/bin/cli.js +20 -0
- package/bin/validate-cwd.js +41 -0
- package/dist/config/__tests__/config.test.d.ts +2 -0
- package/dist/config/__tests__/config.test.js +262 -0
- package/dist/config/__tests__/credentials.test.d.ts +2 -0
- package/dist/config/__tests__/credentials.test.js +360 -0
- package/dist/config/config.d.ts +33 -0
- package/dist/config/config.js +185 -0
- package/dist/config/credentials.d.ts +75 -0
- package/dist/config/credentials.js +259 -0
- package/dist/config/server-selection.d.ts +40 -0
- package/dist/config/server-selection.js +130 -0
- package/dist/connection/__tests__/firebase-auth.test.d.ts +2 -0
- package/dist/connection/__tests__/firebase-auth.test.js +96 -0
- package/dist/connection/__tests__/hmac.test.d.ts +2 -0
- package/dist/connection/__tests__/hmac.test.js +372 -0
- package/dist/connection/auth.d.ts +13 -0
- package/dist/connection/auth.js +91 -0
- package/dist/connection/firebase-auth.d.ts +40 -0
- package/dist/connection/firebase-auth.js +429 -0
- package/dist/connection/hmac.d.ts +24 -0
- package/dist/connection/hmac.js +109 -0
- package/dist/i18n/index.d.ts +25 -0
- package/dist/i18n/index.js +101 -0
- package/dist/i18n/locales/en.json +313 -0
- package/dist/i18n/locales/es.json +302 -0
- package/dist/i18n/locales/fr.json +302 -0
- package/dist/i18n/locales/id.json +302 -0
- package/dist/i18n/locales/ja.json +302 -0
- package/dist/i18n/locales/ko.json +302 -0
- package/dist/i18n/locales/locales/en.json +309 -0
- package/dist/i18n/locales/locales/es.json +302 -0
- package/dist/i18n/locales/locales/fr.json +302 -0
- package/dist/i18n/locales/locales/id.json +302 -0
- package/dist/i18n/locales/locales/ja.json +302 -0
- package/dist/i18n/locales/locales/ko.json +302 -0
- package/dist/i18n/locales/locales/pt.json +302 -0
- package/dist/i18n/locales/locales/zh-Hans.json +302 -0
- package/dist/i18n/locales/pt.json +302 -0
- package/dist/i18n/locales/zh-Hans.json +302 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +493 -0
- package/dist/proxy/ProxyClient.d.ts +125 -0
- package/dist/proxy/ProxyClient.js +781 -0
- package/dist/proxy/ProxySocketWrapper.d.ts +43 -0
- package/dist/proxy/ProxySocketWrapper.js +98 -0
- package/dist/proxy/__tests__/ProxyClient.test.d.ts +2 -0
- package/dist/proxy/__tests__/ProxyClient.test.js +445 -0
- package/dist/proxy/__tests__/ProxySocketWrapper.test.d.ts +2 -0
- package/dist/proxy/__tests__/ProxySocketWrapper.test.js +190 -0
- package/dist/proxy/__tests__/handshake-validation.test.d.ts +2 -0
- package/dist/proxy/__tests__/handshake-validation.test.js +282 -0
- package/dist/proxy/__tests__/token-refresh-race.test.d.ts +14 -0
- package/dist/proxy/__tests__/token-refresh-race.test.js +173 -0
- package/dist/proxy/chunking.d.ts +53 -0
- package/dist/proxy/chunking.js +127 -0
- package/dist/proxy/handshake-validation.d.ts +21 -0
- package/dist/proxy/handshake-validation.js +49 -0
- package/dist/rpc/__tests__/router.test.d.ts +2 -0
- package/dist/rpc/__tests__/router.test.js +262 -0
- package/dist/rpc/router.d.ts +37 -0
- package/dist/rpc/router.js +132 -0
- package/dist/services/BrowserProxyService.d.ts +13 -0
- package/dist/services/BrowserProxyService.js +139 -0
- package/dist/services/FilesystemService.d.ts +99 -0
- package/dist/services/FilesystemService.js +742 -0
- package/dist/services/GitService.d.ts +243 -0
- package/dist/services/GitService.js +1439 -0
- package/dist/services/SearchService.d.ts +93 -0
- package/dist/services/SearchService.js +670 -0
- package/dist/services/TerminalService.d.ts +62 -0
- package/dist/services/TerminalService.js +337 -0
- package/dist/services/__tests__/BrowserProxyService.test.d.ts +2 -0
- package/dist/services/__tests__/BrowserProxyService.test.js +145 -0
- package/dist/services/__tests__/FilesystemService.test.d.ts +2 -0
- package/dist/services/__tests__/FilesystemService.test.js +609 -0
- package/dist/services/__tests__/GitService.test.d.ts +2 -0
- package/dist/services/__tests__/GitService.test.js +953 -0
- package/dist/services/__tests__/SearchService.test.d.ts +2 -0
- package/dist/services/__tests__/SearchService.test.js +384 -0
- package/dist/services/__tests__/TerminalService.test.d.ts +2 -0
- package/dist/services/__tests__/TerminalService.test.js +513 -0
- package/dist/setup/wizard.d.ts +10 -0
- package/dist/setup/wizard.js +172 -0
- package/dist/types.d.ts +196 -0
- package/dist/types.js +44 -0
- package/dist/utils/__tests__/gitignore.test.d.ts +2 -0
- package/dist/utils/__tests__/gitignore.test.js +127 -0
- package/dist/utils/gitignore.d.ts +24 -0
- package/dist/utils/gitignore.js +77 -0
- package/dist/utils/logger.d.ts +96 -0
- package/dist/utils/logger.js +456 -0
- package/dist/utils/project-dir.d.ts +51 -0
- package/dist/utils/project-dir.js +191 -0
- package/dist/utils/ripgrep.d.ts +34 -0
- package/dist/utils/ripgrep.js +148 -0
- package/dist/utils/tool-detection.d.ts +17 -0
- package/dist/utils/tool-detection.js +126 -0
- package/dist/watcher/FileWatcher.d.ts +10 -0
- package/dist/watcher/FileWatcher.js +42 -0
- package/package.json +70 -0
- package/src/config/__tests__/config.test.ts +318 -0
- package/src/config/__tests__/credentials.test.ts +494 -0
- package/src/config/config.ts +206 -0
- package/src/config/credentials.ts +302 -0
- package/src/config/server-selection.ts +150 -0
- package/src/connection/__tests__/firebase-auth.test.ts +121 -0
- package/src/connection/__tests__/hmac.test.ts +509 -0
- package/src/connection/auth.ts +140 -0
- package/src/connection/firebase-auth.ts +504 -0
- package/src/connection/hmac.ts +139 -0
- package/src/i18n/index.ts +119 -0
- package/src/i18n/locales/en.json +313 -0
- package/src/i18n/locales/es.json +302 -0
- package/src/i18n/locales/fr.json +302 -0
- package/src/i18n/locales/id.json +302 -0
- package/src/i18n/locales/ja.json +302 -0
- package/src/i18n/locales/ko.json +302 -0
- package/src/i18n/locales/pt.json +302 -0
- package/src/i18n/locales/zh-Hans.json +302 -0
- package/src/index.ts +542 -0
- package/src/proxy/ProxyClient.ts +968 -0
- package/src/proxy/ProxySocketWrapper.ts +113 -0
- package/src/proxy/__tests__/ProxyClient.test.ts +575 -0
- package/src/proxy/__tests__/ProxySocketWrapper.test.ts +251 -0
- package/src/proxy/__tests__/handshake-validation.test.ts +367 -0
- package/src/proxy/chunking.ts +162 -0
- package/src/proxy/handshake-validation.ts +64 -0
- package/src/rpc/__tests__/router.test.ts +400 -0
- package/src/rpc/router.ts +183 -0
- package/src/services/BrowserProxyService.ts +179 -0
- package/src/services/FilesystemService.ts +841 -0
- package/src/services/GitService.ts +1639 -0
- package/src/services/SearchService.ts +809 -0
- package/src/services/TerminalService.ts +413 -0
- package/src/services/__tests__/BrowserProxyService.test.ts +155 -0
- package/src/services/__tests__/FilesystemService.test.ts +1002 -0
- package/src/services/__tests__/GitService.test.ts +1552 -0
- package/src/services/__tests__/SearchService.test.ts +484 -0
- package/src/services/__tests__/TerminalService.test.ts +702 -0
- package/src/setup/wizard.ts +242 -0
- package/src/types/fossil-delta.d.ts +4 -0
- package/src/types.ts +287 -0
- package/src/utils/__tests__/gitignore.test.ts +174 -0
- package/src/utils/gitignore.ts +91 -0
- package/src/utils/logger.ts +578 -0
- package/src/utils/project-dir.ts +218 -0
- package/src/utils/ripgrep.ts +180 -0
- package/src/utils/tool-detection.ts +141 -0
- package/src/watcher/FileWatcher.ts +53 -0
- package/tsconfig.json +24 -0
- package/vitest.config.ts +19 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search service - efficient server-side text search
|
|
3
|
+
*
|
|
4
|
+
* Design principles:
|
|
5
|
+
* - Use ripgrep when available for maximum performance
|
|
6
|
+
* - Stream-based processing to handle large files efficiently
|
|
7
|
+
* - Buffer-based searching for performance
|
|
8
|
+
* - Cross-platform compatible
|
|
9
|
+
* - Memory-efficient with configurable limits
|
|
10
|
+
*/
|
|
11
|
+
import { AuthenticatedSocket } from '../types.js';
|
|
12
|
+
export declare class SearchService {
|
|
13
|
+
private rootPath;
|
|
14
|
+
private maxFileSize;
|
|
15
|
+
private chunkSize;
|
|
16
|
+
private ripgrepAvailable;
|
|
17
|
+
private ripgrepForceDisabled;
|
|
18
|
+
constructor(rootPath?: string, maxFileSize?: number, // 10MB default
|
|
19
|
+
chunkSize?: number, // 64KB chunks
|
|
20
|
+
ripgrepEnabled?: boolean);
|
|
21
|
+
/**
|
|
22
|
+
* Check if ripgrep is available (async, caches result)
|
|
23
|
+
*/
|
|
24
|
+
private checkRipgrepAvailability;
|
|
25
|
+
/**
|
|
26
|
+
* Check if character is a word boundary (space or punctuation)
|
|
27
|
+
*/
|
|
28
|
+
private isWordBoundary;
|
|
29
|
+
/**
|
|
30
|
+
* Find word boundary going backwards from position
|
|
31
|
+
*/
|
|
32
|
+
private findWordBoundaryBackward;
|
|
33
|
+
/**
|
|
34
|
+
* Find word boundary going forward from position
|
|
35
|
+
*/
|
|
36
|
+
private findWordBoundaryForward;
|
|
37
|
+
/**
|
|
38
|
+
* Trim line text to show context around match
|
|
39
|
+
* - Trims to word boundaries
|
|
40
|
+
* - Adds "…" prefix/suffix if trimmed
|
|
41
|
+
* - Returns trimmed line and offset
|
|
42
|
+
*/
|
|
43
|
+
private trimLineToMatch;
|
|
44
|
+
/**
|
|
45
|
+
* Stream search results using ripgrep with glob patterns
|
|
46
|
+
* Falls back to Node.js implementation if ripgrep is not available
|
|
47
|
+
* Sends results in batches of 50 via RPC notifications
|
|
48
|
+
*/
|
|
49
|
+
private findWithStream;
|
|
50
|
+
/**
|
|
51
|
+
* Stream search results using Node.js implementation
|
|
52
|
+
* Used as fallback when ripgrep is not available
|
|
53
|
+
*/
|
|
54
|
+
private findWithStreamNode;
|
|
55
|
+
/**
|
|
56
|
+
* Get all files in a directory matching optional glob pattern
|
|
57
|
+
*/
|
|
58
|
+
private getAllFiles;
|
|
59
|
+
/**
|
|
60
|
+
* Simple glob pattern matching
|
|
61
|
+
*/
|
|
62
|
+
private matchGlob;
|
|
63
|
+
/**
|
|
64
|
+
* Handle search RPC methods
|
|
65
|
+
*/
|
|
66
|
+
handle(method: string, params: any, socket: AuthenticatedSocket): Promise<any>;
|
|
67
|
+
/**
|
|
68
|
+
* Build regular expression from search parameters
|
|
69
|
+
*/
|
|
70
|
+
private buildRegExp;
|
|
71
|
+
/**
|
|
72
|
+
* Search small files by reading entirely into memory
|
|
73
|
+
*/
|
|
74
|
+
private searchSmallFile;
|
|
75
|
+
/**
|
|
76
|
+
* Search large files using streaming approach
|
|
77
|
+
* This handles files that might not fit in memory
|
|
78
|
+
*/
|
|
79
|
+
private searchLargeFile;
|
|
80
|
+
/**
|
|
81
|
+
* Get surrounding line range for context
|
|
82
|
+
*/
|
|
83
|
+
private getSurroundingLineRange;
|
|
84
|
+
/**
|
|
85
|
+
* Convert string index to row/column position
|
|
86
|
+
*/
|
|
87
|
+
private indexToPosition;
|
|
88
|
+
/**
|
|
89
|
+
* Cleanup resources
|
|
90
|
+
*/
|
|
91
|
+
cleanup(): void;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=SearchService.d.ts.map
|