MCPcopy Create free account
hub / github.com/clawbot7/cli-gateway / runFirstTimeSetup

Function runFirstTimeSetup

src/config.ts:162–251  ·  view source on GitHub ↗
(params: {
  defaults: {
    defaultWorkspaceRoot: string;
    defaultDbPath: string;
  };
  file: string;
  input: NodeJS.ReadStream;
  output: NodeJS.WriteStream;
})

Source from the content-addressed store, hash-verified

160}
161
162async function runFirstTimeSetup(params: {
163 defaults: {
164 defaultWorkspaceRoot: string;
165 defaultDbPath: string;
166 };
167 file: string;
168 input: NodeJS.ReadStream;
169 output: NodeJS.WriteStream;
170}): Promise<Record<string, unknown>> {
171 params.output.write('\n');
172 params.output.write('cli-gateway first-time setup\n');
173 params.output.write(`Config file: ${params.file}\n`);
174 params.output.write('Press Enter to accept defaults.\n\n');
175
176 const rl = createInterface({
177 input: params.input,
178 output: params.output,
179 });
180
181 try {
182 const acpAgentCommand = await askWithDefault(
183 rl,
184 'ACP agent command',
185 'npx',
186 );
187 const acpArgsRaw = await askWithDefault(
188 rl,
189 'ACP agent args (space-separated)',
190 '-y @zed-industries/codex-acp@latest',
191 );
192 const workspaceRoot = await askWithDefault(
193 rl,
194 'Default workspace root',
195 params.defaults.defaultWorkspaceRoot,
196 );
197 const dbPath = await askWithDefault(
198 rl,
199 'SQLite DB path',
200 params.defaults.defaultDbPath,
201 );
202 const schedulerEnabled = await askYesNo(rl, 'Enable scheduler', true);
203
204 const discordToken = await askOptional(rl, 'Discord bot token (optional)');
205 const discordAllowChannelId = discordToken
206 ? await askOptional(rl, 'Discord allow channel id (optional)')
207 : '';
208 const telegramToken = await askOptional(rl, 'Telegram bot token (optional)');
209 const feishuAppId = await askOptional(rl, 'Feishu app id (optional)');
210 const feishuAppSecret = feishuAppId
211 ? await askOptional(rl, 'Feishu app secret (optional)')
212 : '';
213 const feishuVerificationToken =
214 feishuAppId && feishuAppSecret
215 ? await askOptional(rl, 'Feishu verification token (optional)')
216 : '';
217
218 let feishuListenPort = 3030;
219 if (feishuAppId && feishuAppSecret) {

Callers 1

loadConfigFunction · 0.85

Calls 7

askWithDefaultFunction · 0.85
askYesNoFunction · 0.85
askOptionalFunction · 0.85
askPortWithDefaultFunction · 0.85
splitArgsFunction · 0.85
writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected