Skip to content
Merged
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
34 changes: 28 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- run: tail -n 1 coverage.txt >> "$GITHUB_STEP_SUMMARY"

build:
needs: test
needs: [test, version]
strategy:
fail-fast: false
matrix:
Expand All @@ -64,6 +64,14 @@ jobs:
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- shell: bash
env:
TAG: ${{ needs.version.outputs.tag }}
run: |
export VERSION="${TAG#v}"
perl -pi -e '$done ||= s/^version = "[^"]*"/version = "$ENV{VERSION}"/' Cargo.toml
perl -0pi -e 's/(name = "status_cli"\r?\nversion = )"[^"]*"/$1"$ENV{VERSION}"/' Cargo.lock
grep -m1 '^version' Cargo.toml
- run: cargo build --release --locked --target ${{ matrix.target }}
- if: runner.os == 'macOS'
run: |
Expand Down Expand Up @@ -202,16 +210,30 @@ jobs:
fetch-depth: 0
- id: version
run: |
tag="v$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n 1)"
base=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n 1)
last=$(git tag --list 'v[0-9]*.[0-9]*.[0-9]*' --sort=-v:refname | head -n 1)
publish=false
if [ "$GITHUB_REF" = "refs/heads/main" ] && ! git rev-parse -q --verify "refs/tags/$tag" >/dev/null; then
publish=true
elif [ "$GITHUB_REF" = "refs/tags/$tag" ]; then
if [ "$GITHUB_REF_TYPE" = "tag" ]; then
tag="$GITHUB_REF_NAME"
publish=true
elif [ -z "$last" ]; then
tag="v$base"
else
current=${last#v}
major=${current%%.*}
rest=${current#*.}
next="$major.$((${rest%%.*} + 1)).0"
highest=$(printf '%s\n' "$next" "$base" | sort -V | tail -n 1)
tag="v$highest"
fi
if [ "$GITHUB_EVENT_NAME" = "push" ] && [ "$GITHUB_REF" = "refs/heads/main" ]; then
if [ -z "$last" ] || ! git diff --quiet "$last" HEAD -- src Cargo.toml Cargo.lock; then
publish=true
fi
fi
echo "tag=$tag" >> "$GITHUB_OUTPUT"
echo "publish=$publish" >> "$GITHUB_OUTPUT"
echo "$tag publish=$publish"
echo "last=${last:-none} next=$tag publish=$publish"

release:
if: needs.version.outputs.publish == 'true'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ GEMINI.md
.gemini/
.agy/
.agents/
.serena/
.cursor/
.cursorrules
.windsurf/
Expand Down
71 changes: 71 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ crossterm = "0.29.0"
portable-pty = "0.9.0"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
sha2 = "0.11.0"
terminal_size = "0.4.4"
toml_edit = "0.25.16"
vt100 = "0.16.2"
Expand Down
91 changes: 72 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,17 @@ in `~/.local/bin` and runs `status_cli setup`, which configures every host it fi
copy of each file it changes. On Windows the folder is added to `PATH`; on Linux and macOS the host settings point
at the binary's full path, so `PATH` does not matter. Open a new session afterwards.

`status_cli doctor` checks the result: version, `PATH`, each host's settings, the `codex-stt` shortcut and the
detected terminal and language. It exits with 1 when something is missing.
`status_cli doctor` checks the result: version, `PATH`, each host's settings and usage hooks, the `codex-stt`
shortcut and the detected terminal and language. It exits with 1 when something is missing.

`status_cli update` moves to the latest GitHub release. It compares the release tag with the running version and stops
if there is nothing newer. Otherwise it downloads that release's binary for your system with `curl`, which ships with
Windows 10 and later, macOS and most Linux distributions. It checks the SHA-256 against the release's `SHA256SUMS`,
makes sure the new binary runs, and only then swaps it in place of the running one. Open sessions pick it up on their
next refresh. On Windows the running binary can't be overwritten, so it is renamed to `status_cli.old`, which the next
update deletes. Errors exit with 1 and leave the installed binary untouched. `STATUS_CLI_RELEASE_URL` (release JSON)
and `STATUS_CLI_BASE_URL` (asset folder) point it at another source, which is how the tests run it against a local
release.

### Install with an AI assistant

Expand Down Expand Up @@ -117,21 +126,61 @@ describes it: the auto-compact window minus 33k tokens (about 967k on a 1M windo
context unless `CLAUDE_CODE_AUTO_COMPACT_WINDOW` sets a smaller one, and `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` can only
bring the threshold down. Values set through `autoCompactWindow` in settings are not read.

## Languages
## Usage limits for agents

`status_cli setup` also hooks `status_cli guard` into every host, so the agent knows how much of the 5-hour and
weekly limits is used and when each one resets, without being asked:

| Host | Where | When |
| --- | --- | --- |
| Claude Code | `hooks` in `settings.json` | every prompt (`UserPromptSubmit`), and before `Agent`, `Task` or `Workflow` |
| Codex CLI | `~/.codex/hooks.json` | session start and every prompt |
| agy | plugin in `~/.gemini/config/plugins/status_cli/` | session start, and before each model call near the limit |

The agent reads a line such as `status_cli: session 57% (resets in 58m), week 21% (resets in 5d0h).` From 85% of
the session or 90% of the week it is also told to keep its task notes current and to ask before starting subagents
or workflows. From 95% of the session or 97% of the week it is told not to start new tasks: record what is done
and what comes next, tell the user, and stop. In Claude Code, subagents then need confirmation, and are blocked once
the limit is nearly exhausted. Codex has no confirmation step, so it only blocks.

Labels follow the system language: English, Spanish, Portuguese, French and Chinese, with English for anything
else. `STATUS_CLI_LANG` overrides it (`en`, `es`, `pt`, `fr`, `zh`); otherwise `LC_ALL`, `LC_MESSAGES` and `LANG`
are used, and the Windows display language when those are empty.
Claude Code and agy are read from the state the status line saves for that session; Codex is read from the session
file Codex itself writes, so it works with or without `codex-stt`. A window that already reset is not reported.
Codex runs only hooks you trust: after `status_cli setup`, approve the new ones once with `/hooks` in Codex.
Running setup again replaces the previous guard entries and leaves every other hook alone.

| | en | es | pt | fr | zh |
| --- | --- | --- | --- | --- | --- |
| 5-hour window | session | sesión | sessão | session | 会话 |
| Weekly window | week | semana | semana | semaine | 本周 |
| Auto-compact | compact | compactar | compactar | compacter | 压缩 |
| Context | context | contexto | contexto | contexte | 上下文 |
| Duration | time | tiempo | tempo | temps | 时长 |
## Languages

Chinese characters count as two columns, so the line keeps its width.
Labels follow the system language, with English for anything else. `STATUS_CLI_LANG` overrides it; otherwise
`LC_ALL`, `LC_MESSAGES` and `LANG` are used, and the Windows display language when those are empty. The first two
letters pick the language, so `pt`, `pt_BR` and `pt-PT` all give Brazilian Portuguese and `zh_TW` gives simplified
Chinese.

| Code | Language | 5-hour window | Weekly window | Auto-compact | Context | Duration |
| --- | --- | --- | --- | --- | --- | --- |
| `en` | English | session | week | compact | context | time |
| `pt` | Portuguese (Brazil) | sessão | semana | compactar | contexto | tempo |
| `es` | Spanish | sesión | semana | compactar | contexto | tiempo |
| `zh` | Chinese (simplified) | 会话 | 本周 | 压缩 | 上下文 | 时长 |
| `hi` | Hindi | सत्र | सप्ताह | संक्षेपण | संदर्भ | समय |
| `ar` | Arabic | الجلسة | الأسبوع | الضغط | السياق | الوقت |
| `fr` | French | session | semaine | compacter | contexte | temps |
| `de` | German | Sitzung | Woche | verdichten | Kontext | Zeit |
| `ja` | Japanese | セッション | 今週 | 圧縮 | コンテキスト | 時間 |
| `ru` | Russian | сессия | неделя | сжатие | контекст | время |
| `ko` | Korean | 세션 | 주간 | 압축 | 컨텍스트 | 시간 |
| `it` | Italian | sessione | settimana | compattare | contesto | tempo |
| `id` | Indonesian | sesi | minggu | ringkas | konteks | waktu |
| `tr` | Turkish | oturum | hafta | sıkıştır | bağlam | süre |
| `vi` | Vietnamese | phiên | tuần | nén | ngữ cảnh | thời gian |
| `th` | Thai | เซสชัน | สัปดาห์ | บีบอัด | บริบท | เวลา |
| `bn` | Bengali | সেশন | সপ্তাহ | সংকোচন | প্রসঙ্গ | সময় |
| `ur` | Urdu | سیشن | ہفتہ | کمپیکٹ | سیاق | وقت |
| `pl` | Polish | sesja | tydzień | kompaktowanie | kontekst | czas |
| `nl` | Dutch | sessie | week | compacteren | context | tijd |

Chinese, Japanese and Korean characters count as two columns and combining marks (Thai, Hindi, Bengali, Arabic
vowel signs) as none, so the line keeps its width. Arabic and Urdu are written in logical order; how they read
depends on the terminal's right-to-left support. The guard's messages to the agent use the same language.

## Configuration

Expand All @@ -141,7 +190,7 @@ Everything works out of the box. These environment variables change the defaults
| --- | --- |
| `STATUS_CLI_COLOR` | `truecolor`, `256`, `16` or `none`, for terminals that do not advertise their depth (tmux, screen) |
| `STATUS_CLI_ASCII` | ASCII instead of Unicode glyphs |
| `STATUS_CLI_LANG` | `en`, `es`, `pt`, `fr` or `zh` |
| `STATUS_CLI_LANG` | Language code from the table above, such as `en`, `pt`, `zh`, `ja` or `ar` |
| `NO_COLOR` | No colors |
| `STATUS_CLI_LOG` | JSON Lines log with per-phase timings, host, model, effort and the rendered line |
| `STATUS_CLI_CODEX` | Program to run instead of `codex` in `codex-stt` |
Expand Down Expand Up @@ -178,14 +227,18 @@ cargo llvm-cov --summary-only
```

The suite has unit tests beside each module and integration tests in `tests/`: `cli` (rendering), `matrix` (every
model, effort and mode), `i18n` (every language), `setup`, `codex`, `wrap` (Codex inside a real pseudo-terminal),
model, effort and mode), `i18n` (every language), `setup`, `guard` (usage hooks and their registration), `codex`, `wrap` (Codex inside a real pseudo-terminal),
`regression` (one test per fixed bug) and `e2e` (install, configure, then run the configured command through the
host's shell). CI runs them on every platform and reports coverage.

Each feature in `src/features/` owns its parsing, rendering and tests; `payload`, `state`, `style`, `terminal` and
`layout` are shared. Releases are automatic: bump `version` in `Cargo.toml` and merge to `main`. Once every test,
shell and distro check passes, CI tags the commit, publishes the binaries with `SHA256SUMS` and installs them on
each platform.
`layout` are shared. Releases are automatic. Every push to `main` that changes `src/`, `Cargo.toml` or `Cargo.lock`
since the last `vX.Y.Z` tag ships the next minor version: `v1.1.0` becomes `v1.2.0`. CI writes that number into
`Cargo.toml` and `Cargo.lock` inside the runner before building, so nothing is committed back. The `version` in
`Cargo.toml` is a floor: raise it by hand for a major or a specific version, and CI uses it when it's higher. Pushes
that only touch docs or CI don't release. Once every test, shell and distro check passes, CI tags the commit,
publishes the binaries with `SHA256SUMS` and installs them on each platform. Local builds report the `Cargo.toml`
version, which can trail the latest release.

## License

Expand Down
3 changes: 3 additions & 0 deletions src/features.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
pub mod clock;
pub mod codex;
pub mod context;
pub mod guard;
pub mod hooks;
pub mod model;
pub mod quota;
pub mod setup;
pub mod telemetry;
pub mod update;
pub mod wrap;
2 changes: 1 addition & 1 deletion src/features/codex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl Reader {
}
}

fn parse_session(file: &Path) -> Result<Payload, Box<dyn Error>> {
pub fn parse_session(file: &Path) -> Result<Payload, Box<dyn Error>> {
let mut payload = Payload { product: Some("codex".to_owned()), ..Payload::default() };
for record in tail_records(file)?.iter().rev() {
let body = &record["payload"];
Expand Down
Loading
Loading