Skip to content

feat(update): add interactive menu to /update with auto-update toggle - #134

Merged
elkaix merged 2 commits into
mainfrom
feat/update-auto-submenu
Jun 14, 2026
Merged

feat(update): add interactive menu to /update with auto-update toggle#134
elkaix merged 2 commits into
mainfrom
feat/update-auto-submenu

Conversation

@elkaix

@elkaix elkaix commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Makes the auto-update toggle discoverable from the bare /update command instead of requiring a subcommand. Builds on the /update auto toggle from #133.

  • /update now opens a top-level menu:
    Update
    ❯ Check for updates now
      Auto-update on startup: off
      Cancel
    
    "Check for updates now" is the default, so a bare /update + Enter still goes straight to the check/install flow (one keypress, no regression). "Auto-update on startup" shows the current state and jumps to the On/Off picker.
  • /update auto with no value now opens an interactive On/Off picker (cursor defaulted to the current setting) instead of only printing status.
  • /update auto on|off still sets it directly. When an external override is active (PYTHINKER_CLI_NO_AUTO_UPDATE or a source checkout), the setting is read-only, so /update auto reports that read-only state rather than popping a no-op picker — preserving the "never a silent no-op" rule.

No change to the auto_update default (still on) and run_update_prompt is untouched — this is additive UI only.

Changes

  • src/pythinker_code/ui/shell/slash.pyupdate_command routes bare invocations through a new _prompt_update_action() menu; _auto_update_toggle opens the picker on no-args (non-override); added _prompt_auto_update_selection() reusing the existing ChoiceInput widget.
  • tests/ui_and_conv/test_update_auto_slash.py — menu routing (check / auto / cancel) and picker path (persist + cancel-is-noop). 11 passed.
  • CHANGELOG.md (Unreleased) + docs/en/reference/slash-commands.md.

Verification

  • make check-pythinker-code — ruff + format + pyright clean.
  • uv run pytest tests/ui_and_conv/test_update_auto_slash.py — 11 passed.

Summary by CodeRabbit

Release Notes

  • New Features

    • The /update command now opens an interactive menu to choose between checking for updates or managing the auto-update toggle.
    • /update auto now supports interactive On/Off selection when run without arguments.
  • Improvements

    • Auto-update status shown across settings and info now reflects the effective state.
    • When an external override is active, the auto-update toggle becomes read-only with an explanation (preventing silent no-ops).

Make the auto-update toggle discoverable from the bare `/update` command
instead of requiring the `auto` subcommand:

- `/update` now opens a top-level menu — "Check for updates now" (the
  default, so a bare `/update` + Enter still checks immediately) or
  "Auto-update on startup" with its current state, which jumps to the
  On/Off picker.
- `/update auto` with no value opens an interactive On/Off picker, cursor
  defaulted to the current setting, instead of only printing status.
- `/update auto on|off` still sets it directly; when an external override
  is active the setting is read-only, so `/update auto` reports that state
  rather than popping a no-op picker.

Update slash-command docs and add focused tests for the menu routing and
the picker path.
@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 56476c2c-afe3-4107-a307-da8790cf4d53

📥 Commits

Reviewing files that changed from the base of the PR and between 3c03c18 and 3bfacc5.

📒 Files selected for processing (1)
  • tests/ui_and_conv/test_update_auto_slash.py

📝 Walkthrough

Walkthrough

This PR makes /update interactive when run without arguments, adds interactive /update auto on/off selection with read-only override handling, and updates tests and changelog text to cover the new command paths and state reporting.

Changes

Update command flow

Layer / File(s) Summary
Bare /update menu and routing
src/pythinker_code/ui/shell/slash.py, tests/ui_and_conv/test_update_auto_slash.py
Bare /update now prompts for check/auto/cancel via _prompt_update_action(), routes to update or auto-toggle, or returns on cancel. Tests verify each action path and confirm state preservation via monkeypatched ChoiceInput.
Auto-update toggle with on/off picker
src/pythinker_code/ui/shell/slash.py, tests/ui_and_conv/test_update_auto_slash.py
/update auto supports explicit on|off args, reports effective state read-only when override exists, and prompts interactive on/off via _prompt_auto_update_selection() otherwise. Tests verify persistence, runtime mirroring, and cancellation.
Changelog documentation
CHANGELOG.md
Updated unreleased entry documents /update menu behavior, /update auto interactive modes, and read-only handling when external override is active.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

enhancement

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.69% which is insufficient. The required threshold is 70.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title follows conventional commits format with 'feat' type, 'update' scope, and a clear description of the interactive menu addition for the /update command.
Description check ✅ Passed The description provides comprehensive context: it summarizes changes, details the menu structure, explains the interactive picker behavior, and documents verification steps. All key sections are present and informative.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/update-auto-submenu

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/ui_and_conv/test_update_auto_slash.py`:
- Around line 147-151: Replace the private-helper monkeypatching in
test_update_auto_slash behavior tests with assertions against observable
outcomes: stop patching _prompt_update_action, _auto_update_toggle, and
_prompt_auto_update_selection directly, and instead drive the flow through
run_update_prompt, shell_slash, and the config/user-facing output so the tests
verify interactive choice boundaries, persisted settings, and visible results
rather than internal wiring.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: b3028a3d-e3a5-48a2-813e-6f106bde3ea6

📥 Commits

Reviewing files that changed from the base of the PR and between 7e476c1 and 3c03c18.

⛔ Files ignored due to path filters (1)
  • docs/en/reference/slash-commands.md is excluded by !docs/**
📒 Files selected for processing (3)
  • CHANGELOG.md
  • src/pythinker_code/ui/shell/slash.py
  • tests/ui_and_conv/test_update_auto_slash.py

Comment thread tests/ui_and_conv/test_update_auto_slash.py Outdated
@codecov

codecov Bot commented Jun 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.95238% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/pythinker_code/ui/shell/slash.py 80.95% 5 Missing and 3 partials ⚠️

📢 Thoughts on this report? Let us know!

…helpers

Address review: the /update menu and auto-update picker tests patched the
private _prompt_update_action / _auto_update_toggle / _prompt_auto_update_selection
helpers and asserted internal call wiring. Drive the real helpers by faking only
the interactive ChoiceInput boundary (and stubbing the public run_update_prompt
seam), and assert observable results — persisted/unchanged config, the update
flow running or being skipped, and the picker's default cursor reflecting the
current state.
@elkaix
elkaix merged commit f21a84a into main Jun 14, 2026
38 checks passed
@elkaix
elkaix deleted the feat/update-auto-submenu branch June 14, 2026 00:42
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