@ncukondo/reference-manager 0.3.0 → 0.5.0

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 (113) hide show
  1. package/README.md +282 -107
  2. package/dist/chunks/file-watcher-B-SiUw5f.js +1557 -0
  3. package/dist/chunks/file-watcher-B-SiUw5f.js.map +1 -0
  4. package/dist/chunks/{search-Be9vzUIH.js → index-DLIGxQaB.js} +399 -89
  5. package/dist/chunks/index-DLIGxQaB.js.map +1 -0
  6. package/dist/chunks/loader-DuzyKV70.js +394 -0
  7. package/dist/chunks/loader-DuzyKV70.js.map +1 -0
  8. package/dist/cli/commands/add.d.ts +3 -3
  9. package/dist/cli/commands/add.d.ts.map +1 -1
  10. package/dist/cli/commands/cite.d.ts +3 -3
  11. package/dist/cli/commands/cite.d.ts.map +1 -1
  12. package/dist/cli/commands/fulltext.d.ts +5 -34
  13. package/dist/cli/commands/fulltext.d.ts.map +1 -1
  14. package/dist/cli/commands/list.d.ts +3 -3
  15. package/dist/cli/commands/list.d.ts.map +1 -1
  16. package/dist/cli/commands/mcp.d.ts +16 -0
  17. package/dist/cli/commands/mcp.d.ts.map +1 -0
  18. package/dist/cli/commands/remove.d.ts +3 -3
  19. package/dist/cli/commands/remove.d.ts.map +1 -1
  20. package/dist/cli/commands/search.d.ts +3 -3
  21. package/dist/cli/commands/search.d.ts.map +1 -1
  22. package/dist/cli/commands/server.d.ts +2 -0
  23. package/dist/cli/commands/server.d.ts.map +1 -1
  24. package/dist/cli/commands/update.d.ts +3 -3
  25. package/dist/cli/commands/update.d.ts.map +1 -1
  26. package/dist/cli/execution-context.d.ts +23 -36
  27. package/dist/cli/execution-context.d.ts.map +1 -1
  28. package/dist/cli/index.d.ts.map +1 -1
  29. package/dist/cli/server-client.d.ts +24 -40
  30. package/dist/cli/server-client.d.ts.map +1 -1
  31. package/dist/cli/server-detection.d.ts +1 -0
  32. package/dist/cli/server-detection.d.ts.map +1 -1
  33. package/dist/cli.js +21061 -317
  34. package/dist/cli.js.map +1 -1
  35. package/dist/config/defaults.d.ts.map +1 -1
  36. package/dist/config/loader.d.ts.map +1 -1
  37. package/dist/config/schema.d.ts +2 -3
  38. package/dist/config/schema.d.ts.map +1 -1
  39. package/dist/core/csl-json/types.d.ts +3 -0
  40. package/dist/core/csl-json/types.d.ts.map +1 -1
  41. package/dist/core/library-interface.d.ts +100 -0
  42. package/dist/core/library-interface.d.ts.map +1 -0
  43. package/dist/core/library.d.ts +29 -46
  44. package/dist/core/library.d.ts.map +1 -1
  45. package/dist/features/operations/add.d.ts +2 -2
  46. package/dist/features/operations/add.d.ts.map +1 -1
  47. package/dist/features/operations/cite.d.ts +2 -2
  48. package/dist/features/operations/cite.d.ts.map +1 -1
  49. package/dist/features/operations/fulltext/attach.d.ts +47 -0
  50. package/dist/features/operations/fulltext/attach.d.ts.map +1 -0
  51. package/dist/features/operations/fulltext/detach.d.ts +38 -0
  52. package/dist/features/operations/fulltext/detach.d.ts.map +1 -0
  53. package/dist/features/operations/fulltext/get.d.ts +41 -0
  54. package/dist/features/operations/fulltext/get.d.ts.map +1 -0
  55. package/dist/features/operations/fulltext/index.d.ts +9 -0
  56. package/dist/features/operations/fulltext/index.d.ts.map +1 -0
  57. package/dist/features/operations/index.d.ts +15 -0
  58. package/dist/features/operations/index.d.ts.map +1 -0
  59. package/dist/features/operations/library-operations.d.ts +64 -0
  60. package/dist/features/operations/library-operations.d.ts.map +1 -0
  61. package/dist/features/operations/list.d.ts +2 -2
  62. package/dist/features/operations/list.d.ts.map +1 -1
  63. package/dist/features/operations/operations-library.d.ts +36 -0
  64. package/dist/features/operations/operations-library.d.ts.map +1 -0
  65. package/dist/features/operations/remove.d.ts +4 -4
  66. package/dist/features/operations/remove.d.ts.map +1 -1
  67. package/dist/features/operations/search.d.ts +2 -2
  68. package/dist/features/operations/search.d.ts.map +1 -1
  69. package/dist/features/operations/update.d.ts +2 -2
  70. package/dist/features/operations/update.d.ts.map +1 -1
  71. package/dist/features/search/matcher.d.ts.map +1 -1
  72. package/dist/features/search/normalizer.d.ts +12 -0
  73. package/dist/features/search/normalizer.d.ts.map +1 -1
  74. package/dist/features/search/tokenizer.d.ts.map +1 -1
  75. package/dist/features/search/types.d.ts +1 -1
  76. package/dist/features/search/types.d.ts.map +1 -1
  77. package/dist/features/search/uppercase.d.ts +41 -0
  78. package/dist/features/search/uppercase.d.ts.map +1 -0
  79. package/dist/index.js +24 -192
  80. package/dist/index.js.map +1 -1
  81. package/dist/mcp/context.d.ts +19 -0
  82. package/dist/mcp/context.d.ts.map +1 -0
  83. package/dist/mcp/index.d.ts +20 -0
  84. package/dist/mcp/index.d.ts.map +1 -0
  85. package/dist/mcp/resources/index.d.ts +10 -0
  86. package/dist/mcp/resources/index.d.ts.map +1 -0
  87. package/dist/mcp/resources/library.d.ts +26 -0
  88. package/dist/mcp/resources/library.d.ts.map +1 -0
  89. package/dist/mcp/tools/add.d.ts +17 -0
  90. package/dist/mcp/tools/add.d.ts.map +1 -0
  91. package/dist/mcp/tools/cite.d.ts +15 -0
  92. package/dist/mcp/tools/cite.d.ts.map +1 -0
  93. package/dist/mcp/tools/fulltext.d.ts +51 -0
  94. package/dist/mcp/tools/fulltext.d.ts.map +1 -0
  95. package/dist/mcp/tools/index.d.ts +12 -0
  96. package/dist/mcp/tools/index.d.ts.map +1 -0
  97. package/dist/mcp/tools/list.d.ts +13 -0
  98. package/dist/mcp/tools/list.d.ts.map +1 -0
  99. package/dist/mcp/tools/remove.d.ts +19 -0
  100. package/dist/mcp/tools/remove.d.ts.map +1 -0
  101. package/dist/mcp/tools/search.d.ts +13 -0
  102. package/dist/mcp/tools/search.d.ts.map +1 -0
  103. package/dist/server/index.d.ts +23 -1
  104. package/dist/server/index.d.ts.map +1 -1
  105. package/dist/server/routes/references.d.ts.map +1 -1
  106. package/dist/server.js +5 -271
  107. package/dist/server.js.map +1 -1
  108. package/package.json +2 -1
  109. package/dist/chunks/detector-DHztTaFY.js +0 -619
  110. package/dist/chunks/detector-DHztTaFY.js.map +0 -1
  111. package/dist/chunks/loader-mQ25o6cV.js +0 -1054
  112. package/dist/chunks/loader-mQ25o6cV.js.map +0 -1
  113. package/dist/chunks/search-Be9vzUIH.js.map +0 -1
@@ -0,0 +1,394 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { homedir, tmpdir } from "node:os";
3
+ import { join } from "node:path";
4
+ import { parse } from "@iarna/toml";
5
+ import { z } from "zod";
6
+ const logLevelSchema = z.enum(["silent", "info", "debug"]);
7
+ const backupConfigSchema = z.object({
8
+ maxGenerations: z.number().int().positive(),
9
+ maxAgeDays: z.number().int().positive(),
10
+ directory: z.string().min(1)
11
+ });
12
+ const watchConfigSchema = z.object({
13
+ debounceMs: z.number().int().nonnegative(),
14
+ pollIntervalMs: z.number().int().positive(),
15
+ retryIntervalMs: z.number().int().positive(),
16
+ maxRetries: z.number().int().nonnegative()
17
+ });
18
+ const serverConfigSchema = z.object({
19
+ autoStart: z.boolean(),
20
+ autoStopMinutes: z.number().int().nonnegative()
21
+ });
22
+ const citationFormatSchema = z.enum(["text", "html", "rtf"]);
23
+ const citationConfigSchema = z.object({
24
+ defaultStyle: z.string(),
25
+ cslDirectory: z.array(z.string()),
26
+ defaultLocale: z.string(),
27
+ defaultFormat: citationFormatSchema
28
+ });
29
+ const pubmedConfigSchema = z.object({
30
+ email: z.string().optional(),
31
+ apiKey: z.string().optional()
32
+ });
33
+ const fulltextConfigSchema = z.object({
34
+ directory: z.string().min(1)
35
+ });
36
+ const configSchema = z.object({
37
+ library: z.string().min(1),
38
+ logLevel: logLevelSchema,
39
+ backup: backupConfigSchema,
40
+ watch: watchConfigSchema,
41
+ server: serverConfigSchema,
42
+ citation: citationConfigSchema,
43
+ pubmed: pubmedConfigSchema,
44
+ fulltext: fulltextConfigSchema
45
+ });
46
+ const partialConfigSchema = z.object({
47
+ library: z.string().min(1).optional(),
48
+ logLevel: logLevelSchema.optional(),
49
+ log_level: logLevelSchema.optional(),
50
+ // snake_case support
51
+ backup: z.object({
52
+ maxGenerations: z.number().int().positive().optional(),
53
+ max_generations: z.number().int().positive().optional(),
54
+ maxAgeDays: z.number().int().positive().optional(),
55
+ max_age_days: z.number().int().positive().optional(),
56
+ directory: z.string().min(1).optional()
57
+ }).optional(),
58
+ watch: z.object({
59
+ debounceMs: z.number().int().nonnegative().optional(),
60
+ debounce_ms: z.number().int().nonnegative().optional(),
61
+ pollIntervalMs: z.number().int().positive().optional(),
62
+ poll_interval_ms: z.number().int().positive().optional(),
63
+ retryIntervalMs: z.number().int().positive().optional(),
64
+ retry_interval_ms: z.number().int().positive().optional(),
65
+ maxRetries: z.number().int().nonnegative().optional(),
66
+ max_retries: z.number().int().nonnegative().optional()
67
+ }).optional(),
68
+ server: z.object({
69
+ autoStart: z.boolean().optional(),
70
+ auto_start: z.boolean().optional(),
71
+ autoStopMinutes: z.number().int().nonnegative().optional(),
72
+ auto_stop_minutes: z.number().int().nonnegative().optional()
73
+ }).optional(),
74
+ citation: z.object({
75
+ defaultStyle: z.string().optional(),
76
+ default_style: z.string().optional(),
77
+ cslDirectory: z.union([z.string(), z.array(z.string())]).optional(),
78
+ csl_directory: z.union([z.string(), z.array(z.string())]).optional(),
79
+ defaultLocale: z.string().optional(),
80
+ default_locale: z.string().optional(),
81
+ defaultFormat: citationFormatSchema.optional(),
82
+ default_format: citationFormatSchema.optional()
83
+ }).optional(),
84
+ pubmed: z.object({
85
+ email: z.string().optional(),
86
+ apiKey: z.string().optional(),
87
+ api_key: z.string().optional()
88
+ }).optional(),
89
+ fulltext: z.object({
90
+ directory: z.string().min(1).optional()
91
+ }).optional()
92
+ }).passthrough();
93
+ function normalizeBackupConfig(backup) {
94
+ const normalized = {};
95
+ const maxGenerations = backup.maxGenerations ?? backup.max_generations;
96
+ if (maxGenerations !== void 0) {
97
+ normalized.maxGenerations = maxGenerations;
98
+ }
99
+ const maxAgeDays = backup.maxAgeDays ?? backup.max_age_days;
100
+ if (maxAgeDays !== void 0) {
101
+ normalized.maxAgeDays = maxAgeDays;
102
+ }
103
+ if (backup.directory !== void 0) {
104
+ normalized.directory = backup.directory;
105
+ }
106
+ return Object.keys(normalized).length > 0 ? normalized : void 0;
107
+ }
108
+ function normalizeWatchConfig(watch) {
109
+ const normalized = {};
110
+ const debounceMs = watch.debounceMs ?? watch.debounce_ms;
111
+ if (debounceMs !== void 0) {
112
+ normalized.debounceMs = debounceMs;
113
+ }
114
+ const pollIntervalMs = watch.pollIntervalMs ?? watch.poll_interval_ms;
115
+ if (pollIntervalMs !== void 0) {
116
+ normalized.pollIntervalMs = pollIntervalMs;
117
+ }
118
+ const retryIntervalMs = watch.retryIntervalMs ?? watch.retry_interval_ms;
119
+ if (retryIntervalMs !== void 0) {
120
+ normalized.retryIntervalMs = retryIntervalMs;
121
+ }
122
+ const maxRetries = watch.maxRetries ?? watch.max_retries;
123
+ if (maxRetries !== void 0) {
124
+ normalized.maxRetries = maxRetries;
125
+ }
126
+ return Object.keys(normalized).length > 0 ? normalized : void 0;
127
+ }
128
+ function normalizeServerConfig(server) {
129
+ const normalized = {};
130
+ const autoStart = server.autoStart ?? server.auto_start;
131
+ if (autoStart !== void 0) {
132
+ normalized.autoStart = autoStart;
133
+ }
134
+ const autoStopMinutes = server.autoStopMinutes ?? server.auto_stop_minutes;
135
+ if (autoStopMinutes !== void 0) {
136
+ normalized.autoStopMinutes = autoStopMinutes;
137
+ }
138
+ return Object.keys(normalized).length > 0 ? normalized : void 0;
139
+ }
140
+ function normalizeCitationConfig(citation) {
141
+ const normalized = {};
142
+ const defaultStyle = citation.defaultStyle ?? citation.default_style;
143
+ if (defaultStyle !== void 0) {
144
+ normalized.defaultStyle = defaultStyle;
145
+ }
146
+ const cslDirectory = citation.cslDirectory ?? citation.csl_directory;
147
+ if (cslDirectory !== void 0) {
148
+ normalized.cslDirectory = Array.isArray(cslDirectory) ? cslDirectory : [cslDirectory];
149
+ }
150
+ const defaultLocale = citation.defaultLocale ?? citation.default_locale;
151
+ if (defaultLocale !== void 0) {
152
+ normalized.defaultLocale = defaultLocale;
153
+ }
154
+ const defaultFormat = citation.defaultFormat ?? citation.default_format;
155
+ if (defaultFormat !== void 0) {
156
+ normalized.defaultFormat = defaultFormat;
157
+ }
158
+ return Object.keys(normalized).length > 0 ? normalized : void 0;
159
+ }
160
+ function normalizePubmedConfig(pubmed) {
161
+ const normalized = {};
162
+ if (pubmed.email !== void 0) {
163
+ normalized.email = pubmed.email;
164
+ }
165
+ const apiKey = pubmed.apiKey ?? pubmed.api_key;
166
+ if (apiKey !== void 0) {
167
+ normalized.apiKey = apiKey;
168
+ }
169
+ return Object.keys(normalized).length > 0 ? normalized : void 0;
170
+ }
171
+ function normalizePartialConfig(partial) {
172
+ const normalized = {};
173
+ if (partial.library !== void 0) {
174
+ normalized.library = partial.library;
175
+ }
176
+ const logLevel = partial.logLevel ?? partial.log_level;
177
+ if (logLevel !== void 0) {
178
+ normalized.logLevel = logLevel;
179
+ }
180
+ const backup = partial.backup !== void 0 ? normalizeBackupConfig(partial.backup) : void 0;
181
+ if (backup) {
182
+ normalized.backup = backup;
183
+ }
184
+ const watch = partial.watch !== void 0 ? normalizeWatchConfig(partial.watch) : void 0;
185
+ if (watch) {
186
+ normalized.watch = watch;
187
+ }
188
+ const server = partial.server !== void 0 ? normalizeServerConfig(partial.server) : void 0;
189
+ if (server) {
190
+ normalized.server = server;
191
+ }
192
+ const citation = partial.citation !== void 0 ? normalizeCitationConfig(partial.citation) : void 0;
193
+ if (citation) {
194
+ normalized.citation = citation;
195
+ }
196
+ const pubmed = partial.pubmed !== void 0 ? normalizePubmedConfig(partial.pubmed) : void 0;
197
+ if (pubmed) {
198
+ normalized.pubmed = pubmed;
199
+ }
200
+ const fulltext = partial.fulltext !== void 0 ? normalizeFulltextConfig(partial.fulltext) : void 0;
201
+ if (fulltext) {
202
+ normalized.fulltext = fulltext;
203
+ }
204
+ return normalized;
205
+ }
206
+ function normalizeFulltextConfig(fulltext) {
207
+ const normalized = {};
208
+ if (fulltext.directory !== void 0) {
209
+ normalized.directory = fulltext.directory;
210
+ }
211
+ return Object.keys(normalized).length > 0 ? normalized : void 0;
212
+ }
213
+ function getDefaultBackupDirectory() {
214
+ return join(tmpdir(), "reference-manager", "backups");
215
+ }
216
+ function getDefaultLibraryPath() {
217
+ return join(homedir(), ".reference-manager", "csl.library.json");
218
+ }
219
+ function getDefaultUserConfigPath() {
220
+ return join(homedir(), ".reference-manager", "config.toml");
221
+ }
222
+ function getDefaultCurrentDirConfigFilename() {
223
+ return ".reference-manager.config.toml";
224
+ }
225
+ function getDefaultCslDirectory() {
226
+ return join(homedir(), ".reference-manager", "csl");
227
+ }
228
+ function getDefaultFulltextDirectory() {
229
+ return join(homedir(), ".reference-manager", "fulltext");
230
+ }
231
+ const defaultConfig = {
232
+ library: getDefaultLibraryPath(),
233
+ logLevel: "info",
234
+ backup: {
235
+ maxGenerations: 50,
236
+ maxAgeDays: 365,
237
+ directory: getDefaultBackupDirectory()
238
+ },
239
+ watch: {
240
+ debounceMs: 500,
241
+ pollIntervalMs: 5e3,
242
+ retryIntervalMs: 200,
243
+ maxRetries: 10
244
+ },
245
+ server: {
246
+ autoStart: false,
247
+ autoStopMinutes: 0
248
+ },
249
+ citation: {
250
+ defaultStyle: "apa",
251
+ cslDirectory: [getDefaultCslDirectory()],
252
+ defaultLocale: "en-US",
253
+ defaultFormat: "text"
254
+ },
255
+ pubmed: {
256
+ email: void 0,
257
+ apiKey: void 0
258
+ },
259
+ fulltext: {
260
+ directory: getDefaultFulltextDirectory()
261
+ }
262
+ };
263
+ function loadTOMLFile(path) {
264
+ if (!existsSync(path)) {
265
+ return null;
266
+ }
267
+ try {
268
+ const content = readFileSync(path, "utf-8");
269
+ const parsed = parse(content);
270
+ const validated = partialConfigSchema.parse(parsed);
271
+ return validated;
272
+ } catch (error) {
273
+ throw new Error(
274
+ `Failed to load config from ${path}: ${error instanceof Error ? error.message : String(error)}`
275
+ );
276
+ }
277
+ }
278
+ function mergeConfigs(base, ...overrides) {
279
+ const result = { ...base };
280
+ const sectionKeys = ["backup", "watch", "server", "citation", "pubmed", "fulltext"];
281
+ for (const override of overrides) {
282
+ if (!override) continue;
283
+ if (override.library !== void 0) {
284
+ result.library = override.library;
285
+ }
286
+ if (override.logLevel !== void 0) {
287
+ result.logLevel = override.logLevel;
288
+ }
289
+ for (const key of sectionKeys) {
290
+ if (override[key] !== void 0) {
291
+ result[key] = {
292
+ ...result[key],
293
+ ...override[key]
294
+ };
295
+ }
296
+ }
297
+ }
298
+ return result;
299
+ }
300
+ function fillDefaults(partial) {
301
+ return {
302
+ library: partial.library ?? defaultConfig.library,
303
+ logLevel: partial.logLevel ?? defaultConfig.logLevel,
304
+ backup: {
305
+ maxGenerations: partial.backup?.maxGenerations ?? defaultConfig.backup.maxGenerations,
306
+ maxAgeDays: partial.backup?.maxAgeDays ?? defaultConfig.backup.maxAgeDays,
307
+ directory: partial.backup?.directory ?? defaultConfig.backup.directory
308
+ },
309
+ watch: {
310
+ debounceMs: partial.watch?.debounceMs ?? defaultConfig.watch.debounceMs,
311
+ pollIntervalMs: partial.watch?.pollIntervalMs ?? defaultConfig.watch.pollIntervalMs,
312
+ retryIntervalMs: partial.watch?.retryIntervalMs ?? defaultConfig.watch.retryIntervalMs,
313
+ maxRetries: partial.watch?.maxRetries ?? defaultConfig.watch.maxRetries
314
+ },
315
+ server: {
316
+ autoStart: partial.server?.autoStart ?? defaultConfig.server.autoStart,
317
+ autoStopMinutes: partial.server?.autoStopMinutes ?? defaultConfig.server.autoStopMinutes
318
+ },
319
+ citation: fillCitationDefaults(partial.citation),
320
+ pubmed: fillPubmedDefaults(partial.pubmed),
321
+ fulltext: fillFulltextDefaults(partial.fulltext)
322
+ };
323
+ }
324
+ function fillCitationDefaults(partial) {
325
+ return {
326
+ defaultStyle: partial?.defaultStyle ?? defaultConfig.citation.defaultStyle,
327
+ cslDirectory: partial?.cslDirectory ?? defaultConfig.citation.cslDirectory,
328
+ defaultLocale: partial?.defaultLocale ?? defaultConfig.citation.defaultLocale,
329
+ defaultFormat: partial?.defaultFormat ?? defaultConfig.citation.defaultFormat
330
+ };
331
+ }
332
+ function fillPubmedDefaults(partial) {
333
+ const email = process.env.PUBMED_EMAIL ?? partial?.email ?? defaultConfig.pubmed.email;
334
+ const apiKey = process.env.PUBMED_API_KEY ?? partial?.apiKey ?? defaultConfig.pubmed.apiKey;
335
+ return {
336
+ email,
337
+ apiKey
338
+ };
339
+ }
340
+ function expandTilde(path) {
341
+ if (path.startsWith("~/")) {
342
+ return join(homedir(), path.slice(2));
343
+ }
344
+ return path;
345
+ }
346
+ function fillFulltextDefaults(partial) {
347
+ const envDir = process.env.REFERENCE_MANAGER_FULLTEXT_DIR;
348
+ const directory = envDir ?? partial?.directory ?? defaultConfig.fulltext.directory;
349
+ return {
350
+ directory: expandTilde(directory)
351
+ };
352
+ }
353
+ function loadConfig(options = {}) {
354
+ const cwd = options.cwd ?? process.cwd();
355
+ const userConfigPath = options.userConfigPath ?? getDefaultUserConfigPath();
356
+ const userConfig = loadTOMLFile(userConfigPath);
357
+ const envConfigPath = process.env.REFERENCE_MANAGER_CONFIG;
358
+ const envConfig = envConfigPath ? loadTOMLFile(envConfigPath) : null;
359
+ const currentConfigPath = join(cwd, getDefaultCurrentDirConfigFilename());
360
+ const currentConfig = loadTOMLFile(currentConfigPath);
361
+ const normalizedUser = userConfig ? normalizePartialConfig(userConfig) : null;
362
+ const normalizedEnv = envConfig ? normalizePartialConfig(envConfig) : null;
363
+ const normalizedCurrent = currentConfig ? normalizePartialConfig(currentConfig) : null;
364
+ const merged = mergeConfigs(
365
+ {},
366
+ normalizedUser,
367
+ normalizedEnv,
368
+ normalizedCurrent,
369
+ options.overrides
370
+ );
371
+ const config = fillDefaults(merged);
372
+ try {
373
+ return configSchema.parse(config);
374
+ } catch (error) {
375
+ throw new Error(
376
+ `Invalid configuration: ${error instanceof Error ? error.message : String(error)}`
377
+ );
378
+ }
379
+ }
380
+ export {
381
+ getDefaultCurrentDirConfigFilename as a,
382
+ backupConfigSchema as b,
383
+ configSchema as c,
384
+ defaultConfig as d,
385
+ getDefaultLibraryPath as e,
386
+ getDefaultUserConfigPath as f,
387
+ getDefaultBackupDirectory as g,
388
+ logLevelSchema as h,
389
+ loadConfig as l,
390
+ normalizePartialConfig as n,
391
+ partialConfigSchema as p,
392
+ watchConfigSchema as w
393
+ };
394
+ //# sourceMappingURL=loader-DuzyKV70.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader-DuzyKV70.js","sources":["../../src/config/schema.ts","../../src/config/defaults.ts","../../src/config/loader.ts"],"sourcesContent":["/**\n * Configuration schema using Zod\n */\n\nimport { z } from \"zod\";\n\n/**\n * Log level schema\n */\nexport const logLevelSchema = z.enum([\"silent\", \"info\", \"debug\"]);\n\n/**\n * Backup configuration schema\n */\nexport const backupConfigSchema = z.object({\n maxGenerations: z.number().int().positive(),\n maxAgeDays: z.number().int().positive(),\n directory: z.string().min(1),\n});\n\n/**\n * File watching configuration schema\n * Note: File watching is always enabled in server mode (HTTP/MCP).\n * CLI mode does not use file watching.\n */\nexport const watchConfigSchema = z.object({\n debounceMs: z.number().int().nonnegative(),\n pollIntervalMs: z.number().int().positive(),\n retryIntervalMs: z.number().int().positive(),\n maxRetries: z.number().int().nonnegative(),\n});\n\n/**\n * Server configuration schema\n */\nexport const serverConfigSchema = z.object({\n autoStart: z.boolean(),\n autoStopMinutes: z.number().int().nonnegative(),\n});\n\n/**\n * Citation format schema\n */\nexport const citationFormatSchema = z.enum([\"text\", \"html\", \"rtf\"]);\n\n/**\n * Citation configuration schema\n */\nexport const citationConfigSchema = z.object({\n defaultStyle: z.string(),\n cslDirectory: z.array(z.string()),\n defaultLocale: z.string(),\n defaultFormat: citationFormatSchema,\n});\n\n/**\n * PubMed API configuration schema\n */\nexport const pubmedConfigSchema = z.object({\n email: z.string().optional(),\n apiKey: z.string().optional(),\n});\n\n/**\n * Fulltext storage configuration schema\n */\nexport const fulltextConfigSchema = z.object({\n directory: z.string().min(1),\n});\n\n/**\n * Complete configuration schema\n */\nexport const configSchema = z.object({\n library: z.string().min(1),\n logLevel: logLevelSchema,\n backup: backupConfigSchema,\n watch: watchConfigSchema,\n server: serverConfigSchema,\n citation: citationConfigSchema,\n pubmed: pubmedConfigSchema,\n fulltext: fulltextConfigSchema,\n});\n\n/**\n * Partial configuration schema (for TOML files)\n * Supports both camelCase and snake_case field names\n */\nexport const partialConfigSchema = z\n .object({\n library: z.string().min(1).optional(),\n logLevel: logLevelSchema.optional(),\n log_level: logLevelSchema.optional(), // snake_case support\n backup: z\n .object({\n maxGenerations: z.number().int().positive().optional(),\n max_generations: z.number().int().positive().optional(),\n maxAgeDays: z.number().int().positive().optional(),\n max_age_days: z.number().int().positive().optional(),\n directory: z.string().min(1).optional(),\n })\n .optional(),\n watch: z\n .object({\n debounceMs: z.number().int().nonnegative().optional(),\n debounce_ms: z.number().int().nonnegative().optional(),\n pollIntervalMs: z.number().int().positive().optional(),\n poll_interval_ms: z.number().int().positive().optional(),\n retryIntervalMs: z.number().int().positive().optional(),\n retry_interval_ms: z.number().int().positive().optional(),\n maxRetries: z.number().int().nonnegative().optional(),\n max_retries: z.number().int().nonnegative().optional(),\n })\n .optional(),\n server: z\n .object({\n autoStart: z.boolean().optional(),\n auto_start: z.boolean().optional(),\n autoStopMinutes: z.number().int().nonnegative().optional(),\n auto_stop_minutes: z.number().int().nonnegative().optional(),\n })\n .optional(),\n citation: z\n .object({\n defaultStyle: z.string().optional(),\n default_style: z.string().optional(),\n cslDirectory: z.union([z.string(), z.array(z.string())]).optional(),\n csl_directory: z.union([z.string(), z.array(z.string())]).optional(),\n defaultLocale: z.string().optional(),\n default_locale: z.string().optional(),\n defaultFormat: citationFormatSchema.optional(),\n default_format: citationFormatSchema.optional(),\n })\n .optional(),\n pubmed: z\n .object({\n email: z.string().optional(),\n apiKey: z.string().optional(),\n api_key: z.string().optional(),\n })\n .optional(),\n fulltext: z\n .object({\n directory: z.string().min(1).optional(),\n })\n .optional(),\n })\n .passthrough(); // Allow unknown fields in TOML files\n\n/**\n * Inferred types from schemas\n */\nexport type LogLevel = z.infer<typeof logLevelSchema>;\nexport type BackupConfig = z.infer<typeof backupConfigSchema>;\nexport type WatchConfig = z.infer<typeof watchConfigSchema>;\nexport type ServerConfig = z.infer<typeof serverConfigSchema>;\nexport type CitationFormat = z.infer<typeof citationFormatSchema>;\nexport type CitationConfig = z.infer<typeof citationConfigSchema>;\nexport type PubmedConfig = z.infer<typeof pubmedConfigSchema>;\nexport type FulltextConfig = z.infer<typeof fulltextConfigSchema>;\nexport type Config = z.infer<typeof configSchema>;\nexport type PartialConfig = z.infer<typeof partialConfigSchema>;\n\n/**\n * Deep partial type for Config\n */\nexport type DeepPartialConfig = {\n library?: string;\n logLevel?: LogLevel;\n backup?: Partial<BackupConfig>;\n watch?: Partial<WatchConfig>;\n server?: Partial<ServerConfig>;\n citation?: Partial<CitationConfig>;\n pubmed?: Partial<PubmedConfig>;\n fulltext?: Partial<FulltextConfig>;\n};\n\n/**\n * Normalize backup configuration from snake_case to camelCase\n */\nfunction normalizeBackupConfig(\n backup: Partial<{\n maxGenerations?: number;\n max_generations?: number;\n maxAgeDays?: number;\n max_age_days?: number;\n directory?: string;\n }>\n): Partial<BackupConfig> | undefined {\n const normalized: Partial<BackupConfig> = {};\n\n const maxGenerations = backup.maxGenerations ?? backup.max_generations;\n if (maxGenerations !== undefined) {\n normalized.maxGenerations = maxGenerations;\n }\n\n const maxAgeDays = backup.maxAgeDays ?? backup.max_age_days;\n if (maxAgeDays !== undefined) {\n normalized.maxAgeDays = maxAgeDays;\n }\n\n if (backup.directory !== undefined) {\n normalized.directory = backup.directory;\n }\n\n return Object.keys(normalized).length > 0 ? normalized : undefined;\n}\n\n/**\n * Normalize watch configuration from snake_case to camelCase\n */\nfunction normalizeWatchConfig(\n watch: Partial<{\n debounceMs?: number;\n debounce_ms?: number;\n pollIntervalMs?: number;\n poll_interval_ms?: number;\n retryIntervalMs?: number;\n retry_interval_ms?: number;\n maxRetries?: number;\n max_retries?: number;\n }>\n): Partial<WatchConfig> | undefined {\n const normalized: Partial<WatchConfig> = {};\n\n const debounceMs = watch.debounceMs ?? watch.debounce_ms;\n if (debounceMs !== undefined) {\n normalized.debounceMs = debounceMs;\n }\n\n const pollIntervalMs = watch.pollIntervalMs ?? watch.poll_interval_ms;\n if (pollIntervalMs !== undefined) {\n normalized.pollIntervalMs = pollIntervalMs;\n }\n\n const retryIntervalMs = watch.retryIntervalMs ?? watch.retry_interval_ms;\n if (retryIntervalMs !== undefined) {\n normalized.retryIntervalMs = retryIntervalMs;\n }\n\n const maxRetries = watch.maxRetries ?? watch.max_retries;\n if (maxRetries !== undefined) {\n normalized.maxRetries = maxRetries;\n }\n\n return Object.keys(normalized).length > 0 ? normalized : undefined;\n}\n\n/**\n * Normalize server configuration from snake_case to camelCase\n */\nfunction normalizeServerConfig(\n server: Partial<{\n autoStart?: boolean;\n auto_start?: boolean;\n autoStopMinutes?: number;\n auto_stop_minutes?: number;\n }>\n): Partial<ServerConfig> | undefined {\n const normalized: Partial<ServerConfig> = {};\n\n const autoStart = server.autoStart ?? server.auto_start;\n if (autoStart !== undefined) {\n normalized.autoStart = autoStart;\n }\n\n const autoStopMinutes = server.autoStopMinutes ?? server.auto_stop_minutes;\n if (autoStopMinutes !== undefined) {\n normalized.autoStopMinutes = autoStopMinutes;\n }\n\n return Object.keys(normalized).length > 0 ? normalized : undefined;\n}\n\n/**\n * Normalize citation configuration from snake_case to camelCase\n */\nfunction normalizeCitationConfig(\n citation: Partial<{\n defaultStyle?: string;\n default_style?: string;\n cslDirectory?: string | string[];\n csl_directory?: string | string[];\n defaultLocale?: string;\n default_locale?: string;\n defaultFormat?: CitationFormat;\n default_format?: CitationFormat;\n }>\n): Partial<CitationConfig> | undefined {\n const normalized: Partial<CitationConfig> = {};\n\n const defaultStyle = citation.defaultStyle ?? citation.default_style;\n if (defaultStyle !== undefined) {\n normalized.defaultStyle = defaultStyle;\n }\n\n const cslDirectory = citation.cslDirectory ?? citation.csl_directory;\n if (cslDirectory !== undefined) {\n // Normalize to array: string -> [string]\n normalized.cslDirectory = Array.isArray(cslDirectory) ? cslDirectory : [cslDirectory];\n }\n\n const defaultLocale = citation.defaultLocale ?? citation.default_locale;\n if (defaultLocale !== undefined) {\n normalized.defaultLocale = defaultLocale;\n }\n\n const defaultFormat = citation.defaultFormat ?? citation.default_format;\n if (defaultFormat !== undefined) {\n normalized.defaultFormat = defaultFormat;\n }\n\n return Object.keys(normalized).length > 0 ? normalized : undefined;\n}\n\n/**\n * Normalize pubmed configuration from snake_case to camelCase\n */\nfunction normalizePubmedConfig(\n pubmed: Partial<{\n email?: string;\n apiKey?: string;\n api_key?: string;\n }>\n): Partial<PubmedConfig> | undefined {\n const normalized: Partial<PubmedConfig> = {};\n\n if (pubmed.email !== undefined) {\n normalized.email = pubmed.email;\n }\n\n const apiKey = pubmed.apiKey ?? pubmed.api_key;\n if (apiKey !== undefined) {\n normalized.apiKey = apiKey;\n }\n\n return Object.keys(normalized).length > 0 ? normalized : undefined;\n}\n\n/**\n * Normalize snake_case fields to camelCase\n */\nexport function normalizePartialConfig(partial: PartialConfig): DeepPartialConfig {\n const normalized: DeepPartialConfig = {};\n\n // Library\n if (partial.library !== undefined) {\n normalized.library = partial.library;\n }\n\n // Log level (prefer camelCase, fallback to snake_case)\n const logLevel = partial.logLevel ?? partial.log_level;\n if (logLevel !== undefined) {\n normalized.logLevel = logLevel;\n }\n\n // Backup\n const backup =\n partial.backup !== undefined\n ? normalizeBackupConfig(partial.backup as Parameters<typeof normalizeBackupConfig>[0])\n : undefined;\n if (backup) {\n normalized.backup = backup;\n }\n\n // Watch\n const watch =\n partial.watch !== undefined\n ? normalizeWatchConfig(partial.watch as Parameters<typeof normalizeWatchConfig>[0])\n : undefined;\n if (watch) {\n normalized.watch = watch;\n }\n\n // Server\n const server =\n partial.server !== undefined\n ? normalizeServerConfig(partial.server as Parameters<typeof normalizeServerConfig>[0])\n : undefined;\n if (server) {\n normalized.server = server;\n }\n\n // Citation\n const citation =\n partial.citation !== undefined\n ? normalizeCitationConfig(partial.citation as Parameters<typeof normalizeCitationConfig>[0])\n : undefined;\n if (citation) {\n normalized.citation = citation;\n }\n\n // PubMed\n const pubmed =\n partial.pubmed !== undefined\n ? normalizePubmedConfig(partial.pubmed as Parameters<typeof normalizePubmedConfig>[0])\n : undefined;\n if (pubmed) {\n normalized.pubmed = pubmed;\n }\n\n // Fulltext\n const fulltext =\n partial.fulltext !== undefined ? normalizeFulltextConfig(partial.fulltext) : undefined;\n if (fulltext) {\n normalized.fulltext = fulltext;\n }\n\n return normalized;\n}\n\n/**\n * Normalize fulltext configuration\n */\nfunction normalizeFulltextConfig(fulltext: {\n directory?: string | undefined;\n}): Partial<FulltextConfig> | undefined {\n const normalized: Partial<FulltextConfig> = {};\n\n if (fulltext.directory !== undefined) {\n normalized.directory = fulltext.directory;\n }\n\n return Object.keys(normalized).length > 0 ? normalized : undefined;\n}\n","/**\n * Default configuration values\n */\n\nimport { tmpdir } from \"node:os\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport type { Config } from \"./schema.js\";\n\n/**\n * Get the default backup directory\n * Uses $TMPDIR/reference-manager/backups/\n */\nexport function getDefaultBackupDirectory(): string {\n return join(tmpdir(), \"reference-manager\", \"backups\");\n}\n\n/**\n * Get the default library path\n * Uses ~/.reference-manager/csl.library.json\n */\nexport function getDefaultLibraryPath(): string {\n return join(homedir(), \".reference-manager\", \"csl.library.json\");\n}\n\n/**\n * Get the default user config path\n * Uses ~/.reference-manager/config.toml\n */\nexport function getDefaultUserConfigPath(): string {\n return join(homedir(), \".reference-manager\", \"config.toml\");\n}\n\n/**\n * Get the default current directory config filename\n * Uses .reference-manager.config.toml\n */\nexport function getDefaultCurrentDirConfigFilename(): string {\n return \".reference-manager.config.toml\";\n}\n\n/**\n * Get the default CSL directory\n * Uses ~/.reference-manager/csl/\n */\nexport function getDefaultCslDirectory(): string {\n return join(homedir(), \".reference-manager\", \"csl\");\n}\n\n/**\n * Get the default fulltext directory\n * Uses ~/.reference-manager/fulltext/\n */\nexport function getDefaultFulltextDirectory(): string {\n return join(homedir(), \".reference-manager\", \"fulltext\");\n}\n\n/**\n * Default configuration\n */\nexport const defaultConfig: Config = {\n library: getDefaultLibraryPath(),\n logLevel: \"info\",\n backup: {\n maxGenerations: 50,\n maxAgeDays: 365,\n directory: getDefaultBackupDirectory(),\n },\n watch: {\n debounceMs: 500,\n pollIntervalMs: 5000,\n retryIntervalMs: 200,\n maxRetries: 10,\n },\n server: {\n autoStart: false,\n autoStopMinutes: 0,\n },\n citation: {\n defaultStyle: \"apa\",\n cslDirectory: [getDefaultCslDirectory()],\n defaultLocale: \"en-US\",\n defaultFormat: \"text\",\n },\n pubmed: {\n email: undefined,\n apiKey: undefined,\n },\n fulltext: {\n directory: getDefaultFulltextDirectory(),\n },\n};\n","/**\n * Configuration loader\n */\n\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { parse as parseTOML } from \"@iarna/toml\";\nimport {\n defaultConfig,\n getDefaultCurrentDirConfigFilename,\n getDefaultUserConfigPath,\n} from \"./defaults.js\";\nimport {\n type Config,\n type DeepPartialConfig,\n type PartialConfig,\n configSchema,\n normalizePartialConfig,\n partialConfigSchema,\n} from \"./schema.js\";\n\n/**\n * Options for loading configuration\n */\nexport interface LoadConfigOptions {\n /** Current working directory (default: process.cwd()) */\n cwd?: string;\n /** User config path (default: ~/.reference-manager/config.toml) */\n userConfigPath?: string;\n /** CLI argument overrides */\n overrides?: Partial<Config>;\n}\n\n/**\n * Load and parse a TOML config file\n */\nfunction loadTOMLFile(path: string): PartialConfig | null {\n if (!existsSync(path)) {\n return null;\n }\n\n try {\n const content = readFileSync(path, \"utf-8\");\n const parsed = parseTOML(content);\n\n // Validate with partial schema\n const validated = partialConfigSchema.parse(parsed);\n return validated;\n } catch (error) {\n throw new Error(\n `Failed to load config from ${path}: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n}\n\n/**\n * Merge partial configurations\n * Later configs override earlier ones\n */\nfunction mergeConfigs(\n base: DeepPartialConfig,\n ...overrides: (DeepPartialConfig | null | undefined)[]\n): DeepPartialConfig {\n const result: DeepPartialConfig = { ...base };\n\n const sectionKeys = [\"backup\", \"watch\", \"server\", \"citation\", \"pubmed\", \"fulltext\"] as const;\n\n for (const override of overrides) {\n if (!override) continue;\n\n // Merge top-level primitive fields\n if (override.library !== undefined) {\n result.library = override.library;\n }\n if (override.logLevel !== undefined) {\n result.logLevel = override.logLevel;\n }\n\n // Merge section configs\n for (const key of sectionKeys) {\n if (override[key] !== undefined) {\n result[key] = {\n ...result[key],\n ...override[key],\n };\n }\n }\n }\n\n return result;\n}\n\n/**\n * Fill missing fields with defaults\n */\nfunction fillDefaults(partial: DeepPartialConfig): Config {\n return {\n library: partial.library ?? defaultConfig.library,\n logLevel: partial.logLevel ?? defaultConfig.logLevel,\n backup: {\n maxGenerations: partial.backup?.maxGenerations ?? defaultConfig.backup.maxGenerations,\n maxAgeDays: partial.backup?.maxAgeDays ?? defaultConfig.backup.maxAgeDays,\n directory: partial.backup?.directory ?? defaultConfig.backup.directory,\n },\n watch: {\n debounceMs: partial.watch?.debounceMs ?? defaultConfig.watch.debounceMs,\n pollIntervalMs: partial.watch?.pollIntervalMs ?? defaultConfig.watch.pollIntervalMs,\n retryIntervalMs: partial.watch?.retryIntervalMs ?? defaultConfig.watch.retryIntervalMs,\n maxRetries: partial.watch?.maxRetries ?? defaultConfig.watch.maxRetries,\n },\n server: {\n autoStart: partial.server?.autoStart ?? defaultConfig.server.autoStart,\n autoStopMinutes: partial.server?.autoStopMinutes ?? defaultConfig.server.autoStopMinutes,\n },\n citation: fillCitationDefaults(partial.citation),\n pubmed: fillPubmedDefaults(partial.pubmed),\n fulltext: fillFulltextDefaults(partial.fulltext),\n };\n}\n\n/**\n * Fill citation config with defaults\n */\nfunction fillCitationDefaults(partial: DeepPartialConfig[\"citation\"]): Config[\"citation\"] {\n return {\n defaultStyle: partial?.defaultStyle ?? defaultConfig.citation.defaultStyle,\n cslDirectory: partial?.cslDirectory ?? defaultConfig.citation.cslDirectory,\n defaultLocale: partial?.defaultLocale ?? defaultConfig.citation.defaultLocale,\n defaultFormat: partial?.defaultFormat ?? defaultConfig.citation.defaultFormat,\n };\n}\n\n/**\n * Fill pubmed config with defaults\n * Environment variables take priority over config file values\n */\nfunction fillPubmedDefaults(partial: DeepPartialConfig[\"pubmed\"]): Config[\"pubmed\"] {\n // Environment variables take priority\n const email = process.env.PUBMED_EMAIL ?? partial?.email ?? defaultConfig.pubmed.email;\n const apiKey = process.env.PUBMED_API_KEY ?? partial?.apiKey ?? defaultConfig.pubmed.apiKey;\n\n return {\n email,\n apiKey,\n };\n}\n\n/**\n * Expand ~ to home directory\n */\nfunction expandTilde(path: string): string {\n if (path.startsWith(\"~/\")) {\n return join(homedir(), path.slice(2));\n }\n return path;\n}\n\n/**\n * Fill fulltext config with defaults\n *\n * Priority:\n * 1. Environment variable REFERENCE_MANAGER_FULLTEXT_DIR\n * 2. Config file setting\n * 3. Default value\n */\nfunction fillFulltextDefaults(partial: DeepPartialConfig[\"fulltext\"]): Config[\"fulltext\"] {\n const envDir = process.env.REFERENCE_MANAGER_FULLTEXT_DIR;\n const directory = envDir ?? partial?.directory ?? defaultConfig.fulltext.directory;\n return {\n directory: expandTilde(directory),\n };\n}\n\n/**\n * Load configuration from multiple sources\n *\n * Priority (highest to lowest):\n * 1. CLI argument overrides\n * 2. Current directory config (.reference-manager.config.toml)\n * 3. Environment variable (REFERENCE_MANAGER_CONFIG)\n * 4. User config (~/.reference-manager/config.toml)\n * 5. Default values\n */\nexport function loadConfig(options: LoadConfigOptions = {}): Config {\n const cwd = options.cwd ?? process.cwd();\n const userConfigPath = options.userConfigPath ?? getDefaultUserConfigPath();\n\n // 1. Load user config (lowest priority)\n const userConfig = loadTOMLFile(userConfigPath);\n\n // 2. Load environment variable config\n const envConfigPath = process.env.REFERENCE_MANAGER_CONFIG;\n const envConfig = envConfigPath ? loadTOMLFile(envConfigPath) : null;\n\n // 3. Load current directory config (highest priority)\n const currentConfigPath = join(cwd, getDefaultCurrentDirConfigFilename());\n const currentConfig = loadTOMLFile(currentConfigPath);\n\n // Normalize snake_case to camelCase\n const normalizedUser = userConfig ? normalizePartialConfig(userConfig) : null;\n const normalizedEnv = envConfig ? normalizePartialConfig(envConfig) : null;\n const normalizedCurrent = currentConfig ? normalizePartialConfig(currentConfig) : null;\n\n // Merge configs (priority: current > env > user > defaults)\n const merged = mergeConfigs(\n {},\n normalizedUser,\n normalizedEnv,\n normalizedCurrent,\n options.overrides\n );\n\n // Fill missing fields with defaults\n const config = fillDefaults(merged);\n\n // Validate final config\n try {\n return configSchema.parse(config);\n } catch (error) {\n throw new Error(\n `Invalid configuration: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n}\n"],"names":["parseTOML"],"mappings":";;;;;AASO,MAAM,iBAAiB,EAAE,KAAK,CAAC,UAAU,QAAQ,OAAO,CAAC;AAKzD,MAAM,qBAAqB,EAAE,OAAO;AAAA,EACzC,gBAAgB,EAAE,OAAA,EAAS,IAAA,EAAM,SAAA;AAAA,EACjC,YAAY,EAAE,OAAA,EAAS,IAAA,EAAM,SAAA;AAAA,EAC7B,WAAW,EAAE,OAAA,EAAS,IAAI,CAAC;AAC7B,CAAC;AAOM,MAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,YAAY,EAAE,OAAA,EAAS,IAAA,EAAM,YAAA;AAAA,EAC7B,gBAAgB,EAAE,OAAA,EAAS,IAAA,EAAM,SAAA;AAAA,EACjC,iBAAiB,EAAE,OAAA,EAAS,IAAA,EAAM,SAAA;AAAA,EAClC,YAAY,EAAE,SAAS,IAAA,EAAM,YAAA;AAC/B,CAAC;AAKM,MAAM,qBAAqB,EAAE,OAAO;AAAA,EACzC,WAAW,EAAE,QAAA;AAAA,EACb,iBAAiB,EAAE,SAAS,IAAA,EAAM,YAAA;AACpC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A,IACb,CAAA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,EAAA;AAIV,QAAM,SAAS,aAAa,MAAM;AAGlC,MAAI;AACF,WAAO,aAAa,MAAM,MAAM;AAAA,EAClC,SAAS,OAAO;AACd,UAAM,IAAI;AAAA,MACR,0BAA0B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAAA,IAAA;AAAA,EAEpF;AACF;"}
@@ -1,5 +1,5 @@
1
1
  import type { PubmedConfig } from "../../features/import/fetcher.js";
