Skip to content

fix: allow CLI theme config setter - #544

Closed
YoneRai12 wants to merge 1 commit into
mainfrom
codex/fix-theme-config-key-handling
Closed

fix: allow CLI theme config setter#544
YoneRai12 wants to merge 1 commit into
mainfrom
codex/fix-theme-config-key-handling

Conversation

@YoneRai12

Copy link
Copy Markdown
Owner

Motivation

  • themeDEFAULT_CONFIGnormalize_config_key() で受け入れられている一方、非対話の設定経路である parse_config_value()theme 分岐が無く、さらに argparse の選択肢に theme が入っていなかったため、yonerai config set theme ... や自動化経路で設定できない不整合が発生していました。

Description

  • clients/cli/yonerai_cli/config.pyparse_config_value()if key == "theme": ブロックを追加して auto/dark/light/mono を検証するようにしました。
  • clients/cli/yonerai_cli/commands/config.pyCONFIG_KEY_CHOICES"theme" を追加して CLI の config set theme ... が受け付けられるようにしました。
  • 設定レポート出力 (build_config_report) と pretty 表示行に theme を含めるようにして、config show や JSON レポートで確認できるようにしました。
  • 回帰テストを tests/test_cli_theme.py に追加して、直接の設定 API 経路での永続化、無効テーマの拒否、および yonerai config set theme ... --json の CLI 経路をカバーするようにしました。

Testing

  • 単体・回帰テストとして pytest tests/test_cli_theme.py tests/test_cli_command_display_modes.py と選択した tests/test_cli_interactive_v030.py の設定系テスト群を実行し、全テストが成功しました(24 passed)。
  • CLI スモークとして PYTHONPATH=clients/cli python -m yonerai_cli config set theme dark --config-path /tmp/yonerai-theme-smoke.json --json を実行し、期待どおり "theme": "dark" が出力され成功しました。
  • 静的チェックとして ruffpython -m compileall を実行し警告・コンパイルエラーは発生しませんでした。
  • 変更行に対する秘密/ローカルパスのスキャンおよび mojibake / hidden-Unicode スキャンを実行し問題は検出されませんでした。

Codex Task

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for a new "theme" configuration option in the CLI client, allowing users to choose between auto, dark, light, or mono themes. It includes validation logic, CLI command integration, and corresponding unit tests. The feedback suggests using the existing theme_from_input helper function within parse_config_value to resolve theme aliases and uppercase inputs, preventing unexpected validation errors when configuring the theme via the CLI.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +209 to +212
if key == "theme":
if raw not in THEMES:
raise ConfigError("theme must be auto, dark, light, or mono.")
return raw

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

parse_config_valuetheme の値を検証する際、raw not in THEMES で直接チェックしているため、ダーク2 などの日本語・数値エイリアス(yonerai_cli/tui/themes.py_THEME_INPUT_ALIASES で定義されているもの)や、大文字表記(DARK など)が受け入れられず、ConfigError が発生してしまいます。

インタラクティブシェルでの /テーマ コマンドや初期設定プロンプトでは theme_from_input を介してエイリアスが正常に解決されるため、CLIの config set 経路でも同様にエイリアスを解決できるように theme_from_input を使用することをお勧めします。モジュール先頭でのインポートは循環参照を引き起こすため、関数内でのローカルインポートが安全です。

    if key == "theme":
        from yonerai_cli.tui.themes import theme_from_input
        normalized = theme_from_input(raw)
        if normalized is None:
            raise ConfigError("theme must be auto, dark, light, or mono.")
        return normalized

@YoneRai12

Copy link
Copy Markdown
Owner Author

Duplicate of #545 for the CLI theme config setter lane.\n\nCurrent classification on 2026-06-28:\n- #544 and #545 touch the same files and implement the same UX fix.\n- Both have the same valid P2 review: route config set theme through the shared heme_from_input alias parser so Japanese/numeric aliases match /テーマ and onboarding.\n- This is not a current P0/P1/security blocker and should not starve the Web-to-CLI sync/security lane.\n\nKeeping #545 as the canonical tracking PR for the theme-config UX fix; closing #544 to avoid duplicate review/merge paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant