Skip to content

feat: preview undo ranges before confirmation#326

Draft
RealKai42 wants to merge 1 commit into
mainfrom
xtr/undo-preview-ui
Draft

feat: preview undo ranges before confirmation#326
RealKai42 wants to merge 1 commit into
mainfrom
xtr/undo-preview-ui

Conversation

@RealKai42
Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue. This change follows a maintainer request to make /undo confirmable in the TUI instead of executing immediately.

Problem

/undo currently withdraws history as soon as the command is submitted. That makes it too easy to remove more conversation context than intended, and there is no visual confirmation step for choosing how many recent prompts should be withdrawn.

What changed

  • Changed /undo to open a TUI-only preview mode instead of calling undoHistory immediately.
  • Added keyboard handling so expands the undo range, narrows it, Enter confirms, and Esc / Ctrl-C / Ctrl-D cancels without touching core state.
  • Rendered the selected undo turn with a compact dark-red preview that respects compaction boundaries and restores the withdrawn prompt into the input box after confirmation.
  • Documented /undo [<count>] in the English and Chinese slash command reference.
  • Added a changeset for the CLI package.

Verification

  • pnpm --filter @moonshot-ai/kimi-code exec tsc --noEmit
  • git diff --check
  • pnpm --dir docs build was attempted but could not run because the docs package dependencies are not installed in this workspace (vitepress: command not found).
  • gen-docs was used for the docs update, but its changelog sync prerequisite script docs/scripts/sync-changelog.mjs is not present in this checkout.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 2, 2026

🦋 Changeset detected

Latest commit: d125bb6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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.

2 participants