2
- import { type AddReferencesResult, type AddedItem, type FailedItem, type SkippedItem } from "../../features/operations/add.js";
2
+ import type { AddReferencesResult, AddedItem, FailedItem, SkippedItem } from "../../features/operations/add.js";
3
3
  import type { ExecutionContext } from "../execution-context.js";
4
4
  /**
5
5
  * Options for the add command.
@@ -25,10 +25,10 @@ export type AddCommandResult = AddReferencesResult;
25
25
  export type { AddedItem, FailedItem, SkippedItem };
26
26
  /**
27
27
  * Execute add command.
28
- * Routes to server API or direct library operation based on execution context.
28
+ * Uses context.library.import() which works for both local and server modes.
29
29
  *
30
30
  * @param options - Add command options
31
- * @param context - Execution context (server or local)
31
+ * @param context - Execution context
32
32
  * @returns Add result containing added, failed, and skipped items
33
33
  */
34
34
  export declare function executeAdd(options: AddCommandOptions, context: ExecutionContext): Promise<AddCommandResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/add.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,WAAW,EAEjB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,8CAA8C;IAC9C,MAAM,E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E,YAAY,CAAC;IAC5B,gCAAgC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yBAAyB;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,CAAC;AAGnD,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC;AAKnD;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,gBAAgB,CAAC,CAgB3B;AAiCD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAgClF;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAa5D"}
@@ -1,4 +1,4 @@
1
- import { type CiteResult } from "../../features/operations/cite.js";
1
+ import type { CiteResult } from "../../features/operations/cite.js";
2
2
  import type { ExecutionContext } from "../execution-context.js";
3
3
  /**
4
4
  * Options for the cite command.
@@ -18,10 +18,10 @@ export interface CiteCommandOptions {
18
18
  export type CiteCommandResult = CiteResult;
19
19
  /**
20
20
  * Execute cite command.
21
- * Routes to server API or direct library operation based on execution context.
21
+ * Uses context.library.cite() which works for both local and server modes.
22
22
  *
23
23
  * @param options - Cite command options
24
- * @param context - Execution context (server or local)
24
+ * @param context - Execution context
25
25
  * @returns Cite result containing per-identifier results
26
26
  */
27
27
  export declare function executeCite(options: CiteCommandOptions, context: ExecutionContext): Promise<CiteCommandResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"cite.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/cite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAkB,MAAM,mCAAmC,CAAC;AACpF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC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AC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC;AAiC3C;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CAI5B;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAQlE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAQlE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAWjE"}
@@ -1,7 +1,10 @@
1
1
  /**
2
2
  * Fulltext CLI commands: attach, get, detach
3
+ *
4
+ * Uses ILibrary interface for unified operations across local and server modes.
3
5
  */
