Skip to content

feat: Add rage-quit CLI command to display terminal inactivity signatures#355

Open
PrathamReddy888 wants to merge 6 commits into
bitflicker64:mainfrom
PrathamReddy888:The-"Rage-Quit"-Signature-🛑-#46

Hidden character warning

The head ref may contain hidden characters: "The-"Rage-Quit"-Signature-\ud83d\uded1-#46"
Open

feat: Add rage-quit CLI command to display terminal inactivity signatures#355
PrathamReddy888 wants to merge 6 commits into
bitflicker64:mainfrom
PrathamReddy888:The-"Rage-Quit"-Signature-🛑-#46

Conversation

@PrathamReddy888

@PrathamReddy888 PrathamReddy888 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR attempts to add a new termstory rage-quit CLI command and formatter, but the feature already exists in v0.6.0 via show_rage_quit() at cli.py:1600-1614. The diff introduces a duplicate command registration and a conflicting formatter signature that would break the existing implementation.

Changes

  • CLI: Adds a duplicate @app.command("rage-quit") registration at cli.py:1564, conflicting with the existing show_rage_quit() handler at cli.py:1600-1614
  • Formatter: Adds a new format_rage_quit_signatures() function at formatter.py:211-278 with signature (signatures, total_events), conflicting with the existing implementation at formatter.py:1833-1874 which expects a single rage_quit_info dict
  • Insights: Removes a blank line at insights.py:649

Architecture / Flow

flowchart LR
  A[CLI: rage-quit command] --> B{Which handler?}
  B --> C[Existing: show_rage_quit at cli.py:1600]
  B --> D[New: rage_quit at cli.py:1564]
  C --> E[analyze_all db]
  D --> F[calculate_rage_quit_signatures sessions]
  E --> G[format_rage_quit_signatures rage_quit_info]
  F --> H[format_rage_quit_signatures signatures total_events]
  G --> I[Output]
  H --> J[Output]
  style C fill:#90EE90
  style D fill:#FFB6C6
  style G fill:#90EE90
  style H fill:#FFB6C6
Loading

Fixes

Breaking Changes

  • Duplicate command registration: Typer will error or shadow one of the two @app.command("rage-quit") handlers
  • Formatter API break: The new format_rage_quit_signatures() has a different signature than the existing one, breaking the call from show_rage_quit()

Testing

# This will fail due to duplicate command registration
termstory rage-quit

Notes

The rage-quit feature is already fully implemented in v0.6.0 with calculate_rage_quit_signatures() in insights.py:685-720, the CLI command show_rage_quit() in cli.py:1600-1614, and the formatter format_rage_quit_signatures() in formatter.py:1833-1874. This PR should be rejected as it introduces conflicts without adding new functionality.

Added a new command 'rage-quit' to analyze terminal session endings.
Adds a function to format rage-quit signatures for CLI display, including emojis based on command types.
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@git-miku git-miku Bot added the needs-triage Awaiting human triage — run /triage to mark as triaged label Jul 24, 2026
@git-miku git-miku Bot added size/S PR changes ~38 lines area/ai area/ai area/cli area/cli area/tui area/tui labels Jul 24, 2026
@git-miku

git-miku Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Tip

👋 Hey @PrathamReddy888 — Miku's on it. Here are the most useful commands for this PR:

💬 Command What it does
:miku /review 🔍 Line-by-line review
:miku /review-sc ✏️ Inline suggested changes
:miku /security 🛡️ Security scan
:miku /perf ⚡ Performance notes
:miku /test 🧪 Test suggestions
:miku /summarize 📝 TL;DR

Note

🎓 This repo is part of ECSOC26. Run :miku /ecsoc to add the ECSOC26 label to this PR.

Note

⭐ Star this repo to unlock all commands. Say :miku /help for the full list.

📖 All commands
🤖 AI-powered — 14 commands
Command Description Works on
:miku /ask <question> Answer a question about the codebase Issues & PRs
:miku /review Full code review (auto-fetches diff) PRs only
:miku /review-sc Post inline suggested-change comments PRs only
:miku /security OWASP security review (injection, auth, crypto…) PRs only
:miku /perf Performance & efficiency analysis PRs only
:miku /docs Generate docstrings for changed code PRs only
:miku /test Suggest unit tests for changed code PRs only
:miku /roast Humorous but constructive code roast 🔥 PRs only
:miku /checklist Smart diff-aware PR checklist PRs only
:miku /summarize TL;DR of this issue or PR Issues & PRs
:miku /explain <target> Explain a file, function, or concept Issues & PRs
:miku /changelog Draft a CHANGELOG entry PRs only
:miku /estimate Story-point effort estimate Issues only
:miku /chat <message> General conversation Issues & PRs
🔧 Issue & PR management — 18 commands
Command Description Works on
:miku /assign [@user] Assign to yourself or another user Issues & PRs
:miku /unassign [@user] Remove yourself or another user Issues & PRs
:miku /label <name> Add a label Issues & PRs
:miku /remove-label <name> Remove a label Issues & PRs
:miku /close [reason] Close this issue or PR Issues & PRs
:miku /reopen Reopen a closed issue or PR Issues & PRs
:miku /approve [message] Submit an approving review on a PR PRs only
:miku /retitle <new title> Change the title Issues & PRs
:miku /duplicate #N Mark as duplicate of #N and close Issues & PRs
:miku /milestone [name] Set or list open milestones Issues & PRs
:miku /ship [version] Mark PR as shipped / deployed PRs only
:miku /lock [reason] Lock conversation (resolved / off-topic / spam) Issues & PRs
:miku /unlock Unlock conversation Issues & PRs
:miku /cc @user1 [@user2] Request reviews PRs only
:miku /lgtm [cancel] Signal "Looks Good To Me" Issues & PRs
:miku /hold [cancel] Block merge; :miku /hold cancel releases it Issues & PRs
:miku /wip Toggle WIP (converts PR to draft) Issues & PRs
:miku /merge Merge this PR (CI + approval required) PRs only
🎉 Community & utility — 9 commands
Command Description Works on
:miku /vote Open a 👍 👎 🚀 reaction poll Issues & PRs
:miku /kudos @user [msg] Give public kudos to a contributor Issues & PRs
:miku /stats Repo stars, forks, top contributors Issues & PRs
:miku /remind <dur> <msg> Schedule a reminder (e.g. 2h, 30m, 1d) Issues & PRs
:miku /size Show PR size breakdown PRs only
:miku /ping [@user ...] Ping contributors with an AI message Issues & PRs
:miku /joke Tell a programming joke Issues & PRs
:miku /shrug Add ¯_(ツ)_/¯ label Issues & PRs
:miku /help Show this message Issues & PRs

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds rage-quit signature formatting and Typer command handlers that analyze non-legacy sessions, calculate signatures, and print formatted results. The CLI module also contains duplicate rage-quit command registrations and duplicate formatter declarations.

