@@ -6,6 +6,14 @@ import { translatePlugins } from "./src/translator";
66import { executeCopilot } from "./src/executor" ;
77import { runOperator } from "./src/operator" ;
88import { clearAllCaches } from "./src/cache" ;
9+ import { enablePlugin , disablePlugin , listEnabledPlugins } from "./src/plugin" ;
10+ import {
11+ addMarketplace ,
12+ listMarketplaces ,
13+ removeMarketplace ,
14+ updateMarketplace ,
15+ updateAllMarketplaces ,
16+ } from "./src/marketplace" ;
917
1018async function main ( ) : Promise < void > {
1119 const args = parseCliArgs ( process . argv ) ;
@@ -15,6 +23,63 @@ async function main(): Promise<void> {
1523 process . exit ( exitCode ) ;
1624 }
1725
26+ if ( args . command === "plugin" ) {
27+ if ( args . pluginSubcommand === "enable" && args . pluginName ) {
28+ await enablePlugin ( args . pluginName ) ;
29+ process . exit ( 0 ) ;
30+ }
31+
32+ if ( args . pluginSubcommand === "disable" && args . pluginName ) {
33+ await disablePlugin ( args . pluginName ) ;
34+ process . exit ( 0 ) ;
35+ }
36+
37+ if (
38+ args . listEnabledPlugins &&
39+ ! args . pluginSubcommand &&
40+ ! args . marketplaceSubcommand
41+ ) {
42+ await listEnabledPlugins ( ) ;
43+ process . exit ( 0 ) ;
44+ }
45+
46+ if ( args . marketplaceSubcommand === "list" ) {
47+ await listMarketplaces ( ) ;
48+ process . exit ( 0 ) ;
49+ }
50+
51+ if ( args . marketplaceSubcommand === "add" && args . marketplaceTarget ) {
52+ await addMarketplace ( args . marketplaceTarget ) ;
53+ process . exit ( 0 ) ;
54+ }
55+
56+ if ( args . marketplaceSubcommand === "remove" && args . marketplaceTarget ) {
57+ await removeMarketplace ( args . marketplaceTarget ) ;
58+ process . exit ( 0 ) ;
59+ }
60+
61+ if ( args . marketplaceSubcommand === "update" ) {
62+ if ( args . updateAll ) {
63+ await updateAllMarketplaces ( ) ;
64+ process . exit ( 0 ) ;
65+ }
66+ if ( args . marketplaceTarget ) {
67+ await updateMarketplace ( args . marketplaceTarget ) ;
68+ process . exit ( 0 ) ;
69+ }
70+ console . error (
71+ "Error: Marketplace name is required for 'update' command. Use '--all' to update all marketplaces or provide a marketplace name."
72+ ) ;
73+ process . exit ( 1 ) ;
74+ }
75+
76+ // If we get here with a plugin command but no valid subcommand,
77+ // show help for the plugin command
78+ console . error ( "Error: plugin command requires a subcommand" ) ;
79+ console . error ( "Run 'construct plugin --help' for usage information" ) ;
80+ process . exit ( 1 ) ;
81+ }
82+
1883 // Handle --clear-cache
1984 if ( args . clearCache ) {
2085 await clearAllCaches ( ) ;
0 commit comments