codevault 1.6.0 → 1.6.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.
Files changed (237) hide show
  1. package/dist/chunking/file-grouper.d.ts +39 -0
  2. package/dist/chunking/file-grouper.d.ts.map +1 -0
  3. package/dist/chunking/file-grouper.js +164 -0
  4. package/dist/chunking/file-grouper.js.map +1 -0
  5. package/dist/chunking/semantic-chunker.d.ts +37 -0
  6. package/dist/chunking/semantic-chunker.d.ts.map +1 -0
  7. package/dist/chunking/semantic-chunker.js +157 -0
  8. package/dist/chunking/semantic-chunker.js.map +1 -0
  9. package/dist/chunking/token-counter.d.ts +28 -0
  10. package/dist/chunking/token-counter.d.ts.map +1 -0
  11. package/dist/chunking/token-counter.js +207 -0
  12. package/dist/chunking/token-counter.js.map +1 -0
  13. package/dist/cli/commands/ask-cmd.d.ts +3 -0
  14. package/dist/cli/commands/ask-cmd.d.ts.map +1 -0
  15. package/dist/cli/commands/ask-cmd.js +130 -0
  16. package/dist/cli/commands/ask-cmd.js.map +1 -0
  17. package/dist/cli/commands/chat-cmd.d.ts +3 -0
  18. package/dist/cli/commands/chat-cmd.d.ts.map +1 -0
  19. package/dist/cli/commands/chat-cmd.js +194 -0
  20. package/dist/cli/commands/chat-cmd.js.map +1 -0
  21. package/dist/cli/commands/config-cmd.d.ts +3 -0
  22. package/dist/cli/commands/config-cmd.d.ts.map +1 -0
  23. package/dist/cli/commands/config-cmd.js +245 -0
  24. package/dist/cli/commands/config-cmd.js.map +1 -0
  25. package/dist/cli/commands/context.d.ts +3 -0
  26. package/dist/cli/commands/context.d.ts.map +1 -0
  27. package/dist/cli/commands/context.js +98 -0
  28. package/dist/cli/commands/context.js.map +1 -0
  29. package/dist/cli/commands/interactive-config.d.ts +2 -0
  30. package/dist/cli/commands/interactive-config.d.ts.map +1 -0
  31. package/dist/cli/commands/interactive-config.js +274 -0
  32. package/dist/cli/commands/interactive-config.js.map +1 -0
  33. package/dist/cli.d.ts +3 -0
  34. package/dist/cli.d.ts.map +1 -0
  35. package/dist/cli.js +403 -0
  36. package/dist/cli.js.map +1 -0
  37. package/dist/codemap/io.d.ts +5 -0
  38. package/dist/codemap/io.d.ts.map +1 -0
  39. package/dist/codemap/io.js +30 -0
  40. package/dist/codemap/io.js.map +1 -0
  41. package/dist/config/apply-env.d.ts +15 -0
  42. package/dist/config/apply-env.d.ts.map +1 -0
  43. package/dist/config/apply-env.js +91 -0
  44. package/dist/config/apply-env.js.map +1 -0
  45. package/dist/config/constants.d.ts +326 -0
  46. package/dist/config/constants.d.ts.map +1 -0
  47. package/dist/config/constants.js +214 -0
  48. package/dist/config/constants.js.map +1 -0
  49. package/dist/config/loader.d.ts +57 -0
  50. package/dist/config/loader.d.ts.map +1 -0
  51. package/dist/config/loader.js +287 -0
  52. package/dist/config/loader.js.map +1 -0
  53. package/dist/config/types.d.ts +46 -0
  54. package/dist/config/types.d.ts.map +1 -0
  55. package/dist/config/types.js +2 -0
  56. package/dist/config/types.js.map +1 -0
  57. package/dist/context/packs.d.ts +33 -0
  58. package/dist/context/packs.d.ts.map +1 -0
  59. package/dist/context/packs.js +180 -0
  60. package/dist/context/packs.js.map +1 -0
  61. package/dist/core/batch-indexer.d.ts +56 -0
  62. package/dist/core/batch-indexer.d.ts.map +1 -0
  63. package/dist/core/batch-indexer.js +189 -0
  64. package/dist/core/batch-indexer.js.map +1 -0
  65. package/dist/core/indexer.d.ts +3 -0
  66. package/dist/core/indexer.d.ts.map +1 -0
  67. package/dist/core/indexer.js +600 -0
  68. package/dist/core/indexer.js.map +1 -0
  69. package/dist/core/metadata.d.ts +19 -0
  70. package/dist/core/metadata.d.ts.map +1 -0
  71. package/dist/core/metadata.js +161 -0
  72. package/dist/core/metadata.js.map +1 -0
  73. package/dist/core/search.d.ts +7 -0
  74. package/dist/core/search.d.ts.map +1 -0
  75. package/dist/core/search.js +545 -0
  76. package/dist/core/search.js.map +1 -0
  77. package/dist/core/symbol-extractor.d.ts +3 -0
  78. package/dist/core/symbol-extractor.d.ts.map +1 -0
  79. package/dist/core/symbol-extractor.js +78 -0
  80. package/dist/core/symbol-extractor.js.map +1 -0
  81. package/dist/core/types.d.ts +104 -0
  82. package/dist/core/types.d.ts.map +1 -0
  83. package/dist/core/types.js +2 -0
  84. package/dist/core/types.js.map +1 -0
  85. package/dist/database/db.d.ts +102 -0
  86. package/dist/database/db.d.ts.map +1 -0
  87. package/dist/database/db.js +366 -0
  88. package/dist/database/db.js.map +1 -0
  89. package/dist/indexer/merkle.d.ts +13 -0
  90. package/dist/indexer/merkle.d.ts.map +1 -0
  91. package/dist/indexer/merkle.js +86 -0
  92. package/dist/indexer/merkle.js.map +1 -0
  93. package/dist/indexer/update.d.ts +19 -0
  94. package/dist/indexer/update.d.ts.map +1 -0
  95. package/dist/indexer/update.js +40 -0
  96. package/dist/indexer/update.js.map +1 -0
  97. package/dist/indexer/watch.d.ts +21 -0
  98. package/dist/indexer/watch.d.ts.map +1 -0
  99. package/dist/indexer/watch.js +222 -0
  100. package/dist/indexer/watch.js.map +1 -0
  101. package/dist/languages/rules.d.ts +11 -0
  102. package/dist/languages/rules.d.ts.map +1 -0
  103. package/dist/languages/rules.js +371 -0
  104. package/dist/languages/rules.js.map +1 -0
  105. package/dist/languages/tree-sitter-loader.d.ts +27 -0
  106. package/dist/languages/tree-sitter-loader.d.ts.map +1 -0
  107. package/dist/languages/tree-sitter-loader.js +76 -0
  108. package/dist/languages/tree-sitter-loader.js.map +1 -0
  109. package/dist/mcp/schemas.d.ts +166 -0
  110. package/dist/mcp/schemas.d.ts.map +1 -0
  111. package/dist/mcp/schemas.js +159 -0
  112. package/dist/mcp/schemas.js.map +1 -0
  113. package/dist/mcp/tools/ask-codebase.d.ts +85 -0
  114. package/dist/mcp/tools/ask-codebase.d.ts.map +1 -0
  115. package/dist/mcp/tools/ask-codebase.js +125 -0
  116. package/dist/mcp/tools/ask-codebase.js.map +1 -0
  117. package/dist/mcp/tools/use-context-pack.d.ts +57 -0
  118. package/dist/mcp/tools/use-context-pack.d.ts.map +1 -0
  119. package/dist/mcp/tools/use-context-pack.js +91 -0
  120. package/dist/mcp/tools/use-context-pack.js.map +1 -0
  121. package/dist/mcp-server.d.ts +3 -0
  122. package/dist/mcp-server.d.ts.map +1 -0
  123. package/dist/mcp-server.js +511 -0
  124. package/dist/mcp-server.js.map +1 -0
  125. package/dist/providers/base.d.ts +39 -0
  126. package/dist/providers/base.d.ts.map +1 -0
  127. package/dist/providers/base.js +198 -0
  128. package/dist/providers/base.js.map +1 -0
  129. package/dist/providers/chat-llm.d.ts +30 -0
  130. package/dist/providers/chat-llm.d.ts.map +1 -0
  131. package/dist/providers/chat-llm.js +85 -0
  132. package/dist/providers/chat-llm.js.map +1 -0
  133. package/dist/providers/index.d.ts +5 -0
  134. package/dist/providers/index.d.ts.map +1 -0
  135. package/dist/providers/index.js +12 -0
  136. package/dist/providers/index.js.map +1 -0
  137. package/dist/providers/openai.d.ts +14 -0
  138. package/dist/providers/openai.d.ts.map +1 -0
  139. package/dist/providers/openai.js +122 -0
  140. package/dist/providers/openai.js.map +1 -0
  141. package/dist/providers/token-counter.d.ts +2 -0
  142. package/dist/providers/token-counter.d.ts.map +1 -0
  143. package/dist/providers/token-counter.js +18 -0
  144. package/dist/providers/token-counter.js.map +1 -0
  145. package/dist/ranking/api-reranker.d.ts +18 -0
  146. package/dist/ranking/api-reranker.d.ts.map +1 -0
  147. package/dist/ranking/api-reranker.js +134 -0
  148. package/dist/ranking/api-reranker.js.map +1 -0
  149. package/dist/ranking/symbol-boost.d.ts +15 -0
  150. package/dist/ranking/symbol-boost.d.ts.map +1 -0
  151. package/dist/ranking/symbol-boost.js +175 -0
  152. package/dist/ranking/symbol-boost.js.map +1 -0
  153. package/dist/search/bm25.d.ts +17 -0
  154. package/dist/search/bm25.d.ts.map +1 -0
  155. package/dist/search/bm25.js +56 -0
  156. package/dist/search/bm25.js.map +1 -0
  157. package/dist/search/hybrid.d.ts +21 -0
  158. package/dist/search/hybrid.d.ts.map +1 -0
  159. package/dist/search/hybrid.js +50 -0
  160. package/dist/search/hybrid.js.map +1 -0
  161. package/dist/search/scope.d.ts +5 -0
  162. package/dist/search/scope.d.ts.map +1 -0
  163. package/dist/search/scope.js +107 -0
  164. package/dist/search/scope.js.map +1 -0
  165. package/dist/storage/encrypted-chunks.d.ts +40 -0
  166. package/dist/storage/encrypted-chunks.d.ts.map +1 -0
  167. package/dist/storage/encrypted-chunks.js +238 -0
  168. package/dist/storage/encrypted-chunks.js.map +1 -0
  169. package/dist/symbols/extract.d.ts +15 -0
  170. package/dist/symbols/extract.d.ts.map +1 -0
  171. package/dist/symbols/extract.js +208 -0
  172. package/dist/symbols/extract.js.map +1 -0
  173. package/dist/symbols/graph.d.ts +3 -0
  174. package/dist/symbols/graph.d.ts.map +1 -0
  175. package/dist/symbols/graph.js +89 -0
  176. package/dist/symbols/graph.js.map +1 -0
  177. package/dist/synthesis/conversational-synthesizer.d.ts +61 -0
  178. package/dist/synthesis/conversational-synthesizer.d.ts.map +1 -0
  179. package/dist/synthesis/conversational-synthesizer.js +286 -0
  180. package/dist/synthesis/conversational-synthesizer.js.map +1 -0
  181. package/dist/synthesis/markdown-formatter.d.ts +13 -0
  182. package/dist/synthesis/markdown-formatter.d.ts.map +1 -0
  183. package/dist/synthesis/markdown-formatter.js +104 -0
  184. package/dist/synthesis/markdown-formatter.js.map +1 -0
  185. package/dist/synthesis/prompt-builder.d.ts +21 -0
  186. package/dist/synthesis/prompt-builder.d.ts.map +1 -0
  187. package/dist/synthesis/prompt-builder.js +129 -0
  188. package/dist/synthesis/prompt-builder.js.map +1 -0
  189. package/dist/synthesis/synthesizer.d.ts +30 -0
  190. package/dist/synthesis/synthesizer.d.ts.map +1 -0
  191. package/dist/synthesis/synthesizer.js +210 -0
  192. package/dist/synthesis/synthesizer.js.map +1 -0
  193. package/dist/types/ast.d.ts +3 -0
  194. package/dist/types/ast.d.ts.map +1 -0
  195. package/dist/types/ast.js +2 -0
  196. package/dist/types/ast.js.map +1 -0
  197. package/dist/types/codemap.d.ts +58 -0
  198. package/dist/types/codemap.d.ts.map +1 -0
  199. package/dist/types/codemap.js +224 -0
  200. package/dist/types/codemap.js.map +1 -0
  201. package/dist/types/context-pack.d.ts +47 -0
  202. package/dist/types/context-pack.d.ts.map +1 -0
  203. package/dist/types/context-pack.js +44 -0
  204. package/dist/types/context-pack.js.map +1 -0
  205. package/dist/types/search.d.ts +15 -0
  206. package/dist/types/search.d.ts.map +1 -0
  207. package/dist/types/search.js +11 -0
  208. package/dist/types/search.js.map +1 -0
  209. package/dist/utils/cli-ui.d.ts +44 -0
  210. package/dist/utils/cli-ui.d.ts.map +1 -0
  211. package/dist/utils/cli-ui.js +139 -0
  212. package/dist/utils/cli-ui.js.map +1 -0
  213. package/dist/utils/indexer-with-progress.d.ts +10 -0
  214. package/dist/utils/indexer-with-progress.d.ts.map +1 -0
  215. package/dist/utils/indexer-with-progress.js +43 -0
  216. package/dist/utils/indexer-with-progress.js.map +1 -0
  217. package/dist/utils/logger.d.ts +55 -0
  218. package/dist/utils/logger.d.ts.map +1 -0
  219. package/dist/utils/logger.js +121 -0
  220. package/dist/utils/logger.js.map +1 -0
  221. package/dist/utils/mutex.d.ts +63 -0
  222. package/dist/utils/mutex.d.ts.map +1 -0
  223. package/dist/utils/mutex.js +123 -0
  224. package/dist/utils/mutex.js.map +1 -0
  225. package/dist/utils/path-helpers.d.ts +27 -0
  226. package/dist/utils/path-helpers.d.ts.map +1 -0
  227. package/dist/utils/path-helpers.js +55 -0
  228. package/dist/utils/path-helpers.js.map +1 -0
  229. package/dist/utils/rate-limiter.d.ts +34 -0
  230. package/dist/utils/rate-limiter.d.ts.map +1 -0
  231. package/dist/utils/rate-limiter.js +178 -0
  232. package/dist/utils/rate-limiter.js.map +1 -0
  233. package/dist/utils/scan-patterns.d.ts +5 -0
  234. package/dist/utils/scan-patterns.d.ts.map +1 -0
  235. package/dist/utils/scan-patterns.js +29 -0
  236. package/dist/utils/scan-patterns.js.map +1 -0
  237. package/package.json +1 -1
