@bike4mind/cli 0.2.64-worktree-refactor-extract-search-query-builders.21815 → 0.2.64
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/bin/bike4mind-cli.mjs +6 -6
- package/dist/BubblewrapRuntime-BHbtqvLx.mjs +72 -0
- package/dist/ConfigStore-CllM6jOf.mjs +8614 -0
- package/dist/ImageStore-DaKT_Ew8.mjs +202 -0
- package/dist/ProxyManager-Dl2nFk-A.mjs +259 -0
- package/dist/ProxyManager-kiOD1X8-.mjs +3 -0
- package/dist/SandboxOrchestrator-BEW3rqYi.mjs +159 -0
- package/dist/SandboxOrchestrator-CHZgSR3P.mjs +3 -0
- package/dist/SandboxRuntimeAdapter-C1B4t20N.mjs +57 -0
- package/dist/SandboxRuntimeAdapter-D7UAG13n.mjs +3 -0
- package/dist/SeatbeltRuntime-D4m0VOcD.mjs +116 -0
- package/dist/StderrViolationParser-D0afQ3-1.mjs +70 -0
- package/dist/ViolationLogStore-CZl35HcA.mjs +96 -0
- package/dist/bashExecute-BTkdqlSs-5foM20Lb.mjs +466 -0
- package/dist/commands/doctorCommand.mjs +101 -0
- package/dist/commands/headlessCommand.mjs +319 -0
- package/dist/commands/mcpCommand.mjs +218 -0
- package/dist/commands/updateCommand.mjs +40 -0
- package/dist/createFile-yQfh8uvk-I-yM5DxC.mjs +63 -0
- package/dist/deleteFile-DKHfnyny-G3b1Kj2T.mjs +66 -0
- package/dist/globFiles-D1en6joM-8jekiXdX.mjs +100 -0
- package/dist/grepSearch-aMamoBn_-DCJcY8JS.mjs +173 -0
- package/dist/index.mjs +6722 -0
- package/dist/pathValidation-Cgjh5WQO-DiCZTcq6.mjs +63 -0
- package/dist/store-Dw1nZX2Y.mjs +128 -0
- package/dist/store-nZExNOWX.mjs +3 -0
- package/dist/terminalSetup-rmr1P8KF.mjs +254 -0
- package/dist/tools-C6M5aW8W.mjs +20907 -0
- package/dist/treeSitterEngine-DCSXcm_3.mjs +309 -0
- package/dist/types-DBEjF9YS.mjs +59 -0
- package/dist/types-DK3P88Px.mjs +3 -0
- package/dist/updateChecker-Cu9dkHxV.mjs +120 -0
- package/package.json +10 -10
- package/dist/BubblewrapRuntime-PMIOLWKR.js +0 -71
- package/dist/HydrationEngine-YL2HWJ3V.js +0 -9
- package/dist/ImageStore-MMUOUPI2.js +0 -224
- package/dist/ProxyManager-HEB4TLVX.js +0 -7
- package/dist/SandboxOrchestrator-UIJ5GYBB.js +0 -8
- package/dist/SandboxRuntimeAdapter-FQ56MAB2.js +0 -13
- package/dist/SeatbeltRuntime-EE3TTLEP.js +0 -98
- package/dist/StderrViolationParser-7OYPM2DJ.js +0 -59
- package/dist/ViolationLogStore-RIIUVURH.js +0 -104
- package/dist/artifactExtractor-R7DIP2XO.js +0 -180
- package/dist/bashExecute-GLGLD3JD.js +0 -379
- package/dist/chunk-4BIBE3J7.js +0 -48
- package/dist/chunk-5LZS5CVJ.js +0 -161
- package/dist/chunk-BDQBOLYG.js +0 -120
- package/dist/chunk-BPFEGDC7.js +0 -192
- package/dist/chunk-EPIYC3LA.js +0 -13770
- package/dist/chunk-G4ZGEQFT.js +0 -250
- package/dist/chunk-GQGOWACU.js +0 -770
- package/dist/chunk-J6ZBI6TI.js +0 -1079
- package/dist/chunk-JW3JRHH7.js +0 -12433
- package/dist/chunk-KQAMBXAW.js +0 -163
- package/dist/chunk-KUVV2NAB.js +0 -19125
- package/dist/chunk-LTLJRF6I.js +0 -44
- package/dist/chunk-PFBYGCOW.js +0 -449
- package/dist/chunk-QWB6ZYY4.js +0 -48
- package/dist/chunk-SGPRXN4C.js +0 -245
- package/dist/chunk-UZUHPHZC.js +0 -95
- package/dist/chunk-WBE7SQUB.js +0 -241
- package/dist/chunk-Y4WOJJM3.js +0 -147
- package/dist/commands/doctorCommand.js +0 -87
- package/dist/commands/headlessCommand.js +0 -380
- package/dist/commands/mcpCommand.js +0 -203
- package/dist/commands/updateCommand.js +0 -42
- package/dist/create-C4VEEEYR.js +0 -12
- package/dist/createFile-6PSPLW6R.js +0 -71
- package/dist/deleteFile-AUSRLWIK.js +0 -73
- package/dist/formatConverter-5QEJDW24.js +0 -7
- package/dist/globFiles-TSRN64N2.js +0 -120
- package/dist/grepSearch-634XWZOJ.js +0 -216
- package/dist/index.js +0 -6779
- package/dist/llmMarkdownGenerator-Z6NB26TT.js +0 -371
- package/dist/markdownGenerator-SK2ZQQL4.js +0 -269
- package/dist/mementoService-N4IM6QAC.js +0 -12
- package/dist/notificationDeduplicator-HUC53NEW.js +0 -9
- package/dist/src-F4KZCAA2.js +0 -319
- package/dist/src-ISX322I7.js +0 -1101
- package/dist/store-CAB6BV3P.js +0 -11
- package/dist/subtractCredits-D4KEM6VU.js +0 -12
- package/dist/terminalSetup-C5FHMLC3.js +0 -214
- package/dist/treeSitterEngine-4SGFQDY3.js +0 -330
- package/dist/types-KB5NP6T4.js +0 -7
- package/dist/utils-JCHWDM4Z.js +0 -31
package/dist/store-CAB6BV3P.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
SubtractCreditsSchema,
|
|
4
|
-
subtractCredits
|
|
5
|
-
} from "./chunk-5LZS5CVJ.js";
|
|
6
|
-
import "./chunk-EPIYC3LA.js";
|
|
7
|
-
import "./chunk-PFBYGCOW.js";
|
|
8
|
-
import "./chunk-JW3JRHH7.js";
|
|
9
|
-
export {
|
|
10
|
-
SubtractCreditsSchema,
|
|
11
|
-
subtractCredits
|
|
12
|
-
};
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// src/utils/terminalSetup.ts
|
|
4
|
-
import { existsSync, promises as fs } from "fs";
|
|
5
|
-
import path from "path";
|
|
6
|
-
import { homedir } from "os";
|
|
7
|
-
var TERMINAL_INFO = {
|
|
8
|
-
iterm2: { name: "iTerm2", status: "native" },
|
|
9
|
-
wezterm: { name: "WezTerm", status: "native" },
|
|
10
|
-
ghostty: { name: "Ghostty", status: "native" },
|
|
11
|
-
kitty: { name: "Kitty", status: "native" },
|
|
12
|
-
vscode: { name: "VS Code", status: "configurable" },
|
|
13
|
-
alacritty: { name: "Alacritty", status: "configurable" },
|
|
14
|
-
zed: { name: "Zed", status: "manual" },
|
|
15
|
-
terminal_app: { name: "Terminal.app", status: "manual" },
|
|
16
|
-
warp: { name: "Warp", status: "manual" },
|
|
17
|
-
unknown: { name: "Unknown", status: "unknown" }
|
|
18
|
-
};
|
|
19
|
-
function detectTerminal() {
|
|
20
|
-
const termProgram = process.env["TERM_PROGRAM"] ?? "";
|
|
21
|
-
const term = process.env["TERM"] ?? "";
|
|
22
|
-
if (termProgram === "vscode" || process.env["VSCODE_PID"]) {
|
|
23
|
-
return { id: "vscode", ...TERMINAL_INFO.vscode };
|
|
24
|
-
}
|
|
25
|
-
if (termProgram === "iTerm.app" || process.env["ITERM_SESSION_ID"]) {
|
|
26
|
-
return { id: "iterm2", ...TERMINAL_INFO.iterm2 };
|
|
27
|
-
}
|
|
28
|
-
if (termProgram === "WezTerm" || process.env["WEZTERM_PANE"]) {
|
|
29
|
-
return { id: "wezterm", ...TERMINAL_INFO.wezterm };
|
|
30
|
-
}
|
|
31
|
-
if (termProgram === "ghostty" || term === "xterm-ghostty") {
|
|
32
|
-
return { id: "ghostty", ...TERMINAL_INFO.ghostty };
|
|
33
|
-
}
|
|
34
|
-
if (term === "xterm-kitty" || process.env["KITTY_PID"]) {
|
|
35
|
-
return { id: "kitty", ...TERMINAL_INFO.kitty };
|
|
36
|
-
}
|
|
37
|
-
if (termProgram === "Alacritty" || term === "alacritty") {
|
|
38
|
-
return { id: "alacritty", ...TERMINAL_INFO.alacritty };
|
|
39
|
-
}
|
|
40
|
-
if (termProgram === "WarpTerminal" || process.env["WARP_IS_LOCAL_SHELL_SESSION"]) {
|
|
41
|
-
return { id: "warp", ...TERMINAL_INFO.warp };
|
|
42
|
-
}
|
|
43
|
-
if (termProgram === "zed") {
|
|
44
|
-
return { id: "zed", ...TERMINAL_INFO.zed };
|
|
45
|
-
}
|
|
46
|
-
if (termProgram === "Apple_Terminal") {
|
|
47
|
-
return { id: "terminal_app", ...TERMINAL_INFO.terminal_app };
|
|
48
|
-
}
|
|
49
|
-
return { id: "unknown", ...TERMINAL_INFO.unknown };
|
|
50
|
-
}
|
|
51
|
-
var VSCODE_KEYBINDING = {
|
|
52
|
-
key: "shift+enter",
|
|
53
|
-
command: "workbench.action.terminal.sendSequence",
|
|
54
|
-
args: { text: "\x1B[13;2u" },
|
|
55
|
-
when: "terminalFocus"
|
|
56
|
-
};
|
|
57
|
-
async function setupVSCode() {
|
|
58
|
-
const vscodeDirs = [
|
|
59
|
-
path.join(homedir(), "Library", "Application Support", "Code", "User"),
|
|
60
|
-
// macOS
|
|
61
|
-
path.join(homedir(), ".config", "Code", "User"),
|
|
62
|
-
// Linux
|
|
63
|
-
path.join(homedir(), "AppData", "Roaming", "Code", "User")
|
|
64
|
-
// Windows
|
|
65
|
-
];
|
|
66
|
-
const vscodeDir = vscodeDirs.find((dir) => existsSync(dir));
|
|
67
|
-
if (!vscodeDir) {
|
|
68
|
-
return {
|
|
69
|
-
success: false,
|
|
70
|
-
message: "Could not find VS Code settings directory.\nManually add this to your keybindings.json (Cmd+K Cmd+S \u2192 Open Keyboard Shortcuts JSON):\n\n" + JSON.stringify(VSCODE_KEYBINDING, null, 2)
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
const keybindingsPath = path.join(vscodeDir, "keybindings.json");
|
|
74
|
-
let keybindings = [];
|
|
75
|
-
if (existsSync(keybindingsPath)) {
|
|
76
|
-
const content = await fs.readFile(keybindingsPath, "utf-8");
|
|
77
|
-
const stripped = content.replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
78
|
-
try {
|
|
79
|
-
keybindings = JSON.parse(stripped);
|
|
80
|
-
} catch {
|
|
81
|
-
return {
|
|
82
|
-
success: false,
|
|
83
|
-
message: "Could not parse keybindings.json. Manually add this entry:\n\n" + JSON.stringify(VSCODE_KEYBINDING, null, 2)
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
const alreadyConfigured = keybindings.some(
|
|
88
|
-
(binding) => binding["key"] === "shift+enter" && binding["command"] === "workbench.action.terminal.sendSequence" && binding["when"] === "terminalFocus"
|
|
89
|
-
);
|
|
90
|
-
if (alreadyConfigured) {
|
|
91
|
-
return {
|
|
92
|
-
success: true,
|
|
93
|
-
message: "VS Code is already configured for Shift+Enter newlines."
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
keybindings.push(VSCODE_KEYBINDING);
|
|
97
|
-
await fs.writeFile(keybindingsPath, JSON.stringify(keybindings, null, 2) + "\n", "utf-8");
|
|
98
|
-
return {
|
|
99
|
-
success: true,
|
|
100
|
-
message: `Updated ${keybindingsPath}
|
|
101
|
-
Shift+Enter will now insert a newline in the B4M CLI.
|
|
102
|
-
Restart your VS Code terminal for the change to take effect.`
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
var ALACRITTY_TOML_SNIPPET = `
|
|
106
|
-
# B4M CLI: Shift+Enter sends Kitty-protocol sequence for newline
|
|
107
|
-
[[keyboard.bindings]]
|
|
108
|
-
key = "Return"
|
|
109
|
-
mods = "Shift"
|
|
110
|
-
chars = "\\u001b[13;2u"
|
|
111
|
-
`.trim();
|
|
112
|
-
async function setupAlacritty() {
|
|
113
|
-
const configPaths = [
|
|
114
|
-
path.join(homedir(), ".config", "alacritty", "alacritty.toml"),
|
|
115
|
-
path.join(homedir(), ".alacritty.toml")
|
|
116
|
-
];
|
|
117
|
-
const existingConfig = configPaths.find((p) => existsSync(p));
|
|
118
|
-
const configPath = existingConfig ?? configPaths[0];
|
|
119
|
-
let content = "";
|
|
120
|
-
if (existingConfig) {
|
|
121
|
-
content = await fs.readFile(configPath, "utf-8");
|
|
122
|
-
if (content.includes("[13;2u") || content.includes("\\u001b[13;2u")) {
|
|
123
|
-
return {
|
|
124
|
-
success: true,
|
|
125
|
-
message: "Alacritty is already configured for Shift+Enter newlines."
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
const newContent = content ? content.trimEnd() + "\n\n" + ALACRITTY_TOML_SNIPPET + "\n" : ALACRITTY_TOML_SNIPPET + "\n";
|
|
130
|
-
const configDir = path.dirname(configPath);
|
|
131
|
-
if (!existsSync(configDir)) {
|
|
132
|
-
await fs.mkdir(configDir, { recursive: true });
|
|
133
|
-
}
|
|
134
|
-
await fs.writeFile(configPath, newContent, "utf-8");
|
|
135
|
-
return {
|
|
136
|
-
success: true,
|
|
137
|
-
message: `Updated ${configPath}
|
|
138
|
-
Shift+Enter will now insert a newline in the B4M CLI.
|
|
139
|
-
Restart Alacritty for the change to take effect.`
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
function getManualInstructions(terminal) {
|
|
143
|
-
switch (terminal.id) {
|
|
144
|
-
case "zed":
|
|
145
|
-
return "Add this to your Zed keymap.json (Zed \u2192 Settings \u2192 Open Key Bindings):\n\n" + JSON.stringify(
|
|
146
|
-
[
|
|
147
|
-
{
|
|
148
|
-
context: "Terminal",
|
|
149
|
-
bindings: {
|
|
150
|
-
"shift-enter": ["terminal::SendText", "\\u001b[13;2u"]
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
],
|
|
154
|
-
null,
|
|
155
|
-
2
|
|
156
|
-
);
|
|
157
|
-
case "terminal_app":
|
|
158
|
-
return "macOS Terminal.app cannot send distinct Shift+Enter sequences.\n\nAlternatives:\n \u2022 Use Option+Enter (\u2325+Enter) to insert newlines\n \u2022 Type \\ then Enter to insert newlines\n \u2022 Switch to iTerm2, WezTerm, or Ghostty for native Shift+Enter support";
|
|
159
|
-
case "warp":
|
|
160
|
-
return "Warp terminal has limited keybinding customization.\n\nAlternatives:\n \u2022 Use Option+Enter (\u2325+Enter) to insert newlines\n \u2022 Type \\ then Enter to insert newlines";
|
|
161
|
-
default:
|
|
162
|
-
return "Your terminal needs to be configured to send a distinct escape sequence for Shift+Enter.\nConfigure Shift+Enter to send: \\x1b[13;2u (Kitty keyboard protocol)\n\nAlternatives that work in all terminals:\n \u2022 Option/Alt+Enter to insert newlines\n \u2022 Type \\ then Enter to insert newlines";
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
async function runTerminalSetup() {
|
|
166
|
-
const terminal = detectTerminal();
|
|
167
|
-
console.log(`
|
|
168
|
-
Detected terminal: ${terminal.name}
|
|
169
|
-
`);
|
|
170
|
-
switch (terminal.status) {
|
|
171
|
-
case "native":
|
|
172
|
-
console.log(`\u2705 ${terminal.name} natively supports Shift+Enter for newlines.
|
|
173
|
-
No configuration needed!
|
|
174
|
-
`);
|
|
175
|
-
break;
|
|
176
|
-
case "configurable": {
|
|
177
|
-
console.log(`Configuring ${terminal.name} for Shift+Enter support...
|
|
178
|
-
`);
|
|
179
|
-
let result;
|
|
180
|
-
switch (terminal.id) {
|
|
181
|
-
case "vscode":
|
|
182
|
-
result = await setupVSCode();
|
|
183
|
-
break;
|
|
184
|
-
case "alacritty":
|
|
185
|
-
result = await setupAlacritty();
|
|
186
|
-
break;
|
|
187
|
-
default:
|
|
188
|
-
result = { success: false, message: "No auto-configuration available." };
|
|
189
|
-
}
|
|
190
|
-
console.log(result.success ? `\u2705 ${result.message}` : `\u26A0\uFE0F ${result.message}`);
|
|
191
|
-
console.log();
|
|
192
|
-
break;
|
|
193
|
-
}
|
|
194
|
-
case "manual":
|
|
195
|
-
console.log(`\u26A0\uFE0F ${terminal.name} requires manual configuration.
|
|
196
|
-
`);
|
|
197
|
-
console.log(getManualInstructions(terminal));
|
|
198
|
-
console.log();
|
|
199
|
-
break;
|
|
200
|
-
case "unknown":
|
|
201
|
-
console.log(getManualInstructions(terminal));
|
|
202
|
-
console.log();
|
|
203
|
-
break;
|
|
204
|
-
}
|
|
205
|
-
console.log("Universal newline methods (work in all terminals):");
|
|
206
|
-
console.log(" \u2022 Option/Alt + Enter \u2014 insert newline");
|
|
207
|
-
console.log(" \u2022 \\ + Enter \u2014 insert newline (backslash-escape)");
|
|
208
|
-
console.log(" \u2022 Shift + Enter \u2014 insert newline (if terminal supports Kitty protocol)");
|
|
209
|
-
console.log();
|
|
210
|
-
}
|
|
211
|
-
export {
|
|
212
|
-
detectTerminal,
|
|
213
|
-
runTerminalSetup
|
|
214
|
-
};
|
|
@@ -1,330 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// src/tools/getFileStructure/treeSitterEngine.ts
|
|
4
|
-
import { createRequire } from "module";
|
|
5
|
-
import { readFileSync } from "fs";
|
|
6
|
-
|
|
7
|
-
// src/tools/getFileStructure/types.ts
|
|
8
|
-
var EXTENSION_TO_LANGUAGE = {
|
|
9
|
-
".ts": "typescript",
|
|
10
|
-
".tsx": "tsx",
|
|
11
|
-
".js": "javascript",
|
|
12
|
-
".jsx": "javascript",
|
|
13
|
-
".mjs": "javascript",
|
|
14
|
-
".cjs": "javascript",
|
|
15
|
-
".py": "python"
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
// src/tools/getFileStructure/queries/typescript.ts
|
|
19
|
-
var typescriptQueries = {
|
|
20
|
-
imports: `
|
|
21
|
-
(import_statement
|
|
22
|
-
source: (string) @source
|
|
23
|
-
) @import
|
|
24
|
-
`,
|
|
25
|
-
exports: `
|
|
26
|
-
(export_statement
|
|
27
|
-
declaration: (function_declaration
|
|
28
|
-
name: (identifier) @name)
|
|
29
|
-
) @export
|
|
30
|
-
|
|
31
|
-
(export_statement
|
|
32
|
-
declaration: (class_declaration
|
|
33
|
-
name: (type_identifier) @name)
|
|
34
|
-
) @export
|
|
35
|
-
|
|
36
|
-
(export_statement
|
|
37
|
-
declaration: (interface_declaration
|
|
38
|
-
name: (type_identifier) @name)
|
|
39
|
-
) @export
|
|
40
|
-
|
|
41
|
-
(export_statement
|
|
42
|
-
declaration: (type_alias_declaration
|
|
43
|
-
name: (type_identifier) @name)
|
|
44
|
-
) @export
|
|
45
|
-
|
|
46
|
-
(export_statement
|
|
47
|
-
declaration: (enum_declaration
|
|
48
|
-
name: (identifier) @name)
|
|
49
|
-
) @export
|
|
50
|
-
|
|
51
|
-
(export_statement
|
|
52
|
-
declaration: (lexical_declaration
|
|
53
|
-
(variable_declarator
|
|
54
|
-
name: (identifier) @name))
|
|
55
|
-
) @export
|
|
56
|
-
|
|
57
|
-
(export_statement
|
|
58
|
-
(export_clause
|
|
59
|
-
(export_specifier
|
|
60
|
-
name: (identifier) @name))
|
|
61
|
-
) @export
|
|
62
|
-
`,
|
|
63
|
-
functions: `
|
|
64
|
-
(function_declaration
|
|
65
|
-
name: (identifier) @name
|
|
66
|
-
) @function
|
|
67
|
-
|
|
68
|
-
(lexical_declaration
|
|
69
|
-
(variable_declarator
|
|
70
|
-
name: (identifier) @name
|
|
71
|
-
value: (arrow_function)
|
|
72
|
-
)
|
|
73
|
-
) @function
|
|
74
|
-
`,
|
|
75
|
-
classes: `
|
|
76
|
-
(class_declaration
|
|
77
|
-
name: (type_identifier) @name
|
|
78
|
-
) @class
|
|
79
|
-
`,
|
|
80
|
-
interfaces: `
|
|
81
|
-
(interface_declaration
|
|
82
|
-
name: (type_identifier) @name
|
|
83
|
-
) @interface
|
|
84
|
-
`,
|
|
85
|
-
types: `
|
|
86
|
-
(type_alias_declaration
|
|
87
|
-
name: (type_identifier) @name
|
|
88
|
-
) @type
|
|
89
|
-
|
|
90
|
-
(enum_declaration
|
|
91
|
-
name: (identifier) @name
|
|
92
|
-
) @enum
|
|
93
|
-
`
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
// src/tools/getFileStructure/queries/javascript.ts
|
|
97
|
-
var javascriptQueries = {
|
|
98
|
-
imports: `
|
|
99
|
-
(import_statement
|
|
100
|
-
source: (string) @source
|
|
101
|
-
) @import
|
|
102
|
-
`,
|
|
103
|
-
exports: `
|
|
104
|
-
(export_statement
|
|
105
|
-
declaration: (function_declaration
|
|
106
|
-
name: (identifier) @name)
|
|
107
|
-
) @export
|
|
108
|
-
|
|
109
|
-
(export_statement
|
|
110
|
-
declaration: (class_declaration
|
|
111
|
-
name: (identifier) @name)
|
|
112
|
-
) @export
|
|
113
|
-
|
|
114
|
-
(export_statement
|
|
115
|
-
declaration: (lexical_declaration
|
|
116
|
-
(variable_declarator
|
|
117
|
-
name: (identifier) @name))
|
|
118
|
-
) @export
|
|
119
|
-
|
|
120
|
-
(export_statement
|
|
121
|
-
(export_clause
|
|
122
|
-
(export_specifier
|
|
123
|
-
name: (identifier) @name))
|
|
124
|
-
) @export
|
|
125
|
-
`,
|
|
126
|
-
functions: `
|
|
127
|
-
(function_declaration
|
|
128
|
-
name: (identifier) @name
|
|
129
|
-
) @function
|
|
130
|
-
|
|
131
|
-
(lexical_declaration
|
|
132
|
-
(variable_declarator
|
|
133
|
-
name: (identifier) @name
|
|
134
|
-
value: (arrow_function)
|
|
135
|
-
)
|
|
136
|
-
) @function
|
|
137
|
-
`,
|
|
138
|
-
classes: `
|
|
139
|
-
(class_declaration
|
|
140
|
-
name: (identifier) @name
|
|
141
|
-
) @class
|
|
142
|
-
`,
|
|
143
|
-
// JavaScript has no interface keyword
|
|
144
|
-
interfaces: "",
|
|
145
|
-
// JavaScript has no type aliases or enums
|
|
146
|
-
types: ""
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
// src/tools/getFileStructure/queries/python.ts
|
|
150
|
-
var pythonQueries = {
|
|
151
|
-
imports: `
|
|
152
|
-
(import_statement
|
|
153
|
-
name: (dotted_name) @source
|
|
154
|
-
) @import
|
|
155
|
-
|
|
156
|
-
(import_from_statement
|
|
157
|
-
module_name: (dotted_name) @source
|
|
158
|
-
) @import_from
|
|
159
|
-
`,
|
|
160
|
-
// Python uses __all__ convention, not language-level exports
|
|
161
|
-
exports: "",
|
|
162
|
-
functions: `
|
|
163
|
-
(function_definition
|
|
164
|
-
name: (identifier) @name
|
|
165
|
-
) @function
|
|
166
|
-
`,
|
|
167
|
-
classes: `
|
|
168
|
-
(class_definition
|
|
169
|
-
name: (identifier) @name
|
|
170
|
-
) @class
|
|
171
|
-
`,
|
|
172
|
-
// Python has no interface keyword (Protocol is a runtime construct)
|
|
173
|
-
interfaces: "",
|
|
174
|
-
// Python has no type alias syntax at the grammar level
|
|
175
|
-
types: ""
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
// src/tools/getFileStructure/queries/index.ts
|
|
179
|
-
var LANGUAGE_QUERIES = {
|
|
180
|
-
typescript: typescriptQueries,
|
|
181
|
-
tsx: typescriptQueries,
|
|
182
|
-
javascript: javascriptQueries,
|
|
183
|
-
python: pythonQueries
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
// src/tools/getFileStructure/treeSitterEngine.ts
|
|
187
|
-
var require2 = createRequire(import.meta.url);
|
|
188
|
-
var TreeSitter;
|
|
189
|
-
var parserInitialized = false;
|
|
190
|
-
var languageCache = /* @__PURE__ */ new Map();
|
|
191
|
-
function locateTreeSitterWasm() {
|
|
192
|
-
return require2.resolve("web-tree-sitter/tree-sitter.wasm");
|
|
193
|
-
}
|
|
194
|
-
function locateLanguageWasm(language) {
|
|
195
|
-
return require2.resolve(`tree-sitter-wasms/out/tree-sitter-${language}.wasm`);
|
|
196
|
-
}
|
|
197
|
-
async function ensureInitialized() {
|
|
198
|
-
if (parserInitialized) return;
|
|
199
|
-
try {
|
|
200
|
-
const moduleName = "web-tree-sitter";
|
|
201
|
-
TreeSitter = await import(
|
|
202
|
-
/* webpackIgnore: true */
|
|
203
|
-
moduleName
|
|
204
|
-
);
|
|
205
|
-
} catch {
|
|
206
|
-
throw new Error(
|
|
207
|
-
"web-tree-sitter is not available. Install it with: pnpm add web-tree-sitter tree-sitter-wasms --filter @bike4mind/cli"
|
|
208
|
-
);
|
|
209
|
-
}
|
|
210
|
-
const wasmPath = locateTreeSitterWasm();
|
|
211
|
-
const wasmBinary = readFileSync(wasmPath);
|
|
212
|
-
await TreeSitter.Parser.init({
|
|
213
|
-
locateFile: (scriptName) => {
|
|
214
|
-
if (scriptName === "tree-sitter.wasm") {
|
|
215
|
-
return wasmPath;
|
|
216
|
-
}
|
|
217
|
-
return scriptName;
|
|
218
|
-
},
|
|
219
|
-
wasmBinary
|
|
220
|
-
});
|
|
221
|
-
parserInitialized = true;
|
|
222
|
-
}
|
|
223
|
-
async function loadLanguage(languageId) {
|
|
224
|
-
const cached = languageCache.get(languageId);
|
|
225
|
-
if (cached) return cached;
|
|
226
|
-
const wasmPath = locateLanguageWasm(languageId);
|
|
227
|
-
const language = await TreeSitter.Language.load(wasmPath);
|
|
228
|
-
languageCache.set(languageId, language);
|
|
229
|
-
return language;
|
|
230
|
-
}
|
|
231
|
-
function runQuery(language, rootNode, querySource, kind) {
|
|
232
|
-
if (!querySource.trim()) return [];
|
|
233
|
-
const items = [];
|
|
234
|
-
const query = new TreeSitter.Query(language, querySource);
|
|
235
|
-
try {
|
|
236
|
-
const matches = query.matches(rootNode);
|
|
237
|
-
for (const match of matches) {
|
|
238
|
-
const nameCapture = match.captures.find((c) => c.name === "name");
|
|
239
|
-
const sourceCapture = match.captures.find((c) => c.name === "source");
|
|
240
|
-
if (kind === "import") {
|
|
241
|
-
const importCapture = match.captures.find((c) => c.name === "import" || c.name === "import_from");
|
|
242
|
-
const node = importCapture?.node || sourceCapture?.node;
|
|
243
|
-
if (node) {
|
|
244
|
-
items.push({
|
|
245
|
-
kind: "import",
|
|
246
|
-
name: sourceCapture?.node.text.replace(/['"]/g, "") || "",
|
|
247
|
-
line: node.startPosition.row + 1,
|
|
248
|
-
details: node.text
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
} else if (nameCapture) {
|
|
252
|
-
items.push({
|
|
253
|
-
kind,
|
|
254
|
-
name: nameCapture.node.text,
|
|
255
|
-
line: nameCapture.node.startPosition.row + 1,
|
|
256
|
-
...kind === "export" && { exported: true }
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
} finally {
|
|
261
|
-
query.delete();
|
|
262
|
-
}
|
|
263
|
-
return items;
|
|
264
|
-
}
|
|
265
|
-
var QUERY_CATEGORIES = [
|
|
266
|
-
["imports", "import"],
|
|
267
|
-
["exports", "export"],
|
|
268
|
-
["functions", "function"],
|
|
269
|
-
["classes", "class"],
|
|
270
|
-
["interfaces", "interface"],
|
|
271
|
-
["types", "type"]
|
|
272
|
-
];
|
|
273
|
-
async function parseFileStructure(sourceCode, languageId) {
|
|
274
|
-
await ensureInitialized();
|
|
275
|
-
const queries = LANGUAGE_QUERIES[languageId];
|
|
276
|
-
if (!queries) {
|
|
277
|
-
throw new Error(
|
|
278
|
-
`No query definitions for language: ${languageId}. Supported: ${getSupportedLanguages().join(", ")}`
|
|
279
|
-
);
|
|
280
|
-
}
|
|
281
|
-
const language = await loadLanguage(languageId);
|
|
282
|
-
const parser = new TreeSitter.Parser();
|
|
283
|
-
let tree = null;
|
|
284
|
-
try {
|
|
285
|
-
parser.setLanguage(language);
|
|
286
|
-
tree = parser.parse(sourceCode);
|
|
287
|
-
if (!tree) {
|
|
288
|
-
throw new Error("Failed to parse source code");
|
|
289
|
-
}
|
|
290
|
-
const allItems = [];
|
|
291
|
-
for (const [queryKey, kind] of QUERY_CATEGORIES) {
|
|
292
|
-
allItems.push(...runQuery(language, tree.rootNode, queries[queryKey], kind));
|
|
293
|
-
}
|
|
294
|
-
return deduplicateItems(allItems);
|
|
295
|
-
} finally {
|
|
296
|
-
tree?.delete();
|
|
297
|
-
parser.delete();
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
function deduplicateItems(items) {
|
|
301
|
-
const exportNames = /* @__PURE__ */ new Set();
|
|
302
|
-
const definitionNames = /* @__PURE__ */ new Set();
|
|
303
|
-
for (const item of items) {
|
|
304
|
-
if (item.kind === "export") {
|
|
305
|
-
exportNames.add(item.name);
|
|
306
|
-
} else if (item.kind !== "import") {
|
|
307
|
-
definitionNames.add(item.name);
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
const result = [];
|
|
311
|
-
for (const item of items) {
|
|
312
|
-
if (item.kind === "export" && definitionNames.has(item.name)) continue;
|
|
313
|
-
if (item.kind !== "export" && item.kind !== "import" && exportNames.has(item.name)) {
|
|
314
|
-
item.exported = true;
|
|
315
|
-
}
|
|
316
|
-
result.push(item);
|
|
317
|
-
}
|
|
318
|
-
return result;
|
|
319
|
-
}
|
|
320
|
-
function getSupportedLanguages() {
|
|
321
|
-
return Object.keys(LANGUAGE_QUERIES);
|
|
322
|
-
}
|
|
323
|
-
function getLanguageForExtension(ext) {
|
|
324
|
-
return EXTENSION_TO_LANGUAGE[ext] || null;
|
|
325
|
-
}
|
|
326
|
-
export {
|
|
327
|
-
getLanguageForExtension,
|
|
328
|
-
getSupportedLanguages,
|
|
329
|
-
parseFileStructure
|
|
330
|
-
};
|
package/dist/types-KB5NP6T4.js
DELETED
package/dist/utils-JCHWDM4Z.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
clearFailedAttempts,
|
|
4
|
-
generateBackupCodes,
|
|
5
|
-
generateTOTPSetup,
|
|
6
|
-
getLockoutTimeRemaining,
|
|
7
|
-
isUserLockedOut,
|
|
8
|
-
recordFailedAttempt,
|
|
9
|
-
shouldResetFailedAttempts,
|
|
10
|
-
userCanDisableMFA,
|
|
11
|
-
userEligibleForMFA,
|
|
12
|
-
userHasMFAConfigured,
|
|
13
|
-
userRequiresMFA,
|
|
14
|
-
verifyBackupCode,
|
|
15
|
-
verifyTOTPToken
|
|
16
|
-
} from "./chunk-BDQBOLYG.js";
|
|
17
|
-
export {
|
|
18
|
-
clearFailedAttempts,
|
|
19
|
-
generateBackupCodes,
|
|
20
|
-
generateTOTPSetup,
|
|
21
|
-
getLockoutTimeRemaining,
|
|
22
|
-
isUserLockedOut,
|
|
23
|
-
recordFailedAttempt,
|
|
24
|
-
shouldResetFailedAttempts,
|
|
25
|
-
userCanDisableMFA,
|
|
26
|
-
userEligibleForMFA,
|
|
27
|
-
userHasMFAConfigured,
|
|
28
|
-
userRequiresMFA,
|
|
29
|
-
verifyBackupCode,
|
|
30
|
-
verifyTOTPToken
|
|
31
|
-
};
|