@abacus-ai/cli 1.106.25008 → 2.0.0-canary.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/.oxlintrc.json +8 -0
- package/dist/index.mjs +12823 -0
- package/package.json +7 -39
- package/resources/abacus.ico +0 -0
- package/resources/entitlements.plist +9 -0
- package/src/__e2e__/README.md +196 -0
- package/src/__e2e__/agent-interactions.e2e.test.tsx +61 -0
- package/src/__e2e__/cli-commands.e2e.test.tsx +77 -0
- package/src/__e2e__/conversation-throttle.e2e.test.ts +453 -0
- package/src/__e2e__/conversation.e2e.test.tsx +56 -0
- package/src/__e2e__/diff-preview.e2e.test.tsx +3399 -0
- package/src/__e2e__/file-creation.e2e.test.tsx +149 -0
- package/src/__e2e__/helpers/test-helpers.ts +449 -0
- package/src/__e2e__/keyboard-navigation.e2e.test.tsx +34 -0
- package/src/__e2e__/llm-models.e2e.test.ts +402 -0
- package/src/__e2e__/mcp/mcp-callback-flow.e2e.test.tsx +71 -0
- package/src/__e2e__/mcp/mcp-full-app-ui.e2e.test.tsx +167 -0
- package/src/__e2e__/mcp/mcp-ui-rendering.e2e.test.tsx +185 -0
- package/src/__e2e__/repl.e2e.test.tsx +78 -0
- package/src/__e2e__/shell-compatibility.e2e.test.tsx +76 -0
- package/src/__e2e__/theme-mcp.e2e.test.tsx +98 -0
- package/src/__e2e__/tool-permissions.e2e.test.tsx +66 -0
- package/src/args.ts +22 -0
- package/src/components/__tests__/react-compiler.test.tsx +78 -0
- package/src/components/__tests__/status-indicator.test.tsx +403 -0
- package/src/components/composer/__tests__/bash-runner.test.tsx +263 -0
- package/src/components/composer/agent-mode-indicator.tsx +63 -0
- package/src/components/composer/bash-runner.tsx +54 -0
- package/src/components/composer/commands/default-commands.tsx +615 -0
- package/src/components/composer/commands/handler.tsx +59 -0
- package/src/components/composer/commands/picker.tsx +273 -0
- package/src/components/composer/commands/registry.ts +233 -0
- package/src/components/composer/commands/types.ts +33 -0
- package/src/components/composer/context.tsx +88 -0
- package/src/components/composer/file-mention-picker.tsx +83 -0
- package/src/components/composer/help.tsx +44 -0
- package/src/components/composer/index.tsx +1007 -0
- package/src/components/composer/mentions.ts +57 -0
- package/src/components/composer/message-queue.tsx +70 -0
- package/src/components/composer/mode-panel.tsx +35 -0
- package/src/components/composer/modes/__tests__/bash-handler.test.tsx +755 -0
- package/src/components/composer/modes/__tests__/bash-renderer.test.tsx +1108 -0
- package/src/components/composer/modes/bash-handler.tsx +132 -0
- package/src/components/composer/modes/bash-renderer.tsx +175 -0
- package/src/components/composer/modes/default-handlers.tsx +33 -0
- package/src/components/composer/modes/index.ts +41 -0
- package/src/components/composer/modes/types.ts +21 -0
- package/src/components/composer/persistent-shell.ts +283 -0
- package/src/components/composer/process.ts +65 -0
- package/src/components/composer/types.ts +9 -0
- package/src/components/composer/use-mention-search.ts +68 -0
- package/src/components/error-boundry.tsx +60 -0
- package/src/components/exit-message.tsx +29 -0
- package/src/components/expanded-view.tsx +74 -0
- package/src/components/file-completion.tsx +127 -0
- package/src/components/header.tsx +47 -0
- package/src/components/logo.tsx +37 -0
- package/src/components/segments.tsx +356 -0
- package/src/components/status-indicator.tsx +306 -0
- package/src/components/tool-group-summary.tsx +263 -0
- package/src/components/tool-permissions/ask-user-question-permission-ui.tsx +319 -0
- package/src/components/tool-permissions/diff-preview.tsx +359 -0
- package/src/components/tool-permissions/index.ts +5 -0
- package/src/components/tool-permissions/permission-options.tsx +401 -0
- package/src/components/tool-permissions/permission-preview-header.tsx +57 -0
- package/src/components/tool-permissions/tool-permission-ui.tsx +420 -0
- package/src/components/tools/agent/ask-user-question.tsx +107 -0
- package/src/components/tools/agent/enter-plan-mode.tsx +55 -0
- package/src/components/tools/agent/exit-plan-mode.tsx +83 -0
- package/src/components/tools/agent/handoff-to-main.tsx +27 -0
- package/src/components/tools/agent/subagent.tsx +37 -0
- package/src/components/tools/agent/todo-write.tsx +104 -0
- package/src/components/tools/browser/close-tab.tsx +58 -0
- package/src/components/tools/browser/computer.tsx +70 -0
- package/src/components/tools/browser/get-interactive-elements.tsx +54 -0
- package/src/components/tools/browser/get-tab-content.tsx +51 -0
- package/src/components/tools/browser/navigate-to.tsx +59 -0
- package/src/components/tools/browser/new-tab.tsx +60 -0
- package/src/components/tools/browser/perform-action.tsx +63 -0
- package/src/components/tools/browser/refresh-tab.tsx +43 -0
- package/src/components/tools/browser/switch-tab.tsx +58 -0
- package/src/components/tools/filesystem/delete-file.tsx +104 -0
- package/src/components/tools/filesystem/edit.tsx +220 -0
- package/src/components/tools/filesystem/list-dir.tsx +78 -0
- package/src/components/tools/filesystem/read-file.tsx +180 -0
- package/src/components/tools/filesystem/upload-image.tsx +76 -0
- package/src/components/tools/ide/ide-diagnostics.tsx +62 -0
- package/src/components/tools/index.ts +91 -0
- package/src/components/tools/mcp/mcp-tool.tsx +158 -0
- package/src/components/tools/search/fetch-url.tsx +73 -0
- package/src/components/tools/search/file-search.tsx +78 -0
- package/src/components/tools/search/grep.tsx +90 -0
- package/src/components/tools/search/semantic-search.tsx +66 -0
- package/src/components/tools/search/web-search.tsx +71 -0
- package/src/components/tools/shared/index.tsx +48 -0
- package/src/components/tools/shared/zod-coercion.ts +35 -0
- package/src/components/tools/terminal/bash-tool-output.tsx +188 -0
- package/src/components/tools/terminal/get-terminal-output.tsx +91 -0
- package/src/components/tools/terminal/run-in-terminal.tsx +131 -0
- package/src/components/tools/types.ts +16 -0
- package/src/components/tools.tsx +68 -0
- package/src/components/ui/__tests__/divider.test.tsx +61 -0
- package/src/components/ui/__tests__/gradient.test.tsx +125 -0
- package/src/components/ui/__tests__/input.test.tsx +166 -0
- package/src/components/ui/__tests__/select.test.tsx +273 -0
- package/src/components/ui/__tests__/shimmer.test.tsx +99 -0
- package/src/components/ui/blinking-indicator.tsx +27 -0
- package/src/components/ui/divider.tsx +162 -0
- package/src/components/ui/gradient.tsx +56 -0
- package/src/components/ui/input.tsx +228 -0
- package/src/components/ui/select.tsx +151 -0
- package/src/components/ui/shimmer.tsx +76 -0
- package/src/context/agent-mode.tsx +95 -0
- package/src/context/extension-file.tsx +136 -0
- package/src/context/network-activity.tsx +45 -0
- package/src/context/notification.tsx +62 -0
- package/src/context/shell-size.tsx +49 -0
- package/src/context/shell-title.tsx +38 -0
- package/src/entrypoints/print-mode.ts +312 -0
- package/src/entrypoints/repl.tsx +389 -0
- package/src/hooks/use-agent.ts +15 -0
- package/src/hooks/use-api-client.ts +1 -0
- package/src/hooks/use-available-height.ts +8 -0
- package/src/hooks/use-cleanup.ts +29 -0
- package/src/hooks/use-interrupt-manager.ts +242 -0
- package/src/hooks/use-models.ts +22 -0
- package/src/index.ts +217 -0
- package/src/lib/__tests__/ansi.test.ts +255 -0
- package/src/lib/__tests__/cli.test.ts +122 -0
- package/src/lib/__tests__/commands.test.ts +325 -0
- package/src/lib/__tests__/constants.test.ts +15 -0
- package/src/lib/__tests__/focusables.test.ts +25 -0
- package/src/lib/__tests__/fs.test.ts +231 -0
- package/src/lib/__tests__/markdown.test.tsx +348 -0
- package/src/lib/__tests__/mcpCommandHandler.test.ts +173 -0
- package/src/lib/__tests__/mcpManagement.test.ts +38 -0
- package/src/lib/__tests__/path-paste.test.ts +144 -0
- package/src/lib/__tests__/path.test.ts +300 -0
- package/src/lib/__tests__/queries.test.ts +39 -0
- package/src/lib/__tests__/standaloneMcpService.test.ts +71 -0
- package/src/lib/__tests__/text-buffer.test.ts +328 -0
- package/src/lib/__tests__/text-utils.test.ts +32 -0
- package/src/lib/__tests__/timing.test.ts +78 -0
- package/src/lib/__tests__/utils.test.ts +238 -0
- package/src/lib/__tests__/vim-buffer-actions.test.ts +154 -0
- package/src/lib/ansi.ts +150 -0
- package/src/lib/cli-push-server.ts +112 -0
- package/src/lib/cli.ts +44 -0
- package/src/lib/clipboard.ts +226 -0
- package/src/lib/command-utils.ts +93 -0
- package/src/lib/commands.ts +270 -0
- package/src/lib/constants.ts +3 -0
- package/src/lib/extension-connection.ts +181 -0
- package/src/lib/focusables.ts +7 -0
- package/src/lib/fs.ts +533 -0
- package/src/lib/markdown/code-block.tsx +63 -0
- package/src/lib/markdown/index.ts +4 -0
- package/src/lib/markdown/link.tsx +19 -0
- package/src/lib/markdown/markdown.tsx +372 -0
- package/src/lib/markdown/types.ts +15 -0
- package/src/lib/mcpCommandHandler.ts +121 -0
- package/src/lib/mcpManagement.ts +44 -0
- package/src/lib/path-paste.ts +185 -0
- package/src/lib/path.ts +179 -0
- package/src/lib/queries.ts +15 -0
- package/src/lib/standaloneMcpService.ts +688 -0
- package/src/lib/status-utils.ts +237 -0
- package/src/lib/test-utils.tsx +72 -0
- package/src/lib/text-buffer.ts +2415 -0
- package/src/lib/text-utils.ts +272 -0
- package/src/lib/timing.ts +63 -0
- package/src/lib/types.ts +295 -0
- package/src/lib/utils.ts +182 -0
- package/src/lib/vim-buffer-actions.ts +732 -0
- package/src/providers/agent.tsx +1063 -0
- package/src/providers/api-client.tsx +43 -0
- package/src/services/logger.ts +85 -0
- package/src/terminal/detection.ts +187 -0
- package/src/terminal/exit.ts +279 -0
- package/src/terminal/notification.ts +83 -0
- package/src/terminal/progress.ts +201 -0
- package/src/terminal/setup.ts +797 -0
- package/src/terminal/types.ts +51 -0
- package/src/theme/context.tsx +57 -0
- package/src/theme/index.ts +4 -0
- package/src/theme/themed.tsx +35 -0
- package/src/theme/themes.json +546 -0
- package/src/theme/types.ts +110 -0
- package/src/tools/types.ts +59 -0
- package/src/tools/utils/__tests__/zod-coercion.test.ts +33 -0
- package/src/tools/utils/tool-ui-components.tsx +649 -0
- package/src/tools/utils/zod-coercion.ts +35 -0
- package/tsconfig.json +16 -0
- package/tsconfig.node.json +29 -0
- package/tsconfig.test.json +27 -0
- package/tsdown.config.ts +17 -0
- package/vitest.config.ts +76 -0
- package/README.md +0 -28
- package/dist/index.js +0 -26
package/package.json
CHANGED
|
@@ -1,47 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abacus-ai/cli",
|
|
3
|
-
"
|
|
4
|
-
"binName": "abacusai",
|
|
5
|
-
"version": "1.106.25008",
|
|
6
|
-
"nodeVersion": "22.19.0",
|
|
7
|
-
"distro": "fb9b4b01c06699c1a80f26ca9de940a9aebb29e0",
|
|
8
|
-
"author": {
|
|
9
|
-
"name": "Abacus AI"
|
|
10
|
-
},
|
|
11
|
-
"license": "Proprietary",
|
|
12
|
-
"main": "./dist/index.js",
|
|
13
|
-
"module": "./dist/index.js",
|
|
14
|
-
"source": "./src/index.ts",
|
|
3
|
+
"version": "2.0.0-canary.1",
|
|
15
4
|
"type": "module",
|
|
16
|
-
"homepage": "https://desktop.abacus.ai/",
|
|
17
|
-
"files": [
|
|
18
|
-
"dist"
|
|
19
|
-
],
|
|
20
|
-
"bugs": {
|
|
21
|
-
"url": "mailto:support@abacus.ai"
|
|
22
|
-
},
|
|
23
5
|
"bin": {
|
|
24
|
-
"abacusai": "
|
|
25
|
-
},
|
|
26
|
-
"scripts": {
|
|
27
|
-
"build": "tsc && bun build ./src/index.ts --minify --target=node --outdir=dist"
|
|
6
|
+
"abacusai": "dist/index.mjs"
|
|
28
7
|
},
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"@tsconfig/strictest": "^2.0.7",
|
|
32
|
-
"@types/color-name": "^2.0.0",
|
|
33
|
-
"@types/glob": "^9.0.0",
|
|
34
|
-
"@types/minimatch": "^6.0.0",
|
|
35
|
-
"@types/node": "^24.9.2",
|
|
36
|
-
"@types/semver": "^7.7.1",
|
|
37
|
-
"extract-zip": "^2.0.1",
|
|
38
|
-
"node-downloader-helper": "^2.1.9",
|
|
39
|
-
"semver": "^7.7.3",
|
|
40
|
-
"simple-update-notifier": "^2.0.0",
|
|
41
|
-
"tar": "^7.5.2",
|
|
42
|
-
"typescript": "^6.0.0-dev.20251031"
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=18"
|
|
43
10
|
},
|
|
44
|
-
"
|
|
45
|
-
"
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"koffi": "^2.15.1",
|
|
13
|
+
"@vscode/ripgrep": "^1.17.0"
|
|
46
14
|
}
|
|
47
15
|
}
|
|
Binary file
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<!-- Required for Bun's JIT compilation in standalone executables -->
|
|
6
|
+
<key>com.apple.security.cs.allow-jit</key>
|
|
7
|
+
<true/>
|
|
8
|
+
</dict>
|
|
9
|
+
</plist>
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# E2E Tests for TUI
|
|
2
|
+
|
|
3
|
+
This directory contains end-to-end tests for the TUI (Terminal User Interface) using `ink-testing-library`.
|
|
4
|
+
|
|
5
|
+
## Test Structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
src/__e2e__/
|
|
9
|
+
├── helpers/
|
|
10
|
+
│ └── test-helpers.ts # Shared test utilities and helpers
|
|
11
|
+
├── repl.e2e.test.tsx # E2E tests for REPL functionality
|
|
12
|
+
├── conversation.e2e.test.tsx # E2E tests for conversation flows
|
|
13
|
+
├── tool-permissions.e2e.test.tsx # E2E tests for tool permissions
|
|
14
|
+
├── cli-commands.e2e.test.tsx # E2E tests for CLI commands (/help, /status, etc.)
|
|
15
|
+
├── agent-interactions.e2e.test.tsx # E2E tests for agent interactions (send, stop, model)
|
|
16
|
+
├── keyboard-navigation.e2e.test.tsx # E2E tests for keyboard navigation (ESC, arrows)
|
|
17
|
+
├── theme-mcp.e2e.test.tsx # E2E tests for theme and MCP menus
|
|
18
|
+
└── shell-compatibility.e2e.test.tsx # E2E tests for shell compatibility (bash, zsh, fish)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Running Tests
|
|
22
|
+
|
|
23
|
+
The tests need you to set the `ABACUS_API_KEY` and/or `ABACUS_THROTTLED_API_KEY` environment variables. You can get these from the [Abacus AI CLI dashboard](https://abacus.ai/app/abacusai-cli).
|
|
24
|
+
|
|
25
|
+
### Run all tests (unit + e2e)
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm run test
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Run only e2e tests
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm run test:e2e
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Run only unit tests
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm run test:unit
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Watch mode for e2e tests
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm run test:e2e:watch
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Run with UI
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm run test:ui
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Run with coverage
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm run test:coverage
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Writing E2E Tests
|
|
62
|
+
|
|
63
|
+
E2E tests use `ink-testing-library` to render the full TUI application and simulate user interactions.
|
|
64
|
+
|
|
65
|
+
### Example Test
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
import { renderE2E, simulateText, simulateEnter, waitForFrame } from "./helpers/test-helpers.js";
|
|
69
|
+
import React from "react";
|
|
70
|
+
import { sleep } from "../lib/utils.js";
|
|
71
|
+
|
|
72
|
+
it("should handle user input", async () => {
|
|
73
|
+
const { App } = await import("../entrypoints/repl.js");
|
|
74
|
+
const config = {
|
|
75
|
+
cwd: process.cwd(),
|
|
76
|
+
isIndependentMode: false,
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const { lastFrame, stdin, unmount } = renderE2E(React.createElement(App, { config } as any));
|
|
80
|
+
|
|
81
|
+
// Wait for the app to render
|
|
82
|
+
await waitForFrame(lastFrame, (frame) => frame.length > 0, 3000);
|
|
83
|
+
|
|
84
|
+
// Simulate user typing
|
|
85
|
+
simulateText(stdin, "Hello");
|
|
86
|
+
simulateEnter(stdin);
|
|
87
|
+
|
|
88
|
+
// Wait for response
|
|
89
|
+
await sleep(500);
|
|
90
|
+
|
|
91
|
+
// Assert
|
|
92
|
+
const frame = lastFrame();
|
|
93
|
+
expect(frame).toContain("Hello");
|
|
94
|
+
|
|
95
|
+
unmount();
|
|
96
|
+
});
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Helper Functions
|
|
100
|
+
|
|
101
|
+
### `renderE2E(component)`
|
|
102
|
+
|
|
103
|
+
Renders a component for e2e testing, returns test context with `lastFrame()`, `stdin`, `frames`, and `unmount()`.
|
|
104
|
+
|
|
105
|
+
### `simulateText(stdin, text)`
|
|
106
|
+
|
|
107
|
+
Simulates typing text character by character.
|
|
108
|
+
|
|
109
|
+
### `simulateEnter(stdin)`
|
|
110
|
+
|
|
111
|
+
Simulates pressing Enter key.
|
|
112
|
+
|
|
113
|
+
### `simulateCtrlC(stdin)`
|
|
114
|
+
|
|
115
|
+
Simulates pressing Ctrl+C.
|
|
116
|
+
|
|
117
|
+
### `simulateEscape(stdin)`
|
|
118
|
+
|
|
119
|
+
Simulates pressing ESC key.
|
|
120
|
+
|
|
121
|
+
### `simulateUpArrow(stdin)`
|
|
122
|
+
|
|
123
|
+
Simulates pressing Up Arrow key (for history navigation).
|
|
124
|
+
|
|
125
|
+
### `simulateDownArrow(stdin)`
|
|
126
|
+
|
|
127
|
+
Simulates pressing Down Arrow key.
|
|
128
|
+
|
|
129
|
+
### `simulateRightArrow(stdin)`
|
|
130
|
+
|
|
131
|
+
Simulates pressing Right Arrow key.
|
|
132
|
+
|
|
133
|
+
### `simulateLeftArrow(stdin)`
|
|
134
|
+
|
|
135
|
+
Simulates pressing Left Arrow key.
|
|
136
|
+
|
|
137
|
+
### `waitForFrame(lastFrame, predicate, timeout)`
|
|
138
|
+
|
|
139
|
+
Waits for a frame that matches the predicate function.
|
|
140
|
+
|
|
141
|
+
### `mockApiClient()`
|
|
142
|
+
|
|
143
|
+
Creates a mock API client for testing.
|
|
144
|
+
|
|
145
|
+
### `mockConfigService()`
|
|
146
|
+
|
|
147
|
+
Creates a mock config service for testing.
|
|
148
|
+
|
|
149
|
+
## Best Practices
|
|
150
|
+
|
|
151
|
+
1. **Use `// @vitest-environment node`** at the top of e2e test files to run in Node environment
|
|
152
|
+
2. **Always unmount** after each test to clean up resources
|
|
153
|
+
3. **Use `waitForFrame`** instead of arbitrary timeouts when possible
|
|
154
|
+
4. **Mock external dependencies** like API clients to make tests deterministic
|
|
155
|
+
5. **Test user flows**, not implementation details
|
|
156
|
+
6. **Keep tests focused** - one flow per test
|
|
157
|
+
7. **Use descriptive test names** that explain the user scenario
|
|
158
|
+
|
|
159
|
+
## Differences from Component Tests
|
|
160
|
+
|
|
161
|
+
| Aspect | Component Tests | E2E Tests |
|
|
162
|
+
| --------------- | --------------------- | ------------------------- |
|
|
163
|
+
| **Scope** | Individual components | Full application flow |
|
|
164
|
+
| **Environment** | jsdom | Node (with Ink rendering) |
|
|
165
|
+
| **Mocking** | Heavy mocking | Minimal mocking |
|
|
166
|
+
| **Speed** | Fast | Slower |
|
|
167
|
+
| **Focus** | Component behavior | User experience |
|
|
168
|
+
| **Location** | `src/lib/__tests__/` | `src/__e2e__/` |
|
|
169
|
+
|
|
170
|
+
## Debugging
|
|
171
|
+
|
|
172
|
+
To debug e2e tests, you can:
|
|
173
|
+
|
|
174
|
+
1. Print the current frame:
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
console.log(lastFrame());
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
2. Print all frames:
|
|
181
|
+
|
|
182
|
+
```typescript
|
|
183
|
+
console.log(frames);
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
3. Add longer timeouts for debugging:
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
await waitForFrame(lastFrame, predicate, 30000); // 30 seconds
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
4. Use Vitest UI mode for visual debugging:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
npm run test:ui
|
|
196
|
+
```
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { describe, it, expect } from "vitest";
|
|
3
|
+
|
|
4
|
+
import { App } from "../entrypoints/repl.js";
|
|
5
|
+
import { Timing } from "../lib/timing.js";
|
|
6
|
+
import {
|
|
7
|
+
renderWithProviders,
|
|
8
|
+
simulateText,
|
|
9
|
+
simulateEnter,
|
|
10
|
+
waitForFrame,
|
|
11
|
+
} from "./helpers/test-helpers.js";
|
|
12
|
+
|
|
13
|
+
describe.concurrent("Agent Interaction E2E Tests", () => {
|
|
14
|
+
it("send message and stop agent", async () => {
|
|
15
|
+
const timing = new Timing();
|
|
16
|
+
|
|
17
|
+
const { lastFrame, stdin, unmount } = renderWithProviders(React.createElement(App, { timing }));
|
|
18
|
+
|
|
19
|
+
await waitForFrame(lastFrame, (frame) => frame.length > 0, 8000);
|
|
20
|
+
simulateText(stdin, "Build me a tic tac toe game");
|
|
21
|
+
simulateEnter(stdin);
|
|
22
|
+
|
|
23
|
+
simulateText(stdin, "/stop");
|
|
24
|
+
simulateEnter(stdin);
|
|
25
|
+
|
|
26
|
+
const frame = lastFrame();
|
|
27
|
+
expect(frame.length).toBeGreaterThan(0);
|
|
28
|
+
|
|
29
|
+
unmount();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("change model", async () => {
|
|
33
|
+
const timing = new Timing();
|
|
34
|
+
|
|
35
|
+
const { lastFrame, stdin, unmount } = renderWithProviders(React.createElement(App, { timing }));
|
|
36
|
+
|
|
37
|
+
await waitForFrame(lastFrame, (frame) => frame.length > 0, 5000);
|
|
38
|
+
simulateText(stdin, "/model gpt-4");
|
|
39
|
+
simulateEnter(stdin);
|
|
40
|
+
|
|
41
|
+
const frame = lastFrame();
|
|
42
|
+
expect(frame.length).toBeGreaterThan(0);
|
|
43
|
+
|
|
44
|
+
unmount();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("terminal setup command", async () => {
|
|
48
|
+
const timing = new Timing();
|
|
49
|
+
|
|
50
|
+
const { lastFrame, stdin, unmount } = renderWithProviders(React.createElement(App, { timing }));
|
|
51
|
+
|
|
52
|
+
await waitForFrame(lastFrame, (frame) => frame.length > 0, 5000);
|
|
53
|
+
simulateText(stdin, "/terminal-setup");
|
|
54
|
+
simulateEnter(stdin);
|
|
55
|
+
|
|
56
|
+
const frame = lastFrame();
|
|
57
|
+
expect(frame.length).toBeGreaterThan(0);
|
|
58
|
+
|
|
59
|
+
unmount();
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { describe, it, expect } from "vitest";
|
|
3
|
+
|
|
4
|
+
import { App } from "../entrypoints/repl.js";
|
|
5
|
+
import { Timing } from "../lib/timing.js";
|
|
6
|
+
import {
|
|
7
|
+
renderWithProviders,
|
|
8
|
+
simulateText,
|
|
9
|
+
simulateEnter,
|
|
10
|
+
waitForFrame,
|
|
11
|
+
} from "./helpers/test-helpers.js";
|
|
12
|
+
|
|
13
|
+
describe.concurrent("CLI Commands E2E Tests", () => {
|
|
14
|
+
it("/help - should display help information", async () => {
|
|
15
|
+
const timing = new Timing();
|
|
16
|
+
|
|
17
|
+
const { lastFrame, stdin, unmount } = renderWithProviders(React.createElement(App, { timing }));
|
|
18
|
+
|
|
19
|
+
await waitForFrame(lastFrame, (frame) => frame.length > 0, 5000);
|
|
20
|
+
|
|
21
|
+
simulateText(stdin, "/help");
|
|
22
|
+
simulateEnter(stdin);
|
|
23
|
+
|
|
24
|
+
const frame = lastFrame();
|
|
25
|
+
expect(frame.length).toBeGreaterThan(0);
|
|
26
|
+
|
|
27
|
+
unmount();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("/version - should display CLI version", async () => {
|
|
31
|
+
const timing = new Timing();
|
|
32
|
+
|
|
33
|
+
const { lastFrame, stdin, unmount } = renderWithProviders(React.createElement(App, { timing }));
|
|
34
|
+
|
|
35
|
+
await waitForFrame(lastFrame, (frame) => frame.length > 0, 5000);
|
|
36
|
+
|
|
37
|
+
simulateText(stdin, "/version");
|
|
38
|
+
simulateEnter(stdin);
|
|
39
|
+
|
|
40
|
+
const frame = lastFrame();
|
|
41
|
+
expect(frame.length).toBeGreaterThan(0);
|
|
42
|
+
|
|
43
|
+
unmount();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it("/status - should display user status information", async () => {
|
|
47
|
+
const timing = new Timing();
|
|
48
|
+
|
|
49
|
+
const { lastFrame, stdin, unmount } = renderWithProviders(React.createElement(App, { timing }));
|
|
50
|
+
|
|
51
|
+
await waitForFrame(lastFrame, (frame) => frame.length > 0, 5000);
|
|
52
|
+
|
|
53
|
+
simulateText(stdin, "/status");
|
|
54
|
+
simulateEnter(stdin);
|
|
55
|
+
|
|
56
|
+
const frame = lastFrame();
|
|
57
|
+
expect(frame.length).toBeGreaterThan(0);
|
|
58
|
+
|
|
59
|
+
unmount();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("/usage - should display usage information", async () => {
|
|
63
|
+
const timing = new Timing();
|
|
64
|
+
|
|
65
|
+
const { lastFrame, stdin, unmount } = renderWithProviders(React.createElement(App, { timing }));
|
|
66
|
+
|
|
67
|
+
await waitForFrame(lastFrame, (frame) => frame.length > 0, 5000);
|
|
68
|
+
|
|
69
|
+
simulateText(stdin, "/usage");
|
|
70
|
+
simulateEnter(stdin);
|
|
71
|
+
|
|
72
|
+
const frame = lastFrame();
|
|
73
|
+
expect(frame.length).toBeGreaterThan(0);
|
|
74
|
+
|
|
75
|
+
unmount();
|
|
76
|
+
});
|
|
77
|
+
});
|