Skip to content

feat: browser login + table views + colour + release-plz - #1

Merged
wavekat-eason merged 13 commits into
mainfrom
feat/browser-login
Apr 28, 2026
Merged

feat: browser login + table views + colour + release-plz#1
wavekat-eason merged 13 commits into
mainfrom
feat/browser-login

Conversation

@wavekat-eason

Copy link
Copy Markdown
Contributor

Summary

  • Browser-based login. `wk login` now does a loopback OAuth handshake (the `gh` / `vercel` CLI pattern) — no more pasting cookies out of dev tools. Bearer token (`wkcli_…`) replaces the legacy session cookie; the legacy cookie is still read so existing `auth.json` files keep working until the next login. `--no-browser` and `WK_TOKEN` cover SSH / CI.
  • Cleaner output. `wk projects list`, `wk projects show`, `wk annotations list` all gain table / summary views with `--json` for piping into `jq`. ASR snippets render under each annotation row, truncated to 80 visible columns (CJK-aware via `unicode-width`). Pagination prints a ready-to-paste `Next:` line when more pages exist.
  • Colour everywhere. Tiny `style` module (raw ANSI, no extra crate). Auto-disabled when stdout isn't a TTY or `NO_COLOR` is set. `CLICOLOR_FORCE=1` forces it on for CI captures. Padding is applied before styling so column alignment isn't broken by ANSI codes.
  • Versioning. `wk -V` and `wk --version` print a multi-line block (version + name + repo URL) so output pasted into a bug report carries enough context on its own.
  • Release-plz CI. New `.github/workflows/release-plz.yml` and `release-plz.toml` mirror `wavekat-core` / `wavekat-turn` / `wavekat-vad`. Conventional-commit-driven version PRs, automatic crates.io publish on merge.

Requires

Test plan

  • `cargo build --release` clean.
  • `cargo clippy --no-deps -- -D warnings` clean.
  • `wk login --base-url http://localhost:5010\` against local platform: browser opens, Authorize, terminal greets you.
  • `wk projects list` — colour table, headers aligned, `Next:` hint appears past page 1.
  • `wk annotations list ` — ASR text shows under each row, truncated at 80 visible cols (verify with a CJK-heavy project).
  • `wk projects list --json | jq .` and `wk annotations list --json | jq .` still emit the raw shape for scripts.
  • `wk logout` revokes the token server-side; subsequent `wk me` returns "not signed in".
  • `NO_COLOR=1 wk projects list` — no ANSI codes.
  • `wk -V` and `wk --version` — both print the same multi-line block.

🤖 Generated with Claude Code

wavekat-eason and others added 13 commits April 28, 2026 11:16
Replaces the v1 cookie-paste flow with a proper loopback OAuth handshake
(the gh / vercel CLI pattern). `wk login` binds an ephemeral 127.0.0.1
port, opens the browser to <platform>/cli-login, and waits for the
platform to redirect back with a freshly minted `wkcli_…` bearer token —
no more "open dev tools and copy the cookie".

- Hand-rolled single-shot loopback HTTP listener (std::net) with a
  random CSRF state and a 5 minute deadline.
- `--no-browser` falls back to printing the URL (works over SSH with a
  port-forward); `--token` / `WK_TOKEN` skips the dance for CI.
- `wk logout` now best-effort revokes the token server-side via
  /api/auth/cli/tokens/revoke-current before clearing the local file.
- Auth config grows a `token` field; the legacy `session_cookie` is
  still read so existing installs keep working until the next login.
- README rewritten around the new flow.

Requires the matching wavekat-platform changes (cli_tokens table,
bearer-token middleware, /cli-login SPA route).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Match the convention used by wavekat-turn / wavekat-core / wavekat-vad.
The banner SVG (`wavekat-cli-narrow.svg`) needs to be added to
wavekat-brand/assets/banners/ — the link will 404 until then.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The wavekat-cli repo (and crates.io page) is public, but
wavekat-platform is private — external readers hitting the GitHub link
got a 404. Point at the public platform URL instead, and drop the
dangling docs/06-export.md link from the "What's next" section.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Raw JSON dumps weren't pulling their weight at the terminal. Match the
shape of `projects list`: print a compact table by default and add a
`--json` flag for piping into jq.

- `wk annotations list` now prints `ID FILE LABEL RANGE REVIEW`. Add
  `--asr` to inline the ASR snippet under each row when you want to
  read the labels rather than script over them.
- `wk projects show` prints a labelled summary; `--json` keeps the raw
  response for scripts.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- annotations list: drop the --asr flag; the snippet (truncated to 96
  chars) is printed under every row. The whole point of looking at
  annotations in a terminal is the language, not the IDs.
- annotations / projects list: when more pages exist, print a
  ready-to-copy "Next: wk … --page N" line under the page summary so
  pagination is discoverable without a trip to --help.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a tiny `style` module (raw ANSI, no extra crate) and threads it
through every command. Output is automatically plain when stdout
isn't a TTY or when `NO_COLOR` is set, so piping into jq / files /
other tools keeps working unchanged. `CLICOLOR_FORCE=1` forces colour
back on for CI captures.

Where the colour shows up:
- `wk me` / login / logout: dim labels, role tinted (root=magenta,
  user=green, none=yellow), green ✓ on success.
- `wk projects list`: bold headers, dim ids and timestamps; `show`
  highlights the project name, dims metadata.
- `wk annotations list`: bold headers, cyan label cell, dim id /
  range / ASR snippet, review status coloured by outcome
  (approved=green, rejected=red, needs_fix=yellow, unreviewed=dim).

Padding is applied to raw bytes before styling so column alignment
isn't broken by the ANSI escape codes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Char-count truncation overshoots in CJK content because each glyph
takes two terminal columns. Switch to a unicode-width truncation
capped at 80 visible columns, so Chinese / Japanese / Korean ASR
snippets wrap at the same on-screen width as Latin ones.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ANSI escape codes count toward byte length but not toward visible
column width, so wrapping the id in `style::dim(...)` and *then*
asking `{:<38}` to pad it shrunk the visible cell to 36 cols and
pulled the NAME / CREATED headers two cols out of alignment. Pad
the raw string first, then style — same fix already applied to the
annotations table.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`wk -V` keeps the terse `wk 0.0.1` form. `wk --version` adds the
package name, description, and repository URL so output pasted into
a bug report carries enough context on its own. Sourced from the
standard CARGO_PKG_* env vars so it stays in sync with Cargo.toml.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
clap defaults to a short/long split on the version flag (the rustc
convention from many years ago), but in practice rustc and cargo
both print the same string regardless. Drop the split and emit the
full version block for both forms — fewer surprises, easier to
remember.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mirrors the wavekat-core / wavekat-turn / wavekat-vad setup. On every
push to main, release-plz opens (or updates) a release PR that bumps
the version + writes the CHANGELOG. Merging that PR triggers the
release job, which tags, creates a GitHub Release, and publishes to
crates.io.

Requires `CARGO_REGISTRY_TOKEN` to be set in the repo's Actions
secrets (https://crates.io/me → "API Tokens" with publish-new +
publish-update scope on `wavekat-cli`).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@wavekat-eason
wavekat-eason merged commit f17da9a into main Apr 28, 2026
1 check passed
@wavekat-eason
wavekat-eason deleted the feat/browser-login branch April 28, 2026 03:03
@github-actions github-actions Bot mentioned this pull request Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant