Repository navigation
Description
Friction
devops ai cost report and devops ai cost roi take --days N (the last N days) only. On 2026-10-24 the owner asked for the local AI savings of the first three weeks of October (2026-10-01 to 2026-10-21), and the answer needed a script that copies the ledger, deletes the rows outside the range and calls SpendLedger.get_lifetime_report on the copy.
What should happen
devops ai cost report and devops ai cost roi take --since <date> and --until <date> (ISO dates or datetimes, UTC unless an offset is given), and --by day or --by week gives one row for each period, with requests, local tokens, actual spend, the local cost equivalent at the reference model, and the cloud spend avoided. --days stays as a short form of --since.
Acceptance criteria
-
devops ai cost report --since 2026-10-01 --until 2026-10-22 --by week --jsongives three rows whose sums equal the report of the whole range, with a test on a ledger fixture. - The MCP tool
ai_cost_reporttakes the same range.
Proposed design
Problem statement
The commands devops ai cost report and devops ai cost roi accept only --days N to select a time window. A person who needs a fixed date range, such as 2026-10-01 to 2026-10-21, must copy the ledger, delete rows outside the range, and call SpendLedger.get_lifetime_report on the copy. The commands need --since and --until for an explicit range, and --by day or --by week to group results into one row per period. The MCP tool ai_cost_report must accept the same range.
Acceptance criteria
- Criterion 1: Running
devops ai cost report --since 2026-10-01 --until 2026-10-22 --by week --jsonreturns three rows whose column sums equal the ungrouped report of the same range.
Verification: A test on a ledger fixture asserts that the sum of the three weekly rows equals the sum of the ungrouped report for the same date range. - Criterion 2: Running
devops ai cost roi --since 2026-10-01 --until 2026-10-22 --by week --jsonreturns one row per week with requests, local tokens, actual spend, local cost equivalent, and cloud spend avoided.
Verification: A test on a ledger fixture asserts the column names and the per-week grouping of the ROI output. - Criterion 3: The flag
--days Nstill works and is equivalent to--sinceset to today minus N days.
Verification: A test asserts that--days 7produces the same rows as--sincewith no--until. - Criterion 4: The MCP tool
ai_cost_reportaccepts--since,--until, and--bywith the same semantics as the CLI.
Verification: A test intests/test_fastmcp_contracts.pycallsai_cost_reportwith a date range and a grouping value, and asserts the returned rows match the CLI output for the same range.
Key questions
- Which MCP tool must accept the new range and grouping?: The tool is
ai_cost_report, documented at line 14 and line 243 ofdocs/MCP_TOOLS.md, and referenced intests/test_fastmcp_contracts.py:110. [sources: docs/MCP_TOOLS.md:14, docs/MCP_TOOLS.md:243, tests/test_fastmcp_contracts.py:110] - What is the relationship between
--daysand--once?: The body records that--daysstays as a short form of--since. It is a decision by the issue author. (proposed) - Does this item depend on issue fix(ai): the spend series exists at $0, a gateway call counts as local or hosted by the backend that served it, and the ledger exposition stops reusing the OTLP names #1631?: No. The intake reply states fix(ai): the spend series exists at $0, a gateway call counts as local or hosted by the backend that served it, and the ledger exposition stops reusing the OTLP names #1631 asks for a different change (spend series exposition). They share a theme but fix(ai): the spend series exists at $0, a gateway call counts as local or hosted by the backend that served it, and the ledger exposition stops reusing the OTLP names #1631 is not a prerequisite. (proposed)
Open questions
- What ledger method does the current
--dayspath call? (missing verified source) - What columns appear in each grouped row? (missing verified source)
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Alternatives check of 2026-11-02: partly.
Tool: ccusage/ccusage (https://github.com/ccusage/ccusage), NOASSERTION, last activity 2026-11-02, maintained.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNew
- StatusShow more project fieldsNew
Activity
dan-petty commentedon Oct 24, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones on the board.
The candidate proposes new features for AI cost reporting with date range and grouping options.The feature improves usability of existing AI cost reporting tools but is not critical for core functionality.The feature provides better flexibility in analyzing AI costs over specific time periods, which is valuable for planning and budgeting.Implementing date range options and grouping requires modifying command-line parsing, date handling logic, and report generation code.Both items relate to AI cost reporting and spend ledger functionality, but the candidate adds date range and grouping features while item 1631 fixes issues with spend series exposition.dan-petty commentedon Oct 28, 2026
Refine cannot set this item to Ready at bb46660 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.
--dayspath call? (missing verified source)devops-cli-service commentedon Nov 2, 2026
Alternatives check: partly
Tool: ccusage/ccusage (https://github.com/ccusage/ccusage)
Covers:
--sinceand--untiltake explicit start and end dates and can be combined or used alone.--json, with token counts and cost per period plus a summary of totals.--mode calculate), and week-start control for weekly grouping.Lacks:
devops ai cost report/roiimplementation.ai_cost_reportMCP tool with the CLI's range and grouping semantics, and no--days Nshort form matching the issue's spec.SpendLedger.get_lifetime_report; it is a separate CLI with its own data sources and output schema.Searches run:
Sources:
Checked on 2026-11-02. A person decides what this means for the item. The check changes no label and closes no issue.
[-]feat(ai): devops ai cost report and roi take --since and --until and group by day or week[/-][+]feat(ai): Add --since, --until, and --by to cost report and roi[/+]dan-petty commentedon Nov 6, 2026
The job shortened the title of this item. The summary had 79 characters, and the limit is 60. The type and the scope stay.
feat(ai): devops ai cost report and roi take --since and --until and group by day or weekfeat(ai): Add --since, --until, and --by to cost report and roidevops-cli-service commentedon Nov 9, 2026
Released in v0.103.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.103.0
devops-cli-service commentedon Nov 9, 2026
Live since 2026-11-09 21:49 UTC