wave-code 0.6.4 → 0.7.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 (61) 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.map +1 -1
  5. package/dist/commands/plugin/disable.js +3 -10
  6. package/dist/commands/plugin/enable.d.ts.map +1 -1
  7. package/dist/commands/plugin/enable.js +3 -10
  8. package/dist/commands/plugin/install.d.ts.map +1 -1
  9. package/dist/commands/plugin/install.js +4 -11
  10. package/dist/commands/plugin/list.d.ts.map +1 -1
  11. package/dist/commands/plugin/list.js +5 -39
  12. package/dist/commands/plugin/marketplace.js +9 -9
  13. package/dist/commands/plugin/uninstall.d.ts.map +1 -1
  14. package/dist/commands/plugin/uninstall.js +4 -17
  15. package/dist/commands/plugin/update.js +3 -3
  16. package/dist/components/App.d.ts +1 -0
  17. package/dist/components/App.d.ts.map +1 -1
  18. package/dist/components/App.js +4 -4
  19. package/dist/components/BackgroundTaskManager.d.ts.map +1 -1
  20. package/dist/components/BackgroundTaskManager.js +14 -6
  21. package/dist/components/ConfirmationDetails.d.ts.map +1 -1
  22. package/dist/components/ConfirmationDetails.js +1 -5
  23. package/dist/components/DiffDisplay.d.ts.map +1 -1
  24. package/dist/components/DiffDisplay.js +2 -7
  25. package/dist/components/MessageItem.d.ts.map +1 -1
  26. package/dist/components/MessageItem.js +1 -1
  27. package/dist/components/MessageList.d.ts.map +1 -1
  28. package/dist/components/MessageList.js +2 -18
  29. package/dist/contexts/useChat.d.ts +1 -0
  30. package/dist/contexts/useChat.d.ts.map +1 -1
  31. package/dist/contexts/useChat.js +3 -1
  32. package/dist/hooks/usePluginManager.d.ts.map +1 -1
  33. package/dist/hooks/usePluginManager.js +20 -39
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +16 -0
  36. package/dist/print-cli.d.ts +1 -0
  37. package/dist/print-cli.d.ts.map +1 -1
  38. package/dist/print-cli.js +2 -1
  39. package/dist/utils/toolParameterTransforms.d.ts +1 -5
  40. package/dist/utils/toolParameterTransforms.d.ts.map +1 -1
  41. package/dist/utils/toolParameterTransforms.js +0 -11
  42. package/package.json +2 -2
  43. package/src/cli.tsx +3 -0
  44. package/src/commands/plugin/disable.ts +3 -17
  45. package/src/commands/plugin/enable.ts +3 -17
  46. package/src/commands/plugin/install.ts +4 -18
  47. package/src/commands/plugin/list.ts +5 -55
  48. package/src/commands/plugin/marketplace.ts +9 -9
  49. package/src/commands/plugin/uninstall.ts +4 -26
  50. package/src/commands/plugin/update.ts +3 -3
  51. package/src/components/App.tsx +10 -2
  52. package/src/components/BackgroundTaskManager.tsx +49 -32
  53. package/src/components/ConfirmationDetails.tsx +0 -6
  54. package/src/components/DiffDisplay.tsx +2 -16
  55. package/src/components/MessageItem.tsx +2 -6
  56. package/src/components/MessageList.tsx +2 -30
  57. package/src/contexts/useChat.tsx +4 -0
  58. package/src/hooks/usePluginManager.ts +21 -57
  59. package/src/index.ts +17 -0
  60. package/src/print-cli.ts +3 -0
  61. package/src/utils/toolParameterTransforms.ts +0 -18
@@ -1,5 +1,5 @@
1
1
  import { useState, useCallback, useEffect, useMemo } from "react";
