Skip to content

Conversation

@Zochory
Copy link
Member

@Zochory Zochory commented Nov 24, 2025

  • Add new messages indicator when not at bottom
  • Improve auto-scroll logic with initial load handling
  • Add smooth scrolling animation and enable/disable controls
  • Include UI elements for better user interaction

Description

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Test addition or update
  • Dependency update

Related Issues

Fixes #
Related to #

Changes Made

Screenshots (if applicable)

Testing

Test Configuration

  • OS: [e.g. macOS 14.0]
  • Terminal: [e.g. iTerm2]
  • Bun Version: [e.g. 1.0.15]

Test Cases

  • Tested basic chat functionality
  • Tested command system
  • Tested mention system
  • Tested keyboard shortcuts
  • Tested with real API endpoint
  • Tested error handling
  • Ran type checking (bun run typecheck)
  • Tested in multiple terminal emulators
  • Other: _______________

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published
  • I have checked my code and corrected any misspellings
  • I have updated the CHANGELOG.md file (if applicable)

Breaking Changes

Additional Notes

Reviewer Checklist

  • Code quality is acceptable
  • Tests are adequate
  • Documentation is updated
  • No security concerns
  • Performance impact is acceptable
  • Breaking changes are justified and documented

chore: update dependencies to latest versions

docs: update workflow integration documentation

fix(af.ts): improve type safety in request info parsing

style: organize imports and improve code formatting

build: update package.json dependencies and resolutions
- Add dracula theme with new color tokens
- Implement theme cycling in command handler
- Add score display to suggestions
- Improve status line and header messaging
- Add syntax highlighting for code blocks
- Implement adaptive text input component
- Add search and tabs to settings menu
- Improve session list with search and actions
- Add tests for new components and features
- Update documentation for new components
- Add new messages indicator when not at bottom
- Improve auto-scroll logic with initial load handling
- Add smooth scrolling animation and enable/disable controls
- Include UI elements for better user interaction
Copilot AI review requested due to automatic review settings November 24, 2025 19:20
@coderabbitai
Copy link

coderabbitai bot commented Nov 24, 2025

Caution

Review failed

The pull request is closed.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Summary by CodeRabbit

Release Notes v0.1.5

  • New Features

    • Added Dracula theme option alongside dark and light themes
    • Introduced session search functionality
    • Enhanced input area with adaptive text expansion and line counting
    • Added visual status indicators for processing and streaming states
    • Improved code block rendering with syntax highlighting in messages
  • Bug Fixes

    • Fixed theme cycling to properly rotate through all available themes
  • Documentation

    • Updated architecture and added component documentation
    • Added comprehensive release notes and changelog entry
  • Chores

    • Updated dependencies for improved compatibility
    • Removed unused telemetry dependency
    • Fixed CI cache key tracking

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

Refactors the app into hook/service modules, adds OpenAPI/Kiota specs and Agent Framework bridge env vars, introduces new UI components (AdaptiveTextInput, PromptOverlay, StatusLine, etc.) and Dracula theme, updates CI/package management for Bun, enhances auto-scroll UI, streaming service, AF parsing, tests, and docs.

Changes

Cohort / File(s) Summary
Config & Packaging
\.env.example, package.json, \.gitignore
Adds AF_BRIDGE_BASE_URL and AF_MODEL to env example; bumps package to 0.1.5 and updates deps (TypeScript, React, OpenTUI), removes telemetry; adds bridge.db to .gitignore.
CI Workflows
.github/workflows/ci.yml, .github/workflows/publish.yml
Switches cache key to bun.lock; CI runs bun test after typecheck; publish workflow cache key updated similarly.
OpenAPI / Kiota
openapi.json, .kiota/apimanifest.json, .kiota/documents/QLAWAPI/openapi.json, .kiota/workspace.json
Adds full OpenAPI 3.1 spec for health/workflow endpoints and Kiota manifest/workspace for SDK generation.
Architecture & Docs
README.md, docs/ARCHITECTURE.md, docs/CHANGELOG.md, docs/releases/v0.1.5.md, docs/AdaptiveTextInput.md, .trae/documents/*
Documents modular hook/service architecture, AdaptiveTextInput, release notes, plans and analyses; README version bump.
Core refactor
src/index.tsx
Replaces monolithic state with hooks/services; composes new components and centralizes command/streaming flows.
Hooks (new)
src/hooks/*
src/hooks/useAppState.ts, src/hooks/useInputMode.ts, src/hooks/useKeyboardShortcuts.ts, src/hooks/useSessions.ts, src/hooks/useSettings.ts, src/hooks/useStreaming.ts
New hooks for app state, input mode/suggestions, keyboard shortcuts, sessions, settings, and streaming with spinner/elapsed handling.
Services (new)
src/services/*
src/services/commandService.ts, src/services/streamingService.ts
Centralized command execution and OpenAI streaming service (SSE parsing, callbacks).
API helpers & AF parsing
src/api.ts, src/af.ts, src/uiHelpers.ts
Adds getOpenAIEnv(), tighten AF payload typing/formatting, and UI helper functions for placeholders/hints.
Themes & types
src/themes.ts, src/types.ts
Adds dracula theme and DRACULA tokens; extends ThemeName; adds optional score to UISuggestion.
New UI components
src/components/*
src/components/AdaptiveTextInput.tsx, src/components/PromptOverlay.tsx, src/components/StatusLine.tsx
New adaptive textarea component, prompt overlay, and status line with exported props/utilities.
Component updates
src/components/*
src/components/Header.tsx, src/components/InputArea.tsx, src/components/MessageList.tsx, src/components/SessionList.tsx, src/components/SettingsMenu.tsx, src/components/SuggestionList.tsx, src/components/WelcomeScreen.tsx
UI/spacing adjustments, workflow-only status rendering, code-block syntax rendering, session search input, tabbed settings, suggestion score display, welcome layout changes.
UI helpers
src/uiHelpers.ts
Adds getSuggestionFooter, getInputPlaceholder, getInputHint.
Auto-scroll & Web UI
web-ui/af-workflows-ui.ts, web-ui/af-workflows-ui.css
initAutoScroll accepts options, supports animated scroll, UI indicator/button, exposes lifecycle and controls; new CSS classes for AF UI.
Tests
tests/*
tests/adaptive-input.test.ts, tests/commandService.test.ts, tests/streamingService.test.ts, tests/theme-cycle.test.ts, tests/web-ui/scroll.test.ts
Adds unit tests for adaptive input, command routing, streaming error handling, theme cycling, and auto-scroll behavior.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI as App (index.tsx)
    participant Hooks as Hooks (useInputMode/useStreaming/useAppState)
    participant Service as Services (commandService/streamingService)
    participant API as OpenAI / AF bridge

    User->>UI: type / submit
    UI->>Hooks: detect mode (useInputMode)
    Hooks-->>UI: suggestions, inputMode

    alt command mode
        UI->>Service: executeCommand(cmd)
        Service-->>UI: CommandResult
    else streaming mode
        UI->>Hooks: useStreaming.streamResponse(...)
        Hooks->>Service: streamResponseFromOpenAI / startWorkflow
        Service->>API: POST /responses or AF bridge
        API-->>Service: SSE chunks / deltas
        Service->>Hooks: onDelta/onError/onDone
        Hooks-->>UI: update assistant message
    end

    UI->>Hooks: setMessages / persist
    Hooks-->>UI: re-render
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

  • Pay extra attention to:
    • src/index.tsx (integration of many new hooks/components)
    • src/hooks/useKeyboardShortcuts.ts and src/hooks/useSettings.ts (keyboard flows, side effects, prompt lifecycle)
    • src/services/streamingService.ts and src/af.ts (SSE parsing, AF payload handling and error paths)
    • Tests for streaming and commandService for flakiness and environment dependencies

Possibly related PRs

  • Handoff #4 — Agent Framework Bridge Integration: directly overlaps AF env vars and AF-related parsing/streaming and workflow UI; likely highly related.

Poem

🐰 I hopped from files to tidy hooks,

I chased the streams through SSE nooks,
Dracula dons the CLI tonight,
Commands now march in single file, polite,
Docs, tests, and themes — a rabbit's delight.

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is largely incomplete, with most required template sections either empty, unchecked, or containing placeholder text without specific details. Complete the template by filling in the Type of Change (select at least one), Related Issues (add issue numbers), Changes Made (list specific changes), Testing section (document tests performed and check relevant boxes), Checklist items (mark completed tasks), and confirm no screenshots are needed or add them.
Docstring Coverage ⚠️ Warning Docstring coverage is 38.24% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'Dev' is vague and generic, using a non-descriptive term that doesn't convey meaningful information about the changeset. Replace with a specific, descriptive title that summarizes the main change, such as 'Enhance auto-scroll with new message indicator and smooth animations' or similar.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6902504 and 50f8c54.

⛔ Files ignored due to path filters (3)
  • bridge.db is excluded by !**/*.db
  • bun.lock is excluded by !**/*.lock
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (49)
  • .env.example (1 hunks)
  • .github/workflows/ci.yml (2 hunks)
  • .github/workflows/publish.yml (1 hunks)
  • .gitignore (2 hunks)
  • .kiota/apimanifest.json (1 hunks)
  • .kiota/documents/QLAWAPI/openapi.json (1 hunks)
  • .kiota/workspace.json (1 hunks)
  • .trae/documents/Integrate Handoff Workflows into QLAW TUI.md (1 hunks)
  • .trae/documents/QLAW CLI Analysis, Cleanup, Docs, Version 0.1.5, QA.md (1 hunks)
  • .trae/documents/QLAW CLI Codebase Analysis + Proposed Improvements.md (1 hunks)
  • README.md (1 hunks)
  • docs/ARCHITECTURE.md (3 hunks)
  • docs/AdaptiveTextInput.md (1 hunks)
  • docs/CHANGELOG.md (1 hunks)
  • docs/releases/v0.1.5.md (1 hunks)
  • openapi.json (1 hunks)
  • package.json (2 hunks)
  • src/af.ts (2 hunks)
  • src/api.ts (1 hunks)
  • src/commandHandlers.ts (1 hunks)
  • src/components/AdaptiveTextInput.tsx (1 hunks)
  • src/components/Header.tsx (2 hunks)
  • src/components/InputArea.tsx (2 hunks)
  • src/components/MessageList.tsx (4 hunks)
  • src/components/PromptOverlay.tsx (1 hunks)
  • src/components/SessionList.tsx (2 hunks)
  • src/components/SettingsMenu.tsx (1 hunks)
  • src/components/StatusLine.tsx (1 hunks)
  • src/components/SuggestionList.tsx (2 hunks)
  • src/components/WelcomeScreen.tsx (1 hunks)
  • src/hooks/useAppState.ts (1 hunks)
  • src/hooks/useInputMode.ts (1 hunks)
  • src/hooks/useKeyboardShortcuts.ts (1 hunks)
  • src/hooks/useSessions.ts (1 hunks)
  • src/hooks/useSettings.ts (1 hunks)
  • src/hooks/useStreaming.ts (1 hunks)
  • src/index.tsx (10 hunks)
  • src/services/commandService.ts (1 hunks)
  • src/services/streamingService.ts (1 hunks)
  • src/themes.ts (2 hunks)
  • src/types.ts (2 hunks)
  • src/uiHelpers.ts (1 hunks)
  • tests/adaptive-input.test.ts (1 hunks)
  • tests/commandService.test.ts (1 hunks)
  • tests/streamingService.test.ts (1 hunks)
  • tests/theme-cycle.test.ts (1 hunks)
  • tests/web-ui/scroll.test.ts (1 hunks)
  • web-ui/af-workflows-ui.css (1 hunks)
  • web-ui/af-workflows-ui.ts (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

- Add debounce utility and apply to file I/O operations to reduce disk writes
- Optimize message updates with direct array indexing instead of O(n) map
- Extract SSE line processing into reusable function to eliminate duplicate code
- Add comprehensive tests for debounce utility
- Document performance optimizations in PERFORMANCE_OPTIMIZATIONS.md
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the qlaw-cli codebase by extracting logic into services and hooks, adds UI improvements (auto-scroll with animation, new messages indicator), introduces a Dracula theme with cycling support, and updates dependencies. The changes improve code organization and maintainability while adding new features.

Key Changes:

  • Extracted streaming, command execution, and UI state management into separate services and hooks
  • Added enhanced auto-scroll functionality with smooth animations and user controls
  • Introduced Dracula theme and theme cycling (dark → light → dracula)

Reviewed changes

Copilot reviewed 48 out of 52 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
web-ui/af-workflows-ui.ts Enhanced auto-scroll with animation, UI controls, and destroy method
web-ui/af-workflows-ui.css Added styles for new messages indicator and scroll button
tests/* New test files for scroll, theme, streaming, command, and adaptive input
src/services/* Extracted streamingService and commandService from index.tsx
src/hooks/* New hooks for streaming, settings, sessions, keyboard, input mode, app state
src/components/* New StatusLine, PromptOverlay, AdaptiveTextInput components
src/index.tsx Refactored to use new hooks and services (498 lines → 117 lines)
src/themes.ts Added DRACULA theme
src/commandHandlers.ts Theme cycling logic updated
src/api.ts Added getOpenAIEnv helper
src/types.ts Added "dracula" to ThemeName, score to UISuggestion
package.json Version bump to 0.1.5, OpenTUI updates, removed applicationinsights
bun.lock Updated dependencies
docs/* New release notes, architecture docs, AdaptiveTextInput docs
openapi.json New OpenAPI specification file
.kiota/* New Kiota configuration files
.gitignore Added bridge.db

{
id: "theme",
label: "Theme",
value: settings.theme === "dark" ? "Dark" : "Light",
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

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

The theme value display logic doesn't account for the new "dracula" theme. When theme is "dracula", it will display "Light" which is incorrect. Update to handle all three theme values: settings.theme === "dark" ? "Dark" : settings.theme === "light" ? "Light" : "Dracula".

Copilot uses AI. Check for mistakes.
? settings.afBridgeBaseUrl
? "Workflow • AF bridge ready"
: "Workflow • AF bridge not set"
: "Standard • Set OPENAI_API_KEY to enable streaming";
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

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

The error message "Standard • Set OPENAI_API_KEY to enable streaming" is misleading. The streaming functionality depends on OPENAI_BASE_URL, OPENAI_API_KEY, and OPENAI_MODEL (all three), not just the API key. Update to: "Standard • Configure OpenAI settings to enable streaming" or similar.

Copilot uses AI. Check for mistakes.
src/index.tsx Outdated
import { SessionList } from "./components/SessionList.tsx";
import { SettingsMenu } from "./components/SettingsMenu.tsx";
import { Header } from "./components/Header.tsx";
// Header component not used
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

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

Dead code comment indicates the Header import is unused but still present. Remove the commented-out import statement entirely: import { Header } from "./components/Header.tsx"; should be deleted.

Copilot uses AI. Check for mistakes.

// Streaming spinner animation
useEffect(() => {
let intervalId: ReturnType<typeof setInterval> | undefined;
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

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

[nitpick] The intervalId type should be Timer | undefined in Bun environments for consistency with Bun's runtime types, though ReturnType<typeof setInterval> works. Consider using the more explicit Timer type from Bun's globals for clarity.

Copilot uses AI. Check for mistakes.
const start = Date.now();
const step = () => {
const t = Math.min(1, (Date.now() - start) / durationMs);
const eased = t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

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

The easing function used here (ease-in-out quad) lacks documentation. Add a comment explaining the easing function: // Ease-in-out quadratic easing for smooth animation.

Copilot uses AI. Check for mistakes.
src/af.ts Outdated
Comment on lines 56 to 60
? ri.data.conversation.filter((m): m is ConversationMessage =>
typeof m === 'object' && m !== null &&
typeof m.role === 'string' &&
typeof m.text === 'string'
typeof (m as ConversationMessage).role === 'string' &&
typeof (m as ConversationMessage).text === 'string'
)
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

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

[nitpick] The type guard uses repeated type assertions (m as ConversationMessage) which could be simplified. Consider using a helper function or destructuring: const { role, text } = m as ConversationMessage; return typeof role === 'string' && typeof text === 'string'.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,160 @@
import { TextAttributes, type TextareaRenderable } from "@opentui/core";
import { createElement, useCallback, useEffect, useMemo, useRef, useState } from "react";
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

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

Unused import createElement.

Suggested change
import { createElement, useCallback, useEffect, useMemo, useRef, useState } from "react";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";

Copilot uses AI. Check for mistakes.
* Handles command/mention detection and suggestion generation
*/

import { useState, useEffect, useMemo } from "react";
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

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

Unused import useMemo.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,28 @@
import { expect, test, describe } from "bun:test";
import { getTheme, DARK, LIGHT, DRACULA } from "../src/themes";
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

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

Unused imports DARK, LIGHT.

Copilot uses AI. Check for mistakes.
@Zochory
Copy link
Member Author

Zochory commented Nov 24, 2025

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Contributor

Copilot AI commented Nov 24, 2025

@Zochory I've opened a new pull request, #10, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits November 24, 2025 20:41
…mports

Co-authored-by: Zochory <60674042+Zochory@users.noreply.github.com>
Address code review feedback: fix theme display, error messages, and unused imports
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 48 out of 52 changed files in this pull request and generated 4 comments.

Comment on lines 67 to 78
// Save current session when messages change
useEffect(() => {
if (currentSessionId && messages.length > 0) {
setSessions((prev) =>
prev.map((s) =>
s.id === currentSessionId
? { ...s, messages, updatedAt: new Date() }
: s
)
);
}
}, [messages, currentSessionId, setSessions]);
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

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

The setSessions dependency in the useEffect hook on line 78 is unnecessary and could cause infinite re-renders. The setSessions function from useState is stable and doesn't need to be in the dependency array. This violates the rules of hooks dependency optimization.

