Adds operator-facing `marchwarden costs` subcommand that reads the JSONL ledger from M2.5.2 and pretty-prints a rich summary: - Cost Summary panel: total calls, total spend, total tokens (input/ output split), Tavily search count, warning for any calls with unknown model prices - Per-Day table sorted by date - Per-Model table sorted by model id - Highest-Cost Call panel with trace_id and question Flags: --since ISO date or relative shorthand (7d, 24h, 2w, 1m) --until same --model filter to a specific model_id --json emit raw filtered ledger entries instead of the table --ledger override default path (mostly for tests) Also fixes a Dockerfile gap: the obs/ package added in M2.5.1 was not being COPYed into the image, so the installed `marchwarden` entry point couldn't import it. Tests had been passing because they mounted /app over the install. Adding `COPY obs ./obs` restores parity. Tests cover summary rendering, model filter, since-date filter, JSON output, and the empty-ledger friendly path. 110/110 passing. End-to-end verified against the real cost ledger. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
25 lines
617 B
Docker
25 lines
617 B
Docker
FROM python:3.12-slim
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
|
PIP_NO_CACHE_DIR=1
|
|
|
|
WORKDIR /app
|
|
|
|
# Install build deps separately so the layer caches when source changes.
|
|
COPY pyproject.toml README.md ./
|
|
RUN pip install --upgrade pip
|
|
|
|
# Copy the project and install editable with dev extras.
|
|
COPY cli ./cli
|
|
COPY obs ./obs
|
|
COPY researchers ./researchers
|
|
COPY orchestrator ./orchestrator
|
|
COPY tests ./tests
|
|
RUN pip install -e ".[dev]"
|
|
|
|
# Trace files land here; mount a volume to persist across runs.
|
|
RUN mkdir -p /root/.marchwarden/traces
|
|
|
|
CMD ["pytest", "-q"]
|