2
- import { MarketplaceService, PluginScopeManager, ConfigurationService, PluginManager, } from "wave-agent-sdk";
2
+ import { PluginCore, } from "wave-agent-sdk";
3
3
  export function usePluginManager() {
4
4
  const [state, setState] = useState({
5
5
  currentView: "DISCOVER",
@@ -11,17 +11,7 @@ export function usePluginManager() {
11
11
  const [marketplaces, setMarketplaces] = useState([]);
12
12
  const [installedPlugins, setInstalledPlugins] = useState([]);
13
13
  const [discoverablePlugins, setDiscoverablePlugins] = useState([]);
14
- const marketplaceService = useMemo(() => new MarketplaceService(), []);
15
- const configurationService = useMemo(() => new ConfigurationService(), []);
16
- const pluginManager = useMemo(() => new PluginManager({
17
- workdir: process.cwd(),
18
- configurationService,
19
- }), [configurationService]);
20
- const pluginScopeManager = useMemo(() => new PluginScopeManager({
21
- workdir: process.cwd(),
22
- configurationService,
23
- pluginManager,
24
- }), [configurationService, pluginManager]);
14
+ const pluginCore = useMemo(() => new PluginCore(), []);
25
15
  const refresh = useCallback(async () => {
26
16
  setState((prev) => ({
27
17
  ...prev,
@@ -30,9 +20,9 @@ export function usePluginManager() {
30
20
  }));
31
21
  try {
32
22
  const [mks, installed, enabledMap] = await Promise.all([
33
- marketplaceService.listMarketplaces(),
34
- marketplaceService.getInstalledPlugins(),
35
- Promise.resolve(pluginScopeManager.getMergedEnabledPlugins()),
23
+ pluginCore.listMarketplaces(),
24
+ pluginCore.getInstalledPlugins(),
25
+ Promise.resolve(pluginCore.getMergedEnabledPlugins()),
36
26
  ]);
37
27
  setMarketplaces(mks);
38
28
  const allInstalledWithEnabled = installed.plugins.map((p) => {
@@ -40,7 +30,7 @@ export function usePluginManager() {
40
30
  return {
41
31
  ...p,
42
32
  enabled: !!enabledMap[pluginId],
43
- scope: pluginScopeManager.findPluginScope(pluginId) || undefined,
33
+ scope: pluginCore.findPluginScope(pluginId) || undefined,
44
34
  };
45
35
  });
46
36
  // Only show enabled plugins in the "Installed" view
@@ -48,7 +38,7 @@ export function usePluginManager() {
48
38
  const allDiscoverable = [];
49
39
  for (const mk of mks) {
50
40
  try {
51
- const manifest = await marketplaceService.loadMarketplaceManifest(marketplaceService.getMarketplacePath(mk));
41
+ const manifest = await pluginCore.loadMarketplaceManifest(pluginCore.getMarketplacePath(mk));
52
42
  manifest.plugins.forEach((p) => {
53
43
  const pluginId = `${p.name}@${mk.name}`;
54
44
  const isInstalled = installed.plugins.find((ip) => ip.name === p.name && ip.marketplace === mk.name);
@@ -77,7 +67,7 @@ export function usePluginManager() {
77
67
  error: error instanceof Error ? error.message : String(error),
78
68
  }));
79
69
  }
80
- }, [marketplaceService, pluginScopeManager]);
70
+ }, [pluginCore]);
81
71
  useEffect(() => {
82
72
  refresh();
83
73
  }, [refresh]);
@@ -94,7 +84,7 @@ export function usePluginManager() {
94
84
  error: null,
95
85
  }));
96
86
  try {
97
- await marketplaceService.addMarketplace(source);
87
+ await pluginCore.addMarketplace(source);
98
88
  await refresh();
99
89
  }
100
90
  catch (error) {
@@ -104,7 +94,7 @@ export function usePluginManager() {
104
94
  error: error instanceof Error ? error.message : String(error),
105
95
  }));
106
96
  }
107
- }, [marketplaceService, refresh]);
97
+ }, [pluginCore, refresh]);
108
98
  const removeMarketplace = useCallback(async (name) => {
109
99
  setState((prev) => ({
110
100
  ...prev,
@@ -112,7 +102,7 @@ export function usePluginManager() {
112
102
  error: null,
113
103
  }));
114
104
  try {
115
- await marketplaceService.removeMarketplace(name);
105
+ await pluginCore.removeMarketplace(name);
116
106
  await refresh();
117
107
  }
118
108
  catch (error) {
@@ -122,7 +112,7 @@ export function usePluginManager() {
122
112
  error: error instanceof Error ? error.message : String(error),
123
113
  }));
124
114
  }
125
- }, [marketplaceService, refresh]);
115
+ }, [pluginCore, refresh]);
126
116
  const updateMarketplace = useCallback(async (name) => {
127
117
  setState((prev) => ({
128
118
  ...prev,
@@ -130,7 +120,7 @@ export function usePluginManager() {
130
120
  error: null,
131
121
  }));
132
122
  try {
133
- await marketplaceService.updateMarketplace(name);
123
+ await pluginCore.updateMarketplace(name);
134
124
  await refresh();
135
125
  }
136
126
  catch (error) {
@@ -140,7 +130,7 @@ export function usePluginManager() {
140
130
  error: error instanceof Error ? error.message : String(error),
141
131
  }));
142
132
  }
143
- }, [marketplaceService, refresh]);
133
+ }, [pluginCore, refresh]);
144
134
  const installPlugin = useCallback(async (name, marketplace, scope = "project") => {
145
135
  setState((prev) => ({
146
136
  ...prev,
@@ -149,9 +139,7 @@ export function usePluginManager() {
149
139
  }));
150
140
  try {
151
141
  const pluginId = `${name}@${marketplace}`;
152
- const workdir = process.cwd();
153
- await marketplaceService.installPlugin(pluginId, workdir);
154
- await pluginScopeManager.enablePlugin(scope, pluginId);
142
+ await pluginCore.installPlugin(pluginId, scope);
155
143
  await refresh();
156
144
  }
157
145
  catch (error) {
@@ -161,7 +149,7 @@ export function usePluginManager() {
161
149
  error: error instanceof Error ? error.message : String(error),
162
150
  }));
163
151
  }
164
- }, [marketplaceService, pluginScopeManager, refresh]);
152
+ }, [pluginCore, refresh]);
165
153
  const uninstallPlugin = useCallback(async (name, marketplace) => {
166
154
  setState((prev) => ({
167
155
  ...prev,
@@ -170,14 +158,7 @@ export function usePluginManager() {
170
158
  }));
171
159
  try {
172
160
  const pluginId = `${name}@${marketplace}`;
173
- const workdir = process.cwd();
174
- // 1. Remove from global registry and potentially clean up cache
175
- await marketplaceService.uninstallPlugin(pluginId, workdir);
176
- // 2. Find the scope where it's currently enabled and remove it from there
177
- const scope = pluginScopeManager.findPluginScope(pluginId);
178
- if (scope) {
179
- await configurationService.removeEnabledPlugin(workdir, scope, pluginId);
180
- }
161
+ await pluginCore.uninstallPlugin(pluginId);
181
162
  await refresh();
182
163
  }
183
164
  catch (error) {
@@ -187,7 +168,7 @@ export function usePluginManager() {
187
168
  error: error instanceof Error ? error.message : String(error),
188
169
  }));
189
170
  }
190
- }, [configurationService, marketplaceService, pluginScopeManager, refresh]);
171
+ }, [pluginCore, refresh]);
191
172
  const updatePlugin = useCallback(async (name, marketplace) => {
192
173
  setState((prev) => ({
193
174
  ...prev,
@@ -196,7 +177,7 @@ export function usePluginManager() {
196
177
  }));
197
178
  try {
198
179
  const pluginId = `${name}@${marketplace}`;
199
- await marketplaceService.updatePlugin(pluginId);
180
+ await pluginCore.updatePlugin(pluginId);
200
181
  await refresh();
201
182
  }
202
183
  catch (error) {
@@ -206,7 +187,7 @@ export function usePluginManager() {
206
187
  error: error instanceof Error ? error.message : String(error),
207
188
  }));
208
189
  }
209
- }, [marketplaceService, refresh]);
190
+ }, [pluginCore, refresh]);
210
191
  return {
211
192
  state,
212
193
  marketplaces,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,wBAAsB,IAAI,kBAkQzB;AAGD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGpC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,oBAAoB,GAC1B,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,wBAAsB,IAAI,kBAmRzB;AAGD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGpC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,oBAAoB,GAC1B,MAAM,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -39,6 +39,11 @@ export async function main() {
39
39
  type: "array",
40
40
  string: true,
41
41
  global: false,
42
+ })
43
+ .option("tools", {
44
+ description: 'Specify a comma-separated list of tools to enable (e.g., \'Bash,Read,Write\'). Use "" to disable all, "default" for all.',
45
+ type: "string",
46
+ global: false,
42
47
  })
43
48
  .command("plugin", "Manage plugins and marketplaces", (yargs) => {
44
49
  return yargs
@@ -136,6 +141,14 @@ export async function main() {
136
141
  .recommendCommands()
137
142
  .strict()
138
143
  .parseAsync();
144
+ const parseTools = (tools) => {
145
+ if (tools === undefined || tools === "default")
146
+ return undefined;
147
+ if (tools === "")
148
+ return [];
149
+ return tools.split(",").map((t) => t.trim());
150
+ };
151
+ const tools = parseTools(argv.tools);
139
152
  // Handle restore session command
140
153
  if (argv.restore === "" ||
141
154
  (process.argv.includes("-r") && argv.restore === undefined) ||
@@ -151,6 +164,7 @@ export async function main() {
151
164
  restoreSessionId: selectedSessionId,
152
165
  bypassPermissions: argv.dangerouslySkipPermissions,
153
166
  pluginDirs: argv.pluginDir,
167
+ tools,
154
168
  });
155
169
  }
156
170
  // Handle print mode directly
@@ -163,6 +177,7 @@ export async function main() {
163
177
  showStats: argv.showStats,
164
178
  bypassPermissions: argv.dangerouslySkipPermissions,
165
179
  pluginDirs: argv.pluginDir,
180
+ tools,
166
181
  });
167
182
  }
