@abacus-ai/cli 2.0.0-canary.1 → 2.0.0-canary.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/dist/index.mjs +450 -422
  2. package/package.json +4 -1
  3. package/.oxlintrc.json +0 -8
  4. package/resources/abacus.ico +0 -0
  5. package/resources/entitlements.plist +0 -9
  6. package/src/__e2e__/README.md +0 -196
  7. package/src/__e2e__/agent-interactions.e2e.test.tsx +0 -61
  8. package/src/__e2e__/cli-commands.e2e.test.tsx +0 -77
  9. package/src/__e2e__/conversation-throttle.e2e.test.ts +0 -453
  10. package/src/__e2e__/conversation.e2e.test.tsx +0 -56
  11. package/src/__e2e__/diff-preview.e2e.test.tsx +0 -3399
  12. package/src/__e2e__/file-creation.e2e.test.tsx +0 -149
  13. package/src/__e2e__/helpers/test-helpers.ts +0 -449
  14. package/src/__e2e__/keyboard-navigation.e2e.test.tsx +0 -34
  15. package/src/__e2e__/llm-models.e2e.test.ts +0 -402
  16. package/src/__e2e__/mcp/mcp-callback-flow.e2e.test.tsx +0 -71
  17. package/src/__e2e__/mcp/mcp-full-app-ui.e2e.test.tsx +0 -167
  18. package/src/__e2e__/mcp/mcp-ui-rendering.e2e.test.tsx +0 -185
  19. package/src/__e2e__/repl.e2e.test.tsx +0 -78
  20. package/src/__e2e__/shell-compatibility.e2e.test.tsx +0 -76
  21. package/src/__e2e__/theme-mcp.e2e.test.tsx +0 -98
  22. package/src/__e2e__/tool-permissions.e2e.test.tsx +0 -66
  23. package/src/args.ts +0 -22
  24. package/src/components/__tests__/react-compiler.test.tsx +0 -78
  25. package/src/components/__tests__/status-indicator.test.tsx +0 -403
  26. package/src/components/composer/__tests__/bash-runner.test.tsx +0 -263
  27. package/src/components/composer/agent-mode-indicator.tsx +0 -63
  28. package/src/components/composer/bash-runner.tsx +0 -54
  29. package/src/components/composer/commands/default-commands.tsx +0 -615
  30. package/src/components/composer/commands/handler.tsx +0 -59
  31. package/src/components/composer/commands/picker.tsx +0 -273
  32. package/src/components/composer/commands/registry.ts +0 -233
  33. package/src/components/composer/commands/types.ts +0 -33
  34. package/src/components/composer/context.tsx +0 -88
  35. package/src/components/composer/file-mention-picker.tsx +0 -83
  36. package/src/components/composer/help.tsx +0 -44
  37. package/src/components/composer/index.tsx +0 -1007
  38. package/src/components/composer/mentions.ts +0 -57
  39. package/src/components/composer/message-queue.tsx +0 -70
  40. package/src/components/composer/mode-panel.tsx +0 -35
  41. package/src/components/composer/modes/__tests__/bash-handler.test.tsx +0 -755
  42. package/src/components/composer/modes/__tests__/bash-renderer.test.tsx +0 -1108
  43. package/src/components/composer/modes/bash-handler.tsx +0 -132
  44. package/src/components/composer/modes/bash-renderer.tsx +0 -175
  45. package/src/components/composer/modes/default-handlers.tsx +0 -33
  46. package/src/components/composer/modes/index.ts +0 -41
  47. package/src/components/composer/modes/types.ts +0 -21
  48. package/src/components/composer/persistent-shell.ts +0 -283
  49. package/src/components/composer/process.ts +0 -65
  50. package/src/components/composer/types.ts +0 -9
  51. package/src/components/composer/use-mention-search.ts +0 -68
  52. package/src/components/error-boundry.tsx +0 -60
  53. package/src/components/exit-message.tsx +0 -29
  54. package/src/components/expanded-view.tsx +0 -74
  55. package/src/components/file-completion.tsx +0 -127
  56. package/src/components/header.tsx +0 -47
  57. package/src/components/logo.tsx +0 -37
  58. package/src/components/segments.tsx +0 -356
  59. package/src/components/status-indicator.tsx +0 -306
  60. package/src/components/tool-group-summary.tsx +0 -263
  61. package/src/components/tool-permissions/ask-user-question-permission-ui.tsx +0 -319
  62. package/src/components/tool-permissions/diff-preview.tsx +0 -359
  63. package/src/components/tool-permissions/index.ts +0 -5
  64. package/src/components/tool-permissions/permission-options.tsx +0 -401
  65. package/src/components/tool-permissions/permission-preview-header.tsx +0 -57
  66. package/src/components/tool-permissions/tool-permission-ui.tsx +0 -420
  67. package/src/components/tools/agent/ask-user-question.tsx +0 -107
  68. package/src/components/tools/agent/enter-plan-mode.tsx +0 -55
  69. package/src/components/tools/agent/exit-plan-mode.tsx +0 -83
  70. package/src/components/tools/agent/handoff-to-main.tsx +0 -27
  71. package/src/components/tools/agent/subagent.tsx +0 -37
  72. package/src/components/tools/agent/todo-write.tsx +0 -104
  73. package/src/components/tools/browser/close-tab.tsx +0 -58
  74. package/src/components/tools/browser/computer.tsx +0 -70
  75. package/src/components/tools/browser/get-interactive-elements.tsx +0 -54
  76. package/src/components/tools/browser/get-tab-content.tsx +0 -51
  77. package/src/components/tools/browser/navigate-to.tsx +0 -59
  78. package/src/components/tools/browser/new-tab.tsx +0 -60
  79. package/src/components/tools/browser/perform-action.tsx +0 -63
  80. package/src/components/tools/browser/refresh-tab.tsx +0 -43
  81. package/src/components/tools/browser/switch-tab.tsx +0 -58
  82. package/src/components/tools/filesystem/delete-file.tsx +0 -104
  83. package/src/components/tools/filesystem/edit.tsx +0 -220
  84. package/src/components/tools/filesystem/list-dir.tsx +0 -78
  85. package/src/components/tools/filesystem/read-file.tsx +0 -180
  86. package/src/components/tools/filesystem/upload-image.tsx +0 -76
  87. package/src/components/tools/ide/ide-diagnostics.tsx +0 -62
  88. package/src/components/tools/index.ts +0 -91
  89. package/src/components/tools/mcp/mcp-tool.tsx +0 -158
  90. package/src/components/tools/search/fetch-url.tsx +0 -73
  91. package/src/components/tools/search/file-search.tsx +0 -78
  92. package/src/components/tools/search/grep.tsx +0 -90
  93. package/src/components/tools/search/semantic-search.tsx +0 -66
  94. package/src/components/tools/search/web-search.tsx +0 -71
  95. package/src/components/tools/shared/index.tsx +0 -48
  96. package/src/components/tools/shared/zod-coercion.ts +0 -35
  97. package/src/components/tools/terminal/bash-tool-output.tsx +0 -188
  98. package/src/components/tools/terminal/get-terminal-output.tsx +0 -91
  99. package/src/components/tools/terminal/run-in-terminal.tsx +0 -131
  100. package/src/components/tools/types.ts +0 -16
  101. package/src/components/tools.tsx +0 -68
  102. package/src/components/ui/__tests__/divider.test.tsx +0 -61
  103. package/src/components/ui/__tests__/gradient.test.tsx +0 -125
  104. package/src/components/ui/__tests__/input.test.tsx +0 -166
  105. package/src/components/ui/__tests__/select.test.tsx +0 -273
  106. package/src/components/ui/__tests__/shimmer.test.tsx +0 -99
  107. package/src/components/ui/blinking-indicator.tsx +0 -27
  108. package/src/components/ui/divider.tsx +0 -162
  109. package/src/components/ui/gradient.tsx +0 -56
  110. package/src/components/ui/input.tsx +0 -228
  111. package/src/components/ui/select.tsx +0 -151
  112. package/src/components/ui/shimmer.tsx +0 -76
  113. package/src/context/agent-mode.tsx +0 -95
  114. package/src/context/extension-file.tsx +0 -136
  115. package/src/context/network-activity.tsx +0 -45
  116. package/src/context/notification.tsx +0 -62
  117. package/src/context/shell-size.tsx +0 -49
  118. package/src/context/shell-title.tsx +0 -38
  119. package/src/entrypoints/print-mode.ts +0 -312
  120. package/src/entrypoints/repl.tsx +0 -389
  121. package/src/hooks/use-agent.ts +0 -15
  122. package/src/hooks/use-api-client.ts +0 -1
  123. package/src/hooks/use-available-height.ts +0 -8
  124. package/src/hooks/use-cleanup.ts +0 -29
  125. package/src/hooks/use-interrupt-manager.ts +0 -242
  126. package/src/hooks/use-models.ts +0 -22
  127. package/src/index.ts +0 -217
  128. package/src/lib/__tests__/ansi.test.ts +0 -255
  129. package/src/lib/__tests__/cli.test.ts +0 -122
  130. package/src/lib/__tests__/commands.test.ts +0 -325
  131. package/src/lib/__tests__/constants.test.ts +0 -15
  132. package/src/lib/__tests__/focusables.test.ts +0 -25
  133. package/src/lib/__tests__/fs.test.ts +0 -231
  134. package/src/lib/__tests__/markdown.test.tsx +0 -348
  135. package/src/lib/__tests__/mcpCommandHandler.test.ts +0 -173
  136. package/src/lib/__tests__/mcpManagement.test.ts +0 -38
  137. package/src/lib/__tests__/path-paste.test.ts +0 -144
  138. package/src/lib/__tests__/path.test.ts +0 -300
  139. package/src/lib/__tests__/queries.test.ts +0 -39
  140. package/src/lib/__tests__/standaloneMcpService.test.ts +0 -71
  141. package/src/lib/__tests__/text-buffer.test.ts +0 -328
  142. package/src/lib/__tests__/text-utils.test.ts +0 -32
  143. package/src/lib/__tests__/timing.test.ts +0 -78
  144. package/src/lib/__tests__/utils.test.ts +0 -238
  145. package/src/lib/__tests__/vim-buffer-actions.test.ts +0 -154
  146. package/src/lib/ansi.ts +0 -150
  147. package/src/lib/cli-push-server.ts +0 -112
  148. package/src/lib/cli.ts +0 -44
  149. package/src/lib/clipboard.ts +0 -226
  150. package/src/lib/command-utils.ts +0 -93
  151. package/src/lib/commands.ts +0 -270
  152. package/src/lib/constants.ts +0 -3
  153. package/src/lib/extension-connection.ts +0 -181
  154. package/src/lib/focusables.ts +0 -7
  155. package/src/lib/fs.ts +0 -533
  156. package/src/lib/markdown/code-block.tsx +0 -63
  157. package/src/lib/markdown/index.ts +0 -4
  158. package/src/lib/markdown/link.tsx +0 -19
  159. package/src/lib/markdown/markdown.tsx +0 -372
  160. package/src/lib/markdown/types.ts +0 -15
  161. package/src/lib/mcpCommandHandler.ts +0 -121
  162. package/src/lib/mcpManagement.ts +0 -44
  163. package/src/lib/path-paste.ts +0 -185
  164. package/src/lib/path.ts +0 -179
  165. package/src/lib/queries.ts +0 -15
  166. package/src/lib/standaloneMcpService.ts +0 -688
  167. package/src/lib/status-utils.ts +0 -237
  168. package/src/lib/test-utils.tsx +0 -72
  169. package/src/lib/text-buffer.ts +0 -2415
  170. package/src/lib/text-utils.ts +0 -272
  171. package/src/lib/timing.ts +0 -63
  172. package/src/lib/types.ts +0 -295
  173. package/src/lib/utils.ts +0 -182
  174. package/src/lib/vim-buffer-actions.ts +0 -732
  175. package/src/providers/agent.tsx +0 -1063
  176. package/src/providers/api-client.tsx +0 -43
  177. package/src/services/logger.ts +0 -85
  178. package/src/terminal/detection.ts +0 -187
  179. package/src/terminal/exit.ts +0 -279
  180. package/src/terminal/notification.ts +0 -83
  181. package/src/terminal/progress.ts +0 -201
  182. package/src/terminal/setup.ts +0 -797
  183. package/src/terminal/types.ts +0 -51
  184. package/src/theme/context.tsx +0 -57
  185. package/src/theme/index.ts +0 -4
  186. package/src/theme/themed.tsx +0 -35
  187. package/src/theme/themes.json +0 -546
  188. package/src/theme/types.ts +0 -110
  189. package/src/tools/types.ts +0 -59
  190. package/src/tools/utils/__tests__/zod-coercion.test.ts +0 -33
  191. package/src/tools/utils/tool-ui-components.tsx +0 -649
  192. package/src/tools/utils/zod-coercion.ts +0 -35
  193. package/tsconfig.json +0 -16
  194. package/tsconfig.node.json +0 -29
  195. package/tsconfig.test.json +0 -27
  196. package/tsdown.config.ts +0 -17
  197. package/vitest.config.ts +0 -76
