fix: インタラクティブプロンプト検出時にtmuxバッファ全体がレスポンスとして保存される (#326)#327
Merged
Conversation
…dLine onwards - Extract resolveExtractionStartIndex() as shared helper for startIndex determination - Fix Location 1 (Claude early prompt detection) to use lastCapturedLine-based extraction - Fix Location 2 (fallback prompt detection) to use lastCapturedLine-based extraction and add stripAnsi() for XSS risk mitigation - Refactor normal response path to use the shared helper (DRY) - Add 12 unit tests covering all 4 branches and edge cases Resolves #326 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract buildPromptExtractionResult() helper to eliminate duplicate prompt extraction logic at two call sites (DRY). Enhance JSDoc for resolveExtractionStartIndex() with detailed parameter docs, branch descriptions, and design policy references. Restructure test file with nested describe blocks aligned to the 4-branch design document terminology. Flatten if-else chain to early-return style for clarity. Quality Metrics: - Coverage: maintained (all 3647 tests pass) - ESLint errors: 0 - TypeScript errors: 0 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
extractResponse()のインタラクティブプロンプト検出時にlastCapturedLine以降の行のみをレスポンスとして返すよう修正し、前の会話内容の混入を防止resolveExtractionStartIndex()ヘルパー関数を抽出してstartIndex決定ロジックを一元化(DRY化)stripAnsi()を追加しXSSリスクを軽減Changes
Bug Fix
stripAnsi(fullOutput)→stripAnsi(lines.slice(startIndex).join('\n'))fullOutput→stripAnsi(lines.slice(startIndex).join('\n'))(stripAnsi()追加)Refactoring
resolveExtractionStartIndex()ヘルパー関数を@internalexportとして追加(4分岐startIndex決定ロジック)resolveExtractionStartIndex()呼び出しに置換buildPromptExtractionResult()ヘルパー関数で重複コードを排除Tests
tests/unit/lib/resolve-extraction-start-index.test.ts新規作成(12テストケース)Quality
Test plan
Closes #326
🤖 Generated with Claude Code