MCPcopy Index your code
hub / github.com/triggerdotdev/trigger.dev / promptApiKey

Function promptApiKey

packages/cli/src/cli/index.ts:198–225  ·  view source on GitHub ↗
(instanceUrl: string)

Source from the content-addressed store, hash-verified

196};
197
198export const promptApiKey = async (instanceUrl: string): Promise<string> => {
199 // First prompt if they want to enter their API key now, and if they say Yes, then prompt for it and return it
200 const { apiKey } = await inquirer.prompt<{ apiKey: string }>({
201 type: "password",
202 name: "apiKey",
203 message: `Enter your secret dev API key (Find yours ➡️ ${instanceUrl})`,
204 validate: (input) => {
205 // Make sure they enter something like tr_dev_********
206 if (!input) {
207 return "Please enter your secret dev API key";
208 }
209
210 const result = checkApiKeyIsDevServer(input);
211
212 if (result.success) {
213 return true;
214 }
215
216 if (!result.type) {
217 return "Please enter a valid development API key (should start with tr_dev_)";
218 }
219
220 return `Please enter your secret dev API key, you've entered a ${result.type.environment} ${result.type.type} key`;
221 },
222 });
223
224 return apiKey;
225};
226
227export const promptEndpointSlug = async (path: string): Promise<string> => {
228 const { endpointSlug } = await inquirer.prompt<{

Callers 1

Calls 1

checkApiKeyIsDevServerFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…