wave-code 0.2.0 → 0.4.0

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 (140) hide show
  1. package/dist/commands/plugin/disable.d.ts +2 -1
  2. package/dist/commands/plugin/disable.d.ts.map +1 -1
  3. package/dist/commands/plugin/disable.js +3 -2
  4. package/dist/commands/plugin/enable.d.ts +2 -1
  5. package/dist/commands/plugin/enable.d.ts.map +1 -1
  6. package/dist/commands/plugin/enable.js +3 -2
  7. package/dist/commands/plugin/install.d.ts +2 -1
  8. package/dist/commands/plugin/install.d.ts.map +1 -1
  9. package/dist/commands/plugin/list.d.ts.map +1 -1
  10. package/dist/commands/plugin/list.js +15 -3
  11. package/dist/commands/plugin/marketplace.d.ts +3 -0
  12. package/dist/commands/plugin/marketplace.d.ts.map +1 -1
  13. package/dist/commands/plugin/marketplace.js +15 -1
  14. package/dist/commands/plugin/uninstall.d.ts +4 -0
  15. package/dist/commands/plugin/uninstall.d.ts.map +1 -0
  16. package/dist/commands/plugin/uninstall.js +29 -0
  17. package/dist/commands/plugin/update.d.ts +4 -0
  18. package/dist/commands/plugin/update.d.ts.map +1 -0
  19. package/dist/commands/plugin/update.js +15 -0
  20. package/dist/components/ChatInterface.d.ts.map +1 -1
  21. package/dist/components/ChatInterface.js +2 -2
  22. package/dist/components/CommandSelector.d.ts.map +1 -1
  23. package/dist/components/CommandSelector.js +6 -0
  24. package/dist/components/Confirmation.js +1 -1
  25. package/dist/components/DiscoverView.d.ts +3 -0
  26. package/dist/components/DiscoverView.d.ts.map +1 -0
  27. package/dist/components/DiscoverView.js +25 -0
  28. package/dist/components/FileSelector.js +1 -1
  29. package/dist/components/HistorySearch.d.ts +8 -0
  30. package/dist/components/HistorySearch.d.ts.map +1 -0
  31. package/dist/components/HistorySearch.js +67 -0
  32. package/dist/components/InputBox.d.ts +1 -1
  33. package/dist/components/InputBox.d.ts.map +1 -1
  34. package/dist/components/InputBox.js +26 -17
  35. package/dist/components/InstalledView.d.ts +3 -0
  36. package/dist/components/InstalledView.d.ts.map +1 -0
  37. package/dist/components/InstalledView.js +30 -0
  38. package/dist/components/Markdown.d.ts.map +1 -1
  39. package/dist/components/Markdown.js +22 -9
  40. package/dist/components/MarketplaceAddForm.d.ts +3 -0
  41. package/dist/components/MarketplaceAddForm.d.ts.map +1 -0
  42. package/dist/components/MarketplaceAddForm.js +26 -0
  43. package/dist/components/MarketplaceDetail.d.ts +3 -0
  44. package/dist/components/MarketplaceDetail.d.ts.map +1 -0
  45. package/dist/components/MarketplaceDetail.js +38 -0
  46. package/dist/components/MarketplaceList.d.ts +9 -0
  47. package/dist/components/MarketplaceList.d.ts.map +1 -0
  48. package/dist/components/MarketplaceList.js +16 -0
  49. package/dist/components/MarketplaceView.d.ts +3 -0
  50. package/dist/components/MarketplaceView.d.ts.map +1 -0
  51. package/dist/components/MarketplaceView.js +28 -0
  52. package/dist/components/PluginDetail.d.ts +3 -0
  53. package/dist/components/PluginDetail.d.ts.map +1 -0
  54. package/dist/components/PluginDetail.js +63 -0
  55. package/dist/components/PluginList.d.ts +14 -0
  56. package/dist/components/PluginList.d.ts.map +1 -0
  57. package/dist/components/PluginList.js +12 -0
  58. package/dist/components/PluginManagerShell.d.ts +5 -0
  59. package/dist/components/PluginManagerShell.d.ts.map +1 -0
  60. package/dist/components/PluginManagerShell.js +89 -0
  61. package/dist/components/PluginManagerTypes.d.ts +33 -0
  62. package/dist/components/PluginManagerTypes.d.ts.map +1 -0
  63. package/dist/components/PluginManagerTypes.js +1 -0
  64. package/dist/components/RewindCommand.d.ts +9 -0
  65. package/dist/components/RewindCommand.d.ts.map +1 -0
  66. package/dist/components/RewindCommand.js +42 -0
  67. package/dist/components/SessionSelector.d.ts +11 -0
  68. package/dist/components/SessionSelector.d.ts.map +1 -0
  69. package/dist/components/SessionSelector.js +38 -0
  70. package/dist/components/SubagentBlock.d.ts.map +1 -1
  71. package/dist/components/SubagentBlock.js +20 -1
  72. package/dist/components/ToolResultDisplay.js +1 -1
  73. package/dist/contexts/PluginManagerContext.d.ts +4 -0
  74. package/dist/contexts/PluginManagerContext.d.ts.map +1 -0
  75. package/dist/contexts/PluginManagerContext.js +9 -0
  76. package/dist/contexts/useChat.d.ts +2 -0
  77. package/dist/contexts/useChat.d.ts.map +1 -1
  78. package/dist/contexts/useChat.js +21 -0
  79. package/dist/hooks/useInputManager.d.ts +6 -14
  80. package/dist/hooks/useInputManager.d.ts.map +1 -1
  81. package/dist/hooks/useInputManager.js +29 -45
  82. package/dist/hooks/usePluginManager.d.ts +3 -0
  83. package/dist/hooks/usePluginManager.d.ts.map +1 -0
  84. package/dist/hooks/usePluginManager.js +223 -0
  85. package/dist/index.d.ts.map +1 -1
  86. package/dist/index.js +150 -177
  87. package/dist/managers/InputManager.d.ts +12 -21
  88. package/dist/managers/InputManager.d.ts.map +1 -1
  89. package/dist/managers/InputManager.js +77 -108
  90. package/dist/plugin-manager-cli.d.ts +6 -0
  91. package/dist/plugin-manager-cli.d.ts.map +1 -0
  92. package/dist/plugin-manager-cli.js +12 -0
  93. package/dist/session-selector-cli.d.ts +2 -0
  94. package/dist/session-selector-cli.d.ts.map +1 -0
  95. package/dist/session-selector-cli.js +25 -0
  96. package/package.json +7 -3
  97. package/src/commands/plugin/disable.ts +7 -3
  98. package/src/commands/plugin/enable.ts +7 -3
  99. package/src/commands/plugin/install.ts +2 -1
  100. package/src/commands/plugin/list.ts +21 -3
  101. package/src/commands/plugin/marketplace.ts +17 -1
  102. package/src/commands/plugin/uninstall.ts +39 -0
  103. package/src/commands/plugin/update.ts +19 -0
  104. package/src/components/ChatInterface.tsx +2 -1
  105. package/src/components/CommandSelector.tsx +7 -0
  106. package/src/components/Confirmation.tsx +1 -1
  107. package/src/components/DiscoverView.tsx +31 -0
  108. package/src/components/FileSelector.tsx +1 -1
  109. package/src/components/HistorySearch.tsx +148 -0
  110. package/src/components/InputBox.tsx +43 -28
  111. package/src/components/InstalledView.tsx +61 -0
  112. package/src/components/Markdown.tsx +37 -26
  113. package/src/components/MarketplaceAddForm.tsx +39 -0
  114. package/src/components/MarketplaceDetail.tsx +79 -0
  115. package/src/components/MarketplaceList.tsx +52 -0
  116. package/src/components/MarketplaceView.tsx +43 -0
  117. package/src/components/PluginDetail.tsx +147 -0
  118. package/src/components/PluginList.tsx +51 -0
  119. package/src/components/PluginManagerShell.tsx +189 -0
  120. package/src/components/PluginManagerTypes.ts +47 -0
  121. package/src/components/RewindCommand.tsx +114 -0
  122. package/src/components/SessionSelector.tsx +127 -0
  123. package/src/components/SubagentBlock.tsx +29 -1
  124. package/src/components/ToolResultDisplay.tsx +2 -2
  125. package/src/contexts/PluginManagerContext.ts +15 -0
  126. package/src/contexts/useChat.tsx +26 -0
  127. package/src/hooks/useInputManager.ts +29 -61
  128. package/src/hooks/usePluginManager.ts +296 -0
  129. package/src/index.ts +241 -280
  130. package/src/managers/InputManager.ts +93 -149
  131. package/src/plugin-manager-cli.tsx +13 -0
  132. package/src/session-selector-cli.tsx +37 -0
  133. package/dist/components/BashHistorySelector.d.ts +0 -11
  134. package/dist/components/BashHistorySelector.d.ts.map +0 -1
  135. package/dist/components/BashHistorySelector.js +0 -93
  136. package/dist/hooks/usePagination.d.ts +0 -20
  137. package/dist/hooks/usePagination.d.ts.map +0 -1
  138. package/dist/hooks/usePagination.js +0 -168
  139. package/src/components/BashHistorySelector.tsx +0 -181
  140. package/src/hooks/usePagination.ts +0 -203
package/src/index.ts CHANGED
@@ -1,306 +1,267 @@
1
1
  import yargs from "yargs";
2
2
  import { hideBin } from "yargs/helpers";
3
3
  import { startCli } from "./cli.js";
4
- import {
5
- listSessions,
6
- getSessionFilePath,
7
- getFirstMessageContent,
8
- } from "wave-agent-sdk";
4
+ import { Scope } from "wave-agent-sdk";
9
5
 
10
6
  // Export main function for external use
11
7
  export async function main() {
12
- const argv = await yargs(hideBin(process.argv))
13
- .option("restore", {
14
- alias: "r",
15
- description: "Restore session by ID",
16
- type: "string",
17
- global: false,
18
- })
19
- .option("continue", {
20
- alias: "c",
21
- description: "Continue from last session",
22
- type: "boolean",
23
- global: false,
24
- })
25
- .option("print", {
26
- alias: "p",
27
- description: "Print response without interactive mode",
28
- type: "string",
29
- global: false,
30
- })
31
- .option("show-stats", {
32
- description: "Show timing and usage statistics in print mode",
33
- type: "boolean",
34
- global: false,
35
- })
36
- .option("list-sessions", {
37
- description: "List all available sessions",
38
- type: "boolean",
39
- global: false,
40
- })
41
- .option("dangerously-skip-permissions", {
42
- description: "Skip all permission checks (dangerous)",
43
- type: "boolean",
44
- default: false,
45
- global: false,
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
- });
8
+ try {
9
+ const argv = await yargs(hideBin(process.argv))
10
+ .option("restore", {
11
+ alias: "r",
12
+ description:
13
+ "Restore session by ID (or list sessions if no ID provided)",
14
+ type: "string",
15
+ global: false,
16
+ })
17
+ .option("continue", {
18
+ alias: "c",
19
+ description: "Continue from last session",
20
+ type: "boolean",
21
+ global: false,
22
+ })
23
+ .option("print", {
24
+ alias: "p",
25
+ description: "Print response without interactive mode",
26
+ type: "string",
27
+ global: false,
28
+ })
29
+ .option("show-stats", {
30
+ description: "Show timing and usage statistics in print mode",
31
+ type: "boolean",
32
+ global: false,
33
+ })
34
+ .option("dangerously-skip-permissions", {
35
+ description: "Skip all permission checks (dangerous)",
36
+ type: "boolean",
37
+ default: false,
38
+ global: false,
39
+ })
40
+ .option("plugin-dir", {
41
+ description: "Load a plugin from a specific directory",
42
+ type: "array",
43
+ string: true,
44
+ global: false,
45
+ })
46
+ .command(
47
+ "plugin",
48
+ "Manage plugins and marketplaces",
49
+ (yargs) => {
50
+ return yargs
51
+ .help()
52
+ .command(
53
+ "ui",
54
+ "Open interactive plugin manager UI",
55
+ {},
56
+ async () => {
57
+ const { startPluginManagerCli } = await import(
58
+ "./plugin-manager-cli.js"
59
+ );
60
+ const shouldExit = await startPluginManagerCli();
61
+ if (shouldExit) {
62
+ process.exit(0);
63
+ }
64
+ },
65
+ )
66
+ .command(
67
+ "marketplace",
68
+ "Manage plugin marketplaces",
69
+ (yargs) => {
70
+ return yargs
71
+ .help()
72
+ .command(
73
+ "add <input>",
74
+ "Add a plugin marketplace (local path, owner/repo, or Git URL)",
75
+ (yargs) => {
76
+ return yargs.positional("input", {
77
+ describe:
78
+ "Path to local marketplace, GitHub owner/repo, or full Git URL (with optional #ref)",
79
+ type: "string",
80
+ });
81
+ },
82
+ async (argv) => {
83
+ const { addMarketplaceCommand } = await import(
84
+ "./commands/plugin/marketplace.js"
85
+ );
86
+ await addMarketplaceCommand(argv as { input: string });
87
+ },
88
+ )
89
+ .command(
90
+ "update [name]",
91
+ "Update registered marketplace(s)",
92
+ (yargs) => {
93
+ return yargs.positional("name", {
94
+ describe: "Name of the marketplace to update",
95
+ type: "string",
96
+ });
97
+ },
98
+ async (argv) => {
99
+ const { updateMarketplaceCommand } = await import(
100
+ "./commands/plugin/marketplace.js"
101
+ );
102
+ await updateMarketplaceCommand(argv as { name?: string });
103
+ },
104
+ )
105
+ .command(
106
+ "list",
107
+ "List registered marketplaces",
108
+ {},
109
+ async () => {
110
+ const { listMarketplacesCommand } = await import(
111
+ "./commands/plugin/marketplace.js"
112
+ );
113
+ await listMarketplacesCommand();
114
+ },
115
+ )
116
+ .demandCommand(1, "Please specify a marketplace subcommand");
117
+ },
118
+ () => {},
119
+ )
120
+ .command(
121
+ "install <plugin>",
122
+ "Install a plugin from a marketplace",
123
+ (yargs) => {
124
+ return yargs
125
+ .positional("plugin", {
126
+ describe: "Plugin to install (format: name@marketplace)",
127
+ type: "string",
128
+ })
129
+ .option("scope", {
130
+ alias: "s",
131
+ describe: "Scope to enable the plugin in",
132
+ choices: ["user", "project", "local"],
133
+ type: "string",
134
+ });
135
+ },
136
+ async (argv) => {
137
+ const { installPluginCommand } = await import(
138
+ "./commands/plugin/install.js"
139
+ );
140
+ await installPluginCommand(
141
+ argv as {
142
+ plugin: string;
143
+ scope?: Scope;
74
144
  },
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",
145
+ );
146
+ },
147
+ )
148
+ .command(
149
+ "list",
150
+ "List all available plugins from marketplaces",
151
+ {},
152
+ async () => {
153
+ const { listPluginsCommand } = await import(
154
+ "./commands/plugin/list.js"
155
+ );
156
+ await listPluginsCommand();
157
+ },
158
+ )
159
+ .command(
160
+ "uninstall <plugin>",
161
+ "Uninstall a plugin",
162
+ (yargs) => {
163
+ return yargs.positional("plugin", {
164
+ describe: "Plugin to uninstall (format: name@marketplace)",
127
165
  type: "string",
128
166
  });
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
+ },
168
+ async (argv) => {
169
+ const { uninstallPluginCommand } = await import(
170
+ "./commands/plugin/uninstall.js"
171
+ );
172
+ await uninstallPluginCommand(argv as { plugin: string });
173
+ },
174
+ )
175
+ .command(
176
+ "update <plugin>",
177
+ "Update a plugin (uninstall followed by install)",
178
+ (yargs) => {
179
+ return yargs.positional("plugin", {
180
+ describe: "Plugin to update (format: name@marketplace)",
167
181
  type: "string",
168
182
  });
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
- )
215
- .version()
216
- .alias("v", "version")
217
- .example("$0", "Start CLI with default settings")
218
- .example("$0 --restore session_123", "Restore specific session")
219
- .example("$0 --continue", "Continue from last session")
220
- .example("$0 --print 'Hello'", "Send message in print mode")
221
- .example(
222
- "$0 -p 'Hello' --show-stats",
223
- "Send message in print mode with statistics",
224
- )
225
- .example("$0 --list-sessions", "List all available sessions")
226
- .help("h")
227
- .recommendCommands()
228
- .strict()
229
- .parseAsync();
230
-
231
- // Handle list sessions command
232
- if (argv.listSessions) {
233
- try {
234
- const currentWorkdir = process.cwd();
235
- const sessions = await listSessions(currentWorkdir);
183
+ },
184
+ async (argv) => {
185
+ const { updatePluginCommand } = await import(
186
+ "./commands/plugin/update.js"
187
+ );
188
+ await updatePluginCommand(argv as { plugin: string });
189
+ },
190
+ );
191
+ },
192
+ async (argv) => {
193
+ // If no subcommand is provided, launch the UI
194
+ if (argv._.length === 1 && argv._[0] === "plugin") {
195
+ const { startPluginManagerCli } = await import(
196
+ "./plugin-manager-cli.js"
197
+ );
198
+ const shouldExit = await startPluginManagerCli();
199
+ if (shouldExit) {
200
+ process.exit(0);
201
+ }
202
+ }
203
+ },
204
+ )
205
+ .version()
206
+ .alias("v", "version")
207
+ .example("$0", "Start CLI with default settings")
208
+ .example("$0 --restore session_123", "Restore specific session")
209
+ .example("$0 --continue", "Continue from last session")
210
+ .example("$0 --print 'Hello'", "Send message in print mode")
211
+ .example(
212
+ "$0 -p 'Hello' --show-stats",
213
+ "Send message in print mode with statistics",
214
+ )
215
+ .help("h")
216
+ .recommendCommands()
217
+ .strict()
218
+ .parseAsync();
236
219
 
237
- if (sessions.length === 0) {
238
- console.log(`No sessions found for workdir: ${currentWorkdir}`);
220
+ // Handle restore session command
221
+ if (
222
+ argv.restore === "" ||
223
+ (process.argv.includes("-r") && argv.restore === undefined) ||
224
+ (process.argv.includes("--restore") && argv.restore === undefined)
225
+ ) {
226
+ // Interactive session selection
227
+ const { startSessionSelectorCli } = await import(
228
+ "./session-selector-cli.js"
229
+ );
230
+ const selectedSessionId = await startSessionSelectorCli();
231
+ if (!selectedSessionId) {
239
232
  return;
240
233
  }
234
+ // Continue with the selected session
235
+ return startCli({
236
+ restoreSessionId: selectedSessionId,
237
+ bypassPermissions: argv.dangerouslySkipPermissions,
238
+ pluginDirs: argv.pluginDir as string[],
239
+ });
240
+ }
241
241
 
242
- console.log(`Available sessions for: ${currentWorkdir}`);
243
- console.log("==========================================");
244
-
245
- // Get last 5 sessions
246
- const lastSessions = sessions.slice(0, 5);
247
-
248
- for (const session of lastSessions) {
249
- const lastActiveAt = new Date(session.lastActiveAt).toLocaleString();
250
- const filePath = await getSessionFilePath(session.id, session.workdir);
251
-
252
- // Get first message content
253
- const firstMessageContent = await getFirstMessageContent(
254
- session.id,
255
- session.workdir,
256
- );
257
-
258
- // Truncate content if too long
259
- let truncatedContent =
260
- firstMessageContent || "No first message content";
261
- if (truncatedContent.length > 30) {
262
- truncatedContent = truncatedContent.substring(0, 30) + "...";
263
- }
264
-
265
- console.log(`ID: ${session.id}`);
266
- console.log(` Workdir: ${session.workdir}`);
267
- console.log(` File Path: ${filePath}`);
268
- console.log(` Last Active: ${lastActiveAt}`);
269
- console.log(` Last Message Tokens: ${session.latestTotalTokens}`);
270
- console.log(` First Message: ${truncatedContent}`);
271
- console.log("");
272
- }
273
-
274
- if (sessions.length > 5) {
275
- console.log(`... and ${sessions.length - 5} more sessions`);
276
- }
277
-
278
- return;
279
- } catch (error) {
280
- console.error("Failed to list sessions:", error);
281
- process.exit(1);
242
+ // Handle print mode directly
243
+ if (argv.print !== undefined) {
244
+ const { startPrintCli } = await import("./print-cli.js");
245
+ return startPrintCli({
246
+ restoreSessionId: argv.restore,
247
+ continueLastSession: argv.continue,
248
+ message: argv.print,
249
+ showStats: argv.showStats,
250
+ bypassPermissions: argv.dangerouslySkipPermissions,
251
+ pluginDirs: argv.pluginDir as string[],
252
+ });
282
253
  }
283
- }
284
254
 
285
- // Handle print mode directly
286
- if (argv.print !== undefined) {
287
- const { startPrintCli } = await import("./print-cli.js");
288
- return startPrintCli({
255
+ await startCli({
289
256
  restoreSessionId: argv.restore,
290
257
  continueLastSession: argv.continue,
291
- message: argv.print,
292
- showStats: argv.showStats,
293
258
  bypassPermissions: argv.dangerouslySkipPermissions,
294
259
  pluginDirs: argv.pluginDir as string[],
295
260
  });
261
+ } catch (error) {
262
+ console.error("Failed to start WAVE Code:", error);
263
+ process.exit(1);
296
264
  }
297
-
298
- await startCli({
299
- restoreSessionId: argv.restore,
300
- continueLastSession: argv.continue,
301
- bypassPermissions: argv.dangerouslySkipPermissions,
302
- pluginDirs: argv.pluginDir as string[],
303
- });
304
265
  }
305
266
 
306
267
  // Export CLI function