MCPcopy
hub / github.com/mixedbread-ai/mgrep / ensureAuthenticated

Function ensureAuthenticated

src/lib/utils.ts:176–199  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

174}
175
176export async function ensureAuthenticated(): Promise<void> {
177 // Check if API key is set via environment variable
178 if (process.env.MXBAI_API_KEY) {
179 return;
180 }
181
182 // Check for stored OAuth token
183 const token = await getStoredToken();
184 if (token) {
185 return;
186 }
187
188 const shouldLogin = await confirm({
189 message: "You are not logged in. Would you like to login now?",
190 initialValue: true,
191 });
192
193 if (isCancel(shouldLogin) || !shouldLogin) {
194 cancel("Operation cancelled");
195 process.exit(0);
196 }
197
198 await loginAction();
199}
200
201export async function deleteFile(
202 store: Store,

Callers 5

createStoreFunction · 0.85
claude-code.tsFile · 0.85
codex.tsFile · 0.85
opencode.tsFile · 0.85
droid.tsFile · 0.85

Calls 2

getStoredTokenFunction · 0.85
loginActionFunction · 0.85

Tested by

no test coverage detected