@mariozechner/pi-tui 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +655 -0
- package/dist/autocomplete.d.ts +44 -0
- package/dist/autocomplete.d.ts.map +1 -0
- package/dist/autocomplete.js +454 -0
- package/dist/autocomplete.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +23 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +75 -0
- package/dist/logger.js.map +1 -0
- package/dist/markdown-component.d.ts +14 -0
- package/dist/markdown-component.d.ts.map +1 -0
- package/dist/markdown-component.js +225 -0
- package/dist/markdown-component.js.map +1 -0
- package/dist/select-list.d.ts +21 -0
- package/dist/select-list.d.ts.map +1 -0
- package/dist/select-list.js +130 -0
- package/dist/select-list.js.map +1 -0
- package/dist/text-component.d.ts +13 -0
- package/dist/text-component.d.ts.map +1 -0
- package/dist/text-component.js +90 -0
- package/dist/text-component.js.map +1 -0
- package/dist/text-editor.d.ts +40 -0
- package/dist/text-editor.d.ts.map +1 -0
- package/dist/text-editor.js +670 -0
- package/dist/text-editor.js.map +1 -0
- package/dist/tui.d.ts +58 -0
- package/dist/tui.d.ts.map +1 -0
- package/dist/tui.js +391 -0
- package/dist/tui.js.map +1 -0
- package/dist/whitespace-component.d.ts +12 -0
- package/dist/whitespace-component.d.ts.map +1 -0
- package/dist/whitespace-component.js +21 -0
- package/dist/whitespace-component.js.map +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
import { readdirSync, statSync } from "fs";
|
|
2
|
+
import mimeTypes from "mime-types";
|
|
3
|
+
import { homedir } from "os";
|
|
4
|
+
import { basename, dirname, extname, join } from "path";
|
|
5
|
+
import { logger } from "./logger.js";
|
|
6
|
+
function isAttachableFile(filePath) {
|
|
7
|
+
const mimeType = mimeTypes.lookup(filePath);
|
|
8
|
+
// Check file extension for common text files that might be misidentified
|
|
9
|
+
const textExtensions = [
|
|
10
|
+
".txt",
|
|
11
|
+
".md",
|
|
12
|
+
".markdown",
|
|
13
|
+
".js",
|
|
14
|
+
".ts",
|
|
15
|
+
".tsx",
|
|
16
|
+
".jsx",
|
|
17
|
+
".py",
|
|
18
|
+
".java",
|
|
19
|
+
".c",
|
|
20
|
+
".cpp",
|
|
21
|
+
".h",
|
|
22
|
+
".hpp",
|
|
23
|
+
".cs",
|
|
24
|
+
".php",
|
|
25
|
+
".rb",
|
|
26
|
+
".go",
|
|
27
|
+
".rs",
|
|
28
|
+
".swift",
|
|
29
|
+
".kt",
|
|
30
|
+
".scala",
|
|
31
|
+
".sh",
|
|
32
|
+
".bash",
|
|
33
|
+
".zsh",
|
|
34
|
+
".fish",
|
|
35
|
+
".html",
|
|
36
|
+
".htm",
|
|
37
|
+
".css",
|
|
38
|
+
".scss",
|
|
39
|
+
".sass",
|
|
40
|
+
".less",
|
|
41
|
+
".xml",
|
|
42
|
+
".json",
|
|
43
|
+
".yaml",
|
|
44
|
+
".yml",
|
|
45
|
+
".toml",
|
|
46
|
+
".ini",
|
|
47
|
+
".cfg",
|
|
48
|
+
".conf",
|
|
49
|
+
".log",
|
|
50
|
+
".sql",
|
|
51
|
+
".r",
|
|
52
|
+
".R",
|
|
53
|
+
".m",
|
|
54
|
+
".pl",
|
|
55
|
+
".lua",
|
|
56
|
+
".vim",
|
|
57
|
+
".dockerfile",
|
|
58
|
+
".makefile",
|
|
59
|
+
".cmake",
|
|
60
|
+
".gradle",
|
|
61
|
+
".maven",
|
|
62
|
+
".properties",
|
|
63
|
+
".env",
|
|
64
|
+
];
|
|
65
|
+
const ext = extname(filePath).toLowerCase();
|
|
66
|
+
if (textExtensions.includes(ext))
|
|
67
|
+
return true;
|
|
68
|
+
if (!mimeType)
|
|
69
|
+
return false;
|
|
70
|
+
if (mimeType.startsWith("image/"))
|
|
71
|
+
return true;
|
|
72
|
+
if (mimeType.startsWith("text/"))
|
|
73
|
+
return true;
|
|
74
|
+
// Special cases for common text files that might not be detected as text/
|
|
75
|
+
const commonTextTypes = [
|
|
76
|
+
"application/json",
|
|
77
|
+
"application/javascript",
|
|
78
|
+
"application/typescript",
|
|
79
|
+
"application/xml",
|
|
80
|
+
"application/yaml",
|
|
81
|
+
"application/x-yaml",
|
|
82
|
+
];
|
|
83
|
+
return commonTextTypes.includes(mimeType);
|
|
84
|
+
}
|
|
85
|
+
// Combined provider that handles both slash commands and file paths
|
|
86
|
+
export class CombinedAutocompleteProvider {
|
|
87
|
+
commands;
|
|
88
|
+
basePath;
|
|
89
|
+
constructor(commands = [], basePath = process.cwd()) {
|
|
90
|
+
this.commands = commands;
|
|
91
|
+
this.basePath = basePath;
|
|
92
|
+
}
|
|
93
|
+
getSuggestions(lines, cursorLine, cursorCol) {
|
|
94
|
+
logger.debug("CombinedAutocompleteProvider", "getSuggestions called", {
|
|
95
|
+
lines,
|
|
96
|
+
cursorLine,
|
|
97
|
+
cursorCol,
|
|
98
|
+
});
|
|
99
|
+
const currentLine = lines[cursorLine] || "";
|
|
100
|
+
const textBeforeCursor = currentLine.slice(0, cursorCol);
|
|
101
|
+
// Check for slash commands
|
|
102
|
+
if (textBeforeCursor.startsWith("/")) {
|
|
103
|
+
const spaceIndex = textBeforeCursor.indexOf(" ");
|
|
104
|
+
if (spaceIndex === -1) {
|
|
105
|
+
// No space yet - complete command names
|
|
106
|
+
const prefix = textBeforeCursor.slice(1); // Remove the "/"
|
|
107
|
+
const filtered = this.commands
|
|
108
|
+
.filter((cmd) => {
|
|
109
|
+
const name = "name" in cmd ? cmd.name : cmd.value; // Check if SlashCommand or AutocompleteItem
|
|
110
|
+
return name?.toLowerCase().startsWith(prefix.toLowerCase());
|
|
111
|
+
})
|
|
112
|
+
.map((cmd) => ({
|
|
113
|
+
value: "name" in cmd ? cmd.name : cmd.value,
|
|
114
|
+
label: "name" in cmd ? cmd.name : cmd.label,
|
|
115
|
+
...(cmd.description && { description: cmd.description }),
|
|
116
|
+
}));
|
|
117
|
+
if (filtered.length === 0)
|
|
118
|
+
return null;
|
|
119
|
+
return {
|
|
120
|
+
items: filtered,
|
|
121
|
+
prefix: textBeforeCursor,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
// Space found - complete command arguments
|
|
126
|
+
const commandName = textBeforeCursor.slice(1, spaceIndex); // Command without "/"
|
|
127
|
+
const argumentText = textBeforeCursor.slice(spaceIndex + 1); // Text after space
|
|
128
|
+
const command = this.commands.find((cmd) => {
|
|
129
|
+
const name = "name" in cmd ? cmd.name : cmd.value;
|
|
130
|
+
return name === commandName;
|
|
131
|
+
});
|
|
132
|
+
if (!command || !("getArgumentCompletions" in command) || !command.getArgumentCompletions) {
|
|
133
|
+
return null; // No argument completion for this command
|
|
134
|
+
}
|
|
135
|
+
const argumentSuggestions = command.getArgumentCompletions(argumentText);
|
|
136
|
+
if (!argumentSuggestions || argumentSuggestions.length === 0) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
items: argumentSuggestions,
|
|
141
|
+
prefix: argumentText,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
// Check for file paths - triggered by Tab or if we detect a path pattern
|
|
146
|
+
const pathMatch = this.extractPathPrefix(textBeforeCursor, false);
|
|
147
|
+
logger.debug("CombinedAutocompleteProvider", "Path match check", {
|
|
148
|
+
textBeforeCursor,
|
|
149
|
+
pathMatch,
|
|
150
|
+
});
|
|
151
|
+
if (pathMatch !== null) {
|
|
152
|
+
const suggestions = this.getFileSuggestions(pathMatch);
|
|
153
|
+
if (suggestions.length === 0)
|
|
154
|
+
return null;
|
|
155
|
+
return {
|
|
156
|
+
items: suggestions,
|
|
157
|
+
prefix: pathMatch,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
applyCompletion(lines, cursorLine, cursorCol, item, prefix) {
|
|
163
|
+
const currentLine = lines[cursorLine] || "";
|
|
164
|
+
const beforePrefix = currentLine.slice(0, cursorCol - prefix.length);
|
|
165
|
+
const afterCursor = currentLine.slice(cursorCol);
|
|
166
|
+
// Check if we're completing a slash command (prefix starts with "/")
|
|
167
|
+
if (prefix.startsWith("/")) {
|
|
168
|
+
// This is a command name completion
|
|
169
|
+
const newLine = beforePrefix + "/" + item.value + " " + afterCursor;
|
|
170
|
+
const newLines = [...lines];
|
|
171
|
+
newLines[cursorLine] = newLine;
|
|
172
|
+
return {
|
|
173
|
+
lines: newLines,
|
|
174
|
+
cursorLine,
|
|
175
|
+
cursorCol: beforePrefix.length + item.value.length + 2, // +2 for "/" and space
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
// Check if we're completing a file attachment (prefix starts with "@")
|
|
179
|
+
if (prefix.startsWith("@")) {
|
|
180
|
+
// This is a file attachment completion
|
|
181
|
+
const newLine = beforePrefix + item.value + " " + afterCursor;
|
|
182
|
+
const newLines = [...lines];
|
|
183
|
+
newLines[cursorLine] = newLine;
|
|
184
|
+
return {
|
|
185
|
+
lines: newLines,
|
|
186
|
+
cursorLine,
|
|
187
|
+
cursorCol: beforePrefix.length + item.value.length + 1, // +1 for space
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
// Check if we're in a slash command context (beforePrefix contains "/command ")
|
|
191
|
+
const textBeforeCursor = currentLine.slice(0, cursorCol);
|
|
192
|
+
if (textBeforeCursor.includes("/") && textBeforeCursor.includes(" ")) {
|
|
193
|
+
// This is likely a command argument completion
|
|
194
|
+
const newLine = beforePrefix + item.value + afterCursor;
|
|
195
|
+
const newLines = [...lines];
|
|
196
|
+
newLines[cursorLine] = newLine;
|
|
197
|
+
return {
|
|
198
|
+
lines: newLines,
|
|
199
|
+
cursorLine,
|
|
200
|
+
cursorCol: beforePrefix.length + item.value.length,
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
// For file paths, complete the path
|
|
204
|
+
const newLine = beforePrefix + item.value + afterCursor;
|
|
205
|
+
const newLines = [...lines];
|
|
206
|
+
newLines[cursorLine] = newLine;
|
|
207
|
+
return {
|
|
208
|
+
lines: newLines,
|
|
209
|
+
cursorLine,
|
|
210
|
+
cursorCol: beforePrefix.length + item.value.length,
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
// Extract a path-like prefix from the text before cursor
|
|
214
|
+
extractPathPrefix(text, forceExtract = false) {
|
|
215
|
+
// Check for @ file attachment syntax first
|
|
216
|
+
const atMatch = text.match(/@([^\s]*)$/);
|
|
217
|
+
if (atMatch) {
|
|
218
|
+
return atMatch[0]; // Return the full @path pattern
|
|
219
|
+
}
|
|
220
|
+
// Match paths - including those ending with /, ~/, or any word at end for forced extraction
|
|
221
|
+
// This regex captures:
|
|
222
|
+
// - Paths starting from beginning of line or after space/quote/equals
|
|
223
|
+
// - Optional ./ or ../ or ~/ prefix (including the trailing slash for ~/)
|
|
224
|
+
// - The path itself (can include / in the middle)
|
|
225
|
+
// - For forced extraction, capture any word at the end
|
|
226
|
+
const matches = text.match(/(?:^|[\s"'=])((?:~\/|\.{0,2}\/?)?(?:[^\s"'=]*\/?)*[^\s"'=]*)$/);
|
|
227
|
+
if (!matches) {
|
|
228
|
+
// If forced extraction and no matches, return empty string to trigger from current dir
|
|
229
|
+
return forceExtract ? "" : null;
|
|
230
|
+
}
|
|
231
|
+
const pathPrefix = matches[1] || "";
|
|
232
|
+
// For forced extraction (Tab key), always return something
|
|
233
|
+
if (forceExtract) {
|
|
234
|
+
return pathPrefix;
|
|
235
|
+
}
|
|
236
|
+
// For natural triggers, return if it looks like a path, ends with /, starts with ~/, .
|
|
237
|
+
// Only return empty string if the text looks like it's starting a path context
|
|
238
|
+
if (pathPrefix.includes("/") || pathPrefix.startsWith(".") || pathPrefix.startsWith("~/")) {
|
|
239
|
+
return pathPrefix;
|
|
240
|
+
}
|
|
241
|
+
// Return empty string only if we're at the beginning of the line or after a space
|
|
242
|
+
// (not after quotes or other delimiters that don't suggest file paths)
|
|
243
|
+
if (pathPrefix === "" && (text === "" || text.endsWith(" "))) {
|
|
244
|
+
return pathPrefix;
|
|
245
|
+
}
|
|
246
|
+
return null;
|
|
247
|
+
}
|
|
248
|
+
// Expand home directory (~/) to actual home path
|
|
249
|
+
expandHomePath(path) {
|
|
250
|
+
if (path.startsWith("~/")) {
|
|
251
|
+
const expandedPath = join(homedir(), path.slice(2));
|
|
252
|
+
// Preserve trailing slash if original path had one
|
|
253
|
+
return path.endsWith("/") && !expandedPath.endsWith("/") ? expandedPath + "/" : expandedPath;
|
|
254
|
+
}
|
|
255
|
+
else if (path === "~") {
|
|
256
|
+
return homedir();
|
|
257
|
+
}
|
|
258
|
+
return path;
|
|
259
|
+
}
|
|
260
|
+
// Get file/directory suggestions for a given path prefix
|
|
261
|
+
getFileSuggestions(prefix) {
|
|
262
|
+
logger.debug("CombinedAutocompleteProvider", "getFileSuggestions called", {
|
|
263
|
+
prefix,
|
|
264
|
+
basePath: this.basePath,
|
|
265
|
+
});
|
|
266
|
+
try {
|
|
267
|
+
let searchDir;
|
|
268
|
+
let searchPrefix;
|
|
269
|
+
let expandedPrefix = prefix;
|
|
270
|
+
let isAtPrefix = false;
|
|
271
|
+
// Handle @ file attachment prefix
|
|
272
|
+
if (prefix.startsWith("@")) {
|
|
273
|
+
isAtPrefix = true;
|
|
274
|
+
expandedPrefix = prefix.slice(1); // Remove the @
|
|
275
|
+
}
|
|
276
|
+
// Handle home directory expansion
|
|
277
|
+
if (expandedPrefix.startsWith("~")) {
|
|
278
|
+
expandedPrefix = this.expandHomePath(expandedPrefix);
|
|
279
|
+
}
|
|
280
|
+
if (expandedPrefix === "" ||
|
|
281
|
+
expandedPrefix === "./" ||
|
|
282
|
+
expandedPrefix === "../" ||
|
|
283
|
+
expandedPrefix === "~" ||
|
|
284
|
+
expandedPrefix === "~/" ||
|
|
285
|
+
prefix === "@") {
|
|
286
|
+
// Complete from specified position
|
|
287
|
+
if (prefix.startsWith("~")) {
|
|
288
|
+
searchDir = expandedPrefix;
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
searchDir = join(this.basePath, expandedPrefix);
|
|
292
|
+
}
|
|
293
|
+
searchPrefix = "";
|
|
294
|
+
}
|
|
295
|
+
else if (expandedPrefix.endsWith("/")) {
|
|
296
|
+
// If prefix ends with /, show contents of that directory
|
|
297
|
+
if (prefix.startsWith("~") || (isAtPrefix && expandedPrefix.startsWith("/"))) {
|
|
298
|
+
searchDir = expandedPrefix;
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
searchDir = join(this.basePath, expandedPrefix);
|
|
302
|
+
}
|
|
303
|
+
searchPrefix = "";
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
// Split into directory and file prefix
|
|
307
|
+
const dir = dirname(expandedPrefix);
|
|
308
|
+
const file = basename(expandedPrefix);
|
|
309
|
+
if (prefix.startsWith("~") || (isAtPrefix && expandedPrefix.startsWith("/"))) {
|
|
310
|
+
searchDir = dir;
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
searchDir = join(this.basePath, dir);
|
|
314
|
+
}
|
|
315
|
+
searchPrefix = file;
|
|
316
|
+
}
|
|
317
|
+
logger.debug("CombinedAutocompleteProvider", "Searching directory", {
|
|
318
|
+
searchDir,
|
|
319
|
+
searchPrefix,
|
|
320
|
+
});
|
|
321
|
+
const entries = readdirSync(searchDir);
|
|
322
|
+
const suggestions = [];
|
|
323
|
+
for (const entry of entries) {
|
|
324
|
+
if (!entry.toLowerCase().startsWith(searchPrefix.toLowerCase())) {
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
const fullPath = join(searchDir, entry);
|
|
328
|
+
const isDirectory = statSync(fullPath).isDirectory();
|
|
329
|
+
// For @ prefix, filter to only show directories and attachable files
|
|
330
|
+
if (isAtPrefix && !isDirectory && !isAttachableFile(fullPath)) {
|
|
331
|
+
continue;
|
|
332
|
+
}
|
|
333
|
+
let relativePath;
|
|
334
|
+
// Handle @ prefix path construction
|
|
335
|
+
if (isAtPrefix) {
|
|
336
|
+
const pathWithoutAt = expandedPrefix;
|
|
337
|
+
if (pathWithoutAt.endsWith("/")) {
|
|
338
|
+
relativePath = "@" + pathWithoutAt + entry;
|
|
339
|
+
}
|
|
340
|
+
else if (pathWithoutAt.includes("/")) {
|
|
341
|
+
if (pathWithoutAt.startsWith("~/")) {
|
|
342
|
+
const homeRelativeDir = pathWithoutAt.slice(2); // Remove ~/
|
|
343
|
+
const dir = dirname(homeRelativeDir);
|
|
344
|
+
relativePath = "@~/" + (dir === "." ? entry : join(dir, entry));
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
relativePath = "@" + join(dirname(pathWithoutAt), entry);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
|
+
if (pathWithoutAt.startsWith("~")) {
|
|
352
|
+
relativePath = "@~/" + entry;
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
relativePath = "@" + entry;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
else if (prefix.endsWith("/")) {
|
|
360
|
+
// If prefix ends with /, append entry to the prefix
|
|
361
|
+
relativePath = prefix + entry;
|
|
362
|
+
}
|
|
363
|
+
else if (prefix.includes("/")) {
|
|
364
|
+
// Preserve ~/ format for home directory paths
|
|
365
|
+
if (prefix.startsWith("~/")) {
|
|
366
|
+
const homeRelativeDir = prefix.slice(2); // Remove ~/
|
|
367
|
+
const dir = dirname(homeRelativeDir);
|
|
368
|
+
relativePath = "~/" + (dir === "." ? entry : join(dir, entry));
|
|
369
|
+
}
|
|
370
|
+
else {
|
|
371
|
+
relativePath = join(dirname(prefix), entry);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
// For standalone entries, preserve ~/ if original prefix was ~/
|
|
376
|
+
if (prefix.startsWith("~")) {
|
|
377
|
+
relativePath = "~/" + entry;
|
|
378
|
+
}
|
|
379
|
+
else {
|
|
380
|
+
relativePath = entry;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
suggestions.push({
|
|
384
|
+
value: isDirectory ? relativePath + "/" : relativePath,
|
|
385
|
+
label: entry,
|
|
386
|
+
description: isDirectory ? "directory" : "file",
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
// Sort directories first, then alphabetically
|
|
390
|
+
suggestions.sort((a, b) => {
|
|
391
|
+
const aIsDir = a.description === "directory";
|
|
392
|
+
const bIsDir = b.description === "directory";
|
|
393
|
+
if (aIsDir && !bIsDir)
|
|
394
|
+
return -1;
|
|
395
|
+
if (!aIsDir && bIsDir)
|
|
396
|
+
return 1;
|
|
397
|
+
return a.label.localeCompare(b.label);
|
|
398
|
+
});
|
|
399
|
+
logger.debug("CombinedAutocompleteProvider", "Returning suggestions", {
|
|
400
|
+
count: suggestions.length,
|
|
401
|
+
firstFew: suggestions.slice(0, 3).map((s) => s.label),
|
|
402
|
+
});
|
|
403
|
+
return suggestions.slice(0, 10); // Limit to 10 suggestions
|
|
404
|
+
}
|
|
405
|
+
catch (e) {
|
|
406
|
+
// Directory doesn't exist or not accessible
|
|
407
|
+
logger.error("CombinedAutocompleteProvider", "Error reading directory", {
|
|
408
|
+
error: e instanceof Error ? e.message : String(e),
|
|
409
|
+
});
|
|
410
|
+
return [];
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
// Force file completion (called on Tab key) - always returns suggestions
|
|
414
|
+
getForceFileSuggestions(lines, cursorLine, cursorCol) {
|
|
415
|
+
logger.debug("CombinedAutocompleteProvider", "getForceFileSuggestions called", {
|
|
416
|
+
lines,
|
|
417
|
+
cursorLine,
|
|
418
|
+
cursorCol,
|
|
419
|
+
});
|
|
420
|
+
const currentLine = lines[cursorLine] || "";
|
|
421
|
+
const textBeforeCursor = currentLine.slice(0, cursorCol);
|
|
422
|
+
// Don't trigger if we're in a slash command
|
|
423
|
+
if (textBeforeCursor.startsWith("/") && !textBeforeCursor.includes(" ")) {
|
|
424
|
+
return null;
|
|
425
|
+
}
|
|
426
|
+
// Force extract path prefix - this will always return something
|
|
427
|
+
const pathMatch = this.extractPathPrefix(textBeforeCursor, true);
|
|
428
|
+
logger.debug("CombinedAutocompleteProvider", "Forced path match", {
|
|
429
|
+
textBeforeCursor,
|
|
430
|
+
pathMatch,
|
|
431
|
+
});
|
|
432
|
+
if (pathMatch !== null) {
|
|
433
|
+
const suggestions = this.getFileSuggestions(pathMatch);
|
|
434
|
+
if (suggestions.length === 0)
|
|
435
|
+
return null;
|
|
436
|
+
return {
|
|
437
|
+
items: suggestions,
|
|
438
|
+
prefix: pathMatch,
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
return null;
|
|
442
|
+
}
|
|
443
|
+
// Check if we should trigger file completion (called on Tab key)
|
|
444
|
+
shouldTriggerFileCompletion(lines, cursorLine, cursorCol) {
|
|
445
|
+
const currentLine = lines[cursorLine] || "";
|
|
446
|
+
const textBeforeCursor = currentLine.slice(0, cursorCol);
|
|
447
|
+
// Don't trigger if we're in a slash command
|
|
448
|
+
if (textBeforeCursor.startsWith("/") && !textBeforeCursor.includes(" ")) {
|
|
449
|
+
return false;
|
|
450
|
+
}
|
|
451
|
+
return true;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
//# sourceMappingURL=autocomplete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autocomplete.js","sourceRoot":"","sources":["../src/autocomplete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC3C,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,S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AI,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;YACvD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,IAAI,CAAC;YAE1C,OAAO;gBACN,KAAK,EAAE,WAAW;gBAClB,MAAM,EAAE,SAAS;aACjB,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACb,CAAC;IAED,iEAAiE;IACjE,2BAA2B,CAAC,KAAe,EAAE,UAAkB,EAAE,SAAiB;QACjF,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QAC5C,MAAM,gBAAgB,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;QAEzD,4CAA4C;QAC5C,IAAI,gBAAgB,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACzE,OAAO,KAAK,CAAC;QACd,CAAC;QAED,OAAO,IAAI,CAAC;IACb,CAAC;CACD"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { type AutocompleteItem, type AutocompleteProvider, CombinedAutocompleteProvider, type SlashCommand, } from "./autocomplete.js";
|
|
2
|
+
export { type LoggerConfig, logger } from "./logger.js";
|
|
3
|
+
export { MarkdownComponent } from "./markdown-component.js";
|
|
4
|
+
export { type SelectItem, SelectList } from "./select-list.js";
|
|
5
|
+
export { TextComponent } from "./text-component.js";
|
|
6
|
+
export { TextEditor, type TextEditorConfig } from "./text-editor.js";
|
|
7
|
+
export { type Component, type ComponentRenderResult, Container, type ContainerRenderResult, type Padding, TUI, } from "./tui.js";
|
|
8
|
+
export { WhitespaceComponent } from "./whitespace-component.js";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,4BAA4B,EAC5B,KAAK,YAAY,GACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,KAAK,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE/D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EACN,KAAK,SAAS,EACd,KAAK,qBAAqB,EAC1B,SAAS,EACT,KAAK,qBAAqB,EAC1B,KAAK,OAAO,EACZ,GAAG,GACH,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Core TUI interfaces and classes
|
|
2
|
+
// Autocomplete support
|
|
3
|
+
export { CombinedAutocompleteProvider, } from "./autocomplete.js";
|
|
4
|
+
// Logger for debugging
|
|
5
|
+
export { logger } from "./logger.js";
|
|
6
|
+
// Markdown component
|
|
7
|
+
export { MarkdownComponent } from "./markdown-component.js";
|
|
8
|
+
// Select list component
|
|
9
|
+
export { SelectList } from "./select-list.js";
|
|
10
|
+
// Text component
|
|
11
|
+
export { TextComponent } from "./text-component.js";
|
|
12
|
+
// Text editor component
|
|
13
|
+
export { TextEditor } from "./text-editor.js";
|
|
14
|
+
export { Container, TUI, } from "./tui.js";
|
|
15
|
+
// Whitespace component
|
|
16
|
+
export { WhitespaceComponent } from "./whitespace-component.js";
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAElC,uBAAuB;AACvB,OAAO,EAGN,4BAA4B,GAE5B,MAAM,mBAAmB,CAAC;AAC3B,uBAAuB;AACvB,OAAO,EAAqB,MAAM,EAAE,MAAM,aAAa,CAAC;AACxD,qBAAqB;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,wBAAwB;AACxB,OAAO,EAAmB,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC/D,iBAAiB;AACjB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,wBAAwB;AACxB,OAAO,EAAE,UAAU,EAAyB,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAGN,SAAS,EAGT,GAAG,GACH,MAAM,UAAU,CAAC;AAClB,uBAAuB;AACvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC"}
|
package/dist/logger.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface LoggerConfig {
|
|
2
|
+
enabled: boolean;
|
|
3
|
+
logFile: string;
|
|
4
|
+
logLevel: "debug" | "info" | "warn" | "error";
|
|
5
|
+
}
|
|
6
|
+
declare class Logger {
|
|
7
|
+
private config;
|
|
8
|
+
configure(config: Partial<LoggerConfig>): void;
|
|
9
|
+
private shouldLog;
|
|
10
|
+
private log;
|
|
11
|
+
debug(component: string, message: string, data?: any): void;
|
|
12
|
+
info(component: string, message: string, data?: any): void;
|
|
13
|
+
warn(component: string, message: string, data?: any): void;
|
|
14
|
+
error(component: string, message: string, data?: any): void;
|
|
15
|
+
keyInput(component: string, keyData: string): void;
|
|
16
|
+
render(component: string, renderResult: any): void;
|
|
17
|
+
focus(component: string, focused: boolean): void;
|
|
18
|
+
componentLifecycle(component: string, action: string, details?: any): void;
|
|
19
|
+
stateChange(component: string, property: string, oldValue: any, newValue: any): void;
|
|
20
|
+
}
|
|
21
|
+
export declare const logger: Logger;
|
|
22
|
+
export {};
|
|
23
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AE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,GAAG,IAAI;CAGpF;AAED,eAAO,MAAM,MAAM,QAAe,CAAC"}
|
package/dist/logger.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { appendFileSync, writeFileSync } from "fs";
|
|
2
|
+
import { join } from "path";
|
|
3
|
+
class Logger {
|
|
4
|
+
config = {
|
|
5
|
+
enabled: false,
|
|
6
|
+
logFile: join(process.cwd(), "tui-debug.log"),
|
|
7
|
+
logLevel: "debug",
|
|
8
|
+
};
|
|
9
|
+
configure(config) {
|
|
10
|
+
this.config = { ...this.config, ...config };
|
|
11
|
+
if (this.config.enabled) {
|
|
12
|
+
// Clear log file on startup
|
|
13
|
+
try {
|
|
14
|
+
writeFileSync(this.config.logFile, `=== TUI Debug Log Started ${new Date().toISOString()} ===\n`);
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
// Silently fail if we can't write to log file
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
shouldLog(level) {
|
|
22
|
+
if (!this.config.enabled)
|
|
23
|
+
return false;
|
|
24
|
+
const levels = ["debug", "info", "warn", "error"];
|
|
25
|
+
const currentLevel = levels.indexOf(this.config.logLevel);
|
|
26
|
+
const messageLevel = levels.indexOf(level);
|
|
27
|
+
return messageLevel >= currentLevel;
|
|
28
|
+
}
|
|
29
|
+
log(level, component, message, data) {
|
|
30
|
+
if (!this.shouldLog(level))
|
|
31
|
+
return;
|
|
32
|
+
try {
|
|
33
|
+
const timestamp = new Date().toISOString();
|
|
34
|
+
const dataStr = data ? ` | Data: ${JSON.stringify(data)}` : "";
|
|
35
|
+
const logLine = `[${timestamp}] ${level.toUpperCase()} [${component}] ${message}${dataStr}\n`;
|
|
36
|
+
appendFileSync(this.config.logFile, logLine);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
// Silently fail if we can't write to log file
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
debug(component, message, data) {
|
|
43
|
+
this.log("debug", component, message, data);
|
|
44
|
+
}
|
|
45
|
+
info(component, message, data) {
|
|
46
|
+
this.log("info", component, message, data);
|
|
47
|
+
}
|
|
48
|
+
warn(component, message, data) {
|
|
49
|
+
this.log("warn", component, message, data);
|
|
50
|
+
}
|
|
51
|
+
error(component, message, data) {
|
|
52
|
+
this.log("error", component, message, data);
|
|
53
|
+
}
|
|
54
|
+
// Specific TUI logging methods
|
|
55
|
+
keyInput(component, keyData) {
|
|
56
|
+
this.debug(component, "Key input received", {
|
|
57
|
+
keyData,
|
|
58
|
+
charCodes: Array.from(keyData).map((c) => c.charCodeAt(0)),
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
render(component, renderResult) {
|
|
62
|
+
this.debug(component, "Render result", renderResult);
|
|
63
|
+
}
|
|
64
|
+
focus(component, focused) {
|
|
65
|
+
this.info(component, `Focus ${focused ? "gained" : "lost"}`);
|
|
66
|
+
}
|
|
67
|
+
componentLifecycle(component, action, details) {
|
|
68
|
+
this.info(component, `Component ${action}`, details);
|
|
69
|
+
}
|
|
70
|
+
stateChange(component, property, oldValue, newValue) {
|
|
71
|
+
this.debug(component, `State change: ${property}`, { oldValue, newValue });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export const logger = new Logger();
|
|
75
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAQ5B,MAAM,MAAM;IACH,MAAM,GAAiB;QAC9B,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,eAAe,CAAC;QAC7C,Q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AAC,SAAiB,EAAE,OAAgB;QACxC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED,kBAAkB,CAAC,SAAiB,EAAE,MAAc,EAAE,OAAa;QAClE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC;IAED,WAAW,CAAC,SAAiB,EAAE,QAAgB,EAAE,QAAa,EAAE,QAAa;QAC5E,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,iBAAiB,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC5E,CAAC;CACD;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Component, ComponentRenderResult } from "./tui.js";
|
|
2
|
+
export declare class MarkdownComponent implements Component {
|
|
3
|
+
private text;
|
|
4
|
+
private lines;
|
|
5
|
+
private previousLines;
|
|
6
|
+
constructor(text?: string);
|
|
7
|
+
setText(text: string): void;
|
|
8
|
+
render(width: number): ComponentRenderResult;
|
|
9
|
+
private renderToken;
|
|
10
|
+
private renderInlineTokens;
|
|
11
|
+
private wrapLine;
|
|
12
|
+
private getVisibleLength;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=markdown-component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown-component.d.ts","sourceRoot":"","sources":["../src/markdown-component.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjE,qBAAa,iBAAkB,YAAW,SAAS;IAClD,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,aAAa,CAAgB;gBAEzB,IAAI,GAAE,MAAW;IAI7B,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI3B,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,qBAAqB;IAkC5C,OAAO,CAAC,WAAW;IAmGnB,OAAO,CAAC,kBAAkB;IAmD1B,OAAO,CAAC,QAAQ;IAsDhB,OAAO,CAAC,gBAAgB;CAIxB"}
|