Skip to content

Enhance Pair Writing Mode: Add Discuss action and streamline UX#380

Merged
rjroy merged 7 commits intomainfrom
feat/adjust-pair-writing
Jan 21, 2026
Merged

Enhance Pair Writing Mode: Add Discuss action and streamline UX#380
rjroy merged 7 commits intomainfrom
feat/adjust-pair-writing

Conversation

@rjroy
Copy link
Copy Markdown
Owner

@rjroy rjroy commented Jan 21, 2026

Summary

  • Added "Discuss" advisory action for open-ended conversation about selected text
  • Streamlined Quick Action UX by removing toast notifications
  • Refactored prompt building to reduce code duplication and improve maintainability
  • Updated snapshot button styling for better visual distinction

Changes

New Feature: Discuss Action

Added a new advisory action type that enables freeform discussion about selected text:

  • Backend prompt configuration with role and instructions
  • Frontend context menu integration with message bubble icon
  • Consistent with existing advisory actions (Validate, Critique, Compare)

UX Improvements

Removed Toast notifications from Quick Actions:

  • Quick Action confirmations previously showed in toast notifications
  • Now Quick Actions appear directly in the conversation pane via onQuickAction prop
  • Cleaner integration with the shared discussion context
  • Simplified PairWritingEditor component (removed Toast dependency)

Snapshot button visual polish:

  • Changed color from accent to success green (--color-text-success)
  • More intuitive indication that snapshot exists

Code Quality

Refactored prompt building:

  • Consolidated Validate/Critique/Discuss prompts using buildStandardAdvisoryPrompt
  • Extracted shared formatting logic (formatRules)
  • Compare action retains unique structure (before/after comparison)
  • Maintains backward compatibility with exported individual builders

Simplified PairWritingEditor:

  • Removed toast state management and chunk accumulation logic
  • Streamlined response handling with switch statement
  • Cleaner dependency injection (removed ToastComponent prop)
  • Reduced component complexity by 150+ lines

Test Plan

  • All existing tests pass (./git-hooks/pre-commit.sh)
  • Type checking passes across all workspaces
  • Linting passes across all workspaces
  • Discuss action appears in context menu
  • Discuss action sends proper advisory action request
  • Quick Actions no longer show toast notifications
  • Quick Actions appear in conversation history
  • Snapshot button displays with green success color
  • All four advisory actions (Validate, Critique, Compare, Discuss) work correctly

🤖 Generated with Claude Code

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 21, 2026

Codecov Report

❌ Patch coverage is 94.28571% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
backend/src/pair-writing-prompts.ts 89.83% 6 Missing ⚠️
frontend/src/components/PairWritingEditor.tsx 97.22% 1 Missing ⚠️
frontend/src/components/PairWritingMode.tsx 95.65% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Add comprehensive tests for Pair Writing mode features:
- EditorContextMenu: Advisory Actions, Compare action, mode-specific rendering
- PairWritingMode: Action handlers, content tracking, exit confirmation flow

Fix bug where content reload effect fired on local edits, resetting
unsaved changes flag. Now uses ref to detect actual prop changes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@rjroy rjroy merged commit 81d6c74 into main Jan 21, 2026
2 checks passed
@rjroy rjroy deleted the feat/adjust-pair-writing branch January 21, 2026 04:17
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