4
- import { type FulltextType } from "../../features/fulltext/index.js";
6
+ import type { FulltextType } from "../../features/fulltext/index.js";
7
+ import { type FulltextAttachResult, type FulltextDetachResult, type FulltextGetResult } from "../../features/operations/fulltext/index.js";
5
8
  import type { ExecutionContext } from "../execution-context.js";
6
9
  /**
7
10
  * Options for fulltext attach command
@@ -16,18 +19,6 @@ export interface FulltextAttachOptions {
16
19
  fulltextDirectory: string;
17
20
  stdinContent?: Buffer;
18
21
  }
19
- /**
20
- * Result from fulltext attach command
21
- */
22
- export interface FulltextAttachResult {
23
- success: boolean;
24
- filename?: string;
25
- type?: FulltextType;
26
- overwritten?: boolean;
27
- existingFile?: string;
28
- requiresConfirmation?: boolean;
29
- error?: string;
30
- }
31
22
  /**
32
23
  * Options for fulltext get command
33
24
  */
@@ -38,18 +29,6 @@ export interface FulltextGetOptions {
38
29
  byUuid?: boolean;
39
30
  fulltextDirectory: string;
40
31
  }
41
- /**
42
- * Result from fulltext get command
43
- */
44
- export interface FulltextGetResult {
45
- success: boolean;
46
- paths?: {
47
- pdf?: string;
48
- markdown?: string;
49
- };
50
- content?: Buffer;
51
- error?: string;
52
- }
53
32
  /**
54
33
  * Options for fulltext detach command
55
34
  */
@@ -61,15 +40,7 @@ export interface FulltextDetachOptions {
61
40
  byUuid?: boolean;
62
41
  fulltextDirectory: string;
63
42
  }
64
- /**
65
- * Result from fulltext detach command
66
- */
67
- export interface FulltextDetachResult {
68
- success: boolean;
69
- detached?: FulltextType[];
70
- deleted?: FulltextType[];
71
- error?: string;
72
- }
43
+ export type { FulltextAttachResult, FulltextGetResult, FulltextDetachResult };
73
44
  /**
74
45
  * Execute fulltext attach command
75
46
  */
@@ -1 +1 @@
1
- {"version":3,"file":"fulltext.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/fulltext.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAE1B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC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E,OAAO,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAGD,YAAY,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,CAAC;AAE9E;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,oBAAoB,CAAC,CAa/B;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CAU5B;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,oBAAoB,CAAC,CAU/B;AAMD;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAiB/E;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAkBzE;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAe/E;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,oBAAoB,GAAG,iBAAiB,GAAG,oBAAoB,GACtE,MAAM,CAER"}
@@ -1,4 +1,4 @@
1
- import { type ListResult } from "../../features/operations/list.js";
1
+ import type { ListResult } from "../../features/operations/list.js";
2
2
  import type { ExecutionContext } from "../execution-context.js";
3
3
  /**
4
4
  * Options for the list command.
@@ -15,10 +15,10 @@ export interface ListCommandOptions {
15
15
  export type ListCommandResult = ListResult;
16
16
  /**
17
17
  * Execute list command.
18
- * Routes to server API or direct library operation based on execution context.
18
+ * Uses context.library.list() which works for both local and server modes.
19
19
  *
20
20
  * @param options - List command options
21
- * @param context - Execution context (server or local)
21
+ * @param context - Execution context
22
22
  * @returns List result containing formatted items
23
23
  */
24
24
  export declare function executeList(options: ListCommandOptions, context: ExecutionContext): Promise<ListCommandResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,UAAU,EAEhB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC;AA4B3C;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CAW5B;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAKlE"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC;AA4B3C;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CAK5B;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAKlE"}
@@ -0,0 +1,16 @@
1
+ import type { Readable, Writable } from "node:stream";
2
+ import { type McpServerResult } from "../../mcp/index.js";
3
+ export interface McpStartOptions {
4
+ configPath: string;
5
+ libraryPath?: string;
6
+ stdin?: Readable;
7
+ stdout?: Writable;
8
+ }
9
+ /**
10
+ * Start MCP stdio server.
11
+ *
12
+ * @param options - MCP server options
13
+ * @returns MCP server result with dispose function
14
+ */
15
+ export declare function mcpStart(options: McpStartOptions): Promise<McpServerResult>;
16
+ //# sourceMappingURL=mcp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,KAAK,eAAe,EAAmB,MAAM,oBAAoB,CAAC;AAE3E,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,MAAM,CAAC,EAAE,QAAQ,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAsB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAgBjF"}