Tags: kernel/cli
Tags
CLI: Update SDK to 9a6636d (v0.91.0) and add new commands/flags (#215) This is the evergreen coverage branch, so the merge to main carries several SDK bumps and every CLI change built on them since the last merge — considerably more than the latest commit. Full inventory below. ## SDK Updates - kernel-go-sdk to **v0.91.0** (final bump `9a6636d` is version-only; the preceding `25f9b28` added the customer-facing OTLP destination CRUD API, `cb90eb7` added browser memory requests, `1f70e73` added credential provider names, plus earlier bumps for list filters, proxy config, auth context, and audit-log formats) ## New command groups - **`kernel telemetry destinations`** — `create`, `get`, `list`, `update`, `delete` for OTLP export destinations. `create`/`update` take `--name`, `--endpoint`, `--description`, `--header NAME=VALUE`; `update` adds `--remove-header NAME` (key-by-key edits via the SDK extra-fields escape hatch, since removal needs a JSON `null`); `list` uses the page-based UX (`--page`, `--per-page`, `--name`, `--query`); `delete` prompts unless `-y`. Header values are returned redacted, so only header names render. - **`kernel auth context`** — shows the principal, organization, credential scope, and effective scope resolved for the current credentials (table or `-o json`). ## New flags on existing commands - `browsers create`: `--memory` (`8GiB`/`16GiB`, validated locally), `--proxy-name`, `--proxy-mode` (`direct`/`default`), `--telemetry-export-otlp <id-or-name|off>` (implies `--telemetry=all` when unset) - `browsers update`: `--proxy-name`, `--proxy-mode`; `--clear-proxy` and `--disable-default-proxy` redefined as aliases of the modes - `browsers telemetry events`: `--order asc|desc` (desc rejects `--since`, use `--until`) - `auth connections create/update/login`: `--proxy-mode`, `--stealth`, `--telemetry-export-otlp`; `create` documents plan-derived `--health-check-interval` bounds - `auth connections list`: `--query` - `api-keys list`: `--name`, `--query`, `--status active|deleted|all`, `--sort-by`, `--sort-direction`; `--include-deleted` kept as a deprecated alias for `--status all` - `audit-logs download`: `--format jsonl.gz|jsonl`; `--to` default now derived from the window and format - `browser-pools list`: `--name`, `--query`; `browser-pools acquire`: `--start-url` - `credential-providers list`, `credentials list`, `deploy history`, `invoke history`: `--query` - `extensions list`: `--name`, `--query` - `profiles list`: `--name` - `projects list`: `--name`, `--query`; project commands select by ID or name - `proxies list`: `--name`, `--query` - global `--project` now accepts a project **name** as well as an ID ## Output changes (affect existing invocations) - `browsers list`: **column order changed** — Region moved next to Created At; empty values render `-`. Anything parsing this table positionally will need updating. - `browsers get`: new `Memory`, `Proxy` (resolved selection or egress mode, replacing the conditional `Proxy ID` row), and `Private Hosts` rows; `browsers create`/`get` with a profile show `Profile Save Changes` - `org limits get`: new `Max Auth Connections`, `Auth Connections Used`, `Min Health Check Interval` rows (rendered only when the API returns them) - `credential-providers list`: new `Name` column - `auth connections get`: new `Browser Proxy` / `Browser Stealth` rows; login prompts show canonical field/choice metadata - `api-keys list`: `Deleted At` column appears only when the filter can return deleted keys (default output unchanged) - `projects delete`: success message echoes the identifier you passed rather than the resolved ID Also rewords several help/error strings that the help renderer's first-word title-casing mangled (`Exact-Match`, `Destination(S)`, `--Order`). ## Testing - `go vet ./...` + `go test ./...` pass; new unit tests for telemetry destinations, auth context, proxy selection, and list filters - QA'd end-to-end against the production API with main and this branch side by side: telemetry destinations full lifecycle (including the in-use `409` delete guard and redacted headers), `browsers create --memory 16GiB --telemetry-export-otlp`, proxy flag validation and mutual exclusion, `--order desc`, all new list filters, `--status`/`--include-deleted`, `audit-logs --format` (verified gzip vs NDJSON on disk), `--project` by name, `browser-pools acquire --start-url`, and the output diffs listed above. All test resources deleted afterwards. - Not exercised live: the new `auth connections create/update/login` flags (verified via help output and unit tests only, to avoid mutating shared auth connections) Triggered by: kernel/kernel-go-sdk@9a6636d (v0.91.0) Reviewer: @kernel-internal[bot] <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Large CLI/API-facing change set with a breaking `browsers list` table layout and new proxy/telemetry/export semantics on session and auth flows; risk is mitigated by client-side validation and extensive tests but affects automation parsing tables. > > **Overview** > Updates the CLI on **kernel-go-sdk v0.91.0** and expands surface area across browsers, managed auth, projects, and observability. > > **New commands:** `kernel telemetry destinations` (OTLP endpoint CRUD with redacted headers and in-use delete guards) and `kernel auth context` (principal, org, credential vs effective scope). **Projects** gain `get`, `delete`, and `limits get/set`; global `--project` accepts **name or ID**. > > **Browsers & pools:** `--memory` (8/16 GiB), unified **proxy** selection (`--proxy-id` / `--proxy-name` / `--proxy-mode`; legacy `--clear-proxy` / `--disable-default-proxy` map to modes), normalized **`--private-host`** (cap 32), **`--telemetry-export-otlp`**, pool acquire **`--start-url`**, and telemetry events **`--order`**. Auth connections move proxy/stealth/telemetry under **`browser`** config and show richer canonical field/choice metadata on `get`/`follow`. > > **Lists & exports:** API keys, audit logs (`--format jsonl` vs `jsonl.gz`), and many list commands add **`--query`** / **`--name`** / **`--status`** (API keys). **Breaking:** `browsers list` column order changes (Region beside Created At); `browsers get` adds Memory, Proxy, and Private Hosts rows. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 40025e8. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: kernel-internal[bot] <260533166+kernel-internal[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: kernel-internal[bot] <kernel-internal[bot]@users.noreply.github.com> Co-authored-by: sjmiller609 <7516283+sjmiller609@users.noreply.github.com>
Persist OAuth project scope (#216) ## summary - persist authoritative organization/project scope returned by the OAuth server - preserve scope across automatic refresh and treat legacy credentials as organization-wide - show the active OAuth scope in `kernel auth` - document organization-wide and project-scoped login behavior ## tests - `go test ./...` - `go vet ./...` - `go build ./...` ## dependency Pairs with kernel/kernel-mcp-server#138. The fields are optional, so this remains compatible with the currently deployed OAuth server. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes OAuth token handling and stored credential shape; behavior is backward compatible for legacy tokens but affects how scope is enforced for all OAuth sessions after login or refresh. > > **Overview** > Adds **organization-wide vs project-scoped OAuth** to the CLI by persisting `access_scope` and `project_id` on stored credentials. > > During login, the callback may carry scope in OAuth `state`; after code exchange, **token response fields override** state for `org_id`, `access_scope`, and `project_id`. Missing scope defaults to organization-wide; org-wide tokens clear `project_id`. The same fields are updated on **refresh**, with legacy tokens without scope fields treated as organization-wide. > > **`kernel auth`** prints whether the session is organization-wide or locked to a project ID. README documents choosing scope at login and that project-scoped tokens cannot use `--project` to switch projects. > > Tests cover authoritative scope from token exchange, refresh preserving project scope, and legacy refresh behavior. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit c9eb41d. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
Add audit-logs export commands for S3 export destinations (#214) ## Summary Adds a `kernel audit-logs export` command group for managing S3 audit log export destinations: - `create` — creates a destination (paused by default) and prints the trust-policy onboarding steps with the Kernel role ARN and external ID - `list` — paginated table with delivery status per destination (`--limit`/`--offset`, more-results hint from pagination headers); JSON output includes a `next_offset` cursor when another page is available - `get` — full detail view including delivery status: status, last success with computed lag, last error and time, consecutive failures, next attempt - `update` — partial update of region/bucket/prefix/role ARN/KMS key; `--clear-kms-key` sends an empty string to remove the key, omitted flags leave fields unchanged; 409 conflicts get a retry-against-fresh-state hint - `pause` / `resume` — status transitions with notes on in-flight uploads and resume semantics - `delete` — removes a destination - `test` — runs the destination test and exits non-zero on failure, reporting the failing stage and error code All calls go through the generated `AuditLogExportDestinationService` in kernel-go-sdk v0.87.0 (bumped from v0.85.0), following the existing `cmd/audit_logs.go` service-interface pattern. A thin adapter remains only to read and validate the `X-Has-More`/`X-Next-Offset` pagination headers via `option.WithResponseInto`, since the SDK pager does not surface them. `--clear-kms-key` sends `{"kms_key_id":""}` per the SDK contract (empty string clears; omit/null leaves unchanged), locked in by a wire-contract test. Create, list, get, update, pause, resume, and test support `--output json`. ## Testing - `make test` passes (unit tests cover output rendering, flag validation, partial-update/clear semantics, pagination headers and JSON cursors, 409 handling, and test-failure exit behavior) - All flows (create, get, list, update incl. KMS set/clear, pause/resume, test, delete, and error paths) were exercised end-to-end against a live environment with the built binary <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > CLI-only feature with mocked and httptest coverage; no changes to core auth or runtime paths beyond a dependency bump. > > **Overview** > Adds **`kernel audit-logs export`**, a new subcommand group under `audit-logs` for managing continuous S3 audit log export destinations via `kernel-go-sdk` **v0.87.0** (from v0.85.0). > > Operators can **create** paused S3 destinations (with optional KMS), **list** with `--limit`/`--offset` and pagination from `X-Has-More` / `X-Next-Offset`, **get** delivery health, **partially update** bucket/role/KMS (including `--clear-kms-key`), **pause** / **resume**, **delete**, and **test** (non-zero exit on failure). Create prints IAM trust onboarding steps; list/get/update/pause/resume/test support **`--output json`**. > > Implementation mirrors existing audit-logs CLI patterns (service interface + thin SDK adapter for list pagination). Broad unit tests cover rendering, validation, KMS wire contract, 409 hints, and pagination. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0987661. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: yummybomb <19238148+yummybomb@users.noreply.github.com>
PreviousNext