@514labs/moose-lsp 0.1.0-dev.11.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/dist/clickhouseData.d.ts +78 -0
  2. package/dist/clickhouseData.js +111 -0
  3. package/dist/clickhouseData.js.map +1 -0
  4. package/dist/clickhouseData.test.d.ts +2 -0
  5. package/dist/clickhouseData.test.js +92 -0
  6. package/dist/clickhouseData.test.js.map +1 -0
  7. package/dist/clickhouseVersion.d.ts +49 -0
  8. package/dist/clickhouseVersion.js +148 -0
  9. package/dist/clickhouseVersion.js.map +1 -0
  10. package/dist/clickhouseVersion.test.d.ts +2 -0
  11. package/dist/clickhouseVersion.test.js +113 -0
  12. package/dist/clickhouseVersion.test.js.map +1 -0
  13. package/dist/codeActions.d.ts +27 -0
  14. package/dist/codeActions.js +172 -0
  15. package/dist/codeActions.js.map +1 -0
  16. package/dist/codeActions.test.d.ts +2 -0
  17. package/dist/codeActions.test.js +206 -0
  18. package/dist/codeActions.test.js.map +1 -0
  19. package/dist/completions.d.ts +22 -0
  20. package/dist/completions.js +227 -0
  21. package/dist/completions.js.map +1 -0
  22. package/dist/completions.test.d.ts +2 -0
  23. package/dist/completions.test.js +282 -0
  24. package/dist/completions.test.js.map +1 -0
  25. package/dist/data/clickhouse-25.6.json +30772 -0
  26. package/dist/data/clickhouse-25.8.json +31872 -0
  27. package/dist/diagnostics.d.ts +18 -0
  28. package/dist/diagnostics.js +53 -0
  29. package/dist/diagnostics.js.map +1 -0
  30. package/dist/diagnostics.test.d.ts +2 -0
  31. package/dist/diagnostics.test.js +109 -0
  32. package/dist/diagnostics.test.js.map +1 -0
  33. package/dist/formatting.d.ts +36 -0
  34. package/dist/formatting.js +69 -0
  35. package/dist/formatting.js.map +1 -0
  36. package/dist/formatting.test.d.ts +2 -0
  37. package/dist/formatting.test.js +92 -0
  38. package/dist/formatting.test.js.map +1 -0
  39. package/dist/hover.d.ts +44 -0
  40. package/dist/hover.js +209 -0
  41. package/dist/hover.js.map +1 -0
  42. package/dist/hover.test.d.ts +2 -0
  43. package/dist/hover.test.js +354 -0
  44. package/dist/hover.test.js.map +1 -0
  45. package/dist/index.d.ts +2 -0
  46. package/dist/index.js +25 -0
  47. package/dist/index.js.map +1 -0
  48. package/dist/node_modules/@514labs/moose-sql-validator-wasm/dist/index.js +56 -0
  49. package/dist/node_modules/@514labs/moose-sql-validator-wasm/dist/index.js.map +1 -0
  50. package/dist/node_modules/@514labs/moose-sql-validator-wasm/dist/index.test.js +185 -0
  51. package/dist/node_modules/@514labs/moose-sql-validator-wasm/dist/index.test.js.map +1 -0
  52. package/dist/node_modules/@514labs/moose-sql-validator-wasm/package.json +40 -0
  53. package/dist/node_modules/@514labs/moose-sql-validator-wasm/pkg/package.json +11 -0
  54. package/dist/node_modules/@514labs/moose-sql-validator-wasm/pkg/sql_validator.js +176 -0
  55. package/dist/node_modules/@514labs/moose-sql-validator-wasm/pkg/sql_validator_bg.wasm +0 -0
  56. package/dist/projectDetector.d.ts +21 -0
  57. package/dist/projectDetector.js +162 -0
  58. package/dist/projectDetector.js.map +1 -0
  59. package/dist/projectDetector.test.d.ts +2 -0
  60. package/dist/projectDetector.test.js +303 -0
  61. package/dist/projectDetector.test.js.map +1 -0
  62. package/dist/pythonService.d.ts +40 -0
  63. package/dist/pythonService.js +121 -0
  64. package/dist/pythonService.js.map +1 -0
  65. package/dist/pythonService.test.d.ts +2 -0
  66. package/dist/pythonService.test.js +208 -0
  67. package/dist/pythonService.test.js.map +1 -0
  68. package/dist/pythonSqlExtractor.d.ts +25 -0
  69. package/dist/pythonSqlExtractor.js +258 -0
  70. package/dist/pythonSqlExtractor.js.map +1 -0
  71. package/dist/pythonSqlExtractor.test.d.ts +2 -0
  72. package/dist/pythonSqlExtractor.test.js +227 -0
  73. package/dist/pythonSqlExtractor.test.js.map +1 -0
  74. package/dist/server.d.ts +2 -0
  75. package/dist/server.integration.test.d.ts +2 -0
  76. package/dist/server.integration.test.js +189 -0
  77. package/dist/server.integration.test.js.map +1 -0
  78. package/dist/server.js +228412 -0
  79. package/dist/server.js.map +1 -0
  80. package/dist/serverLogic.d.ts +40 -0
  81. package/dist/serverLogic.js +61 -0
  82. package/dist/serverLogic.js.map +1 -0
  83. package/dist/serverLogic.test.d.ts +2 -0
  84. package/dist/serverLogic.test.js +263 -0
  85. package/dist/serverLogic.test.js.map +1 -0
  86. package/dist/sqlExtractor.d.ts +15 -0
  87. package/dist/sqlExtractor.js +105 -0
  88. package/dist/sqlExtractor.js.map +1 -0
  89. package/dist/sqlExtractor.test.d.ts +2 -0
  90. package/dist/sqlExtractor.test.js +267 -0
  91. package/dist/sqlExtractor.test.js.map +1 -0
  92. package/dist/sqlLocations.d.ts +31 -0
  93. package/dist/sqlLocations.js +51 -0
  94. package/dist/sqlLocations.js.map +1 -0
  95. package/dist/sqlLocations.test.d.ts +2 -0
  96. package/dist/sqlLocations.test.js +94 -0
  97. package/dist/sqlLocations.test.js.map +1 -0
  98. package/dist/typescriptService.d.ts +29 -0
  99. package/dist/typescriptService.js +137 -0
  100. package/dist/typescriptService.js.map +1 -0
  101. package/dist/typescriptService.test.d.ts +2 -0
  102. package/dist/typescriptService.test.js +200 -0
  103. package/dist/typescriptService.test.js.map +1 -0
  104. package/package.json +49 -0
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var projectDetector_exports = {};
30
+ __export(projectDetector_exports, {
31
+ detectMooseProject: () => detectMooseProject,
32
+ detectMooseProjectWithInfo: () => detectMooseProjectWithInfo
33
+ });
34
+ module.exports = __toCommonJS(projectDetector_exports);
35
+ var fs = __toESM(require("node:fs/promises"));
36
+ var path = __toESM(require("node:path"));
37
+ var import_glob = require("glob");
38
+ async function detectTypeScriptMooseProject(workspaceRoot) {
39
+ const packageJsonPaths = await (0, import_glob.glob)("**/package.json", {
40
+ cwd: workspaceRoot,
41
+ ignore: ["**/node_modules/**", "**/dist/**", "**/target/**"]
42
+ });
43
+ for (const relativePath of packageJsonPaths) {
44
+ const fullPath = path.join(workspaceRoot, relativePath);
45
+ try {
46
+ const content = await fs.readFile(fullPath, "utf-8");
47
+ const pkg = JSON.parse(content);
48
+ const deps = { ...pkg.dependencies, ...pkg.devDependencies };
49
+ if (deps["@514labs/moose-lib"]) {
50
+ return path.dirname(fullPath);
51
+ }
52
+ } catch {
53
+ }
54
+ }
55
+ return null;
56
+ }
57
+ async function detectPythonMooseProject(workspaceRoot) {
58
+ const pyprojectPaths = await (0, import_glob.glob)("**/pyproject.toml", {
59
+ cwd: workspaceRoot,
60
+ ignore: [
61
+ "**/node_modules/**",
62
+ "**/.venv/**",
63
+ "**/venv/**",
64
+ "**/dist/**",
65
+ "**/target/**"
66
+ ]
67
+ });
68
+ for (const relativePath of pyprojectPaths) {
69
+ const fullPath = path.join(workspaceRoot, relativePath);
70
+ try {
71
+ const content = await fs.readFile(fullPath, "utf-8");
72
+ if (content.includes("moose-lib") || content.includes("moose_lib")) {
73
+ return path.dirname(fullPath);
74
+ }
75
+ } catch {
76
+ }
77
+ }
78
+ const requirementsPaths = await (0, import_glob.glob)("**/requirements*.txt", {
79
+ cwd: workspaceRoot,
80
+ ignore: [
81
+ "**/node_modules/**",
82
+ "**/.venv/**",
83
+ "**/venv/**",
84
+ "**/dist/**",
85
+ "**/target/**"
86
+ ]
87
+ });
88
+ for (const relativePath of requirementsPaths) {
89
+ const fullPath = path.join(workspaceRoot, relativePath);
90
+ try {
91
+ const content = await fs.readFile(fullPath, "utf-8");
92
+ if (content.includes("moose-lib") || content.includes("moose_lib")) {
93
+ return path.dirname(fullPath);
94
+ }
95
+ } catch {
96
+ }
97
+ }
98
+ const setupPyPaths = await (0, import_glob.glob)("**/setup.py", {
99
+ cwd: workspaceRoot,
100
+ ignore: [
101
+ "**/node_modules/**",
102
+ "**/.venv/**",
103
+ "**/venv/**",
104
+ "**/dist/**",
105
+ "**/target/**"
106
+ ]
107
+ });
108
+ for (const relativePath of setupPyPaths) {
109
+ const fullPath = path.join(workspaceRoot, relativePath);
110
+ try {
111
+ const content = await fs.readFile(fullPath, "utf-8");
112
+ if (content.includes("moose-lib") || content.includes("moose_lib")) {
113
+ return path.dirname(fullPath);
114
+ }
115
+ } catch {
116
+ }
117
+ }
118
+ return null;
119
+ }
120
+ async function detectMooseProject(workspaceRoot) {
121
+ try {
122
+ const tsRoot = await detectTypeScriptMooseProject(workspaceRoot);
123
+ if (tsRoot) return tsRoot;
124
+ const pyRoot = await detectPythonMooseProject(workspaceRoot);
125
+ if (pyRoot) return pyRoot;
126
+ return null;
127
+ } catch (error) {
128
+ console.error("Error detecting Moose project:", error);
129
+ return null;
130
+ }
131
+ }
132
+ async function detectMooseProjectWithInfo(workspaceRoot) {
133
+ try {
134
+ const tsRoot = await detectTypeScriptMooseProject(workspaceRoot);
135
+ const pyRoot = await detectPythonMooseProject(workspaceRoot);
136
+ if (tsRoot && pyRoot) {
137
+ if (tsRoot.startsWith(pyRoot)) {
138
+ return { root: tsRoot, type: "both" };
139
+ }
140
+ if (pyRoot.startsWith(tsRoot)) {
141
+ return { root: pyRoot, type: "both" };
142
+ }
143
+ return { root: tsRoot, type: "typescript" };
144
+ }
145
+ if (tsRoot) {
146
+ return { root: tsRoot, type: "typescript" };
147
+ }
148
+ if (pyRoot) {
149
+ return { root: pyRoot, type: "python" };
150
+ }
151
+ return null;
152
+ } catch (error) {
153
+ console.error("Error detecting Moose project:", error);
154
+ return null;
155
+ }
156
+ }
157
+ // Annotate the CommonJS export names for ESM import in node:
158
+ 0 && (module.exports = {
159
+ detectMooseProject,
160
+ detectMooseProjectWithInfo
161
+ });
162
+ //# sourceMappingURL=projectDetector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/projectDetector.ts"],"sourcesContent":["import * as fs from 'node:fs/promises';\nimport * as path from 'node:path';\nimport { glob } from 'glob';\n\n/**\n * Result of project detection, indicating both the root and the type of project.\n */\nexport interface MooseProjectInfo {\n root: string;\n type: 'typescript' | 'python' | 'both';\n}\n\n/**\n * Detects a Moose TypeScript project by searching for package.json containing @514labs/moose-lib\n */\nasync function detectTypeScriptMooseProject(\n workspaceRoot: string,\n): Promise<string | null> {\n const packageJsonPaths = await glob('**/package.json', {\n cwd: workspaceRoot,\n ignore: ['**/node_modules/**', '**/dist/**', '**/target/**'],\n });\n\n for (const relativePath of packageJsonPaths) {\n const fullPath = path.join(workspaceRoot, relativePath);\n\n try {\n const content = await fs.readFile(fullPath, 'utf-8');\n const pkg = JSON.parse(content);\n\n const deps = { ...pkg.dependencies, ...pkg.devDependencies };\n if (deps['@514labs/moose-lib']) {\n return path.dirname(fullPath);\n }\n } catch {\n // Skip files that can't be read or parsed\n }\n }\n\n return null;\n}\n\n/**\n * Detects a Moose Python project by searching for pyproject.toml or requirements.txt containing moose-lib\n */\nasync function detectPythonMooseProject(\n workspaceRoot: string,\n): Promise<string | null> {\n // Check pyproject.toml files\n const pyprojectPaths = await glob('**/pyproject.toml', {\n cwd: workspaceRoot,\n ignore: [\n '**/node_modules/**',\n '**/.venv/**',\n '**/venv/**',\n '**/dist/**',\n '**/target/**',\n ],\n });\n\n for (const relativePath of pyprojectPaths) {\n const fullPath = path.join(workspaceRoot, relativePath);\n\n try {\n const content = await fs.readFile(fullPath, 'utf-8');\n // Check if moose-lib is mentioned in pyproject.toml\n if (content.includes('moose-lib') || content.includes('moose_lib')) {\n return path.dirname(fullPath);\n }\n } catch {\n // Skip files that can't be read\n }\n }\n\n // Check requirements.txt files\n const requirementsPaths = await glob('**/requirements*.txt', {\n cwd: workspaceRoot,\n ignore: [\n '**/node_modules/**',\n '**/.venv/**',\n '**/venv/**',\n '**/dist/**',\n '**/target/**',\n ],\n });\n\n for (const relativePath of requirementsPaths) {\n const fullPath = path.join(workspaceRoot, relativePath);\n\n try {\n const content = await fs.readFile(fullPath, 'utf-8');\n // Check if moose-lib is listed as a dependency\n if (content.includes('moose-lib') || content.includes('moose_lib')) {\n return path.dirname(fullPath);\n }\n } catch {\n // Skip files that can't be read\n }\n }\n\n // Check setup.py files\n const setupPyPaths = await glob('**/setup.py', {\n cwd: workspaceRoot,\n ignore: [\n '**/node_modules/**',\n '**/.venv/**',\n '**/venv/**',\n '**/dist/**',\n '**/target/**',\n ],\n });\n\n for (const relativePath of setupPyPaths) {\n const fullPath = path.join(workspaceRoot, relativePath);\n\n try {\n const content = await fs.readFile(fullPath, 'utf-8');\n if (content.includes('moose-lib') || content.includes('moose_lib')) {\n return path.dirname(fullPath);\n }\n } catch {\n // Skip files that can't be read\n }\n }\n\n return null;\n}\n\n/**\n * Detects a Moose project by searching for package.json files containing @514labs/moose-lib\n * or Python project files containing moose-lib.\n * Supports monorepos by recursively searching subdirectories.\n * Returns the first project root found (prefers TypeScript, then Python).\n */\nexport async function detectMooseProject(\n workspaceRoot: string,\n): Promise<string | null> {\n try {\n // Try TypeScript first\n const tsRoot = await detectTypeScriptMooseProject(workspaceRoot);\n if (tsRoot) return tsRoot;\n\n // Try Python\n const pyRoot = await detectPythonMooseProject(workspaceRoot);\n if (pyRoot) return pyRoot;\n\n return null;\n } catch (error) {\n console.error('Error detecting Moose project:', error);\n return null;\n }\n}\n\n/**\n * Detects Moose project with detailed information about project type.\n * Returns project info including whether it's TypeScript, Python, or both.\n */\nexport async function detectMooseProjectWithInfo(\n workspaceRoot: string,\n): Promise<MooseProjectInfo | null> {\n try {\n const tsRoot = await detectTypeScriptMooseProject(workspaceRoot);\n const pyRoot = await detectPythonMooseProject(workspaceRoot);\n\n if (tsRoot && pyRoot) {\n // Both found - use the more specific (deeper) root, or TypeScript if same\n if (tsRoot.startsWith(pyRoot)) {\n return { root: tsRoot, type: 'both' };\n }\n if (pyRoot.startsWith(tsRoot)) {\n return { root: pyRoot, type: 'both' };\n }\n // Different roots - prefer TypeScript\n return { root: tsRoot, type: 'typescript' };\n }\n\n if (tsRoot) {\n return { root: tsRoot, type: 'typescript' };\n }\n\n if (pyRoot) {\n return { root: pyRoot, type: 'python' };\n }\n\n return null;\n } catch (error) {\n console.error('Error detecting Moose project:', error);\n return null;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAoB;AACpB,WAAsB;AACtB,kBAAqB;AAarB,eAAe,6BACb,eACwB;AACxB,QAAM,mBAAmB,UAAM,kBAAK,mBAAmB;AAAA,IACrD,KAAK;AAAA,IACL,QAAQ,CAAC,sBAAsB,cAAc,cAAc;AAAA,EAC7D,CAAC;AAED,aAAW,gBAAgB,kBAAkB;AAC3C,UAAM,WAAW,KAAK,KAAK,eAAe,YAAY;AAEtD,QAAI;AACF,YAAM,UAAU,MAAM,GAAG,SAAS,UAAU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ACrD,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1,303 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var import_node_assert = __toESM(require("node:assert"));
25
+ var fs = __toESM(require("node:fs/promises"));
26
+ var os = __toESM(require("node:os"));
27
+ var path = __toESM(require("node:path"));
28
+ var import_node_test = require("node:test");
29
+ var import_projectDetector = require("./projectDetector");
30
+ (0, import_node_test.test)("Project Detection Tests", async (t) => {
31
+ await t.test("finds Moose project in root directory", async () => {
32
+ const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "moose-lsp-test-"));
33
+ try {
34
+ await fs.writeFile(
35
+ path.join(tmpDir, "package.json"),
36
+ JSON.stringify({
37
+ name: "test-project",
38
+ dependencies: {
39
+ "@514labs/moose-lib": "^1.0.0"
40
+ }
41
+ })
42
+ );
43
+ const result = await (0, import_projectDetector.detectMooseProject)(tmpDir);
44
+ import_node_assert.default.strictEqual(result, tmpDir);
45
+ } finally {
46
+ await fs.rm(tmpDir, { recursive: true, force: true });
47
+ }
48
+ });
49
+ await t.test("finds Moose project in monorepo subdirectory", async () => {
50
+ const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "moose-lsp-test-"));
51
+ try {
52
+ await fs.writeFile(
53
+ path.join(tmpDir, "package.json"),
54
+ JSON.stringify({
55
+ name: "monorepo-root",
56
+ private: true
57
+ })
58
+ );
59
+ const packagesDir = path.join(tmpDir, "packages", "moose-backend");
60
+ await fs.mkdir(packagesDir, { recursive: true });
61
+ await fs.writeFile(
62
+ path.join(packagesDir, "package.json"),
63
+ JSON.stringify({
64
+ name: "moose-backend",
65
+ dependencies: {
66
+ "@514labs/moose-lib": "^1.0.0"
67
+ }
68
+ })
69
+ );
70
+ const result = await (0, import_projectDetector.detectMooseProject)(tmpDir);
71
+ import_node_assert.default.strictEqual(result, packagesDir);
72
+ } finally {
73
+ await fs.rm(tmpDir, { recursive: true, force: true });
74
+ }
75
+ });
76
+ await t.test("returns null when no Moose project found", async () => {
77
+ const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "moose-lsp-test-"));
78
+ try {
79
+ await fs.writeFile(
80
+ path.join(tmpDir, "package.json"),
81
+ JSON.stringify({
82
+ name: "non-moose-project",
83
+ dependencies: {
84
+ express: "^4.0.0"
85
+ }
86
+ })
87
+ );
88
+ const result = await (0, import_projectDetector.detectMooseProject)(tmpDir);
89
+ import_node_assert.default.strictEqual(result, null);
90
+ } finally {
91
+ await fs.rm(tmpDir, { recursive: true, force: true });
92
+ }
93
+ });
94
+ await t.test("checks devDependencies as well", async () => {
95
+ const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "moose-lsp-test-"));
96
+ try {
97
+ await fs.writeFile(
98
+ path.join(tmpDir, "package.json"),
99
+ JSON.stringify({
100
+ name: "test-project",
101
+ devDependencies: {
102
+ "@514labs/moose-lib": "^1.0.0"
103
+ }
104
+ })
105
+ );
106
+ const result = await (0, import_projectDetector.detectMooseProject)(tmpDir);
107
+ import_node_assert.default.strictEqual(result, tmpDir);
108
+ } finally {
109
+ await fs.rm(tmpDir, { recursive: true, force: true });
110
+ }
111
+ });
112
+ });
113
+ (0, import_node_test.test)("Python Project Detection Tests", async (t) => {
114
+ await t.test("finds Python Moose project via pyproject.toml", async () => {
115
+ const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "moose-lsp-test-"));
116
+ try {
117
+ await fs.writeFile(
118
+ path.join(tmpDir, "pyproject.toml"),
119
+ `[project]
120
+ name = "test-project"
121
+ dependencies = [
122
+ "moose-lib>=0.6.0",
123
+ ]
124
+ `
125
+ );
126
+ const result = await (0, import_projectDetector.detectMooseProject)(tmpDir);
127
+ import_node_assert.default.strictEqual(result, tmpDir);
128
+ } finally {
129
+ await fs.rm(tmpDir, { recursive: true, force: true });
130
+ }
131
+ });
132
+ await t.test("finds Python Moose project via requirements.txt", async () => {
133
+ const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "moose-lsp-test-"));
134
+ try {
135
+ await fs.writeFile(
136
+ path.join(tmpDir, "requirements.txt"),
137
+ `flask>=2.0.0
138
+ moose-lib>=0.6.0
139
+ requests>=2.28.0
140
+ `
141
+ );
142
+ const result = await (0, import_projectDetector.detectMooseProject)(tmpDir);
143
+ import_node_assert.default.strictEqual(result, tmpDir);
144
+ } finally {
145
+ await fs.rm(tmpDir, { recursive: true, force: true });
146
+ }
147
+ });
148
+ await t.test("finds Python Moose project via setup.py", async () => {
149
+ const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "moose-lsp-test-"));
150
+ try {
151
+ await fs.writeFile(
152
+ path.join(tmpDir, "setup.py"),
153
+ `from setuptools import setup
154
+
155
+ setup(
156
+ name="test-project",
157
+ install_requires=[
158
+ "moose-lib>=0.6.0",
159
+ ],
160
+ )
161
+ `
162
+ );
163
+ const result = await (0, import_projectDetector.detectMooseProject)(tmpDir);
164
+ import_node_assert.default.strictEqual(result, tmpDir);
165
+ } finally {
166
+ await fs.rm(tmpDir, { recursive: true, force: true });
167
+ }
168
+ });
169
+ await t.test(
170
+ "detects moose_lib with underscore in pyproject.toml",
171
+ async () => {
172
+ const tmpDir = await fs.mkdtemp(
173
+ path.join(os.tmpdir(), "moose-lsp-test-")
174
+ );
175
+ try {
176
+ await fs.writeFile(
177
+ path.join(tmpDir, "pyproject.toml"),
178
+ `[project]
179
+ name = "test-project"
180
+ dependencies = [
181
+ "moose_lib>=0.6.0",
182
+ ]
183
+ `
184
+ );
185
+ const result = await (0, import_projectDetector.detectMooseProject)(tmpDir);
186
+ import_node_assert.default.strictEqual(result, tmpDir);
187
+ } finally {
188
+ await fs.rm(tmpDir, { recursive: true, force: true });
189
+ }
190
+ }
191
+ );
192
+ await t.test(
193
+ "returns null for Python project without moose-lib",
194
+ async () => {
195
+ const tmpDir = await fs.mkdtemp(
196
+ path.join(os.tmpdir(), "moose-lsp-test-")
197
+ );
198
+ try {
199
+ await fs.writeFile(
200
+ path.join(tmpDir, "requirements.txt"),
201
+ `flask>=2.0.0
202
+ requests>=2.28.0
203
+ `
204
+ );
205
+ const result = await (0, import_projectDetector.detectMooseProject)(tmpDir);
206
+ import_node_assert.default.strictEqual(result, null);
207
+ } finally {
208
+ await fs.rm(tmpDir, { recursive: true, force: true });
209
+ }
210
+ }
211
+ );
212
+ });
213
+ (0, import_node_test.test)("Project Detection With Info Tests", async (t) => {
214
+ await t.test("returns typescript type for TypeScript project", async () => {
215
+ const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "moose-lsp-test-"));
216
+ try {
217
+ await fs.writeFile(
218
+ path.join(tmpDir, "package.json"),
219
+ JSON.stringify({
220
+ name: "test-project",
221
+ dependencies: {
222
+ "@514labs/moose-lib": "^1.0.0"
223
+ }
224
+ })
225
+ );
226
+ const result = await (0, import_projectDetector.detectMooseProjectWithInfo)(tmpDir);
227
+ import_node_assert.default.ok(result);
228
+ import_node_assert.default.strictEqual(result.root, tmpDir);
229
+ import_node_assert.default.strictEqual(result.type, "typescript");
230
+ } finally {
231
+ await fs.rm(tmpDir, { recursive: true, force: true });
232
+ }
233
+ });
234
+ await t.test("returns python type for Python project", async () => {
235
+ const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "moose-lsp-test-"));
236
+ try {
237
+ await fs.writeFile(
238
+ path.join(tmpDir, "pyproject.toml"),
239
+ `[project]
240
+ name = "test-project"
241
+ dependencies = ["moose-lib>=0.6.0"]
242
+ `
243
+ );
244
+ const result = await (0, import_projectDetector.detectMooseProjectWithInfo)(tmpDir);
245
+ import_node_assert.default.ok(result);
246
+ import_node_assert.default.strictEqual(result.root, tmpDir);
247
+ import_node_assert.default.strictEqual(result.type, "python");
248
+ } finally {
249
+ await fs.rm(tmpDir, { recursive: true, force: true });
250
+ }
251
+ });
252
+ await t.test(
253
+ "returns both type for project with both languages",
254
+ async () => {
255
+ const tmpDir = await fs.mkdtemp(
256
+ path.join(os.tmpdir(), "moose-lsp-test-")
257
+ );
258
+ try {
259
+ await fs.writeFile(
260
+ path.join(tmpDir, "package.json"),
261
+ JSON.stringify({
262
+ name: "test-project",
263
+ dependencies: {
264
+ "@514labs/moose-lib": "^1.0.0"
265
+ }
266
+ })
267
+ );
268
+ await fs.writeFile(
269
+ path.join(tmpDir, "pyproject.toml"),
270
+ `[project]
271
+ name = "test-project"
272
+ dependencies = ["moose-lib>=0.6.0"]
273
+ `
274
+ );
275
+ const result = await (0, import_projectDetector.detectMooseProjectWithInfo)(tmpDir);
276
+ import_node_assert.default.ok(result);
277
+ import_node_assert.default.strictEqual(result.root, tmpDir);
278
+ import_node_assert.default.strictEqual(result.type, "both");
279
+ } finally {
280
+ await fs.rm(tmpDir, { recursive: true, force: true });
281
+ }
282
+ }
283
+ );
284
+ await t.test("returns null for project without moose-lib", async () => {
285
+ const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "moose-lsp-test-"));
286
+ try {
287
+ await fs.writeFile(
288
+ path.join(tmpDir, "package.json"),
289
+ JSON.stringify({
290
+ name: "test-project",
291
+ dependencies: {
292
+ express: "^4.0.0"
293
+ }
294
+ })
295
+ );
296
+ const result = await (0, import_projectDetector.detectMooseProjectWithInfo)(tmpDir);
297
+ import_node_assert.default.strictEqual(result, null);
298
+ } finally {
299
+ await fs.rm(tmpDir, { recursive: true, force: true });
300
+ }
301
+ });
302
+ });
303
+ //# sourceMappingURL=projectDetector.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/projectDetector.test.ts"],"sourcesContent":["import assert from 'node:assert';\nimport * as fs from 'node:fs/promises';\nimport * as os from 'node:os';\nimport * as path from 'node:path';\nimport { test } from 'node:test';\nimport {\n detectMooseProject,\n detectMooseProjectWithInfo,\n} from './projectDetector';\n\ntest('Project Detection Tests', async (t) => {\n await t.test('finds Moose project in root directory', async () => {\n const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'moose-lsp-test-'));\n\n try {\n // Create package.json with moose-lib dependency\n await fs.writeFile(\n path.join(tmpDir, 'package.json'),\n JSON.stringify({\n name: 'test-project',\n dependencies: {\n '@514labs/moose-lib': '^1.0.0',\n },\n }),\n );\n\n const result = await detectMooseProject(tmpDir);\n assert.strictEqual(result, tmpDir);\n } finally {\n await fs.rm(tmpDir, { recursive: true, force: true });\n }\n });\n\n await t.test('finds Moose project in monorepo subdirectory', async () => {\n const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'moose-lsp-test-'));\n\n try {\n // Create root package.json without moose-lib\n await fs.writeFile(\n path.join(tmpDir, 'package.json'),\n JSON.stringify({\n name: 'monorepo-root',\n private: true,\n }),\n );\n\n // Create packages directory\n const packagesDir = path.join(tmpDir, 'packages', 'moose-backend');\n await fs.mkdir(packagesDir, { recursive: true });\n\n // Create package.json with moose-lib in subdirectory\n await fs.writeFile(\n path.join(packagesDir, 'package.json'),\n JSON.stringify({\n name: 'moose-backend',\n dependencies: {\n '@514labs/moose-lib': '^1.0.0',\n },\n }),\n );\n\n const result = await detectMooseProject(tmpDir);\n assert.strictEqual(result, packagesDir);\n } finally {\n await fs.rm(tmpDir, { recursive: true, force: true });\n }\n });\n\n await t.test('returns null when no Moose project found', async () => {\n const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'moose-lsp-test-'));\n\n try {\n // Create package.json without moose-lib\n await fs.writeFile(\n path.join(tmpDir, 'package.json'),\n JSON.stringify({\n name: 'non-moose-project',\n dependencies: {\n express: '^4.0.0',\n },\n }),\n );\n\n const result = await detectMooseProject(tmpDir);\n assert.strictEqual(result, null);\n } finally {\n await fs.rm(tmpDir, { recursive: true, force: true });\n }\n });\n\n await t.test('checks devDependencies as well', async () => {\n const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'moose-lsp-test-'));\n\n try {\n await fs.writeFile(\n path.join(tmpDir, 'package.json'),\n JSON.stringify({\n name: 'test-project',\n devDependencies: {\n '@514labs/moose-lib': '^1.0.0',\n },\n }),\n );\n\n const result = await detectMooseProject(tmpDir);\n assert.strictEqual(result, tmpDir);\n } finally {\n await fs.rm(tmpDir, { recursive: true, force: true });\n }\n });\n});\n\ntest('Python Project Detection Tests', async (t) => {\n await t.test('finds Python Moose project via pyproject.toml', async () => {\n const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'moose-lsp-test-'));\n\n try {\n // Create pyproject.toml with moose-lib dependency\n await fs.writeFile(\n path.join(tmpDir, 'pyproject.toml'),\n `[project]\nname = \"test-project\"\ndependencies = [\n \"moose-lib>=0.6.0\",\n]\n`,\n );\n\n const result = await detectMooseProject(tmpDir);\n assert.strictEqual(result, tmpDir);\n } finally {\n await fs.rm(tmpDir, { recursive: true, force: true });\n }\n });\n\n await t.test('finds Python Moose project via requirements.txt', async () => {\n const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'moose-lsp-test-'));\n\n try {\n // Create requirements.txt with moose-lib dependency\n await fs.writeFile(\n path.join(tmpDir, 'requirements.txt'),\n `flask>=2.0.0\nmoose-lib>=0.6.0\nrequests>=2.28.0\n`,\n );\n\n const result = await detectMooseProject(tmpDir);\n assert.strictEqual(result, tmpDir);\n } finally {\n await fs.rm(tmpDir, { recursive: true, force: true });\n }\n });\n\n await t.test('finds Python Moose project via setup.py', async () => {\n const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'moose-lsp-test-'));\n\n try {\n // Create setup.py with moose-lib dependency\n await fs.writeFile(\n path.join(tmpDir, 'setup.py'),\n `from setuptools import setup\n\nsetup(\n name=\"test-project\",\n install_requires=[\n \"moose-lib>=0.6.0\",\n ],\n)\n`,\n );\n\n const result = await detectMooseProject(tmpDir);\n assert.strictEqual(result, tmpDir);\n } finally {\n await fs.rm(tmpDir, { recursive: true, force: true });\n }\n });\n\n await t.test(\n 'detects moose_lib with underscore in pyproject.toml',\n async () => {\n const tmpDir = await fs.mkdtemp(\n path.join(os.tmpdir(), 'moose-lsp-test-'),\n );\n\n try {\n await fs.writeFile(\n path.join(tmpDir, 'pyproject.toml'),\n `[project]\nname = \"test-project\"\ndependencies = [\n \"moose_lib>=0.6.0\",\n]\n`,\n );\n\n const result = await detectMooseProject(tmpDir);\n assert.strictEqual(result, tmpDir);\n } finally {\n await fs.rm(tmpDir, { recursive: true, force: true });\n }\n },\n );\n\n await t.test(\n 'returns null for Python project without moose-lib',\n async () => {\n const tmpDir = await fs.mkdtemp(\n path.join(os.tmpdir(), 'moose-lsp-test-'),\n );\n\n try {\n await fs.writeFile(\n path.join(tmpDir, 'requirements.txt'),\n `flask>=2.0.0\nrequests>=2.28.0\n`,\n );\n\n const result = await detectMooseProject(tmpDir);\n assert.strictEqual(result, null);\n } finally {\n await fs.rm(tmpDir, { recursive: true, force: true });\n }\n },\n );\n});\n\ntest('Project Detection With Info Tests', async (t) => {\n await t.test('returns typescript type for TypeScript project', async () => {\n const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'moose-lsp-test-'));\n\n try {\n await fs.writeFile(\n path.join(tmpDir, 'package.json'),\n JSON.stringify({\n name: 'test-project',\n dependencies: {\n '@514labs/moose-lib': '^1.0.0',\n },\n }),\n );\n\n const result = await detectMooseProjectWithInfo(tmpDir);\n assert.ok(result);\n assert.strictEqual(result.root, tmpDir);\n assert.strictEqual(result.type, 'typescript');\n } finally {\n await fs.rm(tmpDir, { recursive: true, force: true });\n }\n });\n\n await t.test('returns python type for Python project', async () => {\n const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'moose-lsp-test-'));\n\n try {\n await fs.writeFile(\n path.join(tmpDir, 'pyproject.toml'),\n `[project]\nname = \"test-project\"\ndependencies = [\"moose-lib>=0.6.0\"]\n`,\n );\n\n const result = await detectMooseProjectWithInfo(tmpDir);\n assert.ok(result);\n assert.strictEqual(result.root, tmpDir);\n assert.strictEqual(result.type, 'python');\n } finally {\n await fs.rm(tmpDir, { recursive: true, force: true });\n }\n });\n\n await t.test(\n 'returns both type for project with both languages',\n async () => {\n const tmpDir = await fs.mkdtemp(\n path.join(os.tmpdir(), 'moose-lsp-test-'),\n );\n\n try {\n // Create both TypeScript and Python config files\n await fs.writeFile(\n path.join(tmpDir, 'package.json'),\n JSON.stringify({\n name: 'test-project',\n dependencies: {\n '@514labs/moose-lib': '^1.0.0',\n },\n }),\n );\n\n await fs.writeFile(\n path.join(tmpDir, 'pyproject.toml'),\n `[project]\nname = \"test-project\"\ndependencies = [\"moose-lib>=0.6.0\"]\n`,\n );\n\n const result = await detectMooseProjectWithInfo(tmpDir);\n assert.ok(result);\n assert.strictEqual(result.root, tmpDir);\n assert.strictEqual(result.type, 'both');\n } finally {\n await fs.rm(tmpDir, { recursive: true, force: true });\n }\n },\n );\n\n await t.test('returns null for project without moose-lib', async () => {\n const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'moose-lsp-test-'));\n\n try {\n await fs.writeFile(\n path.join(tmpDir, 'package.json'),\n JSON.stringify({\n name: 'test-project',\n dependencies: {\n express: '^4.0.0',\n },\n }),\n );\n\n const result = await detectMooseProjectWithInfo(tmpD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AAAA,QACH;AAEA,cAAM,GAAG;AAAA,UACP,KAAK,KAAK,QAAQ,gBAAgB;AAAA,UAClC;AAAA;AAAA;AAAA;AAAA,QAIF;AAEA,cAAM,SAAS,UAAM,mDAA2B,MAAM;AACtD,2BAAAA,QAAO,GAAG,MAAM;AAChB,2BAAAA,QAAO,YAAY,OAAO,MAAM,MAAM;AACtC,2BAAAA,QAAO,YAAY,OAAO,MAAM,MAAM;AAAA,MACxC,UAAE;AACA,cAAM,GAAG,GAAG,QAAQ,EAAE,WAAW,MAAM,OAAO,KAAK,CAAC;AAAA,MACtD;AAAA,IACF;AAAA,EACF;AAEA,QAAM,EAAE,KAAK,8CAA8C,YAAY;AACrE,UAAM,SAAS,MAAM,GAAG,QAAQ,KAAK,KAAK,GAAG,OAAO,GAAG,iBAAiB,CAAC;AAEzE,QAAI;AACF,YAAM,GAAG;AAAA,QACP,KAAK,KAAK,QAAQ,cAAc;AAAA,QAChC,KAAK,UAAU;AAAA,UACb,MAAM;AAAA,UACN,cAAc;AAAA,YACZ,SAAS;AAAA,UACX;AAAA,QACF,CAAC;AAAA,MACH;AAEA,YAAM,SAAS,UAAM,mDAA2B,MAAM;AACtD,yBAAAA,QAAO,YAAY,QAAQ,IAAI;AAAA,IACjC,UAAE;AACA,YAAM,GAAG,GAAG,QAAQ,EAAE,WAAW,MAAM,OAAO,KAAK,CAAC;AAAA,IACtD;AAAA,EACF,CAAC;AACH,CAAC;","names":["assert"]}
@@ -0,0 +1,40 @@
1
+ import { SqlLocation } from './sqlLocations.js';
2
+
3
+ /**
4
+ * Represents a parsed Python file in memory.
5
+ */
6
+ interface PythonFile {
7
+ path: string;
8
+ content: string;
9
+ }
10
+ /**
11
+ * Service that manages Python files for SQL extraction.
12
+ * Holds files in memory for fast incremental updates.
13
+ */
14
+ interface PythonService {
15
+ /** Initialize with project root path. Scans for Python files. */
16
+ initialize(projectRoot: string): Promise<void>;
17
+ /** Update file content in cache. */
18
+ updateFile(filePath: string, content: string): void;
19
+ /** Get all Python files (for initial scan). */
20
+ getFiles(): PythonFile[];
21
+ /** Get specific file by path. */
22
+ getFile(filePath: string): PythonFile | undefined;
23
+ /** Extract SQL locations from a specific file. */
24
+ extractSqlLocations(filePath: string): SqlLocation[];
25
+ /** Extract SQL locations from all files. */
26
+ extractAllSqlLocations(): SqlLocation[];
27
+ /** Check if service is initialized and healthy. */
28
+ isHealthy(): boolean;
29
+ /** Get initialization error if any. */
30
+ getError(): string | null;
31
+ /** Get the project root. */
32
+ getProjectRoot(): string | null;
33
+ }
34
+ /**
35
+ * Creates a Python service that manages Python file lifecycle.
36
+ * Maintains an in-memory cache for fast updates on file changes.
37
+ */
38
+ declare function createPythonService(): PythonService;
39
+
40
+ export { type PythonService, createPythonService };