fix: restore CLI and quota provider startup (#1857)

Export ngrok tunnel capabilities for CLI startup
Import Clack spinner/progress helpers used in interactive CLI paths
Restore Google quota provider registry exports
This commit is contained in:
Bohdan Triapitsyn
2026-06-27 09:19:24 +03:00
parent 1cec2f3b1a
commit 38c9ff77c9
7 changed files with 85 additions and 10 deletions
@@ -11,12 +11,20 @@ import {
fetchGoogleModels
} from './api.js';
export { resolveGoogleAuthSources } from './auth.js';
export const providerId = 'google';
export const providerName = 'Google';
export const aliases = ['google', 'google.oauth'];
export const isConfigured = () => resolveGoogleAuthSources().length > 0;
export const fetchGoogleQuota = async () => {
const authSources = resolveGoogleAuthSources();
if (!authSources.length) {
return buildResult({
providerId: 'google',
providerName: 'Google',
providerId,
providerName,
ok: false,
configured: false,
error: 'Not configured'
@@ -76,8 +84,8 @@ export const fetchGoogleQuota = async () => {
if (!Object.keys(models).length) {
return buildResult({
providerId: 'google',
providerName: 'Google',
providerId,
providerName,
ok: false,
configured: true,
error: sourceErrors[0] ?? 'Failed to fetch models'
@@ -85,8 +93,8 @@ export const fetchGoogleQuota = async () => {
}
return buildResult({
providerId: 'google',
providerName: 'Google',
providerId,
providerName,
ok: true,
configured: true,
usage: {
@@ -43,9 +43,9 @@ const registry = {
fetchQuota: cursor.fetchQuota
},
google: {
providerId: 'google',
providerName: 'Google',
isConfigured: () => google.resolveGoogleAuthSources().length > 0,
providerId: google.providerId,
providerName: google.providerName,
isConfigured: google.isConfigured,
fetchQuota: google.fetchGoogleQuota
},
'zai-coding-plan': {
@@ -0,0 +1,17 @@
import { describe, expect, it } from 'vitest';
import * as google from './google/index.js';
import { listConfiguredQuotaProviders } from './index.js';
describe('quota provider registry', () => {
it('exposes google provider configuration helpers through the provider module', () => {
expect(google.providerId).toBe('google');
expect(google.providerName).toBe('Google');
expect(typeof google.isConfigured).toBe('function');
expect(typeof google.resolveGoogleAuthSources).toBe('function');
});
it('can list configured providers without missing provider exports', () => {
expect(() => listConfiguredQuotaProviders()).not.toThrow();
});
});
@@ -13,7 +13,7 @@ import {
} from '../types.js';
import { getTunnelDependencyInstallInfo } from '../install-help.js';
const ngrokTunnelProviderCapabilities = {
export const ngrokTunnelProviderCapabilities = {
provider: TUNNEL_PROVIDER_NGROK,
defaults: {
mode: TUNNEL_MODE_QUICK,