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.
- package/dist/commands/plugin/disable.d.ts +2 -1
- package/dist/commands/plugin/disable.d.ts.map +1 -1
- package/dist/commands/plugin/disable.js +3 -2
- package/dist/commands/plugin/enable.d.ts +2 -1
- package/dist/commands/plugin/enable.d.ts.map +1 -1
- package/dist/commands/plugin/enable.js +3 -2
- package/dist/commands/plugin/install.d.ts +2 -1
- package/dist/commands/plugin/install.d.ts.map +1 -1
- package/dist/commands/plugin/list.d.ts.map +1 -1
- package/dist/commands/plugin/list.js +15 -3
- package/dist/commands/plugin/marketplace.d.ts +3 -0
- package/dist/commands/plugin/marketplace.d.ts.map +1 -1
- package/dist/commands/plugin/marketplace.js +15 -1
- package/dist/commands/plugin/uninstall.d.ts +4 -0
- package/dist/commands/plugin/uninstall.d.ts.map +1 -0
- package/dist/commands/plugin/uninstall.js +29 -0
- package/dist/commands/plugin/update.d.ts +4 -0
- package/dist/commands/plugin/update.d.ts.map +1 -0
- package/dist/commands/plugin/update.js +15 -0
- package/dist/components/ChatInterface.d.ts.map +1 -1
- package/dist/components/ChatInterface.js +2 -2
- package/dist/components/CommandSelector.d.ts.map +1 -1
- package/dist/components/CommandSelector.js +6 -0
- package/dist/components/Confirmation.js +1 -1
- package/dist/components/DiscoverView.d.ts +3 -0
- package/dist/components/DiscoverView.d.ts.map +1 -0
- package/dist/components/DiscoverView.js +25 -0
- package/dist/components/FileSelector.js +1 -1
- package/dist/components/HistorySearch.d.ts +8 -0
- package/dist/components/HistorySearch.d.ts.map +1 -0
- package/dist/components/HistorySearch.js +67 -0
- package/dist/components/InputBox.d.ts +1 -1
- package/dist/components/InputBox.d.ts.map +1 -1
- package/dist/components/InputBox.js +26 -17
- package/dist/components/InstalledView.d.ts +3 -0
- package/dist/components/InstalledView.d.ts.map +1 -0
- package/dist/components/InstalledView.js +30 -0
- package/dist/components/Markdown.d.ts.map +1 -1
- package/dist/components/Markdown.js +22 -9
- package/dist/components/MarketplaceAddForm.d.ts +3 -0
- package/dist/components/MarketplaceAddForm.d.ts.map +1 -0
- package/dist/components/MarketplaceAddForm.js +26 -0
- package/dist/components/MarketplaceDetail.d.ts +3 -0
- package/dist/components/MarketplaceDetail.d.ts.map +1 -0
- package/dist/components/MarketplaceDetail.js +38 -0
- package/dist/components/MarketplaceList.d.ts +9 -0
- package/dist/components/MarketplaceList.d.ts.map +1 -0
- package/dist/components/MarketplaceList.js +16 -0
- package/dist/components/MarketplaceView.d.ts +3 -0
- package/dist/components/MarketplaceView.d.ts.map +1 -0
- package/dist/components/MarketplaceView.js +28 -0
- package/dist/components/PluginDetail.d.ts +3 -0
- package/dist/components/PluginDetail.d.ts.map +1 -0
- package/dist/components/PluginDetail.js +63 -0
- package/dist/components/PluginList.d.ts +14 -0
- package/dist/components/PluginList.d.ts.map +1 -0
- package/dist/components/PluginList.js +12 -0
- package/dist/components/PluginManagerShell.d.ts +5 -0
- package/dist/components/PluginManagerShell.d.ts.map +1 -0
- package/dist/components/PluginManagerShell.js +89 -0
- package/dist/components/PluginManagerTypes.d.ts +33 -0
- package/dist/components/PluginManagerTypes.d.ts.map +1 -0
- package/dist/components/PluginManagerTypes.js +1 -0
- package/dist/components/RewindCommand.d.ts +9 -0
- package/dist/components/RewindCommand.d.ts.map +1 -0
- package/dist/components/RewindCommand.js +42 -0
- package/dist/components/SessionSelector.d.ts +11 -0
- package/dist/components/SessionSelector.d.ts.map +1 -0
- package/dist/components/SessionSelector.js +38 -0
- package/dist/components/SubagentBlock.d.ts.map +1 -1
- package/dist/components/SubagentBlock.js +20 -1
- package/dist/components/ToolResultDisplay.js +1 -1
- package/dist/contexts/PluginManagerContext.d.ts +4 -0
- package/dist/contexts/PluginManagerContext.d.ts.map +1 -0
- package/dist/contexts/PluginManagerContext.js +9 -0
- package/dist/contexts/useChat.d.ts +2 -0
- package/dist/contexts/useChat.d.ts.map +1 -1
- package/dist/contexts/useChat.js +21 -0
- package/dist/hooks/useInputManager.d.ts +6 -14
- package/dist/hooks/useInputManager.d.ts.map +1 -1
- package/dist/hooks/useInputManager.js +29 -45
- package/dist/hooks/usePluginManager.d.ts +3 -0
- package/dist/hooks/usePluginManager.d.ts.map +1 -0
- package/dist/hooks/usePluginManager.js +223 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +150 -177
- package/dist/managers/InputManager.d.ts +12 -21
- package/dist/managers/InputManager.d.ts.map +1 -1
- package/dist/managers/InputManager.js +77 -108
- package/dist/plugin-manager-cli.d.ts +6 -0
- package/dist/plugin-manager-cli.d.ts.map +1 -0
- package/dist/plugin-manager-cli.js +12 -0
- package/dist/session-selector-cli.d.ts +2 -0
- package/dist/session-selector-cli.d.ts.map +1 -0
- package/dist/session-selector-cli.js +25 -0
- package/package.json +7 -3
- package/src/commands/plugin/disable.ts +7 -3
- package/src/commands/plugin/enable.ts +7 -3
- package/src/commands/plugin/install.ts +2 -1
- package/src/commands/plugin/list.ts +21 -3
- package/src/commands/plugin/marketplace.ts +17 -1
- package/src/commands/plugin/uninstall.ts +39 -0
- package/src/commands/plugin/update.ts +19 -0
- package/src/components/ChatInterface.tsx +2 -1
- package/src/components/CommandSelector.tsx +7 -0
- package/src/components/Confirmation.tsx +1 -1
- package/src/components/DiscoverView.tsx +31 -0
- package/src/components/FileSelector.tsx +1 -1
- package/src/components/HistorySearch.tsx +148 -0
- package/src/components/InputBox.tsx +43 -28
- package/src/components/InstalledView.tsx +61 -0
- package/src/components/Markdown.tsx +37 -26
- package/src/components/MarketplaceAddForm.tsx +39 -0
- package/src/components/MarketplaceDetail.tsx +79 -0
- package/src/components/MarketplaceList.tsx +52 -0
- package/src/components/MarketplaceView.tsx +43 -0
- package/src/components/PluginDetail.tsx +147 -0
- package/src/components/PluginList.tsx +51 -0
- package/src/components/PluginManagerShell.tsx +189 -0
- package/src/components/PluginManagerTypes.ts +47 -0
- package/src/components/RewindCommand.tsx +114 -0
- package/src/components/SessionSelector.tsx +127 -0
- package/src/components/SubagentBlock.tsx +29 -1
- package/src/components/ToolResultDisplay.tsx +2 -2
- package/src/contexts/PluginManagerContext.ts +15 -0
- package/src/contexts/useChat.tsx +26 -0
- package/src/hooks/useInputManager.ts +29 -61
- package/src/hooks/usePluginManager.ts +296 -0
- package/src/index.ts +241 -280
- package/src/managers/InputManager.ts +93 -149
- package/src/plugin-manager-cli.tsx +13 -0
- package/src/session-selector-cli.tsx +37 -0
- package/dist/components/BashHistorySelector.d.ts +0 -11
- package/dist/components/BashHistorySelector.d.ts.map +0 -1
- package/dist/components/BashHistorySelector.js +0 -93
- package/dist/hooks/usePagination.d.ts +0 -20
- package/dist/hooks/usePagination.d.ts.map +0 -1
- package/dist/hooks/usePagination.js +0 -168
- package/src/components/BashHistorySelector.tsx +0 -181
- 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
|
-
|
|
13
|
-
.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
"
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
)
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
(
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
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
|
-
|
|
238
|
-
|
|
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
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
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
|
-
|
|
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
|