MCPcopy
hub / github.com/di-sukharev/opencommit / getApiKey

Function getApiKey

src/commands/setup.ts:102–121  ·  view source on GitHub ↗
(provider: string)

Source from the content-addressed store, hash-verified

100}
101
102async function getApiKey(provider: string): Promise<string | symbol> {
103 const url =
104 PROVIDER_API_KEY_URLS[provider as keyof typeof PROVIDER_API_KEY_URLS];
105
106 let message = `Enter your ${provider} API key:`;
107 if (url) {
108 message = `Enter your API key:\n${chalk.dim(` Get your key at: ${url}`)}`;
109 }
110
111 return await text({
112 message,
113 placeholder: 'sk-...',
114 validate: (value) => {
115 if (!value || value.trim().length === 0) {
116 return 'API key is required';
117 }
118 return undefined;
119 }
120 });
121}
122
123function formatCacheAge(timestamp: number | null): string {
124 if (!timestamp) return '';

Callers 2

runSetupFunction · 0.70
promptForMissingApiKeyFunction · 0.70

Calls 2

textFunction · 0.85
trimMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…