@yeshwanthyk/open-tui 0.1.0 → 0.1.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.
- package/dist/app.d.ts +18 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.jsx +28 -0
- package/dist/app.jsx.map +1 -0
- package/dist/autocomplete/autocomplete.d.ts +48 -0
- package/dist/autocomplete/autocomplete.d.ts.map +1 -0
- package/dist/autocomplete/autocomplete.js +391 -0
- package/dist/autocomplete/autocomplete.js.map +1 -0
- package/dist/autocomplete/file-index.d.ts +36 -0
- package/dist/autocomplete/file-index.d.ts.map +1 -0
- package/dist/autocomplete/file-index.js +143 -0
- package/dist/autocomplete/file-index.js.map +1 -0
- package/dist/autocomplete/index.d.ts +3 -0
- package/dist/autocomplete/index.d.ts.map +1 -0
- package/dist/autocomplete/index.js +3 -0
- package/dist/autocomplete/index.js.map +1 -0
- package/dist/components/badge.d.ts +11 -0
- package/dist/components/badge.d.ts.map +1 -0
- package/dist/components/badge.jsx +31 -0
- package/dist/components/badge.jsx.map +1 -0
- package/dist/components/code-block.d.ts +12 -0
- package/dist/components/code-block.d.ts.map +1 -0
- package/dist/components/code-block.jsx +34 -0
- package/dist/components/code-block.jsx.map +1 -0
- package/dist/components/dialog.d.ts +12 -0
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dialog.jsx +29 -0
- package/dist/components/dialog.jsx.map +1 -0
- package/dist/components/diff.d.ts +11 -0
- package/dist/components/diff.d.ts.map +1 -0
- package/dist/components/diff.jsx +17 -0
- package/dist/components/diff.jsx.map +1 -0
- package/dist/components/divider.d.ts +9 -0
- package/dist/components/divider.d.ts.map +1 -0
- package/dist/components/divider.jsx +13 -0
- package/dist/components/divider.jsx.map +1 -0
- package/dist/components/editor.d.ts +87 -0
- package/dist/components/editor.d.ts.map +1 -0
- package/dist/components/editor.jsx +146 -0
- package/dist/components/editor.jsx.map +1 -0
- package/dist/components/image.d.ts +65 -0
- package/dist/components/image.d.ts.map +1 -0
- package/dist/components/image.jsx +319 -0
- package/dist/components/image.jsx.map +1 -0
- package/dist/components/loader.d.ts +25 -0
- package/dist/components/loader.d.ts.map +1 -0
- package/dist/components/loader.jsx +31 -0
- package/dist/components/loader.jsx.map +1 -0
- package/dist/components/markdown.d.ts +28 -0
- package/dist/components/markdown.d.ts.map +1 -0
- package/dist/components/markdown.jsx +30 -0
- package/dist/components/markdown.jsx.map +1 -0
- package/dist/components/panel.d.ts +12 -0
- package/dist/components/panel.d.ts.map +1 -0
- package/dist/components/panel.jsx +51 -0
- package/dist/components/panel.jsx.map +1 -0
- package/dist/components/select-list.d.ts +55 -0
- package/dist/components/select-list.d.ts.map +1 -0
- package/dist/components/select-list.jsx +135 -0
- package/dist/components/select-list.jsx.map +1 -0
- package/dist/components/spacer.d.ts +25 -0
- package/dist/components/spacer.d.ts.map +1 -0
- package/dist/components/spacer.jsx +27 -0
- package/dist/components/spacer.jsx.map +1 -0
- package/dist/components/toast.d.ts +19 -0
- package/dist/components/toast.d.ts.map +1 -0
- package/dist/components/toast.jsx +52 -0
- package/dist/components/toast.jsx.map +1 -0
- package/dist/context/terminal.d.ts +7 -0
- package/dist/context/terminal.d.ts.map +1 -0
- package/dist/context/terminal.jsx +6 -0
- package/dist/context/terminal.jsx.map +1 -0
- package/dist/context/theme.d.ts +117 -0
- package/dist/context/theme.d.ts.map +1 -0
- package/dist/context/theme.jsx +650 -0
- package/dist/context/theme.jsx.map +1 -0
- package/dist/hooks/use-keyboard.d.ts +7 -0
- package/dist/hooks/use-keyboard.d.ts.map +1 -0
- package/dist/hooks/use-keyboard.js +6 -0
- package/dist/hooks/use-keyboard.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/opentui-augmentations.d.ts +9 -0
- package/dist/opentui-augmentations.d.ts.map +1 -0
- package/dist/opentui-augmentations.js +1 -0
- package/dist/opentui-augmentations.js.map +1 -0
- package/dist/parsers-config.d.ts +16 -0
- package/dist/parsers-config.d.ts.map +1 -0
- package/dist/parsers-config.js +119 -0
- package/dist/parsers-config.js.map +1 -0
- package/dist/themes/aura.json +69 -0
- package/dist/themes/ayu.json +80 -0
- package/dist/themes/catppuccin-macchiato.json +233 -0
- package/dist/themes/catppuccin.json +112 -0
- package/dist/themes/cobalt2.json +228 -0
- package/dist/themes/dracula.json +219 -0
- package/dist/themes/everforest.json +241 -0
- package/dist/themes/flexoki.json +237 -0
- package/dist/themes/github.json +233 -0
- package/dist/themes/gruvbox.json +95 -0
- package/dist/themes/kanagawa.json +77 -0
- package/dist/themes/lucent-orng.json +227 -0
- package/dist/themes/marvin.json +97 -0
- package/dist/themes/material.json +235 -0
- package/dist/themes/matrix.json +77 -0
- package/dist/themes/mercury.json +245 -0
- package/dist/themes/monokai.json +221 -0
- package/dist/themes/nightowl.json +221 -0
- package/dist/themes/nord.json +223 -0
- package/dist/themes/one-dark.json +84 -0
- package/dist/themes/opencode.json +245 -0
- package/dist/themes/orng.json +245 -0
- package/dist/themes/palenight.json +222 -0
- package/dist/themes/rosepine.json +234 -0
- package/dist/themes/solarized.json +223 -0
- package/dist/themes/synthwave84.json +226 -0
- package/dist/themes/tokyonight.json +243 -0
- package/dist/themes/vercel.json +245 -0
- package/dist/themes/vesper.json +218 -0
- package/dist/themes/zenburn.json +223 -0
- package/dist/utils/clipboard.d.ts +12 -0
- package/dist/utils/clipboard.d.ts.map +1 -0
- package/dist/utils/clipboard.js +52 -0
- package/dist/utils/clipboard.js.map +1 -0
- package/dist/utils/text-width.d.ts +26 -0
- package/dist/utils/text-width.d.ts.map +1 -0
- package/dist/utils/text-width.js +101 -0
- package/dist/utils/text-width.js.map +1 -0
- package/package.json +13 -4
- package/src/index.ts +0 -121
package/dist/app.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* App entry point - wrapper around OpenTUI's render function
|
|
3
|
+
*/
|
|
4
|
+
import type { CliRendererConfig } from "@opentui/core";
|
|
5
|
+
import type { JSX } from "@opentui/solid/jsx-runtime";
|
|
6
|
+
export interface AppConfig extends CliRendererConfig {
|
|
7
|
+
/** Exit callback when app terminates */
|
|
8
|
+
onExit?: () => Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Start the TUI application with the given root component
|
|
12
|
+
*
|
|
13
|
+
* @param rootComponent - Function returning the root JSX element
|
|
14
|
+
* @param config - Configuration options for the renderer
|
|
15
|
+
* @returns Promise that resolves when the app exits
|
|
16
|
+
*/
|
|
17
|
+
export declare function startApp(rootComponent: () => JSX.Element, config?: AppConfig): Promise<void>;
|
|
18
|
+
//# sourceMappingURL=app.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEtD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAA;AAErD,MAAM,WAAW,SAAU,SAAQ,iBAAiB;IACnD,wCAAwC;IACxC,MAAM,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC5B;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,CAAC,OAAO,EAAE,MAAM,GAAE,SAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBhG"}
|
package/dist/app.jsx
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* App entry point - wrapper around OpenTUI's render function
|
|
3
|
+
*/
|
|
4
|
+
import { render } from "@opentui/solid";
|
|
5
|
+
/**
|
|
6
|
+
* Start the TUI application with the given root component
|
|
7
|
+
*
|
|
8
|
+
* @param rootComponent - Function returning the root JSX element
|
|
9
|
+
* @param config - Configuration options for the renderer
|
|
10
|
+
* @returns Promise that resolves when the app exits
|
|
11
|
+
*/
|
|
12
|
+
export function startApp(rootComponent, config = {}) {
|
|
13
|
+
return new Promise((resolve) => {
|
|
14
|
+
const { onExit, ...renderConfig } = config;
|
|
15
|
+
render(rootComponent, {
|
|
16
|
+
targetFps: 30,
|
|
17
|
+
exitOnCtrlC: false,
|
|
18
|
+
useKittyKeyboard: {},
|
|
19
|
+
...renderConfig,
|
|
20
|
+
onDestroy: async () => {
|
|
21
|
+
renderConfig.onDestroy?.();
|
|
22
|
+
await onExit?.();
|
|
23
|
+
resolve();
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=app.jsx.map
|
package/dist/app.jsx.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.jsx","sourceRoot":"","sources":["../src/app.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAQvC;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,aAAgC,EAAE,SAAoB,EAAE;IAChF,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;QACpC,MAAM,EAAE,MAAM,EAAE,GAAG,YAAY,EAAE,GAAG,MAAM,CAAA;QAE1C,MAAM,CAAC,aAAa,EAAE;YACrB,SAAS,EAAE,EAAE;YACb,WAAW,EAAE,KAAK;YAClB,gBAAgB,EAAE,EAAE;YACpB,GAAG,YAAY;YACf,SAAS,EAAE,KAAK,IAAI,EAAE;gBACrB,YAAY,CAAC,SAAS,EAAE,EAAE,CAAA;gBAC1B,MAAM,MAAM,EAAE,EAAE,CAAA;gBAChB,OAAO,EAAE,CAAA;YACV,CAAC;SACD,CAAC,CAAA;IACH,CAAC,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export interface AutocompleteItem {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface SlashCommand {
|
|
7
|
+
name: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
getArgumentCompletions?(argumentPrefix: string): AutocompleteItem[] | null;
|
|
10
|
+
}
|
|
11
|
+
export interface AutocompleteProvider {
|
|
12
|
+
getSuggestions(lines: string[], cursorLine: number, cursorCol: number): {
|
|
13
|
+
items: AutocompleteItem[];
|
|
14
|
+
prefix: string;
|
|
15
|
+
} | null;
|
|
16
|
+
applyCompletion(lines: string[], cursorLine: number, cursorCol: number, item: AutocompleteItem, prefix: string): {
|
|
17
|
+
lines: string[];
|
|
18
|
+
cursorLine: number;
|
|
19
|
+
cursorCol: number;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export declare class CombinedAutocompleteProvider implements AutocompleteProvider {
|
|
23
|
+
private commands;
|
|
24
|
+
private basePath;
|
|
25
|
+
private fileIndex;
|
|
26
|
+
constructor(commands?: (SlashCommand | AutocompleteItem)[], basePath?: string);
|
|
27
|
+
getSuggestions(lines: string[], cursorLine: number, cursorCol: number): {
|
|
28
|
+
items: AutocompleteItem[];
|
|
29
|
+
prefix: string;
|
|
30
|
+
} | null;
|
|
31
|
+
applyCompletion(lines: string[], cursorLine: number, cursorCol: number, item: AutocompleteItem, prefix: string): {
|
|
32
|
+
lines: string[];
|
|
33
|
+
cursorLine: number;
|
|
34
|
+
cursorCol: number;
|
|
35
|
+
};
|
|
36
|
+
private extractPathPrefix;
|
|
37
|
+
private expandHomePath;
|
|
38
|
+
private getFileSuggestions;
|
|
39
|
+
private getFuzzyFileSuggestions;
|
|
40
|
+
getForceFileSuggestions(lines: string[], cursorLine: number, cursorCol: number): {
|
|
41
|
+
items: AutocompleteItem[];
|
|
42
|
+
prefix: string;
|
|
43
|
+
} | null;
|
|
44
|
+
shouldTriggerFileCompletion(lines: string[], cursorLine: number, cursorCol: number): boolean;
|
|
45
|
+
/** Refresh the file index (call after files are created/deleted) */
|
|
46
|
+
refreshFileIndex(): void;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=autocomplete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../src/autocomplete/autocomplete.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,gBAAgB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,sBAAsB,CAAC,CAAC,cAAc,EAAE,MAAM,GAAG,gBAAgB,EAAE,GAAG,IAAI,CAAC;CAC3E;AAED,MAAM,WAAW,oBAAoB;IAGpC,cAAc,CACb,KAAK,EAAE,MAAM,EAAE,EACf,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GACf;QACF,KAAK,EAAE,gBAAgB,EAAE,CAAC;QAC1B,MAAM,EAAE,MAAM,CAAC;KACf,GAAG,IAAI,CAAC;IAIT,eAAe,CACd,KAAK,EAAE,MAAM,EAAE,EACf,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,MAAM,GACZ;QACF,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;KAClB,CAAC;CACF;AAGD,qBAAa,4BAA6B,YAAW,oBAAoB;IACxE,OAAO,CAAC,QAAQ,CAAsC;IACtD,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,SAAS,CAAY;gBAG5B,QAAQ,GAAE,CAAC,YAAY,GAAG,gBAAgB,CAAC,EAAO,EAClD,QAAQ,GAAE,MAAsB;IAOjC,cAAc,CACb,KAAK,EAAE,MAAM,EAAE,EACf,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GACf;QAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IA8FvD,eAAe,CACd,KAAK,EAAE,MAAM,EAAE,EACf,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,MAAM,GACZ;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE;IA6D7D,OAAO,CAAC,iBAAiB;IAwCzB,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,kBAAkB;IAoJ1B,OAAO,CAAC,uBAAuB;IAmB/B,uBAAuB,CACtB,KAAK,EAAE,MAAM,EAAE,EACf,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GACf;QAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAyBvD,2BAA2B,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO;IAY5F,oEAAoE;IACpE,gBAAgB,IAAI,IAAI;CAGxB"}
|
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
import { readdirSync } from "fs";
|
|
2
|
+
import { homedir } from "os";
|
|
3
|
+
import { basename, dirname, join } from "path";
|
|
4
|
+
import { FileIndex } from "./file-index.js";
|
|
5
|
+
// Combined provider that handles both slash commands and file paths
|
|
6
|
+
export class CombinedAutocompleteProvider {
|
|
7
|
+
commands;
|
|
8
|
+
basePath;
|
|
9
|
+
fileIndex;
|
|
10
|
+
constructor(commands = [], basePath = process.cwd()) {
|
|
11
|
+
this.commands = commands;
|
|
12
|
+
this.basePath = basePath;
|
|
13
|
+
this.fileIndex = new FileIndex({ cwd: basePath });
|
|
14
|
+
}
|
|
15
|
+
getSuggestions(lines, cursorLine, cursorCol) {
|
|
16
|
+
const currentLine = lines[cursorLine] || "";
|
|
17
|
+
const textBeforeCursor = currentLine.slice(0, cursorCol);
|
|
18
|
+
// Check for @ file reference (fuzzy search) - must be after a space or at start
|
|
19
|
+
const atMatch = textBeforeCursor.match(/(?:^|[\s])(@[^\s]*)$/);
|
|
20
|
+
if (atMatch) {
|
|
21
|
+
const prefix = atMatch[1] ?? "@"; // The @... part
|
|
22
|
+
const query = prefix.slice(1); // Remove the @
|
|
23
|
+
const suggestions = this.getFuzzyFileSuggestions(query);
|
|
24
|
+
if (suggestions.length === 0)
|
|
25
|
+
return null;
|
|
26
|
+
return {
|
|
27
|
+
items: suggestions,
|
|
28
|
+
prefix: prefix,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
// Check for slash commands
|
|
32
|
+
if (textBeforeCursor.startsWith("/")) {
|
|
33
|
+
const spaceIndex = textBeforeCursor.indexOf(" ");
|
|
34
|
+
if (spaceIndex === -1) {
|
|
35
|
+
// No space yet - complete command names
|
|
36
|
+
const prefix = textBeforeCursor.slice(1); // Remove the "/"
|
|
37
|
+
const filtered = this.commands
|
|
38
|
+
.filter((cmd) => {
|
|
39
|
+
const name = "name" in cmd ? cmd.name : cmd.value; // Check if SlashCommand or AutocompleteItem
|
|
40
|
+
return name?.toLowerCase().startsWith(prefix.toLowerCase());
|
|
41
|
+
})
|
|
42
|
+
.map((cmd) => {
|
|
43
|
+
const value = String("name" in cmd ? cmd.name : cmd.value ?? "");
|
|
44
|
+
const label = String("name" in cmd ? cmd.name : cmd.label ?? value);
|
|
45
|
+
return {
|
|
46
|
+
value,
|
|
47
|
+
label,
|
|
48
|
+
...(cmd.description && { description: String(cmd.description) }),
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
if (filtered.length === 0)
|
|
52
|
+
return null;
|
|
53
|
+
return {
|
|
54
|
+
items: filtered,
|
|
55
|
+
prefix: textBeforeCursor,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
// Space found - complete command arguments
|
|
60
|
+
const commandName = textBeforeCursor.slice(1, spaceIndex); // Command without "/"
|
|
61
|
+
const argumentText = textBeforeCursor.slice(spaceIndex + 1); // Text after space
|
|
62
|
+
const command = this.commands.find((cmd) => {
|
|
63
|
+
const name = "name" in cmd ? cmd.name : cmd.value;
|
|
64
|
+
return name === commandName;
|
|
65
|
+
});
|
|
66
|
+
if (!command || !("getArgumentCompletions" in command) || !command.getArgumentCompletions) {
|
|
67
|
+
return null; // No argument completion for this command
|
|
68
|
+
}
|
|
69
|
+
const argumentSuggestions = command.getArgumentCompletions(argumentText);
|
|
70
|
+
if (!argumentSuggestions || argumentSuggestions.length === 0) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
// Ensure all items have valid string fields
|
|
74
|
+
const validatedItems = argumentSuggestions.map((item) => ({
|
|
75
|
+
value: String(item.value ?? ""),
|
|
76
|
+
label: String(item.label ?? item.value ?? ""),
|
|
77
|
+
...(item.description != null && { description: String(item.description) }),
|
|
78
|
+
}));
|
|
79
|
+
return {
|
|
80
|
+
items: validatedItems,
|
|
81
|
+
prefix: argumentText,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
// Check for file paths - triggered by Tab or if we detect a path pattern
|
|
86
|
+
const pathMatch = this.extractPathPrefix(textBeforeCursor, false);
|
|
87
|
+
if (pathMatch !== null) {
|
|
88
|
+
const suggestions = this.getFileSuggestions(pathMatch);
|
|
89
|
+
if (suggestions.length === 0)
|
|
90
|
+
return null;
|
|
91
|
+
return {
|
|
92
|
+
items: suggestions,
|
|
93
|
+
prefix: pathMatch,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
applyCompletion(lines, cursorLine, cursorCol, item, prefix) {
|
|
99
|
+
const currentLine = lines[cursorLine] || "";
|
|
100
|
+
const beforePrefix = currentLine.slice(0, cursorCol - prefix.length);
|
|
101
|
+
const afterCursor = currentLine.slice(cursorCol);
|
|
102
|
+
// Check if we're completing a slash command (prefix starts with "/")
|
|
103
|
+
if (prefix.startsWith("/")) {
|
|
104
|
+
// This is a command name completion
|
|
105
|
+
const newLine = beforePrefix + "/" + item.value + " " + afterCursor;
|
|
106
|
+
const newLines = [...lines];
|
|
107
|
+
newLines[cursorLine] = newLine;
|
|
108
|
+
return {
|
|
109
|
+
lines: newLines,
|
|
110
|
+
cursorLine,
|
|
111
|
+
cursorCol: beforePrefix.length + item.value.length + 2, // +2 for "/" and space
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
// Check if we're completing a file attachment (prefix starts with "@")
|
|
115
|
+
if (prefix.startsWith("@")) {
|
|
116
|
+
// This is a file attachment completion
|
|
117
|
+
const newLine = beforePrefix + item.value + " " + afterCursor;
|
|
118
|
+
const newLines = [...lines];
|
|
119
|
+
newLines[cursorLine] = newLine;
|
|
120
|
+
return {
|
|
121
|
+
lines: newLines,
|
|
122
|
+
cursorLine,
|
|
123
|
+
cursorCol: beforePrefix.length + item.value.length + 1, // +1 for space
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
// Check if we're in a slash command context (beforePrefix contains "/command ")
|
|
127
|
+
const textBeforeCursor = currentLine.slice(0, cursorCol);
|
|
128
|
+
if (textBeforeCursor.includes("/") && textBeforeCursor.includes(" ")) {
|
|
129
|
+
// This is likely a command argument completion
|
|
130
|
+
const newLine = beforePrefix + item.value + afterCursor;
|
|
131
|
+
const newLines = [...lines];
|
|
132
|
+
newLines[cursorLine] = newLine;
|
|
133
|
+
return {
|
|
134
|
+
lines: newLines,
|
|
135
|
+
cursorLine,
|
|
136
|
+
cursorCol: beforePrefix.length + item.value.length,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
// For file paths, complete the path
|
|
140
|
+
const newLine = beforePrefix + item.value + afterCursor;
|
|
141
|
+
const newLines = [...lines];
|
|
142
|
+
newLines[cursorLine] = newLine;
|
|
143
|
+
return {
|
|
144
|
+
lines: newLines,
|
|
145
|
+
cursorLine,
|
|
146
|
+
cursorCol: beforePrefix.length + item.value.length,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
// Extract a path-like prefix from the text before cursor
|
|
150
|
+
extractPathPrefix(text, forceExtract = false) {
|
|
151
|
+
// Check for @ file attachment syntax first
|
|
152
|
+
const atMatch = text.match(/@([^\s]*)$/);
|
|
153
|
+
if (atMatch) {
|
|
154
|
+
return atMatch[0]; // Return the full @path pattern
|
|
155
|
+
}
|
|
156
|
+
// Simple approach: find the last whitespace/delimiter and extract the word after it
|
|
157
|
+
// This avoids catastrophic backtracking from nested quantifiers
|
|
158
|
+
const lastDelimiterIndex = Math.max(text.lastIndexOf(" "), text.lastIndexOf("\t"), text.lastIndexOf('"'), text.lastIndexOf("'"), text.lastIndexOf("="));
|
|
159
|
+
const pathPrefix = lastDelimiterIndex === -1 ? text : text.slice(lastDelimiterIndex + 1);
|
|
160
|
+
// For forced extraction (Tab key), always return something
|
|
161
|
+
if (forceExtract) {
|
|
162
|
+
return pathPrefix;
|
|
163
|
+
}
|
|
164
|
+
// For natural triggers, return if it looks like a path, ends with /, starts with ~/, .
|
|
165
|
+
// Only return empty string if the text looks like it's starting a path context
|
|
166
|
+
if (pathPrefix.includes("/") || pathPrefix.startsWith(".") || pathPrefix.startsWith("~/")) {
|
|
167
|
+
return pathPrefix;
|
|
168
|
+
}
|
|
169
|
+
// Return empty string only at start of line (for Tab completion from scratch)
|
|
170
|
+
// Don't trigger on trailing space - that causes autocomplete to show after completing @file refs
|
|
171
|
+
if (pathPrefix === "" && text === "") {
|
|
172
|
+
return pathPrefix;
|
|
173
|
+
}
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
// Expand home directory (~/) to actual home path
|
|
177
|
+
expandHomePath(path) {
|
|
178
|
+
if (path.startsWith("~/")) {
|
|
179
|
+
const expandedPath = join(homedir(), path.slice(2));
|
|
180
|
+
// Preserve trailing slash if original path had one
|
|
181
|
+
return path.endsWith("/") && !expandedPath.endsWith("/") ? expandedPath + "/" : expandedPath;
|
|
182
|
+
}
|
|
183
|
+
else if (path === "~") {
|
|
184
|
+
return homedir();
|
|
185
|
+
}
|
|
186
|
+
return path;
|
|
187
|
+
}
|
|
188
|
+
// Get file/directory suggestions for a given path prefix
|
|
189
|
+
getFileSuggestions(prefix) {
|
|
190
|
+
try {
|
|
191
|
+
let expandedPrefix = prefix;
|
|
192
|
+
let isAtPrefix = false;
|
|
193
|
+
// Handle @ file attachment prefix
|
|
194
|
+
if (prefix.startsWith("@")) {
|
|
195
|
+
isAtPrefix = true;
|
|
196
|
+
expandedPrefix = prefix.slice(1);
|
|
197
|
+
}
|
|
198
|
+
// Handle home directory expansion
|
|
199
|
+
if (expandedPrefix.startsWith("~")) {
|
|
200
|
+
expandedPrefix = this.expandHomePath(expandedPrefix);
|
|
201
|
+
}
|
|
202
|
+
// For relative paths, use index-backed fuzzy search (respects .gitignore)
|
|
203
|
+
const isAbsoluteOrHome = expandedPrefix.startsWith("/") || prefix.startsWith("~");
|
|
204
|
+
if (!isAbsoluteOrHome) {
|
|
205
|
+
return this.getFuzzyFileSuggestions(expandedPrefix, isAtPrefix);
|
|
206
|
+
}
|
|
207
|
+
// Fall through to readdirSync for absolute/home paths
|
|
208
|
+
let searchDir;
|
|
209
|
+
let searchPrefix;
|
|
210
|
+
if (expandedPrefix === "" ||
|
|
211
|
+
expandedPrefix === "./" ||
|
|
212
|
+
expandedPrefix === "../" ||
|
|
213
|
+
expandedPrefix === "~" ||
|
|
214
|
+
expandedPrefix === "~/" ||
|
|
215
|
+
expandedPrefix === "/" ||
|
|
216
|
+
prefix === "@") {
|
|
217
|
+
// Complete from specified position
|
|
218
|
+
if (prefix.startsWith("~") || expandedPrefix === "/") {
|
|
219
|
+
searchDir = expandedPrefix;
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
searchDir = join(this.basePath, expandedPrefix);
|
|
223
|
+
}
|
|
224
|
+
searchPrefix = "";
|
|
225
|
+
}
|
|
226
|
+
else if (expandedPrefix.endsWith("/")) {
|
|
227
|
+
// If prefix ends with /, show contents of that directory
|
|
228
|
+
if (prefix.startsWith("~") || expandedPrefix.startsWith("/")) {
|
|
229
|
+
searchDir = expandedPrefix;
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
searchDir = join(this.basePath, expandedPrefix);
|
|
233
|
+
}
|
|
234
|
+
searchPrefix = "";
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
// Split into directory and file prefix
|
|
238
|
+
const dir = dirname(expandedPrefix);
|
|
239
|
+
const file = basename(expandedPrefix);
|
|
240
|
+
if (prefix.startsWith("~") || expandedPrefix.startsWith("/")) {
|
|
241
|
+
searchDir = dir;
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
searchDir = join(this.basePath, dir);
|
|
245
|
+
}
|
|
246
|
+
searchPrefix = file;
|
|
247
|
+
}
|
|
248
|
+
const entries = readdirSync(searchDir, { withFileTypes: true });
|
|
249
|
+
const suggestions = [];
|
|
250
|
+
for (const entry of entries) {
|
|
251
|
+
if (!entry.name || !entry.name.toLowerCase().startsWith(searchPrefix.toLowerCase())) {
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
const isDirectory = entry.isDirectory();
|
|
255
|
+
let relativePath;
|
|
256
|
+
const name = String(entry.name);
|
|
257
|
+
// Handle @ prefix path construction
|
|
258
|
+
if (isAtPrefix) {
|
|
259
|
+
const pathWithoutAt = expandedPrefix;
|
|
260
|
+
if (pathWithoutAt.endsWith("/")) {
|
|
261
|
+
relativePath = "@" + pathWithoutAt + name;
|
|
262
|
+
}
|
|
263
|
+
else if (pathWithoutAt.includes("/")) {
|
|
264
|
+
if (pathWithoutAt.startsWith("~/")) {
|
|
265
|
+
const homeRelativeDir = pathWithoutAt.slice(2); // Remove ~/
|
|
266
|
+
const dir = dirname(homeRelativeDir);
|
|
267
|
+
relativePath = "@~/" + (dir === "." ? name : join(dir, name));
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
relativePath = "@" + join(dirname(pathWithoutAt), name);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
if (pathWithoutAt.startsWith("~")) {
|
|
275
|
+
relativePath = "@~/" + name;
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
relativePath = "@" + name;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
else if (prefix.endsWith("/")) {
|
|
283
|
+
// If prefix ends with /, append entry to the prefix
|
|
284
|
+
relativePath = prefix + name;
|
|
285
|
+
}
|
|
286
|
+
else if (prefix.includes("/")) {
|
|
287
|
+
// Preserve ~/ format for home directory paths
|
|
288
|
+
if (prefix.startsWith("~/")) {
|
|
289
|
+
const homeRelativeDir = prefix.slice(2); // Remove ~/
|
|
290
|
+
const dir = dirname(homeRelativeDir);
|
|
291
|
+
relativePath = "~/" + (dir === "." ? name : join(dir, name));
|
|
292
|
+
}
|
|
293
|
+
else if (prefix.startsWith("/")) {
|
|
294
|
+
// Absolute path - construct properly
|
|
295
|
+
const dir = dirname(prefix);
|
|
296
|
+
if (dir === "/") {
|
|
297
|
+
relativePath = "/" + name;
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
relativePath = dir + "/" + name;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
relativePath = join(dirname(prefix), name);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
// For standalone entries, preserve ~/ if original prefix was ~/
|
|
309
|
+
if (prefix.startsWith("~")) {
|
|
310
|
+
relativePath = "~/" + name;
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
relativePath = name;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
suggestions.push({
|
|
317
|
+
value: isDirectory ? relativePath + "/" : relativePath,
|
|
318
|
+
label: name,
|
|
319
|
+
description: isDirectory ? "directory" : "file",
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
// Sort directories first, then alphabetically
|
|
323
|
+
suggestions.sort((a, b) => {
|
|
324
|
+
const aIsDir = a.description === "directory";
|
|
325
|
+
const bIsDir = b.description === "directory";
|
|
326
|
+
if (aIsDir && !bIsDir)
|
|
327
|
+
return -1;
|
|
328
|
+
if (!aIsDir && bIsDir)
|
|
329
|
+
return 1;
|
|
330
|
+
return a.label.localeCompare(b.label);
|
|
331
|
+
});
|
|
332
|
+
return suggestions;
|
|
333
|
+
}
|
|
334
|
+
catch (e) {
|
|
335
|
+
// Directory doesn't exist or not accessible
|
|
336
|
+
return [];
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
// Fuzzy file search using ripgrep + fuzzysort (fast, respects .gitignore)
|
|
340
|
+
getFuzzyFileSuggestions(query, includeAtPrefix = true) {
|
|
341
|
+
const results = this.fileIndex.search(query, { limit: 20, includeDirs: true });
|
|
342
|
+
return results
|
|
343
|
+
.filter((r) => r.path != null) // Guard against malformed results
|
|
344
|
+
.map(({ path: entryPath, isDirectory }) => {
|
|
345
|
+
const pathWithoutSlash = isDirectory ? entryPath.slice(0, -1) : entryPath;
|
|
346
|
+
const entryName = basename(pathWithoutSlash);
|
|
347
|
+
const value = includeAtPrefix ? `@${String(entryPath)}` : String(entryPath);
|
|
348
|
+
return {
|
|
349
|
+
value,
|
|
350
|
+
label: String(entryName) + (isDirectory ? "/" : ""),
|
|
351
|
+
description: String(pathWithoutSlash),
|
|
352
|
+
};
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
// Force file completion (called on Tab key) - always returns suggestions
|
|
356
|
+
getForceFileSuggestions(lines, cursorLine, cursorCol) {
|
|
357
|
+
const currentLine = lines[cursorLine] || "";
|
|
358
|
+
const textBeforeCursor = currentLine.slice(0, cursorCol);
|
|
359
|
+
// Don't trigger if we're typing a slash command at the start of the line
|
|
360
|
+
if (textBeforeCursor.trim().startsWith("/") && !textBeforeCursor.trim().includes(" ")) {
|
|
361
|
+
return null;
|
|
362
|
+
}
|
|
363
|
+
// Force extract path prefix - this will always return something
|
|
364
|
+
const pathMatch = this.extractPathPrefix(textBeforeCursor, true);
|
|
365
|
+
if (pathMatch !== null) {
|
|
366
|
+
const suggestions = this.getFileSuggestions(pathMatch);
|
|
367
|
+
if (suggestions.length === 0)
|
|
368
|
+
return null;
|
|
369
|
+
return {
|
|
370
|
+
items: suggestions,
|
|
371
|
+
prefix: pathMatch,
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
return null;
|
|
375
|
+
}
|
|
376
|
+
// Check if we should trigger file completion (called on Tab key)
|
|
377
|
+
shouldTriggerFileCompletion(lines, cursorLine, cursorCol) {
|
|
378
|
+
const currentLine = lines[cursorLine] || "";
|
|
379
|
+
const textBeforeCursor = currentLine.slice(0, cursorCol);
|
|
380
|
+
// Don't trigger if we're typing a slash command at the start of the line
|
|
381
|
+
if (textBeforeCursor.trim().startsWith("/") && !textBeforeCursor.trim().includes(" ")) {
|
|
382
|
+
return false;
|
|
383
|
+
}
|
|
384
|
+
return true;
|
|
385
|
+
}
|
|
386
|
+
/** Refresh the file index (call after files are created/deleted) */
|
|
387
|
+
refreshFileIndex() {
|
|
388
|
+
this.fileIndex.refresh().catch(() => { });
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
//# sourceMappingURL=autocomplete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autocomplete.js","sourceRoot":"","sources":["../../src/autocomplete/autocomplete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAA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AQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACvF,OAAO,IAAI,CAAC;QACb,CAAC;QAED,gEAAgE;QAChE,MAAM,SAAS,GAAG,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;QACjE,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;YACxB,MAAM,WAAW,GAAG,IAAI,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,yEAAyE;QACzE,IAAI,gBAAgB,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACvF,OAAO,KAAK,CAAC;QACd,CAAC;QAED,OAAO,IAAI,CAAC;IACb,CAAC;IAED,oEAAoE;IACpE,gBAAgB;QACf,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAc,CAAC,CAAC,CAAC;IACtD,CAAC;CACD"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface FileIndexOptions {
|
|
2
|
+
cwd: string;
|
|
3
|
+
lazy?: boolean;
|
|
4
|
+
/** Time in ms before index is considered stale (default: 30000) */
|
|
5
|
+
staleTime?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface FileSearchResult {
|
|
8
|
+
path: string;
|
|
9
|
+
isDirectory: boolean;
|
|
10
|
+
score: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Fast file index using ripgrep for listing and fuzzysort for matching.
|
|
14
|
+
* Respects .gitignore by default.
|
|
15
|
+
*/
|
|
16
|
+
export declare class FileIndex {
|
|
17
|
+
private cwd;
|
|
18
|
+
private files;
|
|
19
|
+
private indexing;
|
|
20
|
+
private indexed;
|
|
21
|
+
private pendingCallbacks;
|
|
22
|
+
private searchItemsFilesOnly;
|
|
23
|
+
private searchItemsWithDirs;
|
|
24
|
+
private lastRefreshTime;
|
|
25
|
+
private staleTime;
|
|
26
|
+
constructor(options: FileIndexOptions);
|
|
27
|
+
refresh(): Promise<void>;
|
|
28
|
+
search(query: string, options?: {
|
|
29
|
+
limit?: number;
|
|
30
|
+
includeDirs?: boolean;
|
|
31
|
+
}): FileSearchResult[];
|
|
32
|
+
get fileCount(): number;
|
|
33
|
+
get isIndexing(): boolean;
|
|
34
|
+
get isReady(): boolean;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=file-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-index.d.ts","sourceRoot":"","sources":["../../src/autocomplete/file-index.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,gBAAgB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACd;AAID;;;GAGG;AACH,qBAAa,SAAS;IACrB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,gBAAgB,CAAyB;IACjD,OAAO,CAAC,oBAAoB,CAAoB;IAChD,OAAO,CAAC,mBAAmB,CAAoB;IAC/C,OAAO,CAAC,eAAe,CAAK;IAC5B,OAAO,CAAC,SAAS,CAAS;gBAEd,OAAO,EAAE,gBAAgB;IAQ/B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA6E9B,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,gBAAgB,EAAE;IA2C9F,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,UAAU,IAAI,OAAO,CAExB;IAED,IAAI,OAAO,IAAI,OAAO,CAErB;CACD"}
|