fix(tui): 回答済みプロンプト行の消去 + リファクタリング第1〜3弾#62
Merged
Conversation
questionary の collapse 行 (質問+回答) が Enter/y-n 回答後も画面に残り、 TUI ループの再描画が 1 回答ごとに下へずれていた。erase_when_done を 全 ask (select/text/confirm/path) で立てる _ask_erased ヘルパを新設。 pty + pyte の実 TTY 統合テストを追加 (monkeypatch では検出不能のため)。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- tui/flow.py 新設: 番兵→例外変換 (need/need_optional)、境界デコレータ (collect_args)、共通メニューループ (menu_loop)、optional_int / confirm_or_back を一元化 - actions_*: 約 30 回反復していた None/MENU_BACK 番兵チェック 4 行ラダーを flow.need 1 行に、_run_operation の if-elif チェーンを dict ディスパッチに、 4 ファイル重複の run() ループを flow.menu_loop に統合 - menu.py: text/path の重複収集ループを _collect_stripped に統合、 ナビヒント文言を HINT_BACK/HINT_SEARCH 定数化 - 公開契約 (関数名・戻り値番兵・プロンプト文言・プロンプト順序) は不変。 テスト変更なしで 731 passed / ruff クリーン Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- flow.back_as_cancel 新設: 選択ヘルパに残っていた None/MENU_BACK→ARG_CANCEL 変換ラダー 4 箇所を 1 行化 (env/_select_project, project/_select_build_image, snapshot/_select_snapshot_name×2, plugin/_select_name) - app.py: TOP_CATEGORIES / _LABELS / _route の if-elif で三重持ちだった カテゴリ定義を _CATEGORIES 単一 SSoT から導出。routing は module.run の 遅延解決 dict に (monkeypatch 互換) - actions_plugin: registry 名取得 2 関数を _registry_names(lister) に統合、 空一覧の案内+中止を _select_name へ吸収し wrapper 2 関数を薄い委譲に - actions_env / actions_project: 引数なし操作 (sync/edit/up/rebuild) を dict 直書き lambda に統一 (plugin/snapshot と同形) 公開契約・プロンプト文言・順序は不変。731 passed / ruff クリーン Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
可読性・Pythonic 化・関数行数適正化・メンテナンス性向上を目的とした 横断リファクタリング (動作変更なし、731 tests green / ruff clean)。 - 関数分割: migrate / _install_from_repo / install_plugin / add_repository / refresh_repository / _add_env_parser / generate_scaled_compose / _ensure_images / cmd_up / sync_projects → 100 行超の関数 8 件をゼロに - SSoT 化: RegistryInfo.available_plugins() 新設 (AvailablePlugin 変換 4 箇所を一元化)、env パース共通化 (_parse_env_assignment)、 @ref 拒否エラー・Available plugins 表示・git 実行・[name] positional 定義の共通ヘルパ化、レコード更新を dataclasses.replace に統一 - Pythonic 化: 自前 _deep_copy → copy.deepcopy、線形探索 → next()、 内包表記 / setdefault / startswith タプル化、_dispatch の if ラダー → 宣言的テーブル + importlib - 死蔵コード除去: 到達不能 except、未使用 import / 変数 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
takemi-ohama
commented
Jun 12, 2026
takemi-ohama
left a comment
Contributor
Author
There was a problem hiding this comment.
🤖 cross-review | round 1 | codex | APPROVE
修正必須の指摘はありません。
takemi-ohama
commented
Jun 12, 2026
takemi-ohama
left a comment
Contributor
Author
There was a problem hiding this comment.
🤖 cross-review | round 1 | gemini | APPROVE
設計や全体構造において指摘すべき問題点はありません。PRは全体的に整理されており、リファクタリングとして安全な状態です。
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.
概要
TUI の回答済みプロンプト行の残留・行ずれ修正 (39a29ab) と、それに続くコードベース横断リファクタリング第 1〜3 弾をまとめた PR です。動作変更はありません (バグ修正コミットを除く)。
含まれる変更
fix(tui): 回答済みプロンプト行を全プロンプトで消去 (39a29ab)
refactor 第1弾 (d9b6340): TUI 中止伝搬の集約
refactor 第2弾 (b1b9ad6): TUI 選択ヘルパ整理
refactor 第3弾 (d98b67e): 100行超関数の全解消と重複ロジックの SSoT 化
migrate/_install_from_repo/install_plugin/add_repository/refresh_repository/_add_env_parser/generate_scaled_compose/_ensure_images/cmd_up/sync_projects→ 100 行超の関数 8 件 → 0 件RegistryInfo.available_plugins()新設 (AvailablePlugin 変換 4 箇所を一元化)、env パース共通化、@ref 拒否エラー・Available plugins 表示・git 実行・[name]positional 定義の共通ヘルパ化、レコード更新をdataclasses.replaceに統一_deep_copy→copy.deepcopy、線形探索 →next()、内包表記 /setdefault/startswithタプル化、_dispatchの if ラダー → 宣言的テーブル +importlibcheck=Trueなしsubprocess.runへのCalledProcessError)、未使用 import / 変数テスト
pytest: 731 passed, 1 skipped (リファクタ前後で同一)ruff check lib/devbase/: All checks passed🤖 Generated with Claude Code