wave-code 0.0.5 → 0.0.8

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 (93) hide show
  1. package/README.md +3 -3
  2. package/dist/cli.d.ts +1 -0
  3. package/dist/cli.d.ts.map +1 -1
  4. package/dist/cli.js +2 -2
  5. package/dist/components/App.d.ts +1 -0
  6. package/dist/components/App.d.ts.map +1 -1
  7. package/dist/components/App.js +4 -4
  8. package/dist/components/BashHistorySelector.d.ts.map +1 -1
  9. package/dist/components/BashHistorySelector.js +17 -3
  10. package/dist/components/ChatInterface.d.ts.map +1 -1
  11. package/dist/components/ChatInterface.js +6 -24
  12. package/dist/components/CommandSelector.js +4 -4
  13. package/dist/components/Confirmation.d.ts +11 -0
  14. package/dist/components/Confirmation.d.ts.map +1 -0
  15. package/dist/components/Confirmation.js +148 -0
  16. package/dist/components/DiffDisplay.d.ts +8 -0
  17. package/dist/components/DiffDisplay.d.ts.map +1 -0
  18. package/dist/components/DiffDisplay.js +168 -0
  19. package/dist/components/FileSelector.d.ts +2 -4
  20. package/dist/components/FileSelector.d.ts.map +1 -1
  21. package/dist/components/FileSelector.js +2 -2
  22. package/dist/components/InputBox.d.ts.map +1 -1
  23. package/dist/components/InputBox.js +30 -50
  24. package/dist/components/Markdown.d.ts +6 -0
  25. package/dist/components/Markdown.d.ts.map +1 -0
  26. package/dist/components/Markdown.js +22 -0
  27. package/dist/components/MemoryDisplay.js +1 -1
  28. package/dist/components/MessageItem.d.ts +8 -0
  29. package/dist/components/MessageItem.d.ts.map +1 -0
  30. package/dist/components/MessageItem.js +15 -0
  31. package/dist/components/MessageList.d.ts +1 -1
  32. package/dist/components/MessageList.d.ts.map +1 -1
  33. package/dist/components/MessageList.js +33 -33
  34. package/dist/components/ReasoningDisplay.d.ts +8 -0
  35. package/dist/components/ReasoningDisplay.d.ts.map +1 -0
  36. package/dist/components/ReasoningDisplay.js +10 -0
  37. package/dist/components/SubagentBlock.d.ts +0 -1
  38. package/dist/components/SubagentBlock.d.ts.map +1 -1
  39. package/dist/components/SubagentBlock.js +29 -30
  40. package/dist/components/ToolResultDisplay.d.ts.map +1 -1
  41. package/dist/components/ToolResultDisplay.js +6 -5
  42. package/dist/contexts/useChat.d.ts +14 -2
  43. package/dist/contexts/useChat.d.ts.map +1 -1
  44. package/dist/contexts/useChat.js +128 -17
  45. package/dist/hooks/useInputManager.d.ts +6 -1
  46. package/dist/hooks/useInputManager.d.ts.map +1 -1
  47. package/dist/hooks/useInputManager.js +32 -2
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +30 -5
  50. package/dist/managers/InputManager.d.ts +11 -1
  51. package/dist/managers/InputManager.d.ts.map +1 -1
  52. package/dist/managers/InputManager.js +77 -26
  53. package/dist/print-cli.d.ts +2 -0
  54. package/dist/print-cli.d.ts.map +1 -1
  55. package/dist/print-cli.js +121 -23
  56. package/dist/utils/toolParameterTransforms.d.ts +23 -0
  57. package/dist/utils/toolParameterTransforms.d.ts.map +1 -0
  58. package/dist/utils/toolParameterTransforms.js +77 -0
  59. package/dist/utils/usageSummary.d.ts +6 -0
  60. package/dist/utils/usageSummary.d.ts.map +1 -1
  61. package/dist/utils/usageSummary.js +72 -0
  62. package/package.json +13 -8
  63. package/src/cli.tsx +3 -1
  64. package/src/components/App.tsx +7 -3
  65. package/src/components/BashHistorySelector.tsx +26 -3
  66. package/src/components/ChatInterface.tsx +38 -54
  67. package/src/components/CommandSelector.tsx +5 -5
  68. package/src/components/Confirmation.tsx +253 -0
  69. package/src/components/DiffDisplay.tsx +300 -0
  70. package/src/components/FileSelector.tsx +4 -6
  71. package/src/components/InputBox.tsx +58 -87
  72. package/src/components/Markdown.tsx +29 -0
  73. package/src/components/MemoryDisplay.tsx +1 -1
  74. package/src/components/MessageItem.tsx +96 -0
  75. package/src/components/MessageList.tsx +140 -202
  76. package/src/components/ReasoningDisplay.tsx +33 -0
  77. package/src/components/SubagentBlock.tsx +56 -84
  78. package/src/components/ToolResultDisplay.tsx +9 -5
  79. package/src/contexts/useChat.tsx +194 -21
  80. package/src/hooks/useInputManager.ts +40 -3
  81. package/src/index.ts +45 -5
  82. package/src/managers/InputManager.ts +101 -27
  83. package/src/print-cli.ts +143 -21
  84. package/src/utils/toolParameterTransforms.ts +104 -0
  85. package/src/utils/usageSummary.ts +109 -0
  86. package/dist/components/DiffViewer.d.ts +0 -9
  87. package/dist/components/DiffViewer.d.ts.map +0 -1
  88. package/dist/components/DiffViewer.js +0 -221
  89. package/dist/utils/fileSearch.d.ts +0 -20
  90. package/dist/utils/fileSearch.d.ts.map +0 -1
  91. package/dist/utils/fileSearch.js +0 -102
  92. package/src/components/DiffViewer.tsx +0 -321
  93. package/src/utils/fileSearch.ts +0 -133
@@ -1,133 +0,0 @@
1
- import { glob } from "glob";
2
- import { getGlobIgnorePatterns } from "wave-agent-sdk";
3
- import * as fs from "fs";
4
- import * as path from "path";
5
-
6
- export interface FileItem {
7
- path: string;
8
- type: "file" | "directory";
9
- }
10
-
11
- /**
12
- * Check if path is a directory
13
- */
14
- export const isDirectory = (filePath: string): boolean => {
15
- try {
16
- const fullPath = path.isAbsolute(filePath)
17
- ? filePath
18
- : path.join(process.cwd(), filePath);
19
- return fs.statSync(fullPath).isDirectory();
20
- } catch {
21
- return false;
22
- }
23
- };
24
-
25
- /**
26
- * Convert string paths to FileItem objects
27
- */
28
- export const convertToFileItems = (paths: string[]): FileItem[] => {
29
- return paths.map((filePath) => ({
30
- path: filePath,
31
- type: isDirectory(filePath) ? "directory" : "file",
32
- }));
33
- };
34
-
35
- /**
36
- * Search files and directories using glob patterns
37
- */
38
- export const searchFiles = async (
39
- query: string,
40
- options?: {
41
- maxResults?: number;
42
- workingDirectory?: string;
43
- },
44
- ): Promise<FileItem[]> => {
45
- const { maxResults = 10, workingDirectory = process.cwd() } = options || {};
46
-
47
- try {
48
- let files: string[] = [];
49
- let directories: string[] = [];
50
-
51
- const globOptions = {
52
- ignore: getGlobIgnorePatterns(workingDirectory),
53
- maxDepth: 10,
54
- nocase: true, // Case insensitive
55
- dot: true, // Include hidden files and directories
56
- cwd: workingDirectory, // Specify search root directory
57
- };
58
-
59
- if (!query.trim()) {
60
- // When query is empty, show some common file types and directories
61
- const commonPatterns = [
62
- "**/*.ts",
63
- "**/*.tsx",
64
- "**/*.js",
65
- "**/*.jsx",
66
- "**/*.json",
67
- ];
68
-
69
- // Search files
70
- const filePromises = commonPatterns.map((pattern) =>
71
- glob(pattern, { ...globOptions, nodir: true }),
72
- );
73
-
74
- // Search directories (only search first level to avoid too many results)
75
- const dirPromises = [glob("*/", { ...globOptions, maxDepth: 1 })];
76
-
77
- const fileResults = await Promise.all(filePromises);
78
- const dirResults = await Promise.all(dirPromises);
79
-
80
- files = fileResults.flat();
81
- directories = dirResults.flat().map((dir) => {
82
- // glob returns string type paths, remove trailing slash
83
- return String(dir).replace(/\/$/, "");
84
- });
85
- } else {
86
- // Build multiple glob patterns to support more flexible search
87
- const filePatterns = [
88
- // Match files with filenames containing query
89
- `**/*${query}*`,
90
- // Match files with query in path (match directory names)
91
- `**/${query}*/**/*`,
92
- ];
93
-
94
- const dirPatterns = [
95
- // Match directory names containing query
96
- `**/*${query}*/`,
97
- // Match directories containing query in path
98
- `**/${query}*/`,
99
- ];
100
-
101
- // Search files
102
- const filePromises = filePatterns.map((pattern) =>
103
- glob(pattern, { ...globOptions, nodir: true }),
104
- );
105
-
106
- // Search directories
107
- const dirPromises = dirPatterns.map((pattern) =>
108
- glob(pattern, { ...globOptions, nodir: false }),
109
- );
110
-
111
- const fileResults = await Promise.all(filePromises);
112
- const dirResults = await Promise.all(dirPromises);
113
-
114
- files = fileResults.flat();
115
- directories = dirResults.flat().map((dir) => {
116
- // glob returns string type paths, remove trailing slash
117
- return String(dir).replace(/\/$/, "");
118
- });
119
- }
120
-
121
- // Deduplicate and merge files and directories
122
- const uniqueFiles = Array.from(new Set(files));
123
- const uniqueDirectories = Array.from(new Set(directories));
124
- const allPaths = [...uniqueDirectories, ...uniqueFiles]; // Directories first
125
-
126
- // Limit to maximum results and convert to FileItem
127
- const fileItems = convertToFileItems(allPaths.slice(0, maxResults));
128
- return fileItems;
129
- } catch (error) {
130
- console.error("Glob search error:", error);
131
- return [];
132
- }
133
- };