Skip to content

feat(usage): implement CLI commands for token tracking#753

Merged
AlexMikhalev merged 1 commit intomainfrom
feat/usage-cli-commands
Apr 3, 2026
Merged

feat(usage): implement CLI commands for token tracking#753
AlexMikhalev merged 1 commit intomainfrom
feat/usage-cli-commands

Conversation

@AlexMikhalev
Copy link
Copy Markdown
Contributor

Summary

  • Fix opendal version mismatch (0.50 -> 0.54) to align with terraphim_persistence
  • Implement 4 CLI commands: History, Export, Alert, Budgets (Show already existed)
  • Fix budget percentage float division, alert highest-threshold match, test data unit corrections
  • All feature-gated with #[cfg(feature = "persistence")] and graceful fallbacks

Changes

File Change
terraphim_usage/Cargo.toml opendal 0.50 -> 0.54, added to persistence feature
terraphim_usage/src/store.rs Fixed opendal 0.54 API (Buffer.to_vec()), chrono type annotations, float budget calc, alert logic, test data
terraphim_usage/src/cli.rs Implemented History/Export/Alert/Budgets commands with #[cfg(feature)] gating
Cargo.lock Lock file update

Verification

  • 19/19 tests passing (cargo test --package terraphim_usage --all-features)
  • Build passes: cargo build --package terraphim-cli --features "usage"
  • Feature gates verified with and without persistence
  • Right-side-of-V verification: GO

Refs: #187

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

Documentation Preview

Your documentation changes have been deployed to:
https://32615e24.terraphim-docs.pages.dev

This preview will be available until the PR is closed.

- Fix LegacyTerm missing #[derive(Deserialize)] in terraphim_automata
- Remove clone_on_copy for u64 IDs in builder.rs, rolegraph, cli, mcp_server
- Replace map_or with is_some_and in rolegraph/medical.rs
- Suppress dead_code warnings on deserialization-only structs in terraphim_usage
- Remove unused imports from terraphim_usage providers
- Replace redundant closures with variant constructors in store.rs
- Remove unnecessary i64-to-i64 cast in ExecutionRecord::duration_ms

Refs #229
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

Documentation Preview

Your documentation changes have been deployed to:
https://963f2e62.terraphim-docs.pages.dev

This preview will be available until the PR is closed.

@AlexMikhalev AlexMikhalev merged commit 29782b6 into main Apr 3, 2026
31 of 33 checks passed
@AlexMikhalev AlexMikhalev deleted the feat/usage-cli-commands branch April 3, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant