wave-code 0.0.16 → 0.0.17

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 (90) hide show
  1. package/dist/cli.d.ts +1 -0
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +2 -2
  4. package/dist/commands/plugin/disable.d.ts +5 -0
  5. package/dist/commands/plugin/disable.d.ts.map +1 -0
  6. package/dist/commands/plugin/disable.js +21 -0
  7. package/dist/commands/plugin/enable.d.ts +5 -0
  8. package/dist/commands/plugin/enable.d.ts.map +1 -0
  9. package/dist/commands/plugin/enable.js +21 -0
  10. package/dist/commands/plugin/install.d.ts +5 -0
  11. package/dist/commands/plugin/install.d.ts.map +1 -0
  12. package/dist/commands/plugin/install.js +28 -0
  13. package/dist/commands/plugin/list.d.ts +2 -0
  14. package/dist/commands/plugin/list.d.ts.map +1 -0
  15. package/dist/commands/plugin/list.js +53 -0
  16. package/dist/commands/plugin/marketplace.d.ts +8 -0
  17. package/dist/commands/plugin/marketplace.d.ts.map +1 -0
  18. package/dist/commands/plugin/marketplace.js +73 -0
  19. package/dist/components/App.d.ts +1 -0
  20. package/dist/components/App.d.ts.map +1 -1
  21. package/dist/components/App.js +4 -4
  22. package/dist/components/BashHistorySelector.d.ts +1 -0
  23. package/dist/components/BashHistorySelector.d.ts.map +1 -1
  24. package/dist/components/BashHistorySelector.js +15 -5
  25. package/dist/components/BashShellManager.d.ts.map +1 -1
  26. package/dist/components/BashShellManager.js +4 -4
  27. package/dist/components/ChatInterface.d.ts.map +1 -1
  28. package/dist/components/ChatInterface.js +1 -2
  29. package/dist/components/CommandSelector.d.ts.map +1 -1
  30. package/dist/components/CommandSelector.js +2 -2
  31. package/dist/components/Confirmation.d.ts +1 -0
  32. package/dist/components/Confirmation.d.ts.map +1 -1
  33. package/dist/components/Confirmation.js +151 -48
  34. package/dist/components/DiffDisplay.d.ts +3 -2
  35. package/dist/components/DiffDisplay.d.ts.map +1 -1
  36. package/dist/components/DiffDisplay.js +87 -82
  37. package/dist/components/FileSelector.d.ts.map +1 -1
  38. package/dist/components/FileSelector.js +2 -2
  39. package/dist/components/InputBox.d.ts.map +1 -1
  40. package/dist/components/InputBox.js +2 -2
  41. package/dist/components/McpManager.d.ts.map +1 -1
  42. package/dist/components/McpManager.js +3 -3
  43. package/dist/components/MemoryTypeSelector.d.ts.map +1 -1
  44. package/dist/components/MemoryTypeSelector.js +1 -1
  45. package/dist/components/MessageList.js +1 -1
  46. package/dist/components/PlanDisplay.d.ts +8 -0
  47. package/dist/components/PlanDisplay.d.ts.map +1 -0
  48. package/dist/components/PlanDisplay.js +14 -0
  49. package/dist/components/ToolResultDisplay.d.ts.map +1 -1
  50. package/dist/components/ToolResultDisplay.js +1 -1
  51. package/dist/contexts/useChat.d.ts +1 -0
  52. package/dist/contexts/useChat.d.ts.map +1 -1
  53. package/dist/contexts/useChat.js +3 -1
  54. package/dist/hooks/useInputManager.d.ts +1 -0
  55. package/dist/hooks/useInputManager.d.ts.map +1 -1
  56. package/dist/hooks/useInputManager.js +4 -0
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +103 -0
  59. package/dist/managers/InputManager.d.ts +1 -0
  60. package/dist/managers/InputManager.d.ts.map +1 -1
  61. package/dist/managers/InputManager.js +7 -2
  62. package/dist/print-cli.d.ts +1 -0
  63. package/dist/print-cli.d.ts.map +1 -1
  64. package/dist/print-cli.js +2 -1
  65. package/package.json +2 -2
  66. package/src/cli.tsx +8 -1
  67. package/src/commands/plugin/disable.ts +31 -0
  68. package/src/commands/plugin/enable.ts +31 -0
  69. package/src/commands/plugin/install.ts +42 -0
  70. package/src/commands/plugin/list.ts +64 -0
  71. package/src/commands/plugin/marketplace.ts +72 -0
  72. package/src/components/App.tsx +11 -5
  73. package/src/components/BashHistorySelector.tsx +25 -7
  74. package/src/components/BashShellManager.tsx +16 -8
  75. package/src/components/ChatInterface.tsx +29 -27
  76. package/src/components/CommandSelector.tsx +8 -4
  77. package/src/components/Confirmation.tsx +312 -106
  78. package/src/components/DiffDisplay.tsx +167 -149
  79. package/src/components/FileSelector.tsx +8 -4
  80. package/src/components/InputBox.tsx +14 -4
  81. package/src/components/McpManager.tsx +12 -6
  82. package/src/components/MemoryTypeSelector.tsx +4 -2
  83. package/src/components/MessageList.tsx +1 -1
  84. package/src/components/PlanDisplay.tsx +46 -0
  85. package/src/components/ToolResultDisplay.tsx +4 -2
  86. package/src/contexts/useChat.tsx +4 -0
  87. package/src/hooks/useInputManager.ts +8 -0
  88. package/src/index.ts +178 -0
  89. package/src/managers/InputManager.ts +12 -1
  90. package/src/print-cli.ts +3 -0
package/src/index.ts CHANGED
@@ -14,30 +14,204 @@ export async function main() {
14
14
  alias: "r",
15
15
  description: "Restore session by ID",
16
16
  type: "string",
17
+ global: false,
17
18
  })
18
19
  .option("continue", {
19
20
  alias: "c",
20
21
  description: "Continue from last session",
21
22
  type: "boolean",
23
+ global: false,
22
24
  })
23
25
  .option("print", {
24
26
  alias: "p",
25
27
  description: "Print response without interactive mode",
26
28
  type: "string",
29
+ global: false,
27
30
  })
28
31
  .option("show-stats", {
29
32
  description: "Show timing and usage statistics in print mode",
30
33
  type: "boolean",
34
+ global: false,
31
35
  })
32
36
  .option("list-sessions", {
33
37
  description: "List all available sessions",
34
38
  type: "boolean",
39
+ global: false,
35
40
  })
36
41
  .option("dangerously-skip-permissions", {
37
42
  description: "Skip all permission checks (dangerous)",
38
43
  type: "boolean",
39
44
  default: false,
45
+ global: false,
40
46
  })
47
+ .option("plugin-dir", {
48
+ description: "Load a plugin from a specific directory",
49
+ type: "array",
50
+ string: true,
51
+ global: false,
52
+ })
53
+ .command(
54
+ "plugin",
55
+ "Manage plugins and marketplaces",
56
+ (yargs) => {
57
+ return yargs
58
+ .help()
59
+ .command(
60
+ "marketplace",
61
+ "Manage plugin marketplaces",
62
+ (yargs) => {
63
+ return yargs
64
+ .help()
65
+ .command(
66
+ "add <input>",
67
+ "Add a plugin marketplace (local path, owner/repo, or Git URL)",
68
+ (yargs) => {
69
+ return yargs.positional("input", {
70
+ describe:
71
+ "Path to local marketplace, GitHub owner/repo, or full Git URL (with optional #ref)",
72
+ type: "string",
73
+ });
74
+ },
75
+ async (argv) => {
76
+ const { addMarketplaceCommand } = await import(
77
+ "./commands/plugin/marketplace.js"
78
+ );
79
+ await addMarketplaceCommand(argv as { input: string });
80
+ },
81
+ )
82
+ .command(
83
+ "update [name]",
84
+ "Update registered marketplace(s)",
85
+ (yargs) => {
86
+ return yargs.positional("name", {
87
+ describe: "Name of the marketplace to update",
88
+ type: "string",
89
+ });
90
+ },
91
+ async (argv) => {
92
+ const { updateMarketplaceCommand } = await import(
93
+ "./commands/plugin/marketplace.js"
94
+ );
95
+ await updateMarketplaceCommand(argv as { name?: string });
96
+ },
97
+ )
98
+ .command(
99
+ "list",
100
+ "List registered marketplaces",
101
+ {},
102
+ async () => {
103
+ const { listMarketplacesCommand } = await import(
104
+ "./commands/plugin/marketplace.js"
105
+ );
106
+ await listMarketplacesCommand();
107
+ },
108
+ )
109
+ .demandCommand(1, "Please specify a marketplace subcommand");
110
+ },
111
+ () => {},
112
+ )
113
+ .command(
114
+ "install <plugin>",
115
+ "Install a plugin from a marketplace",
116
+ (yargs) => {
117
+ return yargs
118
+ .positional("plugin", {
119
+ describe: "Plugin to install (format: name@marketplace)",
120
+ type: "string",
121
+ })
122
+ .option("scope", {
123
+ alias: "s",
124
+ describe: "Scope to enable the plugin in",
125
+ choices: ["user", "project", "local"],
126
+ default: "user",
127
+ type: "string",
128
+ });
129
+ },
130
+ async (argv) => {
131
+ const { installPluginCommand } = await import(
132
+ "./commands/plugin/install.js"
133
+ );
134
+ await installPluginCommand(
135
+ argv as {
136
+ plugin: string;
137
+ scope?: "user" | "project" | "local";
138
+ },
139
+ );
140
+ },
141
+ )
142
+ .command(
143
+ "list",
144
+ "List all available plugins from marketplaces",
145
+ {},
146
+ async () => {
147
+ const { listPluginsCommand } = await import(
148
+ "./commands/plugin/list.js"
149
+ );
150
+ await listPluginsCommand();
151
+ },
152
+ )
153
+ .command(
154
+ "enable <plugin>",
155
+ "Enable a plugin in a specific scope",
156
+ (yargs) => {
157
+ return yargs
158
+ .positional("plugin", {
159
+ describe: "Plugin ID (format: name@marketplace)",
160
+ type: "string",
161
+ })
162
+ .option("scope", {
163
+ alias: "s",
164
+ describe: "Scope to enable the plugin in",
165
+ choices: ["user", "project", "local"],
166
+ default: "user",
167
+ type: "string",
168
+ });
169
+ },
170
+ async (argv) => {
171
+ const { enablePluginCommand } = await import(
172
+ "./commands/plugin/enable.js"
173
+ );
174
+ await enablePluginCommand(
175
+ argv as {
176
+ plugin: string;
177
+ scope: "user" | "project" | "local";
178
+ },
179
+ );
180
+ },
181
+ )
182
+ .command(
183
+ "disable <plugin>",
184
+ "Disable a plugin in a specific scope",
185
+ (yargs) => {
186
+ return yargs
187
+ .positional("plugin", {
188
+ describe: "Plugin ID (format: name@marketplace)",
189
+ type: "string",
190
+ })
191
+ .option("scope", {
192
+ alias: "s",
193
+ describe: "Scope to disable the plugin in",
194
+ choices: ["user", "project", "local"],
195
+ default: "user",
196
+ type: "string",
197
+ });
198
+ },
199
+ async (argv) => {
200
+ const { disablePluginCommand } = await import(
201
+ "./commands/plugin/disable.js"
202
+ );
203
+ await disablePluginCommand(
204
+ argv as {
205
+ plugin: string;
206
+ scope: "user" | "project" | "local";
207
+ },
208
+ );
209
+ },
210
+ )
211
+ .demandCommand(1, "Please specify a plugin subcommand");
212
+ },
213
+ () => {},
214
+ )
41
215
  .version()
42
216
  .alias("v", "version")
43
217
  .example("$0", "Start CLI with default settings")
@@ -50,6 +224,8 @@ export async function main() {
50
224
  )
51
225
  .example("$0 --list-sessions", "List all available sessions")
52
226
  .help("h")
227
+ .recommendCommands()
228
+ .strict()
53
229
  .parseAsync();
54
230
 
55
231
  // Handle list sessions command
@@ -115,6 +291,7 @@ export async function main() {
115
291
  message: argv.print,
116
292
  showStats: argv.showStats,
117
293
  bypassPermissions: argv.dangerouslySkipPermissions,
294
+ pluginDirs: argv.pluginDir as string[],
118
295
  });
119
296
  }
120
297
 
@@ -122,6 +299,7 @@ export async function main() {
122
299
  restoreSessionId: argv.restore,
123
300
  continueLastSession: argv.continue,
124
301
  bypassPermissions: argv.dangerouslySkipPermissions,
302
+ pluginDirs: argv.pluginDir as string[],
125
303
  });
126
304
  }
127
305
 
@@ -1,6 +1,7 @@
1
1
  import { FileItem } from "../components/FileSelector.js";
2
2
  import {
3
3
  searchFiles as searchFilesUtil,
4
+ deleteBashCommandFromHistory,
4
5
  PermissionMode,
5
6
  Logger,
6
7
  } from "wave-agent-sdk";
@@ -511,6 +512,16 @@ export class InputManager {
511
512
  this.callbacks.onSendMessage?.(bashCommand);
512
513
  }
513
514
 
515
+ handleBashHistoryDelete(command: string, workdir?: string): void {
516
+ deleteBashCommandFromHistory(command, workdir);
517
+ // Trigger a refresh of the selector state to force re-render of BashHistorySelector
518
+ this.callbacks.onBashHistorySelectorStateChange?.(
519
+ this.showBashHistorySelector,
520
+ this.bashHistorySearchQuery,
521
+ this.exclamationPosition,
522
+ );
523
+ }
524
+
514
525
  checkForExclamationDeletion(cursorPosition: number): boolean {
515
526
  if (
516
527
  this.showBashHistorySelector &&
@@ -878,7 +889,7 @@ export class InputManager {
878
889
  }
879
890
 
880
891
  cyclePermissionMode(): void {
881
- const modes: PermissionMode[] = ["default", "acceptEdits"];
892
+ const modes: PermissionMode[] = ["default", "acceptEdits", "plan"];
882
893
  const currentIndex = modes.indexOf(this.permissionMode);
883
894
  const nextIndex =
884
895
  currentIndex === -1 ? 0 : (currentIndex + 1) % modes.length;
package/src/print-cli.ts CHANGED
@@ -7,6 +7,7 @@ export interface PrintCliOptions {
7
7
  message?: string;
8
8
  showStats?: boolean;
9
9
  bypassPermissions?: boolean;
10
+ pluginDirs?: string[];
10
11
  }
11
12
 
12
13
  function displayTimingInfo(startTime: Date, showStats: boolean): void {
@@ -31,6 +32,7 @@ export async function startPrintCli(options: PrintCliOptions): Promise<void> {
31
32
  message,
32
33
  showStats = false,
33
34
  bypassPermissions,
35
+ pluginDirs,
34
36
  } = options;
35
37
 
36
38
  if (
@@ -151,6 +153,7 @@ export async function startPrintCli(options: PrintCliOptions): Promise<void> {
151
153
  restoreSessionId,
152
154
  continueLastSession,
153
155
  permissionMode: bypassPermissions ? "bypassPermissions" : undefined,
156
+ plugins: pluginDirs?.map((path) => ({ type: "local", path })),
154
157
  // 保持流式模式以获得更好的命令行用户体验
155
158
  });
156
159