Files
oh-my-pi/packages/coding-agent/test/issue-953-repro.test.ts
T
can1357 78b795ad80 feat(session-stats): added Python session-stats analyze/sync commands
- Added a Python `analyze.py` CLI with `tools`, `edits`, and `followups` session-stats subcommands.
- Added `sync.py` ingestion with `~/.omp/stats.db`, migration SQL, and incremental JSONL resume logic.
- Replaced `stats:run` in `package.json` with `stats:sync` and new `stats:edits`, `stats:tools`, and `stats:followups` scripts.
- Removed the Rust session-stats crate files (`Cargo.toml`, `main.rs`, `common.rs`, `cmd_*.rs`) and their old command logic.
- Removed `.gitignore` ignores for `scripts/session-stats/Cargo.lock` and `scripts/session-stats/edit-analysis.csv`.
- Updated eval tool guidance to show Python `asyncio.run(...)` usage.
2026-05-09 04:41:41 +02:00

61 lines
1.7 KiB
TypeScript

import { beforeAll, describe, expect, it } from "bun:test";
import type { SegmentContext } from "../src/modes/components/status-line/segments";
import { renderSegment } from "../src/modes/components/status-line/segments";
import { initTheme, theme } from "../src/modes/theme/theme";
beforeAll(async () => {
await initTheme();
});
function createCtx(usage: Partial<SegmentContext["usageStats"]>): SegmentContext {
return {
session: {
state: {},
isFastModeEnabled: () => false,
modelRegistry: { isUsingOAuth: () => false },
sessionManager: undefined,
} as unknown as SegmentContext["session"],
width: 120,
options: {},
planMode: null,
loopMode: null,
usageStats: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
premiumRequests: 0,
cost: 0,
tokensPerSecond: null,
...usage,
},
contextPercent: 0,
contextWindow: 0,
autoCompactEnabled: false,
subagentCount: 0,
sessionStartTime: Date.now(),
git: {
branch: null,
status: null,
pr: null,
},
};
}
describe("issue #953 cache status line icons", () => {
it("renders cache reads as cache output and cache writes as cache input", () => {
const cacheRead = renderSegment("cache_read", createCtx({ cacheRead: 28_919_910 }));
const cacheWrite = renderSegment("cache_write", createCtx({ cacheWrite: 1_759_992 }));
expect(cacheRead.visible).toBe(true);
expect(cacheRead.content).toContain(theme.icon.cache);
expect(cacheRead.content).toContain(theme.icon.output);
expect(cacheRead.content).not.toContain(theme.icon.input);
expect(cacheWrite.visible).toBe(true);
expect(cacheWrite.content).toContain(theme.icon.cache);
expect(cacheWrite.content).toContain(theme.icon.input);
expect(cacheWrite.content).not.toContain(theme.icon.output);
});
});