MCPcopy Create free account

hub / github.com/boltrunner/gcli2api / functions

Functions96 in github.com/boltrunner/gcli2api

↓ 14 callersFunctionNewCaClient
(httpClient *http.Client, transportRetries int, baseDelay time.Duration)
internal/codeassist/client.go:48
↓ 12 callersFunctionmkClient
(rt http.RoundTripper)
internal/codeassist/client_test.go:18
↓ 10 callersFunctionresp
(status int, body string, ct string)
internal/codeassist/client_test.go:22
↓ 8 callersFunctionNewMultiClient
NewMultiClient constructs a MultiClient. It does not perform network calls. projectMap maps expanded credential paths to ordered project IDs to use.
internal/codeassist/multiclient.go:60
↓ 8 callersFunctionrun_command
Run a command and return the result.
scripts/release.py:22
↓ 5 callersMethodClose
Close closes the underlying DB if present.
internal/state/state.go:79
↓ 4 callersFunctionExpandUser
(path string)
internal/utils/utils.go:49
↓ 3 callersMethodClose
()
internal/codeassist/multiclient_test.go:210
↓ 3 callersMethodGenerateContent
(ctx context.Context, model, project string, req gemini.GeminiRequest)
internal/codeassist/multiclient.go:145
↓ 3 callersFunctionNormalizeGeminiRequest
NormalizeGeminiRequest ensures roles are present.
internal/gemini/normalize.go:8
↓ 3 callersMethodValidate
(cfgPath string)
internal/config/config.go:130
↓ 3 callersMethoddisplayName
()
internal/codeassist/multiclient.go:296
↓ 2 callersMethodFlush
()
internal/server/server_test.go:54
↓ 2 callersMethodGenerateContent
(ctx context.Context, model, project string, req gemini.GeminiRequest)
internal/server/server.go:30
↓ 2 callersMethodGenerateContentStream
(ctx context.Context, model, project string, req gemini.GeminiRequest)
internal/codeassist/multiclient.go:185
↓ 2 callersMethodGenerateContentStream
(ctx context.Context, model, project string, req gemini.GeminiRequest)
internal/server/server.go:31
↓ 2 callersFunctionLoadConfig
(path string)
internal/config/config.go:47
↓ 2 callersFunctionLoadRawTokenFromFile
Single-file helper retained for callers to load per-path tokens. LoadRawTokenFromFile loads a RawToken from a single JSON file path (with ~ expansion)
internal/auth/auth.go:55
↓ 2 callersFunctionNewPersistingTokenSource
(base oauth2.TokenSource, initial RawToken, path string, persist bool)
internal/auth/auth.go:80
↓ 2 callersFunctionNewWithCAClient
NewWithCAClient allows injecting a custom CodeAssist client (for tests).
internal/server/server.go:65
↓ 2 callersMethodToOAuth2Token
()
internal/auth/auth.go:25
↓ 2 callersMethodToken
()
internal/auth/auth_test.go:50
↓ 2 callersFunctionWithRetries
WithRetries runs fn with exponential backoff w/ jitter.
internal/httpx/httpx.go:53
↓ 2 callersMethodauthorize
(r *http.Request)
internal/server/server.go:97
↓ 2 callersFunctioncomputeDelay
computeBackoffDelay helper for tests by wrapping WithRetries timing via injection isn't trivial. Instead, check deterministic bounds with a fake RNG v
internal/httpx/httpx_test.go:12
↓ 2 callersFunctioncountRequestTokens
countRequestTokens approximates the total token count for the request by summing tokens of all text parts in systemInstruction and contents using tikt
internal/server/server.go:293
↓ 2 callersMethoddecodeGeminiRequest
(r *http.Request)
internal/server/server.go:159
↓ 2 callersMethoddoJSON
doJSON posts JSON to ":<method>" and decodes the JSON response into out.
internal/codeassist/client.go:333
↓ 2 callersMethodgetOrDiscoverProjectID
(ctx context.Context, e *entry)
internal/codeassist/multiclient.go:311
↓ 2 callersFunctionisRetryable
isRetryable determines if an error should trigger rotation/retry. It treats HTTP 401, 403, 429, and all 5xx as retryable, as well as common transport
internal/codeassist/multiclient.go:344
↓ 2 callersFunctionlistModels
()
internal/server/server.go:331
↓ 2 callersMethodpickStart
()
internal/codeassist/multiclient.go:131
↓ 2 callersMethodvalidateModel
(model string)
internal/server/server.go:155
↓ 1 callersFunctionComputeTokenKey
ComputeTokenKey returns a stable digest for a credential identity.
internal/state/state.go:126
↓ 1 callersMethodDiscoverProjectID
DiscoverProjectID attempts to derive the Google Cloud project ID to use with Code Assist when none is provided. It mirrors the Node implementation: 1)
internal/codeassist/client.go:248
↓ 1 callersMethodGenerateContent
(ctx context.Context, model, project string, req gemini.GeminiRequest)
internal/codeassist/client.go:52
↓ 1 callersMethodGenerateContentStream
StreamClient returns a channel of responses and an error channel.
internal/codeassist/client.go:90
↓ 1 callersMethodGetProjectID
GetProjectID returns the project id for tokenKey, and whether it was found.
internal/state/state.go:90
↓ 1 callersMethodGetRRCounter
GetRRCounter returns the persisted round-robin counter for a (provider, clientID). ok == false indicates not found.
internal/state/state.go:133
↓ 1 callersFunctionIsSupportedModel
IsSupportedModel reports whether the given model name is supported.
internal/gemini/models.go:18
↓ 1 callersFunctionNewOAuthHTTPClient
NewOAuthHTTPClient creates an *http.Client with OAuth2 transport. If proxyURL is non-nil, it is used as the upstream proxy. Supported schemes: http, s
internal/httpx/httpx.go:17
↓ 1 callersFunctionOpen
Open opens a SQLite database at path and ensures schema. If opening fails, a memory-only store is returned with db == nil.
internal/state/state.go:28
↓ 1 callersMethodRouter
()
internal/server/server.go:82
↓ 1 callersFunctionSaveRawTokenAtomic
(path string, rt RawToken)
internal/auth/auth.go:104
↓ 1 callersMethodSetRRCounter
SetRRCounter upserts the round-robin counter for (provider, clientID).
internal/state/state.go:153
↓ 1 callersMethodToken
()
internal/auth/auth.go:84
↓ 1 callersMethodUpsertProjectID
UpsertProjectID stores or updates the mapping for tokenKey.
internal/state/state.go:111
↓ 1 callersMethodWriteHeader
(code int)
internal/server/middleware.go:16
↓ 1 callersFunctioncalculate_sha256
Calculate SHA256 hash of a file.
scripts/release.py:41
↓ 1 callersFunctioncli
Release automation for gcli2api project.
scripts/release.py:51
↓ 1 callersFunctionfromOAuth2Token
(tok *oauth2.Token, prev RawToken)
internal/auth/auth.go:34
↓ 1 callersMethodhandleGenerateContent
(model string, w http.ResponseWriter, r *http.Request)
internal/server/server.go:169
↓ 1 callersMethodhandleModel
(w http.ResponseWriter, r *http.Request)
internal/server/server.go:132
↓ 1 callersMethodhandleStreamGenerateContent
(model string, w http.ResponseWriter, r *http.Request)
internal/server/server.go:203
↓ 1 callersFunctionhttpStatusFromError
(err error)
internal/server/server.go:313
↓ 1 callersMethodinit
(db *sql.DB)
internal/state/state.go:53
↓ 1 callersFunctionparseSSEStream
parseSSEStream is a local minimal SSE parser to avoid extra imports.
internal/codeassist/client.go:149
↓ 1 callersFunctiontruncateLongStringInImpl
TruncateLongStringInObject recursively truncates long strings in a JSON-like object. It mimics the Python function truncate_long_strings_in_object.
internal/utils/utils.go:12
↓ 1 callersMethodwithConcurrencyLimit
withConcurrencyLimit adds simple server-wide concurrency limiting.
internal/server/middleware.go:57
↓ 1 callersMethodwithLogging
(next http.Handler)
internal/server/middleware.go:28
↓ 1 callersMethodwithRecover
withRecover adds a panic recovery layer to prevent leaking stack traces and to ensure a clean 500 response is sent to the client.
internal/server/middleware.go:43
MethodClose
()
internal/codeassist/multiclient_test.go:227
FunctionEnsureFresh
Helper to force-refresh a token if it's near expiry in the next N minutes.
internal/auth/auth.go:137
MethodFlush
Flush implements http.Flusher by forwarding to the underlying ResponseWriter
internal/server/middleware.go:22
MethodGenerateContent
(ctx context.Context, model, project string, req gemini.GeminiRequest)
internal/server/server_test.go:20
MethodGenerateContentStream
(ctx context.Context, model, project string, req gemini.GeminiRequest)
internal/server/server_test.go:27
MethodMarshalJSON
MarshalJSON implements custom JSON marshaling for GeminiRequest to include unknown fields in the output
internal/gemini/types.go:140
FunctionNew
(cfg config.Config, httpCli *http.Client)
internal/server/server.go:42
MethodRead
(p []byte)
internal/codeassist/multiclient_test.go:209
MethodRead
(p []byte)
internal/codeassist/multiclient_test.go:218
MethodRoundTrip
(r *http.Request)
internal/codeassist/client_test.go:16
FunctionTestBackoff_JitterBounds
(t *testing.T)
internal/httpx/httpx_test.go:18
FunctionTestClient_Unary_NoInternalRetry
(t *testing.T)
internal/codeassist/client_test.go:29
FunctionTestConfig_ProjectIds_UnknownKey_Fails
(t *testing.T)
internal/config/config_test.go:5
FunctionTestGeminiRequest_UnknownFields
(t *testing.T)
internal/gemini/normalize_test.go:31
FunctionTestGenerationConfig_passthrough
System prompt from file feature removed; no tests required.
internal/gemini/normalize_test.go:23
FunctionTestHandler_FlushBehavior
(t *testing.T)
internal/server/server_test.go:56
FunctionTestListModels_shape
(t *testing.T)
internal/server/server_test.go:41
FunctionTestMultiClient_EmptyProjectList_FallsBackToDiscovery
(t *testing.T)
internal/codeassist/multiclient_test.go:189
FunctionTestMultiClient_ProjectUnits_AutoOnly
When projectIds is ["_auto"] only, we include just one discovery-based unit.
internal/codeassist/multiclient_test.go:167
FunctionTestMultiClient_ProjectUnits_RoundRobin
New behavior: per-credential project units and rotation across them.
internal/codeassist/multiclient_test.go:83
FunctionTestMultiClient_ProjectUnits_WithAuto_DiscoveryIncluded
When projectIds includes the special token "_auto", include a discovery-based unit in addition to any explicit project ids.
internal/codeassist/multiclient_test.go:134
FunctionTestMultiClient_RotationPolicy_Unary
Focused test: rotation behavior on 401 vs 500.
internal/codeassist/multiclient_test.go:19
FunctionTestMultiClient_StreamRotation_BeforeFirstEvent
(t *testing.T)
internal/codeassist/multiclient_test.go:229
FunctionTestMultiClient_Stream_NoRotation_AfterFirstEvent
(t *testing.T)
internal/codeassist/multiclient_test.go:265
FunctionTestNormalizeRoles_DefaultsOnly
(t *testing.T)
internal/gemini/normalize_test.go:8
FunctionTestStream_SSEParse_Success
(t *testing.T)
internal/codeassist/client_test.go:45
FunctionTestTokenLoadAndRefreshShape
(t *testing.T)
internal/auth/auth_test.go:13
FunctionTestWithRetries_StopsAfterMax
(t *testing.T)
internal/httpx/httpx_test.go:32
FunctionTruncateLongStringInObject
(v any, n int)
internal/utils/utils.go:36
MethodUnmarshalJSON
UnmarshalJSON implements custom JSON unmarshaling for GeminiRequest to capture unknown fields while preserving known ones
internal/gemini/types.go:88
Functionbuild_release
Build cross-platform binaries for release.
scripts/release.py:59
MethodhandleHealth
(w http.ResponseWriter, r *http.Request)
internal/server/server.go:91
MethodhandleListModels
(w http.ResponseWriter, r *http.Request)
internal/server/server.go:119
Functionmain
()
main.go:32
Functionupload_release
Create or update GitHub release and upload assets.
scripts/release.py:134