Skip to content

fix(tui): 回答済みプロンプト行の消去 + リファクタリング第1〜3弾#62

Merged
takemi-ohama merged 4 commits into
mainfrom
feature/tui-erase-answered-prompts
Jun 12, 2026
Merged

fix(tui): 回答済みプロンプト行の消去 + リファクタリング第1〜3弾#62
takemi-ohama merged 4 commits into
mainfrom
feature/tui-erase-answered-prompts

Conversation

@takemi-ohama

Copy link
Copy Markdown
Contributor

概要

TUI の回答済みプロンプト行の残留・行ずれ修正 (39a29ab) と、それに続くコードベース横断リファクタリング第 1〜3 弾をまとめた PR です。動作変更はありません (バグ修正コミットを除く)。

含まれる変更

fix(tui): 回答済みプロンプト行を全プロンプトで消去 (39a29ab)

  • 回答済みプロンプト行の残留と行ずれを全プロンプト種別で解消

refactor 第1弾 (d9b6340): TUI 中止伝搬の集約

  • 中止伝搬を flow モジュールへ集約し、番兵ラダー・重複ループを排除

refactor 第2弾 (b1b9ad6): TUI 選択ヘルパ整理

  • 選択ヘルパの残ラダー解消とカテゴリ定義の SSoT 化

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 件
  • SSoT 化: RegistryInfo.available_plugins() 新設 (AvailablePlugin 変換 4 箇所を一元化)、env パース共通化、@ref 拒否エラー・Available plugins 表示・git 実行・[name] positional 定義の共通ヘルパ化、レコード更新を dataclasses.replace に統一
  • Pythonic 化: 自前 _deep_copycopy.deepcopy、線形探索 → next()、内包表記 / setdefault / startswith タプル化、_dispatch の if ラダー → 宣言的テーブル + importlib
  • 死蔵コード除去: 到達不能 except (check=True なし subprocess.run への CalledProcessError)、未使用 import / 変数

テスト

  • pytest: 731 passed, 1 skipped (リファクタ前後で同一)
  • ruff check lib/devbase/: All checks passed

🤖 Generated with Claude Code

takemi-ohama and others added 4 commits June 11, 2026 17:30
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 takemi-ohama left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🤖 cross-review | round 1 | codex | APPROVE

修正必須の指摘はありません。

@takemi-ohama takemi-ohama left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🤖 cross-review | round 1 | gemini | APPROVE

設計や全体構造において指摘すべき問題点はありません。PRは全体的に整理されており、リファクタリングとして安全な状態です。

@takemi-ohama takemi-ohama merged commit 7aff48c into main Jun 12, 2026
5 checks passed
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