@gemini-designer/mcp-server 0.1.2 → 0.1.29

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 (129) hide show
  1. package/dist/components/catalog.d.ts.map +1 -1
  2. package/dist/components/catalog.js +10 -4
  3. package/dist/components/catalog.js.map +1 -1
  4. package/dist/config/index.d.ts.map +1 -1
  5. package/dist/config/index.js +11 -6
  6. package/dist/config/index.js.map +1 -1
  7. package/dist/context/builder.d.ts.map +1 -1
  8. package/dist/context/builder.js.map +1 -1
  9. package/dist/context/filter.d.ts.map +1 -1
  10. package/dist/context/filter.js +5 -1
  11. package/dist/context/filter.js.map +1 -1
  12. package/dist/context/grounding.d.ts.map +1 -1
  13. package/dist/context/grounding.js +7 -3
  14. package/dist/context/grounding.js.map +1 -1
  15. package/dist/context/guards.d.ts.map +1 -1
  16. package/dist/context/guards.js +53 -0
  17. package/dist/context/guards.js.map +1 -1
  18. package/dist/context/repo-hints.js.map +1 -1
  19. package/dist/context/styling-detector.d.ts +24 -0
  20. package/dist/context/styling-detector.d.ts.map +1 -0
  21. package/dist/context/styling-detector.js +337 -0
  22. package/dist/context/styling-detector.js.map +1 -0
  23. package/dist/design/principles.js.map +1 -1
  24. package/dist/generation/gemini-client.d.ts.map +1 -1
  25. package/dist/generation/gemini-client.js.map +1 -1
  26. package/dist/generation/litellm-client.d.ts.map +1 -1
  27. package/dist/generation/litellm-client.js +14 -7
  28. package/dist/generation/litellm-client.js.map +1 -1
  29. package/dist/generation/remote-client.d.ts +10 -5
  30. package/dist/generation/remote-client.d.ts.map +1 -1
  31. package/dist/generation/remote-client.js +13 -2
  32. package/dist/generation/remote-client.js.map +1 -1
  33. package/dist/index.js.map +1 -1
  34. package/dist/output/file-writer.d.ts.map +1 -1
  35. package/dist/output/file-writer.js +4 -4
  36. package/dist/output/file-writer.js.map +1 -1
  37. package/dist/output/formatter.d.ts.map +1 -1
  38. package/dist/output/formatter.js +5 -2
  39. package/dist/output/formatter.js.map +1 -1
  40. package/dist/server.d.ts.map +1 -1
  41. package/dist/server.js +2 -1
  42. package/dist/server.js.map +1 -1
  43. package/dist/stack/detect.d.ts.map +1 -1
  44. package/dist/stack/detect.js +42 -9
  45. package/dist/stack/detect.js.map +1 -1
  46. package/dist/tokens/sync.d.ts.map +1 -1
  47. package/dist/tokens/sync.js +22 -5
  48. package/dist/tokens/sync.js.map +1 -1
  49. package/dist/tools/analyze-screenshot-ui.d.ts.map +1 -1
  50. package/dist/tools/analyze-screenshot-ui.js +5 -5
  51. package/dist/tools/analyze-screenshot-ui.js.map +1 -1
  52. package/dist/tools/analyze-tokens.d.ts.map +1 -1
  53. package/dist/tools/analyze-tokens.js +3 -1
  54. package/dist/tools/analyze-tokens.js.map +1 -1
  55. package/dist/tools/catalog-components.d.ts.map +1 -1
  56. package/dist/tools/catalog-components.js +1 -4
  57. package/dist/tools/catalog-components.js.map +1 -1
  58. package/dist/tools/create-ui.d.ts +3 -0
  59. package/dist/tools/create-ui.d.ts.map +1 -1
  60. package/dist/tools/create-ui.js +203 -75
  61. package/dist/tools/create-ui.js.map +1 -1
  62. package/dist/tools/detect-ui-stack.js.map +1 -1
  63. package/dist/tools/generate-component-variants.d.ts.map +1 -1
  64. package/dist/tools/generate-component-variants.js +15 -4
  65. package/dist/tools/generate-component-variants.js.map +1 -1
  66. package/dist/tools/generate-vibes.d.ts.map +1 -1
  67. package/dist/tools/generate-vibes.js +7 -3
  68. package/dist/tools/generate-vibes.js.map +1 -1
  69. package/dist/tools/index.js.map +1 -1
  70. package/dist/tools/modify-ui.d.ts.map +1 -1
  71. package/dist/tools/modify-ui.js +7 -2
  72. package/dist/tools/modify-ui.js.map +1 -1
  73. package/dist/tools/scaffold-project.d.ts.map +1 -1
  74. package/dist/tools/scaffold-project.js +3 -1
  75. package/dist/tools/scaffold-project.js.map +1 -1
  76. package/dist/tools/snippet-ui.d.ts +3 -1
  77. package/dist/tools/snippet-ui.d.ts.map +1 -1
  78. package/dist/tools/snippet-ui.js +219 -88
  79. package/dist/tools/snippet-ui.js.map +1 -1
  80. package/dist/tools/sync-design-tokens.d.ts.map +1 -1
  81. package/dist/tools/sync-design-tokens.js +26 -11
  82. package/dist/tools/sync-design-tokens.js.map +1 -1
  83. package/dist/utils/walk.d.ts.map +1 -1
  84. package/dist/utils/walk.js.map +1 -1
  85. package/dist/version.d.ts +2 -0
  86. package/dist/version.d.ts.map +1 -0
  87. package/dist/version.js +5 -0
  88. package/dist/version.js.map +1 -0
  89. package/package.json +55 -55
  90. package/src/__tests__/builder.test.ts +19 -19
  91. package/src/__tests__/config.test.ts +63 -31
  92. package/src/__tests__/filter.test.ts +98 -92
  93. package/src/__tests__/remote-client.test.ts +179 -0
  94. package/src/components/catalog.ts +170 -166
  95. package/src/config/index.ts +185 -177
  96. package/src/context/builder.ts +157 -157
  97. package/src/context/filter.ts +110 -104
  98. package/src/context/grounding.ts +143 -129
  99. package/src/context/guards.ts +97 -38
  100. package/src/context/repo-hints.ts +24 -24
  101. package/src/context/styling-detector.ts +460 -0
  102. package/src/design/principles.ts +14 -14
  103. package/src/generation/gemini-client.ts +53 -56
  104. package/src/generation/litellm-client.ts +102 -86
  105. package/src/generation/remote-client.ts +100 -77
  106. package/src/index.ts +16 -16
  107. package/src/output/file-writer.ts +123 -123
  108. package/src/output/formatter.ts +139 -132
  109. package/src/server.ts +12 -11
  110. package/src/stack/detect.ts +226 -175
  111. package/src/tokens/sync.ts +189 -155
  112. package/src/tools/analyze-screenshot-ui.ts +89 -88
  113. package/src/tools/analyze-tokens.ts +80 -78
  114. package/src/tools/catalog-components.ts +68 -68
  115. package/src/tools/create-ui.ts +295 -142
  116. package/src/tools/detect-ui-stack.ts +36 -36
  117. package/src/tools/generate-component-variants.ts +155 -135
  118. package/src/tools/generate-vibes.ts +121 -117
  119. package/src/tools/index.ts +14 -14
  120. package/src/tools/modify-ui.ts +170 -165
  121. package/src/tools/scaffold-project.ts +68 -66
  122. package/src/tools/snippet-ui.ts +323 -172
  123. package/src/tools/sync-design-tokens.ts +217 -195
  124. package/src/utils/walk.ts +47 -45
  125. package/src/version.ts +6 -0
  126. package/tsconfig.json +23 -33
  127. package/vitest.config.ts +10 -10
  128. package/.prettierrc +0 -9
  129. package/eslint.config.js +0 -37