168
183
  await startCli({
@@ -170,6 +185,7 @@ export async function main() {
170
185
  continueLastSession: argv.continue,
171
186
  bypassPermissions: argv.dangerouslySkipPermissions,
172
187
  pluginDirs: argv.pluginDir,
188
+ tools,
173
189
  });
174
190
  }
175
191
  catch (error) {
@@ -5,6 +5,7 @@ export interface PrintCliOptions {
5
5
  showStats?: boolean;
6
6
  bypassPermissions?: boolean;
7
7
  pluginDirs?: string[];
8
+ tools?: string[];
8
9
  }
9
10
  export declare function startPrintCli(options: PrintCliOptions): Promise<void>;
10
11
  //# sourceMappingURL=print-cli.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"print-cli.d.ts","sourceRoot":"","sources":["../src/print-cli.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAgBD,wBAAsB,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA8J3E"}
1
+ {"version":3,"file":"print-cli.d.ts","sourceRoot":"","sources":["../src/print-cli.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAgBD,wBAAsB,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAgK3E"}
package/dist/print-cli.js CHANGED
@@ -13,7 +13,7 @@ function displayTimingInfo(startTime, showStats) {
13
13
  }
14
14
  export async function startPrintCli(options) {
15
15
  const startTime = new Date();
16
- const { restoreSessionId, continueLastSession, message, showStats = false, bypassPermissions, pluginDirs, } = options;
16
+ const { restoreSessionId, continueLastSession, message, showStats = false, bypassPermissions, pluginDirs, tools, } = options;
17
17
  if ((!message || message.trim() === "") &&
18
18
  !continueLastSession &&
19
19
  !restoreSessionId) {
@@ -97,6 +97,7 @@ export async function startPrintCli(options) {
97
97
  continueLastSession,
98
98
  permissionMode: bypassPermissions ? "bypassPermissions" : undefined,
99
99
  plugins: pluginDirs?.map((path) => ({ type: "local", path })),
100
+ tools,
100
101
  // 保持流式模式以获得更好的命令行用户体验
101
102
  });
102
103
  // Send message if provided and not empty
@@ -2,7 +2,7 @@
2
2
  * Tool parameter transformation utilities for UI rendering
3
3
  * Forces type judgment based on tool name using type assertions
4
4
  */
5
- import { type Change, type WriteToolParameters, type EditToolParameters, type MultiEditToolParameters } from "wave-agent-sdk";
5
+ import { type Change, type WriteToolParameters, type EditToolParameters } from "wave-agent-sdk";
6
6
  /**
7
7
  * Transform Write tool parameters to changes
8
8
  */
@@ -11,10 +11,6 @@ export declare function transformWriteParameters(parameters: WriteToolParameters
11
11
  * Transform Edit tool parameters to changes
12
12
  */
13
13
  export declare function transformEditParameters(parameters: EditToolParameters): Change[];
14
- /**
15
- * Transform MultiEdit tool parameters to changes
16
- */
17
- export declare function transformMultiEditParameters(parameters: MultiEditToolParameters): Change[];
18
14
  /**
19
15
  * Transform tool block parameters into standardized Change[] array for diff display
20
16
  * Forces type judgment based on tool name using type assertions
@@ -1 +1 @@
1
- {"version":3,"file":"toolParameterTransforms.d.ts","sourceRoot":"","sources":["../../src/utils/toolParameterTransforms.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,KAAK,MAAM,EACX,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC7B,MAAM,gBAAgB,CAAC;AAmBxB;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,mBAAmB,GAC9B,MAAM,EAAE,CAOV;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,kBAAkB,GAC7B,MAAM,EAAE,CAOV;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,UAAU,EAAE,uBAAuB,GAClC,MAAM,EAAE,CAKV;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,MAAM,EAAE,CA2BV"}
1
+ {"version":3,"file":"toolParameterTransforms.d.ts","sourceRoot":"","sources":["../../src/utils/toolParameterTransforms.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,KAAK,MAAM,EACX,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAmBxB;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,mBAAmB,GAC9B,MAAM,EAAE,CAOV;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,kBAAkB,GAC7B,MAAM,EAAE,CAOV;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,MAAM,EAAE,CAsBV"}
@@ -40,15 +40,6 @@ export function transformEditParameters(parameters) {
40
40
  },
41
41
  ];
42
42
  }
43
- /**
44
- * Transform MultiEdit tool parameters to changes
45
- */
46
- export function transformMultiEditParameters(parameters) {
47
- return parameters.edits.map((edit) => ({
48
- oldContent: edit.old_string,
49
- newContent: edit.new_string,
50
- }));
51
- }
52
43
  /**
53
44
  * Transform tool block parameters into standardized Change[] array for diff display
54
45
  * Forces type judgment based on tool name using type assertions
@@ -64,8 +55,6 @@ export function transformToolBlockToChanges(toolName, parameters) {
64
55
  return transformWriteParameters(parsedParams);
65
56
  case "Edit":
66
57
  return transformEditParameters(parsedParams);
67
- case "MultiEdit":
68
- return transformMultiEditParameters(parsedParams);
69
58
  default:
70
59
  return [];
71
60
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wave-code",
3
- "version": "0.6.4",
3
+ "version": "0.7.0",
4
4
  "description": "CLI-based code assistant powered by AI, built with React and Ink",
5
5
  "repository": {
6
6
  "type": "git",
@@ -37,7 +37,7 @@
37
37
  "react": "^19.2.4",
38
38
  "react-dom": "19.2.4",
39
39
  "yargs": "^17.7.2",
40
- "wave-agent-sdk": "0.6.4"
40
+ "wave-agent-sdk": "0.7.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/react": "^19.1.8",
package/src/cli.tsx CHANGED
@@ -8,6 +8,7 @@ export interface CliOptions {
8
8
  continueLastSession?: boolean;
9
9
  bypassPermissions?: boolean;
10
10
  pluginDirs?: string[];
11
+ tools?: string[];
11
12
  }
12
13
 
13
14
  export async function startCli(options: CliOptions): Promise<void> {
@@ -16,6 +17,7 @@ export async function startCli(options: CliOptions): Promise<void> {
16
17
  continueLastSession,
17
18
  bypassPermissions,
18
19
  pluginDirs,
20
+ tools,
19
21
  } = options;
20
22
 
21
23
  // Continue with ink-based UI for normal mode
@@ -72,6 +74,7 @@ export async function startCli(options: CliOptions): Promise<void> {
72
74
  continueLastSession={continueLastSession}
73
75
  bypassPermissions={bypassPermissions}
74
76
  pluginDirs={pluginDirs}
77
+ tools={tools}
75
78
  />,
76
79
  );
77
80
 
@@ -1,28 +1,14 @@
1
- import {
2
- ConfigurationService,
3
- PluginManager,
4
- PluginScopeManager,
5
- Scope,
6
- } from "wave-agent-sdk";
1
+ import { PluginCore, Scope } from "wave-agent-sdk";
7
2
 
8
3
  export async function disablePluginCommand(argv: {
9
4
  plugin: string;
10
5
  scope?: Scope;
11
6
  }) {
12
7
  const workdir = process.cwd();
13
- const configurationService = new ConfigurationService();
14
- const pluginManager = new PluginManager({ workdir });
15
- const scopeManager = new PluginScopeManager({
16
- workdir,
17
- configurationService,
18
- pluginManager,
19
- });
20
-
21
- const scope =
22
- argv.scope || scopeManager.findPluginScope(argv.plugin) || "user";
8
+ const pluginCore = new PluginCore(workdir);
23
9
 
24
10
  try {
25
- await scopeManager.disablePlugin(scope, argv.plugin);
11
+ const scope = await pluginCore.disablePlugin(argv.plugin, argv.scope);
26
12
  console.log(
27
13
  `Successfully disabled plugin: ${argv.plugin} in ${scope} scope`,
28
14
  );
@@ -1,28 +1,14 @@
1
- import {
2
- ConfigurationService,
3
- PluginManager,
4
- PluginScopeManager,
5
- Scope,
6
- } from "wave-agent-sdk";
1
+ import { PluginCore, Scope } from "wave-agent-sdk";
7
2
 
8
3
  export async function enablePluginCommand(argv: {
9
4
  plugin: string;
10
5
  scope?: Scope;
11
6
  }) {
12
7
  const workdir = process.cwd();
13
- const configurationService = new ConfigurationService();
14
- const pluginManager = new PluginManager({ workdir });
15
- const scopeManager = new PluginScopeManager({
16
- workdir,
17
- configurationService,
18
- pluginManager,
19
- });
20
-
21
- const scope =
22
- argv.scope || scopeManager.findPluginScope(argv.plugin) || "user";
8
+ const pluginCore = new PluginCore(workdir);
23
9
 
24
10
  try {
25
- await scopeManager.enablePlugin(scope, argv.plugin);
11
+ const scope = await pluginCore.enablePlugin(argv.plugin, argv.scope);
26
12
  console.log(
27
13
  `Successfully enabled plugin: ${argv.plugin} in ${scope} scope`,
28
14
  );
@@ -1,36 +1,22 @@
1
- import {
2
- MarketplaceService,
3
- ConfigurationService,
4
- PluginManager,
5
- PluginScopeManager,
6
- Scope,
7
- } from "wave-agent-sdk";
1
+ import { PluginCore, Scope } from "wave-agent-sdk";
8
2
 
9
3
  export async function installPluginCommand(argv: {
10
4
  plugin: string;
11
5
  scope?: Scope;
12
6
  }) {
13
- const marketplaceService = new MarketplaceService();
14
7
  const workdir = process.cwd();
8
+ const pluginCore = new PluginCore(workdir);
15
9
 
16
10
  try {
17
- const installed = await marketplaceService.installPlugin(argv.plugin);
11
+ const installed = await pluginCore.installPlugin(argv.plugin);
18
12
  console.log(
19
13
  `Successfully installed plugin: ${installed.name} v${installed.version} from ${installed.marketplace}`,
20
14
  );
21
15
  console.log(`Cache path: ${installed.cachePath}`);
22
16
 
23
17
  if (argv.scope) {
24
- const configurationService = new ConfigurationService();
25
- const pluginManager = new PluginManager({ workdir });
26
- const scopeManager = new PluginScopeManager({
27
- workdir,
28
- configurationService,
29
- pluginManager,
30
- });
31
-
32
18
  const pluginId = `${installed.name}@${installed.marketplace}`;
33
- await scopeManager.enablePlugin(argv.scope, pluginId);
19
+ await pluginCore.enablePlugin(pluginId, argv.scope);
34
20
  console.log(`Plugin ${pluginId} enabled in ${argv.scope} scope`);
35
21
  }
36
22
 
@@ -1,66 +1,16 @@
1
- import {
2
- MarketplaceService,
3
- ConfigurationService,
4
- PluginScopeManager,
5
- PluginManager,
6
- } from "wave-agent-sdk";
1
+ import { PluginCore } from "wave-agent-sdk";
7
2
 
8
3
  export async function listPluginsCommand() {
9
- const configurationService = new ConfigurationService();
10
- const marketplaceService = new MarketplaceService();
11
- const workdir = process.cwd();
12
- const pluginManager = new PluginManager({
13
- workdir,
14
- configurationService,
15
- });
16
- const pluginScopeManager = new PluginScopeManager({
17
- workdir,
18
- configurationService,
19
- pluginManager,
20
- });
4
+ const pluginCore = new PluginCore(process.cwd());
21
5
 
22
6
  try {
23
- const installedPlugins = await marketplaceService.getInstalledPlugins();
24
- const marketplaces = await marketplaceService.listMarketplaces();
25
- const mergedEnabled = configurationService.getMergedEnabledPlugins(workdir);
7
+ const { plugins, mergedEnabled } = await pluginCore.listPlugins();
26
8
 
27
- // Collect all plugins from all marketplaces
28
- const allMarketplacePlugins: {
29
- name: string;
30
- marketplace: string;
31
- installed: boolean;
32
- version?: string;
33
- scope?: string;
34
- }[] = [];
35
-
36
- for (const m of marketplaces) {
37
- try {
38
- const manifest = await marketplaceService.loadMarketplaceManifest(
39
- marketplaceService.getMarketplacePath(m),
40
- );
41
- manifest.plugins.forEach((p) => {
42
- const pluginId = `${p.name}@${m.name}`;
43
- const installed = installedPlugins.plugins.find(
44
- (ip) => ip.name === p.name && ip.marketplace === m.name,
45
- );
46
- allMarketplacePlugins.push({
47
- name: p.name,
48
- marketplace: m.name,
49
- installed: !!installed,
50
- version: installed?.version,
51
- scope: pluginScopeManager.findPluginScope(pluginId) || undefined,
52
- });
53
- });
54
- } catch {
55
- // Skip marketplaces that fail to load
56
- }
57
- }
58
-
59
- if (allMarketplacePlugins.length === 0) {
9
+ if (plugins.length === 0) {
60
10
  console.log("No plugins found in registered marketplaces.");
61
11
  } else {
62
12
  console.log("Plugins:");
63
- allMarketplacePlugins.forEach((p) => {
13
+ plugins.forEach((p) => {
64
14
  const pluginId = `${p.name}@${p.marketplace}`;
65
15
  const isEnabled = mergedEnabled[pluginId] !== false;
66
16
  const status = p.installed
@@ -1,9 +1,9 @@
1
- import { MarketplaceService } from "wave-agent-sdk";
1
+ import { PluginCore } from "wave-agent-sdk";
2
2
 
3
3
  export async function addMarketplaceCommand(argv: { input: string }) {
4
- const service = new MarketplaceService();
4
+ const pluginCore = new PluginCore(process.cwd());
5
5
  try {
6
- const marketplace = await service.addMarketplace(argv.input);
6
+ const marketplace = await pluginCore.addMarketplace(argv.input);
7
7
  const source = marketplace.source;
8
8
  let sourceInfo = "";
9
9
  if (source.source === "directory") {
@@ -25,9 +25,9 @@ export async function addMarketplaceCommand(argv: { input: string }) {
25
25
  }
26
26
 
27
27
  export async function listMarketplacesCommand() {
28
- const service = new MarketplaceService();
28
+ const pluginCore = new PluginCore(process.cwd());
29
29
  try {
30
- const marketplaces = await service.listMarketplaces();
30
+ const marketplaces = await pluginCore.listMarketplaces();
31
31
  if (marketplaces.length === 0) {
32
32
  console.log("No marketplaces registered.");
33
33
  } else {
@@ -57,9 +57,9 @@ export async function listMarketplacesCommand() {
57
57
  }
58
58
 
59
59
  export async function removeMarketplaceCommand(argv: { name: string }) {
60
- const service = new MarketplaceService();
60
+ const pluginCore = new PluginCore(process.cwd());
61
61
  try {
62
- await service.removeMarketplace(argv.name);
62
+ await pluginCore.removeMarketplace(argv.name);
63
63
  console.log(`Successfully removed marketplace: ${argv.name}`);
64
64
  process.exit(0);
65
65
  } catch (error) {
@@ -70,14 +70,14 @@ export async function removeMarketplaceCommand(argv: { name: string }) {
70
70
  }
71
71
 
72
72
  export async function updateMarketplaceCommand(argv: { name?: string }) {
73
- const service = new MarketplaceService();
73
+ const pluginCore = new PluginCore(process.cwd());
74
74
  try {
75
75
  console.log(
76
76
  argv.name
77
77
  ? `Updating marketplace: ${argv.name}...`
78
78
  : "Updating all marketplaces...",
79
79
  );
80
- await service.updateMarketplace(argv.name);
80
+ await pluginCore.updateMarketplace(argv.name);
81
81
  console.log("Successfully updated.");
82
82
  process.exit(0);
83
83
  } catch (error) {
@@ -1,35 +1,13 @@
1
- import {
2
- MarketplaceService,
3
- ConfigurationService,
4
- PluginManager,
5
- PluginScopeManager,
6
- } from "wave-agent-sdk";
1
+ import { PluginCore } from "wave-agent-sdk";
7
2
 
8
3
  export async function uninstallPluginCommand(argv: { plugin: string }) {
9
- const marketplaceService = new MarketplaceService();
10
4
  const workdir = process.cwd();
5
+ const pluginCore = new PluginCore(workdir);
11
6
 
12
7
  try {
13
- await marketplaceService.uninstallPlugin(argv.plugin, workdir);
8
+ await pluginCore.uninstallPlugin(argv.plugin);
14
9
  console.log(`Successfully uninstalled plugin: ${argv.plugin}`);
15
-
16
- const configurationService = new ConfigurationService();
17
- const pluginManager = new PluginManager({ workdir });
18
- const scopeManager = new PluginScopeManager({
19
- workdir,
20
- configurationService,
21
- pluginManager,
22
- });
23
-
24
- try {
25
- await scopeManager.removePluginFromAllScopes(argv.plugin);
26
- console.log(`Cleaned up plugin configuration from all scopes`);
27
- } catch (error) {
28
- console.warn(
29
- `Warning: Could not clean up all plugin configurations: ${error instanceof Error ? error.message : String(error)}`,
30
- );
31
- }
32
-
10
+ console.log(`Cleaned up plugin configuration from all scopes`);
33
11
  process.exit(0);
34
12
  } catch (error) {
35
13
  const message = error instanceof Error ? error.message : String(error);
@@ -1,10 +1,10 @@
1
- import { MarketplaceService } from "wave-agent-sdk";
1
+ import { PluginCore } from "wave-agent-sdk";
2
2
 
3
3
  export async function updatePluginCommand(argv: { plugin: string }) {
4
- const marketplaceService = new MarketplaceService();
4
+ const pluginCore = new PluginCore(process.cwd());
5
5
 
6
6
  try {
7
- const updated = await marketplaceService.updatePlugin(argv.plugin);
7
+ const updated = await pluginCore.updatePlugin(argv.plugin);
8
8
  console.log(
9
9
  `Successfully updated plugin: ${updated.name} v${updated.version} from ${updated.marketplace}`,
10
10
  );