@supatest/cli 0.0.5 → 0.0.6

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 (69) hide show
  1. package/dist/index.js +9485 -157
  2. package/package.json +8 -5
  3. package/dist/commands/login.js +0 -392
  4. package/dist/commands/setup.js +0 -234
  5. package/dist/config.js +0 -29
  6. package/dist/core/agent.js +0 -259
  7. package/dist/modes/headless.js +0 -117
  8. package/dist/modes/interactive.js +0 -418
  9. package/dist/presenters/composite.js +0 -32
  10. package/dist/presenters/console.js +0 -163
  11. package/dist/presenters/react.js +0 -217
  12. package/dist/presenters/types.js +0 -1
  13. package/dist/presenters/web.js +0 -78
  14. package/dist/prompts/builder.js +0 -181
  15. package/dist/prompts/fixer.js +0 -148
  16. package/dist/prompts/index.js +0 -3
  17. package/dist/prompts/planner.js +0 -70
  18. package/dist/services/api-client.js +0 -244
  19. package/dist/services/event-streamer.js +0 -130
  20. package/dist/types.js +0 -1
  21. package/dist/ui/App.js +0 -322
  22. package/dist/ui/components/AuthBanner.js +0 -24
  23. package/dist/ui/components/AuthDialog.js +0 -32
  24. package/dist/ui/components/Banner.js +0 -12
  25. package/dist/ui/components/ExpandableSection.js +0 -17
  26. package/dist/ui/components/Header.js +0 -51
  27. package/dist/ui/components/HelpMenu.js +0 -89
  28. package/dist/ui/components/InputPrompt.js +0 -286
  29. package/dist/ui/components/MessageList.js +0 -42
  30. package/dist/ui/components/QueuedMessageDisplay.js +0 -31
  31. package/dist/ui/components/Scrollable.js +0 -103
  32. package/dist/ui/components/SessionSelector.js +0 -196
  33. package/dist/ui/components/StatusBar.js +0 -34
  34. package/dist/ui/components/messages/AssistantMessage.js +0 -20
  35. package/dist/ui/components/messages/ErrorMessage.js +0 -26
  36. package/dist/ui/components/messages/LoadingMessage.js +0 -28
  37. package/dist/ui/components/messages/ThinkingMessage.js +0 -17
  38. package/dist/ui/components/messages/TodoMessage.js +0 -44
  39. package/dist/ui/components/messages/ToolMessage.js +0 -218
  40. package/dist/ui/components/messages/UserMessage.js +0 -14
  41. package/dist/ui/contexts/KeypressContext.js +0 -527
  42. package/dist/ui/contexts/MouseContext.js +0 -98
  43. package/dist/ui/contexts/SessionContext.js +0 -129
  44. package/dist/ui/hooks/useAnimatedScrollbar.js +0 -83
  45. package/dist/ui/hooks/useBatchedScroll.js +0 -22
  46. package/dist/ui/hooks/useBracketedPaste.js +0 -31
  47. package/dist/ui/hooks/useFocus.js +0 -50
  48. package/dist/ui/hooks/useKeypress.js +0 -26
  49. package/dist/ui/hooks/useModeToggle.js +0 -25
  50. package/dist/ui/types/auth.js +0 -13
  51. package/dist/ui/utils/file-completion.js +0 -56
  52. package/dist/ui/utils/input.js +0 -50
  53. package/dist/ui/utils/markdown.js +0 -376
  54. package/dist/ui/utils/mouse.js +0 -189
  55. package/dist/ui/utils/theme.js +0 -59
  56. package/dist/utils/banner.js +0 -9
  57. package/dist/utils/encryption.js +0 -71
  58. package/dist/utils/events.js +0 -36
  59. package/dist/utils/keychain-storage.js +0 -120
  60. package/dist/utils/logger.js +0 -209
  61. package/dist/utils/node-version.js +0 -89
  62. package/dist/utils/plan-file.js +0 -75
  63. package/dist/utils/project-instructions.js +0 -23
  64. package/dist/utils/rich-logger.js +0 -208
  65. package/dist/utils/stdin.js +0 -25
  66. package/dist/utils/stdio.js +0 -80
  67. package/dist/utils/summary.js +0 -94
  68. package/dist/utils/token-storage.js +0 -242
  69. package/dist/version.js +0 -6
