Skip to content

feat(cli): add agentplay list --sort before --limit (#64) - #67

Merged
adityajha2005 merged 1 commit into
Entelligence-AI:mainfrom
ShahadatTest:feat/64-list-sort
Nov 2, 2026
Merged

adityajha2005 merged 1 commit into
Entelligence-AI:mainfrom
ShahadatTest:feat/64-list-sort

Conversation

@ShahadatTest

Copy link
Copy Markdown
Contributor

Summary

agentplay list always sorted newest-first before applying --limit, so you could not ask for the most expensive / longest / most-error sessions of a window without --json + jq.

Adds --sort recent|cost|duration|calls|errors (default recent). Sorting happens before --limit. Rows missing the chosen field sort last. Works with --json, --agents, and --since. README flag table updated.

Fixes #64

Test plan

  • pytest python/tests/test_cli_output.py — sort keys apply before limit; missing fields last
  • ruff check on touched files

AI disclosure

Written with help from a Cursor Cloud Agent. I reviewed the diff and ran the tests above.

Allow sorting built sessions by recent, cost, duration, calls, or
errors, applying --limit after the sort so top-N queries work.
Rows missing the sort field come last.

Fixes Entelligence-AI#64

AI assistance: Cursor Cloud Agent helped implement and test this change.

@entelligence-ai-pr-reviews entelligence-ai-pr-reviews Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Entelligence: code quality 5/5 — Excellent.

@entelligence-ai-pr-reviews

Copy link
Copy Markdown

EntelligenceAI PR Summary

Adds agentplay list --sort recent|cost|duration|calls|errors, ordering sessions before --limit and placing rows missing the selected field last. The option works with existing list filters and JSON output, and the README and tests are updated.

flowchart TD
    classDef newBehavior fill:#dcfce7,stroke:#16a34a,color:#14532d;
    A["List sessions"] --> B["Apply filters"]
    B --> C["Sort by selected field"]
    C --> D["Apply limit"]
    D --> E["Print results"]
    class C,D newBehavior;
Loading

🟢 Green = new or changed in this PR


Review Scorecard

Dimension Rating Basis
Code Quality ●●●●● 5/5 — Excellent no critical/significant findings — rated Excellent
Blast Radius Low changed symbols are referenced only within their own file(s); no high-impact surface touched, 2 file(s) / ~32 line(s) changed (size only — not a blast signal)
Merge Confidence ●●●●● 5/5 — Safe to Merge equals code quality; blast radius is shown for context only
Test Coverage — unavailable dependencies failed to install
Security Scan No findings on changed lines SonarQube · Semgrep · TruffleHog on 3 changed files

Safe to merge with a low blast radius; code quality rated Excellent (5/5): the review found nothing to flag.

Key Findings:

  • No critical or significant issues found
Evaluated against
  • 3/3 changed files reviewed
  • criteria: correctness, security & access control, robustness & error handling, concurrency & data integrity, repo conventions / steering docs
  • steering docs: none found in repo
  • PR checks: unit tests (unavailable) · security scan (SonarQube, Semgrep, TruffleHog on 3 changed files)

@entelligence-ai-pr-reviews

Copy link
Copy Markdown

Walkthrough

Adds sorting options to the list CLI command, with sorting applied before the limit and missing selected values placed last. Documents the new behavior and adds regression coverage for all supported sort modes, including newest-first recent sorting.

Changes

Files

  • python/src/agentplay/cli.py
  • python/tests/test_cli_output.py

Added --sort support for list with recent, cost, duration, calls, and errors options. Sessions are sorted before --limit is applied, with missing selected values last; a regression test verifies each sort mode and limit behavior.

Files

  • README.md

Documented the list --sort options and clarified that --limit is applied after sorting.

@adityajha2005

Copy link
Copy Markdown
Contributor

LGTM, thanks @ShahadatTest!

@adityajha2005
adityajha2005 merged commit 943c381 into Entelligence-AI:main Nov 2, 2026
18 checks passed
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.

agentplay list: add --sort cost|duration|calls|errors

2 participants