Skip to content

feat(cli): add /rename command and show topic title in /resume list#4055

Merged
esengine merged 2 commits into
esengine:main-v2from
Starry0214:feat/cli-rename-session
Jun 12, 2026
Merged

feat(cli): add /rename command and show topic title in /resume list#4055
esengine merged 2 commits into
esengine:main-v2from
Starry0214:feat/cli-rename-session

Conversation

@Starry0214

@Starry0214 Starry0214 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR adds a /rename command to the CLI and makes the /resume picker display session topic titles instead of raw message previews, enabling users to give sessions human-readable names.

Changes

New: /rename command

  • /rename <title> — rename the current session
  • /rename <n> <title> — rename session #n from the /resume list
  • Writes topic_title to the .jsonl.meta sidecar file (shared with desktop UI)
  • Registered in slash-command autocomplete and /help menu
  • i18n strings for English and Chinese

Improved: /resume shows topic titles

  • sessionPickerLabel() now prefers TopicTitle over raw message preview
  • sessionSummary() now prefers TopicTitle over raw message preview
  • Sessions renamed via desktop or CLI will show their custom names in the picker

Files changed (11 files, 167 insertions, 3 deletions)

File Change
internal/agent/branch.go +RenameSession() function
internal/cli/rename.go New file: /rename command implementation
internal/cli/rename_test.go New file: unit tests
internal/cli/resume_picker.go sessionPickerLabel() prefers TopicTitle
internal/cli/resume.go sessionSummary() prefers TopicTitle
internal/cli/chat_tui.go Register /rename in runSlashCommand()
internal/cli/complete.go Add /rename to autocomplete
internal/cli/help_view.go Add /rename to /help menu
internal/i18n/i18n.go Add rename-related i18n fields
internal/i18n/messages_en.go English strings
internal/i18n/messages_zh.go Chinese strings

Test Report

Unit Tests (Go)

=== RUN   TestRenameSessionUpdatesTopicTitle
--- PASS: TestRenameSessionUpdatesTopicTitle (0.00s)
=== RUN   TestSessionPickerLabelShowsTopicTitle
--- PASS: TestSessionPickerLabelShowsTopicTitle (0.00s)
PASS
ok      reasonix/internal/cli    0.164s

Test Coverage

Test What it verifies
TestRenameSessionUpdatesTopicTitle RenameSession() creates/updates .jsonl.meta with correct topic_title field. Tests both initial rename and overwrite.
TestSessionPickerLabelShowsTopicTitle sessionPickerLabel() returns label containing TopicTitle when set, falls back to preview when empty.

Manual Verification

  • Binary compiles successfully: go build ./cmd/reasonix (no errors)
  • Binary contains all expected symbols: RenameSession, runRenameCommand, TopicTitle confirmed via binary inspection
  • Real .jsonl.meta file read/write verified with actual session files

Regression

  • All existing tests pass (3 pre-existing environment-dependent failures unrelated to this change)
  • No changes to existing function signatures or behavior
  • TopicTitle is only used when non-empty; existing sessions without titles continue to show raw previews

Usage

# Start CLI
reasonix chat

# Rename current session
/rename 招标文档审查

# Rename session #3 from the list
/rename 3 发改项目汇报

# View sessions (now with topic titles)
/resume

Rebased on v1.6.0 (commit 83f1e04)

@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development tui Terminal UI / CLI (internal/cli, internal/control) agent Core agent loop (internal/agent, internal/control) labels Jun 11, 2026
@Starry0214 Starry0214 force-pushed the feat/cli-rename-session branch 2 times, most recently from b1306db to 534f2b9 Compare June 12, 2026 01:32
- Add /rename <title> to rename the current session
- Add /rename <n> <title> to rename session #n from the /resume list
- sessionPickerLabel() now prefers TopicTitle over raw preview
- sessionSummary() now prefers TopicTitle over raw preview
- RenameSession() writes topic_title to .jsonl.meta sidecar file
- Add /rename to slash-command autocomplete and /help menu
- Add i18n strings for English and Chinese
- Add unit tests for RenameSession and sessionPickerLabel

Closes #XXXX
@Starry0214 Starry0214 force-pushed the feat/cli-rename-session branch from 534f2b9 to 859fdd0 Compare June 12, 2026 01:36
Restore the mojibake-corrupted "subagent · " hint in help_view.go, drop
the UTF-8 BOM and reformat rename_test.go, and gofmt the i18n field
alignment so the lint check passes. No behavior change.
@esengine

Copy link
Copy Markdown
Owner

Thanks @Starry0214, and welcome — nice first contribution! /rename plus showing topic titles in the /resume picker is a genuinely useful addition, and reusing EnsureBranchMeta/SaveBranchMeta for the sidecar was exactly the right call.

I pushed a small cleanup commit before merging: a few files had picked up Windows-editor encoding artifacts — a mojibake'd "subagent · " hint in help_view.go, a UTF-8 BOM on rename_test.go, and some struct/value alignment gofmt wanted. Restored the string, dropped the BOM, ran gofmt; no behavior change. Tip for next time: gofmt -w ./... (or format-on-save with the Go extension) catches these before CI.

Merging once the checks come back green — thanks again for the contribution!

@esengine esengine merged commit c6fa8aa into esengine:main-v2 Jun 12, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Core agent loop (internal/agent, internal/control) tui Terminal UI / CLI (internal/cli, internal/control) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants