diff --git a/src/bin/codegraph.ts b/src/bin/codegraph.ts index 000414e..913d39e 100644 --- a/src/bin/codegraph.ts +++ b/src/bin/codegraph.ts @@ -36,8 +36,9 @@ import { installFatalHandlers } from './fatal-handler'; import { relaunchWithWasmRuntimeFlagsIfNeeded } from '../extraction/wasm-runtime-flags'; import { EXTRACTION_VERSION } from '../extraction/extraction-version'; import { getTelemetry, TELEMETRY_DOCS, recordIndexEvent } from '../telemetry'; -import { writeOffloadConfig, resolveOffload } from '../reasoning/config'; +import { writeOffloadConfig } from '../reasoning/config'; import { writeOffloadToken } from '../reasoning/credentials'; +import { startDeviceLogin, pollForToken, openBrowser } from '../reasoning/login'; import { fetchUsage } from '../reasoning/reasoner'; // Lazy-load heavy modules (CodeGraph, runInstaller) to keep CLI startup fast. @@ -1352,103 +1353,55 @@ program }); /** - * codegraph offload — configure the reasoning offload (bring-your-own endpoint). + * codegraph login / logout — managed reasoning (CodeGraph AI). * - * When set, codegraph_explore reasons over its assembled source with a remote - * model and returns the synthesized answer instead of the raw source dump. + * `login` runs a browser device-authorization flow against the CodeGraph dashboard, + * mints the account's metered org token, and stores it (managed offload on). When + * signed in, codegraph_explore reasons over its assembled source via the managed + * gateway instead of returning the raw source dump. `logout` clears it. + * + * Bring-your-own endpoint is configured via the CODEGRAPH_OFFLOAD_URL / + * CODEGRAPH_OFFLOAD_KEY / CODEGRAPH_OFFLOAD_MODEL env vars (see ../reasoning/config). */ -const offloadCmd = program - .command('offload') - .description('Configure the reasoning offload — let codegraph_explore answer via your own reasoning model'); - -offloadCmd - .command('set-endpoint ') - .description('Send explore output to an OpenAI-compatible reasoning endpoint (URL ends in /v1)') - .option('--model ', 'Model id to request', 'gpt-oss-120b') - .option('--key-env ', 'Name of the env var holding the API key (the key is never written to disk)') - .option('--effort ', 'reasoning_effort: low | medium | high') - .option('--style