Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sources/CodexBarCLI/CLIUsageCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ extension CodexBarCLI {
}

#if !os(macOS)
if parsedSourceMode?.usesWeb == true {
if parsedSourceMode == .web {
Self.exit(
code: .failure,
message: "Error: --source web/auto is only supported on macOS.",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Badge Correct Linux source error text for auto mode

After this change, --source auto is intentionally supported on non-macOS, but the emitted runtime error still says --source web/auto is only supported on macOS. When a Linux user passes --source web, this message now gives incorrect guidance and implies that auto is also invalid, which conflicts with the new behavior and can mislead CLI automation/users troubleshooting source selection.

Useful? React with 👍 / 👎.

Expand Down Expand Up @@ -243,7 +243,7 @@ extension CodexBarCLI {
account: account)

#if !os(macOS)
if effectiveSourceMode.usesWeb {
if effectiveSourceMode == .web {
return Self.webSourceUnsupportedOutput(
provider: provider,
account: account,
Expand Down
9 changes: 9 additions & 0 deletions Tests/CodexBarTests/CLIEntryTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,13 @@ struct CLIEntryTests {
#expect(!CodexBarCLI.shouldUseColor(noColor: true, format: .text))
#expect(!CodexBarCLI.shouldUseColor(noColor: false, format: .json))
}

#if !os(macOS)
@Test
func sourceModeUsesWebIncludesAuto() {
#expect(ProviderSourceMode.web.usesWeb)
#expect(ProviderSourceMode.auto.usesWeb)
#expect(!ProviderSourceMode.api.usesWeb)
}
#endif
}
12 changes: 11 additions & 1 deletion docs/kimi.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ Tracks usage for [Kimi For Coding](https://www.kimi.com/code) in CodexBar.
- Shows current 5-hour rate limit usage
- Automatic and manual authentication methods
- Automatic refresh countdown
- Headless-friendly auth via env var (no GUI required)

## Setup

Choose one of two authentication methods:
Choose one of the authentication methods:

### Method 1: Automatic Browser Import (Recommended)

Expand Down Expand Up @@ -52,6 +53,15 @@ Alternatively, set the `KIMI_AUTH_TOKEN` environment variable:
export KIMI_AUTH_TOKEN="jwt-token-here"
```

This is the recommended approach for CLI/headless usage.

With `KIMI_AUTH_TOKEN` set, the default `codexbar usage --provider kimi` (`--source auto`) will fetch usage via Kimi's HTTP endpoint.

```bash
export KIMI_AUTH_TOKEN="<paste kimi-auth cookie here>"
codexbar usage --provider kimi
```

## Authentication Priority

When multiple sources are available, CodexBar uses this order:
Expand Down