Changes

Rage-quit signatures

Layer / File(s) Summary
Signature output formatting
termstory/formatter.py
Adds formatting for empty or populated signature results, including totals, up to 10 entries, percentages, command emojis, and an explanatory footer.
Rage-quit command flow
termstory/insights.py, termstory/cli.py
Adds handlers that load configured sessions, exclude legacy sessions, calculate signatures, format output, and print through the console; termstory/cli.py contains two rage-quit registrations.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant Database
  participant SignatureCalculator
  participant Formatter
  participant Console
  CLI->>Database: Retrieve sessions
  CLI->>CLI: Filter legacy sessions
  CLI->>SignatureCalculator: Calculate signatures and total events
  CLI->>Formatter: Format signature results
  CLI->>Console: Print formatted output
Loading

Suggested reviewers: bitflicker64, ayush-0918

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR adds the requested termstory rage-quit command and computes rage-quit signatures from session data as described in #46.
Out of Scope Changes check ✅ Passed The changes are focused on the rage-quit CLI feature and related formatting, with no clear unrelated additions.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Title check ✅ Passed The title clearly summarizes the main change: adding a rage-quit CLI command for terminal inactivity signatures.
Description check ✅ Passed The description is related to the changeset and discusses the rage-quit CLI, formatter, and insights updates.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@PrathamReddy888

Copy link
Copy Markdown
Contributor Author

:miku /ecsoc

@git-miku git-miku Bot added the ECSoC26 label Jul 24, 2026
@git-miku

git-miku Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

miku /ecsoc

🏷️ Added ECSOC26.

