pi-lens 3.6.2 → 3.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -2
- package/package.json +4 -4
- package/tsconfig.json +1 -1
- package/clients/__tests__/file-time.test.js +0 -216
- package/clients/__tests__/file-time.test.ts +0 -276
- package/clients/__tests__/format-service.test.js +0 -245
- package/clients/__tests__/format-service.test.ts +0 -339
- package/clients/__tests__/formatters.test.js +0 -271
- package/clients/__tests__/formatters.test.ts +0 -401
- package/clients/agent-behavior-client.js +0 -110
- package/clients/agent-behavior-client.test.js +0 -94
- package/clients/agent-behavior-client.test.ts +0 -116
- package/clients/amain-types.js +0 -164
- package/clients/architect-client.js +0 -291
- package/clients/ast-grep-client.js +0 -253
- package/clients/ast-grep-parser.js +0 -84
- package/clients/ast-grep-rule-manager.js +0 -89
- package/clients/ast-grep-types.js +0 -9
- package/clients/auto-loop.js +0 -131
- package/clients/biome-client.js +0 -420
- package/clients/biome-client.test.js +0 -144
- package/clients/biome-client.test.ts +0 -163
- package/clients/cache/rule-cache.js +0 -72
- package/clients/cache-manager.js +0 -245
- package/clients/cache-manager.test.js +0 -197
- package/clients/cache-manager.test.ts +0 -299
- package/clients/complexity-client.js +0 -675
- package/clients/complexity-client.test.js +0 -234
- package/clients/complexity-client.test.ts +0 -255
- package/clients/config-validator.js +0 -465
- package/clients/dependency-checker.js +0 -325
- package/clients/dependency-checker.test.js +0 -60
- package/clients/dependency-checker.test.ts +0 -71
- package/clients/dispatch/__tests__/autofix-integration.test.js +0 -245
- package/clients/dispatch/__tests__/autofix-integration.test.ts +0 -300
- package/clients/dispatch/__tests__/runner-registration.test.js +0 -234
- package/clients/dispatch/__tests__/runner-registration.test.ts +0 -286
- package/clients/dispatch/debug.log +0 -1
- package/clients/dispatch/dispatcher.edge.test.js +0 -82
- package/clients/dispatch/dispatcher.edge.test.ts +0 -100
- package/clients/dispatch/dispatcher.format.test.js +0 -46
- package/clients/dispatch/dispatcher.format.test.ts +0 -58
- package/clients/dispatch/dispatcher.inline.test.js +0 -74
- package/clients/dispatch/dispatcher.inline.test.ts +0 -93
- package/clients/dispatch/dispatcher.js +0 -381
- package/clients/dispatch/dispatcher.test.js +0 -116
- package/clients/dispatch/dispatcher.test.ts +0 -149
- package/clients/dispatch/integration.js +0 -108
- package/clients/dispatch/plan.js +0 -183
- package/clients/dispatch/runners/architect.js +0 -83
- package/clients/dispatch/runners/architect.test.js +0 -138
- package/clients/dispatch/runners/architect.test.ts +0 -162
- package/clients/dispatch/runners/ast-grep-napi.js +0 -405
- package/clients/dispatch/runners/ast-grep-napi.test.js +0 -107
- package/clients/dispatch/runners/ast-grep-napi.test.ts +0 -129
- package/clients/dispatch/runners/ast-grep.js +0 -157
- package/clients/dispatch/runners/biome.js +0 -55
- package/clients/dispatch/runners/config-validation.js +0 -67
- package/clients/dispatch/runners/go-vet.js +0 -48
- package/clients/dispatch/runners/index.js +0 -47
- package/clients/dispatch/runners/lsp.js +0 -102
- package/clients/dispatch/runners/oxlint.js +0 -67
- package/clients/dispatch/runners/oxlint.test.js +0 -230
- package/clients/dispatch/runners/oxlint.test.ts +0 -303
- package/clients/dispatch/runners/pyright.js +0 -100
- package/clients/dispatch/runners/pyright.test.js +0 -98
- package/clients/dispatch/runners/pyright.test.ts +0 -121
- package/clients/dispatch/runners/python-slop.js +0 -97
- package/clients/dispatch/runners/python-slop.test.js +0 -203
- package/clients/dispatch/runners/python-slop.test.ts +0 -298
- package/clients/dispatch/runners/ruff.js +0 -48
- package/clients/dispatch/runners/rust-clippy.js +0 -102
- package/clients/dispatch/runners/scan_codebase.test.js +0 -89
- package/clients/dispatch/runners/scan_codebase.test.ts +0 -105
- package/clients/dispatch/runners/shellcheck.js +0 -147
- package/clients/dispatch/runners/shellcheck.test.js +0 -98
- package/clients/dispatch/runners/shellcheck.test.ts +0 -129
- package/clients/dispatch/runners/similarity.js +0 -230
- package/clients/dispatch/runners/spellcheck.js +0 -106
- package/clients/dispatch/runners/spellcheck.test.js +0 -158
- package/clients/dispatch/runners/spellcheck.test.ts +0 -214
- package/clients/dispatch/runners/tree-sitter.js +0 -246
- package/clients/dispatch/runners/ts-lsp.js +0 -125
- package/clients/dispatch/runners/ts-slop.js +0 -113
- package/clients/dispatch/runners/type-safety.js +0 -142
- package/clients/dispatch/runners/utils/diagnostic-parsers.js +0 -134
- package/clients/dispatch/runners/utils/runner-helpers.js +0 -115
- package/clients/dispatch/runners/utils.js +0 -51
- package/clients/dispatch/runners/yaml-rule-parser.js +0 -360
- package/clients/dispatch/types.js +0 -16
- package/clients/dispatch/utils/format-utils.js +0 -44
- package/clients/dogfood.test.js +0 -201
- package/clients/dogfood.test.ts +0 -269
- package/clients/file-kinds.js +0 -177
- package/clients/file-kinds.test.js +0 -169
- package/clients/file-kinds.test.ts +0 -210
- package/clients/file-time.js +0 -152
- package/clients/file-utils.js +0 -40
- package/clients/fix-scanners.js +0 -204
- package/clients/format-service.js +0 -184
- package/clients/formatters.js +0 -488
- package/clients/go-client.js +0 -203
- package/clients/go-client.test.js +0 -127
- package/clients/go-client.test.ts +0 -143
- package/clients/installer/index.js +0 -403
- package/clients/interviewer-templates.js +0 -75
- package/clients/interviewer.js +0 -173
- package/clients/jscpd-client.js +0 -196
- package/clients/jscpd-client.test.js +0 -127
- package/clients/jscpd-client.test.ts +0 -145
- package/clients/knip-client.js +0 -239
- package/clients/knip-client.test.js +0 -112
- package/clients/knip-client.test.ts +0 -128
- package/clients/latency-logger.js +0 -40
- package/clients/lsp/__tests__/client.test.js +0 -310
- package/clients/lsp/__tests__/client.test.ts +0 -412
- package/clients/lsp/__tests__/config.test.js +0 -167
- package/clients/lsp/__tests__/config.test.ts +0 -217
- package/clients/lsp/__tests__/error-recovery.test.js +0 -213
- package/clients/lsp/__tests__/error-recovery.test.ts +0 -279
- package/clients/lsp/__tests__/integration.test.js +0 -127
- package/clients/lsp/__tests__/integration.test.ts +0 -160
- package/clients/lsp/__tests__/launch.test.js +0 -313
- package/clients/lsp/__tests__/launch.test.ts +0 -394
- package/clients/lsp/__tests__/server.test.js +0 -259
- package/clients/lsp/__tests__/server.test.ts +0 -332
- package/clients/lsp/__tests__/service.test.js +0 -438
- package/clients/lsp/__tests__/service.test.ts +0 -530
- package/clients/lsp/client.js +0 -350
- package/clients/lsp/config.js +0 -112
- package/clients/lsp/index.js +0 -318
- package/clients/lsp/installer/index.js +0 -391
- package/clients/lsp/interactive-install.js +0 -221
- package/clients/lsp/language.js +0 -170
- package/clients/lsp/launch.js +0 -329
- package/clients/lsp/lsp/launch.js +0 -116
- package/clients/lsp/lsp/server.js +0 -532
- package/clients/lsp/lsp-index.js +0 -10
- package/clients/lsp/path-utils.js +0 -5
- package/clients/lsp/server.js +0 -725
- package/clients/lsp/test-py-spawn/requirements.txt +0 -1
- package/clients/lsp/test-py-spawn/test.py +0 -3
- package/clients/lsp/test-py-svc/requirements.txt +0 -1
- package/clients/lsp/test-py-svc/test.py +0 -3
- package/clients/lsp/test-python-project/requirements.txt +0 -1
- package/clients/lsp/test-python-project/test.py +0 -5
- package/clients/metrics-client.js +0 -107
- package/clients/metrics-client.test.js +0 -128
- package/clients/metrics-client.test.ts +0 -163
- package/clients/metrics-history.js +0 -367
- package/clients/path-utils.js +0 -142
- package/clients/pipeline.js +0 -272
- package/clients/production-readiness.js +0 -522
- package/clients/project-index.js +0 -255
- package/clients/project-metadata.js +0 -531
- package/clients/ruff-client.js +0 -325
- package/clients/ruff-client.test.js +0 -132
- package/clients/ruff-client.test.ts +0 -153
- package/clients/rules-scanner.js +0 -97
- package/clients/runner-tracker.js +0 -152
- package/clients/rust-client.js +0 -205
- package/clients/rust-client.test.js +0 -108
- package/clients/rust-client.test.ts +0 -130
- package/clients/safe-spawn-async.js +0 -163
- package/clients/safe-spawn.js +0 -241
- package/clients/sanitize.js +0 -291
- package/clients/sanitize.test.js +0 -177
- package/clients/sanitize.test.ts +0 -223
- package/clients/scan-architectural-debt.js +0 -167
- package/clients/scan-utils.js +0 -83
- package/clients/secrets-scanner.js +0 -119
- package/clients/secrets-scanner.test.js +0 -100
- package/clients/secrets-scanner.test.ts +0 -113
- package/clients/sg-runner.js +0 -292
- package/clients/state-matrix.js +0 -160
- package/clients/subprocess-client.js +0 -65
- package/clients/symbol-types.js +0 -5
- package/clients/test-runner-client.js +0 -523
- package/clients/test-runner-client.test.js +0 -192
- package/clients/test-runner-client.test.ts +0 -253
- package/clients/test-utils.js +0 -27
- package/clients/test-utils.ts +0 -36
- package/clients/todo-scanner.js +0 -200
- package/clients/todo-scanner.test.js +0 -301
- package/clients/todo-scanner.test.ts +0 -352
- package/clients/tool-availability.js +0 -207
- package/clients/tree-sitter-client.js +0 -601
- package/clients/tree-sitter-query-loader.js +0 -355
- package/clients/tree-sitter-symbol-extractor.js +0 -289
- package/clients/ts-service.js +0 -129
- package/clients/type-coverage-client.js +0 -127
- package/clients/type-coverage-client.test.js +0 -105
- package/clients/type-coverage-client.test.ts +0 -125
- package/clients/type-safety-client.js +0 -138
- package/clients/types.js +0 -11
- package/clients/typescript-client.codefix.test.js +0 -157
- package/clients/typescript-client.codefix.test.ts +0 -186
- package/clients/typescript-client.js +0 -509
- package/clients/typescript-client.test.js +0 -105
- package/clients/typescript-client.test.ts +0 -126
- package/commands/booboo.js +0 -1007
- package/commands/fix-from-booboo.js +0 -398
- package/commands/fix-simplified.js +0 -618
- package/commands/rate.js +0 -281
- package/commands/rate.test.js +0 -119
- package/commands/rate.test.ts +0 -131
- package/commands/refactor.js +0 -130
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Interactive LSP Installer
|
|
3
|
-
*
|
|
4
|
-
* Provides lazy auto-install with user prompt for common languages.
|
|
5
|
-
*
|
|
6
|
-
* Features:
|
|
7
|
-
* - 30-second timeout with auto-accept
|
|
8
|
-
* - --auto-install flag for non-interactive mode
|
|
9
|
-
* - User choice caching per project
|
|
10
|
-
* - Only prompts for "common" languages (Go, Rust, YAML, JSON, Bash)
|
|
11
|
-
*/
|
|
12
|
-
import { spawn } from "node:child_process";
|
|
13
|
-
import * as fs from "node:fs/promises";
|
|
14
|
-
import * as path from "node:path";
|
|
15
|
-
// Languages that support interactive auto-install prompt
|
|
16
|
-
const COMMON_LANGUAGES = {
|
|
17
|
-
go: {
|
|
18
|
-
toolId: "gopls",
|
|
19
|
-
toolName: "Go Language Server (gopls)",
|
|
20
|
-
installCommand: "go install golang.org/x/tools/gopls@latest",
|
|
21
|
-
packageName: "golang.org/x/tools/gopls",
|
|
22
|
-
},
|
|
23
|
-
rust: {
|
|
24
|
-
toolId: "rust-analyzer",
|
|
25
|
-
toolName: "Rust Language Server (rust-analyzer)",
|
|
26
|
-
installCommand: "rustup component add rust-analyzer",
|
|
27
|
-
packageName: "rust-analyzer",
|
|
28
|
-
},
|
|
29
|
-
yaml: {
|
|
30
|
-
toolId: "yaml-language-server",
|
|
31
|
-
toolName: "YAML Language Server",
|
|
32
|
-
installCommand: "npm install -g yaml-language-server",
|
|
33
|
-
packageName: "yaml-language-server",
|
|
34
|
-
},
|
|
35
|
-
json: {
|
|
36
|
-
toolId: "vscode-json-language-server",
|
|
37
|
-
toolName: "JSON Language Server",
|
|
38
|
-
installCommand: "npm install -g vscode-langservers-extracted",
|
|
39
|
-
packageName: "vscode-langservers-extracted",
|
|
40
|
-
},
|
|
41
|
-
bash: {
|
|
42
|
-
toolId: "bash-language-server",
|
|
43
|
-
toolName: "Bash Language Server",
|
|
44
|
-
installCommand: "npm install -g bash-language-server",
|
|
45
|
-
packageName: "bash-language-server",
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Get the cache file path for install choices
|
|
50
|
-
*/
|
|
51
|
-
function getCachePath(cwd) {
|
|
52
|
-
return path.join(cwd, ".pi-lens", "install-choices.json");
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Read cached install choices
|
|
56
|
-
*/
|
|
57
|
-
async function readChoices(cwd) {
|
|
58
|
-
try {
|
|
59
|
-
const cachePath = getCachePath(cwd);
|
|
60
|
-
const content = await fs.readFile(cachePath, "utf-8");
|
|
61
|
-
return JSON.parse(content);
|
|
62
|
-
}
|
|
63
|
-
catch {
|
|
64
|
-
return {};
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Save install choice to cache
|
|
69
|
-
*/
|
|
70
|
-
async function saveChoice(cwd, toolId, choice) {
|
|
71
|
-
const choices = await readChoices(cwd);
|
|
72
|
-
choices[toolId] = { choice, timestamp: Date.now() };
|
|
73
|
-
try {
|
|
74
|
-
const cachePath = getCachePath(cwd);
|
|
75
|
-
await fs.mkdir(path.dirname(cachePath), { recursive: true });
|
|
76
|
-
await fs.writeFile(cachePath, JSON.stringify(choices, null, 2));
|
|
77
|
-
}
|
|
78
|
-
catch {
|
|
79
|
-
// Ignore cache write errors
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Prompt user with timeout
|
|
84
|
-
*/
|
|
85
|
-
function promptUser(timeoutMs) {
|
|
86
|
-
return new Promise((resolve) => {
|
|
87
|
-
// Set up stdin for single char input
|
|
88
|
-
process.stdin.setRawMode?.(true);
|
|
89
|
-
process.stdin.resume();
|
|
90
|
-
process.stdin.setEncoding("utf8");
|
|
91
|
-
const onData = (data) => {
|
|
92
|
-
const char = data.toString().trim().toLowerCase();
|
|
93
|
-
cleanup();
|
|
94
|
-
if (char === "y" || char === "\n" || char === "\r") {
|
|
95
|
-
resolve("yes");
|
|
96
|
-
}
|
|
97
|
-
else if (char === "n") {
|
|
98
|
-
resolve("no");
|
|
99
|
-
}
|
|
100
|
-
// For any other input, auto-accept after timeout
|
|
101
|
-
};
|
|
102
|
-
process.stdin.on("data", onData);
|
|
103
|
-
// Auto-accept after timeout
|
|
104
|
-
const timeout = setTimeout(() => {
|
|
105
|
-
cleanup();
|
|
106
|
-
resolve("yes");
|
|
107
|
-
}, timeoutMs);
|
|
108
|
-
// Handle stdin closing
|
|
109
|
-
process.stdin.on("end", () => {
|
|
110
|
-
cleanup();
|
|
111
|
-
resolve("yes");
|
|
112
|
-
});
|
|
113
|
-
function cleanup() {
|
|
114
|
-
clearTimeout(timeout);
|
|
115
|
-
process.stdin.removeListener("data", onData);
|
|
116
|
-
process.stdin.setRawMode?.(false);
|
|
117
|
-
process.stdin.pause();
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Check if --auto-install flag is set
|
|
123
|
-
*/
|
|
124
|
-
function isAutoInstallEnabled() {
|
|
125
|
-
// Check environment variable or process arguments
|
|
126
|
-
return (process.env.PI_LENS_AUTO_INSTALL === "1" ||
|
|
127
|
-
process.argv.includes("--auto-install"));
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Attempt to install a tool
|
|
131
|
-
*/
|
|
132
|
-
async function installTool(toolId, packageName) {
|
|
133
|
-
console.error(`[pi-lens] Installing ${toolId}...`);
|
|
134
|
-
return new Promise((resolve) => {
|
|
135
|
-
const proc = spawn("npm", ["install", "-g", packageName], {
|
|
136
|
-
stdio: "inherit",
|
|
137
|
-
shell: true,
|
|
138
|
-
});
|
|
139
|
-
proc.on("close", (code) => {
|
|
140
|
-
if (code === 0) {
|
|
141
|
-
console.error(`[pi-lens] ✓ ${toolId} installed successfully`);
|
|
142
|
-
resolve(true);
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
console.error(`[pi-lens] ✗ ${toolId} installation failed (exit code ${code})`);
|
|
146
|
-
resolve(false);
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
proc.on("error", (err) => {
|
|
150
|
-
console.error(`[pi-lens] ✗ ${toolId} installation error:`, err.message);
|
|
151
|
-
resolve(false);
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Prompt user for installation with timeout, or auto-install if flag set
|
|
157
|
-
*
|
|
158
|
-
* @param language - Language identifier (go, rust, yaml, json, bash)
|
|
159
|
-
* @param cwd - Project root
|
|
160
|
-
* @returns true if tool is/should be installed, false to skip
|
|
161
|
-
*/
|
|
162
|
-
export async function promptForInstall(language, cwd) {
|
|
163
|
-
const config = COMMON_LANGUAGES[language];
|
|
164
|
-
if (!config) {
|
|
165
|
-
// Not a common language, don't prompt
|
|
166
|
-
return false;
|
|
167
|
-
}
|
|
168
|
-
// Check cache first
|
|
169
|
-
const choices = await readChoices(cwd);
|
|
170
|
-
const cached = choices[config.toolId];
|
|
171
|
-
if (cached) {
|
|
172
|
-
// Cache valid for 30 days
|
|
173
|
-
const thirtyDays = 30 * 24 * 60 * 60 * 1000;
|
|
174
|
-
if (Date.now() - cached.timestamp < thirtyDays) {
|
|
175
|
-
if (cached.choice === "yes" || cached.choice === "auto") {
|
|
176
|
-
// Verify binary actually exists before trusting cache
|
|
177
|
-
try {
|
|
178
|
-
const { execSync } = await import("node:child_process");
|
|
179
|
-
execSync(`which ${config.toolId}`, { stdio: "ignore" });
|
|
180
|
-
return true; // Binary exists, cache is valid
|
|
181
|
-
}
|
|
182
|
-
catch {
|
|
183
|
-
// Binary not found, invalidate cache and continue to install
|
|
184
|
-
console.error(`[pi-lens] Cached ${config.toolId} not found, re-installing...`);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
return false; // User previously declined
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
// Check auto-install flag
|
|
193
|
-
if (isAutoInstallEnabled()) {
|
|
194
|
-
console.error(`[pi-lens] Auto-install enabled, installing ${config.toolName}...`);
|
|
195
|
-
await saveChoice(cwd, config.toolId, "auto");
|
|
196
|
-
return await installTool(config.toolId, config.packageName);
|
|
197
|
-
}
|
|
198
|
-
// Show interactive prompt
|
|
199
|
-
console.error(`\n⚠️ ${config.toolName} not found`);
|
|
200
|
-
console.error(` Install: ${config.installCommand}`);
|
|
201
|
-
console.error(`\n Install now? [Y/n] (auto-accepts in 30s)`);
|
|
202
|
-
const answer = await promptUser(30000);
|
|
203
|
-
await saveChoice(cwd, config.toolId, answer);
|
|
204
|
-
if (answer === "yes") {
|
|
205
|
-
return await installTool(config.toolId, config.packageName);
|
|
206
|
-
}
|
|
207
|
-
console.error(`[pi-lens] Skipped ${config.toolName} installation`);
|
|
208
|
-
return false;
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Get install command for display purposes
|
|
212
|
-
*/
|
|
213
|
-
export function getInstallCommand(language) {
|
|
214
|
-
return COMMON_LANGUAGES[language]?.installCommand;
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Check if a language supports interactive install
|
|
218
|
-
*/
|
|
219
|
-
export function supportsInteractiveInstall(language) {
|
|
220
|
-
return language in COMMON_LANGUAGES;
|
|
221
|
-
}
|
package/clients/lsp/language.js
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Language ID Mappings for LSP
|
|
3
|
-
*
|
|
4
|
-
* Maps file extensions to LSP language identifiers.
|
|
5
|
-
*/
|
|
6
|
-
export const LANGUAGE_EXTENSIONS = {
|
|
7
|
-
// JavaScript/TypeScript
|
|
8
|
-
".ts": "typescript",
|
|
9
|
-
".tsx": "typescriptreact",
|
|
10
|
-
".mts": "typescript",
|
|
11
|
-
".cts": "typescript",
|
|
12
|
-
".js": "javascript",
|
|
13
|
-
".jsx": "javascriptreact",
|
|
14
|
-
".mjs": "javascript",
|
|
15
|
-
".cjs": "javascript",
|
|
16
|
-
".svelte": "svelte",
|
|
17
|
-
".vue": "vue",
|
|
18
|
-
".astro": "astro",
|
|
19
|
-
// Python
|
|
20
|
-
".py": "python",
|
|
21
|
-
".pyi": "python",
|
|
22
|
-
// Go
|
|
23
|
-
".go": "go",
|
|
24
|
-
".mod": "go",
|
|
25
|
-
".sum": "go",
|
|
26
|
-
// Rust
|
|
27
|
-
".rs": "rust",
|
|
28
|
-
".ron": "rust",
|
|
29
|
-
// C/C++
|
|
30
|
-
".c": "c",
|
|
31
|
-
".cpp": "cpp",
|
|
32
|
-
".cc": "cpp",
|
|
33
|
-
".cxx": "cpp",
|
|
34
|
-
".h": "c",
|
|
35
|
-
".hpp": "cpp",
|
|
36
|
-
".hh": "cpp",
|
|
37
|
-
// Java
|
|
38
|
-
".java": "java",
|
|
39
|
-
// Kotlin
|
|
40
|
-
".kt": "kotlin",
|
|
41
|
-
".kts": "kotlin",
|
|
42
|
-
// Ruby
|
|
43
|
-
".rb": "ruby",
|
|
44
|
-
".rake": "ruby",
|
|
45
|
-
".gemspec": "ruby",
|
|
46
|
-
".ru": "ruby",
|
|
47
|
-
// PHP
|
|
48
|
-
".php": "php",
|
|
49
|
-
// C#
|
|
50
|
-
".cs": "csharp",
|
|
51
|
-
// F#
|
|
52
|
-
".fs": "fsharp",
|
|
53
|
-
".fsi": "fsharp",
|
|
54
|
-
".fsx": "fsharp",
|
|
55
|
-
// Swift
|
|
56
|
-
".swift": "swift",
|
|
57
|
-
// Dart
|
|
58
|
-
".dart": "dart",
|
|
59
|
-
// Lua
|
|
60
|
-
".lua": "lua",
|
|
61
|
-
// Shell
|
|
62
|
-
".sh": "shellscript",
|
|
63
|
-
".bash": "shellscript",
|
|
64
|
-
".zsh": "shellscript",
|
|
65
|
-
".fish": "shellscript",
|
|
66
|
-
// JSON/YAML
|
|
67
|
-
".json": "json",
|
|
68
|
-
".jsonc": "jsonc",
|
|
69
|
-
".yaml": "yaml",
|
|
70
|
-
".yml": "yaml",
|
|
71
|
-
// Markdown
|
|
72
|
-
".md": "markdown",
|
|
73
|
-
".mdx": "markdown",
|
|
74
|
-
// CSS
|
|
75
|
-
".css": "css",
|
|
76
|
-
".scss": "scss",
|
|
77
|
-
".sass": "sass",
|
|
78
|
-
".less": "less",
|
|
79
|
-
// HTML
|
|
80
|
-
".html": "html",
|
|
81
|
-
".htm": "html",
|
|
82
|
-
// SQL
|
|
83
|
-
".sql": "sql",
|
|
84
|
-
// Docker
|
|
85
|
-
".dockerfile": "dockerfile",
|
|
86
|
-
"Dockerfile": "dockerfile",
|
|
87
|
-
// Terraform
|
|
88
|
-
".tf": "terraform",
|
|
89
|
-
".tfvars": "terraform",
|
|
90
|
-
// Nix
|
|
91
|
-
".nix": "nix",
|
|
92
|
-
// Elixir
|
|
93
|
-
".ex": "elixir",
|
|
94
|
-
".exs": "elixir",
|
|
95
|
-
// Haskell
|
|
96
|
-
".hs": "haskell",
|
|
97
|
-
".lhs": "haskell",
|
|
98
|
-
// OCaml
|
|
99
|
-
".ml": "ocaml",
|
|
100
|
-
".mli": "ocaml",
|
|
101
|
-
// Zig
|
|
102
|
-
".zig": "zig",
|
|
103
|
-
".zon": "zig",
|
|
104
|
-
// Gleam
|
|
105
|
-
".gleam": "gleam",
|
|
106
|
-
// Clojure
|
|
107
|
-
".clj": "clojure",
|
|
108
|
-
".cljs": "clojure",
|
|
109
|
-
".cljc": "clojure",
|
|
110
|
-
".edn": "clojure",
|
|
111
|
-
// Scala
|
|
112
|
-
".scala": "scala",
|
|
113
|
-
".sc": "scala",
|
|
114
|
-
// R
|
|
115
|
-
".r": "r",
|
|
116
|
-
".R": "r",
|
|
117
|
-
// Julia
|
|
118
|
-
".jl": "julia",
|
|
119
|
-
// Perl
|
|
120
|
-
".pl": "perl",
|
|
121
|
-
".pm": "perl",
|
|
122
|
-
// Erlang
|
|
123
|
-
".erl": "erlang",
|
|
124
|
-
".hrl": "erlang",
|
|
125
|
-
// Fortran
|
|
126
|
-
".f": "fortran",
|
|
127
|
-
".f90": "fortran",
|
|
128
|
-
".f95": "fortran",
|
|
129
|
-
// COBOL
|
|
130
|
-
".cob": "cobol",
|
|
131
|
-
".cbl": "cobol",
|
|
132
|
-
// Pascal
|
|
133
|
-
".pas": "pascal",
|
|
134
|
-
".pp": "pascal",
|
|
135
|
-
// Ada
|
|
136
|
-
".adb": "ada",
|
|
137
|
-
".ads": "ada",
|
|
138
|
-
// VHDL/Verilog
|
|
139
|
-
".vhd": "vhdl",
|
|
140
|
-
".vhdl": "vhdl",
|
|
141
|
-
".v": "verilog",
|
|
142
|
-
".sv": "systemverilog",
|
|
143
|
-
// GraphQL
|
|
144
|
-
".graphql": "graphql",
|
|
145
|
-
".gql": "graphql",
|
|
146
|
-
// Protocol Buffers
|
|
147
|
-
".proto": "proto",
|
|
148
|
-
// TOML
|
|
149
|
-
".toml": "toml",
|
|
150
|
-
// Prisma
|
|
151
|
-
".prisma": "prisma",
|
|
152
|
-
// Typst
|
|
153
|
-
".typ": "typst",
|
|
154
|
-
".typc": "typst",
|
|
155
|
-
};
|
|
156
|
-
/**
|
|
157
|
-
* Get language ID for a file path
|
|
158
|
-
*/
|
|
159
|
-
export function getLanguageId(filePath) {
|
|
160
|
-
const ext = filePath.slice(filePath.lastIndexOf(".")).toLowerCase();
|
|
161
|
-
return LANGUAGE_EXTENSIONS[ext];
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Get all extensions for a language ID
|
|
165
|
-
*/
|
|
166
|
-
export function getExtensionsForLanguage(languageId) {
|
|
167
|
-
return Object.entries(LANGUAGE_EXTENSIONS)
|
|
168
|
-
.filter(([, id]) => id === languageId)
|
|
169
|
-
.map(([ext]) => ext);
|
|
170
|
-
}
|