Skip to content

Fix #162 インタラクティブモードのスラッシュコマンドを行末でも認識可能にする#406

Open
Yuma-Satake wants to merge 2 commits intonrslib:mainfrom
Yuma-Satake:feature/issue-162
Open

Fix #162 インタラクティブモードのスラッシュコマンドを行末でも認識可能にする#406
Yuma-Satake wants to merge 2 commits intonrslib:mainfrom
Yuma-Satake:feature/issue-162

Conversation

@Yuma-Satake
Copy link
Contributor

@Yuma-Satake Yuma-Satake commented Feb 26, 2026

概要

インタラクティブモードのスラッシュコマンド(/play, /go, /cancel 等)を、行頭だけでなく行末でも認識できるようにした。

変更内容

  • src/shared/constants.tsSlashCommand 定数オブジェクトを追加
  • src/features/interactive/commandMatcher.ts — スラッシュコマンド検出ロジックを新規モジュールとして分離
  • src/features/interactive/conversationLoop.tsmatchSlashCommand を使用するよう変更

確認したこと

  • test/lintのパス

  • 以下の手動チェック(2枚目はチェック用にログ出し)

Screenshot 2026-02-27 at 1 09 55 Screenshot 2026-02-27 at 1 10 12

- スラッシュコマンド検出ロジックを commandMatcher.ts に分離
- 行頭・行末の両方でコマンドを認識し、行中は無視する仕様を実装
- conversationLoop を早期リターン + switch ディスパッチにリファクタリング
- SlashCommand 定数を shared/constants に追加
- コマンドマッチングのユニットテスト36件を追加
- 行末コマンド・行中非認識のE2Eテスト6件を追加

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

差分大きくなっていますが、

  1. 元々前側にあったコマンドの識別機構を切り出し
  2. マッチしていなければ通常のテキストとして扱う処理を前側に移動
  3. コマンド振り分けをswitchに

という内容なので、実際の差分はそこまで大きくありません

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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