Skip to content

Commit fa7fa79

Browse files
authored
Merge pull request #100 from stephenleo/docs/add-ttl-to-readme-sample-config
docs: add ttl field to README usage_limits sample config
2 parents f9ba125 + 0d1c56e commit fa7fa79

File tree

7 files changed

+11
-9
lines changed

7 files changed

+11
-9
lines changed

.github/workflows/claude-code-review.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ name: Claude Code Review
33
on:
44
pull_request:
55
types: [opened, synchronize, ready_for_review, reopened]
6-
pull_request_target:
7-
types: [opened, synchronize, ready_for_review, reopened]
86
# Optional: Only run on specific file changes
97
# paths:
108
# - "src/**/*.ts"
@@ -14,7 +12,7 @@ on:
1412

1513
jobs:
1614
claude-review:
17-
# Optional: Filter by PR author
15+
# Skip for external contributions
1816
# if: |
1917
# github.event.pull_request.user.login == 'external-contributor' ||
2018
# github.event.pull_request.user.login == 'new-developer' ||
@@ -23,7 +21,7 @@ jobs:
2321
runs-on: ubuntu-latest
2422
permissions:
2523
contents: read
26-
pull-requests: write
24+
pull-requests: read
2725
issues: read
2826
id-token: write
2927

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cship"
3-
version = "1.1.2"
3+
version = "1.2.0"
44
edition = "2024"
55
description = "Beautiful, Blazing-fast, Customizable Claude Code Statusline"
66
license = "Apache-2.0"

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ critical_threshold = 70.0
208208
critical_style = "bold red"
209209

210210
[cship.usage_limits]
211+
ttl = 60 # cache TTL in seconds; increase if running many concurrent sessions
211212
five_hour_format = "5h {pct}%"
212213
seven_day_format = "7d {pct}%"
213214
separator = " "

docs/configuration.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ Displays the current working directory or project directory.
295295

296296
## `[cship.usage_limits]` — API Usage Limits
297297

298-
Displays 5-hour and 7-day API utilization percentages with time-to-reset. Fetches from the Anthropic API using your OAuth token (stored in the OS credential store). Results are cached for 60s or until the reset window passes.
298+
Displays 5-hour and 7-day API utilization percentages with time-to-reset. Fetches from the Anthropic API using your OAuth token (stored in the OS credential store). Results are cached for the configured TTL (default 60s) or until the reset window passes.
299299

300300
**Token:** `$cship.usage_limits`
301301

@@ -311,11 +311,13 @@ Displays 5-hour and 7-day API utilization percentages with time-to-reset. Fetche
311311
| `warn_style` | `string` | `"yellow"` | Style at warn level |
312312
| `critical_threshold` | `float` || % at which style switches to `critical_style` |
313313
| `critical_style` | `string` | `"bold red"` | Style at critical level |
314+
| `ttl` | `integer` | `60` | Cache refresh interval in seconds. Increase to reduce API pressure when running multiple concurrent sessions. |
314315

315316
**Prerequisites:** On Linux/WSL2, install `libsecret-tools` and store your OAuth token with `secret-tool`. See [FAQ](/faq#usage-limits-linux) for setup instructions.
316317

317318
```toml
318319
[cship.usage_limits]
320+
ttl = 300 # 5 minutes; increase if you run many concurrent sessions
319321
five_hour_format = "5h {pct}%({reset})"
320322
seven_day_format = "7d {pct}%({reset})"
321323
separator = " "

docs/faq.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ The CShip `usage_limits` module fetches data from the Anthropic API using your C
7575
- Run `cship explain` to confirm cship is receiving a valid JSON context.
7676

7777
**Usage limits** data is cached:
78-
- Cache TTL: **60 seconds**, or until the rate-limit reset window passes (whichever comes first).
79-
- The first call in a session always fetches fresh data; subsequent calls within 60s return the cached value.
78+
- Cache TTL: **configurable (default 60 seconds)**, or until the rate-limit reset window passes (whichever comes first). Set `[cship.usage_limits] ttl` to increase the cache interval if you run many concurrent sessions.
79+
- The first call in a session always fetches fresh data; subsequent calls within the configured TTL return the cached value.
8080
- If the cache seems stale, check that your OAuth token is valid (re-login to Claude Code if needed).
8181

8282
You can see the current cache state by running `cship explain` — it shows the usage limits value being rendered and any warnings if the API call failed.

docs/showcase.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ critical_threshold = 70.0
9797
critical_style = "bold red"
9898

9999
[cship.usage_limits]
100+
ttl = 60 # cache TTL in seconds; increase if running many concurrent sessions
100101
five_hour_format = "5h {pct}%"
101102
seven_day_format = "7d {pct}%"
102103
separator = " "

0 commit comments

Comments
 (0)