@@ -10,55 +10,51 @@ import * as fs from 'node:fs';
10
10
  import * as path from 'node:path';
11
11
 
12
12
  const ConfigSchema = z.object({
13
- // Mode: 'local' uses direct Gemini API, 'remote' uses gateway
14
- mode: z.enum(['local', 'remote']).default('local'),
15
-
16
- // Local provider: direct Gemini SDK, or OpenAI-compatible proxy (e.g. LiteLLM)
17
- // Default to LiteLLM because it unlocks routing, retries, caching, and load balancing.
18
- // If LiteLLM is not configured, we will automatically fall back to direct Gemini.
19
- localProvider: z.enum(['gemini', 'litellm']).default('litellm'),
20
-
21
- // API key for local mode (required if mode is 'local')
22
- apiKey: z.string().optional(),
23
-
24
- // Remote gateway endpoint (required if mode is 'remote')
25
- remoteEndpoint: z.string().url().optional(),
26
-
27
- // Remote API key for gateway authentication
28
- remoteApiKey: z.string().optional(),
29
-
30
- // Workspace paths that can be accessed
31
- allowedPaths: z.array(z.string()).default([process.cwd()]),
32
-
33
- // Default framework for generated code
34
- defaultFramework: z
35
- .enum(['vanilla', 'react', 'vue', 'svelte', 'nextjs'])
36
- .default('react'),
37
-
38
- // Gemini model to use (for local mode)
39
- model: z.string().default('gemini-2.5-flash'),
40
-
41
- // LiteLLM (or other OpenAI-compatible proxy) configuration for local mode
42
- litellmEndpoint: z.string().url().optional(),
43
- litellmApiKey: z.string().optional(),
44
- litellmModel: z.string().optional(),
45
-
46
- // Default accessibility level
47
- accessibility: z.enum(['none', 'wcag-a', 'wcag-aa', 'wcag-aaa']).default('wcag-aa'),
48
-
49
- // Responsive breakpoints
50
- breakpoints: z
51
- .record(z.number())
52
- .default({
53
- sm: 640,
54
- md: 768,
55
- lg: 1024,
56
- xl: 1280,
57
- '2xl': 1536,
58
- }),
59
-
60
- // Debug mode
61
- debug: z.boolean().default(false),
13
+ // Mode: 'local' uses direct Gemini API, 'remote' uses gateway
14
+ mode: z.enum(['local', 'remote']).default('local'),
15
+
16
+ // Local provider: direct Gemini SDK, or OpenAI-compatible proxy (e.g. LiteLLM)
17
+ // Default to LiteLLM because it unlocks routing, retries, caching, and load balancing.
18
+ // If LiteLLM is not configured, we will automatically fall back to direct Gemini.
19
+ localProvider: z.enum(['gemini', 'litellm']).default('litellm'),
20
+
21
+ // API key for local mode (required if mode is 'local')
22
+ apiKey: z.string().optional(),
23
+
24
+ // Remote gateway endpoint (required if mode is 'remote')
25
+ remoteEndpoint: z.string().url().optional(),
26
+
27
+ // Remote API key for gateway authentication
28
+ remoteApiKey: z.string().optional(),
29
+
30
+ // Workspace paths that can be accessed
31
+ allowedPaths: z.array(z.string()).default([process.cwd()]),
32
+
33
+ // Default framework for generated code
34
+ defaultFramework: z.enum(['vanilla', 'react', 'vue', 'svelte', 'nextjs']).default('react'),
35
+
36
+ // Gemini model to use (for local mode)
37
+ model: z.string().default('gemini-2.5-flash'),
38
+
39
+ // LiteLLM (or other OpenAI-compatible proxy) configuration for local mode
40
+ litellmEndpoint: z.string().url().optional(),
41
+ litellmApiKey: z.string().optional(),
42
+ litellmModel: z.string().optional(),
43
+
44
+ // Default accessibility level
45
+ accessibility: z.enum(['none', 'wcag-a', 'wcag-aa', 'wcag-aaa']).default('wcag-aa'),
46
+
47
+ // Responsive breakpoints
48
+ breakpoints: z.record(z.number()).default({
49
+ sm: 640,
50
+ md: 768,
51
+ lg: 1024,
52
+ xl: 1280,
53
+ '2xl': 1536,
54
+ }),
55
+
56
+ // Debug mode
57
+ debug: z.boolean().default(false),
62
58
  });
63
59
 
64
60
  export type Config = z.infer<typeof ConfigSchema>;
@@ -67,171 +63,183 @@ export type Config = z.infer<typeof ConfigSchema>;
67
63
  * Load configuration from all sources
68
64
  */
69
65
  export function loadConfig(): Config {
70
- const configFromFile = loadConfigFile();
71
- const configFromEnv = loadConfigFromEnv();
72
- const configFromArgs = loadConfigFromArgs();
73
-
74
- // Merge configs with priority: args > env > file > defaults
75
- const merged = {
76
- ...configFromFile,
77
- ...configFromEnv,
78
- ...configFromArgs,
79
- };
80
-
81
- const result = ConfigSchema.safeParse(merged);
82
-
83
- if (!result.success) {
84
- console.error('[config] Invalid configuration:', result.error.format());
85
- throw new Error('Invalid configuration');
86
- }
87
-
88
- // Apply smart defaults / fallbacks
89
- // - We default to localProvider=litellm, but automatically fall back to direct Gemini
90
- // when LiteLLM isn't configured.
91
- let cfg: Config = result.data;
92
-
93
- if (cfg.mode === 'local') {
94
- const hasLite = Boolean(cfg.litellmEndpoint);
95
- const hasGemini = Boolean(cfg.apiKey);
96
-
97
- if (cfg.localProvider === 'litellm' && !hasLite) {
98
- if (hasGemini) {
99
- if (cfg.debug) {
100
- console.error('[config] LITELLM_ENDPOINT missing; falling back to localProvider=gemini');
101
- }
102
- cfg = { ...cfg, localProvider: 'gemini' };
103
- }
66
+ const configFromFile = loadConfigFile();
67
+ const configFromEnv = loadConfigFromEnv();
68
+ const configFromArgs = loadConfigFromArgs();
69
+
70
+ // Merge configs with priority: args > env > file > defaults
71
+ const merged = {
72
+ ...configFromFile,
73
+ ...configFromEnv,
74
+ ...configFromArgs,
75
+ };
76
+
77
+ const result = ConfigSchema.safeParse(merged);
78
+
79
+ if (!result.success) {
80
+ console.error('[config] Invalid configuration:', result.error.format());
81
+ throw new Error('Invalid configuration');
82
+ }
83
+
84
+ // Apply smart defaults / fallbacks
85
+ // - We default to localProvider=litellm, but automatically fall back to direct Gemini
86
+ // when LiteLLM isn't configured.
87
+ let cfg: Config = result.data;
88
+
89
+ if (cfg.mode === 'local') {
90
+ const hasLite = Boolean(cfg.litellmEndpoint);
91
+ const hasGemini = Boolean(cfg.apiKey);
92
+
93
+ if (cfg.localProvider === 'litellm' && !hasLite) {
94
+ if (hasGemini) {
95
+ if (cfg.debug) {
96
+ console.error('[config] LITELLM_ENDPOINT missing; falling back to localProvider=gemini');
104
97
  }
98
+ cfg = { ...cfg, localProvider: 'gemini' };
99
+ }
100
+ }
105
101
 
106
- if (cfg.localProvider === 'gemini' && !hasGemini) {
107
- if (hasLite) {
108
- if (cfg.debug) {
109
- console.error('[config] GEMINI_API_KEY missing; falling back to localProvider=litellm');
110
- }
111
- cfg = { ...cfg, localProvider: 'litellm' };
112
- }
102
+ if (cfg.localProvider === 'gemini' && !hasGemini) {
103
+ if (hasLite) {
104
+ if (cfg.debug) {
105
+ console.error('[config] GEMINI_API_KEY missing; falling back to localProvider=litellm');
113
106
  }
107
+ cfg = { ...cfg, localProvider: 'litellm' };
108
+ }
109
+ }
114
110
 
115
- // Validate mode-specific requirements after applying fallbacks
116
- if (cfg.localProvider === 'gemini' && !cfg.apiKey) {
117
- console.error('[config] Local mode (gemini) requires GEMINI_API_KEY environment variable');
118
- throw new Error('Missing Gemini API key for local mode');
119
- }
111
+ // Validate mode-specific requirements after applying fallbacks
112
+ if (cfg.localProvider === 'gemini' && !cfg.apiKey) {
113
+ console.error('[config] Local mode (gemini) requires GEMINI_API_KEY environment variable');
114
+ throw new Error('Missing Gemini API key for local mode');
115
+ }
120
116
 
121
- if (cfg.localProvider === 'litellm' && !cfg.litellmEndpoint) {
122
- console.error('[config] Local mode (litellm) requires LITELLM_ENDPOINT');
123
- throw new Error('Missing LiteLLM endpoint for local mode');
124
- }
117
+ if (cfg.localProvider === 'litellm' && !cfg.litellmEndpoint) {
118
+ console.error('[config] Local mode (litellm) requires LITELLM_ENDPOINT');
119
+ throw new Error('Missing LiteLLM endpoint for local mode');
125
120
  }
121
+ }
122
+
123
+ if (cfg.mode === 'remote' && !cfg.remoteEndpoint) {
124
+ console.error('[config] Remote mode requires GEMINI_DESIGNER_REMOTE_ENDPOINT');
125
+ throw new Error('Missing remote endpoint for remote mode');
126
+ }
126
127
 
127
- if (cfg.mode === 'remote' && !cfg.remoteEndpoint) {
128
- console.error('[config] Remote mode requires GEMINI_DESIGNER_REMOTE_ENDPOINT');
129
- throw new Error('Missing remote endpoint for remote mode');
128
+ // Security: avoid sending API keys over plain HTTP except for local dev.
129
+ if (cfg.mode === 'remote' && cfg.remoteEndpoint) {
130
+ const u = new URL(cfg.remoteEndpoint);
131
+ const isLocalhost = u.hostname === 'localhost' || u.hostname === '127.0.0.1' || u.hostname === '::1';
132
+ if (u.protocol !== 'https:' && !(u.protocol === 'http:' && isLocalhost)) {
133
+ console.error(
134
+ '[config] GEMINI_DESIGNER_REMOTE_ENDPOINT must be https:// (or http://localhost for local dev)'
135
+ );
136
+ throw new Error('Insecure remote endpoint (HTTP)');
130
137
  }
138
+ }
131
139
 
132
- return cfg;
140
+ return cfg;
133
141
  }
134
142
 
135
143
  /**
136
144
  * Load from .gemini-designer.json config file
137
145
  */
138
146
  function loadConfigFile(): Partial<Config> {
139
- const configPath = path.join(process.cwd(), '.gemini-designer.json');
140
-
141
- if (!fs.existsSync(configPath)) {
142
- return {};
143
- }
144
-
145
- try {
146
- const content = fs.readFileSync(configPath, 'utf-8');
147
- return JSON.parse(content);
148
- } catch (error) {
149
- console.error('[config] Error reading config file:', error);
150
- return {};
151
- }
147
+ const configPath = path.join(process.cwd(), '.gemini-designer.json');
148
+
149
+ if (!fs.existsSync(configPath)) {
150
+ return {};
151
+ }
152
+
153
+ try {
154
+ const content = fs.readFileSync(configPath, 'utf-8');
155
+ return JSON.parse(content);
156
+ } catch (error) {
157
+ console.error('[config] Error reading config file:', error);
158
+ return {};
159
+ }
152
160
  }
153
161
 
154
162
  /**
155
163
  * Load from environment variables
156
164
  */
157
165
  function loadConfigFromEnv(): Partial<Config> {
158
- const config: Partial<Config> = {};
166
+ const config: Partial<Config> = {};
159
167
 
160
- if (process.env.GEMINI_API_KEY) {
161
- config.apiKey = process.env.GEMINI_API_KEY;
162
- }
168
+ if (process.env.GEMINI_API_KEY) {
169
+ config.apiKey = process.env.GEMINI_API_KEY;
170
+ }
163
171
 
164
- if (process.env.GEMINI_DESIGNER_MODE) {
165
- config.mode = process.env.GEMINI_DESIGNER_MODE as 'local' | 'remote';
166
- }
172
+ if (process.env.GEMINI_DESIGNER_MODE) {
173
+ config.mode = process.env.GEMINI_DESIGNER_MODE as 'local' | 'remote';
174
+ }
167
175
 
168
- if (process.env.GEMINI_DESIGNER_LOCAL_PROVIDER) {
169
- config.localProvider = process.env.GEMINI_DESIGNER_LOCAL_PROVIDER as Config['localProvider'];
170
- }
176
+ if (process.env.GEMINI_DESIGNER_LOCAL_PROVIDER) {
177
+ config.localProvider = process.env.GEMINI_DESIGNER_LOCAL_PROVIDER as Config['localProvider'];
178
+ }
171
179
 
172
- if (process.env.GEMINI_DESIGNER_REMOTE_ENDPOINT) {
173
- config.remoteEndpoint = process.env.GEMINI_DESIGNER_REMOTE_ENDPOINT;
174
- }
180
+ if (process.env.GEMINI_DESIGNER_REMOTE_ENDPOINT) {
181
+ config.remoteEndpoint = process.env.GEMINI_DESIGNER_REMOTE_ENDPOINT;
182
+ }
175
183
 
176
- if (process.env.GEMINI_DESIGNER_REMOTE_API_KEY) {
177
- config.remoteApiKey = process.env.GEMINI_DESIGNER_REMOTE_API_KEY;
178
- }
184
+ if (process.env.GEMINI_DESIGNER_REMOTE_API_KEY) {
185
+ config.remoteApiKey = process.env.GEMINI_DESIGNER_REMOTE_API_KEY;
186
+ }
179
187
 
180
- if (process.env.GEMINI_DESIGNER_DEBUG === 'true') {
181
- config.debug = true;
182
- }
188
+ if (process.env.GEMINI_DESIGNER_DEBUG === 'true') {
189
+ config.debug = true;
190
+ }
183
191
 
184
- if (process.env.GEMINI_DESIGNER_FRAMEWORK) {
185
- config.defaultFramework = process.env.GEMINI_DESIGNER_FRAMEWORK as Config['defaultFramework'];
186
- }
192
+ if (process.env.GEMINI_DESIGNER_FRAMEWORK) {
193
+ config.defaultFramework = process.env.GEMINI_DESIGNER_FRAMEWORK as Config['defaultFramework'];
194
+ }
187
195
 
188
- if (process.env.GEMINI_MODEL) {
189
- config.model = process.env.GEMINI_MODEL;
190
- }
196
+ if (process.env.GEMINI_MODEL) {
197
+ config.model = process.env.GEMINI_MODEL;
198
+ }
191
199
 
192
- if (process.env.LITELLM_ENDPOINT) {
193
- config.litellmEndpoint = process.env.LITELLM_ENDPOINT;
194
- }
200
+ if (process.env.LITELLM_ENDPOINT) {
201
+ config.litellmEndpoint = process.env.LITELLM_ENDPOINT;
202
+ }
195
203
 
196
- if (process.env.LITELLM_API_KEY) {
197
- config.litellmApiKey = process.env.LITELLM_API_KEY;
198
- }
204
+ if (process.env.LITELLM_API_KEY) {
205
+ config.litellmApiKey = process.env.LITELLM_API_KEY;
206
+ }
199
207
 
200
- if (process.env.LITELLM_MODEL) {
201
- config.litellmModel = process.env.LITELLM_MODEL;
202
- }
208
+ if (process.env.LITELLM_MODEL) {
209
+ config.litellmModel = process.env.LITELLM_MODEL;
210
+ }
203
211
 
204
- return config;
212
+ return config;
205
213
  }
206
214
 
207
215
  /**
208
216
  * Load from CLI arguments
209
217
  */
210
218
  function loadConfigFromArgs(): Partial<Config> {
211
- const args = process.argv.slice(2);
212
- const config: Partial<Config> = {};
213
-
214
- for (let i = 0; i < args.length; i++) {
215
- const arg = args[i];
216
-
217
- if (arg === '--local') {
218
- config.mode = 'local';
219
- } else if (arg === '--remote') {
220
- config.mode = 'remote';
221
- } else if (arg === '--provider' && args[i + 1]) {
222
- config.localProvider = args[++i] as Config['localProvider'];
223
- } else if (arg === '--debug') {
224
- config.debug = true;
225
- } else if (arg === '--api-key' && args[i + 1]) {
226
- config.apiKey = args[++i];
227
- } else if (arg === '--litellm-endpoint' && args[i + 1]) {
228
- config.litellmEndpoint = args[++i];
229
- } else if (arg === '--litellm-model' && args[i + 1]) {
230
- config.litellmModel = args[++i];
231
- } else if (arg === '--endpoint' && args[i + 1]) {
232
- config.remoteEndpoint = args[++i];
233
- }
234
- }
235
-
236
- return config;
219
+ const args = process.argv.slice(2);
220
+ const config: Partial<Config> = {};
221
+
222
+ for (let i = 0; i < args.length; i++) {
223
+ const arg = args[i];
224
+
225
+ if (arg === '--local') {
226
+ config.mode = 'local';
227
+ } else if (arg === '--remote') {
228
+ config.mode = 'remote';
229
+ } else if (arg === '--provider' && args[i + 1]) {
230
+ config.localProvider = args[++i] as Config['localProvider'];
231
+ } else if (arg === '--debug') {
232
+ config.debug = true;
233
+ } else if (arg === '--api-key' && args[i + 1]) {
234
+ config.apiKey = args[++i];
235
+ } else if (arg === '--litellm-endpoint' && args[i + 1]) {
236
+ config.litellmEndpoint = args[++i];
237
+ } else if (arg === '--litellm-model' && args[i + 1]) {
238
+ config.litellmModel = args[++i];
239
+ } else if (arg === '--endpoint' && args[i + 1]) {
240
+ config.remoteEndpoint = args[++i];
241
+ }
242
+ }
243
+
244
+ return config;
237
245
  }