@arabold/docs-mcp-server 2.4.2 → 2.4.3

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 (34) hide show
  1. package/db/migrations/002-normalize-library-table.sql +5 -0
  2. package/db/migrations/003-normalize-vector-table.sql +5 -0
  3. package/db/migrations/004-complete-normalization.sql +7 -0
  4. package/db/migrations/007-dedupe-unversioned-versions.sql +5 -0
  5. package/db/migrations/009-add-pages-table.sql +10 -0
  6. package/db/migrations/014-rebuild-vector-partition-keys.sql +56 -0
  7. package/dist/HtmlDefuddleMiddleware-Cm0vQDqD.js +148 -0
  8. package/dist/HtmlDefuddleMiddleware-Cm0vQDqD.js.map +1 -0
  9. package/dist/assets/main.css +3 -1
  10. package/dist/assets/main.js +7845 -8777
  11. package/dist/assets/main.js.map +1 -1
  12. package/dist/env-DONvEfR5.js +30 -0
  13. package/dist/env-DONvEfR5.js.map +1 -0
  14. package/dist/index.js +10 -8
  15. package/dist/index.js.map +1 -1
  16. package/dist/logger-BBxstTD7.js +82 -0
  17. package/dist/logger-BBxstTD7.js.map +1 -0
  18. package/dist/main-BktKic6L.js +18646 -0
  19. package/dist/main-BktKic6L.js.map +1 -0
  20. package/dist/utils-B-zX5sgp.js +1113 -0
  21. package/dist/utils-B-zX5sgp.js.map +1 -0
  22. package/dist/utils-LjYa0nIu.js +2 -0
  23. package/package.json +61 -61
  24. package/public/assets/main.css +3 -1
  25. package/public/assets/main.js +7845 -8777
  26. package/public/assets/main.js.map +1 -1
  27. package/dist/HtmlDefuddleMiddleware-DjhdN_D2.js +0 -152
  28. package/dist/HtmlDefuddleMiddleware-DjhdN_D2.js.map +0 -1
  29. package/dist/logger-CLtABTNb.js +0 -99
  30. package/dist/logger-CLtABTNb.js.map +0 -1
  31. package/dist/main-WZKPkgC6.js +0 -20454
  32. package/dist/main-WZKPkgC6.js.map +0 -1
  33. package/dist/utils-CJgh41os.js +0 -1152
  34. package/dist/utils-CJgh41os.js.map +0 -1
@@ -0,0 +1,30 @@
1
+ //#region src/utils/env.ts
2
+ /**
3
+ * Normalize a single environment variable value by trimming surrounding whitespace
4
+ * and removing matching outer quotes. Internal quotes are preserved.
5
+ */
6
+ function normalizeEnvValue(value) {
7
+ const trimmed = value.trim();
8
+ if (trimmed.startsWith("\"") && trimmed.endsWith("\"") || trimmed.startsWith("'") && trimmed.endsWith("'")) return trimmed.slice(1, -1);
9
+ return trimmed;
10
+ }
11
+ /**
12
+ * Normalize all string values in process.env in place.
13
+ * Returns the names of environment variables that changed.
14
+ */
15
+ function sanitizeEnvironment(env = process.env) {
16
+ const sanitizedKeys = [];
17
+ for (const [key, value] of Object.entries(env)) {
18
+ if (value === void 0) continue;
19
+ const normalized = normalizeEnvValue(value);
20
+ if (normalized !== value) {
21
+ env[key] = normalized;
22
+ sanitizedKeys.push(key);
23
+ }
24
+ }
25
+ return sanitizedKeys;
26
+ }
27
+ //#endregion
28
+ export { sanitizeEnvironment as n, normalizeEnvValue as t };
29
+
30
+ //# sourceMappingURL=env-DONvEfR5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-DONvEfR5.js","names":[],"sources":["../src/utils/env.ts"],"sourcesContent":["/**\n * Normalize a single environment variable value by trimming surrounding whitespace\n * and removing matching outer quotes. Internal quotes are preserved.\n */\nexport function normalizeEnvValue(value: string): string {\n const trimmed = value.trim();\n if (\n (trimmed.startsWith('\"') && trimmed.endsWith('\"')) ||\n (trimmed.startsWith(\"'\") && trimmed.endsWith(\"'\"))\n ) {\n return trimmed.slice(1, -1);\n }\n return trimmed;\n}\n\n/**\n * Normalize all string values in process.env in place.\n * Returns the names of environment variables that changed.\n */\nexport function sanitizeEnvironment(env: NodeJS.ProcessEnv = process.env): string[] {\n const sanitizedKeys: string[] = [];\n\n for (const [key, value] of Object.entries(env)) {\n if (value === undefined) {\n continue;\n }\n\n const normalized = normalizeEnvValue(value);\n if (normalized !== value) {\n env[key] = normalized;\n sanitizedKeys.push(key);\n }\n }\n\n return sanitizedKeys;\n}\n"],"mappings":";;;;;AAIA,SAAgB,kBAAkB,OAAuB;CACvD,MAAM,UAAU,MAAM,KAAK;CAC3B,IACG,QAAQ,WAAW,IAAG,KAAK,QAAQ,SAAS,IAAG,KAC/C,QAAQ,WAAW,GAAG,KAAK,QAAQ,SAAS,GAAG,GAEhD,OAAO,QAAQ,MAAM,GAAG,EAAE;CAE5B,OAAO;AACT;;;;;AAMA,SAAgB,oBAAoB,MAAyB,QAAQ,KAAe;CAClF,MAAM,gBAA0B,CAAC;CAEjC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,GAAG,GAAG;EAC9C,IAAI,UAAU,KAAA,GACZ;EAGF,MAAM,aAAa,kBAAkB,KAAK;EAC1C,IAAI,eAAe,OAAO;GACxB,IAAI,OAAO;GACX,cAAc,KAAK,GAAG;EACxB;CACF;CAEA,OAAO;AACT"}
package/dist/index.js CHANGED
@@ -1,15 +1,17 @@
1
1
  #!/usr/bin/env node