Copilot uses AI. Check for mistakes.
Comment on lines 140 to 144
{
id: "theme",
label: "Theme",
value: settings.theme === "dark" ? "Dark" : settings.theme === "light" ? "Light" : "Dracula",
description: "Toggle dark/light palette",
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

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

Theme cycling now supports "dracula" but the settings UI toggle description still says "Toggle dark/light palette" which is outdated. This should be updated to reflect that there are now three theme options that cycle through dark → light → dracula.

Copilot uses AI. Check for mistakes.
Comment on lines 146 to 150
onActivate: () =>
setSettings((prev) => ({
...prev,
theme: prev.theme === "dark" ? "light" : "dark",
})),
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

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

The theme toggle onActivate function still toggles between only "dark" and "light", but the type system now supports "dracula" as a third option. This creates inconsistent behavior where the user can see "Dracula" as the current value (line 143) but can't cycle to it via the settings toggle. The toggle should implement the same cycling logic as handleThemeCommand (dark → light → dracula → dark).

Copilot uses AI. Check for mistakes.
Comment on lines 52 to 65
// Save settings when changed
useEffect(() => {
saveSettings(settings);
}, [settings]);

// Save sessions when changed
useEffect(() => {
saveSessions(sessions);
}, [sessions]);

// Save custom commands when changed
useEffect(() => {
saveCustomCommands(customCommands);
}, [customCommands]);
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

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

The saveSettings, saveSessions, and saveCustomCommands functions are called directly in the useEffect hooks. Based on the PR description mentioning "debounced" saving was removed, this may cause performance issues as these functions will be called on every state change. If these functions perform file I/O operations, this could lead to excessive writes. Consider using debounced versions as mentioned in the previous implementation.

Copilot uses AI. Check for mistakes.
@Zochory
Copy link
Member Author

Zochory commented Nov 24, 2025

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Contributor

Copilot AI commented Nov 24, 2025

@Zochory I've opened a new pull request, #11, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits November 24, 2025 22:13
Co-authored-by: Zochory <60674042+Zochory@users.noreply.github.com>
Fix hook dependency and performance issues from code review
@Zochory Zochory merged commit 8bf754a into main Nov 25, 2025
6 of 8 checks passed
@Zochory Zochory deleted the dev branch November 25, 2025 19:16
@coderabbitai coderabbitai bot mentioned this pull request Dec 28, 2025
33 tasks
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.

2 participants