@coderabbitai coderabbitai 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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@termstory/formatter.py`:
- Around line 211-213: Remove the duplicate format_rage_quit_signatures
definition so the canonical two-argument API remains available to
termstory/insights.py. Update or rename the legacy implementation and all of its
callers consistently, preserving the expected formatting behavior without
allowing the later definition to shadow the two-argument function.
- Around line 264-266: Update the rage-quit report formatting around the command
output so command text cannot be interpreted as Rich markup. Escape command
before interpolating it into the output line, or ensure the corresponding print
operation disables markup while preserving the existing report formatting.

In `@termstory/insights.py`:
- Around line 671-675: Update the flow around calculate_rage_quit_signatures so
it also evaluates the final session’s end time against the current time, adding
the ongoing 12+ hour inactivity gap to the result before
format_rage_quit_signatures runs. Preserve the existing adjacent-session
calculations and output structure.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8cb43ba5-0f3b-4aa3-84fd-99ceb377029b

📥 Commits

Reviewing files that changed from the base of the PR and between 568268e and c2bccf1.

📒 Files selected for processing (3)
  • termstory/cli.py
  • termstory/formatter.py
  • termstory/insights.py
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Greptile Review
⚠️ CI failures not shown inline (10)

GitHub Actions: CI / Test (Python 3.10): feat: Add rage-quit CLI command to display terminal inactivity signatures

Conclusion: failure

View job details

##[group]Run python -m pytest tests/ \
 �[36;1mpython -m pytest tests/ \�[0m
 �[36;1m  --tb=short \�[0m
 �[36;1m  -q \�[0m
 �[36;1m  --ignore=tests/stress \�[0m
 �[36;1m  --ignore=tests/poc_debounced.py \�[0m
 �[36;1m  -x \�[0m
 �[36;1m  --timeout=60�[0m
 shell: /usr/bin/bash -e {0}
 env:
   pythonLocation: /opt/hostedtoolcache/Python/3.10.20/x64
   PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.10.20/x64/lib/pkgconfig
   Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.20/x64
   Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.20/x64
   Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.20/x64
   LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.10.20/x64/lib
 ##[endgroup]
 ==================================== ERRORS ====================================
 _________________ ERROR collecting tests/test_expert_resize.py _________________
 tests/test_expert_resize.py:3: in <module>
     from termstory.tui import TermStoryWorkspace
 termstory/tui.py:54: in <module>
     from termstory.insights import calculate_focus_score, calculate_time_of_day_distribution, assign_daily_rpg_class
 termstory/insights.py:650: in <module>
     `@app.command`("rage-quit")
 E   NameError: name 'app' is not defined
 =========================== short test summary info ============================
 ERROR tests/test_expert_resize.py - NameError: name 'app' is not defined
 !!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
 1 error in 0.76s
 ##[error]Process completed with exit code 1.

GitHub Actions: CI / 0_Test (Python 3.10).txt: feat: Add rage-quit CLI command to display terminal inactivity signatures

Conclusion: failure

View job details

##[group]Run python -m pytest tests/ \
 �[36;1mpython -m pytest tests/ \�[0m
 �[36;1m  --tb=short \�[0m
 �[36;1m  -q \�[0m
 �[36;1m  --ignore=tests/stress \�[0m
 �[36;1m  --ignore=tests/poc_debounced.py \�[0m
 �[36;1m  -x \�[0m
 �[36;1m  --timeout=60�[0m
 shell: /usr/bin/bash -e {0}
 env:
   pythonLocation: /opt/hostedtoolcache/Python/3.10.20/x64
   PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.10.20/x64/lib/pkgconfig
   Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.20/x64
   Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.20/x64
   Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.20/x64
   LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.10.20/x64/lib
 ##[endgroup]
 ==================================== ERRORS ====================================
 _________________ ERROR collecting tests/test_expert_resize.py _________________
 tests/test_expert_resize.py:3: in <module>
     from termstory.tui import TermStoryWorkspace
 termstory/tui.py:54: in <module>
     from termstory.insights import calculate_focus_score, calculate_time_of_day_distribution, assign_daily_rpg_class
 termstory/insights.py:650: in <module>
     `@app.command`("rage-quit")
 E   NameError: name 'app' is not defined
 =========================== short test summary info ============================
 ERROR tests/test_expert_resize.py - NameError: name 'app' is not defined
 !!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
 1 error in 0.76s
 ##[error]Process completed with exit code 1.

GitHub Actions: CI / Test (Python 3.11): feat: Add rage-quit CLI command to display terminal inactivity signatures

Conclusion: failure

View job details

##[group]Run python -m pytest tests/ \
 �[36;1mpython -m pytest tests/ \�[0m
 �[36;1m  --tb=short \�[0m
 �[36;1m  -q \�[0m
 �[36;1m  --ignore=tests/stress \�[0m
 �[36;1m  --ignore=tests/poc_debounced.py \�[0m
 �[36;1m  -x \�[0m
 �[36;1m  --timeout=60�[0m
 shell: /usr/bin/bash -e {0}
 env:
   pythonLocation: /opt/hostedtoolcache/Python/3.11.15/x64
   PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.11.15/x64/lib/pkgconfig
   Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.15/x64
   Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.15/x64
   Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.15/x64
   LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.11.15/x64/lib
 ##[endgroup]
 ==================================== ERRORS ====================================
 _________________ ERROR collecting tests/test_expert_resize.py _________________
 tests/test_expert_resize.py:3: in <module>
     from termstory.tui import TermStoryWorkspace
 termstory/tui.py:54: in <module>
     from termstory.insights import calculate_focus_score, calculate_time_of_day_distribution, assign_daily_rpg_class
 termstory/insights.py:650: in <module>
     `@app.command`("rage-quit")
      ^^^
 E   NameError: name 'app' is not defined
 =========================== short test summary info ============================
 ERROR tests/test_expert_resize.py - NameError: name 'app' is not defined
 !!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
 1 error in 0.74s
 ##[error]Process completed with exit code 1.

GitHub Actions: CI / Test (Python 3.9): feat: Add rage-quit CLI command to display terminal inactivity signatures

Conclusion: failure

View job details

##[group]Run python -m pytest tests/ \
 �[36;1mpython -m pytest tests/ \�[0m
 �[36;1m  --tb=short \�[0m
 �[36;1m  -q \�[0m
 �[36;1m  --ignore=tests/stress \�[0m
 �[36;1m  --ignore=tests/poc_debounced.py \�[0m
 �[36;1m  -x \�[0m
 �[36;1m  --timeout=60�[0m
 shell: /usr/bin/bash -e {0}
 env:
   pythonLocation: /opt/hostedtoolcache/Python/3.9.25/x64
   PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.25/x64/lib/pkgconfig
   Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.25/x64
   Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.25/x64
   Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.25/x64
   LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.25/x64/lib
 ##[endgroup]
 ==================================== ERRORS ====================================
 _________________ ERROR collecting tests/test_expert_resize.py _________________
 tests/test_expert_resize.py:3: in <module>
     from termstory.tui import TermStoryWorkspace
 termstory/tui.py:54: in <module>
     from termstory.insights import calculate_focus_score, calculate_time_of_day_distribution, assign_daily_rpg_class
 termstory/insights.py:650: in <module>
     `@app.command`("rage-quit")
 E   NameError: name 'app' is not defined
 =========================== short test summary info ============================
 ERROR tests/test_expert_resize.py - NameError: name 'app' is not defined
 !!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
 1 error in 0.72s
 ##[error]Process completed with exit code 1.

GitHub Actions: CI / 1_Test (Python 3.11).txt: feat: Add rage-quit CLI command to display terminal inactivity signatures

Conclusion: failure

View job details

##[group]Run python -m pytest tests/ \
 �[36;1mpython -m pytest tests/ \�[0m
 �[36;1m  --tb=short \�[0m
 �[36;1m  -q \�[0m
 �[36;1m  --ignore=tests/stress \�[0m
 �[36;1m  --ignore=tests/poc_debounced.py \�[0m
 �[36;1m  -x \�[0m
 �[36;1m  --timeout=60�[0m
 shell: /usr/bin/bash -e {0}
 env:
   pythonLocation: /opt/hostedtoolcache/Python/3.11.15/x64
   PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.11.15/x64/lib/pkgconfig
   Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.15/x64
   Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.15/x64
   Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.15/x64
   LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.11.15/x64/lib
 ##[endgroup]
 ==================================== ERRORS ====================================
 _________________ ERROR collecting tests/test_expert_resize.py _________________
 tests/test_expert_resize.py:3: in <module>
     from termstory.tui import TermStoryWorkspace
 termstory/tui.py:54: in <module>
     from termstory.insights import calculate_focus_score, calculate_time_of_day_distribution, assign_daily_rpg_class
 termstory/insights.py:650: in <module>
     `@app.command`("rage-quit")
      ^^^
 E   NameError: name 'app' is not defined
 =========================== short test summary info ============================
 ERROR tests/test_expert_resize.py - NameError: name 'app' is not defined
 !!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
 1 error in 0.74s
 ##[error]Process completed with exit code 1.

GitHub Actions: CI / Test (Python 3.12): feat: Add rage-quit CLI command to display terminal inactivity signatures

Conclusion: failure

View job details

##[group]Run python -m pytest tests/ \
 �[36;1mpython -m pytest tests/ \�[0m
 �[36;1m  --tb=short \�[0m
 �[36;1m  -q \�[0m
 �[36;1m  --ignore=tests/stress \�[0m
 �[36;1m  --ignore=tests/poc_debounced.py \�[0m
 �[36;1m  -x \�[0m
 �[36;1m  --timeout=60�[0m
 shell: /usr/bin/bash -e {0}
 env:
   pythonLocation: /opt/hostedtoolcache/Python/3.12.13/x64
   PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.12.13/x64/lib/pkgconfig
   Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.13/x64
   Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.13/x64
   Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.13/x64
   LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.13/x64/lib
 ##[endgroup]
 ==================================== ERRORS ====================================
 _________________ ERROR collecting tests/test_expert_resize.py _________________
 tests/test_expert_resize.py:3: in <module>
     from termstory.tui import TermStoryWorkspace
 termstory/tui.py:54: in <module>
     from termstory.insights import calculate_focus_score, calculate_time_of_day_distribution, assign_daily_rpg_class
 termstory/insights.py:650: in <module>
     `@app.command`("rage-quit")
      ^^^
 E   NameError: name 'app' is not defined
 =========================== short test summary info ============================
 ERROR tests/test_expert_resize.py - NameError: name 'app' is not defined
 !!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
 1 error in 0.78s
 ##[error]Process completed with exit code 1.

GitHub Actions: CI / 2_Test (Python 3.12).txt: feat: Add rage-quit CLI command to display terminal inactivity signatures

Conclusion: failure

View job details

##[group]Run python -m pytest tests/ \
 �[36;1mpython -m pytest tests/ \�[0m
 �[36;1m  --tb=short \�[0m
 �[36;1m  -q \�[0m
 �[36;1m  --ignore=tests/stress \�[0m
 �[36;1m  --ignore=tests/poc_debounced.py \�[0m
 �[36;1m  -x \�[0m
 �[36;1m  --timeout=60�[0m
 shell: /usr/bin/bash -e {0}
 env:
   pythonLocation: /opt/hostedtoolcache/Python/3.12.13/x64
   PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.12.13/x64/lib/pkgconfig
   Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.13/x64
   Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.13/x64
   Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.13/x64
   LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.13/x64/lib
 ##[endgroup]
 ==================================== ERRORS ====================================
 _________________ ERROR collecting tests/test_expert_resize.py _________________
 tests/test_expert_resize.py:3: in <module>
     from termstory.tui import TermStoryWorkspace
 termstory/tui.py:54: in <module>
     from termstory.insights import calculate_focus_score, calculate_time_of_day_distribution, assign_daily_rpg_class
 termstory/insights.py:650: in <module>
     `@app.command`("rage-quit")
      ^^^
 E   NameError: name 'app' is not defined
 =========================== short test summary info ============================
 ERROR tests/test_expert_resize.py - NameError: name 'app' is not defined
 !!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
 1 error in 0.78s
 ##[error]Process completed with exit code 1.

GitHub Actions: CI / 3_Test (Python 3.9).txt: feat: Add rage-quit CLI command to display terminal inactivity signatures

Conclusion: failure

View job details

##[group]Run python -m pytest tests/ \
 �[36;1mpython -m pytest tests/ \�[0m
 �[36;1m  --tb=short \�[0m
 �[36;1m  -q \�[0m
 �[36;1m  --ignore=tests/stress \�[0m
 �[36;1m  --ignore=tests/poc_debounced.py \�[0m
 �[36;1m  -x \�[0m
 �[36;1m  --timeout=60�[0m
 shell: /usr/bin/bash -e {0}
 env:
   pythonLocation: /opt/hostedtoolcache/Python/3.9.25/x64
   PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.25/x64/lib/pkgconfig
   Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.25/x64
   Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.25/x64
   Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.25/x64
   LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.25/x64/lib
 ##[endgroup]
 ==================================== ERRORS ====================================
 _________________ ERROR collecting tests/test_expert_resize.py _________________
 tests/test_expert_resize.py:3: in <module>
     from termstory.tui import TermStoryWorkspace
 termstory/tui.py:54: in <module>
     from termstory.insights import calculate_focus_score, calculate_time_of_day_distribution, assign_daily_rpg_class
 termstory/insights.py:650: in <module>
     `@app.command`("rage-quit")
 E   NameError: name 'app' is not defined
 =========================== short test summary info ============================
 ERROR tests/test_expert_resize.py - NameError: name 'app' is not defined
 !!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
 1 error in 0.72s
 ##[error]Process completed with exit code 1.

GitHub Actions: CI / Lint: feat: Add rage-quit CLI command to display terminal inactivity signatures

Conclusion: failure

View job details

##[group]Run ruff check termstory/ --output-format=github || true
 �[36;1mruff check termstory/ --output-format=github || true�[0m
 shell: /usr/bin/bash -e {0}
 env:
   pythonLocation: /opt/hostedtoolcache/Python/3.11.15/x64
   PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.11.15/x64/lib/pkgconfig
   Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.15/x64
   Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.15/x64
   Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.15/x64
   LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.11.15/x64/lib
 ##[endgroup]
 ##[error]termstory/ai.py:1:1: I001 Import block is un-sorted or un-formatted

GitHub Actions: CI / 4_Lint.txt: feat: Add rage-quit CLI command to display terminal inactivity signatures

Conclusion: failure

View job details

##[group]Run ruff check termstory/ --output-format=github || true
 �[36;1mruff check termstory/ --output-format=github || true�[0m
 shell: /usr/bin/bash -e {0}
 env:
   pythonLocation: /opt/hostedtoolcache/Python/3.11.15/x64
   PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.11.15/x64/lib/pkgconfig
   Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.15/x64
   Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.15/x64
   Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.15/x64
   LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.11.15/x64/lib
 ##[endgroup]
 ##[error]termstory/ai.py:1:1: I001 Import block is un-sorted or un-formatted
🧰 Additional context used
📓 Path-based instructions (1)
termstory/*.py

📄 CodeRabbit inference engine (termstory/AGENTS.md)

Follow the existing project structure and naming conventions when adding features.

Files:

  • termstory/cli.py
  • termstory/insights.py
  • termstory/formatter.py
🪛 GitHub Actions: CI / 0_Test (Python 3.10).txt
termstory/insights.py

[error] 650-650: Pytest import failed with NameError: name 'app' is not defined at decorator @app.command("rage-quit").

🪛 GitHub Actions: CI / 1_Test (Python 3.11).txt
termstory/insights.py

[error] 650-650: Pytest collection failed with NameError: name 'app' is not defined. Error occurs at decorator '@app.command("rage-quit")'.

🪛 GitHub Actions: CI / 2_Test (Python 3.12).txt
termstory/insights.py

[error] 650-650: Pytest failed due to import-time exception. NameError: name 'app' is not defined at decorator '@app.command("rage-quit")'.

🪛 GitHub Actions: CI / 3_Test (Python 3.9).txt
termstory/insights.py

[error] 650-650: Test collection failed: NameError in decorator @app.command("rage-quit"). 'app' is not defined.

🪛 GitHub Actions: CI / Test (Python 3.10)
termstory/insights.py

[error] 650-650: Pytest collection failed with NameError: name 'app' is not defined at decorator @app.command("rage-quit").

🪛 GitHub Actions: CI / Test (Python 3.11)
termstory/insights.py

[error] 650-650: Pytest collection failed with NameError: name 'app' is not defined. Error occurs at decorator @app.command("rage-quit").

🪛 GitHub Actions: CI / Test (Python 3.12)
termstory/insights.py

[error] 650-650: Pytest collection failed with NameError: name 'app' is not defined at decorator @app.command("rage-quit").

🪛 GitHub Actions: CI / Test (Python 3.9)
termstory/insights.py

[error] 650-650: pytest collection failed with NameError: name 'app' is not defined. Error occurred at decorator @app.command("rage-quit") in termstory/insights.py.

🔇 Additional comments (2)
termstory/cli.py (1)

384-384: LGTM!

termstory/insights.py (1)

657-664: 🩺 Stability & Availability

Verify that the shared database bootstrap runs for this command.

Unlike the existing termstory/cli.py flow, this handler does not call safe_init_db(db) or run_ingestion(db) before querying sessions. If no app-level callback supplies those steps, first-run execution can fail on an uninitialized schema and normal runs can omit newly ingested data. Confirm the shared bootstrap or add it here.

Comment thread termstory/formatter.py
Comment thread termstory/formatter.py
Comment thread termstory/insights.py Outdated
@greptile-apps

greptile-apps Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a duplicate rage-quit CLI command and a duplicate format_rage_quit_signatures formatter, both of which conflict with fully-working implementations already shipped in v0.6.0. Due to Python's last-definition-wins rule and Typer/Click's command-name overwriting behaviour, the new code becomes entirely dead — the existing handlers remain active — but the conflicts introduce confusion and leave a latent TypeError trap.

  • cli.py: A second @app.command(\"rage-quit\") handler (rage_quit) is registered before the existing show_rage_quit at line 1627. Because Click overwrites earlier registrations with the same name, show_rage_quit remains the active handler; rage_quit is never reachable. It also skips safe_init_db/run_ingestion and carries an unused ctx parameter.
  • formatter.py: A new format_rage_quit_signatures(signatures, total_events) is inserted at line 211, but the original single-argument definition at line 1972 is loaded last and therefore wins. The new definition is dead code, and any caller that passes two arguments would immediately raise TypeError.
  • insights.py: Only a blank line is removed — no functional change.

Confidence Score: 1/5

Not safe to merge — the PR adds duplicate command and formatter definitions that conflict with fully-working v0.6.0 implementations, leaving dead code and a latent TypeError trap in the codebase.

The new CLI handler and formatter are both shadowed by the existing implementations, making them unreachable dead code. The two-argument call to format_rage_quit_signatures inside the new handler would raise TypeError if the command-shadowing were ever fixed without also resolving the formatter conflict. Combined with the missing database initialisation and ingestion in the new handler, the change introduces multiple layered defects without adding any new user-visible functionality.

Both termstory/cli.py and termstory/formatter.py require attention — cli.py for the duplicate command registration and missing DB setup, and formatter.py for the duplicate and shadowed function definition with an incompatible signature.

Important Files Changed

Filename Overview
termstory/cli.py Adds a duplicate @app.command('rage-quit') handler (rage_quit) that conflicts with the existing show_rage_quit registered at line 1627; the new handler also skips safe_init_db/run_ingestion, uses an unused ctx parameter, and redundantly re-imports symbols already available at module level.
termstory/formatter.py Inserts a second definition of format_rage_quit_signatures with a different signature (signatures, total_events) 1761 lines before the original (rage_quit_info) definition; Python's last-definition-wins rule means the new function is entirely dead code, and any call with the new two-argument signature will raise TypeError against the winning definition.
termstory/insights.py Only removes a blank line between two functions — no functional change in this commit.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[termstory rage-quit] --> B{Typer command lookup}
    B --> C[rage_quit at cli.py:1564 - registered first]
    B --> D[show_rage_quit at cli.py:1627 - registered last wins]
    D --> E[safe_init_db + run_ingestion]
    E --> F[analyze_all db]
    F --> G[format_rage_quit_signatures with rage_quit_info dict]
    G --> H[formatter.py:1972 - original definition wins via last-def rule]
    H --> I[Output rendered correctly]
    C -.->|Dead code - overwritten by D| X[format_rage_quit_signatures with signatures + total_events]
    X -.-> Y[formatter.py:211 - new definition shadowed by :1972]
    style C fill:#FFB6C6
    style X fill:#FFB6C6
    style Y fill:#FFB6C6
    style D fill:#90EE90
    style H fill:#90EE90
    style I fill:#90EE90
Loading

Reviews (4): Last reviewed commit: "Update termstory/cli.py" | Re-trigger Greptile

Comment thread termstory/insights.py Outdated
Comment thread termstory/formatter.py
Comment thread termstory/insights.py Outdated
Comment thread termstory/cli.py Outdated
Comment thread termstory/insights.py Outdated
PrathamReddy888 and others added 3 commits July 24, 2026 08:13
Removed the 'rage-quit' command and its associated logic from insights.py.
Adds a new command 'rage-quit' to analyze terminal session patterns.
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
termstory/cli.py (1)

1564-1565: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Consolidate the duplicate rage-quit command handlers. The later show_rage_quit registration is the active command; the earlier rage_quit handler is shadowed and should be removed or folded into a helper. Keep the safe_init_db / run_ingestion flow in the command path.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@termstory/cli.py` around lines 1564 - 1565, Remove or fold the shadowed
earlier rage_quit handler into a helper, leaving the later show_rage_quit
registration as the sole active rage-quit command. Preserve the safe_init_db and
run_ingestion flow in the retained command path.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@termstory/cli.py`:
- Around line 1584-1590: Update the rage-quit handler to pass the full result
object to format_rage_quit_signatures and print the returned ANSI string via
Text.from_ansi(...). Remove the duplicate app.command("rage-quit") handler so
only one registration remains.

---

Nitpick comments:
In `@termstory/cli.py`:
- Around line 1564-1565: Remove or fold the shadowed earlier rage_quit handler
into a helper, leaving the later show_rage_quit registration as the sole active
rage-quit command. Preserve the safe_init_db and run_ingestion flow in the
retained command path.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f2a9ae23-9445-49a8-a445-23f12817ed92

📥 Commits

Reviewing files that changed from the base of the PR and between 0a3240f and a6680e9.

📒 Files selected for processing (1)
  • termstory/cli.py
📜 Review details
⏰ Context from checks skipped due to timeout. (5)
  • GitHub Check: Greptile Review
  • GitHub Check: Test (Python 3.9)
  • GitHub Check: Test (Python 3.12)
  • GitHub Check: Test (Python 3.11)
  • GitHub Check: Test (Python 3.10)
🧰 Additional context used
📓 Path-based instructions (1)
termstory/*.py

📄 CodeRabbit inference engine (termstory/AGENTS.md)

Follow the existing project structure and naming conventions when adding features.

Files:

  • termstory/cli.py

Comment thread termstory/cli.py
@PrathamReddy888

Copy link
Copy Markdown
Contributor Author

@bitflicker64 Please review and merge

@PrathamReddy888

Copy link
Copy Markdown
Contributor Author

@bitflicker64 Please review and merge soon.

@bitflicker64

Copy link
Copy Markdown
Owner

@greptile review
@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

@bitflicker64 I’ll review the changes in #355.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@bitflicker64

Copy link
Copy Markdown
Owner

/rewrite

@git-miku

git-miku Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

miku /rewrite

✅ PR description rewritten! Check the PR body above.

Preview

Summary

This PR attempts to add a new termstory rage-quit CLI command and formatter, but the feature already exists in v0.6.0 via show_rage_quit() at cli.py:1600-1614. The diff introduces a duplicate command registration and a conflicting formatter signature that would break the existing implementation.

Changes

  • CLI: Adds a duplicate @app.command("rage-quit") registration at cli.py:1564, conflicting with the existing show_rage_quit() handler at cli.py:1600-1614
  • Formatter: Adds a new format_rage_quit_signatures() function at formatter.py:211-278 with signature (signatures, total_events), conflicting with the existing implementation at formatter.py:1833-1874 which expects a single rage_quit_info dict
  • Insights: Removes a blank line at insights.py:649

Architecture / Flow

flowchart LR
  A[CLI: rage-quit command] --> B{Which handler?}
  B --> C[Existing: show_rage_quit at cli.py:1600]
  B --> D[New: rage_quit at cli.py:1564]
  C --> E[analyze_all db]
  D --> F[calculate_rage_quit_signatures sessions]
  E --> G[format_rage_quit_signatures rage_quit_info]
  F --> H[format_rage_quit_signatures signatures total_events]
  G --> I[Output]
  H --> J[Output]
  style C fill:#90EE90
  style D fill:#FFB6C6
  style G fill:#90EE90
  style H fill:#FFB6C6
Loading

Fixes

Breaking Changes

  • Duplicate command registration: Typer will error or shadow one of the two @app.command("rage-quit") handlers
  • Formatter API break: The new format_rage_quit_signatures() has a different signature than the existing one, breaking the call from show_rage_quit()

Testing

# This will fail due to duplicate command registration
termstory rage-quit

Notes

The rage-quit feature is already fully implemented in v0.6.0 with calculate_rage_quit_signatures() in insights.py:685-720, the CLI command show_rage_quit() in cli.py:1600-1614, and the formatter format_rage_quit_signatures() in formatter.py:1833-1874. This PR should be rejected as it introduces conflicts without adding new functionality.

@coderabbitai coderabbitai 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
termstory/cli.py (1)

1576-1584: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Initialize and ingest before loading sessions.

This handler reads the database directly without the safe_init_db(db) and run_ingestion(db) steps used by the existing show_rage_quit() flow at Lines 1630-1634. As a result, rage-quit can report stale results or fail when the database schema has not been initialized.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@termstory/cli.py` around lines 1576 - 1584, Update the handler around
calculate_rage_quit_signatures to call safe_init_db(db) and run_ingestion(db)
immediately after creating the Database, before get_all_sessions(). Match the
initialization and ingestion order used by show_rage_quit(), while preserving
the existing legacy-session filtering and signature calculation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@termstory/cli.py`:
- Around line 1576-1584: Update the handler around
calculate_rage_quit_signatures to call safe_init_db(db) and run_ingestion(db)
immediately after creating the Database, before get_all_sessions(). Match the
initialization and ingestion order used by show_rage_quit(), while preserving
the existing legacy-session filtering and signature calculation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6601da8d-4ff3-49f4-a09f-b0fb90cca18f

📥 Commits

Reviewing files that changed from the base of the PR and between a6680e9 and fabc9a4.

📒 Files selected for processing (1)
  • termstory/cli.py
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Greptile Review
🧰 Additional context used
📓 Path-based instructions (1)
termstory/*.py

📄 CodeRabbit inference engine (termstory/AGENTS.md)

Follow the existing project structure and naming conventions when adding features.

Files:

  • termstory/cli.py
🔇 Additional comments (1)
termstory/cli.py (1)

1565-1590: Remove the duplicate rage-quit handler registration.

The new handler is registered alongside the existing show_rage_quit() command, leaving two handlers for the same CLI command. Remove one registration and retain a single implementation.

@bitflicker64 bitflicker64 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

complete the review suggestion and it looks mergable to me

Comment thread termstory/formatter.py
Comment on lines +211 to +225
def format_rage_quit_signatures(
signatures: List[Dict[str, Any]], total_events: int
) -> str:
"""Format rage-quit signatures for display in the CLI.

Args:
signatures: List of rage-quit signature dictionaries
total_events: Total number of rage-quit events analyzed

Returns:
Formatted string for terminal output
"""
if not signatures:
return (
"😤 No rage-quit signatures found! You're either very"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🚨 Bug: Duplicate format_rage_quit_signatures shadows new 2-arg version

formatter.py now defines format_rage_quit_signatures twice: the new (signatures, total_events) version at line 211 and the pre-existing (rage_quit_info) version at line 1972. Because Python binds the later definition, the module-level name always resolves to the 1-arg version at 1972, so the new function at 211 is dead code. The new command's call format_rage_quit_signatures(signatures, total_events) (cli.py:1589) then passes two positional args to a 1-arg function, raising TypeError at runtime. Remove the duplicate new function and reuse the existing formatter, or rename one of them.

Delete the duplicate function; the feature already exists.:

# Drop the new format_rage_quit_signatures (formatter.py:211-276) entirely.
# The existing formatter at formatter.py:1972 already renders rage-quit
# signatures from the analyze_all() 'rage_quit_info' dict.
  • Apply fix

Check the box to apply the fix or reply for a change | Was this helpful? React with 👍 / 👎

Comment thread termstory/cli.py
Comment on lines +1564 to +1578
@app.command("rage-quit")
def rage_quit(ctx: typer.Context) -> None:
"""Find the most frequent commands before 12+ hour periods of inactivity.

Your "rage-quit" is the command you run before long breaks —
it reveals how you typically end your terminal sessions.
"""
from termstory.config import get_config
from termstory.database import Database
from termstory.formatter import format_rage_quit_signatures
from termstory.insights import calculate_rage_quit_signatures

config = get_config()
db = Database(config.get_db_path())
sessions = db.get_all_sessions()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🚨 Bug: Duplicate @app.command("rage-quit") registration collides

cli.py registers @app.command("rage-quit") twice — the new rage_quit() handler at line 1564 and the pre-existing show_rage_quit() at line 1627. Two commands with the same name collide; Click/Typer keeps only one (the later show_rage_quit), so the new handler is silently shadowed and unreachable, making the whole PR a no-op that risks masking regressions. Remove the new duplicate rage_quit() command since show_rage_quit() already implements the feature via analyze_all().

Delete the duplicate command registration.:

# Remove the new command block at cli.py:1564-1590.
# show_rage_quit() at cli.py:1627 already registers 'rage-quit'.
  • Apply fix

Check the box to apply the fix or reply for a change | Was this helpful? React with 👍 / 👎

@gitar-bot

gitar-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown
Code Review 🚫 Blocked 0 resolved / 2 findings

Adds a new rage-quit CLI command and formatter, but fails due to duplicate @app.command("rage-quit") registration collides and duplicate format_rage_quit_signatures shadows new 2-arg version which conflict with existing v0.6.0 implementations.

🚨 Bug: Duplicate format_rage_quit_signatures shadows new 2-arg version

📄 termstory/formatter.py:211-225 📄 termstory/formatter.py:1972-1986 📄 termstory/cli.py:1573 📄 termstory/cli.py:1589

formatter.py now defines format_rage_quit_signatures twice: the new (signatures, total_events) version at line 211 and the pre-existing (rage_quit_info) version at line 1972. Because Python binds the later definition, the module-level name always resolves to the 1-arg version at 1972, so the new function at 211 is dead code. The new command's call format_rage_quit_signatures(signatures, total_events) (cli.py:1589) then passes two positional args to a 1-arg function, raising TypeError at runtime. Remove the duplicate new function and reuse the existing formatter, or rename one of them.

Delete the duplicate function; the feature already exists.
# Drop the new format_rage_quit_signatures (formatter.py:211-276) entirely.
# The existing formatter at formatter.py:1972 already renders rage-quit
# signatures from the analyze_all() 'rage_quit_info' dict.
🚨 Bug: Duplicate @app.command("rage-quit") registration collides

📄 termstory/cli.py:1564-1578 📄 termstory/cli.py:1627-1641

cli.py registers @app.command("rage-quit") twice — the new rage_quit() handler at line 1564 and the pre-existing show_rage_quit() at line 1627. Two commands with the same name collide; Click/Typer keeps only one (the later show_rage_quit), so the new handler is silently shadowed and unreachable, making the whole PR a no-op that risks masking regressions. Remove the new duplicate rage_quit() command since show_rage_quit() already implements the feature via analyze_all().

Delete the duplicate command registration.
# Remove the new command block at cli.py:1564-1590.
# show_rage_quit() at cli.py:1627 already registers 'rage-quit'.
🤖 Prompt for agents
Code Review: Adds a new rage-quit CLI command and formatter, but fails due to duplicate @app.command("rage-quit") registration collides and duplicate format_rage_quit_signatures shadows new 2-arg version which conflict with existing v0.6.0 implementations.

1. 🚨 Bug: Duplicate format_rage_quit_signatures shadows new 2-arg version
   Files: termstory/formatter.py:211-225, termstory/formatter.py:1972-1986, termstory/cli.py:1573, termstory/cli.py:1589

   formatter.py now defines format_rage_quit_signatures twice: the new (signatures, total_events) version at line 211 and the pre-existing (rage_quit_info) version at line 1972. Because Python binds the later definition, the module-level name always resolves to the 1-arg version at 1972, so the new function at 211 is dead code. The new command's call `format_rage_quit_signatures(signatures, total_events)` (cli.py:1589) then passes two positional args to a 1-arg function, raising `TypeError` at runtime. Remove the duplicate new function and reuse the existing formatter, or rename one of them.

   Fix (Delete the duplicate function; the feature already exists.):
   # Drop the new format_rage_quit_signatures (formatter.py:211-276) entirely.
   # The existing formatter at formatter.py:1972 already renders rage-quit
   # signatures from the analyze_all() 'rage_quit_info' dict.

2. 🚨 Bug: Duplicate @app.command("rage-quit") registration collides
   Files: termstory/cli.py:1564-1578, termstory/cli.py:1627-1641

   cli.py registers `@app.command("rage-quit")` twice — the new `rage_quit()` handler at line 1564 and the pre-existing `show_rage_quit()` at line 1627. Two commands with the same name collide; Click/Typer keeps only one (the later `show_rage_quit`), so the new handler is silently shadowed and unreachable, making the whole PR a no-op that risks masking regressions. Remove the new duplicate `rage_quit()` command since `show_rage_quit()` already implements the feature via analyze_all().

   Fix (Delete the duplicate command registration.):
   # Remove the new command block at cli.py:1564-1590.
   # show_rage_quit() at cli.py:1627 already registers 'rage-quit'.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@bitflicker64

Copy link
Copy Markdown
Owner

@greptile review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ai area/ai area/cli area/cli area/tui area/tui ECSoC26 needs-triage Awaiting human triage — run /triage to mark as triaged size/S PR changes ~38 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The "Rage-Quit" Signature 🛑

2 participants