2
+ import { n as sanitizeEnvironment } from "./env-DONvEfR5.js";
3
+ import { r as logger } from "./logger-BBxstTD7.js";
2
4
  import "dotenv/config";
3
- import { s as sanitizeEnvironment, l as logger } from "./logger-CLtABTNb.js";
5
+ //#region src/index.ts
4
6
  process.setSourceMapsEnabled(true);
5
7
  sanitizeEnvironment();
6
- const [{ runCli }, { ensurePlaywrightBrowsersInstalled }] = await Promise.all([
7
- import("./main-WZKPkgC6.js"),
8
- import("./utils-CJgh41os.js").then((n) => n.u)
9
- ]);
8
+ var [{ runCli }, { ensurePlaywrightBrowsersInstalled }] = await Promise.all([import("./main-BktKic6L.js"), import("./utils-LjYa0nIu.js")]);
10
9
  ensurePlaywrightBrowsersInstalled();
11
10
  runCli().catch((error) => {
12
- logger.error(`🔥 Fatal error in main execution: ${error}`);
13
- process.exit(1);
11
+ logger.error(`🔥 Fatal error in main execution: ${error}`);
12
+ process.exit(1);
14
13
  });
15
- //# sourceMappingURL=index.js.map
14
+ //#endregion
15
+ export {};
16
+
17
+ //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["// Enable source maps (Node.js 20+)\nprocess.setSourceMapsEnabled(true);\n\nimport \"dotenv/config\";\nimport { sanitizeEnvironment } from \"./utils/env\";\nimport { logger } from \"./utils/logger\";\n\nsanitizeEnvironment();\n\nconst [{ runCli }, { ensurePlaywrightBrowsersInstalled }] = await Promise.all([\n import(\"./cli/main\"),\n import(\"./cli/utils\"),\n]);\n\n// Ensure Playwright browsers are installed\nensurePlaywrightBrowsersInstalled();\n\n// Run the CLI\nrunCli().catch((error) => {\n logger.error(`🔥 Fatal error in main execution: ${error}`);\n process.exit(1);\n});\n"],"names":[],"mappings":";;AACA,QAAQ,qBAAqB,IAAI;AAMjC,oBAAA;AAEA,MAAM,CAAC,EAAE,OAAA,GAAU,EAAE,mCAAmC,IAAI,MAAM,QAAQ,IAAI;AAAA,EAC5E,OAAO,oBAAY;AAAA,EACnB,OAAO,qBAAa,EAAA,KAAA,OAAA,EAAA,CAAA;AACtB,CAAC;AAGD,kCAAA;AAGA,SAAS,MAAM,CAAC,UAAU;AACxB,SAAO,MAAM,qCAAqC,KAAK,EAAE;AACzD,UAAQ,KAAK,CAAC;AAChB,CAAC;"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["// Enable source maps (Node.js 20+)\nprocess.setSourceMapsEnabled(true);\n\nimport \"dotenv/config\";\nimport { sanitizeEnvironment } from \"./utils/env\";\nimport { logger } from \"./utils/logger\";\n\nsanitizeEnvironment();\n\nconst [{ runCli }, { ensurePlaywrightBrowsersInstalled }] = await Promise.all([\n import(\"./cli/main\"),\n import(\"./cli/utils\"),\n]);\n\n// Ensure Playwright browsers are installed\nensurePlaywrightBrowsersInstalled();\n\n// Run the CLI\nrunCli().catch((error) => {\n logger.error(`🔥 Fatal error in main execution: ${error}`);\n process.exit(1);\n});\n"],"mappings":";;;;AACA,QAAQ,qBAAqB,IAAI;AAMjC,oBAAoB;AAEpB,IAAM,CAAC,EAAE,UAAU,EAAE,uCAAuC,MAAM,QAAQ,IAAI,CAC5E,OAAO,uBACP,OAAO,sBACT,CAAC;AAGD,kCAAkC;AAGlC,OAAO,CAAC,CAAC,OAAO,UAAU;CACxB,OAAO,MAAM,qCAAqC,OAAO;CACzD,QAAQ,KAAK,CAAC;AAChB,CAAC"}
@@ -0,0 +1,82 @@
1
+ //#region src/utils/logger.ts
2
+ /**
3
+ * Defines the available log levels.
4
+ */
5
+ var LogLevel = {
6
+ ERROR: 0,
7
+ WARN: 1,
8
+ INFO: 2,
9
+ DEBUG: 3
10
+ };
11
+ /**
12
+ * Maps string log level names to their numeric values.
13
+ */
14
+ var LOG_LEVEL_MAP = {
15
+ ERROR: LogLevel.ERROR,
16
+ WARN: LogLevel.WARN,
17
+ INFO: LogLevel.INFO,
18
+ DEBUG: LogLevel.DEBUG
19
+ };
20
+ function suppressLogsInTests() {
21
+ return !!process.env.VITEST_WORKER_ID && process.env.ENABLE_TEST_LOGS !== "1";
22
+ }
23
+ function isInteractiveSession() {
24
+ return !!process.stdout.isTTY && !!process.stderr.isTTY;
25
+ }
26
+ function writeToStderr(message) {
27
+ process.stderr.write(message.endsWith("\n") ? message : `${message}\n`);
28
+ }
29
+ /**
30
+ * Gets the log level from the `LOG_LEVEL` environment variable.
31
+ * Returns the matching {@link LogLevel} value, or `null` if the variable
32
+ * is unset or contains an unrecognised value.
33
+ */
34
+ function getLogLevelFromEnv() {
35
+ const envLevel = process.env.LOG_LEVEL?.toUpperCase();
36
+ return envLevel && envLevel in LOG_LEVEL_MAP ? LOG_LEVEL_MAP[envLevel] : null;
37
+ }
38
+ var currentLogLevel = getLogLevelFromEnv() ?? (isInteractiveSession() ? LogLevel.INFO : LogLevel.ERROR);
39
+ /**
40
+ * Sets the current logging level for the application.
41
+ */
42
+ function setLogLevel(level) {
43
+ currentLogLevel = level;
44
+ }
45
+ /**
46
+ * Provides logging functionalities with level control.
47
+ */
48
+ var logger = {
49
+ /**
50
+ * Logs a debug message if the current log level is DEBUG or higher.
51
+ * @param message - The message to log.
52
+ */
53
+ debug: (message) => {
54
+ if (currentLogLevel >= LogLevel.DEBUG && !suppressLogsInTests()) writeToStderr(message);
55
+ },
56
+ /**
57
+ * Logs an info message if the current log level is INFO or higher.
58
+ * @param message - The message to log.
59
+ */
60
+ info: (message) => {
61
+ if (currentLogLevel >= LogLevel.INFO && !suppressLogsInTests()) writeToStderr(message);
62
+ },
63
+ /**
64
+ * Logs a warning message if the current log level is WARN or higher.
65
+ * @param message - The message to log.
66
+ */
67
+ warn: (message) => {
68
+ if (currentLogLevel >= LogLevel.WARN && !suppressLogsInTests()) writeToStderr(message);
69
+ },
70
+ /**
71
+ * Logs an error message if the current log level is ERROR or higher.
72
+ * Suppressed during test runs unless `ENABLE_TEST_LOGS=1` is set.
73
+ * @param message - The message to log.
74
+ */
75
+ error: (message) => {
76
+ if (currentLogLevel >= LogLevel.ERROR && !suppressLogsInTests()) writeToStderr(message);
77
+ }
78
+ };
79
+ //#endregion
80
+ export { setLogLevel as i, getLogLevelFromEnv as n, logger as r, LogLevel as t };
81
+
82
+ //# sourceMappingURL=logger-BBxstTD7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger-BBxstTD7.js","names":[],"sources":["../src/utils/logger.ts"],"sourcesContent":["/**\n * Defines the available log levels.\n */\nexport const LogLevel = {\n ERROR: 0,\n WARN: 1,\n INFO: 2,\n DEBUG: 3,\n} as const;\n\nexport type LogLevel = (typeof LogLevel)[keyof typeof LogLevel];\n\n/**\n * Maps string log level names to their numeric values.\n */\nconst LOG_LEVEL_MAP: Record<string, LogLevel> = {\n ERROR: LogLevel.ERROR,\n WARN: LogLevel.WARN,\n INFO: LogLevel.INFO,\n DEBUG: LogLevel.DEBUG,\n};\n\nfunction suppressLogsInTests(): boolean {\n return !!process.env.VITEST_WORKER_ID && process.env.ENABLE_TEST_LOGS !== \"1\";\n}\n\nfunction isInteractiveSession(): boolean {\n return !!process.stdout.isTTY && !!process.stderr.isTTY;\n}\n\nfunction writeToStderr(message: string): void {\n process.stderr.write(message.endsWith(\"\\n\") ? message : `${message}\\n`);\n}\n\n/**\n * Gets the log level from the `LOG_LEVEL` environment variable.\n * Returns the matching {@link LogLevel} value, or `null` if the variable\n * is unset or contains an unrecognised value.\n */\nexport function getLogLevelFromEnv(): LogLevel | null {\n const envLevel = process.env.LOG_LEVEL?.toUpperCase();\n return envLevel && envLevel in LOG_LEVEL_MAP ? LOG_LEVEL_MAP[envLevel] : null;\n}\n\nlet currentLogLevel: LogLevel =\n getLogLevelFromEnv() ?? (isInteractiveSession() ? LogLevel.INFO : LogLevel.ERROR);\n\n/**\n * Sets the current logging level for the application.\n */\nexport function setLogLevel(level: LogLevel): void {\n currentLogLevel = level;\n}\n\n/**\n * Returns the current logging level for the application.\n */\nexport function getLogLevel(): LogLevel {\n return currentLogLevel;\n}\n\n/**\n * Provides logging functionalities with level control.\n */\nexport const logger = {\n /**\n * Logs a debug message if the current log level is DEBUG or higher.\n * @param message - The message to log.\n */\n debug: (message: string) => {\n if (currentLogLevel >= LogLevel.DEBUG && !suppressLogsInTests()) {\n writeToStderr(message);\n }\n },\n /**\n * Logs an info message if the current log level is INFO or higher.\n * @param message - The message to log.\n */\n info: (message: string) => {\n if (currentLogLevel >= LogLevel.INFO && !suppressLogsInTests()) {\n writeToStderr(message);\n }\n },\n /**\n * Logs a warning message if the current log level is WARN or higher.\n * @param message - The message to log.\n */\n warn: (message: string) => {\n if (currentLogLevel >= LogLevel.WARN && !suppressLogsInTests()) {\n writeToStderr(message);\n }\n },\n /**\n * Logs an error message if the current log level is ERROR or higher.\n * Suppressed during test runs unless `ENABLE_TEST_LOGS=1` is set.\n * @param message - The message to log.\n */\n error: (message: string) => {\n if (currentLogLevel >= LogLevel.ERROR && !suppressLogsInTests()) {\n writeToStderr(message);\n }\n },\n};\n"],"mappings":";;;;AAGA,IAAa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