@@ -0,0 +1,326 @@
1
+ /**
2
+ * Centralized configuration constants for CodeVault
3
+ *
4
+ * This file contains all magic numbers and configuration values used throughout
5
+ * the codebase. Centralizing these values makes the system easier to tune and
6
+ * understand.
7
+ */
8
+ /**
9
+ * Parsing and Tree-sitter Configuration
10
+ */
11
+ export declare const PARSING_CONSTANTS: {
12
+ /**
13
+ * Threshold in bytes to switch to streaming parser
14
+ * Large files above this size are parsed in chunks to avoid memory issues
15
+ */
16
+ readonly SIZE_THRESHOLD: 30000;
17
+ /**
18
+ * Chunk size for streaming parser in bytes
19
+ * Parser will read this many bytes at a time when streaming
20
+ */
21
+ readonly CHUNK_SIZE: 30000;
22
+ };
23
+ /**
24
+ * Cache Configuration
25
+ */
26
+ export declare const CACHE_CONSTANTS: {
27
+ /** Maximum number of BM25 indexes to cache (LRU eviction) */
28
+ readonly MAX_BM25_CACHE_SIZE: number;
29
+ /** Maximum number of code chunks to cache in memory */
30
+ readonly MAX_CHUNK_TEXT_CACHE_SIZE: number;
31
+ /** Interval for periodic cache cleanup in MCP server (milliseconds) */
32
+ readonly CACHE_CLEAR_INTERVAL_MS: number;
33
+ };
34
+ /**
35
+ * Search Configuration
36
+ */
37
+ export declare const SEARCH_CONSTANTS: {
38
+ /** Maximum candidates to send to reranking API */
39
+ readonly RERANKER_MAX_CANDIDATES: number;
40
+ /** Maximum code chunk size to return in bytes (prevents OOM) */
41
+ readonly MAX_CHUNK_SIZE: 100000;
42
+ /** Default result limit for search queries */
43
+ readonly DEFAULT_SEARCH_LIMIT: 10;
44
+ /** Maximum search results limit */
45
+ readonly MAX_SEARCH_LIMIT: 200;
46
+ /** Selection budget multiplier for hybrid search */
47
+ readonly SELECTION_BUDGET_MULTIPLIER: 60;
48
+ /** Reciprocal rank fusion constant */
49
+ readonly RRF_K_CONSTANT: 60;
50
+ };
51
+ /**
52
+ * Symbol Boosting Configuration
53
+ */
54
+ export declare const SYMBOL_BOOST_CONSTANTS: {
55
+ /** Boost applied when query matches function signature */
56
+ readonly SIGNATURE_MATCH_BOOST: 0.3;
57
+ /** Boost applied when query matches neighbor functions */
58
+ readonly NEIGHBOR_MATCH_BOOST: 0.15;
59
+ /** Maximum total boost from symbol matching */
60
+ readonly MAX_SYMBOL_BOOST: 0.45;
61
+ /** Minimum token length for symbol matching */
62
+ readonly MIN_TOKEN_LENGTH: 3;
63
+ /** Maximum parameters to extract from signature */
64
+ readonly MAX_PARAMETERS: 12;
65
+ };
66
+ /**
67
+ * File Watcher Configuration
68
+ */
69
+ export declare const WATCHER_CONSTANTS: {
70
+ /** Default debounce interval in milliseconds */
71
+ readonly DEFAULT_DEBOUNCE_MS: 500;
72
+ /** Minimum debounce interval in milliseconds */
73
+ readonly MIN_DEBOUNCE_MS: 50;
74
+ /** Settle delay for watcher shutdown */
75
+ readonly SETTLE_DELAY_MS: 200;
76
+ /** Stability threshold for file write detection */
77
+ readonly STABILITY_THRESHOLD_MS: 100;
78
+ /** Poll interval for file stability check */
79
+ readonly POLL_INTERVAL_MS: 50;
80
+ };
81
+ /**
82
+ * Rate Limiting Configuration
83
+ */
84
+ export declare const RATE_LIMIT_CONSTANTS: {
85
+ /** Retry delays for rate limit errors (milliseconds) */
86
+ readonly RETRY_DELAYS: readonly [1000, 2000, 5000, 10000];
87
+ /** Maximum queue size to prevent unbounded growth */
88
+ readonly DEFAULT_MAX_QUEUE_SIZE: 10000;
89
+ /** Delay buffer added to rate limit calculations */
90
+ readonly DELAY_BUFFER_MS: 100;
91
+ };
92
+ /**
93
+ * Batch Processing Configuration
94
+ */
95
+ export declare const BATCH_CONSTANTS: {
96
+ /** Maximum retries for failed batches */
97
+ readonly MAX_BATCH_RETRIES: 3;
98
+ /** Initial retry delay for batch failures */
99
+ readonly INITIAL_RETRY_DELAY_MS: 1000;
100
+ /** Maximum tokens per batch for OpenAI */
101
+ readonly MAX_BATCH_TOKENS: 100000;
102
+ /** Maximum tokens per individual item */
103
+ readonly MAX_ITEM_TOKENS: 8191;
104
+ /** Default batch size for embedding generation */
105
+ readonly DEFAULT_BATCH_SIZE: 50;
106
+ };
107
+ /**
108
+ * Encryption Configuration
109
+ */
110
+ export declare const ENCRYPTION_CONSTANTS: {
111
+ /** Magic header for encrypted files */
112
+ readonly MAGIC_HEADER: "CVAULTE1";
113
+ /** Salt length in bytes for key derivation */
114
+ readonly SALT_LENGTH: 16;
115
+ /** Initialization vector length in bytes */
116
+ readonly IV_LENGTH: 12;
117
+ /** Authentication tag length in bytes */
118
+ readonly TAG_LENGTH: 16;
119
+ /** HKDF info string for key derivation */
120
+ readonly HKDF_INFO: "codevault-chunk-v1";
121
+ /** Required encryption key length in bytes */
122
+ readonly REQUIRED_KEY_LENGTH: 32;
123
+ };
124
+ /**
125
+ * LLM Configuration
126
+ */
127
+ export declare const LLM_CONSTANTS: {
128
+ /** Default temperature for multi-query generation */
129
+ readonly MULTI_QUERY_TEMPERATURE: 0.3;
130
+ /** Default temperature for answer synthesis */
131
+ readonly DEFAULT_TEMPERATURE: 0.7;
132
+ /** Maximum tokens for multi-query response */
133
+ readonly MULTI_QUERY_MAX_TOKENS: 500;
134
+ /** Default maximum tokens for chat responses */
135
+ readonly DEFAULT_CHAT_MAX_TOKENS: 4096;
136
+ /** Maximum context chunks for answer synthesis */
137
+ readonly DEFAULT_MAX_CHUNKS: 10;
138
+ };
139
+ /**
140
+ * Chunking Configuration
141
+ */
142
+ export declare const CHUNKING_CONSTANTS: {
143
+ /** Minimum token count for a valid chunk */
144
+ readonly MIN_CHUNK_TOKENS: 50;
145
+ /** Overlap percentage for line-based chunking */
146
+ readonly LINE_OVERLAP_PERCENTAGE: 0.2;
147
+ /** Maximum snippet length for signature extraction */
148
+ readonly MAX_SIGNATURE_SNIPPET: 400;
149
+ /** Maximum snippet length for call extraction */
150
+ readonly MAX_CALL_SNIPPET: 120;
151
+ /** Maximum snippet length for return type detection */
152
+ readonly MAX_RETURN_TYPE_SNIPPET: 80;
153
+ };
154
+ /**
155
+ * Conversational Chat Configuration
156
+ */
157
+ export declare const CONVERSATION_CONSTANTS: {
158
+ /** Maximum distinct chunks retained in conversation cache */
159
+ readonly MAX_CONTEXT_CHUNKS: 200;
160
+ /** Characters to truncate prompts to */
161
+ readonly PROMPT_TRUNCATE_LENGTH: 2000;
162
+ };
163
+ /**
164
+ * Documentation boost configuration
165
+ */
166
+ export declare const DOC_BOOST_CONSTANTS: {
167
+ /** Boost applied to README and documentation files */
168
+ readonly DOC_FILE_BOOST: 0.15;
169
+ /** Intent match boost */
170
+ readonly INTENT_MATCH_BOOST: 0.2;
171
+ /** Tag match boost per tag */
172
+ readonly TAG_MATCH_BOOST: 0.1;
173
+ };
174
+ /**
175
+ * Backward compatibility exports
176
+ * These maintain the old flat constant names for existing code
177
+ */
178
+ export declare const SIZE_THRESHOLD: 30000;
179
+ export declare const CHUNK_SIZE: 30000;
180
+ export declare const MAX_CHUNK_SIZE: 100000;
181
+ export declare const RRF_K: 60;
182
+ export declare const DOC_BOOST: 0.15;
183
+ export declare const MAX_NEIGHBORS: 12;
184
+ export declare const PROMPT_TRUNCATE_LENGTH: 2000;
185
+ export declare const CONVERSATION_MAX_CONTEXT_CHUNKS: 200;
186
+ export declare const DEFAULT_CACHE_CLEAR_INTERVAL_MS: number;
187
+ /**
188
+ * Character estimation (4 chars ≈ 1 token)
189
+ */
190
+ export declare const CHAR_TO_TOKEN_RATIO = 4;
191
+ /**
192
+ * Get all constants as a single object (useful for debugging)
193
+ */
194
+ export declare const ALL_CONSTANTS: {
195
+ readonly PARSING: {
196
+ /**
197
+ * Threshold in bytes to switch to streaming parser
198
+ * Large files above this size are parsed in chunks to avoid memory issues
199
+ */
200
+ readonly SIZE_THRESHOLD: 30000;
201
+ /**
202
+ * Chunk size for streaming parser in bytes
203
+ * Parser will read this many bytes at a time when streaming
204
+ */
205
+ readonly CHUNK_SIZE: 30000;
206
+ };
207
+ readonly CACHE: {
208
+ /** Maximum number of BM25 indexes to cache (LRU eviction) */
209
+ readonly MAX_BM25_CACHE_SIZE: number;
210
+ /** Maximum number of code chunks to cache in memory */
211
+ readonly MAX_CHUNK_TEXT_CACHE_SIZE: number;
212
+ /** Interval for periodic cache cleanup in MCP server (milliseconds) */
213
+ readonly CACHE_CLEAR_INTERVAL_MS: number;
214
+ };
215
+ readonly SEARCH: {
216
+ /** Maximum candidates to send to reranking API */
217
+ readonly RERANKER_MAX_CANDIDATES: number;
218
+ /** Maximum code chunk size to return in bytes (prevents OOM) */
219
+ readonly MAX_CHUNK_SIZE: 100000;
220
+ /** Default result limit for search queries */
221
+ readonly DEFAULT_SEARCH_LIMIT: 10;
222
+ /** Maximum search results limit */
223
+ readonly MAX_SEARCH_LIMIT: 200;
224
+ /** Selection budget multiplier for hybrid search */
225
+ readonly SELECTION_BUDGET_MULTIPLIER: 60;
226
+ /** Reciprocal rank fusion constant */
227
+ readonly RRF_K_CONSTANT: 60;
228
+ };
229
+ readonly SYMBOL_BOOST: {
230
+ /** Boost applied when query matches function signature */
231
+ readonly SIGNATURE_MATCH_BOOST: 0.3;
232
+ /** Boost applied when query matches neighbor functions */
233
+ readonly NEIGHBOR_MATCH_BOOST: 0.15;
234
+ /** Maximum total boost from symbol matching */
235
+ readonly MAX_SYMBOL_BOOST: 0.45;
236
+ /** Minimum token length for symbol matching */
237
+ readonly MIN_TOKEN_LENGTH: 3;
238
+ /** Maximum parameters to extract from signature */
239
+ readonly MAX_PARAMETERS: 12;
240
+ };
241
+ readonly WATCHER: {
242
+ /** Default debounce interval in milliseconds */
243
+ readonly DEFAULT_DEBOUNCE_MS: 500;
244
+ /** Minimum debounce interval in milliseconds */
245
+ readonly MIN_DEBOUNCE_MS: 50;
246
+ /** Settle delay for watcher shutdown */
247
+ readonly SETTLE_DELAY_MS: 200;
248
+ /** Stability threshold for file write detection */
249
+ readonly STABILITY_THRESHOLD_MS: 100;
250
+ /** Poll interval for file stability check */
251
+ readonly POLL_INTERVAL_MS: 50;
252
+ };
253
+ readonly RATE_LIMIT: {
254
+ /** Retry delays for rate limit errors (milliseconds) */
255
+ readonly RETRY_DELAYS: readonly [1000, 2000, 5000, 10000];
256
+ /** Maximum queue size to prevent unbounded growth */
257
+ readonly DEFAULT_MAX_QUEUE_SIZE: 10000;
258
+ /** Delay buffer added to rate limit calculations */
259
+ readonly DELAY_BUFFER_MS: 100;
260
+ };
261
+ readonly BATCH: {
262
+ /** Maximum retries for failed batches */
263
+ readonly MAX_BATCH_RETRIES: 3;
264
+ /** Initial retry delay for batch failures */
265
+ readonly INITIAL_RETRY_DELAY_MS: 1000;
266
+ /** Maximum tokens per batch for OpenAI */
267
+ readonly MAX_BATCH_TOKENS: 100000;
268
+ /** Maximum tokens per individual item */
269
+ readonly MAX_ITEM_TOKENS: 8191;
270
+ /** Default batch size for embedding generation */
271
+ readonly DEFAULT_BATCH_SIZE: 50;
272
+ };
273
+ readonly ENCRYPTION: {
274
+ /** Magic header for encrypted files */
275
+ readonly MAGIC_HEADER: "CVAULTE1";
276
+ /** Salt length in bytes for key derivation */
277
+ readonly SALT_LENGTH: 16;
278
+ /** Initialization vector length in bytes */
279
+ readonly IV_LENGTH: 12;
280
+ /** Authentication tag length in bytes */
281
+ readonly TAG_LENGTH: 16;
282
+ /** HKDF info string for key derivation */
283
+ readonly HKDF_INFO: "codevault-chunk-v1";
284
+ /** Required encryption key length in bytes */
285
+ readonly REQUIRED_KEY_LENGTH: 32;
286
+ };
287
+ readonly LLM: {
288
+ /** Default temperature for multi-query generation */
289
+ readonly MULTI_QUERY_TEMPERATURE: 0.3;
290
+ /** Default temperature for answer synthesis */
291
+ readonly DEFAULT_TEMPERATURE: 0.7;
292
+ /** Maximum tokens for multi-query response */
293
+ readonly MULTI_QUERY_MAX_TOKENS: 500;
294
+ /** Default maximum tokens for chat responses */
295
+ readonly DEFAULT_CHAT_MAX_TOKENS: 4096;
296
+ /** Maximum context chunks for answer synthesis */
297
+ readonly DEFAULT_MAX_CHUNKS: 10;
298
+ };
299
+ readonly CHUNKING: {
300
+ /** Minimum token count for a valid chunk */
301
+ readonly MIN_CHUNK_TOKENS: 50;
302
+ /** Overlap percentage for line-based chunking */
303
+ readonly LINE_OVERLAP_PERCENTAGE: 0.2;
304
+ /** Maximum snippet length for signature extraction */
305
+ readonly MAX_SIGNATURE_SNIPPET: 400;
306
+ /** Maximum snippet length for call extraction */
307
+ readonly MAX_CALL_SNIPPET: 120;
308
+ /** Maximum snippet length for return type detection */
309
+ readonly MAX_RETURN_TYPE_SNIPPET: 80;
310
+ };
311
+ readonly CONVERSATION: {
312
+ /** Maximum distinct chunks retained in conversation cache */
313
+ readonly MAX_CONTEXT_CHUNKS: 200;
314
+ /** Characters to truncate prompts to */
315
+ readonly PROMPT_TRUNCATE_LENGTH: 2000;
316
+ };
317
+ readonly DOC_BOOST: {
318
+ /** Boost applied to README and documentation files */
319
+ readonly DOC_FILE_BOOST: 0.15;
320
+ /** Intent match boost */
321
+ readonly INTENT_MATCH_BOOST: 0.2;
322
+ /** Tag match boost per tag */
323
+ readonly TAG_MATCH_BOOST: 0.1;
324
+ };
325
+ };
326
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/config/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,eAAO,MAAM,iBAAiB;IAC5B;;;OAGG;;IAGH;;;OAGG;;CAEK,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,eAAe;IAC1B,6DAA6D;;IAG7D,uDAAuD;;IAGvD,uEAAuE;;CAE/D,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,gBAAgB;IAC3B,kDAAkD;;IAGlD,gEAAgE;;IAGhE,8CAA8C;;IAG9C,mCAAmC;;IAGnC,oDAAoD;;IAGpD,sCAAsC;;CAE9B,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,sBAAsB;IACjC,0DAA0D;;IAG1D,0DAA0D;;IAG1D,+CAA+C;;IAG/C,+CAA+C;;I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Aa,IAAwC,CAAC;AAGnE,eAAO,MAAM,sBAAsB,MAAgD,CAAC;AAGpF,eAAO,MAAM,+BAA+B,KAA4C,CAAC;AAGzF,eAAO,MAAM,+BAA+B,QAA0C,CAAC;AAEvF;;GAEG;AACH,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,aAAa;;QAtPxB;;;WAGG;;QAGH;;;WAGG;;;;QAQH,6DAA6D;;QAG7D,uDAAuD;;QAGvD,uEAAuE;;;;QAQvE,kDAAkD;;QAGlD,gEAAgE;;QAGhE,8CAA8C;;QAG9C,mCAAmC;;QAGnC,oDAAoD;;QAGpD,sCAAsC;;;;QAQtC,0DAA0D;;QAG1D,0DAA0D;;QAG1D,+CAA+C;;QAG/C,+CAA+C;;QAG/C,mDAAmD;;;;QAQnD,gDAAgD;;QAGhD,gDAAgD;;QAGhD,wCAAwC;;QAGxC,mDAAmD;;QAGnD,6CAA6C;;;;QAQ7C,wDAAwD;;QAGxD,qDAAqD;;QAGrD,oDAAoD;;;;QAQpD,yCAAyC;;QAGzC,6CAA6C;;QAG7C,0CAA0C;;QAG1C,yCAAyC;;QAGzC,kDAAkD;;;;QAQlD,uCAAuC;;QAGvC,8CAA8C;;QAG9C,4CAA4C;;QAG5C,yCAAyC;;QAGzC,0CAA0C;;QAG1C,8CAA8C;;;;QAQ9C,qDAAqD;;QAGrD,+CAA+C;;QAG/C,8CAA8C;;QAG9C,gDAAgD;;QAGhD,kDAAkD;;;;QAQlD,4CAA4C;;QAG5C,iDAAiD;;QAGjD,sDAAsD;;QAGtD,iDAAiD;;QAGjD,uDAAuD;;;;QAQvD,6DAA6D;;QAG7D,wCAAwC;;;;QAQxC,sDAAsD;;QAGtD,yBAAyB;;QAGzB,8BAA8B;;;CAmDtB,CAAC"}
@@ -0,0 +1,214 @@
1
+ /**
2
+ * Centralized configuration constants for CodeVault
3
+ *
4
+ * This file contains all magic numbers and configuration values used throughout
5
+ * the codebase. Centralizing these values makes the system easier to tune and
6
+ * understand.
7
+ */
8
+ /**
9
+ * Parsing and Tree-sitter Configuration
10
+ */
11
+ export const PARSING_CONSTANTS = {
12
+ /**
13
+ * Threshold in bytes to switch to streaming parser
14
+ * Large files above this size are parsed in chunks to avoid memory issues
15
+ */
16
+ SIZE_THRESHOLD: 30_000,
17
+ /**
18
+ * Chunk size for streaming parser in bytes
19
+ * Parser will read this many bytes at a time when streaming
20
+ */
21
+ CHUNK_SIZE: 30_000,
22
+ };
23
+ /**
24
+ * Cache Configuration
25
+ */
26
+ export const CACHE_CONSTANTS = {
27
+ /** Maximum number of BM25 indexes to cache (LRU eviction) */
28
+ MAX_BM25_CACHE_SIZE: parseInt(process.env.CODEVAULT_MAX_BM25_CACHE || '10', 10),
29
+ /** Maximum number of code chunks to cache in memory */
30
+ MAX_CHUNK_TEXT_CACHE_SIZE: parseInt(process.env.CODEVAULT_MAX_CHUNK_CACHE || '1000', 10),
31
+ /** Interval for periodic cache cleanup in MCP server (milliseconds) */
32
+ CACHE_CLEAR_INTERVAL_MS: parseInt(process.env.CODEVAULT_CACHE_CLEAR_INTERVAL || '3600000', 10), // 1 hour
33
+ };
34
+ /**
35
+ * Search Configuration
36
+ */
37
+ export const SEARCH_CONSTANTS = {
38
+ /** Maximum candidates to send to reranking API */
39
+ RERANKER_MAX_CANDIDATES: parseInt(process.env.CODEVAULT_RERANKER_MAX || '50', 10),
40
+ /** Maximum code chunk size to return in bytes (prevents OOM) */
41
+ MAX_CHUNK_SIZE: 100_000,
42
+ /** Default result limit for search queries */
43
+ DEFAULT_SEARCH_LIMIT: 10,
44
+ /** Maximum search results limit */
45
+ MAX_SEARCH_LIMIT: 200,
46
+ /** Selection budget multiplier for hybrid search */
47
+ SELECTION_BUDGET_MULTIPLIER: 60,
48
+ /** Reciprocal rank fusion constant */
49
+ RRF_K_CONSTANT: 60,
50
+ };
51
+ /**
52
+ * Symbol Boosting Configuration
53
+ */
54
+ export const SYMBOL_BOOST_CONSTANTS = {
55
+ /** Boost applied when query matches function signature */
56
+ SIGNATURE_MATCH_BOOST: 0.3,
57
+ /** Boost applied when query matches neighbor functions */
58
+ NEIGHBOR_MATCH_BOOST: 0.15,
59
+ /** Maximum total boost from symbol matching */
60
+ MAX_SYMBOL_BOOST: 0.45,
61
+ /** Minimum token length for symbol matching */
62
+ MIN_TOKEN_LENGTH: 3,
63
+ /** Maximum parameters to extract from signature */
64
+ MAX_PARAMETERS: 12,
65
+ };
66
+ /**
67
+ * File Watcher Configuration
68
+ */
69
+ export const WATCHER_CONSTANTS = {
70
+ /** Default debounce interval in milliseconds */
71
+ DEFAULT_DEBOUNCE_MS: 500,
72
+ /** Minimum debounce interval in milliseconds */
73
+ MIN_DEBOUNCE_MS: 50,
74
+ /** Settle delay for watcher shutdown */
75
+ SETTLE_DELAY_MS: 200,
76
+ /** Stability threshold for file write detection */
77
+ STABILITY_THRESHOLD_MS: 100,
78
+ /** Poll interval for file stability check */
79
+ POLL_INTERVAL_MS: 50,
80
+ };
81
+ /**
82
+ * Rate Limiting Configuration
83
+ */
84
+ export const RATE_LIMIT_CONSTANTS = {
85
+ /** Retry delays for rate limit errors (milliseconds) */
86
+ RETRY_DELAYS: [1000, 2000, 5000, 10000],
87
+ /** Maximum queue size to prevent unbounded growth */
88
+ DEFAULT_MAX_QUEUE_SIZE: 10_000,
89
+ /** Delay buffer added to rate limit calculations */
90
+ DELAY_BUFFER_MS: 100,
91
+ };
92
+ /**
93
+ * Batch Processing Configuration
94
+ */
95
+ export const BATCH_CONSTANTS = {
96
+ /** Maximum retries for failed batches */
97
+ MAX_BATCH_RETRIES: 3,
98
+ /** Initial retry delay for batch failures */
99
+ INITIAL_RETRY_DELAY_MS: 1000,
100
+ /** Maximum tokens per batch for OpenAI */
101
+ MAX_BATCH_TOKENS: 100_000,
102
+ /** Maximum tokens per individual item */
103
+ MAX_ITEM_TOKENS: 8191,
104
+ /** Default batch size for embedding generation */
105
+ DEFAULT_BATCH_SIZE: 50,
106
+ };
107
+ /**
108
+ * Encryption Configuration
109
+ */
110
+ export const ENCRYPTION_CONSTANTS = {
111
+ /** Magic header for encrypted files */
112
+ MAGIC_HEADER: 'CVAULTE1',
113
+ /** Salt length in bytes for key derivation */
114
+ SALT_LENGTH: 16,
115
+ /** Initialization vector length in bytes */
116
+ IV_LENGTH: 12,
117
+ /** Authentication tag length in bytes */
118
+ TAG_LENGTH: 16,
119
+ /** HKDF info string for key derivation */
120
+ HKDF_INFO: 'codevault-chunk-v1',
121
+ /** Required encryption key length in bytes */
122
+ REQUIRED_KEY_LENGTH: 32,
123
+ };
124
+ /**
125
+ * LLM Configuration
126
+ */
127
+ export const LLM_CONSTANTS = {
128
+ /** Default temperature for multi-query generation */
129
+ MULTI_QUERY_TEMPERATURE: 0.3,
130
+ /** Default temperature for answer synthesis */
131
+ DEFAULT_TEMPERATURE: 0.7,
132
+ /** Maximum tokens for multi-query response */
133
+ MULTI_QUERY_MAX_TOKENS: 500,
134
+ /** Default maximum tokens for chat responses */
135
+ DEFAULT_CHAT_MAX_TOKENS: 4096,
136
+ /** Maximum context chunks for answer synthesis */
137
+ DEFAULT_MAX_CHUNKS: 10,
138
+ };
139
+ /**
140
+ * Chunking Configuration
141
+ */
142
+ export const CHUNKING_CONSTANTS = {
143
+ /** Minimum token count for a valid chunk */
144
+ MIN_CHUNK_TOKENS: 50,
145
+ /** Overlap percentage for line-based chunking */
146
+ LINE_OVERLAP_PERCENTAGE: 0.2,
147
+ /** Maximum snippet length for signature extraction */
148
+ MAX_SIGNATURE_SNIPPET: 400,
149
+ /** Maximum snippet length for call extraction */
150
+ MAX_CALL_SNIPPET: 120,
151
+ /** Maximum snippet length for return type detection */
152
+ MAX_RETURN_TYPE_SNIPPET: 80,
153
+ };
154
+ /**
155
+ * Conversational Chat Configuration
156
+ */
157
+ export const CONVERSATION_CONSTANTS = {
158
+ /** Maximum distinct chunks retained in conversation cache */
159
+ MAX_CONTEXT_CHUNKS: 200,
160
+ /** Characters to truncate prompts to */
161
+ PROMPT_TRUNCATE_LENGTH: 2000,
162
+ };
163
+ /**
164
+ * Documentation boost configuration
165
+ */
166
+ export const DOC_BOOST_CONSTANTS = {
167
+ /** Boost applied to README and documentation files */
168
+ DOC_FILE_BOOST: 0.15,
169
+ /** Intent match boost */
170
+ INTENT_MATCH_BOOST: 0.2,
171
+ /** Tag match boost per tag */
172
+ TAG_MATCH_BOOST: 0.1,
173
+ };
174
+ /**
175
+ * Backward compatibility exports
176
+ * These maintain the old flat constant names for existing code
177
+ */
178
+ // Chunking thresholds
179
+ export const SIZE_THRESHOLD = PARSING_CONSTANTS.SIZE_THRESHOLD;
180
+ export const CHUNK_SIZE = PARSING_CONSTANTS.CHUNK_SIZE;
181
+ export const MAX_CHUNK_SIZE = SEARCH_CONSTANTS.MAX_CHUNK_SIZE;
182
+ // Search and ranking constants
183
+ export const RRF_K = SEARCH_CONSTANTS.RRF_K_CONSTANT;
184
+ export const DOC_BOOST = DOC_BOOST_CONSTANTS.DOC_FILE_BOOST;
185
+ // Symbol graph constants
186
+ export const MAX_NEIGHBORS = SYMBOL_BOOST_CONSTANTS.MAX_PARAMETERS;
187
+ // UI truncation limits
188
+ export const PROMPT_TRUNCATE_LENGTH = CONVERSATION_CONSTANTS.PROMPT_TRUNCATE_LENGTH;
189
+ // Conversational context limits
190
+ export const CONVERSATION_MAX_CONTEXT_CHUNKS = CONVERSATION_CONSTANTS.MAX_CONTEXT_CHUNKS;
191
+ // Cache cleanup interval (in milliseconds)
192
+ export const DEFAULT_CACHE_CLEAR_INTERVAL_MS = CACHE_CONSTANTS.CACHE_CLEAR_INTERVAL_MS;
193
+ /**
194
+ * Character estimation (4 chars ≈ 1 token)
195
+ */
196
+ export const CHAR_TO_TOKEN_RATIO = 4;
197
+ /**
198
+ * Get all constants as a single object (useful for debugging)
199
+ */
200
+ export const ALL_CONSTANTS = {
201
+ PARSING: PARSING_CONSTANTS,
202
+ CACHE: CACHE_CONSTANTS,
203
+ SEARCH: SEARCH_CONSTANTS,
204
+ SYMBOL_BOOST: SYMBOL_BOOST_CONSTANTS,
205
+ WATCHER: WATCHER_CONSTANTS,
206
+ RATE_LIMIT: RATE_LIMIT_CONSTANTS,
207
+ BATCH: BATCH_CONSTANTS,
208
+ ENCRYPTION: ENCRYPTION_CONSTANTS,
209
+ LLM: LLM_CONSTANTS,
210
+ CHUNKING: CHUNKING_CONSTANTS,
211
+ CONVERSATION: CONVERSATION_CONSTANTS,
212
+ DOC_BOOST: DOC_BOOST_CONSTANTS,
213
+ };
214
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/config/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B;;;OAGG;IACH,cAAc,EAAE,MAAM;IAEtB;;;OAGG;IACH,UAAU,EAAE,MAAM;CACV,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,6DAA6D;IAC7D,mBAAmB,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,IAAI,EAAE,EAAE,CAAC;IAE/E,uDAAuD;IACvD,yBAAyB,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,MAAM,EAAE,EAAE,CAAC;IAExF,uEAAuE;IACvE,uBAAuB,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,8BAA8B,IAAI,SAAS,EAAE,EAAE,CAAC,EAAE,SAAS;CACjG,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,kDAAkD;IAClD,uBAAuB,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,IAAI,EAAE,EAAE,CAAC;IAEjF,gEAAgE;IAChE,cAAc,EAAE,OAAO;IAEvB,8CAA8C;IAC9C,oBAAoB,EAAE,EAAE;IAExB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AU,GAAG,iBAAiB,CAAC,UAAU,CAAC;AACvD,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAgB,CAAC,cAAc,CAAC;AAE9D,+BAA+B;AAC/B,MAAM,CAAC,MAAM,KAAK,GAAG,gBAAgB,CAAC,cAAc,CAAC;AACrD,MAAM,CAAC,MAAM,SAAS,GAAG,mBAAmB,CAAC,cAAc,CAAC;AAE5D,yBAAyB;AACzB,MAAM,CAAC,MAAM,aAAa,GAAG,sBAAsB,CAAC,cAAc,CAAC;AAEnE,uBAAuB;AACvB,MAAM,CAAC,MAAM,sBAAsB,GAAG,sBAAsB,CAAC,sBAAsB,CAAC;AAEpF,gCAAgC;AAChC,MAAM,CAAC,MAAM,+BAA+B,GAAG,sBAAsB,CAAC,kBAAkB,CAAC;AAEzF,2CAA2C;AAC3C,MAAM,CAAC,MAAM,+BAA+B,GAAG,eAAe,CAAC,uBAAuB,CAAC;AAEvF;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAErC;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,OAAO,EAAE,iBAAiB;IAC1B,KAAK,EAAE,eAAe;IACtB,MAAM,EAAE,gBAAgB;IACxB,YAAY,EAAE,sBAAsB;IACpC,OAAO,EAAE,iBAAiB;IAC1B,UAAU,EAAE,oBAAoB;IAChC,KAAK,EAAE,eAAe;IACtB,UAAU,EAAE,oBAAoB;IAChC,GAAG,EAAE,aAAa;IAClB,QAAQ,EAAE,kBAAkB;IAC5B,YAAY,EAAE,sBAAsB;IACpC,SAAS,EAAE,mBAAmB;CACtB,CAAC"}
@@ -0,0 +1,57 @@
1
+ import type { CodevaultConfig, ConfigSource } from './types.js';
2
+ /**
3
+ * Read global configuration from ~/.codevault/config.json
4
+ * @readonly Never modifies files
5
+ */
6
+ export declare function readGlobalConfig(): CodevaultConfig | null;
7
+ /**
8
+ * Read project-local configuration from .codevault/config.json
9
+ * @readonly Never modifies files
10
+ */
11
+ export declare function readProjectConfig(basePath?: string): CodevaultConfig | null;
12
+ /**
13
+ * Read configuration from environment variables
14
+ * @readonly Never modifies files or environment
15
+ */
16
+ export declare function readEnvConfig(): CodevaultConfig;
17
+ /**
18
+ * Load merged configuration from all sources
19
+ * Priority: env > project > global
20
+ *
21
+ * @readonly Never modifies config files
22
+ * @param basePath Project path for project-local config
23
+ * @returns Merged configuration (in-memory only)
24
+ */
25
+ export declare function loadConfig(basePath?: string): CodevaultConfig;
26
+ /**
27
+ * Get configuration sources for debugging
28
+ * @readonly Never modifies files
29
+ */
30
+ export declare function getConfigSources(basePath?: string): ConfigSource;
31
+ /**
32
+ * Write global configuration (CLI only)
33
+ * This is the ONLY function that writes to disk
34
+ */
35
+ export declare function saveGlobalConfig(config: CodevaultConfig): void;
36
+ /**
37
+ * Write project-local configuration (CLI only)
38
+ * This is the ONLY function that writes project config
39
+ */
40
+ export declare function saveProjectConfig(config: CodevaultConfig, basePath?: string): void;
41
+ /**
42
+ * Check if global config exists
43
+ */
44
+ export declare function hasGlobalConfig(): boolean;
45
+ /**
46
+ * Check if project config exists
47
+ */
48
+ export declare function hasProjectConfig(basePath?: string): boolean;
49
+ /**
50
+ * Get global config file path
51
+ */
52
+ export declare function getGlobalConfigPath(): string;
53
+ /**
54
+ * Get project config file path
55
+ */
56
+ export declare function getProjectConfigPath(basePath?: string): string;
57
+ //# sourceMappingURL=loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAOhE;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,eAAe,GAAG,IAAI,CAWzD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,SAAM,GAAG,eAAe,GAAG,IAAI,CAaxE;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,eAAe,CAyH/C;AA6ED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,QAAQ,SAAM,GAAG,eAAe,CAO1D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,SAAM,GAAG,YAAY,CAM7D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAQ9D;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,EAAE,QAAQ,SAAM,GAAG,IAAI,CAW/E;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAEzC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,SAAM,GAAG,OAAO,CAGxD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,SAAM,GAAG,MAAM,CAE3D"}