Repository navigation
refactor: 監査残タスクの完遂(aichat分割・strict復帰・モジュールフラグ化) - #28
Conversation
1602行に9責務が同居していた index.ts を分割: - gemini-client.ts: Gemini API 型・呼び出し・レスポンス解析・ grounding メタデータ整形(hasOwnProperty 連打80行を optional chaining で整理、抽出・整形は純関数化しテスト追加) - prompt.ts: URL/YouTube 抽出・感情的質問の検出・system instruction 構築(3箇所で再発明されていた URL 正規表現を extractUrls に統一) - memory.ts: 人間らしい記憶システム一式(純関数群としてテスト12件。 2箇所に微妙に異なる内容で二重定義されていた話題キーワード辞書を 和集合に統一。memory: any を AiChatMemory 型に。感情キーワードの 出現数計測を生 RegExp 生成から split カウントに変更し、正規表現 メタ文字を含む語での誤動作リスクを排除) - index.ts: フックのオーケストレーションのみ(1497行 → 890行) 挙動修正: - 記憶の system instruction 注入から「直近5件の会話全文」を廃止し、 重要度7以上の長期記憶(最大3件)のみに変更。直近のやり取りは 会話履歴(contents)として既に渡っており、同じ会話が二重に入って トークンを浪費していた - 記憶・引用由来のテキストを <past-memories> 区切りの参考データとして 渡し、指示として解釈しないことを明示(プロンプトインジェクション 対策の残り) - ユーザーごとに10秒のクールダウンを追加(メンション連投による Gemini 呼び出しの暴走・コスト増を防止。上限1000ユーザーのLRU風管理) - 3箇所にコピペされていた記憶初期化を createEmptyMemory に統一 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VZSVuRBBc7STzkdDq31GDM
フォークで strict: false に緩められていた型検査を upstream と同じ strict: true(noImplicitAny: false は upstream 同様維持)に復帰。 今回の監査で見つかったバグ群がすべて型検査をすり抜けていた根本対策。 - lifecycle(install/run/onInit)で初期化されるフィールド17箇所に definite assignment assertion を付与 - ai.api を api<T = unknown>() にジェネリクス化し、chart の as any 11箇所をレスポンス型(利用フィールドのみ定義)で置換 - reminder の catch 節の err 参照を型ガード付きに修正 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VZSVuRBBc7STzkdDq31GDM
src/index.ts で6モジュール(emoji-react / keyword / maze / chart / poll / earthquake_warning)の登録がコメントアウトされ、TODO が散在 していた。全モジュールを登録し、有効/無効は config フラグで制御する 方式に統一(デフォルトは従来どおり無効。mazeEnabled / pollEnabled / emojiReactEnabled / earthquakeWarningEnabled を新設し、keyword / chart は既存フラグを使用)。 有効化したいモジュールは config.json にフラグを追加するだけでよく、 コード変更・再ビルドの diff が発生しなくなる。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VZSVuRBBc7STzkdDq31GDM
- static メソッド1個だけの UserFormatter クラスを関数 export に変更 - emoji モジュールのハードコード応答文を serifs.emoji.intro へ移動 - serifs.poll.result / resultTie の未使用 title 引数を削除 - どこからも参照されていないリポジトリ直下の emoji-list.json を削除 (src/utils/emojilist.json とは別物の未使用データ) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VZSVuRBBc7STzkdDq31GDM
|
Warning Review limit reached
Next review available in: 21 seconds Limit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?Wait for the limit to reset, then comment An organization admin can change what happens after included review limits in Billing. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (30)
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. Comment |
なぜ
PR #27(バグ修正)で意図的に見送った予防的な品質投資を完遂する。方針確認済みのとおり Gemini 専用のまま(OpenAI互換/OpenRouter 対応はしない)。
変更内容
aichat の4ファイル分割(1497行 → 890行 + 純関数モジュール3つ)
gemini-client.ts: API型・呼び出し・レスポンス解析・grounding整形(hasOwnProperty連打80行を optional chaining に)prompt.ts: URL/YouTube抽出・感情検出・system instruction 構築(3箇所で再発明されていたURL正規表現を統一)memory.ts: 記憶システム一式(二重定義されていた話題辞書を統一、memory: anyを型付け、感情キーワード計測の生 RegExp 生成を排除)<past-memories>区切りの参考データとして渡す(プロンプトインジェクション対策の残り)strict: true 復帰
strict: true(noImplicitAny: falseも upstream 同様維持)へ。PR fix: フォーク独自改変部分の監査で見つかった重大バグ群を修正 #27 のバグ群が全部型検査をすり抜けた根本対策ai.api<T>()ジェネリクス化により chart のas any11箇所を型付きにモジュール有効化の config フラグ移行
mazeEnabled/pollEnabled/emojiReactEnabled/earthquakeWarningEnabled(新設、デフォルト無効)と既存フラグで制御。デフォルト挙動は従来と同一小粒整理
emoji-list.json(リポジトリ直下)削除見送り(理由付き)
テスト
tsc --noEmit(strict)・npm run build・npm test全パス🤖 Generated with Claude Code
https://claude.ai/code/session_01VZSVuRBBc7STzkdDq31GDM