feat: export session to file and import via flag#26514
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces functionality to export and import conversation sessions, addressing issue #23663. By enabling users to persist their chat history to a file and resume it in a new session, this change improves workflow flexibility and session portability without compromising the original data. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request implements session export and import functionality, allowing users to save conversations to JSON files via the /export-session command and resume them using the --session-file flag. Review feedback suggests updating the CliArgs interface to prevent TypeScript compilation errors, reusing the existing Storage instance in the export command to avoid redundancy, and updating session timestamps and persistence logic when importing to maintain UI consistency and history.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request implements session export and import functionality, allowing users to save active conversations to JSON files and resume them via a new CLI flag. The changes include a new /export-session command and logic to handle session restoration while maintaining data isolation. Feedback suggests using object destructuring for more maintainable metadata handling, updating the project hash on import to ensure correct session categorization, and fixing minor indentation issues for better readability.
|
Size Change: +5.81 kB (+0.02%) Total Size: 34 MB
ℹ️ View Unchanged
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces functionality to import and export chat sessions. It adds a new --session-file CLI option to initialize a session from a JSON file and a /export-session slash command to save the current session state. Feedback suggests enforcing mutual exclusivity between the --session-file, --resume, and --session-id flags in the CLI configuration to prevent ambiguous startup behavior.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces functionality to export and import chat sessions. It adds a new /export-session slash command to save the current session to a JSON file and a --session-file CLI flag to initialize a new session from an exported file. The changes include mutual exclusivity logic for session flags, updated session resolution to handle file imports with message filtering, and new UI components to display export status. I have no feedback to provide as no review comments were submitted.
Summary
This PR implements session export to a JSON file and import from a JSON file functionality, resolving issue #23663. It allows users to save their active conversation history and restore it later, even across different worktrees or environments.
Key Features
/export-session <path>to save the current conversation record to a JSON file.--session-file <path>to bootstrap a new session from an exported JSON file./export-sessioncommand and a confirmation message in the history upon successful import.--session-file,--resume, and--session-idflags to prevent ambiguous configurations.Details
ExportSessionMessage.tsxfor real-time export feedback.setPendingItemintoexportSessionCommand.tsfor consistent UI behavior.packages/cli/src/config/config.tswith enhanced validation logic.gemini.tsxto exclude transient system messages (e.g., update notifications) during import.Related Issues
Closes #23663
How to Validate
npm run build).gemini./export-session my-backup.json. Observe the progress spinner.gemini --session-file my-backup.json. Observe history restoration and the "Imported session from..." confirmation message.gemini --resume latest --session-file my-backup.json(Should fail with error message).npm test -w packages/cli.Pre-Merge Checklist