@@ -1,65 +0,0 @@
1
- import { spawn } from "node:child_process";
2
-
3
- export type StreamChunk = { type: "stdout" | "stderr"; data: string };
4
-
5
- type Resolver = (() => void) | null;
6
-
7
- export function runCommandStreaming(commandLine: string): {
8
- stream: AsyncGenerator<StreamChunk, void, void>;
9
- exit: Promise<number>;
10
- } {
11
- const child = spawn(commandLine, { shell: true, stdio: ["ignore", "pipe", "pipe"] });
12
-
13
- const queue: StreamChunk[] = [];
14
- let notify: Resolver = null;
15
- let closed = false;
16
- let exitCode = 0;
17
-
18
- const onData = (type: "stdout" | "stderr") => (chunk: unknown) => {
19
- const data =
20
- typeof chunk === "string"
21
- ? chunk
22
- : Buffer.isBuffer(chunk)
23
- ? chunk.toString("utf8")
24
- : String(chunk);
25
- queue.push({ type, data });
26
- if (notify) {
27
- const n = notify;
28
- notify = null;
29
- n();
30
- }
31
- };
32
-
33
- child.stdout?.on("data", onData("stdout"));
34
- child.stderr?.on("data", onData("stderr"));
35
-
36
- const exit = new Promise<number>((resolve) => {
37
- child.on("close", (code) => {
38
- exitCode = typeof code === "number" ? code : 0;
39
- closed = true;
40
- if (notify) {
41
- const n = notify;
42
- notify = null;
43
- n();
44
- }
45
- resolve(exitCode);
46
- });
47
- });
48
-
49
- async function* stream(): AsyncGenerator<StreamChunk, void, void> {
50
- while (true) {
51
- while (queue.length > 0) {
52
- const item = queue.shift() as StreamChunk;
53
- yield item;
54
- }
55
- if (closed) {
56
- return;
57
- }
58
- await new Promise<void>((r) => {
59
- notify = r;
60
- });
61
- }
62
- }
63
-
64
- return { stream: stream(), exit };
65
- }
@@ -1,9 +0,0 @@
1
- export { AgentMode } from "@codellm/agent";
2
- export enum ComposerMode {
3
- Prompt,
4
- Help,
5
- Bash,
6
- Command,
7
- Files,
8
- }
9
- export type ModeMeta = { color?: string; placeholder: string; prefix: string };
@@ -1,68 +0,0 @@
1
- import { useEffect, useRef, useState } from "react";
2
-
3
- import { searchFiles } from "../../lib/fs.js";
4
- import { abbreviateCwd } from "../../lib/path.js";
5
-
6
- const DEBOUNCE_MS = 100;
7
-
8
- export function useMentionSearch(query: string) {
9
- const [results, setResults] = useState<string[]>([]);
10
- const [isDirectory, setIsDirectory] = useState<boolean[]>([]);
11
- const abortControllerRef = useRef<AbortController | null>(null);
12
- const debounceTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
13
- const lastQueryRef = useRef<string>("");
14
-
15
- useEffect(() => {
16
- if (debounceTimerRef.current) {
17
- clearTimeout(debounceTimerRef.current);
18
- }
19
-
20
- if (abortControllerRef.current) {
21
- abortControllerRef.current.abort();
22
- }
23
-
24
- if (query.trim().length === 0) {
25
- setResults([]);
26
- setIsDirectory([]);
27
- lastQueryRef.current = "";
28
- return;
29
- }
30
-
31
- debounceTimerRef.current = setTimeout(() => {
32
- if (query === lastQueryRef.current) {
33
- return;
34
- }
35
- lastQueryRef.current = query;
36
- const controller = new AbortController();
37
- abortControllerRef.current = controller;
38
-
39
- const run = async () => {
40
- try {
41
- const iter = searchFiles(query, { root: process.cwd() });
42
- for await (const batch of iter) {
43
- if (controller.signal.aborted) {
44
- return;
45
- }
46
- const abbreviated = batch.paths.map(abbreviateCwd);
47
- setResults(abbreviated);
48
- setIsDirectory(batch.isDirectory);
49
- }
50
- } catch {
51
- // Silently handle errors - likely aborted
52
- }
53
- };
54
- void run();
55
- }, DEBOUNCE_MS);
56
-
57
- return () => {
58
- if (debounceTimerRef.current) {
59
- clearTimeout(debounceTimerRef.current);
60
- }
61
- if (abortControllerRef.current) {
62
- abortControllerRef.current.abort();
63
- }
64
- };
65
- }, [query]);
66
-
67
- return { results, isDirectory };
68
- }
@@ -1,60 +0,0 @@
1
- import { View, Text } from "@codellm/jar";
2
- import { Component } from "react";
3
-
4
- export interface ErrorBoundaryProps extends React.PropsWithChildren {
5
- fallback?:
6
- | React.ReactNode
7
- | ((error: Error, errorInfo: React.ErrorInfo | null) => React.ReactNode);
8
- onError?: (error: Error, errorInfo: React.ErrorInfo) => void;
9
- }
10
-
11
- interface ErrorBoundaryState {
12
- hasError: boolean;
13
- error: Error | null;
14
- errorInfo: React.ErrorInfo | null;
15
- }
16
-
17
- export class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
18
- override state: ErrorBoundaryState = {
19
- hasError: false,
20
- error: null,
21
- errorInfo: null,
22
- };
23
-
24
- static getDerivedStateFromError(error: Error): ErrorBoundaryState {
25
- return { hasError: true, error, errorInfo: null };
26
- }
27
-
28
- override componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
29
- this.setState({ error, errorInfo });
30
- if (this.props.onError) {
31
- this.props.onError(error, errorInfo);
32
- }
33
- }
34
-
35
- override render() {
36
- const { hasError, error, errorInfo } = this.state;
37
- const { fallback, children } = this.props;
38
-
39
- if (hasError) {
40
- if (fallback) {
41
- return typeof fallback === "function" ? fallback(error!, errorInfo) : fallback;
42
- }
43
- return (
44
- <View flexDirection="column" padding={1}>
45
- <Text color="red" bold>
46
- Something went wrong.
47
- </Text>
48
- {error && (
49
- <View marginTop={1} flexDirection="column">
50
- <Text color="yellow">{error.toString()}</Text>
51
- {errorInfo?.componentStack && <Text color="gray">{errorInfo.componentStack}</Text>}
52
- </View>
53
- )}
54
- </View>
55
- );
56
- }
57
-
58
- return children;
59
- }
60
- }
@@ -1,29 +0,0 @@
1
- import { View, Text } from "@codellm/jar";
2
- import { memo } from "react";
3
-
4
- import { useTheme } from "../theme/index.js";
5
- import { SMALL_BLOCK } from "./logo.js";
6
-
7
- interface ExitMessageProps {
8
- duration: string;
9
- credits: number;
10
- conversationId?: string | null;
11
- }
12
-
13
- export const ExitMessage = memo(({ duration, credits, conversationId }: ExitMessageProps) => {
14
- const { colors } = useTheme();
15
-
16
- return (
17
- <View flexDirection="column" paddingY={1}>
18
- <Text color={colors.primary}>{SMALL_BLOCK}</Text>
19
- <View height={1} />
20
- <Text color={colors.info}>https://desktop.abacus.ai</Text>
21
- <View height={1} />
22
- <Text dimColor>Spent {duration} in the CLI</Text>
23
- {credits > 0 && <Text dimColor>Total credits used: {Math.floor(credits * 100) / 100}</Text>}
24
- {conversationId && <Text dimColor>abacusai --resume {conversationId}</Text>}
25
- </View>
26
- );
27
- });
28
-
29
- ExitMessage.displayName = "ExitMessage";
@@ -1,74 +0,0 @@
1
- import { View, Text, useInput } from "@codellm/jar";
2
- import { memo, useMemo } from "react";
3
-
4
- import type { HistorySegment } from "../lib/types.js";
5
-
6
- import { useTheme } from "../theme/index.js";
7
- import { Segment, ExpandedThinkingSegment } from "./segments.js";
8
-
9
- interface ExpandedViewProps {
10
- /** Snapshot of segments taken when expand mode was activated — never updates */
11
- snapshot: HistorySegment[];
12
- onClose: () => void;
13
- }
14
-
15
- /**
16
- * Read-only expanded view: shows all segments including thoughts and full tool results.
17
- * This is a static snapshot — it won't update while open.
18
- * Ctrl+O or Escape closes it.
19
- */
20
- export const ExpandedView = memo(({ snapshot, onClose }: ExpandedViewProps) => {
21
- const { colors } = useTheme();
22
-
23
- // Handle Ctrl+O and Escape to close
24
- useInput((input, key) => {
25
- if ((key.ctrl || key.super) && input === "o") {
26
- onClose();
27
- }
28
- if (key.escape) {
29
- onClose();
30
- }
31
- });
32
-
33
- // Filter out temp/spinny segments
34
- const segments = useMemo(() => snapshot.filter((s) => !s.temp && !s.isSpinny), [snapshot]);
35
-
36
- return (
37
- <View flexDirection="column" gap={1}>
38
- <View flexDirection="column" gap={1} paddingBottom={1} width="95%">
39
- {segments.map((seg) => (
40
- <ExpandedSegment key={seg.id} segment={seg} />
41
- ))}
42
- </View>
43
-
44
- {/* Footer */}
45
- <View
46
- borderStyle="single"
47
- borderColor={colors.border}
48
- paddingLeft={1}
49
- paddingRight={1}
50
- flexDirection="row"
51
- gap={2}
52
- >
53
- <Text color={colors.textMuted}>expanded view</Text>
54
- <Text dimColor>ctrl+o or esc to collapse</Text>
55
- </View>
56
- </View>
57
- );
58
- });
59
- ExpandedView.displayName = "ExpandedView";
60
-
61
- /**
62
- * In expanded view:
63
- * - thinking segments are always shown via ExpandedThinkingSegment
64
- * - all other segments (including tool calls) render normally via Segment,
65
- * which already includes full tool result output via ToolDef.renderUI
66
- */
67
- const ExpandedSegment = memo(({ segment }: { segment: HistorySegment }) => {
68
- if (segment.type === "thinking") {
69
- return <ExpandedThinkingSegment {...segment} />;
70
- }
71
-
72
- return <Segment segment={segment} />;
73
- });
74
- ExpandedSegment.displayName = "ExpandedSegment";
@@ -1,127 +0,0 @@
1
- import { View, Text } from "@codellm/jar";
2
- import * as path from "path";
3
- import { memo } from "react";
4
-
5
- export interface FileMatch {
6
- resource: string;
7
- }
8
-
9
- export interface FileCompletionProps {
10
- readonly suggestions: FileMatch[];
11
- readonly selectedIndex: number;
12
- readonly visible: boolean;
13
- readonly maxHeight?: number;
14
- }
15
-
16
- const getFileType = (fileName: string): string => {
17
- const ext = path.extname(fileName);
18
- switch (ext) {
19
- case ".ts":
20
- case ".tsx":
21
- return "ts";
22
- case ".js":
23
- case ".jsx":
24
- return "js";
25
- case ".json":
26
- return "json";
27
- case ".md":
28
- return "md";
29
- case ".css":
30
- case ".scss":
31
- return "css";
32
- case ".html":
33
- return "html";
34
- case ".py":
35
- return "py";
36
- case ".rs":
37
- return "rs";
38
- case ".go":
39
- return "go";
40
- case ".yaml":
41
- case ".yml":
42
- return "yaml";
43
- default:
44
- return fileName.includes(".") ? "file" : "dir";
45
- }
46
- };
47
-
48
- const FileCompletionComponent = ({
49
- suggestions,
50
- selectedIndex,
51
- visible,
52
- maxHeight = 8,
53
- }: FileCompletionProps) => {
54
- if (!visible || suggestions.length === 0) {
55
- return null;
56
- }
57
-
58
- // Show only a window of results for performance
59
- const startIndex = Math.max(0, selectedIndex - Math.floor(maxHeight / 2));
60
- const endIndex = Math.min(suggestions.length, startIndex + maxHeight);
61
- const visibleSuggestions = suggestions.slice(startIndex, endIndex);
62
-
63
- return (
64
- <View
65
- flexDirection="column"
66
- borderStyle="round"
67
- borderColor="gray"
68
- paddingX={1}
69
- marginBottom={1}
70
- >
71
- <Text dimColor>
72
- {suggestions.length} file{suggestions.length !== 1 ? "s" : ""}
73
- </Text>
74
-
75
- {visibleSuggestions.map((suggestion, index) => {
76
- const actualIndex = startIndex + index;
77
- const isSelected = actualIndex === selectedIndex;
78
- const fileName = path.basename(suggestion.resource);
79
- const fileType = getFileType(fileName);
80
-
81
- // Smart path display - show relative to cwd
82
- const relativePath = suggestion.resource.startsWith(process.cwd())
83
- ? suggestion.resource.slice(process.cwd().length + 1).replace(/\\/g, "/")
84
- : suggestion.resource.replace(/\\/g, "/");
85
-
86
- const displayPath =
87
- relativePath.length > 60 ? "..." + relativePath.slice(-57) : relativePath;
88
-
89
- return (
90
- <View key={suggestion.resource} flexDirection="row">
91
- <Text color={isSelected ? "blue" : "gray"} bold={isSelected} dimColor={!isSelected}>
92
- {isSelected ? ">" : " "}
93
- </Text>
94
- <Text color={isSelected ? "blue" : undefined} bold={isSelected}>
95
- {" " + displayPath}
96
- </Text>
97
- <Text dimColor> [{fileType}]</Text>
98
- </View>
99
- );
100
- })}
101
-
102
- {suggestions.length > maxHeight && (
103
- <Text dimColor>
104
- {selectedIndex + 1}/{suggestions.length} • ↑↓ navigate • Tab select • Esc cancel
105
- </Text>
106
- )}
107
- </View>
108
- );
109
- };
110
-
111
- export const FileCompletion = memo(FileCompletionComponent);
112
-
113
- export interface CompletionState {
114
- suggestions: FileMatch[];
115
- selectedIndex: number;
116
- visible: boolean;
117
- pattern: string;
118
- startPosition: number;
119
- }
120
-
121
- export const initialCompletionState: CompletionState = {
122
- suggestions: [],
123
- selectedIndex: 0,
124
- visible: false,
125
- pattern: "",
126
- startPosition: 0,
127
- };
@@ -1,47 +0,0 @@
1
- import { View, Text } from "@codellm/jar";
2
- import { memo, useMemo } from "react";
3
-
4
- import pkg from "@/package.json" with { type: "json" };
5
-
6
- import { useShellSize } from "../context/shell-size.js";
7
- import { useTheme } from "../theme/index.js";
8
- import { Gradient } from "./ui/gradient.js";
9
-
10
- export const RUBI = `\
11
- ▗▄▖ ▗▄▄▖ ▗▄▖ ▗▄▄▖▗▖ ▗▖ ▗▄▄▖ ▗▄▖ ▗▄▄▄▖ ▗▄▄▖▗▖ ▗▄▄▄▖
12
- ▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌ ▐▌▐▌ ▐▌ ▐▌ █ ▐▌ ▐▌ █
13
- ▐▛▀▜▌▐▛▀▚▖▐▛▀▜▌▐▌ ▐▌ ▐▌ ▝▀▚▖▐▛▀▜▌ █ ▐▌ ▐▌ █
14
- ▐▌ ▐▌▐▙▄▞▘▐▌ ▐▌▝▚▄▄▖▝▚▄▞▘▗▄▄▞▘▐▌ ▐▌▗▄█▄▖ ▝▚▄▄▖▐▙▄▄▖▗▄█▄▖ `;
15
-
16
- const NARROW_TERMINAL_WIDTH = 50;
17
-
18
- export const Header = memo(() => {
19
- const { width } = useShellSize();
20
- const { colors } = useTheme();
21
-
22
- const gradientColors = useMemo(
23
- () => [colors.gradientStart, colors.gradientMid, colors.gradientEnd],
24
- [colors],
25
- );
26
-
27
- if (width <= NARROW_TERMINAL_WIDTH) {
28
- return (
29
- <View flexDirection="row" gap={1} flexWrap="wrap">
30
- <Gradient colors={gradientColors}>
31
- <Text>Abacus AI</Text>
32
- </Gradient>
33
- <Text color={colors.textMuted}>v{pkg.version}</Text>
34
- </View>
35
- );
36
- }
37
-
38
- return (
39
- <View flexDirection="column">
40
- <Gradient colors={gradientColors}>
41
- <Text>{RUBI}</Text>
42
- </Gradient>
43
- <Text color={colors.textMuted}>v{pkg.version}</Text>
44
- </View>
45
- );
46
- });
47
- Header.displayName = "Header";
@@ -1,37 +0,0 @@
1
- type GradientColors = Array<string>;
2
-
3
- export const COLLOSAL = `
4
- d8888 888 d8888 8888888
5
- d88888 888 d88888 888
6
- d88P888 888 d88P888 888
7
- d88P 888 88888b. 8888b. .d8888b 888 888 .d8888b d88P 888 888
8
- d88P 888 888 "88b "88b d88P" 888 888 88K d88P 888 888
9
- d88P 888 888 888 .d888888 888 888 888 "Y8888b. d88P 888 888
10
- d8888888888 888 d88P 888 888 Y88b. Y88b 888 X88 d8b d8888888888 888
11
- d88P 888 88888P" "Y888888 "Y8888P "Y88888 88888P' Y8P d88P 888 8888888
12
- `;
13
-
14
- export const ANSI_SHADOW = `
15
- █████╗ ██████╗ █████╗ ██████╗██╗ ██╗███████╗ █████╗ ██╗ ██████╗██╗ ██╗
16
- ██╔══██╗██╔══██╗██╔══██╗██╔════╝██║ ██║██╔════╝ ██╔══██╗██║ ██╔════╝██║ ██║
17
- ███████║██████╔╝███████║██║ ██║ ██║███████╗ ███████║██║ ██║ ██║ ██║
18
- ██╔══██║██╔══██╗██╔══██║██║ ██║ ██║╚════██║ ██╔══██║██║ ██║ ██║ ██║
19
- ██║ ██║██████╔╝██║ ██║╚██████╗╚██████╔╝███████║██╗██║ ██║██║ ╚██████╗███████╗██║
20
- ╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝╚═╝╚═╝ ╚═╝╚═╝ ╚═════╝╚══════╝╚═╝
21
- `;
22
-
23
- export const SMALL_BLOCK = `
24
- ▞▀▖▌ ▞▀▖▜▘ ▞▀▖▌ ▜▘
25
- ▙▄▌▛▀▖▝▀▖▞▀▖▌ ▌▞▀▘ ▙▄▌▐ ▌ ▌ ▐
26
- ▌ ▌▌ ▌▞▀▌▌ ▖▌ ▌▝▀▖▗▖▌ ▌▐ ▌ ▖▌ ▐
27
- ▘ ▘▀▀ ▝▀▘▝▀ ▝▀▘▀▀ ▝▘▘ ▘▀▘ ▝▀ ▀▀▘▀▘
28
- `;
29
-
30
- export const SMALL_BLOCK_2 = `
31
- ▞▀▖▌ ▞▀▖▜▘
32
- ▙▄▌▛▀▖▝▀▖▞▀▖▌ ▌▞▀▘ ▙▄▌▐
33
- ▌ ▌▌ ▌▞▀▌▌ ▖▌ ▌▝▀▖▗▖▌ ▌▐
34
- ▘ ▘▀▀ ▝▀▘▝▀ ▝▀▘▀▀ ▝▘▘ ▘▀▘
35
- `;
36
-
37
- export const GRADIENT: GradientColors = ["pink", "lightblue", "plum", "lightcyan", "lightgray"];