feat: Auto-Yesにターミナル出力のStop条件(正規表現)を追加#315
Merged
Conversation
Add terminal output-based stop condition using regex patterns. When the terminal output matches the user-specified pattern, Auto-Yes is automatically disabled with a toast notification. Implementation: - Add safe-regex2 dependency for ReDoS prevention - Add validateStopPattern() with length, safe-regex2, and syntax checks - Add disableAutoYes() centralized disable function with reason tracking - Add checkStopCondition() and executeRegexWithTimeout() for pattern matching - Insert checkStopCondition() into pollAutoYes() pipeline - Add stopPattern to auto-yes/route.ts POST with server-side validation - Add stopReason to current-output/route.ts response - Add worktreeId validation to current-output/route.ts GET handler - Add stop pattern input UI to AutoYesConfirmDialog with real-time validation - Update AutoYesToggle with AutoYesToggleParams object parameter pattern - Update WorktreeDetailRefactored with stopReason toast notification - Add i18n translations (ja/en) for 6 new keys - Add 40+ new test cases across config, manager, and component tests Security: safe-regex2 ReDoS prevention, fixed error messages (XSS), structured logging, isValidWorktreeId() on current-output route Resolves #314 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…used default exports Move AutoYesStopReason type from auto-yes-manager.ts (server-only) to auto-yes-config.ts (shared) for DRY compliance. This eliminates the inline literal union duplication in WorktreeDetailRefactored.tsx and ensures type consistency across server and client components. Remove unused default exports from AutoYesConfirmDialog.tsx and AutoYesToggle.tsx since only named exports are consumed. Improvements: - DRY: AutoYesStopReason defined once in shared config, re-exported for backward compat - Unused code removal: default exports that were never imported - Type safety: client-side CurrentOutputResponse.stopReason now uses shared type Quality Metrics: - ESLint errors: 0 -> 0 - TypeScript errors: 0 -> 0 - Tests: 115/115 passed -> 115/115 passed Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Added auto-yes-config.ts module documentation (MAX_STOP_PATTERN_LENGTH, validateStopPattern, AutoYesStopReason) - Updated auto-yes-manager.ts documentation with Issue #314 new functions (disableAutoYes, checkStopCondition, executeRegexWithTimeout) - Added Issue #314 entry to implementation-history.md - Added design policy, multi-stage review reports, and pm-auto-dev reports Co-Authored-By: Claude Sonnet 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
rm -rf、DROP TABLE、force pushなどの危険な操作への自動応答を防止主な変更点
設定層
auto-yes-config.ts:MAX_STOP_PATTERN_LENGTH=500、validateStopPattern()共通バリデーション、AutoYesStopReason型(クライアント/サーバー共用)ビジネスロジック層
auto-yes-manager.ts:AutoYesStateにstopPattern/stopReasonフィールド追加、disableAutoYes()専用関数、checkStopCondition()独立関数、executeRegexWithTimeout()タイムアウト保護セキュリティ
safe-regex2ライブラリによるReDoSパターン(カタストロフィックバックトラッキング)検出・拒否executeRegexWithTimeout()による同期タイムアウト保護validateStopPattern()のエラーメッセージは固定文字列のみ(XSS防止)current-output/route.tsにisValidWorktreeId()チェック追加API
auto-yes/route.tsPOST:stopPatternバリデーション・受け渡しcurrent-output/route.tsGET:stopReasonフィールド返却UI
AutoYesConfirmDialog: Stop条件入力フィールド(リアルタイムバリデーション)AutoYesToggle:AutoYesToggleParamsオブジェクト引数パターン(ISP/OCP準拠)WorktreeDetailRefactored: Stop条件マッチ時のトースト通知(重複防止)i18n
locales/ja/autoYes.json/locales/en/autoYes.json: 6翻訳キー追加テスト結果
act()not supported in production builds)変更ファイル数
レビュープロセス
dev-reports/design/issue-314-auto-yes-stop-condition-design-policy.mdTest plan
npx vitest run tests/unit/config/auto-yes-config.test.ts tests/unit/lib/auto-yes-manager.test.tsで115テストパス確認npx tsc --noEmitで型エラー0件確認npm run lintでESLintエラー0件確認(a+)+$がバリデーションで拒否されるCloses #314
🤖 Generated with Claude Code