Skip to content

Added a /scotty command that displays ASCII art - #197

Closed
EvuhLi wants to merge 7 commits into
CMU-313:mainfrom
EvuhLi:reci-eva
Closed

EvuhLi wants to merge 7 commits into
CMU-313:mainfrom
EvuhLi:reci-eva

Conversation

@EvuhLi

@EvuhLi EvuhLi commented Sep 14, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #2

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

This PR creates a custom /scotty command which displays an ASCII art of scotty. I created a new command in App.tsx and created a new component for it that would be displayed whenever the command was run.

If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!

How did you verify your code works?

Screenshots / recordings

Screenshot 2026-09-14 at 2 31 14 PM

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

EvuhLi added 7 commits August 30, 2026 22:02
The filteredParts predicate was an anonymous closure nested three
levels deep inside Share (For -> filter callback), which qlty
attributed to Share's own complexity/return-count score. Hoisting it
into a standalone function is behavior-preserving and lets the
smells report attribute its 8 early returns to the predicate itself.
The data() memo's cost/token/model reducer loop was inlined directly
inside Share, adding to its complexity score. Extracting it into a
standalone summarizeSession(info, msgs) function is behavior-
preserving (same accumulation logic, iterated with for-of instead of
an indexed loop since the index was never used).
…tton

The floating scroll-to-bottom button's signals, IntersectionObserver
sentinel, checkScrollNeed logic, and its onMount/onCleanup pair were
all inlined in Share, driving most of its remaining complexity.
useScrollButton() encapsulates the same logic unchanged and returns
{ visible, scrollToBottom, onMouseEnter, onMouseLeave } for the JSX
to wire up directly.
Exports the two functions extracted from Share out of Share.tsx and adds
unit tests exercising every branch: each isVisiblePart filter rule (plus
a realistic mixed-part integration case) and summarizeSession's cost/
token/model aggregation, last-write-wins fields, and edge cases around
missing session info or messages.
…seScrollButton

useScrollButton bundled its scroll-visibility decision and repeated
"clear this if it's set" cleanup checks inside one closure, which Qlty
flagged as high complexity (28) after the earlier Share extractions
moved it there. Pulling the pure show/hide predicate and a shared
disposeIfSet(value, dispose) helper out to top-level functions drops
useScrollButton out of the Qlty report entirely (file total complexity
144 -> 126) without introducing a new flagged function. Behavior is
unchanged; only where the branches live changed.
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.

P1B: Refactor (script/translate-app.ts:247): Function with high complexity (count = 23): main

2 participants