@@ -1,218 +0,0 @@
1
- /**
2
- * Tool message component
3
- * Displays tool calls (Read, Write, Edit, Bash, etc.)
4
- */
5
- import { structuredPatch } from "diff";
6
- import { Box, Text } from "ink";
7
- import React from "react";
8
- import { getToolDisplayName } from "shared";
9
- import { theme } from "../../utils/theme.js";
10
- export const ToolMessage = ({ toolName, description, input, result, isExpanded = true, }) => {
11
- const displayName = getToolDisplayName(toolName);
12
- const { icon, color } = getToolStyle(toolName);
13
- const resultSummary = result ? getResultSummary(toolName, result) : null;
14
- const hasExpandableContent = !!result;
15
- const isRunning = !result;
16
- // Get the actual command/content to display
17
- const commandDisplay = getCommandDisplay(toolName, input);
18
- // Check if this is an Edit operation - show diff by default
19
- const isEditOperation = toolName === "Edit";
20
- const editDiff = isEditOperation ? getEditDiff(input) : null;
21
- // Tools that support expand/collapse (Bash has expandable output)
22
- const isExpandableTool = toolName === "Bash" || toolName === "BashOutput" || toolName === "Command Output";
23
- return (React.createElement(Box, { flexDirection: "column", marginTop: 1 },
24
- React.createElement(Box, { flexDirection: "row" },
25
- hasExpandableContent && isExpandableTool ? (React.createElement(Text, { color: theme.text.dim }, isExpanded ? "▼ " : "▶ ")) : (React.createElement(Text, { color: isRunning ? "yellow" : color }, "\u25CF ")),
26
- React.createElement(Text, { bold: true, color: color }, displayName),
27
- React.createElement(Text, { color: theme.text.dim },
28
- "(",
29
- description,
30
- ")"),
31
- editDiff && (React.createElement(Text, { color: theme.text.dim },
32
- " with ",
33
- editDiff.additions,
34
- " addition",
35
- editDiff.additions !== 1 ? "s" : "",
36
- " and ",
37
- editDiff.removals,
38
- " removal",
39
- editDiff.removals !== 1 ? "s" : "")),
40
- hasExpandableContent && !isExpanded && isExpandableTool && (React.createElement(Text, { color: theme.text.dim }, " (ctrl+o to expand)"))),
41
- !isEditOperation && resultSummary && (React.createElement(Box, { marginLeft: 2 },
42
- React.createElement(Text, { color: theme.text.dim },
43
- "\u2514 ",
44
- resultSummary))),
45
- editDiff && (React.createElement(Box, { flexDirection: "column", marginLeft: 2 }, editDiff.lines.map((line, i) => {
46
- if (line.type === "separator") {
47
- return (React.createElement(Box, { key: i, flexDirection: "row" },
48
- React.createElement(Text, { color: theme.text.dim }, "...")));
49
- }
50
- const isRemove = line.type === "remove";
51
- const isAdd = line.type === "add";
52
- const bgColor = isRemove ? "#5c1b1b" : isAdd ? "#1b3d1b" : undefined;
53
- const prefix = isRemove ? "- " : isAdd ? "+ " : " ";
54
- const prefixColor = isRemove ? "red" : isAdd ? "green" : theme.text.dim;
55
- return (React.createElement(Box, { key: i, flexDirection: "row" },
56
- React.createElement(Text, { color: theme.text.dim }, line.lineNum.toString().padStart(4, " ")),
57
- React.createElement(Text, { color: prefixColor },
58
- " ",
59
- prefix),
60
- React.createElement(Text, { backgroundColor: bgColor }, line.content)));
61
- }))),
62
- isExpanded && result && isExpandableTool && (React.createElement(Box, { flexDirection: "column", marginLeft: 4, marginTop: 1 },
63
- React.createElement(Text, { color: theme.text.secondary }, truncate(result, 2000))))));
64
- };
65
- /**
66
- * Generate diff display for Edit operations using jsdiff
67
- * Shows context lines before/after changes like Claude Code
68
- */
69
- function getEditDiff(input) {
70
- if (!input?.old_string || !input?.new_string)
71
- return null;
72
- // Use jsdiff to compute structured patch with 3 lines of context
73
- const patch = structuredPatch("file", "file", input.old_string, input.new_string, "", "", { context: 3 });
74
- const lines = [];
75
- let additions = 0;
76
- let removals = 0;
77
- // Process each hunk
78
- for (let hunkIndex = 0; hunkIndex < patch.hunks.length; hunkIndex++) {
79
- const hunk = patch.hunks[hunkIndex];
80
- // Add separator between hunks (except for first)
81
- if (hunkIndex > 0) {
82
- lines.push({
83
- lineNum: "...",
84
- type: "separator",
85
- content: "",
86
- });
87
- }
88
- let oldLineNum = hunk.oldStart;
89
- let newLineNum = hunk.newStart;
90
- for (const line of hunk.lines) {
91
- const content = line.substring(1); // Remove the +/- prefix
92
- if (line.startsWith("+")) {
93
- lines.push({
94
- lineNum: newLineNum,
95
- type: "add",
96
- content,
97
- });
98
- newLineNum++;
99
- additions++;
100
- }
101
- else if (line.startsWith("-")) {
102
- lines.push({
103
- lineNum: oldLineNum,
104
- type: "remove",
105
- content,
106
- });
107
- oldLineNum++;
108
- removals++;
109
- }
110
- else {
111
- // Context line (starts with space)
112
- lines.push({
113
- lineNum: newLineNum,
114
- type: "context",
115
- content,
116
- });
117
- oldLineNum++;
118
- newLineNum++;
119
- }
120
- }
121
- }
122
- return { lines, additions, removals };
123
- }
124
- /**
125
- * Get command/content to display based on tool type
126
- */
127
- function getCommandDisplay(toolName, input) {
128
- if (!input)
129
- return null;
130
- switch (toolName) {
131
- case "Bash":
132
- case "BashOutput":
133
- case "Command Output": {
134
- const command = input.command || input.bash_id;
135
- if (!command)
136
- return null;
137
- // Split long commands into multiple lines
138
- return [command];
139
- }
140
- case "Read":
141
- case "Write":
142
- case "Edit":
143
- return input.file_path ? [input.file_path] : null;
144
- case "Grep":
145
- return input.pattern ? [`"${input.pattern}"${input.path ? ` in ${input.path}` : ""}`] : null;
146
- case "Glob":
147
- return input.pattern ? [input.pattern] : null;
148
- default:
149
- return null;
150
- }
151
- }
152
- /**
153
- * Get icon and color for tool based on name
154
- */
155
- function getToolStyle(toolName) {
156
- const styles = {
157
- Read: { icon: "📖", color: theme.tool.read },
158
- Write: { icon: "✏️", color: theme.tool.write },
159
- Edit: { icon: "✏️", color: theme.tool.edit },
160
- Bash: { icon: "🔨", color: theme.tool.bash },
161
- BashOutput: { icon: "📄", color: theme.tool.bash },
162
- "Command Output": { icon: "📄", color: theme.tool.bash },
163
- Glob: { icon: "🔍", color: theme.tool.search },
164
- Grep: { icon: "🔍", color: theme.tool.search },
165
- Task: { icon: "🤖", color: theme.tool.agent },
166
- TodoWrite: { icon: "📝", color: theme.text.info },
167
- };
168
- return styles[toolName] || { icon: "🔧", color: theme.text.secondary };
169
- }
170
- /**
171
- * Truncate string to max length
172
- */
173
- function truncate(str, maxLength) {
174
- if (str.length <= maxLength) {
175
- return str;
176
- }
177
- return str.slice(0, maxLength - 3) + "...";
178
- }
179
- /**
180
- * Get result summary for tool output
181
- */
182
- function getResultSummary(toolName, result) {
183
- switch (toolName) {
184
- case "Glob": {
185
- // Count lines that look like file paths
186
- const lines = result.split("\n").filter((line) => line.trim());
187
- const count = lines.filter((line) => !line.startsWith("Found")).length;
188
- return count > 0 ? `Found ${count} files` : "No files found";
189
- }
190
- case "Grep": {
191
- // Count lines of output
192
- const lines = result.split("\n").filter((line) => line.trim());
193
- return lines.length > 0
194
- ? `${lines.length} lines of output`
195
- : "No matches found";
196
- }
197
- case "Read": {
198
- // Count lines
199
- const lines = result.split("\n").length;
200
- return `Read ${lines} lines`;
201
- }
202
- case "Bash": {
203
- // Show if there was output
204
- const hasOutput = result.trim().length > 0;
205
- return hasOutput ? `${result.split("\n").length} lines of output` : null;
206
- }
207
- case "BashOutput":
208
- case "Command Output": {
209
- // Show lines of shell output
210
- const lines = result.split("\n").filter((line) => line.trim());
211
- return lines.length > 0
212
- ? `${lines.length} lines of output`
213
- : "No output";
214
- }
215
- default:
216
- return null;
217
- }
218
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * User message component
3
- * Displays user input/prompts
4
- */
5
- import { Box, Text } from "ink";
6
- import React from "react";
7
- import { theme } from "../../utils/theme.js";
8
- export const UserMessage = ({ text }) => {
9
- return (React.createElement(Box, { flexDirection: "row", marginTop: 1 },
10
- React.createElement(Box, { width: 2 },
11
- React.createElement(Text, { color: theme.text.info }, "\u276F ")),
12
- React.createElement(Box, { flexGrow: 1 },
13
- React.createElement(Text, { color: theme.text.primary }, text))));
14
- };